smalruby-editor 0.2.1-x86-mingw32 → 0.2.2-x86-mingw32

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

Potentially problematic release.


This version of smalruby-editor might be problematic. Click here for more details.

Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/LEGAL +4 -3
  3. data/app/assets/javascripts/blocks/character.js.coffee.erb +7 -3
  4. data/app/assets/javascripts/blocks/events.js.coffee.erb +7 -10
  5. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +119 -31
  6. data/app/assets/javascripts/blocks/motion.js.coffee.erb +16 -20
  7. data/app/assets/javascripts/blocks/operators.js.coffee.erb +1 -1
  8. data/app/assets/javascripts/blocks/pen.js.coffee.erb +2 -1
  9. data/app/assets/javascripts/blocks/ruby.js.coffee.erb +3 -3
  10. data/app/assets/javascripts/blocks/sensing.js.coffee.erb +8 -8
  11. data/app/assets/javascripts/blocks/sound.js.coffee.erb +3 -1
  12. data/app/assets/javascripts/fix_blockly.js.erb +105 -0
  13. data/app/assets/javascripts/generators/ruby.js.coffee.erb +3 -0
  14. data/app/assets/javascripts/msg/en_us.js +67 -17
  15. data/app/assets/javascripts/msg/ja.js +151 -95
  16. data/app/assets/javascripts/{smalruby.js.coffee → smalruby.js.coffee.erb} +35 -16
  17. data/app/assets/javascripts/views/character_selector_view.js.coffee +2 -2
  18. data/app/assets/javascripts/views/{load_modal_view.js.coffee → load_modal_view.js.coffee.erb} +8 -2
  19. data/app/assets/javascripts/views/main_menu_view.js.coffee.erb +33 -48
  20. data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +43 -0
  21. data/app/assets/stylesheets/application.css +3 -1
  22. data/app/assets/stylesheets/toolbox.css.scss.erb +2 -56
  23. data/app/assets/stylesheets/toolbox_default.css.scss.erb +34 -0
  24. data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +31 -0
  25. data/app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb +32 -0
  26. data/app/controllers/application_controller.rb +5 -0
  27. data/app/controllers/source_codes_controller.rb +6 -3
  28. data/app/helpers/application_helper.rb +12 -0
  29. data/app/helpers/editor_helper.rb +25 -0
  30. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action.rb +13 -0
  31. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action_with_sec.rb +14 -0
  32. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_ir_photoreflector_value.rb +29 -0
  33. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_led_turn_on_or_off.rb +22 -0
  34. data/app/views/editor/_block_tab.html.haml +7 -6
  35. data/app/views/editor/_reset_modal.html.haml +4 -4
  36. data/app/views/editor/_signin_modal.html.haml +8 -9
  37. data/app/views/editor/_toolbox_default.html.haml +504 -0
  38. data/app/views/editor/_toolbox_smalrubot_s1.html.haml +171 -0
  39. data/app/views/editor/_toolbox_smalrubot_v3.html.haml +177 -0
  40. data/app/views/editor/index.html.haml +12 -2
  41. data/app/views/layouts/application.html.erb +1 -0
  42. data/config/environments/production.rb +1 -0
  43. data/config/locales/en.yml +19 -16
  44. data/config/locales/ja.yml +28 -25
  45. data/demos/hardware_led.rb.xml +79 -79
  46. data/lib/smalruby_editor/config.rb +22 -0
  47. data/lib/smalruby_editor/version.rb +1 -1
  48. data/lib/smalruby_editor.rb +58 -0
  49. data/public/assets/application-71c4890fe0ea2e896fc0acff41cdb0ad.js +39 -0
  50. data/public/assets/application-71c4890fe0ea2e896fc0acff41cdb0ad.js.gz +0 -0
  51. data/public/assets/{application-d5358d75a2c4e570c749b333c59b55ab.css → application-c196e243630d74071981a16041bf391d.css} +1 -1
  52. data/public/assets/application-c196e243630d74071981a16041bf391d.css.gz +0 -0
  53. data/public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js +1 -0
  54. data/public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js.gz +0 -0
  55. data/public/assets/blockly/msg/js/ja-9f676d46458a2802b8f5a797c90ae8a4.js +1 -0
  56. data/public/assets/blockly/msg/js/ja-9f676d46458a2802b8f5a797c90ae8a4.js.gz +0 -0
  57. data/public/assets/manifest-f3d29c6d66b959abe4294a899733e4f0.json +1 -0
  58. data/public/assets/msg/en_us-213fb4a57884078038725a2991776f47.js +1 -0
  59. data/public/assets/msg/en_us-213fb4a57884078038725a2991776f47.js.gz +0 -0
  60. data/public/assets/msg/ja-aeface7456b479021e977a0387204036.js +1 -0
  61. data/public/assets/msg/ja-aeface7456b479021e977a0387204036.js.gz +0 -0
  62. data/public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css +1 -0
  63. data/public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css.gz +0 -0
  64. data/public/assets/toolbox_smalrubot_s1-18d28dc4b99723b60a3f538b742027df.css +1 -0
  65. data/public/assets/toolbox_smalrubot_s1-18d28dc4b99723b60a3f538b742027df.css.gz +0 -0
  66. data/public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css +1 -0
  67. data/public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css.gz +0 -0
  68. data/public/blockly/media/anon.jpeg +0 -0
  69. data/public/blockly/media/handclosed.cur +0 -0
  70. data/public/blockly/media/handdelete.cur +0 -0
  71. data/public/blockly/media/progress.gif +0 -0
  72. data/public/blockly/media/sprites.png +0 -0
  73. data/smalruby-editor.gemspec +2 -1
  74. data/spec/acceptance/base.feature +3 -3
  75. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature +107 -0
  76. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature +151 -0
  77. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_ir_photoreflector_value.feature +100 -0
  78. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +73 -0
  79. data/spec/acceptance/ruby_mode/translate.feature +6 -6
  80. data/spec/acceptance/standalone/save.feature +3 -3
  81. data/spec/acceptance/standalone/signin.feature +1 -2
  82. data/spec/lib/smalruby_editor_spec.rb +21 -11
  83. data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_s1_spec.rb +279 -0
  84. data/vendor/assets/javascripts/blockly/blockly_compressed.js +995 -668
  85. data/vendor/assets/javascripts/blockly/blocks_compressed.js +138 -114
  86. data/vendor/assets/javascripts/blockly/msg/js/en_us.js +6 -6
  87. data/vendor/assets/javascripts/blockly/msg/js/ja.js +42 -28
  88. metadata +66 -25
  89. data/app/assets/javascripts/fix_blockly.js +0 -128
  90. data/app/assets/javascripts/views/signin_modal_view.js.coffee +0 -33
  91. data/app/views/editor/_toolbox.html.haml +0 -496
  92. data/public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js +0 -35
  93. data/public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js.gz +0 -0
  94. data/public/assets/application-d5358d75a2c4e570c749b333c59b55ab.css.gz +0 -0
  95. data/public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js +0 -1
  96. data/public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js.gz +0 -0
  97. data/public/assets/blockly/msg/js/ja-d2cbf808bda8180571bc5f39141a98fe.js +0 -1
  98. data/public/assets/blockly/msg/js/ja-d2cbf808bda8180571bc5f39141a98fe.js.gz +0 -0
  99. data/public/assets/manifest-b1b843b1334b3b973824ab66b1f7a077.json +0 -1
  100. data/public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js +0 -1
  101. data/public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js.gz +0 -0
  102. data/public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js +0 -1
  103. data/public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js.gz +0 -0
  104. data/public/blockly/media/trashbody.png +0 -0
  105. data/public/blockly/media/trashlid.png +0 -0
  106. data/public/blockly/media/tree.png +0 -0
@@ -1,35 +0,0 @@
1
- !function(e,t){function o(e){var t=pt[e]={};return Z.each(e.split(tt),function(e,o){t[o]=!0}),t}function n(e,o,n){if(n===t&&1===e.nodeType){var i="data-"+o.replace(mt,"-$1").toLowerCase();if(n=e.getAttribute(i),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ft.test(n)?Z.parseJSON(n):n}catch(r){}Z.data(e,o,n)}else n=t}return n}function i(e){var t;for(t in e)if(("data"!==t||!Z.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function r(){return!1}function s(){return!0}function l(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function a(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function c(e,t,o){if(t=t||0,Z.isFunction(t))return Z.grep(e,function(e,n){var i=!!t.call(e,n,e);return i===o});if(t.nodeType)return Z.grep(e,function(e){return e===t===o});if("string"==typeof t){var n=Z.grep(e,function(e){return 1===e.nodeType});if(xt.test(t))return Z.filter(t,n,!o);t=Z.filter(t,n)}return Z.grep(e,function(e){return Z.inArray(e,t)>=0===o})}function u(e){var t=Ht.split("|"),o=e.createDocumentFragment();if(o.createElement)for(;t.length;)o.createElement(t.pop());return o}function g(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function h(e,t){if(1===t.nodeType&&Z.hasData(e)){var o,n,i,r=Z._data(e),s=Z._data(t,r),l=r.events;if(l){delete s.handle,s.events={};for(o in l)for(n=0,i=l[o].length;i>n;n++)Z.event.add(t,o,l[o][n])}s.data&&(s.data=Z.extend({},s.data))}}function d(e,t){var o;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),o=t.nodeName.toLowerCase(),"object"===o?(t.parentNode&&(t.outerHTML=e.outerHTML),Z.support.html5Clone&&e.innerHTML&&!Z.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===o&&Yt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===o?t.selected=e.defaultSelected:"input"===o||"textarea"===o?t.defaultValue=e.defaultValue:"script"===o&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(Z.expando))}function p(e){return"undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName("*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll("*"):[]}function f(e){Yt.test(e.type)&&(e.defaultChecked=e.checked)}function m(e,t){if(t in e)return t;for(var o=t.charAt(0).toUpperCase()+t.slice(1),n=t,i=_o.length;i--;)if(t=_o[i]+o,t in e)return t;return n}function y(e,t){return e=t||e,"none"===Z.css(e,"display")||!Z.contains(e.ownerDocument,e)}function _(e,t){for(var o,n,i=[],r=0,s=e.length;s>r;r++)o=e[r],o.style&&(i[r]=Z._data(o,"olddisplay"),t?(!i[r]&&"none"===o.style.display&&(o.style.display=""),""===o.style.display&&y(o)&&(i[r]=Z._data(o,"olddisplay",C(o.nodeName)))):(n=oo(o,"display"),!i[r]&&"none"!==n&&Z._data(o,"olddisplay",n)));for(r=0;s>r;r++)o=e[r],o.style&&(t&&"none"!==o.style.display&&""!==o.style.display||(o.style.display=t?i[r]||"":"none"));return e}function v(e,t,o){var n=uo.exec(t);return n?Math.max(0,n[1]-(o||0))+(n[2]||"px"):t}function E(e,t,o,n){for(var i=o===(n?"border":"content")?4:"width"===t?1:0,r=0;4>i;i+=2)"margin"===o&&(r+=Z.css(e,o+yo[i],!0)),n?("content"===o&&(r-=parseFloat(oo(e,"padding"+yo[i]))||0),"margin"!==o&&(r-=parseFloat(oo(e,"border"+yo[i]+"Width"))||0)):(r+=parseFloat(oo(e,"padding"+yo[i]))||0,"padding"!==o&&(r+=parseFloat(oo(e,"border"+yo[i]+"Width"))||0));return r}function B(e,t,o){var n="width"===t?e.offsetWidth:e.offsetHeight,i=!0,r=Z.support.boxSizing&&"border-box"===Z.css(e,"boxSizing");if(0>=n||null==n){if(n=oo(e,t),(0>n||null==n)&&(n=e.style[t]),go.test(n))return n;i=r&&(Z.support.boxSizingReliable||n===e.style[t]),n=parseFloat(n)||0}return n+E(e,t,o||(r?"border":"content"),i)+"px"}function C(e){if(po[e])return po[e];var t=Z("<"+e+">").appendTo($.body),o=t.css("display");return t.remove(),("none"===o||""===o)&&(no=$.body.appendChild(no||Z.extend($.createElement("iframe"),{frameBorder:0,width:0,height:0})),io&&no.createElement||(io=(no.contentWindow||no.contentDocument).document,io.write("<!doctype html><html><body>"),io.close()),t=io.body.appendChild(io.createElement(e)),o=oo(t,"display"),$.body.removeChild(no)),po[e]=o,o}function k(e,t,o,n){var i;if(Z.isArray(t))Z.each(t,function(t,i){o||Bo.test(e)?n(e,i):k(e+"["+("object"==typeof i?t:"")+"]",i,o,n)});else if(o||"object"!==Z.type(t))n(e,t);else for(i in t)k(e+"["+i+"]",t[i],o,n)}function b(e){return function(t,o){"string"!=typeof t&&(o=t,t="*");var n,i,r,s=t.toLowerCase().split(tt),l=0,a=s.length;if(Z.isFunction(o))for(;a>l;l++)n=s[l],r=/^\+/.test(n),r&&(n=n.substr(1)||"*"),i=e[n]=e[n]||[],i[r?"unshift":"push"](o)}}function A(e,o,n,i,r,s){r=r||o.dataTypes[0],s=s||{},s[r]=!0;for(var l,a=e[r],c=0,u=a?a.length:0,g=e===Mo;u>c&&(g||!l);c++)l=a[c](o,n,i),"string"==typeof l&&(!g||s[l]?l=t:(o.dataTypes.unshift(l),l=A(e,o,n,i,l,s)));return(g||!l)&&!s["*"]&&(l=A(e,o,n,i,"*",s)),l}function T(e,o){var n,i,r=Z.ajaxSettings.flatOptions||{};for(n in o)o[n]!==t&&((r[n]?e:i||(i={}))[n]=o[n]);i&&Z.extend(!0,e,i)}function S(e,o,n){var i,r,s,l,a=e.contents,c=e.dataTypes,u=e.responseFields;for(r in u)r in n&&(o[u[r]]=n[r]);for(;"*"===c[0];)c.shift(),i===t&&(i=e.mimeType||o.getResponseHeader("content-type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){c.unshift(r);break}if(c[0]in n)s=c[0];else{for(r in n){if(!c[0]||e.converters[r+" "+c[0]]){s=r;break}l||(l=r)}s=s||l}return s?(s!==c[0]&&c.unshift(s),n[s]):void 0}function R(e,t){var o,n,i,r,s=e.dataTypes.slice(),l=s[0],a={},c=0;if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),s[1])for(o in e.converters)a[o.toLowerCase()]=e.converters[o];for(;i=s[++c];)if("*"!==i){if("*"!==l&&l!==i){if(o=a[l+" "+i]||a["* "+i],!o)for(n in a)if(r=n.split(" "),r[1]===i&&(o=a[l+" "+r[0]]||a["* "+r[0]])){o===!0?o=a[n]:a[n]!==!0&&(i=r[0],s.splice(c--,0,i));break}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(u){return{state:"parsererror",error:o?u:"No conversion from "+l+" to "+i}}}l=i}return{state:"success",data:t}}function w(){try{return new e.XMLHttpRequest}catch(t){}}function D(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function I(){return setTimeout(function(){Xo=t},0),Xo=Z.now()}function F(e,t){Z.each(t,function(t,o){for(var n=(en[t]||[]).concat(en["*"]),i=0,r=n.length;r>i;i++)if(n[i].call(e,t,o))return})}function L(e,t,o){var n,i=0,r=Jo.length,s=Z.Deferred().always(function(){delete l.elem}),l=function(){for(var t=Xo||I(),o=Math.max(0,a.startTime+a.duration-t),n=1-(o/a.duration||0),i=0,r=a.tweens.length;r>i;i++)a.tweens[i].run(n);return s.notifyWith(e,[a,n,o]),1>n&&r?o:(s.resolveWith(e,[a]),!1)},a=s.promise({elem:e,props:Z.extend({},t),opts:Z.extend(!0,{specialEasing:{}},o),originalProperties:t,originalOptions:o,startTime:Xo||I(),duration:o.duration,tweens:[],createTween:function(t,o){var n=Z.Tween(e,a.opts,t,o,a.opts.specialEasing[t]||a.opts.easing);return a.tweens.push(n),n},stop:function(t){for(var o=0,n=t?a.tweens.length:0;n>o;o++)a.tweens[o].run(1);return t?s.resolveWith(e,[a,t]):s.rejectWith(e,[a,t]),this}}),c=a.props;for(N(c,a.opts.specialEasing);r>i;i++)if(n=Jo[i].call(a,e,c,a.opts))return n;return F(a,c),Z.isFunction(a.opts.start)&&a.opts.start.call(e,a),Z.fx.timer(Z.extend(l,{anim:a,queue:a.opts.queue,elem:e})),a.progress(a.opts.progress).done(a.opts.done,a.opts.complete).fail(a.opts.fail).always(a.opts.always)}function N(e,t){var o,n,i,r,s;for(o in e)if(n=Z.camelCase(o),i=t[n],r=e[o],Z.isArray(r)&&(i=r[1],r=e[o]=r[0]),o!==n&&(e[n]=r,delete e[o]),s=Z.cssHooks[n],s&&"expand"in s){r=s.expand(r),delete e[n];for(o in r)o in e||(e[o]=r[o],t[o]=i)}else t[n]=i}function O(e,t,o){var n,i,r,s,l,a,c,u,g=this,h=e.style,d={},p=[],f=e.nodeType&&y(e);o.queue||(c=Z._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,u=c.empty.fire,c.empty.fire=function(){c.unqueued||u()}),c.unqueued++,g.always(function(){g.always(function(){c.unqueued--,Z.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(o.overflow=[h.overflow,h.overflowX,h.overflowY],"inline"===Z.css(e,"display")&&"none"===Z.css(e,"float")&&(Z.support.inlineBlockNeedsLayout&&"inline"!==C(e.nodeName)?h.zoom=1:h.display="inline-block")),o.overflow&&(h.overflow="hidden",Z.support.shrinkWrapBlocks||g.done(function(){h.overflow=o.overflow[0],h.overflowX=o.overflow[1],h.overflowY=o.overflow[2]}));for(n in t)if(r=t[n],qo.exec(r)){if(delete t[n],r===(f?"hide":"show"))continue;p.push(n)}if(s=p.length)for(l=Z._data(e,"fxshow")||Z._data(e,"fxshow",{}),f?Z(e).show():g.done(function(){Z(e).hide()}),g.done(function(){var t;Z.removeData(e,"fxshow",!0);for(t in d)Z.style(e,t,d[t])}),n=0;s>n;n++)i=p[n],a=g.createTween(i,f?l[i]:0),d[i]=l[i]||Z.style(e,i),i in l||(l[i]=a.start,f&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}function x(e,t,o,n,i){return new x.prototype.init(e,t,o,n,i)}function M(e,t){var o,n={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)o=yo[i],n["margin"+o]=n["padding"+o]=e;return t&&(n.opacity=n.width=e),n}function P(e){return Z.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var H,U,$=e.document,G=e.location,W=e.navigator,V=e.jQuery,K=e.$,j=Array.prototype.push,z=Array.prototype.slice,X=Array.prototype.indexOf,Y=Object.prototype.toString,q=Object.prototype.hasOwnProperty,Q=String.prototype.trim,Z=function(e,t){return new Z.fn.init(e,t,H)},J=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,et=/\S/,tt=/\s+/,ot=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,nt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,it=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,rt=/^[\],:{}\s]*$/,st=/(?:^|:|,)(?:\s*\[)+/g,lt=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,at=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,ct=/^-ms-/,ut=/-([\da-z])/gi,gt=function(e,t){return(t+"").toUpperCase()},ht=function(){$.addEventListener?($.removeEventListener("DOMContentLoaded",ht,!1),Z.ready()):"complete"===$.readyState&&($.detachEvent("onreadystatechange",ht),Z.ready())},dt={};Z.fn=Z.prototype={constructor:Z,init:function(e,o,n){var i,r,s;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:nt.exec(e),i&&(i[1]||!o)){if(i[1])return o=o instanceof Z?o[0]:o,s=o&&o.nodeType?o.ownerDocument||o:$,e=Z.parseHTML(i[1],s,!0),it.test(i[1])&&Z.isPlainObject(o)&&this.attr.call(e,o,!0),Z.merge(this,e);if(r=$.getElementById(i[2]),r&&r.parentNode){if(r.id!==i[2])return n.find(e);this.length=1,this[0]=r}return this.context=$,this.selector=e,this}return!o||o.jquery?(o||n).find(e):this.constructor(o).find(e)}return Z.isFunction(e)?n.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),Z.makeArray(e,this))},selector:"",jquery:"1.8.1",length:0,size:function(){return this.length},toArray:function(){return z.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,o){var n=Z.merge(this.constructor(),e);return n.prevObject=this,n.context=this.context,"find"===t?n.selector=this.selector+(this.selector?" ":"")+o:t&&(n.selector=this.selector+"."+t+"("+o+")"),n},each:function(e,t){return Z.each(this,e,t)},ready:function(e){return Z.ready.promise().done(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(z.apply(this,arguments),"slice",z.call(arguments).join(","))},map:function(e){return this.pushStack(Z.map(this,function(t,o){return e.call(t,o,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},Z.fn.init.prototype=Z.fn,Z.extend=Z.fn.extend=function(){var e,o,n,i,r,s,l=arguments[0]||{},a=1,c=arguments.length,u=!1;for("boolean"==typeof l&&(u=l,l=arguments[1]||{},a=2),"object"!=typeof l&&!Z.isFunction(l)&&(l={}),c===a&&(l=this,--a);c>a;a++)if(null!=(e=arguments[a]))for(o in e)n=l[o],i=e[o],l!==i&&(u&&i&&(Z.isPlainObject(i)||(r=Z.isArray(i)))?(r?(r=!1,s=n&&Z.isArray(n)?n:[]):s=n&&Z.isPlainObject(n)?n:{},l[o]=Z.extend(u,s,i)):i!==t&&(l[o]=i));return l},Z.extend({noConflict:function(t){return e.$===Z&&(e.$=K),t&&e.jQuery===Z&&(e.jQuery=V),Z},isReady:!1,readyWait:1,holdReady:function(e){e?Z.readyWait++:Z.ready(!0)},ready:function(e){if(e===!0?!--Z.readyWait:!Z.isReady){if(!$.body)return setTimeout(Z.ready,1);Z.isReady=!0,e!==!0&&--Z.readyWait>0||(U.resolveWith($,[Z]),Z.fn.trigger&&Z($).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===Z.type(e)},isArray:Array.isArray||function(e){return"array"===Z.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?String(e):dt[Y.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==Z.type(e)||e.nodeType||Z.isWindow(e))return!1;try{if(e.constructor&&!q.call(e,"constructor")&&!q.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(o){return!1}var n;for(n in e);return n===t||q.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,o){var n;return e&&"string"==typeof e?("boolean"==typeof t&&(o=t,t=0),t=t||$,(n=it.exec(e))?[t.createElement(n[1])]:(n=Z.buildFragment([e],t,o?null:[]),Z.merge([],(n.cacheable?Z.clone(n.fragment):n.fragment).childNodes))):null},parseJSON:function(t){return t&&"string"==typeof t?(t=Z.trim(t),e.JSON&&e.JSON.parse?e.JSON.parse(t):rt.test(t.replace(lt,"@").replace(at,"]").replace(st,""))?new Function("return "+t)():(Z.error("Invalid JSON: "+t),void 0)):null},parseXML:function(o){var n,i;if(!o||"string"!=typeof o)return null;try{e.DOMParser?(i=new DOMParser,n=i.parseFromString(o,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(o))}catch(r){n=t}return(!n||!n.documentElement||n.getElementsByTagName("parsererror").length)&&Z.error("Invalid XML: "+o),n},noop:function(){},globalEval:function(t){t&&et.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ct,"ms-").replace(ut,gt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,o,n){var i,r=0,s=e.length,l=s===t||Z.isFunction(e);if(n)if(l){for(i in e)if(o.apply(e[i],n)===!1)break}else for(;s>r&&o.apply(e[r++],n)!==!1;);else if(l){for(i in e)if(o.call(e[i],i,e[i])===!1)break}else for(;s>r&&o.call(e[r],r,e[r++])!==!1;);return e},trim:Q&&!Q.call(" ")?function(e){return null==e?"":Q.call(e)}:function(e){return null==e?"":e.toString().replace(ot,"")},makeArray:function(e,t){var o,n=t||[];return null!=e&&(o=Z.type(e),null==e.length||"string"===o||"function"===o||"regexp"===o||Z.isWindow(e)?j.call(n,e):Z.merge(n,e)),n},inArray:function(e,t,o){var n;if(t){if(X)return X.call(t,e,o);for(n=t.length,o=o?0>o?Math.max(0,n+o):o:0;n>o;o++)if(o in t&&t[o]===e)return o}return-1},merge:function(e,o){var n=o.length,i=e.length,r=0;if("number"==typeof n)for(;n>r;r++)e[i++]=o[r];else for(;o[r]!==t;)e[i++]=o[r++];return e.length=i,e},grep:function(e,t,o){var n,i=[],r=0,s=e.length;for(o=!!o;s>r;r++)n=!!t(e[r],r),o!==n&&i.push(e[r]);return i},map:function(e,o,n){var i,r,s=[],l=0,a=e.length,c=e instanceof Z||a!==t&&"number"==typeof a&&(a>0&&e[0]&&e[a-1]||0===a||Z.isArray(e));if(c)for(;a>l;l++)i=o(e[l],l,n),null!=i&&(s[s.length]=i);else for(r in e)i=o(e[r],r,n),null!=i&&(s[s.length]=i);return s.concat.apply([],s)},guid:1,proxy:function(e,o){var n,i,r;return"string"==typeof o&&(n=e[o],o=e,e=n),Z.isFunction(e)?(i=z.call(arguments,2),r=function(){return e.apply(o,i.concat(z.call(arguments)))},r.guid=e.guid=e.guid||r.guid||Z.guid++,r):t},access:function(e,o,n,i,r,s,l){var a,c=null==n,u=0,g=e.length;if(n&&"object"==typeof n){for(u in n)Z.access(e,o,u,n[u],1,s,i);r=1}else if(i!==t){if(a=l===t&&Z.isFunction(i),c&&(a?(a=o,o=function(e,t,o){return a.call(Z(e),o)}):(o.call(e,i),o=null)),o)for(;g>u;u++)o(e[u],n,a?i.call(e[u],u,o(e[u],n)):i,l);r=1}return r?e:c?o.call(e):g?o(e[0],n):s},now:function(){return(new Date).getTime()}}),Z.ready.promise=function(t){if(!U)if(U=Z.Deferred(),"complete"===$.readyState)setTimeout(Z.ready,1);else if($.addEventListener)$.addEventListener("DOMContentLoaded",ht,!1),e.addEventListener("load",Z.ready,!1);else{$.attachEvent("onreadystatechange",ht),e.attachEvent("onload",Z.ready);var o=!1;try{o=null==e.frameElement&&$.documentElement}catch(n){}o&&o.doScroll&&function i(){if(!Z.isReady){try{o.doScroll("left")}catch(e){return setTimeout(i,50)}Z.ready()}}()}return U.promise(t)},Z.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){dt["[object "+t+"]"]=t.toLowerCase()}),H=Z($);var pt={};Z.Callbacks=function(e){e="string"==typeof e?pt[e]||o(e):Z.extend({},e);var n,i,r,s,l,a,c=[],u=!e.once&&[],g=function(t){for(n=e.memory&&t,i=!0,a=s||0,s=0,l=c.length,r=!0;c&&l>a;a++)if(c[a].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}r=!1,c&&(u?u.length&&g(u.shift()):n?c=[]:h.disable())},h={add:function(){if(c){var t=c.length;!function o(t){Z.each(t,function(t,n){var i=Z.type(n);"function"!==i||e.unique&&h.has(n)?n&&n.length&&"string"!==i&&o(n):c.push(n)})}(arguments),r?l=c.length:n&&(s=t,g(n))}return this},remove:function(){return c&&Z.each(arguments,function(e,t){for(var o;(o=Z.inArray(t,c,o))>-1;)c.splice(o,1),r&&(l>=o&&l--,a>=o&&a--)}),this},has:function(e){return Z.inArray(e,c)>-1},empty:function(){return c=[],this},disable:function(){return c=u=n=t,this},disabled:function(){return!c},lock:function(){return u=t,n||h.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],c&&(!i||u)&&(r?u.push(t):g(t)),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!i}};return h},Z.extend({Deferred:function(e){var t=[["resolve","done",Z.Callbacks("once memory"),"resolved"],["reject","fail",Z.Callbacks("once memory"),"rejected"],["notify","progress",Z.Callbacks("memory")]],o="pending",n={state:function(){return o},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return Z.Deferred(function(o){Z.each(t,function(t,n){var r=n[0],s=e[t];i[n[1]](Z.isFunction(s)?function(){var e=s.apply(this,arguments);e&&Z.isFunction(e.promise)?e.promise().done(o.resolve).fail(o.reject).progress(o.notify):o[r+"With"](this===i?o:this,[e])}:o[r])}),e=null}).promise()},promise:function(e){return"object"==typeof e?Z.extend(e,n):n}},i={};return n.pipe=n.then,Z.each(t,function(e,r){var s=r[2],l=r[3];n[r[1]]=s.add,l&&s.add(function(){o=l},t[1^e][2].disable,t[2][2].lock),i[r[0]]=s.fire,i[r[0]+"With"]=s.fireWith}),n.promise(i),e&&e.call(i,i),i},when:function(e){var t,o,n,i=0,r=z.call(arguments),s=r.length,l=1!==s||e&&Z.isFunction(e.promise)?s:0,a=1===l?e:Z.Deferred(),c=function(e,o,n){return function(i){o[e]=this,n[e]=arguments.length>1?z.call(arguments):i,n===t?a.notifyWith(o,n):--l||a.resolveWith(o,n)}};if(s>1)for(t=new Array(s),o=new Array(s),n=new Array(s);s>i;i++)r[i]&&Z.isFunction(r[i].promise)?r[i].promise().done(c(i,n,r)).fail(a.reject).progress(c(i,o,t)):--l;return l||a.resolveWith(n,r),a.promise()}}),Z.support=function(){var t,o,n,i,r,s,l,a,c,u,g,h=$.createElement("div");if(h.setAttribute("className","t"),h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",o=h.getElementsByTagName("*"),n=h.getElementsByTagName("a")[0],n.style.cssText="top:1px;float:left;opacity:.5",!o||!o.length||!n)return{};i=$.createElement("select"),r=i.appendChild($.createElement("option")),s=h.getElementsByTagName("input")[0],t={leadingWhitespace:3===h.firstChild.nodeType,tbody:!h.getElementsByTagName("tbody").length,htmlSerialize:!!h.getElementsByTagName("link").length,style:/top/.test(n.getAttribute("style")),hrefNormalized:"/a"===n.getAttribute("href"),opacity:/^0.5/.test(n.style.opacity),cssFloat:!!n.style.cssFloat,checkOn:"on"===s.value,optSelected:r.selected,getSetAttribute:"t"!==h.className,enctype:!!$.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==$.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===$.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},s.checked=!0,t.noCloneChecked=s.cloneNode(!0).checked,i.disabled=!0,t.optDisabled=!r.disabled;try{delete h.test}catch(d){t.deleteExpando=!1}if(!h.addEventListener&&h.attachEvent&&h.fireEvent&&(h.attachEvent("onclick",g=function(){t.noCloneEvent=!1}),h.cloneNode(!0).fireEvent("onclick"),h.detachEvent("onclick",g)),s=$.createElement("input"),s.value="t",s.setAttribute("type","radio"),t.radioValue="t"===s.value,s.setAttribute("checked","checked"),s.setAttribute("name","t"),h.appendChild(s),l=$.createDocumentFragment(),l.appendChild(h.lastChild),t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=s.checked,l.removeChild(s),l.appendChild(h),h.attachEvent)for(c in{submit:!0,change:!0,focusin:!0})a="on"+c,u=a in h,u||(h.setAttribute(a,"return;"),u="function"==typeof h[a]),t[c+"Bubbles"]=u;return Z(function(){var o,n,i,r,s="padding:0;margin:0;border:0;display:block;overflow:hidden;",l=$.getElementsByTagName("body")[0];l&&(o=$.createElement("div"),o.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",l.insertBefore(o,l.firstChild),n=$.createElement("div"),o.appendChild(n),n.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=n.getElementsByTagName("td"),i[0].style.cssText="padding:0;margin:0;border:0;display:none",u=0===i[0].offsetHeight,i[0].style.display="",i[1].style.display="none",t.reliableHiddenOffsets=u&&0===i[0].offsetHeight,n.innerHTML="",n.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===n.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==l.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(n,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(n,null)||{width:"4px"}).width,r=$.createElement("div"),r.style.cssText=n.style.cssText=s,r.style.marginRight=r.style.width="0",n.style.width="1px",n.appendChild(r),t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),"undefined"!=typeof n.style.zoom&&(n.innerHTML="",n.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===n.offsetWidth,n.style.display="block",n.style.overflow="visible",n.innerHTML="<div></div>",n.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==n.offsetWidth,o.style.zoom=1),l.removeChild(o),o=n=i=r=null)}),l.removeChild(h),o=n=i=r=s=l=h=null,t}();var ft=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,mt=/([A-Z])/g;Z.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Z.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?Z.cache[e[Z.expando]]:e[Z.expando],!!e&&!i(e)},data:function(e,o,n,i){if(Z.acceptData(e)){var r,s,l=Z.expando,a="string"==typeof o,c=e.nodeType,u=c?Z.cache:e,g=c?e[l]:e[l]&&l;if(g&&u[g]&&(i||u[g].data)||!a||n!==t)return g||(c?e[l]=g=Z.deletedIds.pop()||++Z.uuid:g=l),u[g]||(u[g]={},c||(u[g].toJSON=Z.noop)),("object"==typeof o||"function"==typeof o)&&(i?u[g]=Z.extend(u[g],o):u[g].data=Z.extend(u[g].data,o)),r=u[g],i||(r.data||(r.data={}),r=r.data),n!==t&&(r[Z.camelCase(o)]=n),a?(s=r[o],null==s&&(s=r[Z.camelCase(o)])):s=r,s}},removeData:function(e,t,o){if(Z.acceptData(e)){var n,r,s,l=e.nodeType,a=l?Z.cache:e,c=l?e[Z.expando]:Z.expando;if(a[c]){if(t&&(n=o?a[c]:a[c].data)){Z.isArray(t)||(t in n?t=[t]:(t=Z.camelCase(t),t=t in n?[t]:t.split(" ")));for(r=0,s=t.length;s>r;r++)delete n[t[r]];if(!(o?i:Z.isEmptyObject)(n))return}(o||(delete a[c].data,i(a[c])))&&(l?Z.cleanData([e],!0):Z.support.deleteExpando||a!=a.window?delete a[c]:a[c]=null)}}},_data:function(e,t,o){return Z.data(e,t,o,!0)},acceptData:function(e){var t=e.nodeName&&Z.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),Z.fn.extend({data:function(e,o){var i,r,s,l,a,c=this[0],u=0,g=null;if(e===t){if(this.length&&(g=Z.data(c),1===c.nodeType&&!Z._data(c,"parsedAttrs"))){for(s=c.attributes,a=s.length;a>u;u++)l=s[u].name,0===l.indexOf("data-")&&(l=Z.camelCase(l.substring(5)),n(c,l,g[l]));Z._data(c,"parsedAttrs",!0)}return g}return"object"==typeof e?this.each(function(){Z.data(this,e)}):(i=e.split(".",2),i[1]=i[1]?"."+i[1]:"",r=i[1]+"!",Z.access(this,function(o){return o===t?(g=this.triggerHandler("getData"+r,[i[0]]),g===t&&c&&(g=Z.data(c,e),g=n(c,e,g)),g===t&&i[1]?this.data(i[0]):g):(i[1]=o,this.each(function(){var t=Z(this);t.triggerHandler("setData"+r,i),Z.data(this,e,o),t.triggerHandler("changeData"+r,i)}),void 0)},null,o,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){Z.removeData(this,e)})}}),Z.extend({queue:function(e,t,o){var n;return e?(t=(t||"fx")+"queue",n=Z._data(e,t),o&&(!n||Z.isArray(o)?n=Z._data(e,t,Z.makeArray(o)):n.push(o)),n||[]):void 0},dequeue:function(e,t){t=t||"fx";var o=Z.queue(e,t),n=o.length,i=o.shift(),r=Z._queueHooks(e,t),s=function(){Z.dequeue(e,t)};"inprogress"===i&&(i=o.shift(),n--),i&&("fx"===t&&o.unshift("inprogress"),delete r.stop,i.call(e,s,r)),!n&&r&&r.empty.fire()},_queueHooks:function(e,t){var o=t+"queueHooks";return Z._data(e,o)||Z._data(e,o,{empty:Z.Callbacks("once memory").add(function(){Z.removeData(e,t+"queue",!0),Z.removeData(e,o,!0)})})}}),Z.fn.extend({queue:function(e,o){var n=2;return"string"!=typeof e&&(o=e,e="fx",n--),arguments.length<n?Z.queue(this[0],e):o===t?this:this.each(function(){var t=Z.queue(this,e,o);Z._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&Z.dequeue(this,e)})},dequeue:function(e){return this.each(function(){Z.dequeue(this,e)})},delay:function(e,t){return e=Z.fx?Z.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,o){var n=setTimeout(t,e);o.stop=function(){clearTimeout(n)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,o){var n,i=1,r=Z.Deferred(),s=this,l=this.length,a=function(){--i||r.resolveWith(s,[s])};for("string"!=typeof e&&(o=e,e=t),e=e||"fx";l--;)n=Z._data(s[l],e+"queueHooks"),n&&n.empty&&(i++,n.empty.add(a));return a(),r.promise(o)}});var yt,_t,vt,Et=/[\t\r\n]/g,Bt=/\r/g,Ct=/^(?:button|input)$/i,kt=/^(?:button|input|object|select|textarea)$/i,bt=/^a(?:rea|)$/i,At=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,Tt=Z.support.getSetAttribute;Z.fn.extend({attr:function(e,t){return Z.access(this,Z.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){Z.removeAttr(this,e)})},prop:function(e,t){return Z.access(this,Z.prop,e,t,arguments.length>1)},removeProp:function(e){return e=Z.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(o){}})},addClass:function(e){var t,o,n,i,r,s,l;if(Z.isFunction(e))return this.each(function(t){Z(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(tt),o=0,n=this.length;n>o;o++)if(i=this[o],1===i.nodeType)if(i.className||1!==t.length){for(r=" "+i.className+" ",s=0,l=t.length;l>s;s++)~r.indexOf(" "+t[s]+" ")||(r+=t[s]+" ");i.className=Z.trim(r)}else i.className=e;return this},removeClass:function(e){var o,n,i,r,s,l,a;if(Z.isFunction(e))return this.each(function(t){Z(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===t)for(o=(e||"").split(tt),l=0,a=this.length;a>l;l++)if(i=this[l],1===i.nodeType&&i.className){for(n=(" "+i.className+" ").replace(Et," "),r=0,s=o.length;s>r;r++)for(;n.indexOf(" "+o[r]+" ")>-1;)n=n.replace(" "+o[r]+" "," ");i.className=e?Z.trim(n):""}return this},toggleClass:function(e,t){var o=typeof e,n="boolean"==typeof t;return Z.isFunction(e)?this.each(function(o){Z(this).toggleClass(e.call(this,o,this.className,t),t)}):this.each(function(){if("string"===o)for(var i,r=0,s=Z(this),l=t,a=e.split(tt);i=a[r++];)l=n?l:!s.hasClass(i),s[l?"addClass":"removeClass"](i);else("undefined"===o||"boolean"===o)&&(this.className&&Z._data(this,"__className__",this.className),this.className=this.className||e===!1?"":Z._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",o=0,n=this.length;n>o;o++)if(1===this[o].nodeType&&(" "+this[o].className+" ").replace(Et," ").indexOf(t)>-1)return!0;return!1},val:function(e){var o,n,i,r=this[0];{if(arguments.length)return i=Z.isFunction(e),this.each(function(n){var r,s=Z(this);1===this.nodeType&&(r=i?e.call(this,n,s.val()):e,null==r?r="":"number"==typeof r?r+="":Z.isArray(r)&&(r=Z.map(r,function(e){return null==e?"":e+""})),o=Z.valHooks[this.type]||Z.valHooks[this.nodeName.toLowerCase()],o&&"set"in o&&o.set(this,r,"value")!==t||(this.value=r))});if(r)return o=Z.valHooks[r.type]||Z.valHooks[r.nodeName.toLowerCase()],o&&"get"in o&&(n=o.get(r,"value"))!==t?n:(n=r.value,"string"==typeof n?n.replace(Bt,""):null==n?"":n)}}}),Z.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,o,n,i,r=e.selectedIndex,s=[],l=e.options,a="select-one"===e.type;if(0>r)return null;for(o=a?r:0,n=a?r+1:l.length;n>o;o++)if(i=l[o],!(!i.selected||(Z.support.optDisabled?i.disabled:null!==i.getAttribute("disabled"))||i.parentNode.disabled&&Z.nodeName(i.parentNode,"optgroup"))){if(t=Z(i).val(),a)return t;s.push(t)}return a&&!s.length&&l.length?Z(l[r]).val():s},set:function(e,t){var o=Z.makeArray(t);return Z(e).find("option").each(function(){this.selected=Z.inArray(Z(this).val(),o)>=0}),o.length||(e.selectedIndex=-1),o}}},attrFn:{},attr:function(e,o,n,i){var r,s,l,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return i&&Z.isFunction(Z.fn[o])?Z(e)[o](n):"undefined"==typeof e.getAttribute?Z.prop(e,o,n):(l=1!==a||!Z.isXMLDoc(e),l&&(o=o.toLowerCase(),s=Z.attrHooks[o]||(At.test(o)?_t:yt)),n!==t?null===n?(Z.removeAttr(e,o),void 0):s&&"set"in s&&l&&(r=s.set(e,n,o))!==t?r:(e.setAttribute(o,""+n),n):s&&"get"in s&&l&&null!==(r=s.get(e,o))?r:(r=e.getAttribute(o),null===r?t:r))},removeAttr:function(e,t){var o,n,i,r,s=0;if(t&&1===e.nodeType)for(n=t.split(tt);s<n.length;s++)i=n[s],i&&(o=Z.propFix[i]||i,r=At.test(i),r||Z.attr(e,i,""),e.removeAttribute(Tt?i:o),r&&o in e&&(e[o]=!1))},attrHooks:{type:{set:function(e,t){if(Ct.test(e.nodeName)&&e.parentNode)Z.error("type property can't be changed");else if(!Z.support.radioValue&&"radio"===t&&Z.nodeName(e,"input")){var o=e.value;return e.setAttribute("type",t),o&&(e.value=o),t}}},value:{get:function(e,t){return yt&&Z.nodeName(e,"button")?yt.get(e,t):t in e?e.value:null},set:function(e,t,o){return yt&&Z.nodeName(e,"button")?yt.set(e,t,o):(e.value=t,void 0)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,o,n){var i,r,s,l=e.nodeType;if(e&&3!==l&&8!==l&&2!==l)return s=1!==l||!Z.isXMLDoc(e),s&&(o=Z.propFix[o]||o,r=Z.propHooks[o]),n!==t?r&&"set"in r&&(i=r.set(e,n,o))!==t?i:e[o]=n:r&&"get"in r&&null!==(i=r.get(e,o))?i:e[o]},propHooks:{tabIndex:{get:function(e){var o=e.getAttributeNode("tabindex");return o&&o.specified?parseInt(o.value,10):kt.test(e.nodeName)||bt.test(e.nodeName)&&e.href?0:t}}}}),_t={get:function(e,o){var n,i=Z.prop(e,o);return i===!0||"boolean"!=typeof i&&(n=e.getAttributeNode(o))&&n.nodeValue!==!1?o.toLowerCase():t},set:function(e,t,o){var n;return t===!1?Z.removeAttr(e,o):(n=Z.propFix[o]||o,n in e&&(e[n]=!0),e.setAttribute(o,o.toLowerCase())),o}},Tt||(vt={name:!0,id:!0,coords:!0},yt=Z.valHooks.button={get:function(e,o){var n;return n=e.getAttributeNode(o),n&&(vt[o]?""!==n.value:n.specified)?n.value:t},set:function(e,t,o){var n=e.getAttributeNode(o);return n||(n=$.createAttribute(o),e.setAttributeNode(n)),n.value=t+""}},Z.each(["width","height"],function(e,t){Z.attrHooks[t]=Z.extend(Z.attrHooks[t],{set:function(e,o){return""===o?(e.setAttribute(t,"auto"),o):void 0}})}),Z.attrHooks.contenteditable={get:yt.get,set:function(e,t,o){""===t&&(t="false"),yt.set(e,t,o)}}),Z.support.hrefNormalized||Z.each(["href","src","width","height"],function(e,o){Z.attrHooks[o]=Z.extend(Z.attrHooks[o],{get:function(e){var n=e.getAttribute(o,2);return null===n?t:n}})}),Z.support.style||(Z.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),Z.support.optSelected||(Z.propHooks.selected=Z.extend(Z.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),Z.support.enctype||(Z.propFix.enctype="encoding"),Z.support.checkOn||Z.each(["radio","checkbox"],function(){Z.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value
2
- }}}),Z.each(["radio","checkbox"],function(){Z.valHooks[this]=Z.extend(Z.valHooks[this],{set:function(e,t){return Z.isArray(t)?e.checked=Z.inArray(Z(e).val(),t)>=0:void 0}})});var St=/^(?:textarea|input|select)$/i,Rt=/^([^\.]*|)(?:\.(.+)|)$/,wt=/(?:^|\s)hover(\.\S+|)\b/,Dt=/^key/,It=/^(?:mouse|contextmenu)|click/,Ft=/^(?:focusinfocus|focusoutblur)$/,Lt=function(e){return Z.event.special.hover?e:e.replace(wt,"mouseenter$1 mouseleave$1")};Z.event={add:function(e,o,n,i,r){var s,l,a,c,u,g,h,d,p,f,m;if(3!==e.nodeType&&8!==e.nodeType&&o&&n&&(s=Z._data(e))){for(n.handler&&(p=n,n=p.handler,r=p.selector),n.guid||(n.guid=Z.guid++),a=s.events,a||(s.events=a={}),l=s.handle,l||(s.handle=l=function(e){return"undefined"==typeof Z||e&&Z.event.triggered===e.type?t:Z.event.dispatch.apply(l.elem,arguments)},l.elem=e),o=Z.trim(Lt(o)).split(" "),c=0;c<o.length;c++)u=Rt.exec(o[c])||[],g=u[1],h=(u[2]||"").split(".").sort(),m=Z.event.special[g]||{},g=(r?m.delegateType:m.bindType)||g,m=Z.event.special[g]||{},d=Z.extend({type:g,origType:u[1],data:i,handler:n,guid:n.guid,selector:r,namespace:h.join(".")},p),f=a[g],f||(f=a[g]=[],f.delegateCount=0,m.setup&&m.setup.call(e,i,h,l)!==!1||(e.addEventListener?e.addEventListener(g,l,!1):e.attachEvent&&e.attachEvent("on"+g,l))),m.add&&(m.add.call(e,d),d.handler.guid||(d.handler.guid=n.guid)),r?f.splice(f.delegateCount++,0,d):f.push(d),Z.event.global[g]=!0;e=null}},global:{},remove:function(e,t,o,n,i){var r,s,l,a,c,u,g,h,d,p,f,m=Z.hasData(e)&&Z._data(e);if(m&&(h=m.events)){for(t=Z.trim(Lt(t||"")).split(" "),r=0;r<t.length;r++)if(s=Rt.exec(t[r])||[],l=a=s[1],c=s[2],l){for(d=Z.event.special[l]||{},l=(n?d.delegateType:d.bindType)||l,p=h[l]||[],u=p.length,c=c?new RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,g=0;g<p.length;g++)f=p[g],!(!i&&a!==f.origType||o&&o.guid!==f.guid||c&&!c.test(f.namespace)||n&&n!==f.selector&&("**"!==n||!f.selector)||(p.splice(g--,1),f.selector&&p.delegateCount--,!d.remove||!d.remove.call(e,f)));0===p.length&&u!==p.length&&((!d.teardown||d.teardown.call(e,c,m.handle)===!1)&&Z.removeEvent(e,l,m.handle),delete h[l])}else for(l in h)Z.event.remove(e,l+t[r],o,n,!0);Z.isEmptyObject(h)&&(delete m.handle,Z.removeData(e,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(o,n,i,r){if(!i||3!==i.nodeType&&8!==i.nodeType){var s,l,a,c,u,g,h,d,p,f,m=o.type||o,y=[];if(Ft.test(m+Z.event.triggered))return;if(m.indexOf("!")>=0&&(m=m.slice(0,-1),l=!0),m.indexOf(".")>=0&&(y=m.split("."),m=y.shift(),y.sort()),(!i||Z.event.customEvent[m])&&!Z.event.global[m])return;if(o="object"==typeof o?o[Z.expando]?o:new Z.Event(m,o):new Z.Event(m),o.type=m,o.isTrigger=!0,o.exclusive=l,o.namespace=y.join("."),o.namespace_re=o.namespace?new RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,g=m.indexOf(":")<0?"on"+m:"",!i){s=Z.cache;for(a in s)s[a].events&&s[a].events[m]&&Z.event.trigger(o,n,s[a].handle.elem,!0);return}if(o.result=t,o.target||(o.target=i),n=null!=n?Z.makeArray(n):[],n.unshift(o),h=Z.event.special[m]||{},h.trigger&&h.trigger.apply(i,n)===!1)return;if(p=[[i,h.bindType||m]],!r&&!h.noBubble&&!Z.isWindow(i)){for(f=h.delegateType||m,c=Ft.test(f+m)?i:i.parentNode,u=i;c;c=c.parentNode)p.push([c,f]),u=c;u===(i.ownerDocument||$)&&p.push([u.defaultView||u.parentWindow||e,f])}for(a=0;a<p.length&&!o.isPropagationStopped();a++)c=p[a][0],o.type=p[a][1],d=(Z._data(c,"events")||{})[o.type]&&Z._data(c,"handle"),d&&d.apply(c,n),d=g&&c[g],d&&Z.acceptData(c)&&d.apply(c,n)===!1&&o.preventDefault();return o.type=m,!(r||o.isDefaultPrevented()||h._default&&h._default.apply(i.ownerDocument,n)!==!1||"click"===m&&Z.nodeName(i,"a")||!Z.acceptData(i)||!g||!i[m]||("focus"===m||"blur"===m)&&0===o.target.offsetWidth||Z.isWindow(i)||(u=i[g],u&&(i[g]=null),Z.event.triggered=m,i[m](),Z.event.triggered=t,!u||!(i[g]=u))),o.result}},dispatch:function(o){o=Z.event.fix(o||e.event);var n,i,r,s,l,a,c,u,g,h=(Z._data(this,"events")||{})[o.type]||[],d=h.delegateCount,p=[].slice.call(arguments),f=!o.exclusive&&!o.namespace,m=Z.event.special[o.type]||{},y=[];if(p[0]=o,o.delegateTarget=this,!m.preDispatch||m.preDispatch.call(this,o)!==!1){if(d&&(!o.button||"click"!==o.type))for(r=o.target;r!=this;r=r.parentNode||this)if(r.disabled!==!0||"click"!==o.type){for(l={},c=[],n=0;d>n;n++)u=h[n],g=u.selector,l[g]===t&&(l[g]=Z(g,this).index(r)>=0),l[g]&&c.push(u);c.length&&y.push({elem:r,matches:c})}for(h.length>d&&y.push({elem:this,matches:h.slice(d)}),n=0;n<y.length&&!o.isPropagationStopped();n++)for(a=y[n],o.currentTarget=a.elem,i=0;i<a.matches.length&&!o.isImmediatePropagationStopped();i++)u=a.matches[i],(f||!o.namespace&&!u.namespace||o.namespace_re&&o.namespace_re.test(u.namespace))&&(o.data=u.data,o.handleObj=u,s=((Z.event.special[u.origType]||{}).handle||u.handler).apply(a.elem,p),s!==t&&(o.result=s,s===!1&&(o.preventDefault(),o.stopPropagation())));return m.postDispatch&&m.postDispatch.call(this,o),o.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,o){var n,i,r,s=o.button,l=o.fromElement;return null==e.pageX&&null!=o.clientX&&(n=e.target.ownerDocument||$,i=n.documentElement,r=n.body,e.pageX=o.clientX+(i&&i.scrollLeft||r&&r.scrollLeft||0)-(i&&i.clientLeft||r&&r.clientLeft||0),e.pageY=o.clientY+(i&&i.scrollTop||r&&r.scrollTop||0)-(i&&i.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?o.toElement:l),!e.which&&s!==t&&(e.which=1&s?1:2&s?3:4&s?2:0),e}},fix:function(e){if(e[Z.expando])return e;var t,o,n=e,i=Z.event.fixHooks[e.type]||{},r=i.props?this.props.concat(i.props):this.props;for(e=Z.Event(n),t=r.length;t;)o=r[--t],e[o]=n[o];return e.target||(e.target=n.srcElement||$),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,i.filter?i.filter(e,n):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,o){Z.isWindow(this)&&(this.onbeforeunload=o)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,o,n){var i=Z.extend(new Z.Event,o,{type:e,isSimulated:!0,originalEvent:{}});n?Z.event.trigger(i,null,t):Z.event.dispatch.call(t,i),i.isDefaultPrevented()&&o.preventDefault()}},Z.event.handle=Z.event.dispatch,Z.removeEvent=$.removeEventListener?function(e,t,o){e.removeEventListener&&e.removeEventListener(t,o,!1)}:function(e,t,o){var n="on"+t;e.detachEvent&&("undefined"==typeof e[n]&&(e[n]=null),e.detachEvent(n,o))},Z.Event=function(e,t){return this instanceof Z.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?s:r):this.type=e,t&&Z.extend(this,t),this.timeStamp=e&&e.timeStamp||Z.now(),this[Z.expando]=!0,void 0):new Z.Event(e,t)},Z.Event.prototype={preventDefault:function(){this.isDefaultPrevented=s;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=s;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=s,this.stopPropagation()},isDefaultPrevented:r,isPropagationStopped:r,isImmediatePropagationStopped:r},Z.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Z.event.special[e]={delegateType:t,bindType:t,handle:function(e){{var o,n=this,i=e.relatedTarget,r=e.handleObj;r.selector}return(!i||i!==n&&!Z.contains(n,i))&&(e.type=r.origType,o=r.handler.apply(this,arguments),e.type=t),o}}}),Z.support.submitBubbles||(Z.event.special.submit={setup:function(){return Z.nodeName(this,"form")?!1:(Z.event.add(this,"click._submit keypress._submit",function(e){var o=e.target,n=Z.nodeName(o,"input")||Z.nodeName(o,"button")?o.form:t;n&&!Z._data(n,"_submit_attached")&&(Z.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),Z._data(n,"_submit_attached",!0))}),void 0)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&Z.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return Z.nodeName(this,"form")?!1:(Z.event.remove(this,"._submit"),void 0)}}),Z.support.changeBubbles||(Z.event.special.change={setup:function(){return St.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(Z.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),Z.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),Z.event.simulate("change",this,e,!0)})),!1):(Z.event.add(this,"beforeactivate._change",function(e){var t=e.target;St.test(t.nodeName)&&!Z._data(t,"_change_attached")&&(Z.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&Z.event.simulate("change",this.parentNode,e,!0)}),Z._data(t,"_change_attached",!0))}),void 0)},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return Z.event.remove(this,"._change"),!St.test(this.nodeName)}}),Z.support.focusinBubbles||Z.each({focus:"focusin",blur:"focusout"},function(e,t){var o=0,n=function(e){Z.event.simulate(t,e.target,Z.event.fix(e),!0)};Z.event.special[t]={setup:function(){0===o++&&$.addEventListener(e,n,!0)},teardown:function(){0===--o&&$.removeEventListener(e,n,!0)}}}),Z.fn.extend({on:function(e,o,n,i,s){var l,a;if("object"==typeof e){"string"!=typeof o&&(n=n||o,o=t);for(a in e)this.on(a,o,n,e[a],s);return this}if(null==n&&null==i?(i=o,n=o=t):null==i&&("string"==typeof o?(i=n,n=t):(i=n,n=o,o=t)),i===!1)i=r;else if(!i)return this;return 1===s&&(l=i,i=function(e){return Z().off(e),l.apply(this,arguments)},i.guid=l.guid||(l.guid=Z.guid++)),this.each(function(){Z.event.add(this,e,i,n,o)})},one:function(e,t,o,n){return this.on(e,t,o,n,1)},off:function(e,o,n){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,Z(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(s in e)this.off(s,o,e[s]);return this}return(o===!1||"function"==typeof o)&&(n=o,o=t),n===!1&&(n=r),this.each(function(){Z.event.remove(this,e,n,o)})},bind:function(e,t,o){return this.on(e,null,t,o)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,o){return Z(this.context).on(e,this.selector,t,o),this},die:function(e,t){return Z(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,o,n){return this.on(t,e,o,n)},undelegate:function(e,t,o){return 1==arguments.length?this.off(e,"**"):this.off(t,e||"**",o)},trigger:function(e,t){return this.each(function(){Z.event.trigger(e,t,this)})},triggerHandler:function(e,t){return this[0]?Z.event.trigger(e,t,this[0],!0):void 0},toggle:function(e){var t=arguments,o=e.guid||Z.guid++,n=0,i=function(o){var i=(Z._data(this,"lastToggle"+e.guid)||0)%n;return Z._data(this,"lastToggle"+e.guid,i+1),o.preventDefault(),t[i].apply(this,arguments)||!1};for(i.guid=o;n<t.length;)t[n++].guid=o;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Z.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){Z.fn[t]=function(e,o){return null==o&&(o=e,e=null),arguments.length>0?this.on(t,null,e,o):this.trigger(t)},Dt.test(t)&&(Z.event.fixHooks[t]=Z.event.keyHooks),It.test(t)&&(Z.event.fixHooks[t]=Z.event.mouseHooks)}),function(e,t){function o(e,t,o,n){o=o||[],t=t||R;var i,r,s,l,a=t.nodeType;if(1!==a&&9!==a)return[];if(!e||"string"!=typeof e)return o;if(s=E(t),!s&&!n&&(i=Y.exec(e)))if(l=i[1]){if(9===a){if(r=t.getElementById(l),!r||!r.parentNode)return o;if(r.id===l)return o.push(r),o}else if(t.ownerDocument&&(r=t.ownerDocument.getElementById(l))&&B(t,r)&&r.id===l)return o.push(r),o}else{if(i[2])return F.apply(o,I.call(t.getElementsByTagName(e),0)),o;if((l=i[3])&&lt&&t.getElementsByClassName)return F.apply(o,I.call(t.getElementsByClassName(l),0)),o}return p(e,t,o,n,s)}function n(e){return function(t){var o=t.nodeName.toLowerCase();return"input"===o&&t.type===e}}function i(e){return function(t){var o=t.nodeName.toLowerCase();return("input"===o||"button"===o)&&t.type===e}}function r(e,t,o){if(e===t)return o;for(var n=e.nextSibling;n;){if(n===t)return-1;n=n.nextSibling}return 1}function s(e,t,n,i){var r,s,l,a,c,u,g,h,d,p,f=!n&&t!==R,m=(f?"<s>":"")+e.replace(K,"$1<s>"),y=x[S][m];if(y)return i?0:I.call(y,0);for(c=e,u=[],h=0,d=_.preFilter,p=_.filter;c;){(!r||(s=j.exec(c)))&&(s&&(c=c.slice(s[0].length),l.selector=g),u.push(l=[]),g="",f&&(c=" "+c)),r=!1,(s=z.exec(c))&&(g+=s[0],c=c.slice(s[0].length),r=l.push({part:s.pop().replace(K," "),string:s[0],captures:s}));for(a in p)(s=ot[a].exec(c))&&(!d[a]||(s=d[a](s,t,n)))&&(g+=s[0],c=c.slice(s[0].length),r=l.push({part:a,string:s.shift(),captures:s}));if(!r)break}return g&&(l.selector=g),i?c.length:c?o.error(e):I.call(x(m,u),0)}function l(e,t,o,n){var i=t.dir,r=D++;return e||(e=function(e){return e===o}),t.first?function(t){for(;t=t[i];)if(1===t.nodeType)return e(t)&&t}:n?function(t){for(;t=t[i];)if(1===t.nodeType&&e(t))return t}:function(t){for(var o,n=r+"."+f,s=n+"."+m;t=t[i];)if(1===t.nodeType){if((o=t[S])===s)return t.sizset;if("string"==typeof o&&0===o.indexOf(n)){if(t.sizset)return t}else{if(t[S]=s,e(t))return t.sizset=!0,t;t.sizset=!1}}}}function a(e,t){return e?function(o){var n=t(o);return n&&e(n===!0?o:n)}:t}function c(e,t,o){for(var n,i,r=0;n=e[r];r++)i=_.relative[n.part]?l(i,_.relative[n.part],t,o):a(i,_.filter[n.part].apply(null,n.captures.concat(t,o)));return i}function u(e){return function(t){for(var o,n=0;o=e[n];n++)if(o(t))return!0;return!1}}function g(e,t,n,i){for(var r=0,s=t.length;s>r;r++)o(e,t[r],n,i)}function h(e,t,n,i,r,s){var l,a=_.setFilters[t.toLowerCase()];return a||o.error(t),(e||!(l=r))&&g(e||"*",i,l=[],r),l.length>0?a(l,n,s):[]}function d(e,n,i,r){for(var s,l,a,c,u,d,p,f,m,y,_,v,E,B=0,C=e.length,k=ot.POS,b=new RegExp("^"+k.source+"(?!"+P+")","i"),A=function(){for(var e=1,o=arguments.length-2;o>e;e++)arguments[e]===t&&(m[e]=t)};C>B;B++){for(s=e[B],l="",f=r,a=0,c=s.length;c>a;a++){if(u=s[a],d=u.string,"PSEUDO"===u.part)for(k.exec(""),p=0;m=k.exec(d);)y=!0,_=k.lastIndex=m.index+m[0].length,_>p&&(l+=d.slice(p,m.index),p=_,v=[n],z.test(l)&&(f&&(v=f),f=r),(E=Q.test(l))&&(l=l.slice(0,-5).replace(z,"$&*"),p++),m.length>1&&m[0].replace(b,A),f=h(l,m[1],m[2],v,f,E)),l="";y||(l+=d),y=!1}l?z.test(l)?g(l,f||[n],i,r):o(l,n,i,r?r.concat(f):f):F.apply(i,f)}return 1===C?i:o.uniqueSort(i)}function p(e,t,o,n,i){e=e.replace(K,"$1");var r,l,a,c,u,g,h,p,y,v=s(e,t,i),E=t.nodeType;if(ot.POS.test(e))return d(v,t,o,n);if(n)r=I.call(n,0);else if(1===v.length){if((u=I.call(v[0],0)).length>2&&"ID"===(g=u[0]).part&&9===E&&!i&&_.relative[u[1].part]){if(t=_.find.ID(g.captures[0].replace(tt,""),t,i)[0],!t)return o;e=e.slice(u.shift().string.length)}for(p=(v=q.exec(u[0].string))&&!v.index&&t.parentNode||t,h="",c=u.length-1;c>=0&&(g=u[c],y=g.part,h=g.string+h,!_.relative[y]);c--)if(_.order.test(y)){if(r=_.find[y](g.captures[0].replace(tt,""),p,i),null==r)continue;e=e.slice(0,e.length-h.length)+h.replace(ot[y],""),e||F.apply(o,I.call(r,0));break}}if(e)for(l=C(e,t,i),f=l.dirruns++,null==r&&(r=_.find.TAG("*",q.test(e)&&t.parentNode||t)),c=0;a=r[c];c++)m=l.runs++,l(a)&&o.push(a);return o}var f,m,y,_,v,E,B,C,k,b,A=!0,T="undefined",S=("sizcache"+Math.random()).replace(".",""),R=e.document,w=R.documentElement,D=0,I=[].slice,F=[].push,L=function(e,t){return e[S]=t||!0,e},N=function(){var e={},t=[];return L(function(o,n){return t.push(o)>_.cacheLength&&delete e[t.shift()],e[o]=n},e)},O=N(),x=N(),M=N(),P="[\\x20\\t\\r\\n\\f]",H="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",U=H.replace("w","w#"),$="([*^$|!~]?=)",G="\\["+P+"*("+H+")"+P+"*(?:"+$+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+U+")|)|)"+P+"*\\]",W=":("+H+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+G+")|[^:]|\\\\.)*|.*))\\)|)",V=":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",K=new RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),j=new RegExp("^"+P+"*,"+P+"*"),z=new RegExp("^"+P+"*([\\x20\\t\\r\\n\\f>+~])"+P+"*"),X=new RegExp(W),Y=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,q=/[\x20\t\r\n\f]*[+~]/,Q=/:not\($/,J=/h\d/i,et=/input|select|textarea|button/i,tt=/\\(?!\\)/g,ot={ID:new RegExp("^#("+H+")"),CLASS:new RegExp("^\\.("+H+")"),NAME:new RegExp("^\\[name=['\"]?("+H+")['\"]?\\]"),TAG:new RegExp("^("+H.replace("w","w*")+")"),ATTR:new RegExp("^"+G),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),POS:new RegExp(V,"ig"),needsContext:new RegExp("^"+P+"*[>+~]|"+V,"i")},nt=function(e){var t=R.createElement("div");try{return e(t)}catch(o){return!1}finally{t=null}},it=nt(function(e){return e.appendChild(R.createComment("")),!e.getElementsByTagName("*").length}),rt=nt(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==T&&"#"===e.firstChild.getAttribute("href")}),st=nt(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),lt=nt(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),at=nt(function(e){e.id=S+0,e.innerHTML="<a name='"+S+"'></a><div name='"+S+"'></div>",w.insertBefore(e,w.firstChild);var t=R.getElementsByName&&R.getElementsByName(S).length===2+R.getElementsByName(S+0).length;return y=!R.getElementById(S),w.removeChild(e),t});try{I.call(w.childNodes,0)[0].nodeType}catch(ct){I=function(e){for(var t,o=[];t=this[e];e++)o.push(t);return o}}o.matches=function(e,t){return o(e,null,null,t)},o.matchesSelector=function(e,t){return o(t,null,null,[e]).length>0},v=o.getText=function(e){var t,o="",n=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)o+=v(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[n];n++)o+=v(t);return o},E=o.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},B=o.contains=w.contains?function(e,t){var o=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!!(n&&1===n.nodeType&&o.contains&&o.contains(n))}:w.compareDocumentPosition?function(e,t){return t&&!!(16&e.compareDocumentPosition(t))}:function(e,t){for(;t=t.parentNode;)if(t===e)return!0;return!1},o.attr=function(e,t){var o,n=E(e);return n||(t=t.toLowerCase()),_.attrHandle[t]?_.attrHandle[t](e):st||n?e.getAttribute(t):(o=e.getAttributeNode(t),o?"boolean"==typeof e[t]?e[t]?t:null:o.specified?o.value:null:null)},_=o.selectors={cacheLength:50,createPseudo:L,match:ot,order:new RegExp("ID|TAG"+(at?"|NAME":"")+(lt?"|CLASS":"")),attrHandle:rt?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:y?function(e,t,o){if(typeof t.getElementById!==T&&!o){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}}:function(e,o,n){if(typeof o.getElementById!==T&&!n){var i=o.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==T&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:it?function(e,t){return typeof t.getElementsByTagName!==T?t.getElementsByTagName(e):void 0}:function(e,t){var o=t.getElementsByTagName(e);if("*"===e){for(var n,i=[],r=0;n=o[r];r++)1===n.nodeType&&i.push(n);return i}return o},NAME:function(e,t){return typeof t.getElementsByName!==T?t.getElementsByName(name):void 0},CLASS:function(e,t,o){return typeof t.getElementsByClassName===T||o?void 0:t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(tt,""),e[3]=(e[4]||e[5]||"").replace(tt,""),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1]?(e[2]||o.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*("even"===e[2]||"odd"===e[2])),e[4]=+(e[6]+e[7]||"odd"===e[2])):e[2]&&o.error(e[0]),e},PSEUDO:function(e,t,o){var n,i;return ot.CHILD.test(e[0])?null:(e[3]?e[2]=e[3]:(n=e[4])&&(X.test(n)&&(i=s(n,t,o,!0))&&(i=n.indexOf(")",n.length-i)-n.length)&&(n=n.slice(0,i),e[0]=e[0].slice(0,i)),e[2]=n),e.slice(0,3))}},filter:{ID:y?function(e){return e=e.replace(tt,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(tt,""),function(t){var o=typeof t.getAttributeNode!==T&&t.getAttributeNode("id");return o&&o.value===e}},TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(tt,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=O[S][e];return t||(t=O(e,new RegExp("(^|"+P+")"+e+"("+P+"|$)"))),function(e){return t.test(e.className||typeof e.getAttribute!==T&&e.getAttribute("class")||"")}},ATTR:function(e,t,n){return t?function(i){var r=o.attr(i,e),s=r+"";if(null==r)return"!="===t;switch(t){case"=":return s===n;case"!=":return s!==n;case"^=":return n&&0===s.indexOf(n);case"*=":return n&&s.indexOf(n)>-1;case"$=":return n&&s.substr(s.length-n.length)===n;case"~=":return(" "+s+" ").indexOf(n)>-1;case"|=":return s===n||s.substr(0,n.length+1)===n+"-"}}:function(t){return null!=o.attr(t,e)}},CHILD:function(e,t,o,n){if("nth"===e){var i=D++;return function(e){var t,r,s=0,l=e;if(1===o&&0===n)return!0;if(t=e.parentNode,t&&(t[S]!==i||!e.sizset)){for(l=t.firstChild;l&&(1!==l.nodeType||(l.sizset=++s,l!==e));l=l.nextSibling);t[S]=i}return r=e.sizset-n,0===o?0===r:r%o===0&&r/o>=0}}return function(t){var o=t;switch(e){case"only":case"first":for(;o=o.previousSibling;)if(1===o.nodeType)return!1;if("first"===e)return!0;o=t;case"last":for(;o=o.nextSibling;)if(1===o.nodeType)return!1;return!0}}},PSEUDO:function(e,t,n,i){var r,s=_.pseudos[e]||_.pseudos[e.toLowerCase()];return s||o.error("unsupported pseudo: "+e),s[S]?s(t,n,i):s.length>1?(r=[e,e,"",t],function(e){return s(e,0,r)}):s}},pseudos:{not:L(function(e,t,o){var n=C(e.replace(K,"$1"),t,o);return function(e){return!n(e)}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!_.pseudos.empty(e)},empty:function(e){var t;for(e=e.firstChild;e;){if(e.nodeName>"@"||3===(t=e.nodeType)||4===t)return!1;e=e.nextSibling}return!0},contains:L(function(e){return function(t){return(t.textContent||t.innerText||v(t)).indexOf(e)>-1}}),has:L(function(e){return function(t){return o(e,t).length>0}}),header:function(e){return J.test(e.nodeName)},text:function(e){var t,o;return"input"===e.nodeName.toLowerCase()&&"text"===(t=e.type)&&(null==(o=e.getAttribute("type"))||o.toLowerCase()===t)},radio:n("radio"),checkbox:n("checkbox"),file:n("file"),password:n("password"),image:n("image"),submit:i("submit"),reset:i("reset"),button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return et.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return!(e!==t.activeElement||t.hasFocus&&!t.hasFocus()||!e.type&&!e.href)},active:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t,o){return o?e.slice(1):[e[0]]},last:function(e,t,o){var n=e.pop();return o?e:[n]},even:function(e,t,o){for(var n=[],i=o?1:0,r=e.length;r>i;i+=2)n.push(e[i]);return n},odd:function(e,t,o){for(var n=[],i=o?0:1,r=e.length;r>i;i+=2)n.push(e[i]);return n},lt:function(e,t,o){return o?e.slice(+t):e.slice(0,+t)},gt:function(e,t,o){return o?e.slice(0,+t+1):e.slice(+t+1)},eq:function(e,t,o){var n=e.splice(+t,1);return o?e:n}}},k=w.compareDocumentPosition?function(e,t){return e===t?(b=!0,0):(e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t):e.compareDocumentPosition)?-1:1}:function(e,t){if(e===t)return b=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var o,n,i=[],s=[],l=e.parentNode,a=t.parentNode,c=l;if(l===a)return r(e,t);if(!l)return-1;if(!a)return 1;for(;c;)i.unshift(c),c=c.parentNode;for(c=a;c;)s.unshift(c),c=c.parentNode;o=i.length,n=s.length;for(var u=0;o>u&&n>u;u++)if(i[u]!==s[u])return r(i[u],s[u]);return u===o?r(e,s[u],-1):r(i[u],t,1)},[0,0].sort(k),A=!b,o.uniqueSort=function(e){var t,o=1;if(b=A,e.sort(k),b)for(;t=e[o];o++)t===e[o-1]&&e.splice(o--,1);return e},o.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},C=o.compile=function(e,t,o){var n,i,r,l=M[S][e];if(l&&l.context===t)return l;for(n=s(e,t,o),i=0,r=n.length;r>i;i++)n[i]=c(n[i],t,o);return l=M(e,u(n)),l.context=t,l.runs=l.dirruns=0,l},R.querySelectorAll&&function(){var e,t=p,n=/'|\\/g,i=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,r=[],l=[":active"],a=w.matchesSelector||w.mozMatchesSelector||w.webkitMatchesSelector||w.oMatchesSelector||w.msMatchesSelector;nt(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||r.push("\\["+P+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||r.push(":checked")}),nt(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&r.push("[*^$]="+P+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||r.push(":enabled",":disabled")}),r=r.length&&new RegExp(r.join("|")),p=function(e,o,i,l,a){if(!(l||a||r&&r.test(e)))if(9===o.nodeType)try{return F.apply(i,I.call(o.querySelectorAll(e),0)),i}catch(c){}else if(1===o.nodeType&&"object"!==o.nodeName.toLowerCase()){var u,g,h,d=o.getAttribute("id"),p=d||S,f=q.test(e)&&o.parentNode||o;for(d?p=p.replace(n,"\\$&"):o.setAttribute("id",p),u=s(e,o,a),p="[id='"+p+"']",g=0,h=u.length;h>g;g++)u[g]=p+u[g].selector;try{return F.apply(i,I.call(f.querySelectorAll(u.join(",")),0)),i}catch(c){}finally{d||o.removeAttribute("id")}}return t(e,o,i,l,a)},a&&(nt(function(t){e=a.call(t,"div");try{a.call(t,"[test!='']:sizzle"),l.push(ot.PSEUDO.source,ot.POS.source,"!=")}catch(o){}}),l=new RegExp(l.join("|")),o.matchesSelector=function(t,n){if(n=n.replace(i,"='$1']"),!(E(t)||l.test(n)||r&&r.test(n)))try{var s=a.call(t,n);if(s||e||t.document&&11!==t.document.nodeType)return s}catch(c){}return o(n,null,null,[t]).length>0})}(),_.setFilters.nth=_.setFilters.eq,_.filters=_.pseudos,o.attr=Z.attr,Z.find=o,Z.expr=o.selectors,Z.expr[":"]=Z.expr.pseudos,Z.unique=o.uniqueSort,Z.text=o.getText,Z.isXMLDoc=o.isXML,Z.contains=o.contains}(e);var Nt=/Until$/,Ot=/^(?:parents|prev(?:Until|All))/,xt=/^.[^:#\[\.,]*$/,Mt=Z.expr.match.needsContext,Pt={children:!0,contents:!0,next:!0,prev:!0};Z.fn.extend({find:function(e){var t,o,n,i,r,s,l=this;if("string"!=typeof e)return Z(e).filter(function(){for(t=0,o=l.length;o>t;t++)if(Z.contains(l[t],this))return!0});for(s=this.pushStack("","find",e),t=0,o=this.length;o>t;t++)if(n=s.length,Z.find(e,this[t],s),t>0)for(i=n;i<s.length;i++)for(r=0;n>r;r++)if(s[r]===s[i]){s.splice(i--,1);break}return s},has:function(e){var t,o=Z(e,this),n=o.length;return this.filter(function(){for(t=0;n>t;t++)if(Z.contains(this,o[t]))return!0})},not:function(e){return this.pushStack(c(this,e,!1),"not",e)},filter:function(e){return this.pushStack(c(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?Mt.test(e)?Z(e,this.context).index(this[0])>=0:Z.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var o,n=0,i=this.length,r=[],s=Mt.test(e)||"string"!=typeof e?Z(e,t||this.context):0;i>n;n++)for(o=this[n];o&&o.ownerDocument&&o!==t&&11!==o.nodeType;){if(s?s.index(o)>-1:Z.find.matchesSelector(o,e)){r.push(o);break}o=o.parentNode}return r=r.length>1?Z.unique(r):r,this.pushStack(r,"closest",e)},index:function(e){return e?"string"==typeof e?Z.inArray(this[0],Z(e)):Z.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var o="string"==typeof e?Z(e,t):Z.makeArray(e&&e.nodeType?[e]:e),n=Z.merge(this.get(),o);return this.pushStack(l(o[0])||l(n[0])?n:Z.unique(n))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),Z.fn.andSelf=Z.fn.addBack,Z.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Z.dir(e,"parentNode")},parentsUntil:function(e,t,o){return Z.dir(e,"parentNode",o)},next:function(e){return a(e,"nextSibling")},prev:function(e){return a(e,"previousSibling")},nextAll:function(e){return Z.dir(e,"nextSibling")},prevAll:function(e){return Z.dir(e,"previousSibling")},nextUntil:function(e,t,o){return Z.dir(e,"nextSibling",o)},prevUntil:function(e,t,o){return Z.dir(e,"previousSibling",o)},siblings:function(e){return Z.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return Z.sibling(e.firstChild)},contents:function(e){return Z.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:Z.merge([],e.childNodes)}},function(e,t){Z.fn[e]=function(o,n){var i=Z.map(this,t,o);return Nt.test(e)||(n=o),n&&"string"==typeof n&&(i=Z.filter(n,i)),i=this.length>1&&!Pt[e]?Z.unique(i):i,this.length>1&&Ot.test(e)&&(i=i.reverse()),this.pushStack(i,e,z.call(arguments).join(","))}}),Z.extend({filter:function(e,t,o){return o&&(e=":not("+e+")"),1===t.length?Z.find.matchesSelector(t[0],e)?[t[0]]:[]:Z.find.matches(e,t)},dir:function(e,o,n){for(var i=[],r=e[o];r&&9!==r.nodeType&&(n===t||1!==r.nodeType||!Z(r).is(n));)1===r.nodeType&&i.push(r),r=r[o];return i},sibling:function(e,t){for(var o=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&o.push(e);return o}});var Ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Ut=/ jQuery\d+="(?:null|\d+)"/g,$t=/^\s+/,Gt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Wt=/<([\w:]+)/,Vt=/<tbody/i,Kt=/<|&#?\w+;/,jt=/<(?:script|style|link)/i,zt=/<(?:script|object|embed|option|style)/i,Xt=new RegExp("<(?:"+Ht+")[\\s/>]","i"),Yt=/^(?:checkbox|radio)$/,qt=/checked\s*(?:[^=]|=\s*.checked.)/i,Qt=/\/(java|ecma)script/i,Zt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Jt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},eo=u($),to=eo.appendChild($.createElement("div"));Jt.optgroup=Jt.option,Jt.tbody=Jt.tfoot=Jt.colgroup=Jt.caption=Jt.thead,Jt.th=Jt.td,Z.support.htmlSerialize||(Jt._default=[1,"X<div>","</div>"]),Z.fn.extend({text:function(e){return Z.access(this,function(e){return e===t?Z.text(this):this.empty().append((this[0]&&this[0].ownerDocument||$).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(Z.isFunction(e))return this.each(function(t){Z(this).wrapAll(e.call(this,t))});if(this[0]){var t=Z(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return Z.isFunction(e)?this.each(function(t){Z(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Z(this),o=t.contents();o.length?o.wrapAll(e):t.append(e)})},wrap:function(e){var t=Z.isFunction(e);return this.each(function(o){Z(this).wrapAll(t?e.call(this,o):e)})},unwrap:function(){return this.parent().each(function(){Z.nodeName(this,"body")||Z(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!l(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)
3
- });if(arguments.length){var e=Z.clean(arguments);return this.pushStack(Z.merge(e,this),"before",this.selector)}},after:function(){if(!l(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=Z.clean(arguments);return this.pushStack(Z.merge(this,e),"after",this.selector)}},remove:function(e,t){for(var o,n=0;null!=(o=this[n]);n++)(!e||Z.filter(e,[o]).length)&&(!t&&1===o.nodeType&&(Z.cleanData(o.getElementsByTagName("*")),Z.cleanData([o])),o.parentNode&&o.parentNode.removeChild(o));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&Z.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return Z.clone(this,e,t)})},html:function(e){return Z.access(this,function(e){var o=this[0]||{},n=0,i=this.length;if(e===t)return 1===o.nodeType?o.innerHTML.replace(Ut,""):t;if(!("string"!=typeof e||jt.test(e)||!Z.support.htmlSerialize&&Xt.test(e)||!Z.support.leadingWhitespace&&$t.test(e)||Jt[(Wt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Gt,"<$1></$2>");try{for(;i>n;n++)o=this[n]||{},1===o.nodeType&&(Z.cleanData(o.getElementsByTagName("*")),o.innerHTML=e);o=0}catch(r){}}o&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return l(this[0])?this.length?this.pushStack(Z(Z.isFunction(e)?e():e),"replaceWith",e):this:Z.isFunction(e)?this.each(function(t){var o=Z(this),n=o.html();o.replaceWith(e.call(this,t,n))}):("string"!=typeof e&&(e=Z(e).detach()),this.each(function(){var t=this.nextSibling,o=this.parentNode;Z(this).remove(),t?Z(t).before(e):Z(o).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,o,n){e=[].concat.apply([],e);var i,r,s,l,a=0,c=e[0],u=[],h=this.length;if(!Z.support.checkClone&&h>1&&"string"==typeof c&&qt.test(c))return this.each(function(){Z(this).domManip(e,o,n)});if(Z.isFunction(c))return this.each(function(i){var r=Z(this);e[0]=c.call(this,i,o?r.html():t),r.domManip(e,o,n)});if(this[0]){if(i=Z.buildFragment(e,this,u),s=i.fragment,r=s.firstChild,1===s.childNodes.length&&(s=r),r)for(o=o&&Z.nodeName(r,"tr"),l=i.cacheable||h-1;h>a;a++)n.call(o&&Z.nodeName(this[a],"table")?g(this[a],"tbody"):this[a],a===l?s:Z.clone(s,!0,!0));s=r=null,u.length&&Z.each(u,function(e,t){t.src?Z.ajax?Z.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Z.error("no ajax"):Z.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Zt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),Z.buildFragment=function(e,o,n){var i,r,s,l=e[0];return o=o||$,o=!o.nodeType&&o[0]||o,o=o.ownerDocument||o,1===e.length&&"string"==typeof l&&l.length<512&&o===$&&"<"===l.charAt(0)&&!zt.test(l)&&(Z.support.checkClone||!qt.test(l))&&(Z.support.html5Clone||!Xt.test(l))&&(r=!0,i=Z.fragments[l],s=i!==t),i||(i=o.createDocumentFragment(),Z.clean(e,o,i,n),r&&(Z.fragments[l]=s&&i)),{fragment:i,cacheable:r}},Z.fragments={},Z.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){Z.fn[e]=function(o){var n,i=0,r=[],s=Z(o),l=s.length,a=1===this.length&&this[0].parentNode;if((null==a||a&&11===a.nodeType&&1===a.childNodes.length)&&1===l)return s[t](this[0]),this;for(;l>i;i++)n=(i>0?this.clone(!0):this).get(),Z(s[i])[t](n),r=r.concat(n);return this.pushStack(r,e,s.selector)}}),Z.extend({clone:function(e,t,o){var n,i,r,s;if(Z.support.html5Clone||Z.isXMLDoc(e)||!Xt.test("<"+e.nodeName+">")?s=e.cloneNode(!0):(to.innerHTML=e.outerHTML,to.removeChild(s=to.firstChild)),!(Z.support.noCloneEvent&&Z.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Z.isXMLDoc(e)))for(d(e,s),n=p(e),i=p(s),r=0;n[r];++r)i[r]&&d(n[r],i[r]);if(t&&(h(e,s),o))for(n=p(e),i=p(s),r=0;n[r];++r)h(n[r],i[r]);return n=i=null,s},clean:function(e,t,o,n){var i,r,s,l,a,c,g,h,d,p,m,y=t===$&&eo,_=[];for(t&&"undefined"!=typeof t.createDocumentFragment||(t=$),i=0;null!=(s=e[i]);i++)if("number"==typeof s&&(s+=""),s){if("string"==typeof s)if(Kt.test(s)){for(y=y||u(t),g=t.createElement("div"),y.appendChild(g),s=s.replace(Gt,"<$1></$2>"),l=(Wt.exec(s)||["",""])[1].toLowerCase(),a=Jt[l]||Jt._default,c=a[0],g.innerHTML=a[1]+s+a[2];c--;)g=g.lastChild;if(!Z.support.tbody)for(h=Vt.test(s),d="table"!==l||h?"<table>"!==a[1]||h?[]:g.childNodes:g.firstChild&&g.firstChild.childNodes,r=d.length-1;r>=0;--r)Z.nodeName(d[r],"tbody")&&!d[r].childNodes.length&&d[r].parentNode.removeChild(d[r]);!Z.support.leadingWhitespace&&$t.test(s)&&g.insertBefore(t.createTextNode($t.exec(s)[0]),g.firstChild),s=g.childNodes,g.parentNode.removeChild(g)}else s=t.createTextNode(s);s.nodeType?_.push(s):Z.merge(_,s)}if(g&&(s=g=y=null),!Z.support.appendChecked)for(i=0;null!=(s=_[i]);i++)Z.nodeName(s,"input")?f(s):"undefined"!=typeof s.getElementsByTagName&&Z.grep(s.getElementsByTagName("input"),f);if(o)for(p=function(e){return!e.type||Qt.test(e.type)?n?n.push(e.parentNode?e.parentNode.removeChild(e):e):o.appendChild(e):void 0},i=0;null!=(s=_[i]);i++)Z.nodeName(s,"script")&&p(s)||(o.appendChild(s),"undefined"!=typeof s.getElementsByTagName&&(m=Z.grep(Z.merge([],s.getElementsByTagName("script")),p),_.splice.apply(_,[i+1,0].concat(m)),i+=m.length));return _},cleanData:function(e,t){for(var o,n,i,r,s=0,l=Z.expando,a=Z.cache,c=Z.support.deleteExpando,u=Z.event.special;null!=(i=e[s]);s++)if((t||Z.acceptData(i))&&(n=i[l],o=n&&a[n])){if(o.events)for(r in o.events)u[r]?Z.event.remove(i,r):Z.removeEvent(i,r,o.handle);a[n]&&(delete a[n],c?delete i[l]:i.removeAttribute?i.removeAttribute(l):i[l]=null,Z.deletedIds.push(n))}}}),function(){var e,t;Z.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=Z.uaMatch(W.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),Z.browser=t,Z.sub=function(){function e(t,o){return new e.fn.init(t,o)}Z.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function o(o,n){return n&&n instanceof Z&&!(n instanceof e)&&(n=e(n)),Z.fn.init.call(this,o,n,t)},e.fn.init.prototype=e.fn;var t=e($);return e}}();var oo,no,io,ro=/alpha\([^)]*\)/i,so=/opacity=([^)]*)/,lo=/^(top|right|bottom|left)$/,ao=/^(none|table(?!-c[ea]).+)/,co=/^margin/,uo=new RegExp("^("+J+")(.*)$","i"),go=new RegExp("^("+J+")(?!px)[a-z%]+$","i"),ho=new RegExp("^([-+])=("+J+")","i"),po={},fo={position:"absolute",visibility:"hidden",display:"block"},mo={letterSpacing:0,fontWeight:400},yo=["Top","Right","Bottom","Left"],_o=["Webkit","O","Moz","ms"],vo=Z.fn.toggle;Z.fn.extend({css:function(e,o){return Z.access(this,function(e,o,n){return n!==t?Z.style(e,o,n):Z.css(e,o)},e,o,arguments.length>1)},show:function(){return _(this,!0)},hide:function(){return _(this)},toggle:function(e,t){var o="boolean"==typeof e;return Z.isFunction(e)&&Z.isFunction(t)?vo.apply(this,arguments):this.each(function(){(o?e:y(this))?Z(this).show():Z(this).hide()})}}),Z.extend({cssHooks:{opacity:{get:function(e,t){if(t){var o=oo(e,"opacity");return""===o?"1":o}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Z.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,o,n,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,s,l,a=Z.camelCase(o),c=e.style;if(o=Z.cssProps[a]||(Z.cssProps[a]=m(c,a)),l=Z.cssHooks[o]||Z.cssHooks[a],n===t)return l&&"get"in l&&(r=l.get(e,!1,i))!==t?r:c[o];if(s=typeof n,"string"===s&&(r=ho.exec(n))&&(n=(r[1]+1)*r[2]+parseFloat(Z.css(e,o)),s="number"),!(null==n||"number"===s&&isNaN(n)||("number"===s&&!Z.cssNumber[a]&&(n+="px"),l&&"set"in l&&(n=l.set(e,n,i))===t)))try{c[o]=n}catch(u){}}},css:function(e,o,n,i){var r,s,l,a=Z.camelCase(o);return o=Z.cssProps[a]||(Z.cssProps[a]=m(e.style,a)),l=Z.cssHooks[o]||Z.cssHooks[a],l&&"get"in l&&(r=l.get(e,!0,i)),r===t&&(r=oo(e,o)),"normal"===r&&o in mo&&(r=mo[o]),n||i!==t?(s=parseFloat(r),n||Z.isNumeric(s)?s||0:r):r},swap:function(e,t,o){var n,i,r={};for(i in t)r[i]=e.style[i],e.style[i]=t[i];n=o.call(e);for(i in t)e.style[i]=r[i];return n}}),e.getComputedStyle?oo=function(t,o){var n,i,r,s,l=e.getComputedStyle(t,null),a=t.style;return l&&(n=l[o],""===n&&!Z.contains(t.ownerDocument,t)&&(n=Z.style(t,o)),go.test(n)&&co.test(o)&&(i=a.width,r=a.minWidth,s=a.maxWidth,a.minWidth=a.maxWidth=a.width=n,n=l.width,a.width=i,a.minWidth=r,a.maxWidth=s)),n}:$.documentElement.currentStyle&&(oo=function(e,t){var o,n,i=e.currentStyle&&e.currentStyle[t],r=e.style;return null==i&&r&&r[t]&&(i=r[t]),go.test(i)&&!lo.test(t)&&(o=r.left,n=e.runtimeStyle&&e.runtimeStyle.left,n&&(e.runtimeStyle.left=e.currentStyle.left),r.left="fontSize"===t?"1em":i,i=r.pixelLeft+"px",r.left=o,n&&(e.runtimeStyle.left=n)),""===i?"auto":i}),Z.each(["height","width"],function(e,t){Z.cssHooks[t]={get:function(e,o,n){return o?0===e.offsetWidth&&ao.test(oo(e,"display"))?Z.swap(e,fo,function(){return B(e,t,n)}):B(e,t,n):void 0},set:function(e,o,n){return v(e,o,n?E(e,t,n,Z.support.boxSizing&&"border-box"===Z.css(e,"boxSizing")):0)}}}),Z.support.opacity||(Z.cssHooks.opacity={get:function(e,t){return so.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var o=e.style,n=e.currentStyle,i=Z.isNumeric(t)?"alpha(opacity="+100*t+")":"",r=n&&n.filter||o.filter||"";o.zoom=1,t>=1&&""===Z.trim(r.replace(ro,""))&&o.removeAttribute&&(o.removeAttribute("filter"),n&&!n.filter)||(o.filter=ro.test(r)?r.replace(ro,i):r+" "+i)}}),Z(function(){Z.support.reliableMarginRight||(Z.cssHooks.marginRight={get:function(e,t){return Z.swap(e,{display:"inline-block"},function(){return t?oo(e,"marginRight"):void 0})}}),!Z.support.pixelPosition&&Z.fn.position&&Z.each(["top","left"],function(e,t){Z.cssHooks[t]={get:function(e,o){if(o){var n=oo(e,t);return go.test(n)?Z(e).position()[t]+"px":n}}}})}),Z.expr&&Z.expr.filters&&(Z.expr.filters.hidden=function(e){return 0===e.offsetWidth&&0===e.offsetHeight||!Z.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||oo(e,"display"))},Z.expr.filters.visible=function(e){return!Z.expr.filters.hidden(e)}),Z.each({margin:"",padding:"",border:"Width"},function(e,t){Z.cssHooks[e+t]={expand:function(o){var n,i="string"==typeof o?o.split(" "):[o],r={};for(n=0;4>n;n++)r[e+yo[n]+t]=i[n]||i[n-2]||i[0];return r}},co.test(e)||(Z.cssHooks[e+t].set=v)});var Eo=/%20/g,Bo=/\[\]$/,Co=/\r?\n/g,ko=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bo=/^(?:select|textarea)/i;Z.fn.extend({serialize:function(){return Z.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Z.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bo.test(this.nodeName)||ko.test(this.type))}).map(function(e,t){var o=Z(this).val();return null==o?null:Z.isArray(o)?Z.map(o,function(e){return{name:t.name,value:e.replace(Co,"\r\n")}}):{name:t.name,value:o.replace(Co,"\r\n")}}).get()}}),Z.param=function(e,o){var n,i=[],r=function(e,t){t=Z.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(o===t&&(o=Z.ajaxSettings&&Z.ajaxSettings.traditional),Z.isArray(e)||e.jquery&&!Z.isPlainObject(e))Z.each(e,function(){r(this.name,this.value)});else for(n in e)k(n,e[n],o,r);return i.join("&").replace(Eo,"+")};var Ao,To,So=/#.*$/,Ro=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,wo=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Do=/^(?:GET|HEAD)$/,Io=/^\/\//,Fo=/\?/,Lo=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,No=/([?&])_=[^&]*/,Oo=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,xo=Z.fn.load,Mo={},Po={},Ho=["*/"]+["*"];try{Ao=G.href}catch(Uo){Ao=$.createElement("a"),Ao.href="",Ao=Ao.href}To=Oo.exec(Ao.toLowerCase())||[],Z.fn.load=function(e,o,n){if("string"!=typeof e&&xo)return xo.apply(this,arguments);if(!this.length)return this;var i,r,s,l=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),Z.isFunction(o)?(n=o,o=t):o&&"object"==typeof o&&(r="POST"),Z.ajax({url:e,type:r,dataType:"html",data:o,complete:function(e,t){n&&l.each(n,s||[e.responseText,t,e])}}).done(function(e){s=arguments,l.html(i?Z("<div>").append(e.replace(Lo,"")).find(i):e)}),this},Z.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){Z.fn[t]=function(e){return this.on(t,e)}}),Z.each(["get","post"],function(e,o){Z[o]=function(e,n,i,r){return Z.isFunction(n)&&(r=r||i,i=n,n=t),Z.ajax({type:o,url:e,data:n,success:i,dataType:r})}}),Z.extend({getScript:function(e,o){return Z.get(e,t,o,"script")},getJSON:function(e,t,o){return Z.get(e,t,o,"json")},ajaxSetup:function(e,t){return t?T(e,Z.ajaxSettings):(t=e,e=Z.ajaxSettings),T(e,t),e},ajaxSettings:{url:Ao,isLocal:wo.test(To[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Ho},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":Z.parseJSON,"text xml":Z.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:b(Mo),ajaxTransport:b(Po),ajax:function(e,o){function n(e,o,n,s){var c,g,_,v,B,k=o;2!==E&&(E=2,a&&clearTimeout(a),l=t,r=s||"",C.readyState=e>0?4:0,n&&(v=S(h,C,n)),e>=200&&300>e||304===e?(h.ifModified&&(B=C.getResponseHeader("Last-Modified"),B&&(Z.lastModified[i]=B),B=C.getResponseHeader("Etag"),B&&(Z.etag[i]=B)),304===e?(k="notmodified",c=!0):(c=R(h,v),k=c.state,g=c.data,_=c.error,c=!_)):(_=k,(!k||e)&&(k="error",0>e&&(e=0))),C.status=e,C.statusText=""+(o||k),c?f.resolveWith(d,[g,k,C]):f.rejectWith(d,[C,k,_]),C.statusCode(y),y=t,u&&p.trigger("ajax"+(c?"Success":"Error"),[C,h,c?g:_]),m.fireWith(d,[C,k]),u&&(p.trigger("ajaxComplete",[C,h]),--Z.active||Z.event.trigger("ajaxStop")))}"object"==typeof e&&(o=e,e=t),o=o||{};var i,r,s,l,a,c,u,g,h=Z.ajaxSetup({},o),d=h.context||h,p=d!==h&&(d.nodeType||d instanceof Z)?Z(d):Z.event,f=Z.Deferred(),m=Z.Callbacks("once memory"),y=h.statusCode||{},_={},v={},E=0,B="canceled",C={readyState:0,setRequestHeader:function(e,t){if(!E){var o=e.toLowerCase();e=v[o]=v[o]||e,_[e]=t}return this},getAllResponseHeaders:function(){return 2===E?r:null},getResponseHeader:function(e){var o;if(2===E){if(!s)for(s={};o=Ro.exec(r);)s[o[1].toLowerCase()]=o[2];o=s[e.toLowerCase()]}return o===t?null:o},overrideMimeType:function(e){return E||(h.mimeType=e),this},abort:function(e){return e=e||B,l&&l.abort(e),n(0,e),this}};if(f.promise(C),C.success=C.done,C.error=C.fail,C.complete=m.add,C.statusCode=function(e){if(e){var t;if(2>E)for(t in e)y[t]=[y[t],e[t]];else t=e[C.status],C.always(t)}return this},h.url=((e||h.url)+"").replace(So,"").replace(Io,To[1]+"//"),h.dataTypes=Z.trim(h.dataType||"*").toLowerCase().split(tt),null==h.crossDomain&&(c=Oo.exec(h.url.toLowerCase()),h.crossDomain=!(!c||c[1]==To[1]&&c[2]==To[2]&&(c[3]||("http:"===c[1]?80:443))==(To[3]||("http:"===To[1]?80:443)))),h.data&&h.processData&&"string"!=typeof h.data&&(h.data=Z.param(h.data,h.traditional)),A(Mo,h,o,C),2===E)return C;if(u=h.global,h.type=h.type.toUpperCase(),h.hasContent=!Do.test(h.type),u&&0===Z.active++&&Z.event.trigger("ajaxStart"),!h.hasContent&&(h.data&&(h.url+=(Fo.test(h.url)?"&":"?")+h.data,delete h.data),i=h.url,h.cache===!1)){var k=Z.now(),b=h.url.replace(No,"$1_="+k);h.url=b+(b===h.url?(Fo.test(h.url)?"&":"?")+"_="+k:"")}(h.data&&h.hasContent&&h.contentType!==!1||o.contentType)&&C.setRequestHeader("Content-Type",h.contentType),h.ifModified&&(i=i||h.url,Z.lastModified[i]&&C.setRequestHeader("If-Modified-Since",Z.lastModified[i]),Z.etag[i]&&C.setRequestHeader("If-None-Match",Z.etag[i])),C.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Ho+"; q=0.01":""):h.accepts["*"]);for(g in h.headers)C.setRequestHeader(g,h.headers[g]);if(!h.beforeSend||h.beforeSend.call(d,C,h)!==!1&&2!==E){B="abort";for(g in{success:1,error:1,complete:1})C[g](h[g]);if(l=A(Po,h,o,C)){C.readyState=1,u&&p.trigger("ajaxSend",[C,h]),h.async&&h.timeout>0&&(a=setTimeout(function(){C.abort("timeout")},h.timeout));try{E=1,l.send(_,n)}catch(T){if(!(2>E))throw T;n(-1,T)}}else n(-1,"No Transport");return C}return C.abort()},active:0,lastModified:{},etag:{}});var $o=[],Go=/\?/,Wo=/(=)\?(?=&|$)|\?\?/,Vo=Z.now();Z.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=$o.pop()||Z.expando+"_"+Vo++;return this[e]=!0,e}}),Z.ajaxPrefilter("json jsonp",function(o,n,i){var r,s,l,a=o.data,c=o.url,u=o.jsonp!==!1,g=u&&Wo.test(c),h=u&&!g&&"string"==typeof a&&!(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&Wo.test(a);return"jsonp"===o.dataTypes[0]||g||h?(r=o.jsonpCallback=Z.isFunction(o.jsonpCallback)?o.jsonpCallback():o.jsonpCallback,s=e[r],g?o.url=c.replace(Wo,"$1"+r):h?o.data=a.replace(Wo,"$1"+r):u&&(o.url+=(Go.test(c)?"&":"?")+o.jsonp+"="+r),o.converters["script json"]=function(){return l||Z.error(r+" was not called"),l[0]},o.dataTypes[0]="json",e[r]=function(){l=arguments},i.always(function(){e[r]=s,o[r]&&(o.jsonpCallback=n.jsonpCallback,$o.push(r)),l&&Z.isFunction(s)&&s(l[0]),l=s=t}),"script"):void 0}),Z.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return Z.globalEval(e),e}}}),Z.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),Z.ajaxTransport("script",function(e){if(e.crossDomain){var o,n=$.head||$.getElementsByTagName("head")[0]||$.documentElement;return{send:function(i,r){o=$.createElement("script"),o.async="async",e.scriptCharset&&(o.charset=e.scriptCharset),o.src=e.url,o.onload=o.onreadystatechange=function(e,i){(i||!o.readyState||/loaded|complete/.test(o.readyState))&&(o.onload=o.onreadystatechange=null,n&&o.parentNode&&n.removeChild(o),o=t,i||r(200,"success"))},n.insertBefore(o,n.firstChild)},abort:function(){o&&o.onload(0,1)}}}});var Ko,jo=e.ActiveXObject?function(){for(var e in Ko)Ko[e](0,1)}:!1,zo=0;Z.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&w()||D()}:w,function(e){Z.extend(Z.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(Z.ajaxSettings.xhr()),Z.support.ajax&&Z.ajaxTransport(function(o){if(!o.crossDomain||Z.support.cors){var n;return{send:function(i,r){var s,l,a=o.xhr();if(o.username?a.open(o.type,o.url,o.async,o.username,o.password):a.open(o.type,o.url,o.async),o.xhrFields)for(l in o.xhrFields)a[l]=o.xhrFields[l];o.mimeType&&a.overrideMimeType&&a.overrideMimeType(o.mimeType),!o.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(l in i)a.setRequestHeader(l,i[l])}catch(c){}a.send(o.hasContent&&o.data||null),n=function(e,i){var l,c,u,g,h;try{if(n&&(i||4===a.readyState))if(n=t,s&&(a.onreadystatechange=Z.noop,jo&&delete Ko[s]),i)4!==a.readyState&&a.abort();else{l=a.status,u=a.getAllResponseHeaders(),g={},h=a.responseXML,h&&h.documentElement&&(g.xml=h);try{g.text=a.responseText}catch(e){}try{c=a.statusText}catch(d){c=""}l||!o.isLocal||o.crossDomain?1223===l&&(l=204):l=g.text?200:404}}catch(p){i||r(-1,p)}g&&r(l,c,g,u)},o.async?4===a.readyState?setTimeout(n,0):(s=++zo,jo&&(Ko||(Ko={},Z(e).unload(jo)),Ko[s]=n),a.onreadystatechange=n):n()},abort:function(){n&&n(0,1)}}}});var Xo,Yo,qo=/^(?:toggle|show|hide)$/,Qo=new RegExp("^(?:([-+])=|)("+J+")([a-z%]*)$","i"),Zo=/queueHooks$/,Jo=[O],en={"*":[function(e,t){var o,n,i,r=this.createTween(e,t),s=Qo.exec(t),l=r.cur(),a=+l||0,c=1;if(s){if(o=+s[2],n=s[3]||(Z.cssNumber[e]?"":"px"),"px"!==n&&a){a=Z.css(r.elem,e,!0)||o||1;do i=c=c||".5",a/=c,Z.style(r.elem,e,a+n),c=r.cur()/l;while(1!==c&&c!==i)}r.unit=n,r.start=a,r.end=s[1]?a+(s[1]+1)*o:o}return r}]};Z.Animation=Z.extend(L,{tweener:function(e,t){Z.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var o,n=0,i=e.length;i>n;n++)o=e[n],en[o]=en[o]||[],en[o].unshift(t)},prefilter:function(e,t){t?Jo.unshift(e):Jo.push(e)}}),Z.Tween=x,x.prototype={constructor:x,init:function(e,t,o,n,i,r){this.elem=e,this.prop=o,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=r||(Z.cssNumber[o]?"":"px")},cur:function(){var e=x.propHooks[this.prop];return e&&e.get?e.get(this):x.propHooks._default.get(this)},run:function(e){var t,o=x.propHooks[this.prop];return this.pos=t=this.options.duration?Z.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),o&&o.set?o.set(this):x.propHooks._default.set(this),this}},x.prototype.init.prototype=x.prototype,x.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=Z.css(e.elem,e.prop,!1,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){Z.fx.step[e.prop]?Z.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[Z.cssProps[e.prop]]||Z.cssHooks[e.prop])?Z.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},x.propHooks.scrollTop=x.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Z.each(["toggle","show","hide"],function(e,t){var o=Z.fn[t];Z.fn[t]=function(n,i,r){return null==n||"boolean"==typeof n||!e&&Z.isFunction(n)&&Z.isFunction(i)?o.apply(this,arguments):this.animate(M(t,!0),n,i,r)}}),Z.fn.extend({fadeTo:function(e,t,o,n){return this.filter(y).css("opacity",0).show().end().animate({opacity:t},e,o,n)},animate:function(e,t,o,n){var i=Z.isEmptyObject(e),r=Z.speed(t,o,n),s=function(){var t=L(this,Z.extend({},e),r);i&&t.stop(!0)};return i||r.queue===!1?this.each(s):this.queue(r.queue,s)},stop:function(e,o,n){var i=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=o,o=e,e=t),o&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,o=null!=e&&e+"queueHooks",r=Z.timers,s=Z._data(this);if(o)s[o]&&s[o].stop&&i(s[o]);else for(o in s)s[o]&&s[o].stop&&Zo.test(o)&&i(s[o]);for(o=r.length;o--;)r[o].elem===this&&(null==e||r[o].queue===e)&&(r[o].anim.stop(n),t=!1,r.splice(o,1));(t||!n)&&Z.dequeue(this,e)})}}),Z.each({slideDown:M("show"),slideUp:M("hide"),slideToggle:M("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){Z.fn[e]=function(e,o,n){return this.animate(t,e,o,n)}}),Z.speed=function(e,t,o){var n=e&&"object"==typeof e?Z.extend({},e):{complete:o||!o&&t||Z.isFunction(e)&&e,duration:e,easing:o&&t||t&&!Z.isFunction(t)&&t};return n.duration=Z.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in Z.fx.speeds?Z.fx.speeds[n.duration]:Z.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(){Z.isFunction(n.old)&&n.old.call(this),n.queue&&Z.dequeue(this,n.queue)},n},Z.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},Z.timers=[],Z.fx=x.prototype.init,Z.fx.tick=function(){for(var e,t=Z.timers,o=0;o<t.length;o++)e=t[o],!e()&&t[o]===e&&t.splice(o--,1);t.length||Z.fx.stop()},Z.fx.timer=function(e){e()&&Z.timers.push(e)&&!Yo&&(Yo=setInterval(Z.fx.tick,Z.fx.interval))},Z.fx.interval=13,Z.fx.stop=function(){clearInterval(Yo),Yo=null},Z.fx.speeds={slow:600,fast:200,_default:400},Z.fx.step={},Z.expr&&Z.expr.filters&&(Z.expr.filters.animated=function(e){return Z.grep(Z.timers,function(t){return e===t.elem}).length});var tn=/^(?:body|html)$/i;Z.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){Z.offset.setOffset(this,e,t)});var o,n,i,r,s,l,a,c,u,g,h=this[0],d=h&&h.ownerDocument;if(d)return(i=d.body)===h?Z.offset.bodyOffset(h):(n=d.documentElement,Z.contains(n,h)?(o=h.getBoundingClientRect(),r=P(d),s=n.clientTop||i.clientTop||0,l=n.clientLeft||i.clientLeft||0,a=r.pageYOffset||n.scrollTop,c=r.pageXOffset||n.scrollLeft,u=o.top+a-s,g=o.left+c-l,{top:u,left:g}):{top:0,left:0})},Z.offset={bodyOffset:function(e){var t=e.offsetTop,o=e.offsetLeft;return Z.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(Z.css(e,"marginTop"))||0,o+=parseFloat(Z.css(e,"marginLeft"))||0),{top:t,left:o}},setOffset:function(e,t,o){var n=Z.css(e,"position");"static"===n&&(e.style.position="relative");var i,r,s=Z(e),l=s.offset(),a=Z.css(e,"top"),c=Z.css(e,"left"),u=("absolute"===n||"fixed"===n)&&Z.inArray("auto",[a,c])>-1,g={},h={};u?(h=s.position(),i=h.top,r=h.left):(i=parseFloat(a)||0,r=parseFloat(c)||0),Z.isFunction(t)&&(t=t.call(e,o,l)),null!=t.top&&(g.top=t.top-l.top+i),null!=t.left&&(g.left=t.left-l.left+r),"using"in t?t.using.call(e,g):s.css(g)}},Z.fn.extend({position:function(){if(this[0]){var e=this[0],t=this.offsetParent(),o=this.offset(),n=tn.test(t[0].nodeName)?{top:0,left:0}:t.offset();return o.top-=parseFloat(Z.css(e,"marginTop"))||0,o.left-=parseFloat(Z.css(e,"marginLeft"))||0,n.top+=parseFloat(Z.css(t[0],"borderTopWidth"))||0,n.left+=parseFloat(Z.css(t[0],"borderLeftWidth"))||0,{top:o.top-n.top,left:o.left-n.left}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||$.body;e&&!tn.test(e.nodeName)&&"static"===Z.css(e,"position");)e=e.offsetParent;return e||$.body})}}),Z.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,o){var n=/Y/.test(o);Z.fn[e]=function(i){return Z.access(this,function(e,i,r){var s=P(e);return r===t?s?o in s?s[o]:s.document.documentElement[i]:e[i]:(s?s.scrollTo(n?Z(s).scrollLeft():r,n?r:Z(s).scrollTop()):e[i]=r,void 0)},e,i,arguments.length,null)}}),Z.each({Height:"height",Width:"width"},function(e,o){Z.each({padding:"inner"+e,content:o,"":"outer"+e},function(n,i){Z.fn[i]=function(i,r){var s=arguments.length&&(n||"boolean"!=typeof i),l=n||(i===!0||r===!0?"margin":"border");return Z.access(this,function(o,n,i){var r;return Z.isWindow(o)?o.document.documentElement["client"+e]:9===o.nodeType?(r=o.documentElement,Math.max(o.body["scroll"+e],r["scroll"+e],o.body["offset"+e],r["offset"+e],r["client"+e])):i===t?Z.css(o,n,i,l):Z.style(o,n,i,l)},o,s?i:t,s,null)}})}),e.jQuery=e.$=Z,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Z})}(window),function(e,t){e.rails!==t&&e.error("jquery-ujs has already been loaded!");var o,n=e(document);e.rails=o={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",buttonClickSelector:"button[data-remote]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input[type=file]",linkDisableSelector:"a[data-disable-with]",CSRFProtection:function(t){var o=e('meta[name="csrf-token"]').attr("content");o&&t.setRequestHeader("X-CSRF-Token",o)},fire:function(t,o,n){var i=e.Event(o);return t.trigger(i,n),i.result!==!1},confirm:function(e){return confirm(e)},ajax:function(t){return e.ajax(t)},href:function(e){return e.attr("href")},handleRemote:function(n){var i,r,s,l,a,c,u,g;if(o.fire(n,"ajax:before")){if(l=n.data("cross-domain"),a=l===t?null:l,c=n.data("with-credentials")||null,u=n.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType,n.is("form")){i=n.attr("method"),r=n.attr("action"),s=n.serializeArray();var h=n.data("ujs:submit-button");h&&(s.push(h),n.data("ujs:submit-button",null))}else n.is(o.inputChangeSelector)?(i=n.data("method"),r=n.data("url"),s=n.serialize(),n.data("params")&&(s=s+"&"+n.data("params"))):n.is(o.buttonClickSelector)?(i=n.data("method")||"get",r=n.data("url"),s=n.serialize(),n.data("params")&&(s=s+"&"+n.data("params"))):(i=n.data("method"),r=o.href(n),s=n.data("params")||null);g={type:i||"GET",data:s,dataType:u,beforeSend:function(e,i){return i.dataType===t&&e.setRequestHeader("accept","*/*;q=0.5, "+i.accepts.script),o.fire(n,"ajax:beforeSend",[e,i])},success:function(e,t,o){n.trigger("ajax:success",[e,t,o])},complete:function(e,t){n.trigger("ajax:complete",[e,t])},error:function(e,t,o){n.trigger("ajax:error",[e,t,o])},crossDomain:a},c&&(g.xhrFields={withCredentials:c}),r&&(g.url=r);var d=o.ajax(g);return n.trigger("ajax:send",d),d}return!1},handleMethod:function(n){var i=o.href(n),r=n.data("method"),s=n.attr("target"),l=e("meta[name=csrf-token]").attr("content"),a=e("meta[name=csrf-param]").attr("content"),c=e('<form method="post" action="'+i+'"></form>'),u='<input name="_method" value="'+r+'" type="hidden" />';a!==t&&l!==t&&(u+='<input name="'+a+'" value="'+l+'" type="hidden" />'),s&&c.attr("target",s),c.hide().append(u).appendTo("body"),c.submit()},disableFormElements:function(t){t.find(o.disableSelector).each(function(){var t=e(this),o=t.is("button")?"html":"val";t.data("ujs:enable-with",t[o]()),t[o](t.data("disable-with")),t.prop("disabled",!0)})},enableFormElements:function(t){t.find(o.enableSelector).each(function(){var t=e(this),o=t.is("button")?"html":"val";t.data("ujs:enable-with")&&t[o](t.data("ujs:enable-with")),t.prop("disabled",!1)})},allowAction:function(e){var t,n=e.data("confirm"),i=!1;return n?(o.fire(e,"confirm")&&(i=o.confirm(n),t=o.fire(e,"confirm:complete",[i])),i&&t):!0},blankInputs:function(t,o,n){var i,r,s=e(),l=o||"input,textarea",a=t.find(l);return a.each(function(){if(i=e(this),r=i.is("input[type=checkbox],input[type=radio]")?i.is(":checked"):i.val(),!r==!n){if(i.is("input[type=radio]")&&a.filter('input[type=radio]:checked[name="'+i.attr("name")+'"]').length)return!0;s=s.add(i)}}),s.length?s:!1},nonBlankInputs:function(e,t){return o.blankInputs(e,t,!0)},stopEverything:function(t){return e(t.target).trigger("ujs:everythingStopped"),t.stopImmediatePropagation(),!1},disableElement:function(e){e.data("ujs:enable-with",e.html()),e.html(e.data("disable-with")),e.bind("click.railsDisable",function(e){return o.stopEverything(e)})},enableElement:function(e){e.data("ujs:enable-with")!==t&&(e.html(e.data("ujs:enable-with")),e.removeData("ujs:enable-with")),e.unbind("click.railsDisable")}},o.fire(n,"rails:attachBindings")&&(e.ajaxPrefilter(function(e,t,n){e.crossDomain||o.CSRFProtection(n)}),n.delegate(o.linkDisableSelector,"ajax:complete",function(){o.enableElement(e(this))}),n.delegate(o.linkClickSelector,"click.rails",function(n){var i=e(this),r=i.data("method"),s=i.data("params");if(!o.allowAction(i))return o.stopEverything(n);if(i.is(o.linkDisableSelector)&&o.disableElement(i),i.data("remote")!==t){if(!(!n.metaKey&&!n.ctrlKey||r&&"GET"!==r||s))return!0;var l=o.handleRemote(i);return l===!1?o.enableElement(i):l.error(function(){o.enableElement(i)}),!1}return i.data("method")?(o.handleMethod(i),!1):void 0}),n.delegate(o.buttonClickSelector,"click.rails",function(t){var n=e(this);return o.allowAction(n)?(o.handleRemote(n),!1):o.stopEverything(t)}),n.delegate(o.inputChangeSelector,"change.rails",function(t){var n=e(this);return o.allowAction(n)?(o.handleRemote(n),!1):o.stopEverything(t)}),n.delegate(o.formSubmitSelector,"submit.rails",function(n){var i=e(this),r=i.data("remote")!==t,s=o.blankInputs(i,o.requiredInputSelector),l=o.nonBlankInputs(i,o.fileInputSelector);if(!o.allowAction(i))return o.stopEverything(n);if(s&&i.attr("novalidate")==t&&o.fire(i,"ajax:aborted:required",[s]))return o.stopEverything(n);if(r){if(l){setTimeout(function(){o.disableFormElements(i)},13);var a=o.fire(i,"ajax:aborted:file",[l]);return a||setTimeout(function(){o.enableFormElements(i)},13),a}return o.handleRemote(i),!1}setTimeout(function(){o.disableFormElements(i)},13)}),n.delegate(o.formInputClickSelector,"click.rails",function(t){var n=e(this);if(!o.allowAction(n))return o.stopEverything(t);var i=n.attr("name"),r=i?{name:i,value:n.val()}:null;n.closest("form").data("ujs:submit-button",r)}),n.delegate(o.formSubmitSelector,"ajax:beforeSend.rails",function(t){this==t.target&&o.disableFormElements(e(this))}),n.delegate(o.formSubmitSelector,"ajax:complete.rails",function(t){this==t.target&&o.enableFormElements(e(this))}),e(function(){var t=e("meta[name=csrf-token]").attr("content"),o=e("meta[name=csrf-param]").attr("content");e('form input[name="'+o+'"]').val(t)}))
4
- }(jQuery),function(e,t){function o(t,o){var i,r,s,l=t.nodeName.toLowerCase();return"area"===l?(i=t.parentNode,r=i.name,t.href&&r&&"map"===i.nodeName.toLowerCase()?(s=e("img[usemap=#"+r+"]")[0],!!s&&n(s)):!1):(/input|select|textarea|button|object/.test(l)?!t.disabled:"a"===l?t.href||o:o)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var i=0,r=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(o,n){return"number"==typeof o?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},o)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(o){if(o!==t)return this.css("zIndex",o);if(this.length)for(var n,i,r=e(this[0]);r.length&&r[0]!==document;){if(n=r.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(i=parseInt(r.css("zIndex"),10),!isNaN(i)&&0!==i))return i;r=r.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++i)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(o){return!!e.data(o,t)}}):function(t,o,n){return!!e.data(t,n[3])},focusable:function(t){return o(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),i=isNaN(n);return(i||n>=0)&&o(t,!i)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(o,n){function i(t,o,n,i){return e.each(r,function(){o-=parseFloat(e.css(t,"padding"+this))||0,n&&(o-=parseFloat(e.css(t,"border"+this+"Width"))||0),i&&(o-=parseFloat(e.css(t,"margin"+this))||0)}),o}var r="Width"===n?["Left","Right"]:["Top","Bottom"],s=n.toLowerCase(),l={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(o){return o===t?l["inner"+n].call(this):this.each(function(){e(this).css(s,i(this,o)+"px")})},e.fn["outer"+n]=function(t,o){return"number"!=typeof t?l["outer"+n].call(this,t):this.each(function(){e(this).css(s,i(this,t,!0,o)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(o){return arguments.length?t.call(this,e.camelCase(o)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,o,n){var i,r=e.ui[t].prototype;for(i in n)r.plugins[i]=r.plugins[i]||[],r.plugins[i].push([o,n[i]])},call:function(e,t,o){var n,i=e.plugins[t];if(i&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;n<i.length;n++)e.options[i[n][0]]&&i[n][1].apply(e.element,o)}},hasScroll:function(t,o){if("hidden"===e(t).css("overflow"))return!1;var n=o&&"left"===o?"scrollLeft":"scrollTop",i=!1;return t[n]>0?!0:(t[n]=1,i=t[n]>0,t[n]=0,i)}})}(jQuery),function(e,t){var o=0,n=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var o,n=0;null!=(o=t[n]);n++)try{e(o).triggerHandler("remove")}catch(r){}i(t)},e.widget=function(t,o,n){var i,r,s,l,a={},c=t.split(".")[0];t=t.split(".")[1],i=c+"-"+t,n||(n=o,o=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[c]=e[c]||{},r=e[c][t],s=e[c][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new s(e,t)},e.extend(s,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),l=new o,l.options=e.widget.extend({},l.options),e.each(n,function(t,n){return e.isFunction(n)?(a[t]=function(){var e=function(){return o.prototype[t].apply(this,arguments)},i=function(e){return o.prototype[t].apply(this,e)};return function(){var t,o=this._super,r=this._superApply;return this._super=e,this._superApply=i,t=n.apply(this,arguments),this._super=o,this._superApply=r,t}}(),void 0):(a[t]=n,void 0)}),s.prototype=e.widget.extend(l,{widgetEventPrefix:r?l.widgetEventPrefix:t},a,{constructor:s,namespace:c,widgetName:t,widgetFullName:i}),r?(e.each(r._childConstructors,function(t,o){var n=o.prototype;e.widget(n.namespace+"."+n.widgetName,s,o._proto)}),delete r._childConstructors):o._childConstructors.push(s),e.widget.bridge(t,s)},e.widget.extend=function(o){for(var i,r,s=n.call(arguments,1),l=0,a=s.length;a>l;l++)for(i in s[l])r=s[l][i],s[l].hasOwnProperty(i)&&r!==t&&(o[i]=e.isPlainObject(r)?e.isPlainObject(o[i])?e.widget.extend({},o[i],r):e.widget.extend({},r):r);return o},e.widget.bridge=function(o,i){var r=i.prototype.widgetFullName||o;e.fn[o]=function(s){var l="string"==typeof s,a=n.call(arguments,1),c=this;return s=!l&&a.length?e.widget.extend.apply(null,[s].concat(a)):s,l?this.each(function(){var n,i=e.data(this,r);return i?e.isFunction(i[s])&&"_"!==s.charAt(0)?(n=i[s].apply(i,a),n!==i&&n!==t?(c=n&&n.jquery?c.pushStack(n.get()):n,!1):void 0):e.error("no such method '"+s+"' for "+o+" widget instance"):e.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+s+"'")}):this.each(function(){var t=e.data(this,r);t?t.option(s||{})._init():e.data(this,r,new i(s,this))}),c}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=o++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(o,n){var i,r,s,l=o;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof o)if(l={},i=o.split("."),o=i.shift(),i.length){for(r=l[o]=e.widget.extend({},this.options[o]),s=0;s<i.length-1;s++)r[i[s]]=r[i[s]]||{},r=r[i[s]];if(o=i.pop(),n===t)return r[o]===t?null:r[o];r[o]=n}else{if(n===t)return this.options[o]===t?null:this.options[o];l[o]=n}return this._setOptions(l),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,o,n){var i,r=this;"boolean"!=typeof t&&(n=o,o=t,t=!1),n?(o=i=e(o),this.bindings=this.bindings.add(o)):(n=o,o=this.element,i=this.widget()),e.each(n,function(n,s){function l(){return t||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof s?r[s]:s).apply(r,arguments):void 0}"string"!=typeof s&&(l.guid=s.guid=s.guid||l.guid||e.guid++);var a=n.match(/^(\w+)\s*(.*)$/),c=a[1]+r.eventNamespace,u=a[2];u?i.delegate(u,c,l):o.bind(c,l)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function o(){return("string"==typeof e?n[e]:e).apply(n,arguments)}var n=this;return setTimeout(o,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,o,n){var i,r,s=this.options[t];if(n=n||{},o=e.Event(o),o.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),o.target=this.element[0],r=o.originalEvent)for(i in r)i in o||(o[i]=r[i]);return this.element.trigger(o,n),!(e.isFunction(s)&&s.apply(this.element[0],[o].concat(n))===!1||o.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,o){e.Widget.prototype["_"+t]=function(n,i,r){"string"==typeof i&&(i={effect:i});var s,l=i?i===!0||"number"==typeof i?o:i.effect||o:t;i=i||{},"number"==typeof i&&(i={duration:i}),s=!e.isEmptyObject(i),i.complete=r,i.delay&&n.delay(i.delay),s&&e.effects&&e.effects.effect[l]?n[t](i):l!==t&&n[l]?n[l](i.duration,i.easing,r):n.queue(function(o){e(this)[t](),r&&r.call(n[0]),o()})}})}(jQuery),function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(o){return!0===e.data(o.target,t.widgetName+".preventClickEvent")?(e.removeData(o.target,t.widgetName+".preventClickEvent"),o.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(o){if(!t){this._mouseStarted&&this._mouseUp(o),this._mouseDownEvent=o;var n=this,i=1===o.which,r="string"==typeof this.options.cancel&&o.target.nodeName?e(o.target).closest(this.options.cancel).length:!1;return i&&!r&&this._mouseCapture(o)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(o)&&this._mouseDelayMet(o)&&(this._mouseStarted=this._mouseStart(o)!==!1,!this._mouseStarted)?(o.preventDefault(),!0):(!0===e.data(o.target,this.widgetName+".preventClickEvent")&&e.removeData(o.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return n._mouseMove(e)},this._mouseUpDelegate=function(e){return n._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),o.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var o=this.options;return this.helper||o.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(o.iframeFix===!0?"iframe":o.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var o=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,o){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!o){var n=this._uiHash();if(this._trigger("drag",t,n)===!1)return this._mouseUp({}),!1;this.position=n.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var o=this,n=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!n||"valid"===this.options.revert&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){o._trigger("stop",t)!==!1&&o._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var o=this.options,n=e.isFunction(o.helper)?e(o.helper.apply(this.element[0],[t])):"clone"===o.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===o.appendTo?this.element[0].parentNode:o.appendTo),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,o,n,i=this.options;return i.containment?"window"===i.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===i.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):i.containment.constructor===Array?(this.containment=i.containment,void 0):("parent"===i.containment&&(i.containment=this.helper[0].parentNode),o=e(i.containment),n=o[0],n&&(t="hidden"!==o.css("overflow"),this.containment=[(parseInt(o.css("borderLeftWidth"),10)||0)+(parseInt(o.css("paddingLeft"),10)||0),(parseInt(o.css("borderTopWidth"),10)||0)+(parseInt(o.css("paddingTop"),10)||0),(t?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(o.css("borderRightWidth"),10)||0)-(parseInt(o.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(o.css("borderBottomWidth"),10)||0)-(parseInt(o.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=o),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,o){o||(o=this.position);var n="absolute"===t?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:i.scrollTop(),left:i.scrollLeft()}),{top:o.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*n,left:o.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*n}},_generatePosition:function(t){var o,n,i,r,s=this.options,l="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=t.pageX,c=t.pageY;return this.offset.scroll||(this.offset.scroll={top:l.scrollTop(),left:l.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(n=this.relative_container.offset(),o=[this.containment[0]+n.left,this.containment[1]+n.top,this.containment[2]+n.left,this.containment[3]+n.top]):o=this.containment,t.pageX-this.offset.click.left<o[0]&&(a=o[0]+this.offset.click.left),t.pageY-this.offset.click.top<o[1]&&(c=o[1]+this.offset.click.top),t.pageX-this.offset.click.left>o[2]&&(a=o[2]+this.offset.click.left),t.pageY-this.offset.click.top>o[3]&&(c=o[3]+this.offset.click.top)),s.grid&&(i=s.grid[1]?this.originalPageY+Math.round((c-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,c=o?i-this.offset.click.top>=o[1]||i-this.offset.click.top>o[3]?i:i-this.offset.click.top>=o[1]?i-s.grid[1]:i+s.grid[1]:i,r=s.grid[0]?this.originalPageX+Math.round((a-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,a=o?r-this.offset.click.left>=o[0]||r-this.offset.click.left>o[2]?r:r-this.offset.click.left>=o[0]?r-s.grid[0]:r+s.grid[0]:r)),{top:c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,o,n){return n=n||this._uiHash(),e.ui.plugin.call(this,t,[o,n]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,o,n)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,o){var n=e(this).data("ui-draggable"),i=n.options,r=e.extend({},o,{item:n.element});n.sortables=[],e(i.connectToSortable).each(function(){var o=e.data(this,"ui-sortable");o&&!o.options.disabled&&(n.sortables.push({instance:o,shouldRevert:o.options.revert}),o.refreshPositions(),o._trigger("activate",t,r))})},stop:function(t,o){var n=e(this).data("ui-draggable"),i=e.extend({},o,{item:n.element});e.each(n.sortables,function(){this.instance.isOver?(this.instance.isOver=0,n.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===n.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,o){var n=e(this).data("ui-draggable"),i=this;e.each(n.sortables,function(){var r=!1,s=this;this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(r=!0,e.each(n.sortables,function(){return this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this!==s&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(s.instance.element[0],this.instance.element[0])&&(r=!1),r})),r?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return o.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=n.offset.click.top,this.instance.offset.click.left=n.offset.click.left,this.instance.offset.parent.left-=n.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=n.offset.parent.top-this.instance.offset.parent.top,n._trigger("toSortable",t),n.dropped=this.instance.element,n.currentItem=n.element,this.instance.fromOutside=n),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),n._trigger("fromSortable",t),n.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),o=e(this).data("ui-draggable").options;t.css("cursor")&&(o._cursor=t.css("cursor")),t.css("cursor",o.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,o){var n=e(o.helper),i=e(this).data("ui-draggable").options;n.css("opacity")&&(i._opacity=n.css("opacity")),n.css("opacity",i.opacity)},stop:function(t,o){var n=e(this).data("ui-draggable").options;n._opacity&&e(o.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var o=e(this).data("ui-draggable"),n=o.options,i=!1;o.scrollParent[0]!==document&&"HTML"!==o.scrollParent[0].tagName?(n.axis&&"x"===n.axis||(o.overflowOffset.top+o.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?o.scrollParent[0].scrollTop=i=o.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-o.overflowOffset.top<n.scrollSensitivity&&(o.scrollParent[0].scrollTop=i=o.scrollParent[0].scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(o.overflowOffset.left+o.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?o.scrollParent[0].scrollLeft=i=o.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-o.overflowOffset.left<n.scrollSensitivity&&(o.scrollParent[0].scrollLeft=i=o.scrollParent[0].scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(document).scrollTop()<n.scrollSensitivity?i=e(document).scrollTop(e(document).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<n.scrollSensitivity&&(i=e(document).scrollTop(e(document).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(document).scrollLeft()<n.scrollSensitivity?i=e(document).scrollLeft(e(document).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<n.scrollSensitivity&&(i=e(document).scrollLeft(e(document).scrollLeft()+n.scrollSpeed)))),i!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(o,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),o=t.options;t.snapElements=[],e(o.snap.constructor!==String?o.snap.items||":data(ui-draggable)":o.snap).each(function(){var o=e(this),n=o.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:o.outerWidth(),height:o.outerHeight(),top:n.top,left:n.left})})},drag:function(t,o){var n,i,r,s,l,a,c,u,g,h,d=e(this).data("ui-draggable"),p=d.options,f=p.snapTolerance,m=o.offset.left,y=m+d.helperProportions.width,_=o.offset.top,v=_+d.helperProportions.height;for(g=d.snapElements.length-1;g>=0;g--)l=d.snapElements[g].left,a=l+d.snapElements[g].width,c=d.snapElements[g].top,u=c+d.snapElements[g].height,l-f>y||m>a+f||c-f>v||_>u+f||!e.contains(d.snapElements[g].item.ownerDocument,d.snapElements[g].item)?(d.snapElements[g].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,t,e.extend(d._uiHash(),{snapItem:d.snapElements[g].item})),d.snapElements[g].snapping=!1):("inner"!==p.snapMode&&(n=Math.abs(c-v)<=f,i=Math.abs(u-_)<=f,r=Math.abs(l-y)<=f,s=Math.abs(a-m)<=f,n&&(o.position.top=d._convertPositionTo("relative",{top:c-d.helperProportions.height,left:0}).top-d.margins.top),i&&(o.position.top=d._convertPositionTo("relative",{top:u,left:0}).top-d.margins.top),r&&(o.position.left=d._convertPositionTo("relative",{top:0,left:l-d.helperProportions.width}).left-d.margins.left),s&&(o.position.left=d._convertPositionTo("relative",{top:0,left:a}).left-d.margins.left)),h=n||i||r||s,"outer"!==p.snapMode&&(n=Math.abs(c-_)<=f,i=Math.abs(u-v)<=f,r=Math.abs(l-m)<=f,s=Math.abs(a-y)<=f,n&&(o.position.top=d._convertPositionTo("relative",{top:c,left:0}).top-d.margins.top),i&&(o.position.top=d._convertPositionTo("relative",{top:u-d.helperProportions.height,left:0}).top-d.margins.top),r&&(o.position.left=d._convertPositionTo("relative",{top:0,left:l}).left-d.margins.left),s&&(o.position.left=d._convertPositionTo("relative",{top:0,left:a-d.helperProportions.width}).left-d.margins.left)),!d.snapElements[g].snapping&&(n||i||r||s||h)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,t,e.extend(d._uiHash(),{snapItem:d.snapElements[g].item})),d.snapElements[g].snapping=n||i||r||s||h)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,o=this.data("ui-draggable").options,n=e.makeArray(e(o.stack)).sort(function(t,o){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(o).css("zIndex"),10)||0)});n.length&&(t=parseInt(e(n[0]).css("zIndex"),10)||0,e(n).each(function(o){e(this).css("zIndex",t+o)}),this.css("zIndex",t+n.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,o){var n=e(o.helper),i=e(this).data("ui-draggable").options;n.css("zIndex")&&(i._zIndex=n.css("zIndex")),n.css("zIndex",i.zIndex)},stop:function(t,o){var n=e(this).data("ui-draggable").options;n._zIndex&&e(o.helper).css("zIndex",n._zIndex)}})}(jQuery),function(e){function t(e,t,o){return e>t&&t+o>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,o=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(o)?o:function(e){return e.is(o)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,o=e.ui.ddmanager.droppables[this.options.scope];t<o.length;t++)o[t]===this&&o.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,o){"accept"===t&&(this.accept=e.isFunction(o)?o:function(e){return e.is(o)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var o=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),o&&this._trigger("activate",t,this.ui(o))
5
- },_deactivate:function(t){var o=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),o&&this._trigger("deactivate",t,this.ui(o))},_over:function(t){var o=e.ui.ddmanager.current;o&&(o.currentItem||o.element)[0]!==this.element[0]&&this.accept.call(this.element[0],o.currentItem||o.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(o)))},_out:function(t){var o=e.ui.ddmanager.current;o&&(o.currentItem||o.element)[0]!==this.element[0]&&this.accept.call(this.element[0],o.currentItem||o.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(o)))},_drop:function(t,o){var n=o||e.ui.ddmanager.current,i=!1;return n&&(n.currentItem||n.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===n.options.scope&&t.accept.call(t.element[0],n.currentItem||n.element)&&e.ui.intersect(n,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(i=!0,!1):void 0}),i?!1:this.accept.call(this.element[0],n.currentItem||n.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(n)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,o,n){if(!o.offset)return!1;var i,r,s=(e.positionAbs||e.position.absolute).left,l=s+e.helperProportions.width,a=(e.positionAbs||e.position.absolute).top,c=a+e.helperProportions.height,u=o.offset.left,g=u+o.proportions.width,h=o.offset.top,d=h+o.proportions.height;switch(n){case"fit":return s>=u&&g>=l&&a>=h&&d>=c;case"intersect":return u<s+e.helperProportions.width/2&&l-e.helperProportions.width/2<g&&h<a+e.helperProportions.height/2&&c-e.helperProportions.height/2<d;case"pointer":return i=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,r=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(r,h,o.proportions.height)&&t(i,u,o.proportions.width);case"touch":return(a>=h&&d>=a||c>=h&&d>=c||h>a&&c>d)&&(s>=u&&g>=s||l>=u&&g>=l||u>s&&l>g);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,o){var n,i,r=e.ui.ddmanager.droppables[t.options.scope]||[],s=o?o.type:null,l=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(n=0;n<r.length;n++)if(!(r[n].options.disabled||t&&!r[n].accept.call(r[n].element[0],t.currentItem||t.element))){for(i=0;i<l.length;i++)if(l[i]===r[n].element[0]){r[n].proportions.height=0;continue e}r[n].visible="none"!==r[n].element.css("display"),r[n].visible&&("mousedown"===s&&r[n]._activate.call(r[n],o),r[n].offset=r[n].element.offset(),r[n].proportions={width:r[n].element[0].offsetWidth,height:r[n].element[0].offsetHeight})}},drop:function(t,o){var n=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(n=this._drop.call(this,o)||n),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,o)))}),n},dragStart:function(t,o){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,o)})},drag:function(t,o){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,o),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var n,i,r,s=e.ui.intersect(t,this,this.options.tolerance),l=!s&&this.isover?"isout":s&&!this.isover?"isover":null;l&&(this.options.greedy&&(i=this.options.scope,r=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===i}),r.length&&(n=e.data(r[0],"ui-droppable"),n.greedyChild="isover"===l)),n&&"isover"===l&&(n.isover=!1,n.isout=!0,n._out.call(n,o)),this[l]=!0,this["isout"===l?"isover":"isout"]=!1,this["isover"===l?"_over":"_out"].call(this,o),n&&"isout"===l&&(n.isout=!1,n.isover=!0,n._over.call(n,o)))}})},dragStop:function(t,o){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,o)}}}(jQuery),function(){"use strict";function e(e){function t(t,n){var r,f,m=t==window,y=n&&void 0!==n.message?n.message:void 0;if(n=e.extend({},e.blockUI.defaults,n||{}),!n.ignoreIfBlocked||!e(t).data("blockUI.isBlocked")){if(n.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,n.overlayCSS||{}),r=e.extend({},e.blockUI.defaults.css,n.css||{}),n.onOverlayClick&&(n.overlayCSS.cursor="pointer"),f=e.extend({},e.blockUI.defaults.themedCSS,n.themedCSS||{}),y=void 0===y?n.message:y,m&&d&&o(window,{fadeOut:0}),y&&"string"!=typeof y&&(y.parentNode||y.jquery)){var _=y.jquery?y[0]:y,v={};e(t).data("blockUI.history",v),v.el=_,v.parent=_.parentNode,v.display=_.style.display,v.position=_.style.position,v.parent&&v.parent.removeChild(_)}e(t).data("blockUI.onUnblock",n.onUnblock);var E,B,C,k,b=n.baseZ;E=u||n.forceIframe?e('<iframe class="blockUI" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+n.iframeSrc+'"></iframe>'):e('<div class="blockUI" style="display:none"></div>'),B=n.theme?e('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+b++ +';display:none"></div>'):e('<div class="blockUI blockOverlay" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),n.theme&&m?(k='<div class="blockUI '+n.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(b+10)+';display:none;position:fixed">',n.title&&(k+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(n.title||"&nbsp;")+"</div>"),k+='<div class="ui-widget-content ui-dialog-content"></div>',k+="</div>"):n.theme?(k='<div class="blockUI '+n.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(b+10)+';display:none;position:absolute">',n.title&&(k+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(n.title||"&nbsp;")+"</div>"),k+='<div class="ui-widget-content ui-dialog-content"></div>',k+="</div>"):k=m?'<div class="blockUI '+n.blockMsgClass+' blockPage" style="z-index:'+(b+10)+';display:none;position:fixed"></div>':'<div class="blockUI '+n.blockMsgClass+' blockElement" style="z-index:'+(b+10)+';display:none;position:absolute"></div>',C=e(k),y&&(n.theme?(C.css(f),C.addClass("ui-widget-content")):C.css(r)),n.theme||B.css(n.overlayCSS),B.css("position",m?"fixed":"absolute"),(u||n.forceIframe)&&E.css("opacity",0);var A=[E,B,C],T=m?e("body"):e(t);e.each(A,function(){this.appendTo(T)}),n.theme&&n.draggable&&e.fn.draggable&&C.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var S=h&&(!e.support.boxModel||e("object,embed",m?null:t).length>0);if(g||S){if(m&&n.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(g||!e.support.boxModel)&&!m)var R=a(t,"borderTopWidth"),w=a(t,"borderLeftWidth"),D=R?"(0 - "+R+")":0,I=w?"(0 - "+w+")":0;e.each(A,function(e,t){var o=t[0].style;if(o.position="absolute",2>e)m?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+n.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),m?o.setExpression("width",'jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),I&&o.setExpression("left",I),D&&o.setExpression("top",D);else if(n.centerY)m&&o.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),o.marginTop=0;else if(!n.centerY&&m){var i=n.css&&n.css.top?parseInt(n.css.top,10):0,r="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+i+') + "px"';o.setExpression("top",r)}})}if(y&&(n.theme?C.find(".ui-widget-content").append(y):C.append(y),(y.jquery||y.nodeType)&&e(y).show()),(u||n.forceIframe)&&n.showOverlay&&E.show(),n.fadeIn){var F=n.onBlock?n.onBlock:c,L=n.showOverlay&&!y?F:c,N=y?F:c;n.showOverlay&&B._fadeIn(n.fadeIn,L),y&&C._fadeIn(n.fadeIn,N)}else n.showOverlay&&B.show(),y&&C.show(),n.onBlock&&n.onBlock();if(i(1,t,n),m?(d=C[0],p=e(n.focusableElements,d),n.focusInput&&setTimeout(s,20)):l(C[0],n.centerX,n.centerY),n.timeout){var O=setTimeout(function(){m?e.unblockUI(n):e(t).unblock(n)},n.timeout);e(t).data("blockUI.timeout",O)}}}function o(t,o){var r,s=t==window,l=e(t),a=l.data("blockUI.history"),c=l.data("blockUI.timeout");c&&(clearTimeout(c),l.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),i(0,t,o),null===o.onUnblock&&(o.onUnblock=l.data("blockUI.onUnblock"),l.removeData("blockUI.onUnblock"));var u;u=s?e("body").children().filter(".blockUI").add("body > .blockUI"):l.find(">.blockUI"),o.cursorReset&&(u.length>1&&(u[1].style.cursor=o.cursorReset),u.length>2&&(u[2].style.cursor=o.cursorReset)),s&&(d=p=null),o.fadeOut?(r=u.length,u.stop().fadeOut(o.fadeOut,function(){0===--r&&n(u,a,o,t)})):n(u,a,o,t)}function n(t,o,n,i){var r=e(i);if(!r.data("blockUI.isBlocked")){t.each(function(){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.parent&&o.parent.appendChild(o.el),r.removeData("blockUI.history")),r.data("blockUI.static")&&r.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var s=e(document.body),l=s.width(),a=s[0].style.width;s.width(l-1).width(l),s[0].style.width=a}}function i(t,o,n){var i=o==window,s=e(o);if((t||(!i||d)&&(i||s.data("blockUI.isBlocked")))&&(s.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var l="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).bind(l,n,r):e(document).unbind(l,r)}}function r(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&d&&t.data.constrainTabKey){var o=p,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){s(i)},10),!1}var r=t.data,l=e(t.target);return l.hasClass("blockOverlay")&&r.onOverlayClick&&r.onOverlayClick(t),l.parents("div."+r.blockMsgClass).length>0?!0:0===l.parents().children().filter("div.blockUI").length}function s(e){if(p){var t=p[e===!0?p.length-1:0];t&&t.focus()}}function l(e,t,o){var n=e.parentNode,i=e.style,r=(n.offsetWidth-e.offsetWidth)/2-a(n,"borderLeftWidth"),s=(n.offsetHeight-e.offsetHeight)/2-a(n,"borderTopWidth");t&&(i.left=r>0?r+"px":"0"),o&&(i.top=s>0?s+"px":"0")}function a(t,o){return parseInt(e.css(t,o),10)||0}e.fn._fadeIn=e.fn.fadeIn;var c=e.noop||function(){},u=/MSIE/.test(navigator.userAgent),g=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),h=(document.documentMode||0,e.isFunction(document.createElement("div").style.setExpression));e.blockUI=function(e){t(window,e)},e.unblockUI=function(e){o(window,e)},e.growlUI=function(t,o,n,i){var r=e('<div class="growlUI"></div>');t&&r.append("<h1>"+t+"</h1>"),o&&r.append("<h2>"+o+"</h2>"),void 0===n&&(n=3e3);var s=function(t){t=t||{},e.blockUI({message:r,fadeIn:"undefined"!=typeof t.fadeIn?t.fadeIn:700,fadeOut:"undefined"!=typeof t.fadeOut?t.fadeOut:1e3,timeout:"undefined"!=typeof t.timeout?t.timeout:n,centerY:!1,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};s();r.css("opacity");r.mouseover(function(){s({fadeIn:0,timeout:3e4});var t=e(".blockMsg");t.stop(),t.fadeTo(300,1)}).mouseout(function(){e(".blockMsg").fadeOut(1e3)})},e.fn.block=function(o){if(this[0]===window)return e.blockUI(o),this;var n=e.extend({},e.blockUI.defaults,o||{});return this.each(function(){var t=e(this);n.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,t(this,o)})},e.fn.unblock=function(t){return this[0]===window?(e.unblockUI(t),this):this.each(function(){o(this,t)})},e.blockUI.version=2.66,e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var d=null,p=[]}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e(jQuery)}(),function(){function e(e){var t=function(e,t){return i("",e,t)},r=o;e&&(o[e]||(o[e]={}),r=o[e]),r.define&&r.define.packaged||(n.original=r.define,r.define=n,r.define.packaged=!0),r.require&&r.require.packaged||(i.original=r.require,r.require=t,r.require.packaged=!0)}var t="",o=function(){return this}();if(t||"undefined"==typeof requirejs){var n=function(e,t,o){return"string"!=typeof e?(n.original?n.original.apply(window,arguments):(console.error("dropping module because define wasn't a string."),console.trace()),void 0):(2==arguments.length&&(o=t),n.modules||(n.modules={},n.payloads={}),n.payloads[e]=o,n.modules[e]=null,void 0)},i=function(e,t,o){if("[object Array]"===Object.prototype.toString.call(t)){for(var n=[],r=0,l=t.length;l>r;++r){var a=s(e,t[r]);if(!a&&i.original)return i.original.apply(window,arguments);n.push(a)}o&&o.apply(null,n)}else{if("string"==typeof t){var c=s(e,t);return!c&&i.original?i.original.apply(window,arguments):(o&&o(),c)}if(i.original)return i.original.apply(window,arguments)}},r=function(e,t){if(-1!==t.indexOf("!")){var o=t.split("!");return r(e,o[0])+"!"+r(e,o[1])}if("."==t.charAt(0)){var n=e.split("/").slice(0,-1).join("/");for(t=n+"/"+t;-1!==t.indexOf(".")&&i!=t;){var i=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},s=function(e,t){t=r(e,t);var o=n.modules[t];if(!o){if(o=n.payloads[t],"function"==typeof o){var s={},l={id:t,uri:"",exports:s,packaged:!0},a=function(e,o){return i(t,e,o)},c=o(a,s,l);s=c||l.exports,n.modules[t]=s,delete n.payloads[t]}o=n.modules[t]=s||o}return o};e(t)}}(),define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/multi_select","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/mode/folding/fold_mode","ace/theme/textmate","ace/config"],function(e,t){e("./lib/fixoldbrowsers");var o=e("./lib/dom"),n=e("./lib/event"),i=e("./editor").Editor,r=e("./edit_session").EditSession,s=e("./undomanager").UndoManager,l=e("./virtual_renderer").VirtualRenderer,a=e("./multi_select").MultiSelect;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./mode/folding/fold_mode"),e("./theme/textmate"),t.config=e("./config"),t.require=e,t.edit=function(e){if("string"==typeof e){var r=e,e=document.getElementById(r);if(!e)throw new Error("ace.edit can't find div #"+r)}if(e.env&&e.env.editor instanceof i)return e.env.editor;var s=t.createEditSession(o.getInnerText(e));e.innerHTML="";var c=new i(new l(e));new a(c),c.setSession(s);var u={document:s,editor:c,onResize:c.resize.bind(c,null)};return n.addListener(window,"resize",u.onResize),c.on("destroy",function(){n.removeListener(window,"resize",u.onResize)}),e.env=c.env=u,c},t.createEditSession=function(e,t){var o=new r(e,t);return o.setUndoManager(new s),o},t.EditSession=r,t.UndoManager=s}),define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(e){e("./regexp"),e("./es5-shim")}),define("ace/lib/regexp",["require","exports","module"],function(){function e(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function t(e,t,o){if(Array.prototype.indexOf)return e.indexOf(t,o);for(var n=o||0;n<e.length;n++)if(e[n]===t)return n;return-1}var o={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},n=void 0===o.exec.call(/()??/,"")[1],i=function(){var e=/^/g;return o.test.call(e,""),!e.lastIndex}();i&&n||(RegExp.prototype.exec=function(r){var s,l,a=o.exec.apply(this,arguments);if("string"==typeof r&&a){if(!n&&a.length>1&&t(a,"")>-1&&(l=RegExp(this.source,o.replace.call(e(this),"g","")),o.replace.call(r.slice(a.index),l,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(a[e]=void 0)})),this._xregexp&&this._xregexp.captureNames)for(var c=1;c<a.length;c++)s=this._xregexp.captureNames[c-1],s&&(a[s]=a[c]);!i&&this.global&&!a[0].length&&this.lastIndex>a.index&&this.lastIndex--}return a},i||(RegExp.prototype.test=function(e){var t=o.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t}))}),define("ace/lib/es5-shim",["require","exports","module"],function(){function e(){}function t(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function o(e){return e=+e,e!==e?e=0:0!==e&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}Function.prototype.bind||(Function.prototype.bind=function(t){var o=this;if("function"!=typeof o)throw new TypeError("Function.prototype.bind called on incompatible "+o);var n=g.call(arguments,1),i=function(){if(this instanceof i){var e=o.apply(this,n.concat(g.call(arguments)));return Object(e)===e?e:this}return o.apply(t,n.concat(g.call(arguments)))};return o.prototype&&(e.prototype=o.prototype,i.prototype=new e,e.prototype=null),i});var n,i,r,s,l,a=Function.prototype.call,c=Array.prototype,u=Object.prototype,g=c.slice,h=a.bind(u.toString),d=a.bind(u.hasOwnProperty);if((l=d(u,"__defineGetter__"))&&(n=a.bind(u.__defineGetter__),i=a.bind(u.__defineSetter__),r=a.bind(u.__lookupGetter__),s=a.bind(u.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t,o=[];return o.splice.apply(o,e(20)),o.splice.apply(o,e(26)),t=o.length,o.splice(5,0,"XXX"),t+1==o.length,t+1==o.length?!0:void 0}()){var p=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?p.apply(this,[void 0===e?0:e,void 0===t?this.length-e:t].concat(g.call(arguments,2))):[]}}else Array.prototype.splice=function(e,t){var o=this.length;e>0?e>o&&(e=o):void 0==e?e=0:0>e&&(e=Math.max(o+e,0)),o>e+t||(t=o-e);var n=this.slice(e,e+t),i=g.call(arguments,2),r=i.length;if(e===o)r&&this.push.apply(this,i);else{var s=Math.min(t,o-e),l=e+s,a=l+r-s,c=o-l,u=o-s;if(l>a)for(var h=0;c>h;++h)this[a+h]=this[l+h];else if(a>l)for(h=c;h--;)this[a+h]=this[l+h];if(r&&e===u)this.length=u,this.push.apply(this,i);else for(this.length=u+r,h=0;r>h;++h)this[e+h]=i[h]}return n};Array.isArray||(Array.isArray=function(e){return"[object Array]"==h(e)});var f=Object("a"),m="a"!=f[0]||!(0 in f);if(Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=L(this),o=m&&"[object String]"==h(this)?this.split(""):t,n=arguments[1],i=-1,r=o.length>>>0;if("[object Function]"!=h(e))throw new TypeError;for(;++i<r;)i in o&&e.call(n,o[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=L(this),o=m&&"[object String]"==h(this)?this.split(""):t,n=o.length>>>0,i=Array(n),r=arguments[1];if("[object Function]"!=h(e))throw new TypeError(e+" is not a function");for(var s=0;n>s;s++)s in o&&(i[s]=e.call(r,o[s],s,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t,o=L(this),n=m&&"[object String]"==h(this)?this.split(""):o,i=n.length>>>0,r=[],s=arguments[1];if("[object Function]"!=h(e))throw new TypeError(e+" is not a function");for(var l=0;i>l;l++)l in n&&(t=n[l],e.call(s,t,l,o)&&r.push(t));return r}),Array.prototype.every||(Array.prototype.every=function(e){var t=L(this),o=m&&"[object String]"==h(this)?this.split(""):t,n=o.length>>>0,i=arguments[1];if("[object Function]"!=h(e))throw new TypeError(e+" is not a function");for(var r=0;n>r;r++)if(r in o&&!e.call(i,o[r],r,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=L(this),o=m&&"[object String]"==h(this)?this.split(""):t,n=o.length>>>0,i=arguments[1];if("[object Function]"!=h(e))throw new TypeError(e+" is not a function");for(var r=0;n>r;r++)if(r in o&&e.call(i,o[r],r,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=L(this),o=m&&"[object String]"==h(this)?this.split(""):t,n=o.length>>>0;if("[object Function]"!=h(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var i,r=0;if(arguments.length>=2)i=arguments[1];else for(;;){if(r in o){i=o[r++];break}if(++r>=n)throw new TypeError("reduce of empty array with no initial value")}for(;n>r;r++)r in o&&(i=e.call(void 0,i,o[r],r,t));return i}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=L(this),o=m&&"[object String]"==h(this)?this.split(""):t,n=o.length>>>0;if("[object Function]"!=h(e))throw new TypeError(e+" is not a function");if(!n&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var i,r=n-1;if(arguments.length>=2)i=arguments[1];else for(;;){if(r in o){i=o[r--];break}if(--r<0)throw new TypeError("reduceRight of empty array with no initial value")}do r in this&&(i=e.call(void 0,i,o[r],r,t));while(r--);return i}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(e){var t=m&&"[object String]"==h(this)?this.split(""):L(this),n=t.length>>>0;if(!n)return-1;var i=0;for(arguments.length>1&&(i=o(arguments[1])),i=i>=0?i:Math.max(0,n+i);n>i;i++)if(i in t&&t[i]===e)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(e){var t=m&&"[object String]"==h(this)?this.split(""):L(this),n=t.length>>>0;if(!n)return-1;var i=n-1;for(arguments.length>1&&(i=Math.min(i,o(arguments[1]))),i=i>=0?i:n-Math.abs(i);i>=0;i--)if(i in t&&e===t[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:u)}),!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(e,t){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(y+e);if(d(e,t)){var o,n,i;if(o={enumerable:!0,configurable:!0},l){var a=e.__proto__;e.__proto__=u;var n=r(e,t),i=s(e,t);if(e.__proto__=a,n||i)return n&&(o.get=n),i&&(o.set=i),o}return o.value=e[t],o}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)}),!Object.create){var _;_=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var o;if(null===e)o=_();else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var n=function(){};n.prototype=e,o=new n,o.__proto__=e}return void 0!==t&&Object.defineProperties(o,t),o}}if(Object.defineProperty){var v=t({}),E="undefined"==typeof document||t(document.createElement("div"));if(!v||!E)var B=Object.defineProperty}if(!Object.defineProperty||B){var C="Property description must be an object: ",k="Object.defineProperty called on non-object: ",b="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(e,t,o){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError(k+e);if("object"!=typeof o&&"function"!=typeof o||null===o)throw new TypeError(C+o);if(B)try{return B.call(Object,e,t,o)}catch(a){}if(d(o,"value"))if(l&&(r(e,t)||s(e,t))){var c=e.__proto__;e.__proto__=u,delete e[t],e[t]=o.value,e.__proto__=c}else e[t]=o.value;else{if(!l)throw new TypeError(b);d(o,"get")&&n(e,t,o.get),d(o,"set")&&i(e,t,o.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var o in t)d(t,o)&&Object.defineProperty(e,o,t[o]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(A){Object.freeze=function(e){return function(t){return"function"==typeof t?t:e(t)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;for(var t="";d(e,t);)t+="?";e[t]=!0;var o=d(e,t);return delete e[t],o}),!Object.keys){var T=!0,S=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],R=S.length;for(var w in{toString:null})T=!1;Object.keys=function N(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on a non-object");var N=[];for(var t in e)d(e,t)&&N.push(t);if(T)for(var o=0,n=R;n>o;o++){var i=S[o];d(e,i)&&N.push(i)}return N}}Date.now||(Date.now=function(){return(new Date).getTime()});var D=" \n \f\r   ᠎              \u2028\u2029";if(!String.prototype.trim||D.trim()){D="["+D+"]";var I=new RegExp("^"+D+D+"*"),F=new RegExp(D+D+"*$");String.prototype.trim=function(){return String(this).replace(I,"").replace(F,"")}}var L=function(e){if(null==e)throw new TypeError("can't convert "+e+" to object");return Object(e)}}),define("ace/lib/dom",["require","exports","module"],function(e,t){if("undefined"!=typeof document){var o="http://www.w3.org/1999/xhtml";t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||o,e):document.createElement(e)},t.hasCssClass=function(e,t){var o=e.className.split(/\s+/g);return-1!==o.indexOf(t)},t.addCssClass=function(e,o){t.hasCssClass(e,o)||(e.className+=" "+o)},t.removeCssClass=function(e,t){for(var o=e.className.split(/\s+/g);;){var n=o.indexOf(t);if(-1==n)break;o.splice(n,1)}e.className=o.join(" ")},t.toggleCssClass=function(e,t){for(var o=e.className.split(/\s+/g),n=!0;;){var i=o.indexOf(t);if(-1==i)break;n=!1,o.splice(i,1)}return n&&o.push(t),e.className=o.join(" "),n},t.setCssClass=function(e,o,n){n?t.addCssClass(e,o):t.removeCssClass(e,o)},t.hasCssString=function(e,t){var o,n=0;if(t=t||document,t.createStyleSheet&&(o=t.styleSheets)){for(;n<o.length;)if(o[n++].owningElement.id===e)return!0}else if(o=t.getElementsByTagName("style"))for(;n<o.length;)if(o[n++].id===e)return!0;return!1},t.importCssString=function(e,n,i){if(i=i||document,n&&t.hasCssString(n,i))return null;var r;i.createStyleSheet?(r=i.createStyleSheet(),r.cssText=e,n&&(r.owningElement.id=n)):(r=i.createElementNS?i.createElementNS(o,"style"):i.createElement("style"),r.appendChild(i.createTextNode(e)),n&&(r.id=n),t.getDocumentHead(i).appendChild(r))},t.importCssStylsheet=function(e,o){if(o.createStyleSheet)o.createStyleSheet(e);else{var n=t.createElement("link");n.rel="stylesheet",n.href=e,t.getDocumentHead(o).appendChild(n)}},t.getInnerWidth=function(e){return parseInt(t.computedStyle(e,"paddingLeft"),10)+parseInt(t.computedStyle(e,"paddingRight"),10)+e.clientWidth},t.getInnerHeight=function(e){return parseInt(t.computedStyle(e,"paddingTop"),10)+parseInt(t.computedStyle(e,"paddingBottom"),10)+e.clientHeight},void 0!==window.pageYOffset?(t.getPageScrollTop=function(){return window.pageYOffset},t.getPageScrollLeft=function(){return window.pageXOffset}):(t.getPageScrollTop=function(){return document.body.scrollTop},t.getPageScrollLeft=function(){return document.body.scrollLeft}),t.computedStyle=window.getComputedStyle?function(e,t){return t?(window.getComputedStyle(e,"")||{})[t]||"":window.getComputedStyle(e,"")||{}}:function(e,t){return t?e.currentStyle[t]:e.currentStyle},t.scrollbarWidth=function(e){var o=t.createElement("ace_inner");o.style.width="100%",o.style.minWidth="0px",o.style.height="200px",o.style.display="block";var n=t.createElement("ace_outer"),i=n.style;i.position="absolute",i.left="-10000px",i.overflow="hidden",i.width="200px",i.minWidth="0px",i.height="150px",i.display="block",n.appendChild(o);var r=e.documentElement;r.appendChild(n);var s=o.offsetWidth;i.overflow="scroll";var l=o.offsetWidth;return s==l&&(l=n.clientWidth),r.removeChild(n),s-l},t.setInnerHtml=function(e,t){var o=e.cloneNode(!1);return o.innerHTML=t,e.parentNode.replaceChild(o,e),o},"textContent"in document.documentElement?(t.setInnerText=function(e,t){e.textContent=t},t.getInnerText=function(e){return e.textContent}):(t.setInnerText=function(e,t){e.innerText=t},t.getInnerText=function(e){return e.innerText}),t.getParentWindow=function(e){return e.defaultView||e.parentWindow}}}),define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent","ace/lib/dom"],function(e,t){function o(e,t,o){var l=0;if(l=!i.isOpera||"KeyboardEvent"in window||!i.isMac?0|(t.ctrlKey?1:0)|(t.altKey?2:0)|(t.shiftKey?4:0)|(t.metaKey?8:0):0|(t.metaKey?1:0)|(t.altKey?2:0)|(t.shiftKey?4:0)|(t.ctrlKey?8:0),!i.isMac&&r){if((r[91]||r[92])&&(l|=8),r.altGr){if(3==(3&l))return;r.altGr=0}if(18===o||17===o){var a=t.location||t.keyLocation;if(17===o&&1===a)s=t.timeStamp;else if(18===o&&3===l&&2===a){var c=-s;s=t.timeStamp,c+=s,3>c&&(r.altGr=!0)}}}if(o in n.MODIFIER_KEYS){switch(n.MODIFIER_KEYS[o]){case"Alt":l=2;break;case"Shift":l=4;break;case"Ctrl":l=1;break;default:l=8}o=0}return 8&l&&(91===o||93===o)&&(o=0),l||13!==o||!t.location&&3!==t.keyLocation||(e(t,l,-o),!t.defaultPrevented)?l||o in n.FUNCTION_KEYS||o in n.PRINTABLE_KEYS?e(t,l,o):!1:void 0}{var n=e("./keys"),i=e("./useragent");e("./dom")}t.addListener=function(e,t,o){if(e.addEventListener)return e.addEventListener(t,o,!1);if(e.attachEvent){var n=function(){o.call(e,window.event)};o._wrapper=n,e.attachEvent("on"+t,n)}},t.removeListener=function(e,t,o){return e.removeEventListener?e.removeEventListener(t,o,!1):(e.detachEvent&&e.detachEvent("on"+t,o._wrapper||o),void 0)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||e.ctrlKey&&i.isMac?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,o,n){function i(e){o&&o(e),n&&n(e),t.removeListener(document,"mousemove",o,!0),t.removeListener(document,"mouseup",i,!0),t.removeListener(document,"dragstart",i,!0)}t.addListener(document,"mousemove",o,!0),t.addListener(document,"mouseup",i,!0),t.addListener(document,"dragstart",i,!0)},t.addMouseWheelListener=function(e,o){if("onmousewheel"in e){var n=8;t.addListener(e,"mousewheel",function(e){void 0!==e.wheelDeltaX?(e.wheelX=-e.wheelDeltaX/n,e.wheelY=-e.wheelDeltaY/n):(e.wheelX=0,e.wheelY=-e.wheelDelta/n),o(e)})}else"onwheel"in e?t.addListener(e,"wheel",function(e){e.wheelX=5*(e.deltaX||0),e.wheelY=5*(e.deltaY||0),o(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=5*(e.detail||0),e.wheelY=0):(e.wheelX=0,e.wheelY=5*(e.detail||0)),o(e)})},t.addMultiMouseDownListener=function(e,o,n,r){var s,l,a,c=0,u={2:"dblclick",3:"tripleclick",4:"quadclick"};t.addListener(e,"mousedown",function(e){if(0!=t.getButton(e)?c=0:e.detail>1?(c++,c>4&&(c=1)):c=1,i.isIE){var o=Math.abs(e.clientX-s)>5||Math.abs(e.clientY-l)>5;o&&(c=1),1==c&&(s=e.clientX,l=e.clientY)
6
- }if(n[r]("mousedown",e),c>4)c=0;else if(c>1)return n[r](u[c],e)}),i.isOldIE&&t.addListener(e,"dblclick",function(e){c=2,a&&clearTimeout(a),a=setTimeout(function(){a=null},o[c-1]||600),n[r]("mousedown",e),n[r](u[c],e)})};var r=null,s=0;if(t.addCommandKeyListener=function(e,n){var s=t.addListener;if(i.isOldGecko||i.isOpera&&!("KeyboardEvent"in window)){var l=null;s(e,"keydown",function(e){l=e.keyCode}),s(e,"keypress",function(e){return o(n,e,l)})}else{var a=null;s(e,"keydown",function(e){r[e.keyCode]=!0;var t=o(n,e,e.keyCode);return a=e.defaultPrevented,t}),s(e,"keypress",function(e){a&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),a=null)}),s(e,"keyup",function(e){r[e.keyCode]=null}),r||(r=Object.create(null),s(window,"focus",function(){r=Object.create(null)}))}},window.postMessage&&!i.isOldIE){var l=1;t.nextTick=function(e,o){o=o||window;var n="zero-timeout-message-"+l;t.addListener(o,"message",function i(r){r.data==n&&(t.stopPropagation(r),t.removeListener(o,"message",i),e())}),o.postMessage(n,"*")}}t.nextFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,t.nextFrame=t.nextFrame?t.nextFrame.bind(window):function(e){setTimeout(e,17)}}),define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,t){var o=e("./oop"),n=function(){var e={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,meta:8,command:8,cmd:8},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}};for(var t in e.FUNCTION_KEYS){var n=e.FUNCTION_KEYS[t].toLowerCase();e[n]=parseInt(t,10)}return o.mixin(e,e.MODIFIER_KEYS),o.mixin(e,e.PRINTABLE_KEYS),o.mixin(e,e.FUNCTION_KEYS),e.enter=e["return"],e.escape=e.esc,e.del=e["delete"],e[173]="-",e}();o.mixin(t,n),t.keyCodeToString=function(e){return(n[e]||String.fromCharCode(e)).toLowerCase()}}),define("ace/lib/oop",["require","exports","module"],function(e,t){t.inherits=function(){var e=function(){};return function(t,o){e.prototype=o.prototype,t.super_=o.prototype,t.prototype=new e,t.prototype.constructor=t}}(),t.mixin=function(e,t){for(var o in t)e[o]=t[o];return e},t.implement=function(e,o){t.mixin(e,o)}}),define("ace/lib/useragent",["require","exports","module"],function(e,t){if(t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS},"object"==typeof navigator){var o=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),n=navigator.userAgent;t.isWin="win"==o,t.isMac="mac"==o,t.isLinux="linux"==o,t.isIE=("Microsoft Internet Explorer"==navigator.appName||navigator.appName.indexOf("MSAppHost")>=0)&&parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=window.controllers&&"Gecko"===window.navigator.product,t.isOldGecko=t.isGecko&&parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1],10)<4,t.isOpera=window.opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),t.isWebKit=parseFloat(n.split("WebKit/")[1])||void 0,t.isChrome=parseFloat(n.split(" Chrome/")[1])||void 0,t.isAIR=n.indexOf("AdobeAIR")>=0,t.isIPad=n.indexOf("iPad")>=0,t.isTouchPad=n.indexOf("TouchPad")>=0}}),define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config"],function(e,t){e("./lib/fixoldbrowsers");var o=e("./lib/oop"),n=e("./lib/dom"),i=e("./lib/lang"),r=e("./lib/useragent"),s=e("./keyboard/textinput").TextInput,l=e("./mouse/mouse_handler").MouseHandler,a=e("./mouse/fold_handler").FoldHandler,c=e("./keyboard/keybinding").KeyBinding,u=e("./edit_session").EditSession,g=e("./search").Search,h=e("./range").Range,d=e("./lib/event_emitter").EventEmitter,p=e("./commands/command_manager").CommandManager,f=e("./commands/default_commands").commands,m=e("./config"),y=function(e,t){var o=e.getContainerElement();this.container=o,this.renderer=e,this.commands=new p(r.isMac?"mac":"win",f),this.textInput=new s(e.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.keyBinding=new c(this),this.$mouseHandler=new l(this),new a(this),this.$blockScrolling=0,this.$search=(new g).set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=i.delayedCall(function(){this._signal("input",{}),this.session.bgTokenizer&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(t||new u("")),m.resetOptions(this),m._emit("editor",this)};(function(){o.implement(this,d),this.$initOperationListeners=function(){function e(e){return e[e.length-1]}this.selections=[],this.commands.on("exec",function(t){this.startOperation(t);var o=t.command;if("fileJump"==o.group){var n=this.prevOp;n&&"fileJump"==n.command.group||(this.lastFileJumpPos=e(this.selections))}else this.lastFileJumpPos=null}.bind(this),!0),this.commands.on("afterExec",function(e){var t=e.command;return"fileJump"==t.group&&this.lastFileJumpPos&&!this.curOp.selectionChanged?(this.selection.fromJSON(this.lastFileJumpPos),void 0):(this.endOperation(e),void 0)}.bind(this),!0),this.$opResetTimer=i.delayedCall(this.endOperation.bind(this)),this.on("change",function(){this.curOp||this.startOperation(),this.curOp.docChanged=!0}.bind(this),!0),this.on("changeSelection",function(){this.curOp||this.startOperation(),this.curOp.selectionChanged=!0}.bind(this),!0)},this.curOp=null,this.prevOp={},this.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(this.previousCommand=null,e={}),this.$opResetTimer.schedule(),this.curOp={command:e.command||{},args:e.args},this.selections.push(this.selection.toJSON())},this.endOperation=function(){this.curOp&&(this.prevOp=this.curOp,this.curOp=null)},this.$historyTracker=function(e){if(this.$mergeUndoDeltas){var t=this.prevOp,o=["backspace","del","insertstring"],n=t.command&&e.command.name==t.command.name;if("insertstring"==e.command.name){var i=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),n=n&&this.mergeNextCommand&&(!/\s/.test(i)||/\s/.test(t.args)),this.mergeNextCommand=!0}else n=n&&-1!==o.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(n=!1),n?this.session.mergeUndoDeltas=!0:-1!==o.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},this.setKeyboardHandler=function(e){if(e)if("string"==typeof e){this.$keybindingId=e;var t=this;m.loadModule(["keybinding",e],function(o){t.$keybindingId==e&&t.keyBinding.setKeyboardHandler(o&&o.handler)})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e);else this.keyBinding.setKeyboardHandler(null)},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session!=e){if(this.session){var t=this.session;this.session.removeEventListener("change",this.$onDocumentChange),this.session.removeEventListener("changeMode",this.$onChangeMode),this.session.removeEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.session.removeEventListener("changeTabSize",this.$onChangeTabSize),this.session.removeEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.session.removeEventListener("changeWrapMode",this.$onChangeWrapMode),this.session.removeEventListener("onChangeFold",this.$onChangeFold),this.session.removeEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.session.removeEventListener("changeBackMarker",this.$onChangeBackMarker),this.session.removeEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.session.removeEventListener("changeAnnotation",this.$onChangeAnnotation),this.session.removeEventListener("changeOverwrite",this.$onCursorChange),this.session.removeEventListener("changeScrollTop",this.$onScrollTopChange),this.session.removeEventListener("changeScrollLeft",this.$onScrollLeftChange);var o=this.session.getSelection();o.removeEventListener("changeCursor",this.$onCursorChange),o.removeEventListener("changeSelection",this.$onSelectionChange)}this.session=e,this.$onDocumentChange=this.onDocumentChange.bind(this),e.addEventListener("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.addEventListener("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.addEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.addEventListener("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.addEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.addEventListener("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.addEventListener("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.addEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.addEventListener("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.addEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.addEventListener("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.addEventListener("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.addEventListener("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.addEventListener("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.$blockScrolling+=1,this.onCursorChange(),this.$blockScrolling-=1,this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull(),this._emit("changeSession",{session:e,oldSession:t})}},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?1==t?this.navigateFileEnd():-1==t&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e){this.renderer.setTheme(e)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||n.computedStyle(this.container,"fontSize")},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){if(this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null),!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session.findMatchingBracket(e.getCursorPosition());if(t)var o=new h(t.row,t.column,t.row,t.column+1);else if(e.session.$mode.getMatching)var o=e.session.$mode.getMatching(e.session);o&&(e.session.$bracketHighlight=e.session.addMarker(o,"ace_bracket","text"))},50)}},this.focus=function(){var e=this;setTimeout(function(){e.textInput.focus()}),this.textInput.focus()},this.isFocused=function(){return this.textInput.isFocused()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus"))},this.onBlur=function(){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur"))},this.$cursorChange=function(){this.renderer.updateCursor()},this.onDocumentChange=function(e){var t,o=e.data,n=o.range;t=n.start.row==n.end.row&&"insertLines"!=o.action&&"removeLines"!=o.action?n.end.row:1/0,this.renderer.updateLines(n.start.row,t),this._emit("change",e),this.$cursorChange()},this.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},this.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},this.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},this.onCursorChange=function(){this.$cursorChange(),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$highlightBrackets(),this.$updateHighlightActiveLine(),this._emit("changeSelection")},this.$updateHighlightActiveLine=function(){var e,t=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),this.renderer.$maxLines&&1===this.session.getLength()&&(e=!1)),t.$highlightLineMarker&&!e)t.removeMarker(t.$highlightLineMarker.id),t.$highlightLineMarker=null;else if(!t.$highlightLineMarker&&e){var o=new h(e.row,e.column,e.row,1/0);o.id=t.addMarker(o,"ace_active-line","screenLine"),t.$highlightLineMarker=o}else e&&(t.$highlightLineMarker.start.row=e.row,t.$highlightLineMarker.end.row=e.row,t.$highlightLineMarker.start.column=e.column,t._emit("changeBackMarker"))},this.onSelectionChange=function(){var e=this.session;if(e.$selectionMarker&&e.removeMarker(e.$selectionMarker),e.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var t=this.selection.getRange(),o=this.getSelectionStyle();e.$selectionMarker=e.addMarker(t,"ace_selection",o)}var n=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(n),this._emit("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(!t.isEmpty()&&!t.isMultiLine()){var o=t.start.column-1,n=t.end.column+1,i=e.getLine(t.start.row),r=i.length,s=i.substring(Math.max(o,0),Math.min(n,r));if(!(o>=0&&/^[\w\d]/.test(s)||r>=n&&/[\w\d]$/.test(s))&&(s=i.substring(t.start.column,t.end.column),/^[\w\d]+$/.test(s))){var l=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:s});return l}}},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText();return this._signal("copy",e),e},this.onCopy=function(){this.commands.exec("copy",this)},this.onCut=function(){this.commands.exec("cut",this)},this.onPaste=function(e){this.$readOnly||(this._emit("paste",e),this.insert(e))},this.execCommand=function(e,t){this.commands.exec(e,this,t)},this.insert=function(e){var t=this.session,o=t.getMode(),n=this.getCursorPosition();if(this.getBehavioursEnabled()){var i=o.transformAction(t.getState(n.row),"insertion",this,t,e);i&&(e!==i.text&&(this.session.mergeUndoDeltas=!1,this.$mergeNextCommand=!1),e=i.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()){var r=new h.fromPoints(n,n);r.end.column+=e.length,this.session.remove(r)}}else{var r=this.getSelectionRange();n=this.session.remove(r),this.clearSelection()}if("\n"==e||"\r\n"==e){var s=t.getLine(n.row);if(n.column>s.search(/\S|$/)){var l=s.substr(n.column).search(/\S|$/);t.doc.removeInLine(n.row,n.column,n.column+l)}}this.clearSelection();{var a=n.column,c=t.getState(n.row),s=t.getLine(n.row),u=o.checkOutdent(c,s,e);t.insert(n,e)}if(i&&i.selection&&(2==i.selection.length?this.selection.setSelectionRange(new h(n.row,a+i.selection[0],n.row,a+i.selection[1])):this.selection.setSelectionRange(new h(n.row+i.selection[0],i.selection[1],n.row+i.selection[2],i.selection[3]))),t.getDocument().isNewLine(e)){var g=o.getNextLineIndent(c,s.slice(0,n.column),t.getTabString());t.insert({row:n.row+1,column:0},g)}u&&o.autoOutdent(c,t,n.row)},this.onTextInput=function(e){this.keyBinding.onTextInput(e)},this.onCommandKey=function(e,t,o){this.keyBinding.onCommandKey(e,t,o)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var o=this.session,n=o.getState(t.start.row),i=o.getMode().transformAction(n,"deletion",this,o,t);if(0==t.end.column){var r=o.getTextRange(t);if("\n"==r[r.length-1]){var s=o.getLine(t.end.row);/^\s+$/.test(s)&&(t.end.column=s.length)}}i&&(t=i)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(this.selection.isEmpty()){var e=this.getCursorPosition(),t=e.column;if(0!==t){var o,n,i=this.session.getLine(e.row);t<i.length?(o=i.charAt(t)+i.charAt(t-1),n=new h(e.row,t-1,e.row,t+1)):(o=i.charAt(t-1)+i.charAt(t-2),n=new h(e.row,t-2,e.row,t)),this.session.replace(n,o)}}},this.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),o=this.session.getTextRange(t);this.session.replace(t,o.toLowerCase()),this.selection.setSelectionRange(e)},this.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),o=this.session.getTextRange(t);this.session.replace(t,o.toUpperCase()),this.selection.setSelectionRange(e)},this.indent=function(){var e=this.session,t=this.getSelectionRange();if(t.start.row<t.end.row){var o=this.$getSelectedRows();return e.indentRows(o.first,o.last," "),void 0}if(t.start.column<t.end.column){var n=e.getTextRange(t);if(!/^\s+$/.test(n)){var o=this.$getSelectedRows();return e.indentRows(o.first,o.last," "),void 0}}var r=e.getLine(t.start.row),s=t.start,l=e.getTabSize(),a=e.documentToScreenColumn(s.row,s.column);if(this.session.getUseSoftTabs())var c=l-a%l,u=i.stringRepeat(" ",c);else{for(var c=a%l;" "==r[t.start.column]&&c;)t.start.column--,c--;this.selection.setSelectionRange(t),u=" "}return this.insert(u)},this.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last," ")},this.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},this.sortLines=function(){var e=this.$getSelectedRows(),t=this.session,o=[];for(i=e.first;i<=e.last;i++)o.push(t.getLine(i));o.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0});for(var n=new h(0,0,0,0),i=e.first;i<=e.last;i++){var r=t.getLine(i);n.start.row=i,n.end.row=i,n.end.column=r.length,t.replace(n,o[i-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),o=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,o,e)},this.getNumberAt=function(e,t){var o=/[\-]?[0-9]+(?:\.[0-9]+)?/g;o.lastIndex=0;for(var n=this.session.getLine(e);o.lastIndex<t;){var i=o.exec(n);if(i.index<=t&&i.index+i[0].length>=t){var r={value:i[0],start:i.index,end:i.index+i[0].length};return r}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,o=this.selection.getCursor().column,n=new h(t,o-1,t,o),i=this.session.getTextRange(n);if(!isNaN(parseFloat(i))&&isFinite(i)){var r=this.getNumberAt(t,o);if(r){var s=r.value.indexOf(".")>=0?r.start+r.value.indexOf(".")+1:r.end,l=r.start+r.value.length-s,a=parseFloat(r.value);a*=Math.pow(10,l),e*=s!==r.end&&s>o?Math.pow(10,r.end-o-1):Math.pow(10,r.end-o),a+=e,a/=Math.pow(10,l);var c=a.toFixed(l),u=new h(t,r.start,t,r.end);this.session.replace(u,c),this.moveCursorTo(t,Math.max(r.start+1,o+c.length-r.value.length))}}},this.removeLines=function(){var e,t=this.$getSelectedRows();e=0===t.first||t.last+1<this.session.getLength()?new h(t.first,0,t.last+1,0):new h(t.first-1,this.session.getLine(t.first-1).length,t.last,this.session.getLine(t.last).length),this.session.remove(e),this.clearSelection()},this.duplicateSelection=function(){var e=this.selection,t=this.session,o=e.getRange(),n=e.isBackwards();if(o.isEmpty()){var i=o.start.row;t.duplicateLines(i,i)}else{var r=n?o.start:o.end,s=t.insert(r,t.getTextRange(o),!1);o.start=r,o.end=s,e.setSelectionRange(o,n)}},this.moveLinesDown=function(){this.$moveLines(function(e,t){return this.session.moveLinesDown(e,t)})},this.moveLinesUp=function(){this.$moveLines(function(e,t){return this.session.moveLinesUp(e,t)})},this.moveText=function(e,t,o){return this.session.moveText(e,t,o)},this.copyLinesUp=function(){this.$moveLines(function(e,t){return this.session.duplicateLines(e,t),0})},this.copyLinesDown=function(){this.$moveLines(function(e,t){return this.session.duplicateLines(e,t)})},this.$moveLines=function(e){var t=this.selection;if(!t.inMultiSelectMode||this.inVirtualSelectionMode){var o=t.toOrientedRange(),n=this.$getSelectedRows(o),i=e.call(this,n.first,n.last);o.moveBy(i,0),t.fromOrientedRange(o)}else{var r=t.rangeList.ranges;t.rangeList.detach(this.session);for(var s=r.length;s--;){for(var l=s,n=r[s].collapseRows(),a=n.end.row,c=n.start.row;s--;){var n=r[s].collapseRows();if(!(c-n.end.row<=1))break;c=n.end.row}s++;for(var i=e.call(this,c,a);l>=s;)r[l].moveBy(i,0),l--}t.fromOrientedRange(t.ranges[0]),t.rangeList.attach(this.session)}},this.$getSelectedRows=function(){var e=this.getSelectionRange().collapseRows();return{first:e.start.row,last:e.end.row}},this.onCompositionStart=function(){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var o=this.renderer,n=this.renderer.layerConfig,i=e*Math.floor(n.height/n.lineHeight);this.$blockScrolling++,1==t?this.selection.$moveSelection(function(){this.moveCursorBy(i,0)}):0==t&&(this.selection.moveCursorBy(i,0),this.selection.clearSelection()),this.$blockScrolling--;var r=o.scrollTop;o.scrollBy(0,i*n.lineHeight),null!=t&&o.scrollCursorIntoView(null,.5),o.animateScrolling(r)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,o,n){this.renderer.scrollToLine(e,t,o,n)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.$blockScrolling+=1,this.selection.selectAll(),this.$blockScrolling-=1},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e){var t=this.getCursorPosition(),o=this.session.getBracketRange(t);if(!o){if(o=this.find({needle:/[{}()\[\]]/g,preventScroll:!0,start:{row:t.row,column:t.column-1}}),!o)return;var n=o.start;n.row==t.row&&Math.abs(n.column-t.column)<2&&(o=this.session.getBracketRange(n))}n=o&&o.cursor||n,n&&(e?o&&o.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(n.row,n.column):(this.clearSelection(),this.moveCursorTo(n.row,n.column)))},this.gotoLine=function(e,t,o){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.$blockScrolling+=1,this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.$blockScrolling-=1,this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,o)},this.navigateTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),e=e||1,this.selection.moveCursorBy(-e,0)},this.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),e=e||1,this.selection.moveCursorBy(e,0)},this.navigateLeft=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorLeft();else{var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}this.clearSelection()},this.navigateRight=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorRight();else{var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){var e=this.renderer.scrollTop;this.selection.moveCursorFileEnd(),this.clearSelection(),this.renderer.animateScrolling(e)},this.navigateFileStart=function(){var e=this.renderer.scrollTop;this.selection.moveCursorFileStart(),this.clearSelection(),this.renderer.animateScrolling(e)},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(e,t){t&&this.$search.set(t);var o=this.$search.find(this.session),n=0;return o?(this.$tryReplace(o,e)&&(n=1),null!==o&&(this.selection.setSelectionRange(o),this.renderer.scrollSelectionIntoView(o.start,o.end)),n):n},this.replaceAll=function(e,t){t&&this.$search.set(t);var o=this.$search.findAll(this.session),n=0;if(!o.length)return n;this.$blockScrolling+=1;var i=this.getSelectionRange();this.clearSelection(),this.selection.moveCursorTo(0,0);for(var r=o.length-1;r>=0;--r)this.$tryReplace(o[r],e)&&n++;return this.selection.setSelectionRange(i),this.$blockScrolling-=1,n},this.$tryReplace=function(e,t){var o=this.session.getTextRange(e);return t=this.$search.replace(o,t),null!==t?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()
7
- },this.find=function(e,t,n){t||(t={}),"string"==typeof e||e instanceof RegExp?t.needle=e:"object"==typeof e&&o.mixin(t,e);var i=this.selection.getRange();null==t.needle&&(e=this.session.getTextRange(i)||this.$search.$options.needle,e||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var r=this.$search.find(this.session);return t.preventScroll?r:r?(this.revealRange(r,n),r):(t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i),void 0)},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.$blockScrolling+=1,this.session.unfold(e),this.selection.setSelectionRange(e),this.$blockScrolling-=1;var o=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),0!=t&&this.renderer.animateScrolling(o)},this.undo=function(){this.$blockScrolling++,this.session.getUndoManager().undo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.$blockScrolling++,this.session.getUndoManager().redo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._emit("destroy",this)},this.setAutoScrollEditorIntoView=function(e){if(e!==!1){var t,o=this,n=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var i=this.$scrollAnchor;i.style.cssText="position:absolute",this.container.insertBefore(i,this.container.firstChild);var r=this.on("changeSelection",function(){n=!0}),s=this.renderer.on("beforeRender",function(){n&&(t=o.renderer.container.getBoundingClientRect())}),l=this.renderer.on("afterRender",function(){if(n&&t&&o.isFocused()){var e=o.renderer,r=e.$cursorLayer.$pixelPos,s=e.layerConfig,l=r.top-s.offset;n=r.top>=0&&l+t.top<0?!0:r.top<s.height&&r.top+t.top+s.lineHeight>window.innerHeight?!1:null,null!=n&&(i.style.top=l+"px",i.style.left=r.left+"px",i.style.height=s.lineHeight+"px",i.scrollIntoView(n)),n=t=null}});this.setAutoScrollEditorIntoView=function(e){e!==!0&&(delete this.setAutoScrollEditorIntoView,this.removeEventListener("changeSelection",r),this.renderer.removeEventListener("afterRender",l),this.renderer.removeEventListener("beforeRender",s))}}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;t&&(t.setSmoothBlinking("smooth"==e),t.isBlinking=!this.$readOnly&&"wide"!=e)}}).call(y.prototype),m.defineOptions(y.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._emit("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},cursorStyle:{set:function(){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",showGutter:"renderer",displayIndentGuides:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimout:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",tabSize:"session",wrap:"session",foldStyle:"session"}),t.Editor=y}),define("ace/lib/lang",["require","exports","module"],function(e,t){t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var o="";t>0;)1&t&&(o+=e),(t>>=1)&&(e+=e);return o};var o=/^\s\s*/,n=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(o,"")},t.stringTrimRight=function(e){return e.replace(n,"")},t.copyObject=function(e){var t={};for(var o in e)t[o]=e[o];return t},t.copyArray=function(e){for(var t=[],o=0,n=e.length;n>o;o++)t[o]=e[o]&&"object"==typeof e[o]?this.copyObject(e[o]):e[o];return t},t.deepCopy=function(e){if("object"!=typeof e)return e;var t=e.constructor();for(var o in e)t[o]="object"==typeof e[o]?this.deepCopy(e[o]):e[o];return t},t.arrayToMap=function(e){for(var t={},o=0;o<e.length;o++)t[e[o]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var o in e)t[o]=e[o];return t},t.arrayRemove=function(e,t){for(var o=0;o<=e.length;o++)t===e[o]&&e.splice(o,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return e.replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},t.getMatchOffsets=function(e,t){var o=[];return e.replace(t,function(e){o.push({offset:arguments[arguments.length-2],length:e.length})}),o},t.deferredCall=function(e){var t=null,o=function(){t=null,e()},n=function(e){return n.cancel(),t=setTimeout(o,e||0),n};return n.schedule=n,n.call=function(){return this.cancel(),e(),n},n.cancel=function(){return clearTimeout(t),t=null,n},n},t.delayedCall=function(e,t){var o=null,n=function(){o=null,e()},i=function(e){o&&clearTimeout(o),o=setTimeout(n,e||t)};return i.delay=i,i.schedule=function(e){null==o&&(o=setTimeout(n,e||0))},i.call=function(){this.cancel(),e()},i.cancel=function(){o&&clearTimeout(o),o=null},i.isPending=function(){return o},i}}),define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang"],function(e,t){var o=e("../lib/event"),n=e("../lib/useragent"),i=e("../lib/dom"),r=e("../lib/lang"),s=n.isChrome<18,l=function(e,t){function l(e){if(!f){if(R)t=0,o=e?0:u.value.length-1;else var t=e?2:1,o=2;try{u.setSelectionRange(t,o)}catch(n){}}}function a(){f||(u.value=g,n.isWebKit&&B.schedule())}function c(){setTimeout(function(){m&&(u.style.cssText=m,m=""),null==t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}var u=i.createElement("textarea");u.className="ace_text-input",n.isTouchPad&&u.setAttribute("x-palm-disable-auto-cap",!0),u.wrap="off",u.autocorrect="off",u.autocapitalize="off",u.spellcheck=!1,u.style.opacity="0",e.insertBefore(u,e.firstChild);var g="",h=!1,d=!1,p=!1,f=!1,m="",y=!0;try{var _=document.activeElement===u}catch(v){}o.addListener(u,"blur",function(){t.onBlur(),_=!1}),o.addListener(u,"focus",function(){_=!0,t.onFocus(),l()}),this.focus=function(){u.focus()},this.blur=function(){u.blur()},this.isFocused=function(){return _};var E=r.delayedCall(function(){_&&l(y)}),B=r.delayedCall(function(){f||(u.value=g,_&&l())});n.isWebKit||t.addEventListener("changeSelection",function(){t.selection.isEmpty()!=y&&(y=!y,E.schedule())}),a(),_&&t.onFocus();var C=function(e){return 0===e.selectionStart&&e.selectionEnd===e.value.length};if(!u.setSelectionRange&&u.createTextRange&&(u.setSelectionRange=function(e,t){var o=this.createTextRange();o.collapse(!0),o.moveStart("character",e),o.moveEnd("character",t),o.select()},C=function(e){try{var t=e.ownerDocument.selection.createRange()}catch(o){}return t&&t.parentElement()==e?t.text==e.value:!1}),n.isOldIE){var k=!1,b=function(e){if(!k){var t=u.value;if(!f&&t&&t!=g)return e&&t==g[0]?A.schedule():(D(t),k=!0,a(),k=!1,void 0)}},A=r.delayedCall(b);o.addListener(u,"propertychange",b);var T={13:1,27:1};o.addListener(u,"keyup",function(e){return f&&(!u.value||T[e.keyCode])&&setTimeout(M,0),(u.value.charCodeAt(0)||0)<129?A.call():(f?x():O(),void 0)}),o.addListener(u,"keydown",function(){A.schedule(50)})}var S=function(){h?h=!1:d?d=!1:C(u)?(t.selectAll(),l()):R&&l(t.selection.isEmpty())},R=null;this.setInputHandler=function(e){R=e},this.getInputHandler=function(){return R};var w=!1,D=function(e){R&&(e=R(e),R=null),p?(l(),e&&t.onPaste(e),p=!1):e==g.charAt(0)?w&&t.execCommand("del",{source:"ace"}):(e.substring(0,2)==g?e=e.substr(2):e.charAt(0)==g.charAt(0)?e=e.substr(1):e.charAt(e.length-1)==g.charAt(0)&&(e=e.slice(0,-1)),e.charAt(e.length-1)==g.charAt(0)&&(e=e.slice(0,-1)),e&&t.onTextInput(e)),w&&(w=!1)},I=function(){if(!f){var e=u.value;D(e),a()}},F=function(e){var n=t.getCopyText();if(!n)return o.preventDefault(e),void 0;var i=e.clipboardData||window.clipboardData;if(i&&!s){var r=i.setData("Text",n);r&&(t.onCut(),o.preventDefault(e))}r||(h=!0,u.value=n,u.select(),setTimeout(function(){h=!1,a(),l(),t.onCut()}))},L=function(e){var n=t.getCopyText();if(!n)return o.preventDefault(e),void 0;var i=e.clipboardData||window.clipboardData;if(i&&!s){var r=i.setData("Text",n);r&&(t.onCopy(),o.preventDefault(e))}r||(d=!0,u.value=n,u.select(),setTimeout(function(){d=!1,a(),l(),t.onCopy()}))},N=function(e){var i=e.clipboardData||window.clipboardData;if(i){var r=i.getData("Text");r&&t.onPaste(r),n.isIE&&setTimeout(l),o.preventDefault(e)}else u.value="",p=!0};o.addCommandKeyListener(u,t.onCommandKey.bind(t)),o.addListener(u,"select",S),o.addListener(u,"input",I),o.addListener(u,"cut",F),o.addListener(u,"copy",L),o.addListener(u,"paste",N),!("oncut"in u&&"oncopy"in u&&"onpaste"in u||!o.addListener(e,"keydown",function(e){if((!n.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:L(e);break;case 86:N(e);break;case 88:F(e)}}));var O=function(){f||(f={},t.onCompositionStart(),setTimeout(x,0),t.on("mousedown",M),t.selection.isEmpty()||(t.insert(""),t.session.markUndoGroup(),t.selection.clearSelection()),t.session.markUndoGroup())},x=function(){if(f){var e=u.value.replace(/\x01/g,"");if(f.lastValue!==e&&(t.onCompositionUpdate(e),f.lastValue&&t.undo(),f.lastValue=e,f.lastValue)){var o=t.selection.getRange();t.insert(f.lastValue),t.session.markUndoGroup(),f.range=t.selection.getRange(),t.selection.setRange(o),t.selection.clearSelection()}}},M=function(e){var o=f;f=!1;var n=setTimeout(function(){n=null;var e=u.value.replace(/\x01/g,"");f||(e==o.lastValue?a():!o.lastValue&&e&&(a(),D(e)))});R=function(e){return n&&clearTimeout(n),e=e.replace(/\x01/g,""),e==o.lastValue?"":(o.lastValue&&n&&t.undo(),e)},t.onCompositionEnd(),t.removeListener("mousedown",M),"compositionend"==e.type&&o.range&&t.selection.setRange(o.range)},P=r.delayedCall(x,50);if(o.addListener(u,"compositionstart",O),n.isGecko?o.addListener(u,"text",function(){P.schedule()}):(o.addListener(u,"keyup",function(){P.schedule()}),o.addListener(u,"keydown",function(){P.schedule()})),o.addListener(u,"compositionend",M),this.getElement=function(){return u},this.setReadOnly=function(e){u.readOnly=e},this.onContextMenu=function(e){w=!0,m||(m=u.style.cssText),u.style.cssText="z-index:100000;"+(n.isIE?"opacity:0.1;":""),l(t.selection.isEmpty()),t._emit("nativecontextmenu",{target:t,domEvent:e});var r=t.container.getBoundingClientRect(),s=i.computedStyle(t.container),a=r.top+(parseInt(s.borderTopWidth)||0),g=r.left+(parseInt(r.borderLeftWidth)||0),h=r.bottom-a-u.clientHeight,d=function(e){u.style.left=e.clientX-g-2+"px",u.style.top=Math.min(e.clientY-a-2,h)+"px"};d(e),"mousedown"==e.type&&(t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),n.isWin&&o.capture(t.container,d,c))},this.onContextMenuClose=c,!n.isGecko||n.isMac){var H=function(e){t.textInput.onContextMenu(e),c()};o.addListener(t.renderer.scroller,"contextmenu",H),o.addListener(u,"contextmenu",H)}};t.TextInput=l}),define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"],function(e,t){var o=e("../lib/event"),n=e("../lib/useragent"),i=e("./default_handlers").DefaultHandlers,r=e("./default_gutter_handler").GutterHandler,s=e("./mouse_event").MouseEvent,l=e("./dragdrop_handler").DragdropHandler,a=e("../config"),c=function(e){this.editor=e,new i(this),new r(this),new l(this);var t=e.renderer.getMouseEventTarget();o.addListener(t,"click",this.onMouseEvent.bind(this,"click")),o.addListener(t,"mousemove",this.onMouseMove.bind(this,"mousemove")),o.addMultiMouseDownListener(t,[300,300,250],this,"onMouseEvent"),e.renderer.scrollBarV&&(o.addMultiMouseDownListener(e.renderer.scrollBarV.inner,[300,300,250],this,"onMouseEvent"),o.addMultiMouseDownListener(e.renderer.scrollBarH.inner,[300,300,250],this,"onMouseEvent")),o.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"));var n=e.renderer.$gutter;o.addListener(n,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),o.addListener(n,"click",this.onMouseEvent.bind(this,"gutterclick")),o.addListener(n,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),o.addListener(n,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),o.addListener(t,"mousedown",function(){e.focus()}),o.addListener(n,"mousedown",function(t){return e.focus(),o.preventDefault(t)})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new s(t,this.editor))},this.onMouseMove=function(e,t){var o=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;o&&o.length&&this.editor._emit(e,new s(t,this.editor))},this.onMouseWheel=function(e,t){var o=new s(t,this.editor);o.speed=2*this.$scrollSpeed,o.wheelX=t.wheelX,o.wheelY=t.wheelY,this.editor._emit(e,o)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var i=this.editor.renderer;i.$keepTextAreaAtCursor&&(i.$keepTextAreaAtCursor=null);var r=this,s=function(e){r.x=e.clientX,r.y=e.clientY,t&&t(e)},l=function(e){clearInterval(c),a(),r[r.state+"End"]&&r[r.state+"End"](e),r.$clickSelection=null,null==i.$keepTextAreaAtCursor&&(i.$keepTextAreaAtCursor=!0,i.$moveTextAreaToCursor()),r.isMousePressed=!1,r.onMouseEvent("mouseup",e)},a=function(){r[r.state]&&r[r.state]()};if(n.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){l(e)});o.capture(this.editor.container,s,l);var c=setInterval(a,20)}}).call(c.prototype),a.defineOptions(c.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:150},dragEnabled:{initialValue:!0},focusTimout:{initialValue:0}}),t.MouseHandler=c}),define("ace/mouse/default_handlers",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t){function o(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e));var o=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];o.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function n(e,t,o,n){return Math.sqrt(Math.pow(o-e,2)+Math.pow(n-t,2))}function i(e,t){if(e.start.row==e.end.row)var o=2*t.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)var o=2*t.row-e.start.row-e.end.row;else var o=t.column-4;return 0>o?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}var r=(e("../lib/dom"),e("../lib/event"),e("../lib/useragent"),0);(function(){this.onMouseDown=function(e){var t=e.inSelection(),o=e.getDocumentPosition();this.mousedownEvent=e;var n=this.editor,i=e.getButton();if(0!==i){var r=n.getSelectionRange(),s=r.isEmpty();return s&&(n.moveCursorToPosition(o),n.selection.clearSelection()),n.textInput.onContextMenu(e.domEvent),void 0}return!t||n.isFocused()||(n.focus(),!this.$focusTimout||this.$clickSelection||n.inMultiSelectMode)?(!t||this.$clickSelection||e.getShiftKey()||n.inMultiSelectMode?this.startSelect(o):t&&(this.mousedownEvent.time=(new Date).getTime(),this.startSelect(o)),this.captureMouse(e),e.preventDefault()):(this.mousedownEvent.time=(new Date).getTime(),this.setState("focusWait"),this.captureMouse(e),void 0)},this.startSelect=function(e){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var t=this.editor;setTimeout(function(){this.mousedownEvent.getShiftKey()?t.selection.selectToPosition(e):this.$clickSelection||(t.moveCursorToPosition(e),t.selection.clearSelection())}.bind(this),0),t.renderer.scroller.setCapture&&t.renderer.scroller.setCapture(),t.setStyle("ace_selecting"),this.setState("select")},this.select=function(){var e,t=this.editor,o=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var n=this.$clickSelection.comparePoint(o);if(-1==n)e=this.$clickSelection.end;else if(1==n)e=this.$clickSelection.start;else{var r=i(this.$clickSelection,o);o=r.cursor,e=r.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(o),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,o=this.editor,n=o.renderer.screenToTextCoordinates(this.x,this.y),r=o.selection[e](n.row,n.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(r.start),l=this.$clickSelection.comparePoint(r.end);if(-1==s&&0>=l)t=this.$clickSelection.end,(r.end.row!=n.row||r.end.column!=n.column)&&(n=r.start);else if(1==l&&s>=0)t=this.$clickSelection.start,(r.start.row!=n.row||r.start.column!=n.column)&&(n=r.end);else if(-1==s&&1==l)n=r.end,t=r.start;else{var a=i(this.$clickSelection,n);n=a.cursor,t=a.anchor}o.selection.setSelectionAnchor(t.row,t.column)}o.selection.selectToPosition(n),o.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=n(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=(new Date).getTime();(e>r||t-this.mousedownEvent.time>this.$focusTimout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),o=this.editor,n=o.session,i=n.getBracketRange(t);return i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.$clickSelection=i,this.setState("select"),void 0):(this.$clickSelection=o.selection.getWordRange(t.row,t.column),this.setState("selectByWords"),void 0)},this.onTripleClick=function(e){var t=e.getDocumentPosition(),o=this.editor;this.setState("selectByLines"),this.$clickSelection=o.selection.getLineRange(t.row)},this.onQuadClick=function(){var e=this.editor;e.selectAll(),this.$clickSelection=e.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(!e.getShiftKey()&&!e.getAccelKey()){var t=e.domEvent.timeStamp,o=t-(this.$lastScrollTime||0),n=this.editor,i=n.renderer.isScrollableBy(e.wheelX*e.speed,e.wheelY*e.speed);return i||200>o?(this.$lastScrollTime=t,n.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()):void 0}}}).call(o.prototype),t.DefaultHandlers=o}),define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event"],function(e,t){function o(e){function t(){g=n.createElement("div"),g.className="ace_gutter-tooltip",g.style.display="none",l.container.appendChild(g)}function o(){g||t();var e=u.getDocumentPosition().row,o=a.$annotations[e];if(!o)return r();var n=l.session.getLength();if(e==n){var i=l.renderer.pixelToScreenCoordinates(0,u.y).row,c=u.$pos;if(i>l.session.documentToScreenRow(c.row,c.column))return r()}h!=o&&(h=o.text.join("<br/>"),g.style.display="block",g.innerHTML=h,l.on("mousewheel",r),s(u))}function r(){c&&(c=clearTimeout(c)),h&&(g.style.display="none",h=null,l.removeEventListener("mousewheel",r))}function s(e){var t=l.renderer.$gutter.getBoundingClientRect();if(g.style.left=e.x+15+"px",e.y+3*l.renderer.lineHeight+15<t.bottom)g.style.bottom="",g.style.top=e.y+15+"px";else{g.style.top="";var o=window.innerHeight||document.documentElement.clientHeight;g.style.bottom=o-e.y+5+"px"}}var l=e.editor,a=l.renderer.$gutterLayer;e.editor.setDefaultHandler("guttermousedown",function(t){if(l.isFocused()&&0==t.getButton()){var o=a.getRegion(t);if("foldWidgets"!=o){var n=t.getDocumentPosition().row,i=l.session.selection;if(t.getShiftKey())i.selectTo(n,0);else{if(2==t.domEvent.detail)return l.selectAll(),t.preventDefault();e.$clickSelection=l.selection.getLineRange(n)}return e.setState("selectByLines"),e.captureMouse(t),t.preventDefault()}}});var c,u,g,h;e.editor.setDefaultHandler("guttermousemove",function(t){var i=t.domEvent.target||t.domEvent.srcElement;return n.hasCssClass(i,"ace_fold-widget")?r():(h&&s(t),u=t,c||(c=setTimeout(function(){c=null,u&&!e.isMousePressed?o():r()},50)),void 0)}),i.addListener(l.renderer.$gutter,"mouseout",function(){u=null,h&&!c&&(c=setTimeout(function(){c=null,r()},50))}),l.on("changeSession",r)}var n=e("../lib/dom"),i=e("../lib/event");t.GutterHandler=o}),define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t){var o=e("../lib/event"),n=e("../lib/useragent"),i=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){o.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){o.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var o=this.getDocumentPosition();this.$inSelection=t.contains(o.row,o.column)}return this.$inSelection},this.getButton=function(){return o.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=n.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(i.prototype)}),define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t){function o(e){function t(e,t){var o=(new Date).getTime(),i=!t||e.row!=t.row,r=!t||e.column!=t.column;if(!R||i||r)m.$blockScrolling+=1,m.moveCursorToPosition(e),m.$blockScrolling-=1,R=o,w={x:E,y:B};else{var s=n(w.x,w.y,E,B);s>c?R=null:o-R>=a&&(m.renderer.scrollCursorIntoView(),R=null)}}function o(e,t){var o=(new Date).getTime(),n=m.renderer.layerConfig.lineHeight,i=m.renderer.layerConfig.characterWidth,r=m.renderer.scroller.getBoundingClientRect(),s={x:{left:E-r.left,right:r.right-E},y:{top:B-r.top,bottom:r.bottom-B}},a=Math.min(s.x.left,s.x.right),c=Math.min(s.y.top,s.y.bottom),u={row:e.row,column:e.column};2>=a/i&&(u.column+=s.x.left<s.x.right?-3:2),1>=c/n&&(u.row+=s.y.top<s.y.bottom?-1:1);var g=e.row!=u.row,h=e.column!=u.column,d=!t||e.row!=t.row;g||h&&!d?S?o-S>=l&&m.renderer.scrollCursorIntoView(u):S=o:S=null}function u(){var e=b;b=m.renderer.screenToTextCoordinates(E,B),t(b,e),o(b,e)}function g(){k=m.selection.toOrientedRange(),v=m.session.addMarker(k,"ace_selection",m.getSelectionStyle()),m.clearSelection(),m.isFocused()&&m.renderer.$cursorLayer.setBlinking(!1),clearInterval(C),C=setInterval(u,20),I=0,r.addListener(document,"mousemove",d)}function h(){clearInterval(C),m.session.removeMarker(v),v=null,m.$blockScrolling+=1,m.selection.fromOrientedRange(k),m.$blockScrolling-=1,m.isFocused()&&!T&&m.renderer.$cursorLayer.setBlinking(!m.getReadOnly()),k=null,I=0,S=null,R=null,r.removeListener(document,"mousemove",d)}function d(){null==F&&(F=setTimeout(function(){null!=F&&v&&h()},20))}function p(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return"text/plain"==e||"Text"==e})}function f(e){var t=["copy","copymove","all","uninitialized"],o=["move","copymove","linkmove","all","uninitialized"],n=s.isMac?e.altKey:e.ctrlKey,i="uninitialized";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var r="none";return n&&t.indexOf(i)>=0?r="copy":o.indexOf(i)>=0?r="move":t.indexOf(i)>=0&&(r="copy"),r}var m=e.editor,y=i.createElement("img");y.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(y.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var _=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];_.forEach(function(t){e[t]=this[t]},this),m.addEventListener("mousedown",this.onMouseDown.bind(e));var v,E,B,C,k,b,A,T,S,R,w,D=m.container,I=0;this.onDragStart=function(e){if(this.cancelDrag||!D.draggable){var t=this;return setTimeout(function(){t.startSelect(),t.captureMouse(e)},0),e.preventDefault()}k=m.getSelectionRange();var o=e.dataTransfer;o.effectAllowed=m.getReadOnly()?"copy":"copyMove",s.isOpera&&(m.container.appendChild(y),y._top=y.offsetTop),o.setDragImage&&o.setDragImage(y,0,0),s.isOpera&&m.container.removeChild(y),o.clearData(),o.setData("Text",m.session.getTextRange()),T=!0,this.setState("drag")},this.onDragEnd=function(e){if(D.draggable=!1,T=!1,this.setState(null),!m.getReadOnly()){var t=e.dataTransfer.dropEffect;!A&&"move"==t&&m.session.remove(m.getSelectionRange()),m.renderer.$cursorLayer.setBlinking(!0)}this.editor.unsetStyle("ace_dragging")},this.onDragEnter=function(e){return!m.getReadOnly()&&p(e.dataTransfer)?(v||g(),I++,e.dataTransfer.dropEffect=A=f(e),r.preventDefault(e)):void 0},this.onDragOver=function(e){return!m.getReadOnly()&&p(e.dataTransfer)?(v||(g(),I++),null!==F&&(F=null),E=e.clientX,B=e.clientY,e.dataTransfer.dropEffect=A=f(e),r.preventDefault(e)):void 0},this.onDragLeave=function(e){return I--,0>=I&&v?(h(),A=null,r.preventDefault(e)):void 0},this.onDrop=function(e){if(v){var t=e.dataTransfer;if(T)switch(A){case"move":k=k.contains(b.row,b.column)?{start:b,end:b}:m.moveText(k,b);break;case"copy":k=m.moveText(k,b,!0)}else{var o=t.getData("Text");k={start:b,end:m.session.insert(b,o)},m.focus(),A=null}return h(),r.preventDefault(e)}},r.addListener(D,"dragstart",this.onDragStart.bind(e)),r.addListener(D,"dragend",this.onDragEnd.bind(e)),r.addListener(D,"dragenter",this.onDragEnter.bind(e)),r.addListener(D,"dragover",this.onDragOver.bind(e)),r.addListener(D,"dragleave",this.onDragLeave.bind(e)),r.addListener(D,"drop",this.onDrop.bind(e));var F=null}function n(e,t,o,n){return Math.sqrt(Math.pow(o-e,2)+Math.pow(n-t,2))}var i=e("../lib/dom"),r=e("../lib/event"),s=e("../lib/useragent"),l=200,a=200,c=5;(function(){this.dragWait=function(){var e=(new Date).getTime()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(){this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()),this.editor.unsetStyle("ace_dragging"),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor.container;e.draggable=!0,this.editor.renderer.$cursorLayer.setBlinking(!1),this.editor.setStyle("ace_dragging"),this.setState("dragReady")},this.onMouseDrag=function(){var e=this.editor.container;if(s.isIE&&"dragReady"==this.state){var t=n(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>3&&e.dragDrop()}if("dragWait"===this.state){var t=n(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);t>0&&(e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var t=this.editor,o=e.inSelection(),n=e.getButton(),i=e.domEvent.detail||1;if(1===i&&0===n&&o){this.mousedownEvent.time=(new Date).getTime();var r=e.domEvent.target||e.domEvent.srcElement;if("unselectable"in r&&(r.unselectable="on"),t.getDragDelay()){if(s.isWebKit){self.cancelDrag=!0;var l=t.container;l.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(o.prototype),t.DragdropHandler=o}),define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/event_emitter"],function(e,t,o){"no use strict";function n(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}var i=e("./lib/lang"),r=e("./lib/oop"),s=e("./lib/net"),l=e("./lib/event_emitter").EventEmitter,a=function(){return this}(),c={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{}};t.get=function(e){if(!c.hasOwnProperty(e))throw new Error("Unknown config key: "+e);return c[e]},t.set=function(e,t){if(!c.hasOwnProperty(e))throw new Error("Unknown config key: "+e);c[e]=t},t.all=function(){return i.copyObject(c)},r.implement(t,l),t.moduleUrl=function(e,t){if(c.$moduleUrls[e])return c.$moduleUrls[e];var o=e.split("/");t=t||o[o.length-2]||"";var n="snippets"==t?"/":"-",i=o[o.length-1];if("-"==n){var r=new RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");i=i.replace(r,"")}(!i||i==t)&&o.length>1&&(i=o[o.length-2]);var s=c[t+"Path"];return null==s?s=c.basePath:"/"==n&&(t=n=""),s&&"/"!=s.slice(-1)&&(s+="/"),s+t+n+i+this.get("suffix")},t.setModuleUrl=function(e,t){return c.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(o,n){var i,r;Array.isArray(o)&&(r=o[0],o=o[1]);try{i=e(o)}catch(l){}if(i&&!t.$loading[o])return n&&n(i);if(t.$loading[o]||(t.$loading[o]=[]),t.$loading[o].push(n),!(t.$loading[o].length>1)){var a=function(){e([o],function(e){t._emit("load.module",{name:o,module:e});var n=t.$loading[o];t.$loading[o]=null,n.forEach(function(t){t&&t(e)})})};return t.get("packaged")?(s.loadScript(t.moduleUrl(o,r),a),void 0):a()}},t.init=function(){if(c.packaged=e.packaged||o.packaged||a.define&&define.packaged,!a.document)return"";for(var i={},r="",s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var u=s[l],g=u.src||u.getAttribute("src");if(g){for(var h=u.attributes,d=0,p=h.length;p>d;d++){var f=h[d];0===f.name.indexOf("data-ace-")&&(i[n(f.name.replace(/^data-ace-/,""))]=f.value)}var m=g.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);m&&(r=m[1])}}r&&(i.base=i.base||r,i.packaged=!0),i.basePath=i.base,i.workerPath=i.workerPath||i.base,i.modePath=i.modePath||i.base,i.themePath=i.themePath||i.base,delete i.base;for(var y in i)"undefined"!=typeof i[y]&&t.set(y,i[y])};var u={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};return e?Array.isArray(e)||(t=e,e=Object.keys(t)):e=Object.keys(this.$options),e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this["$"+e]!==t){var o=this.$options[e];return o?o.forwardTo?this[o.forwardTo]&&this[o.forwardTo].setOption(e,t):(o.handlesSet||(this["$"+e]=t),o&&o.set&&o.set.call(this,t),void 0):("undefined"!=typeof console&&console.warn&&console.warn('misspelled option "'+e+'"'),void 0)}},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:("undefined"!=typeof console&&console.warn&&console.warn('misspelled option "'+e+'"'),void 0)}},g={};t.defineOptions=function(e,t,o){return e.$options||(g[t]=e.$options={}),Object.keys(o).forEach(function(t){var n=o[t];"string"==typeof n&&(n={forwardTo:n}),n.name||(n.name=t),e.$options[n.name]=n,"initialValue"in n&&(e["$"+n.name]=n.initialValue)}),r.implement(e,u),this},t.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var o=e.$options[t];"value"in o&&e.setOption(t,o.value)})},t.setDefaultValue=function(e,o,n){var i=g[e]||(g[e]={});i[o]&&(i.forwardTo?t.setDefaultValue(i.forwardTo,o,n):i[o].value=n)},t.setDefaultValues=function(e,o){Object.keys(o).forEach(function(n){t.setDefaultValue(e,n,o[n])})}}),define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t){var o=e("./dom");t.get=function(e,t){var o=new XMLHttpRequest;o.open("GET",e,!0),o.onreadystatechange=function(){4===o.readyState&&t(o.responseText)},o.send(null)},t.loadScript=function(e,t){var n=o.getDocumentHead(),i=document.createElement("script");i.src=e,n.appendChild(i),i.onload=i.onreadystatechange=function(e,o){(o||!i.readyState||"loaded"==i.readyState||"complete"==i.readyState)&&(i=i.onload=i.onreadystatechange=null,o||t())}}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t){var o={},n=function(){this.propagationStopped=!0
8
- },i=function(){this.defaultPrevented=!0};o._emit=o._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var o=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(o.length||r){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=n),t.preventDefault||(t.preventDefault=i),o=o.slice();for(var s=0;s<o.length&&(o[s](t,this),!t.propagationStopped);s++);return r&&!t.defaultPrevented?r(t,this):void 0}},o._signal=function(e,t){var o=(this._eventRegistry||{})[e];if(o){o=o.slice();for(var n=0;n<o.length;n++)o[n](t,this)}},o.once=function(e,t){var o=this;t&&this.addEventListener(e,function n(){o.removeEventListener(e,n),t.apply(null,arguments)})},o.setDefaultHandler=function(e,t){var o=this._defaultHandlers;if(o||(o=this._defaultHandlers={_disabled_:{}}),o[e]){var n=o[e],i=o._disabled_[e];i||(o._disabled_[e]=i=[]),i.push(n);var r=i.indexOf(t);-1!=r&&i.splice(r,1)}o[e]=t},o.removeDefaultHandler=function(e,t){var o=this._defaultHandlers;if(o){var n=o._disabled_[e];if(o[e]==t){{o[e]}n&&this.setDefaultHandler(e,n.pop())}else if(n){var i=n.indexOf(t);-1!=i&&n.splice(i,1)}}},o.on=o.addEventListener=function(e,t,o){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];return n||(n=this._eventRegistry[e]=[]),-1==n.indexOf(t)&&n[o?"unshift":"push"](t),t},o.off=o.removeListener=o.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var o=this._eventRegistry[e];if(o){var n=o.indexOf(t);-1!==n&&o.splice(n,1)}},o.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=o}),define("ace/mouse/fold_handler",["require","exports","module"],function(e,t){function o(e){e.on("click",function(t){var o=t.getDocumentPosition(),n=e.session,i=n.getFoldAt(o.row,o.column,1);i&&(t.getAccelKey()?n.removeFold(i):n.expandFold(i),t.stop())}),e.on("gutterclick",function(t){var o=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==o){var n=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[n]&&e.session.onFoldWidgetClick(n,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var o=e.renderer.$gutterLayer.getRegion(t);if("foldWidgets"==o){var n=t.getDocumentPosition().row,i=e.session,r=i.getParentFoldRangeData(n,!0),s=r.range||r.firstRange;if(s){var n=s.start.row,l=i.getFoldAt(n,i.getLine(n).length,1);l?i.removeFold(l):(i.addFold("...",s),e.renderer.scrollCursorIntoView({row:s.start.row,column:0}))}t.stop()}})}t.FoldHandler=o}),define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t){var o=e("../lib/keys"),n=e("../lib/event"),i=function(e){this.$editor=e,this.$data={},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0),this.$data={editor:this.$editor}},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]!=e){for(;t[t.length-1]&&t[t.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)}},this.addKeyboardHandler=function(e,t){if(e){var o=this.$handlers.indexOf(e);-1!=o&&this.$handlers.splice(o,1),void 0==t?this.$handlers.push(e):this.$handlers.splice(t,0,e),-1==o&&e.attach&&e.attach(this.$editor)}},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return-1==t?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.$callKeyboardHandlers=function(e,t,o,i){for(var r,s=!1,l=this.$editor.commands,a=this.$handlers.length;a--&&(r=this.$handlers[a].handleKeyboard(this.$data,e,t,o,i),!(r&&r.command&&(s="null"==r.command?!0:l.exec(r.command,this.$editor,r.args,i),s&&i&&-1!=e&&1!=r.passEvent&&1!=r.command.passEvent&&n.stopEvent(i),s))););return s},this.onCommandKey=function(e,t,n){var i=o.keyCodeToString(n);this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){var t=this.$callKeyboardHandlers(-1,e);t||this.$editor.commands.exec("insertstring",this.$editor,e)}}).call(i.prototype),t.KeyBinding=i}),define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,t){var o=e("./lib/oop"),n=e("./lib/lang"),i=e("./config"),r=e("./lib/event_emitter").EventEmitter,s=e("./selection").Selection,l=e("./mode/text").Mode,a=e("./range").Range,c=e("./document").Document,u=e("./background_tokenizer").BackgroundTokenizer,g=e("./search_highlight").SearchHighlight,h=function(e,t){this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$foldData=[],this.$foldData.toString=function(){return this.join("\n")},this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof e&&e.getLine||(e=new c(e)),this.setDocument(e),this.selection=new s(this),i.resetOptions(this),this.setMode(t),i._emit("session",this)};(function(){function t(e){return 4352>e?!1:e>=4352&&4447>=e||e>=4515&&4519>=e||e>=4602&&4607>=e||e>=9001&&9002>=e||e>=11904&&11929>=e||e>=11931&&12019>=e||e>=12032&&12245>=e||e>=12272&&12283>=e||e>=12288&&12350>=e||e>=12353&&12438>=e||e>=12441&&12543>=e||e>=12549&&12589>=e||e>=12593&&12686>=e||e>=12688&&12730>=e||e>=12736&&12771>=e||e>=12784&&12830>=e||e>=12832&&12871>=e||e>=12880&&13054>=e||e>=13056&&19903>=e||e>=19968&&42124>=e||e>=42128&&42182>=e||e>=43360&&43388>=e||e>=44032&&55203>=e||e>=55216&&55238>=e||e>=55243&&55291>=e||e>=63744&&64255>=e||e>=65040&&65049>=e||e>=65072&&65106>=e||e>=65108&&65126>=e||e>=65128&&65131>=e||e>=65281&&65376>=e||e>=65504&&65510>=e}o.implement(this,r),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e)return this.$docRowCache=[],this.$screenRowCache=[],void 0;var t=this.$docRowCache.length,o=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>o&&(this.$docRowCache.splice(o,t),this.$screenRowCache.splice(o,t))},this.$getRowCacheIndex=function(e,t){for(var o=0,n=e.length-1;n>=o;){var i=o+n>>1,r=e[i];if(t>r)o=i+1;else{if(!(r>t))return i;n=i-1}}return o-1},this.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.bgTokenizer&&this.bgTokenizer.start(0)},this.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},this.onChange=function(e){var t=e.data;this.$modified=!0,this.$resetRowCache(t.range.start.row);var o=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&!t.ignore&&(this.$deltasDoc.push(t),o&&0!=o.length&&this.$deltasFold.push({action:"removeFolds",folds:o}),this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(t),this._emit("change",e)},this.setValue=function(e){this.doc.setValue(e),this.selection.moveCursorTo(0,0),this.selection.clearSelection(),this.$resetRowCache(0),this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(e){return this.bgTokenizer.getState(e)},this.getTokens=function(e){return this.bgTokenizer.getTokens(e)},this.getTokenAt=function(e,t){var o,n=this.bgTokenizer.getTokens(e),i=0;if(null==t)r=n.length-1,i=this.getLine(e).length;else for(var r=0;r<n.length&&(i+=n[r].value.length,!(i>=t));r++);return o=n[r],o?(o.index=r,o.start=i-o.value.length,o):null},this.setUndoManager=function(e){if(this.$undoManager=e,this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.$informUndoManager&&this.$informUndoManager.cancel(),e){var t=this;this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.$deltasFold.length&&(t.$deltas.push({group:"fold",deltas:t.$deltasFold}),t.$deltasFold=[]),t.$deltasDoc.length&&(t.$deltas.push({group:"doc",deltas:t.$deltasDoc}),t.$deltasDoc=[]),t.$deltas.length>0&&e.execute({action:"aceupdate",args:[t.$deltas,t],merge:t.mergeUndoDeltas}),t.mergeUndoDeltas=!1,t.$deltas=[]},this.$informUndoManager=n.delayedCall(this.$syncInformUndoManager)}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?n.stringRepeat(" ",this.getTabSize()):" "},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize==0},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._emit("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._emit("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._emit("changeBreakpoint",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._emit("changeBreakpoint",{})},this.setBreakpoint=function(e,t){void 0===t&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._emit("changeBreakpoint",{})},this.clearBreakpoint=function(e){delete this.$breakpoints[e],this._emit("changeBreakpoint",{})},this.addMarker=function(e,t,o,n){var i=this.$markerId++,r={range:e,type:o||"line",renderer:"function"==typeof o?o:null,clazz:t,inFront:!!n,id:i};return n?(this.$frontMarkers[i]=r,this._emit("changeFrontMarker")):(this.$backMarkers[i]=r,this._emit("changeBackMarker")),i},this.addDynamicMarker=function(e,t){if(e.update){var o=this.$markerId++;return e.id=o,e.inFront=!!t,t?(this.$frontMarkers[o]=e,this._emit("changeFrontMarker")):(this.$backMarkers[o]=e,this._emit("changeBackMarker")),e}},this.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(t){var o=t.inFront?this.$frontMarkers:this.$backMarkers;t&&(delete o[e],this._emit(t.inFront?"changeFrontMarker":"changeBackMarker"))}},this.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},this.highlight=function(e){if(!this.$searchHighlight){var t=new g(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},this.highlightLines=function(e,t,o,n){"number"!=typeof t&&(o=t,t=e),o||(o="ace_step");var i=new a(e,0,t,1/0);return i.id=this.addMarker(i,o,"fullLine",n),i},this.setAnnotations=function(e){this.$annotations=e,this._emit("changeAnnotation",{})},this.getAnnotations=function(){return this.$annotations||[]},this.clearAnnotations=function(){this.setAnnotations([])},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);this.$autoNewLine=t?t[1]:"\n"},this.getWordRange=function(e,t){var o=this.getLine(e),n=!1;if(t>0&&(n=!!o.charAt(t-1).match(this.tokenRe)),n||(n=!!o.charAt(t).match(this.tokenRe)),n)var i=this.tokenRe;else if(/^\s+$/.test(o.slice(t-1,t+1)))var i=/\s/;else var i=this.nonTokenRe;var r=t;if(r>0){do r--;while(r>=0&&o.charAt(r).match(i));r++}for(var s=t;s<o.length&&o.charAt(s).match(i);)s++;return new a(e,r,e,s)},this.getAWordRange=function(e,t){for(var o=this.getWordRange(e,t),n=this.getLine(o.end.row);n.charAt(o.end.column).match(/[ \t]/);)o.end.column+=1;return o},this.setNewLineMode=function(e){this.doc.setNewLineMode(e)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.setUseWorker=function(e){this.setOption("useWorker",e)},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._emit("tokenizerUpdate",e)},this.$modes={},this.$mode=null,this.$modeId=null,this.setMode=function(e,t){if(e&&"object"==typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var o=e,n=o.path}else n=e||"ace/mode/text";return this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new l),this.$modes[n]&&!o?(this.$onChangeMode(this.$modes[n]),t&&t(),void 0):(this.$modeId=n,i.loadModule(["mode",n],function(e){return this.$modeId!==n?t&&t():this.$modes[n]&&!o?this.$onChangeMode(this.$modes[n]):(e&&e.Mode&&(e=new e.Mode(o),o||(this.$modes[n]=e,e.$id=n),this.$onChangeMode(e),t&&t()),void 0)}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0),void 0)},this.$onChangeMode=function(e,t){if(t||(this.$modeId=e.$id),this.$mode!==e){this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var o=e.getTokenizer();if(void 0!==o.addEventListener){var n=this.onReloadTokenizer.bind(this);o.addEventListener("update",n)}if(this.bgTokenizer)this.bgTokenizer.setTokenizer(o);else{this.bgTokenizer=new u(o);var i=this;this.bgTokenizer.addEventListener("update",function(e){i._emit("tokenizerUpdate",e)})}this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,this.$options.wrapMethod.set.call(this,this.$wrapMethod),t||(this.$setFolding(e.foldingRules),this._emit("changeMode"),this.bgTokenizer.start(0))}},this.$stopWorker=function(){this.$worker&&this.$worker.terminate(),this.$worker=null},this.$startWorker=function(){if("undefined"==typeof Worker||e.noWorker)this.$worker=null;else try{this.$worker=this.$mode.createWorker(this)}catch(t){console.log("Could not load worker"),console.log(t),this.$worker=null}},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.screenWidth},this.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var t=this.doc.getAllLines(),o=this.$rowLengthCache,n=0,i=0,r=this.$foldData[i],s=r?r.start.row:1/0,l=t.length,a=0;l>a;a++){if(a>s){if(a=r.end.row+1,a>=l)break;r=this.$foldData[i++],s=r?r.start.row:1/0}null==o[a]&&(o[a]=this.$getStringScreenWidth(t[a])[0]),o[a]>n&&(n=o[a])}this.screenWidth=n}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.undoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var o=null,n=e.length-1;-1!=n;n--){var i=e[n];"doc"==i.group?(this.doc.revertDeltas(i.deltas),o=this.$getUndoSelection(i.deltas,!0,o)):i.deltas.forEach(function(e){this.addFolds(e.folds)},this)}return this.$fromUndo=!1,o&&this.$undoSelect&&!t&&this.selection.setSelectionRange(o),o}},this.redoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var o=null,n=0;n<e.length;n++){var i=e[n];"doc"==i.group&&(this.doc.applyDeltas(i.deltas),o=this.$getUndoSelection(i.deltas,!1,o))}return this.$fromUndo=!1,o&&this.$undoSelect&&!t&&this.selection.setSelectionRange(o),o}},this.setUndoSelect=function(e){this.$undoSelect=e},this.$getUndoSelection=function(e,t,o){function n(e){var o="insertText"===e.action||"insertLines"===e.action;return t?!o:o}var i,r,s=e[0],l=!1;n(s)?(i=a.fromPoints(s.range.start,s.range.end),l=!0):(i=a.fromPoints(s.range.start,s.range.start),l=!1);for(var c=1;c<e.length;c++)s=e[c],n(s)?(r=s.range.start,-1==i.compare(r.row,r.column)&&i.setStart(s.range.start),r=s.range.end,1==i.compare(r.row,r.column)&&i.setEnd(s.range.end),l=!0):(r=s.range.start,-1==i.compare(r.row,r.column)&&(i=a.fromPoints(s.range.start,s.range.start)),l=!1);if(null!=o){0==a.comparePoints(o.start,i.start)&&(o.start.column+=i.end.column-i.start.column,o.end.column+=i.end.column-i.start.column);var u=o.compareRange(i);1==u?i.setStart(o.start):-1==u&&i.setEnd(o.end)}return i},this.replace=function(e,t){return this.doc.replace(e,t)},this.moveText=function(e,t,o){var n=this.getTextRange(e),i=this.getFoldsInRange(e),r=a.fromPoints(t,t);if(!o){this.remove(e);var s=e.start.row-e.end.row,l=s?-e.end.column:e.start.column-e.end.column;l&&(r.start.row==e.end.row&&r.start.column>e.end.column&&(r.start.column+=l),r.end.row==e.end.row&&r.end.column>e.end.column&&(r.end.column+=l)),s&&r.start.row>=e.end.row&&(r.start.row+=s,r.end.row+=s)}if(r.end=this.insert(r.start,n),i.length){var c=e.start,u=r.start,s=u.row-c.row,l=u.column-c.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==c.row&&(e.start.column+=l),e.end.row==c.row&&(e.end.column+=l),e.start.row+=s,e.end.row+=s,e}))}return r},this.indentRows=function(e,t,o){o=o.replace(/\t/g,this.getTabString());for(var n=e;t>=n;n++)this.insert({row:n,column:0},o)},this.outdentRows=function(e){for(var t=e.collapseRows(),o=new a(0,0,0,0),n=this.getTabSize(),i=t.start.row;i<=t.end.row;++i){var r=this.getLine(i);o.start.row=i,o.end.row=i;for(var s=0;n>s&&" "==r.charAt(s);++s);n>s&&" "==r.charAt(s)?(o.start.column=s,o.end.column=s+1):(o.start.column=0,o.end.column=s),this.remove(o)}},this.$moveLines=function(e,t,o){if(e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t),0>o){var n=this.getRowFoldStart(e+o);if(0>n)return 0;var i=n-e}else if(o>0){var n=this.getRowFoldEnd(t+o);if(n>this.doc.getLength()-1)return 0;var i=n-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var r=new a(e,0,t,Number.MAX_VALUE),s=this.getFoldsInRange(r).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),l=0==o?this.doc.getLines(e,t):this.doc.removeLines(e,t);return this.doc.insertLines(e+i,l),s.length&&this.addFolds(s),i},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return 0>t?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){if(t=Math.max(0,t),0>e)e=0,t=0;else{var o=this.doc.getLength();e>=o?(e=o-1,t=this.doc.getLine(o-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var t=this.getLength();this.$wrapData=[];for(var o=0;t>o;o++)this.$wrapData.push([]);this.$updateWrapData(0,t-1)}this._emit("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)&&(this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this._emit("changeWrapMode"))},this.adjustWrapLimit=function(e,t){var o=this.$wrapLimitRange;o.max<0&&(o={min:t,max:t});var n=this.$constrainWrapLimit(e,o.min,o.max);return n!=this.$wrapLimit&&n>1?(this.$wrapLimit=n,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._emit("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,o){return t&&(e=Math.max(t,e)),o&&(e=Math.min(o,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t,o=this.$useWrapMode,n=e.data.action,i=e.data.range.start.row,r=e.data.range.end.row,s=e.data.range.start,l=e.data.range.end,a=null;if(-1!=n.indexOf("Lines")?(r="insertLines"==n?i+e.data.lines.length:i,t=e.data.lines?e.data.lines.length:r-i):t=r-i,this.$updating=!0,0!=t)if(-1!=n.indexOf("remove")){this[o?"$wrapData":"$rowLengthCache"].splice(i,t);var c=this.$foldData;a=this.getFoldsInRange(e.data.range),this.removeFolds(a);var u=this.getFoldLine(l.row),g=0;if(u){u.addRemoveChars(l.row,l.column,s.column-l.column),u.shiftRow(-t);var h=this.getFoldLine(i);h&&h!==u&&(h.merge(u),u=h),g=c.indexOf(u)+1}for(g;g<c.length;g++){var u=c[g];u.start.row>=l.row&&u.shiftRow(-t)}r=i}else{var d;if(o){d=[i,0];for(var p=0;t>p;p++)d.push([]);this.$wrapData.splice.apply(this.$wrapData,d)}else d=Array(t),d.unshift(i,0),this.$rowLengthCache.splice.apply(this.$rowLengthCache,d);var c=this.$foldData,u=this.getFoldLine(i),g=0;if(u){var f=u.range.compareInside(s.row,s.column);0==f?(u=u.split(s.row,s.column),u.shiftRow(t),u.addRemoveChars(r,0,l.column-s.column)):-1==f&&(u.addRemoveChars(i,0,l.column-s.column),u.shiftRow(t)),g=c.indexOf(u)+1}for(g;g<c.length;g++){var u=c[g];u.start.row>=i&&u.shiftRow(t)}}else{t=Math.abs(e.data.range.start.column-e.data.range.end.column),-1!=n.indexOf("remove")&&(a=this.getFoldsInRange(e.data.range),this.removeFolds(a),t=-t);var u=this.getFoldLine(i);u&&u.addRemoveChars(i,s.column,t)}return o&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,o?this.$updateWrapData(i,r):this.$updateRowLengthCache(i,r),a},this.$updateRowLengthCache=function(e,t){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var o,n,i=this.doc.getAllLines(),r=this.getTabSize(),s=this.$wrapData,l=this.$wrapLimit,a=e;for(t=Math.min(t,i.length-1);t>=a;)n=this.getFoldLine(a,n),n?(o=[],n.walk(function(e,t,n,r){var s;if(null!=e){s=this.$getDisplayTokens(e,o.length),s[0]=h;for(var l=1;l<s.length;l++)s[l]=d}else s=this.$getDisplayTokens(i[t].substring(r,n),o.length);o=o.concat(s)}.bind(this),n.end.row,i[n.end.row].length+1),s[n.start.row]=this.$computeWrapSplits(o,l,r),a=n.end.row+1):(o=this.$getDisplayTokens(i[a]),s[a]=this.$computeWrapSplits(o,l,r),a++)};var s=1,c=2,h=3,d=4,p=9,f=10,m=11,y=12;this.$computeWrapSplits=function(e,t){function o(t){var o=e.slice(r,t),i=o.length;o.join("").replace(/12/g,function(){i-=1}).replace(/2/g,function(){i-=1}),s+=i,n.push(s),r=t}if(0==e.length)return[];for(var n=[],i=e.length,r=0,s=0,l=this.$wrapAsCode;i-r>t;){var a=r+t;if(e[a-1]>=f&&e[a]>=f)o(a);else if(e[a]!=h&&e[a]!=d){for(var c=Math.max(a-(l?10:t-(t>>2)),r-1);a>c&&e[a]<h;)a--;if(l){for(;a>c&&e[a]<h;)a--;for(;a>c&&e[a]==p;)a--}else for(;a>c&&e[a]<f;)a--;a>c?o(++a):(a=r+t,o(a))}else{for(a;a!=r-1&&e[a]!=h;a--);if(a>r){o(a);continue}for(a=r+t;a<e.length&&e[a]==d;a++);if(a==e.length)break;o(a)}}return n},this.$getDisplayTokens=function(e,o){var n,i=[];o=o||0;for(var r=0;r<e.length;r++){var l=e.charCodeAt(r);if(9==l){n=this.getScreenTabSize(i.length+o),i.push(m);for(var a=1;n>a;a++)i.push(y)}else 32==l?i.push(f):l>39&&48>l||l>57&&64>l?i.push(p):l>=4352&&t(l)?i.push(s,c):i.push(s)}return i},this.$getStringScreenWidth=function(e,o,n){if(0==o)return[0,0];null==o&&(o=1/0),n=n||0;var i,r;for(r=0;r<e.length&&(i=e.charCodeAt(r),n+=9==i?this.getScreenTabSize(n):i>=4352&&t(i)?2:1,!(n>o));r++);return[n,r]},this.getRowLength=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},this.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){var o=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(o)},this.getDocumentLastRowColumnPosition=function(e,t){var o=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(o,Number.MAX_VALUE/10)},this.getRowSplitData=function(e){return this.$useWrapMode?this.$wrapData[e]:void 0},this.getScreenTabSize=function(e){return this.$tabSize-e%this.$tabSize},this.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},this.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},this.screenToDocumentPosition=function(e,t){if(0>e)return{row:0,column:0};var o,n,i=0,r=0,s=0,l=0,a=this.$screenRowCache,c=this.$getRowCacheIndex(a,e),u=a.length;if(u&&c>=0)var s=a[c],i=this.$docRowCache[c],g=e>a[u-1];else var g=!u;for(var h=this.getLength()-1,d=this.getNextFoldLine(i),p=d?d.start.row:1/0;e>=s&&(l=this.getRowLength(i),!(s+l-1>=e||i>=h));)s+=l,i++,i>p&&(i=d.end.row+1,d=this.getNextFoldLine(i,d),p=d?d.start.row:1/0),g&&(this.$docRowCache.push(i),this.$screenRowCache.push(s));if(d&&d.start.row<=i)o=this.getFoldDisplayLine(d),i=d.start.row;else{if(e>=s+l||i>h)return{row:h,column:this.getLine(h).length};o=this.getLine(i),d=null}if(this.$useWrapMode){var f=this.$wrapData[i];f&&(n=f[e-s],e>s&&f.length&&(r=f[e-s-1]||f[f.length-1],o=o.substring(r)))}return r+=this.$getStringScreenWidth(o,t)[1],this.$useWrapMode&&r>=n&&(r=n-1),d?d.idxToPosition(r):{row:i,column:r}},this.documentToScreenPosition=function(e,t){if("undefined"==typeof t)var o=this.$clipPositionToDocument(e.row,e.column);else o=this.$clipPositionToDocument(e,t);e=o.row,t=o.column;var n=0,i=null,r=null;r=this.getFoldAt(e,t,1),r&&(e=r.start.row,t=r.start.column);var s,l=0,a=this.$docRowCache,c=this.$getRowCacheIndex(a,e),u=a.length;if(u&&c>=0)var l=a[c],n=this.$screenRowCache[c],g=e>a[u-1];else var g=!u;for(var h=this.getNextFoldLine(l),d=h?h.start.row:1/0;e>l;){if(l>=d){if(s=h.end.row+1,s>e)break;h=this.getNextFoldLine(s,h),d=h?h.start.row:1/0}else s=l+1;n+=this.getRowLength(l),l=s,g&&(this.$docRowCache.push(l),this.$screenRowCache.push(n))}var p="";if(h&&l>=d?(p=this.getFoldDisplayLine(h,e,t),i=h.start.row):(p=this.getLine(e).substring(0,t),i=e),this.$useWrapMode){for(var f=this.$wrapData[i],m=0;p.length>=f[m];)n++,m++;p=p.substring(f[m-1]||0,p.length)}return{row:n,column:this.$getStringScreenWidth(p)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(this.$useWrapMode)for(var o=this.$wrapData.length,n=0,i=0,t=this.$foldData[i++],r=t?t.start.row:1/0;o>n;)e+=this.$wrapData[n].length+1,n++,n>r&&(n=t.end.row+1,t=this.$foldData[i++],r=t?t.start.row:1/0);else{e=this.getLength();for(var s=this.$foldData,i=0;i<s.length;i++)t=s[i],e-=t.end.row-t.start.row}return e}}).call(h.prototype),e("./edit_session/folding").Folding.call(h.prototype),e("./edit_session/bracket_match").BracketMatch.call(h.prototype),i.defineOptions(h.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e){if(e){var t="number"==typeof e?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1);this.$wrap=e}},get:function(){return this.getUseWrapMode()?this.getWrapLimitRange().min||"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){this.$wrapAsCode="auto"==e?"text"!=this.$mode.type:"text"!=e},initialValue:"auto"},firstLineNumber:{set:function(){this._emit("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){isNaN(e)||this.$tabSize===e||(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._emit("changeTabSize"))},initialValue:4,handlesSet:!0},overwrite:{set:function(){this._emit("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0}}),t.EditSession=h}),define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t){var o=e("./lib/oop"),n=e("./lib/lang"),i=e("./lib/event_emitter").EventEmitter,r=e("./range").Range,s=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.lead=this.selectionLead=this.doc.createAnchor(0,0),this.anchor=this.selectionAnchor=this.doc.createAnchor(0,0);var t=this;this.lead.on("change",function(e){t._emit("changeCursor"),t.$isEmpty||t._emit("changeSelection"),!t.$keepDesiredColumnOnChange&&e.old.column!=e.value.column&&(t.$desiredColumn=null)}),this.selectionAnchor.on("change",function(){t.$isEmpty||t._emit("changeSelection")})};(function(){o.implement(this,i),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return this.isEmpty()?!1:this.getRange().isMultiLine()},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.anchor.setPosition(e,t),this.$isEmpty&&(this.$isEmpty=!1,this._emit("changeSelection"))},this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.shiftSelection=function(e){if(this.$isEmpty)return this.moveCursorTo(this.lead.row,this.lead.column+e),void 0;var t=this.getSelectionAnchor(),o=this.getSelectionLead(),n=this.isBackwards();(!n||0!==t.column)&&this.setSelectionAnchor(t.row,t.column+e),(n||0!==o.column)&&this.$moveSelection(function(){this.moveCursorTo(o.row,o.column+e)})},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.isEmpty()?r.fromPoints(t,t):this.isBackwards()?r.fromPoints(t,e):r.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){var e=this.doc.getLength()-1;this.setSelectionAnchor(0,0),this.moveCursorTo(e,this.doc.getLine(e).length)},this.setRange=this.setSelectionRange=function(e,t){t?(this.setSelectionAnchor(e.end.row,e.end.column),this.selectTo(e.start.row,e.start.column)):(this.setSelectionAnchor(e.start.row,e.start.column),this.selectTo(e.end.row,e.end.column)),this.getRange().isEmpty()&&(this.$isEmpty=!0),this.$desiredColumn=null},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if("undefined"==typeof t){var o=e||this.lead;e=o.row,t=o.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var o,n="number"==typeof e?e:this.lead.row,i=this.session.getFoldLine(n);
9
- return i?(n=i.start.row,o=i.end.row):o=n,t===!0?new r(n,0,o,this.session.getLine(o).length):new r(n,0,o+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.moveCursorLeft=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0==t.column)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var o=this.session.getTabSize();this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(t.column-o,t.column).split(" ").length-1==o?this.moveCursorBy(0,-o):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var o=this.session.getTabSize(),t=this.lead;this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(t.column,t.column+o).split(" ").length-1==o?this.moveCursorBy(0,o):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,o=this.session.documentToScreenRow(e,t),n=this.session.screenToDocumentPosition(o,0),i=this.session.getDisplayLine(e,null,n.row,n.column),r=i.match(/^\s*/);r[0].length!=t&&!this.session.$useEmacsStyleLineStart&&(n.column+=r[0].length),this.moveCursorToPosition(n)},this.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var o=this.session.getLine(t.row);if(t.column==o.length){var n=o.search(/\s+$/);n>0&&(t.column=n)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e,t=this.lead.row,o=this.lead.column,n=this.doc.getLine(t),i=n.substring(o);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var r=this.session.getFoldAt(t,o,1);return r?(this.moveCursorTo(r.end.row,r.end.column),void 0):((e=this.session.nonTokenRe.exec(i))&&(o+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,i=n.substring(o)),o>=n.length?(this.moveCursorTo(t,n.length),this.moveCursorRight(),t<this.doc.getLength()-1&&this.moveCursorWordRight(),void 0):((e=this.session.tokenRe.exec(i))&&(o+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,o),void 0))},this.moveCursorLongWordLeft=function(){var e,t=this.lead.row,o=this.lead.column;if(e=this.session.getFoldAt(t,o,-1))return this.moveCursorTo(e.start.row,e.start.column),void 0;var i=this.session.getFoldStringAt(t,o,-1);null==i&&(i=this.doc.getLine(t).substring(0,o));var r,s=n.stringReverse(i);return this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,(r=this.session.nonTokenRe.exec(s))&&(o-=this.session.nonTokenRe.lastIndex,s=s.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),0>=o?(this.moveCursorTo(t,0),this.moveCursorLeft(),t>0&&this.moveCursorWordLeft(),void 0):((r=this.session.tokenRe.exec(s))&&(o-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,o),void 0)},this.$shortWordEndIndex=function(e){var t,o,n=0,i=/\s/,r=this.session.tokenRe;if(r.lastIndex=0,t=this.session.tokenRe.exec(e))n=this.session.tokenRe.lastIndex;else{for(;(o=e[n])&&i.test(o);)n++;if(1>n)for(r.lastIndex=0;(o=e[n])&&!r.test(o);)if(r.lastIndex=0,n++,i.test(o)){if(n>2){n--;break}for(;(o=e[n])&&i.test(o);)n++;if(n>2)break}}return r.lastIndex=0,n},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,o=this.doc.getLine(e),n=o.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==o.length){var r=this.doc.getLength();do e++,n=this.doc.getLine(e);while(r>e&&/^\s*$/.test(n));/^\s+/.test(n)||(n=""),t=0}var s=this.$shortWordEndIndex(n);this.moveCursorTo(e,t+s)},this.moveCursorShortWordLeft=function(){var e,t=this.lead.row,o=this.lead.column;if(e=this.session.getFoldAt(t,o,-1))return this.moveCursorTo(e.start.row,e.start.column);var i=this.session.getLine(t).substring(0,o);if(0==o){do t--,i=this.doc.getLine(t);while(t>0&&/^\s*$/.test(i));o=i.length,/\s+$/.test(i)||(i="")}var r=n.stringReverse(i),s=this.$shortWordEndIndex(r);return this.moveCursorTo(t,o-s)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var o=this.session.documentToScreenPosition(this.lead.row,this.lead.column);0===t&&(this.$desiredColumn?o.column=this.$desiredColumn:this.$desiredColumn=o.column);var n=this.session.screenToDocumentPosition(o.row+e,o.column);this.moveCursorTo(n.row,n.column+t,0===t)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,o){var n=this.session.getFoldAt(e,t,1);n&&(e=n.start.row,t=n.start.column),this.$keepDesiredColumnOnChange=!0,this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,o||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,o){var n=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(n.row,n.column,o)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(void 0==e.start){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var o=r.fromPoints(e[t].start,e[t].end);e.isBackwards&&(o.cursor=o.start),this.addRange(o,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(s.prototype),t.Selection=s}),define("ace/range",["require","exports","module"],function(e,t){var o=function(e,t){return e.row-t.row||e.column-t.column},n=function(e,t,o,n){this.start={row:e,column:t},this.end={row:o,column:n}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return 0==this.compare(e,t)},this.compareRange=function(e){var t,o=e.end,n=e.start;return t=this.compare(o.row,o.column),1==t?(t=this.compare(n.row,n.column),1==t?2:0==t?1:0):-1==t?-2:(t=this.compare(n.row,n.column),-1==t?-1:1==t?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},this.intersects=function(e){var t=this.compareRange(e);return-1==t||0==t||1==t},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return 0==this.compare(e,t)?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return 0==this.compare(e,t)?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return 0==this.compare(e,t)?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0:t<this.start.column?-1:t>this.end.column?1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var o={row:t+1,column:0};else if(this.end.row<e)var o={row:e,column:0};if(this.start.row>t)var i={row:t+1,column:0};else if(this.start.row<e)var i={row:e,column:0};return n.fromPoints(i||this.start,o||this.end)},this.extend=function(e,t){var o=this.compare(e,t);if(0==o)return this;if(-1==o)var i={row:e,column:t};else var r={row:e,column:t};return n.fromPoints(i||this.start,r||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return n.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new n(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new n(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),o=e.documentToScreenPosition(this.end);return new n(t.row,t.column,o.row,o.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(n.prototype),n.fromPoints=function(e,t){return new n(e.row,e.column,t.row,t.column)},n.comparePoints=o,n.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=n}),define("ace/mode/text",["require","exports","module","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,t){var o=e("../tokenizer").Tokenizer,n=e("./text_highlight_rules").TextHighlightRules,i=e("./behaviour").Behaviour,r=e("../unicode"),s=e("../lib/lang"),l=e("../token_iterator").TokenIterator,a=e("../range").Range,c=function(){this.HighlightRules=n,this.$behaviour=new i};(function(){this.tokenRe=new RegExp("^["+r.packages.L+r.packages.Mn+r.packages.Mc+r.packages.Nd+r.packages.Pc+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+r.packages.L+r.packages.Mn+r.packages.Mc+r.packages.Nd+r.packages.Pc+"\\$_]|s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=new this.HighlightRules,this.$tokenizer=new o(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,o,n){function i(e){for(var t=o;n>=t;t++)e(r.getLine(t),t)}var r=t.doc,l=!0,a=!0,c=1/0,u=t.getTabSize(),g=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var h=this.lineCommentStart.map(s.escapeRegExp).join("|"),d=this.lineCommentStart[0];else var h=s.escapeRegExp(this.lineCommentStart),d=this.lineCommentStart;h=new RegExp("^(\\s*)(?:"+h+") ?"),g=t.getUseSoftTabs();var p=function(e,t){var o=e.match(h);if(o){var n=o[1].length,i=o[0].length;!_(e,n,i)&&" "==o[0][i-1]&&i--,r.removeInLine(t,n,i)}},f=d+" ",m=function(e,t){(!l||/\S/.test(e))&&(_(e,c,c)?r.insertInLine({row:t,column:c},f):r.insertInLine({row:t,column:c},d))},y=function(e){return h.test(e)},_=function(e,t,o){for(var n=0;t--&&" "==e.charAt(t);)n++;if(n%u!=0)return!1;for(var n=0;" "==e.charAt(o++);)n++;return u>2?n%u!=u-1:n%u==0}}else{if(!this.blockComment)return!1;var d=this.blockComment.start,v=this.blockComment.end,h=new RegExp("^(\\s*)(?:"+s.escapeRegExp(d)+")"),E=new RegExp("(?:"+s.escapeRegExp(v)+")\\s*$"),m=function(e,t){y(e,t)||(!l||/\S/.test(e))&&(r.insertInLine({row:t,column:e.length},v),r.insertInLine({row:t,column:c},d))},p=function(e,t){var o;(o=e.match(E))&&r.removeInLine(t,e.length-o[0].length,e.length),(o=e.match(h))&&r.removeInLine(t,o[1].length,o[0].length)},y=function(e,o){if(h.test(e))return!0;for(var n=t.getTokens(o),i=0;i<n.length;i++)if("comment"===n[i].type)return!0}}var B=1/0;i(function(e,t){var o=e.search(/\S/);-1!==o?(c>o&&(c=o),a&&!y(e,t)&&(a=!1)):B>e.length&&(B=e.length)}),1/0==c&&(c=B,l=!1,a=!1),g&&c%u!=0&&(c=Math.floor(c/u)*u),i(a?p:m)},this.toggleBlockComment=function(e,t,o,n){var i=this.blockComment;if(i){!i.start&&i[0]&&(i=i[0]);var r,s,c=new l(t,n.row,n.column),u=c.getCurrentToken(),g=(t.selection,t.selection.toOrientedRange());if(u&&/comment/.test(u.type)){for(var h,d;u&&/comment/.test(u.type);){var p=u.value.indexOf(i.start);if(-1!=p){var f=c.getCurrentTokenRow(),m=c.getCurrentTokenColumn()+p;h=new a(f,m,f,m+i.start.length);break}u=c.stepBackward()}for(var c=new l(t,n.row,n.column),u=c.getCurrentToken();u&&/comment/.test(u.type);){var p=u.value.indexOf(i.end);if(-1!=p){var f=c.getCurrentTokenRow(),m=c.getCurrentTokenColumn()+p;d=new a(f,m,f,m+i.end.length);break}u=c.stepForward()}d&&t.remove(d),h&&(t.remove(h),r=h.start.row,s=-i.start.length)}else s=i.start.length,r=o.start.row,t.insert(o.end,i.end),t.insert(o.start,i.start);g.start.row==r&&(g.start.column+=s),g.end.row==r&&(g.end.column+=s),t.selection.fromOrientedRange(g)}},this.getNextLineIndent=function(e,t){return this.$getIndent(t)},this.checkOutdent=function(){return!1},this.autoOutdent=function(){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)e[t]&&(this.$embeds.push(t),this.$modes[t]=new e[t]);for(var o=["toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],t=0;t<o.length;t++)(function(e){var n=o[t],i=e[n];e[o[t]]=function(){return this.$delegator(n,arguments,i)}})(this)},this.$delegator=function(e,t,o){var n=t[0];"string"!=typeof n&&(n=n[0]);for(var i=0;i<this.$embeds.length;i++)if(this.$modes[this.$embeds[i]]){var r=n.split(this.$embeds[i]);if(!r[0]&&r[1]){t[0]=r[1];var s=this.$modes[this.$embeds[i]];return s[e].apply(s,t)}}var l=o.apply(this,t);return o?l:void 0},this.transformAction=function(e,t){if(this.$behaviour){var o=this.$behaviour.getBehaviours();for(var n in o)if(o[n][t]){var i=o[n][t].apply(this,arguments);if(i)return i}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,o=[];for(var n in t)for(var i=t[n],r=0,s=i.length;s>r;r++)if("string"==typeof i[r].token)/keyword|support|storage/.test(i[r].token)&&o.push(i[r].regex);else if("object"==typeof i[r].token)for(var l=0,a=i[r].token.length;a>l;l++)if(/keyword|support|storage/.test(i[r].token[l])){var n=i[r].regex.match(/\(.+?\)/g)[l];o.push(n.substr(1,n.length-2))}this.completionKeywords=o}return e?o.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(){var e=this.$keywordList||this.$createKeywordList();return e.map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})}}).call(c.prototype),t.Mode=c}),define("ace/tokenizer",["require","exports","module"],function(e,t){var o=1e3,n=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){for(var o=this.states[t],n=[],i=0,r=this.matchMappings[t]={defaultToken:"text"},s="g",l=[],a=0;a<o.length;a++){var c=o[a];if(c.defaultToken&&(r.defaultToken=c.defaultToken),c.caseInsensitive&&(s="gi"),null!=c.regex){c.regex instanceof RegExp&&(c.regex=c.regex.toString().slice(1,-1));var u=c.regex,g=new RegExp("(?:("+u+")|(.))").exec("a").length-2;if(Array.isArray(c.token))if(1==c.token.length||1==g)c.token=c.token[0];else{if(g-1!=c.token.length)throw new Error("number of classes and regexp groups in '"+c.token+"'\n'"+c.regex+"' doesn't match\n"+(g-1)+"!="+c.token.length);c.tokenArray=c.token,c.token=null,c.onMatch=this.$arrayTokens}else"function"==typeof c.token&&!c.onMatch&&(c.onMatch=g>1?this.$applyToken:c.token);g>1&&(/\\\d/.test(c.regex)?u=c.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+i+1)}):(g=1,u=this.removeCapturingGroups(c.regex)),!c.splitRegex&&"string"!=typeof c.token&&l.push(c)),r[i]=a,i+=g,n.push(u),c.onMatch||(c.onMatch=null),c.__proto__=null}}l.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,s)},this),this.regExps[t]=new RegExp("("+n.join(")|(")+")|($)",s)}};(function(){this.$setMaxTokenCount=function(e){o=0|e},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),o=this.token.apply(this,t);if("string"==typeof o)return[{type:o,value:e}];for(var n=[],i=0,r=o.length;r>i;i++)t[i]&&(n[n.length]={type:o[i],value:t[i]});return n},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";for(var o=[],n=this.tokenArray,i=0,r=n.length;r>i;i++)t[i+1]&&(o[o.length]={type:n[i],value:t[i+1]});return o},this.removeCapturingGroups=function(e){var t=e.replace(/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,function(e,t){return t?"(?:":e});return t},this.createSplitterRegexp=function(e,t){if(-1!=e.indexOf("(?=")){var o=0,n=!1,i={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,r,s,l,a){return n?n="]"!=l:l?n=!0:s?(o==i.stack&&(i.end=a+1,i.stack=-1),o--):r&&(o++,1!=r.length&&(i.stack=o,i.start=a)),e}),null!=i.end&&/^\)*$/.test(e.substr(i.end))&&(e=e.substring(0,i.start)+e.substr(i.end))}return new RegExp(e,(t||"").replace("g",""))},this.getLineTokens=function(e,t){if(t&&"string"!=typeof t){var n=t.slice(0);t=n[0]}else var n=[];var i=t||"start",r=this.states[i],s=this.matchMappings[i],l=this.regExps[i];l.lastIndex=0;for(var a,c=[],u=0,g={type:null,value:""};a=l.exec(e);){var h=s.defaultToken,d=null,p=a[0],f=l.lastIndex;if(f-p.length>u){var m=e.substring(u,f-p.length);g.type==h?g.value+=m:(g.type&&c.push(g),g={type:h,value:m})}for(var y=0;y<a.length-2;y++)if(void 0!==a[y+1]){d=r[s[y]],h=d.onMatch?d.onMatch(p,i,n):d.token,d.next&&(i="string"==typeof d.next?d.next:d.next(i,n),r=this.states[i],r||(window.console&&console.error&&console.error(i,"doesn't exist"),i="start",r=this.states[i]),s=this.matchMappings[i],u=f,l=this.regExps[i],l.lastIndex=f);break}if(p)if("string"==typeof h)d&&d.merge===!1||g.type!==h?(g.type&&c.push(g),g={type:h,value:p}):g.value+=p;else if(h){g.type&&c.push(g),g={type:null,value:""};for(var y=0;y<h.length;y++)c.push(h[y])}if(u==e.length)break;if(u=f,c.length>o){for(;u<e.length;)g.type&&c.push(g),g={value:e.substring(u,u+=2e3),type:"overflow"};i="start",n=[];break}}return g.type&&c.push(g),{tokens:c,state:n.length?n:i}}}).call(n.prototype),t.Tokenizer=n}),define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t){var o=e("../lib/lang"),n=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(t)for(var o in e){for(var n=e[o],i=0;i<n.length;i++){var r=n[i];r.next&&("string"!=typeof r.next?r.nextState&&0!==r.nextState.indexOf(t)&&(r.nextState=t+r.nextState):0!==r.next.indexOf(t)&&(r.next=t+r.next))}this.$rules[t+o]=n}else for(var o in e)this.$rules[o]=e[o]},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,n,i,r){var s=(new e).getRules();if(i)for(var l=0;l<i.length;l++)i[l]=t+i[l];else{i=[];for(var a in s)i.push(t+a)}if(this.addRules(s,t),n)for(var c=Array.prototype[r?"push":"unshift"],l=0;l<i.length;l++)c.apply(this.$rules[i[l]],o.deepCopy(n));this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return"start"!=e&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t[0]!==e?"start":(t.shift(),t.shift())};this.normalizeRules=function(){function o(r){var s=i[r];s.processed=!0;for(var l=0;l<s.length;l++){var a=s[l];!a.regex&&a.start&&(a.regex=a.start,a.next||(a.next=[]),a.next.push({defaultToken:a.token},{token:a.token+".end",regex:a.end||a.start,next:"pop"}),a.token=a.token+".start",a.push=!0);var c=a.next||a.push;if(c&&Array.isArray(c)){var u=a.stateName;u||(u=a.token,"string"!=typeof u&&(u=u[0]||""),i[u]&&(u+=n++)),i[u]=c,a.next=u,o(u)}else"pop"==c&&(a.next=t);if(a.push&&(a.nextState=a.next||a.push,a.next=e,delete a.push),a.rules)for(var g in a.rules)i[g]?i[g].push&&i[g].push.apply(i[g],a.rules[g]):i[g]=a.rules[g];if(a.include||"string"==typeof a)var h=a.include||a,d=i[h];else Array.isArray(a)&&(d=a);if(d){var p=[l,1].concat(d);a.noEscape&&(p=p.filter(function(e){return!e.next})),s.splice.apply(s,p),l--,d=null}a.keywordMap&&(a.token=this.createKeywordMapper(a.keywordMap,a.defaultToken||"text",a.caseInsensitive),delete a.defaultToken)}}var n=0,i=this.$rules;Object.keys(i).forEach(o,this)},this.createKeywordMapper=function(e,t,o,n){var i=Object.create(null);return Object.keys(e).forEach(function(t){var r=e[t];o&&(r=r.toLowerCase());for(var s=r.split(n||"|"),l=s.length;l--;)i[s[l]]=t}),Object.getPrototypeOf(i)&&(i.__proto__=null),this.$keywordList=Object.keys(i),e=null,o?function(e){return i[e.toLowerCase()]||t}:function(e){return i[e]||t}},this.getKeywords=function(){return this.$keywords}}).call(n.prototype),t.TextHighlightRules=n}),define("ace/mode/behaviour",["require","exports","module"],function(e,t){var o=function(){this.$behaviours={}};(function(){this.add=function(e,t,o){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=o},this.addBehaviours=function(e){for(var t in e)for(var o in e[t])this.add(t,o,e[t][o])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if("function"==typeof e)var o=(new e).getBehaviours(t);else var o=e.getBehaviours(t);this.addBehaviours(o)},this.getBehaviours=function(e){if(!e)return this.$behaviours;for(var t={},o=0;o<e.length;o++)this.$behaviours[e[o]]&&(t[e[o]]=this.$behaviours[e[o]]);return t}}).call(o.prototype),t.Behaviour=o}),define("ace/unicode",["require","exports","module"],function(e,t){function o(e){var o=/\w{4}/g;for(var n in e)t.packages[n]=e[n].replace(o,"\\u$&")}t.packages={},o({L:"0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",Ll:"0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",Lu:"0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",Lt:"01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",Lm:"02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",Lo:"01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",M:"0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",Mn:"0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",Mc:"0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",Me:"0488048906DE20DD-20E020E2-20E4A670-A672",N:"0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",Nd:"0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",Nl:"16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",No:"00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",P:"0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",Pd:"002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",Ps:"0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",Pe:"0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",Pi:"00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",Pf:"00BB2019201D203A2E032E052E0A2E0D2E1D2E21",Pc:"005F203F20402054FE33FE34FE4D-FE4FFF3F",Po:"0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",S:"0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",Sm:"002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",Sc:"002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",Sk:"005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",So:"00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",Z:"002000A01680180E2000-200A20282029202F205F3000",Zs:"002000A01680180E2000-200A202F205F3000",Zl:"2028",Zp:"2029",C:"0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",Cc:"0000-001F007F-009F",Cf:"00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",Co:"E000-F8FF",Cs:"D800-DFFF",Cn:"03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"})
10
- }),define("ace/token_iterator",["require","exports","module"],function(e,t){var o=function(e,t,o){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var n=e.getTokenAt(t,o);this.$tokenIndex=n?n.index:-1};(function(){this.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){this.$tokenIndex+=1;for(var e;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,o=e[t].start;if(void 0!==o)return o;for(o=0;t>0;)t-=1,o+=e[t].value.length;return o}}).call(o.prototype),t.TokenIterator=o}),define("ace/document",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t){var o=e("./lib/oop"),n=e("./lib/event_emitter").EventEmitter,i=e("./range").Range,r=e("./anchor").Anchor,s=function(e){this.$lines=[],0==e.length?this.$lines=[""]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){o.implement(this,n),this.setValue=function(e){var t=this.getLength();this.remove(new i(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new r(this,e,t)},this.$split=0=="aaa".split(/a/).length?function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n"},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine}},this.$autoNewLine="\n",this.$newLineMode="auto",this.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e)},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||"").substring(e.start.column);var o=t.length-1;return e.end.row-e.start.row==o&&(t[o]=t[o].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||0===t.length)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var o=this.$split(t),n=o.splice(0,1)[0],i=0==o.length?null:o.splice(o.length-1,1)[0];return e=this.insertInLine(e,n),null!==i&&(e=this.insertNewLine(e),e=this._insertLines(e.row,o),e=this.insertInLine(e,i||"")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},"\n"+t.join("\n")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(0==t.length)return{row:e,column:0};if(t.length>65535){var o=this._insertLines(e,t.slice(65535));t=t.slice(0,65535)}var n=[e,0];n.push.apply(n,t),this.$lines.splice.apply(this.$lines,n);var r=new i(e,0,e+t.length,0),s={action:"insertLines",range:r,lines:t};return this._emit("change",{data:s}),o||r.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||"";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var o={row:e.row+1,column:0},n={action:"insertText",range:i.fromPoints(e,o),text:this.getNewLineCharacter()};return this._emit("change",{data:n}),o},this.insertInLine=function(e,t){if(0==t.length)return e;var o=this.$lines[e.row]||"";this.$lines[e.row]=o.substring(0,e.column)+t+o.substring(e.column);var n={row:e.row,column:e.column+t.length},r={action:"insertText",range:i.fromPoints(e,n),text:t};return this._emit("change",{data:r}),n},this.remove=function(e){if(!e instanceof i&&(e=i.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end),e.isEmpty())return e.start;var t=e.start.row,o=e.end.row;if(e.isMultiLine()){var n=0==e.start.column?t:t+1,r=o-1;e.end.column>0&&this.removeInLine(o,0,e.end.column),r>=n&&this._removeLines(n,r),n!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,o){if(t!=o){var n=new i(e,t,e,o),r=this.getLine(e),s=r.substring(t,o),l=r.substring(0,t)+r.substring(o,r.length);this.$lines.splice(e,1,l);var a={action:"removeText",range:n,text:s};return this._emit("change",{data:a}),n.start}},this.removeLines=function(e,t){return 0>e||t>=this.getLength()?this.remove(new i(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var o=new i(e,0,t+1,0),n=this.$lines.splice(e,t-e+1),r={action:"removeLines",range:o,nl:this.getNewLineCharacter(),lines:n};return this._emit("change",{data:r}),n},this.removeNewLine=function(e){var t=this.getLine(e),o=this.getLine(e+1),n=new i(e,t.length,e+1,0),r=t+o;this.$lines.splice(e,2,r);var s={action:"removeText",range:n,text:this.getNewLineCharacter()};this._emit("change",{data:s})},this.replace=function(e,t){if(!e instanceof i&&(e=i.fromPoints(e.start,e.end)),0==t.length&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;if(this.remove(e),t)var o=this.insert(e.start,t);else o=e.start;return o},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var o=e[t],n=i.fromPoints(o.range.start,o.range.end);"insertLines"==o.action?this.insertLines(n.start.row,o.lines):"insertText"==o.action?this.insert(n.start,o.text):"removeLines"==o.action?this._removeLines(n.start.row,n.end.row-1):"removeText"==o.action&&this.remove(n)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var o=e[t],n=i.fromPoints(o.range.start,o.range.end);"insertLines"==o.action?this._removeLines(n.start.row,n.end.row-1):"insertText"==o.action?this.remove(n):"removeLines"==o.action?this._insertLines(n.start.row,o.lines):"removeText"==o.action&&this.insert(n.start,o.text)}},this.indexToPosition=function(e,t){for(var o=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,i=t||0,r=o.length;r>i;i++)if(e-=o[i].length+n,0>e)return{row:i,column:e+o[i].length+n};return{row:r-1,column:o[r-1].length}},this.positionToIndex=function(e,t){for(var o=this.$lines||this.getAllLines(),n=this.getNewLineCharacter().length,i=0,r=Math.min(e.row,o.length),s=t||0;r>s;++s)i+=o[s].length+n;return i+e.column}}).call(s.prototype),t.Document=s}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t){var o=e("./lib/oop"),n=e("./lib/event_emitter").EventEmitter,i=t.Anchor=function(e,t,o){this.$onChange=this.onChange.bind(this),this.attach(e),"undefined"==typeof o?this.setPosition(t.row,t.column):this.setPosition(t,o)};(function(){o.implement(this,n),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,o=t.range;if((o.start.row!=o.end.row||o.start.row==this.row)&&!(o.start.row>this.row||o.start.row==this.row&&o.start.column>this.column)){var n=this.row,i=this.column,r=o.start,s=o.end;"insertText"===t.action?r.row===n&&r.column<=i?r.column===i&&this.$insertRight||(r.row===s.row?i+=s.column-r.column:(i-=r.column,n+=s.row-r.row)):r.row!==s.row&&r.row<n&&(n+=s.row-r.row):"insertLines"===t.action?r.row<=n&&(n+=s.row-r.row):"removeText"===t.action?r.row===n&&r.column<i?i=s.column>=i?r.column:Math.max(0,i-(s.column-r.column)):r.row!==s.row&&r.row<n?(s.row===n&&(i=Math.max(0,i-s.column)+r.column),n-=s.row-r.row):s.row===n&&(n-=s.row-r.row,i=Math.max(0,i-s.column)+r.column):"removeLines"==t.action&&r.row<=n&&(s.row<=n?n-=s.row-r.row:(n=r.row,i=0)),this.setPosition(n,i,!0)}},this.setPosition=function(e,t,o){var n;if(n=o?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!=n.row||this.column!=n.column){var i={row:this.row,column:this.column};this.row=n.row,this.column=n.column,this._emit("change",{old:i,value:n})}},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var o={};return e>=this.document.getLength()?(o.row=Math.max(0,this.document.getLength()-1),o.column=this.document.getLine(o.row).length):0>e?(o.row=0,o.column=0):(o.row=e,o.column=Math.min(this.document.getLine(o.row).length,Math.max(0,t))),0>t&&(o.column=0),o}}).call(i.prototype)}),define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t){var o=e("./lib/oop"),n=e("./lib/event_emitter").EventEmitter,i=function(e){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var t=this;this.$worker=function(){if(t.running){for(var e=new Date,o=t.currentLine,n=-1,i=t.doc;t.lines[o];)o++;var r=o,s=i.getLength(),l=0;for(t.running=!1;s>o;){t.$tokenizeRow(o),n=o;do o++;while(t.lines[o]);if(l++,l%5==0&&new Date-e>20)return t.running=setTimeout(t.$worker,20),t.currentLine=o,void 0}t.currentLine=o,n>=r&&t.fireUpdateEvent(r,n)}}};(function(){o.implement(this,n),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var o={first:e,last:t};this._emit("update",{data:o})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.range,o=t.start.row,n=t.end.row-o;if(0===n)this.lines[o]=null;else if("removeText"==e.action||"removeLines"==e.action)this.lines.splice(o,n+1,null),this.states.splice(o,n+1,null);else{var i=Array(n+1);i.unshift(o,1),this.lines.splice.apply(this.lines,i),this.states.splice.apply(this.states,i)}this.currentLine=Math.min(o,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),o=this.states[e-1],n=this.tokenizer.getLineTokens(t,o,e);return this.states[e]+""!=n.state+""?(this.states[e]=n.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=n.tokens}}).call(i.prototype),t.BackgroundTokenizer=i}),define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t){var o=e("./lib/lang"),n=(e("./lib/oop"),e("./range").Range),i=function(e,t,o){this.setRegexp(e),this.clazz=t,this.type=o||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},this.update=function(e,t,i,r){if(this.regExp)for(var s=r.firstRow,l=r.lastRow,a=s;l>=a;a++){var c=this.cache[a];null==c&&(c=o.getMatchOffsets(i.getLine(a),this.regExp),c.length>this.MAX_RANGES&&(c=c.slice(0,this.MAX_RANGES)),c=c.map(function(e){return new n(a,e.offset,a,e.offset+e.length)}),this.cache[a]=c.length?c:"");for(var u=c.length;u--;)t.drawSingleLineMarker(e,c[u].toScreenRange(i),this.clazz,r)}}}).call(i.prototype),t.SearchHighlight=i}),define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"],function(e,t){function o(){this.getFoldAt=function(e,t,o){var n=this.getFoldLine(e);if(!n)return null;for(var i=n.folds,r=0;r<i.length;r++){var s=i[r];if(s.range.contains(e,t)){if(1==o&&s.range.isEnd(e,t))continue;if(-1==o&&s.range.isStart(e,t))continue;return s}}},this.getFoldsInRange=function(e){var t=e.start,o=e.end,n=this.$foldData,i=[];t.column+=1,o.column-=1;for(var r=0;r<n.length;r++){var s=n[r].range.compareRange(e);if(2!=s){if(-2==s)break;for(var l=n[r].folds,a=0;a<l.length;a++){var c=l[a];if(s=c.range.compareRange(e),-2==s)break;if(2!=s){if(42==s)break;i.push(c)}}}}return t.column-=1,o.column+=1,i},this.getAllFolds=function(){function e(e){t.push(e)}for(var t=[],o=this.$foldData,n=0;n<o.length;n++)for(var i=0;i<o[n].folds.length;i++)e(o[n].folds[i]);return t},this.getFoldStringAt=function(e,t,o,n){if(n=n||this.getFoldLine(e),!n)return null;for(var i,r,s={end:{column:0}},l=0;l<n.folds.length;l++){r=n.folds[l];var a=r.range.compareEnd(e,t);if(-1==a){i=this.getLine(r.start.row).substring(s.end.column,r.start.column);break}if(0===a)return null;s=r}return i||(i=this.getLine(r.start.row).substring(s.end.column)),-1==o?i.substring(0,t-s.end.column):1==o?i.substring(t-s.end.column):i},this.getFoldLine=function(e,t){var o=this.$foldData,n=0;for(t&&(n=o.indexOf(t)),-1==n&&(n=0),n;n<o.length;n++){var i=o[n];if(i.start.row<=e&&i.end.row>=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var o=this.$foldData,n=0;for(t&&(n=o.indexOf(t)),-1==n&&(n=0),n;n<o.length;n++){var i=o[n];if(i.end.row>=e)return i}return null},this.getFoldedRowCount=function(e,t){for(var o=this.$foldData,n=t-e+1,i=0;i<o.length;i++){var r=o[i],s=r.end.row,l=r.start.row;if(s>=t){t>l&&(l>=e?n-=t-l:n=0);break}s>=e&&(n-=l>=e?s-l:s-e+1)}return n},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var o,n=this.$foldData,s=!1;e instanceof r?o=e:(o=new r(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var l=o.start.row,a=o.start.column,c=o.end.row,u=o.end.column;if(c>l||l==c&&u-2>=a){var g=this.getFoldAt(l,a,1),h=this.getFoldAt(c,u,-1);if(g&&h==g)return g.addSubFold(o);if(g&&!g.range.isStart(l,a)||h&&!h.range.isEnd(c,u))throw new Error("A fold can't intersect already existing fold"+o.range+g.range);var d=this.getFoldsInRange(o.range);d.length>0&&(this.removeFolds(d),d.forEach(function(e){o.addSubFold(e)}));for(var p=0;p<n.length;p++){var f=n[p];if(c==f.start.row){f.addFold(o),s=!0;break}if(l==f.end.row){if(f.addFold(o),s=!0,!o.sameRow){var m=n[p+1];if(m&&m.start.row==c){f.merge(m);break}}break}if(c<=f.start.row)break}return s||(f=this.$addFoldLine(new i(this.$foldData,o))),this.$useWrapMode?this.$updateWrapData(f.start.row,f.start.row):this.$updateRowLengthCache(f.start.row,f.start.row),this.$modified=!0,this._emit("changeFold",{data:o,action:"add"}),o}throw new Error("The range has to be at least 2 characters width")},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,o=t.start.row,n=t.end.row,i=this.$foldData,r=t.folds;if(1==r.length)i.splice(i.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))r.pop(),t.end.row=r[r.length-1].end.row,t.end.column=r[r.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))r.shift(),t.start.row=r[0].start.row,t.start.column=r[0].start.column;else if(e.sameRow)r.splice(r.indexOf(e),1);else{var s=t.split(e.start.row,e.start.column);r=s.folds,r.shift(),s.start.row=r[0].start.row,s.start.column=r[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(o,n):this.$updateRowLengthCache(o,n)),this.$modified=!0,this._emit("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var t=[],o=0;o<e.length;o++)t.push(e[o]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var o,i;if(null==e?(o=new n(0,0,this.getLength(),0),t=!0):o="number"==typeof e?new n(e,0,e,this.getLine(e).length):"row"in e?n.fromPoints(e,e):e,i=this.getFoldsInRange(o),t)this.removeFolds(i);else for(;i.length;)this.expandFolds(i),i=this.getFoldsInRange(o)},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var o=this.getFoldLine(e,t);return o?o.end.row:e},this.getRowFoldStart=function(e,t){var o=this.getFoldLine(e,t);return o?o.start.row:e},this.getFoldDisplayLine=function(e,t,o,n,i){null==n&&(n=e.start.row,i=0),null==t&&(t=e.end.row,o=this.getLine(t).length);var r=this.doc,s="";return e.walk(function(e,t,o,l){if(!(n>t)){if(t==n){if(i>o)return;l=Math.max(i,l)}s+=null!=e?e:r.getLine(t).substring(l,o)}},t,o),s},this.getDisplayLine=function(e,t,o,n){var i=this.getFoldLine(e);if(!i){var r;return r=this.doc.getLine(e),r.substring(n||0,t||r.length)}return this.getFoldDisplayLine(i,e,t,o,n)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var o=t.folds.map(function(e){return e.clone()});return new i(e,o)})},this.toggleFold=function(e){var t,o,n=this.selection,i=n.getRange();if(i.isEmpty()){var r=i.start;if(t=this.getFoldAt(r.row,r.column))return this.expandFold(t),void 0;(o=this.findMatchingBracket(r))?1==i.comparePoint(o)?i.end=o:(i.start=o,i.start.column++,i.end.column--):(o=this.findMatchingBracket({row:r.row,column:r.column+1}))?(1==i.comparePoint(o)?i.end=o:i.start=o,i.start.column++):i=this.getCommentFoldRange(r.row,r.column)||i}else{var s=this.getFoldsInRange(i);if(e&&s.length)return this.expandFolds(s),void 0;1==s.length&&(t=s[0])}if(t||(t=this.getFoldAt(i.start.row,i.start.column)),t&&t.range.toString()==i.toString())return this.expandFold(t),void 0;var l="...";if(!i.isMultiLine()){if(l=this.getTextRange(i),l.length<4)return;l=l.trim().substring(0,2)+".."}this.addFold(l,i)},this.getCommentFoldRange=function(e,t,o){var i=new s(this,e,t),r=i.getCurrentToken();if(r&&/^comment|string/.test(r.type)){var l=new n,a=new RegExp(r.type.replace(/\..*/,"\\."));if(1!=o){do r=i.stepBackward();while(r&&a.test(r.type));i.stepForward()}if(l.start.row=i.getCurrentTokenRow(),l.start.column=i.getCurrentTokenColumn()+2,i=new s(this,e,t),-1!=o){do r=i.stepForward();while(r&&a.test(r.type));r=i.stepBackward()}else r=i.getCurrentToken();return l.end.row=i.getCurrentTokenRow(),l.end.column=i.getCurrentTokenColumn()+r.value.length-2,l}},this.foldAll=function(e,t,o){void 0==o&&(o=1e5);var n=this.foldWidgets;t=t||this.getLength(),e=e||0;for(var i=e;t>i;i++)if(null==n[i]&&(n[i]=this.getFoldWidget(i)),"start"==n[i]){var r=this.getFoldWidgetRange(i),s=r.end.row;if(r&&r.isMultiLine()&&t>=s&&r.start.row>=e)try{var l=this.addFold("...",r);l.collapseChildren=o,i=s}catch(a){}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)}},this.$setFolding=function(e){return this.$foldMode!=e?(this.$foldMode=e,this.removeListener("change",this.$updateFoldWidgets),this._emit("changeAnnotation"),e&&"manual"!=this.$foldStyle?(this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),void 0):(this.foldWidgets=null,void 0)):void 0},this.getParentFoldRangeData=function(e,t){var o=this.foldWidgets;if(!o||t&&o[e])return{};for(var n,i=e-1;i>=0;){var r=o[i];if(null==r&&(r=o[i]=this.getFoldWidget(i)),"start"==r){var s=this.getFoldWidgetRange(i);if(n||(n=s),s&&s.end.row>=e)break}i--}return{range:-1!==i&&s,firstRange:n}},this.onFoldWidgetClick=function(e,t){var o=this.getFoldWidget(e),n=this.getLine(e);t=t.domEvent;var i=t.shiftKey,r=t.ctrlKey||t.metaKey,s=t.altKey,l="end"===o?-1:1,a=this.getFoldAt(e,-1===l?0:n.length,l);if(a)return i||r?this.removeFold(a):this.expandFold(a),void 0;var c=this.getFoldWidgetRange(e);if(c&&!c.isMultiLine()&&(a=this.getFoldAt(c.start.row,c.start.column,1),a&&c.isEqual(a.range)))return this.removeFold(a),void 0;if(s){var u=this.getParentFoldRangeData(e);if(u.range)var g=u.range.start.row+1,h=u.range.end.row;this.foldAll(g,h,r?1e4:0)}else if(i){var h=c?c.end.row:this.getLength();this.foldAll(e+1,c.end.row,r?1e4:0)}else c&&(r&&(c.collapseChildren=1e4),this.addFold("...",c));c||((t.target||t.srcElement).className+=" ace_invalid")},this.updateFoldWidgets=function(e){var t=e.data,o=t.range,n=o.start.row,i=o.end.row-n;if(0===i)this.foldWidgets[n]=null;else if("removeText"==t.action||"removeLines"==t.action)this.foldWidgets.splice(n,i+1,null);else{var r=Array(i+1);r.unshift(n,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}}}var n=e("../range").Range,i=e("./fold_line").FoldLine,r=e("./fold").Fold,s=e("../token_iterator").TokenIterator;t.Folding=o}),define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t){function o(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var o=t[t.length-1];this.range=new n(t[0].start.row,t[0].start.column,o.end.row,o.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var n=e("../range").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,o){var n,i,r,s=0,l=this.folds,a=!0;null==t&&(t=this.end.row,o=this.end.column);for(var c=0;c<l.length;c++){if(n=l[c],i=n.range.compareStart(t,o),-1==i)return e(null,t,o,s,a),void 0;if(r=e(null,n.start.row,n.start.column,s,a),r=!r&&e(n.placeholder,n.start.row,n.start.column,s),r||0==i)return;a=!n.sameRow,s=n.end.column}e(null,t,o,s,a)},this.getNextFoldTo=function(e,t){for(var o,n,i=0;i<this.folds.length;i++){if(o=this.folds[i],n=o.range.compareEnd(e,t),-1==n)return{fold:o,kind:"after"};if(0==n)return{fold:o,kind:"inside"}}return null},this.addRemoveChars=function(e,t,o){var n,i,r=this.getNextFoldTo(e,t);if(r)if(n=r.fold,"inside"==r.kind&&n.start.column!=t&&n.start.row!=e)window.console&&window.console.log(e,t,n);else if(n.start.row==e){i=this.folds;var s=i.indexOf(n);for(0==s&&(this.start.column+=o),s;s<i.length;s++){if(n=i[s],n.start.column+=o,!n.sameRow)return;n.end.column+=o}this.end.column+=o}},this.split=function(e,t){var n=this.getNextFoldTo(e,t).fold,i=this.folds,r=this.foldData;if(!n)return null;var s=i.indexOf(n),l=i[s-1];this.end.row=l.end.row,this.end.column=l.end.column,i=i.splice(s,i.length-s);var a=new o(r,i);return r.splice(r.indexOf(this)+1,0,a),a},this.merge=function(e){for(var t=e.folds,o=0;o<t.length;o++)this.addFold(t[o]);var n=this.foldData;n.splice(n.indexOf(e),1)},this.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(t){e.push(" "+t.toString())}),e.push("]"),e.join("\n")},this.idxToPosition=function(e){for(var t,o=0,n=0;n<this.folds.length;n++){var t=this.folds[n];if(e-=t.start.column-o,0>e)return{row:t.start.row,column:t.start.column+e};if(e-=t.placeholder.length,0>e)return t.start;o=t.end.column}return{row:this.end.row,column:this.end.column+e}}}).call(o.prototype),t.FoldLine=o}),define("ace/edit_session/fold",["require","exports","module","ace/range","ace/range_list","ace/lib/oop"],function(e,t){function o(e,t){e.row-=t.row,0==e.row&&(e.column-=t.column)}function n(e,t){o(e.start,t),o(e.end,t)}function i(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row}function r(e,t){i(e.start,t),i(e.end,t)}var s=(e("../range").Range,e("../range_list").RangeList),l=e("../lib/oop"),a=t.Fold=function(e,t){this.foldLine=null,this.placeholder=t,this.range=e,this.start=e.start,this.end=e.end,this.sameRow=e.start.row==e.end.row,this.subFolds=this.ranges=[]};l.inherits(a,s),function(){this.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},this.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},this.clone=function(){var e=this.range.clone(),t=new a(e,this.placeholder);return this.subFolds.forEach(function(e){t.subFolds.push(e.clone())}),t.collapseChildren=this.collapseChildren,t},this.addSubFold=function(e){if(!this.range.isEqual(e)){if(!this.range.containsRange(e))throw new Error("A fold can't intersect already existing fold"+e.range+this.range);n(e,this.start);for(var t=e.start.row,o=e.start.column,i=0,r=-1;i<this.subFolds.length&&(r=this.subFolds[i].range.compare(t,o),1==r);i++);var s=this.subFolds[i];if(0==r)return s.addSubFold(e);for(var t=e.range.end.row,o=e.range.end.column,l=i,r=-1;l<this.subFolds.length&&(r=this.subFolds[l].range.compare(t,o),1==r);l++);{this.subFolds[l]}if(0==r)throw new Error("A fold can't intersect already existing fold"+e.range+this.range);{this.subFolds.splice(i,l-i,e)}return e.setFoldLine(this.foldLine),e}},this.restoreRange=function(e){return r(e,this.start)}}.call(a.prototype)}),define("ace/range_list",["require","exports","module","ace/range"],function(e,t){var o=e("./range").Range,n=o.comparePoints,i=function(){this.ranges=[]};(function(){this.comparePoints=n,this.pointIndex=function(e,t,o){for(var i=this.ranges,r=o||0;r<i.length;r++){var s=i[r],l=n(e,s.end);if(!(l>0)){var a=n(e,s.start);return 0===l?t&&0!==a?-r-2:r:a>0||0===a&&!t?r:-r-1}}return-r-1},this.add=function(e){var t=!e.isEmpty(),o=this.pointIndex(e.start,t);0>o&&(o=-o-1);var n=this.pointIndex(e.end,t,o);return 0>n?n=-n-1:n++,this.ranges.splice(o,n-o,e)},this.addList=function(e){for(var t=[],o=e.length;o--;)t.push.call(t,this.add(e[o]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);return t>=0?this.ranges.splice(t,1):void 0},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return n(e.start,t.start)});for(var o,i=t[0],r=1;r<t.length;r++){o=i,i=t[r];var s=n(o.end,i.start);0>s||(0!=s||o.isEmpty()||i.isEmpty())&&(n(o.end,i.end)<0&&(o.end.row=i.end.row,o.end.column=i.end.column),t.splice(r,1),e.push(i),i=o,r--)}return this.ranges=t,e},this.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);return t>=0?this.ranges[t]:void 0},this.clipRows=function(e,t){var o=this.ranges;if(o[0].start.row>t||o[o.length-1].start.row<e)return[];var n=this.pointIndex({row:e,column:0});0>n&&(n=-n-1);var i=this.pointIndex({row:t,column:0},n);0>i&&(i=-i-1);for(var r=[],s=n;i>s;s++)r.push(o[s]);return r},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},this.$onChange=function(e){var t=e.data.range;if("i"==e.data.action[0])var o=t.start,n=t.end;else var n=t.start,o=t.end;for(var i=o.row,r=n.row,s=r-i,l=-o.column+n.column,a=this.ranges,c=0,u=a.length;u>c;c++){var g=a[c];if(!(g.end.row<i)){if(g.start.row>i)break;if(g.start.row==i&&g.start.column>=o.column&&(g.start.column!=o.column||!this.$insertRight)&&(g.start.column+=l,g.start.row+=s),g.end.row==i&&g.end.column>=o.column){if(g.end.column==o.column&&this.$insertRight)continue;g.end.column==o.column&&l>0&&u-1>c&&g.end.column>g.start.column&&g.end.column==a[c+1].start.column&&(g.end.column-=l),g.end.column+=l,g.end.row+=s}}}if(0!=s&&u>c)for(;u>c;c++){var g=a[c];g.start.row+=s,g.end.row+=s}}}).call(i.prototype),t.RangeList=i}),define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t){function o(){this.findMatchingBracket=function(e,t){if(0==e.column)return null;var o=t||this.getLine(e.row).charAt(e.column-1);if(""==o)return null;var n=o.match(/([\(\[\{])|([\)\]\}])/);return n?n[1]?this.$findClosingBracket(n[1],e):this.$findOpeningBracket(n[2],e):null},this.getBracketRange=function(e){var t,o=this.getLine(e.row),n=!0,r=o.charAt(e.column-1),s=r&&r.match(/([\(\[\{])|([\)\]\}])/);if(s||(r=o.charAt(e.column),e={row:e.row,column:e.column+1},s=r&&r.match(/([\(\[\{])|([\)\]\}])/),n=!1),!s)return null;if(s[1]){var l=this.$findClosingBracket(s[1],e);if(!l)return null;t=i.fromPoints(e,l),n||(t.end.column++,t.start.column--),t.cursor=t.end}else{var l=this.$findOpeningBracket(s[2],e);if(!l)return null;t=i.fromPoints(l,e),n||(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{"},this.$findOpeningBracket=function(e,t,o){var i=this.$brackets[e],r=1,s=new n(this,t.row,t.column),l=s.getCurrentToken();if(l||(l=s.stepForward()),l){o||(o=new RegExp("(\\.?"+l.type.replace(".","\\.").replace("rparen",".paren")+")+"));for(var a=t.column-s.getCurrentTokenColumn()-2,c=l.value;;){for(;a>=0;){var u=c.charAt(a);if(u==i){if(r-=1,0==r)return{row:s.getCurrentTokenRow(),column:a+s.getCurrentTokenColumn()}}else u==e&&(r+=1);a-=1}do l=s.stepBackward();while(l&&!o.test(l.type));if(null==l)break;c=l.value,a=c.length-1}return null}},this.$findClosingBracket=function(e,t,o){var i=this.$brackets[e],r=1,s=new n(this,t.row,t.column),l=s.getCurrentToken();if(l||(l=s.stepForward()),l){o||(o=new RegExp("(\\.?"+l.type.replace(".","\\.").replace("lparen",".paren")+")+"));for(var a=t.column-s.getCurrentTokenColumn();;){for(var c=l.value,u=c.length;u>a;){var g=c.charAt(a);if(g==i){if(r-=1,0==r)return{row:s.getCurrentTokenRow(),column:a+s.getCurrentTokenColumn()}}else g==e&&(r+=1);a+=1}do l=s.stepForward();while(l&&!o.test(l.type));if(null==l)break;a=0}return null}}}var n=e("../token_iterator").TokenIterator,i=e("../range").Range;t.BracketMatch=o}),define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t){var o=e("./lib/lang"),n=e("./lib/oop"),i=e("./range").Range,r=function(){this.$options={}};(function(){this.set=function(e){return n.mixin(this.$options,e),this},this.getOptions=function(){return o.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$matchIterator(e,this.$options);if(!t)return!1;var o=null;return t.forEach(function(e,t,n){if(e.start)o=e;else{var r=e.offset+(n||0);o=new i(t,r,t,r+e.length)}return!0}),o},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,r=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),s=[],l=t.re;if(t.$isMultiLine)for(var a=l.length,c=r.length-a,u=l.offset||0;c>=u;u++){for(var g=0;a>g&&-1!=r[u+g].search(l[g]);g++);var h=r[u],d=r[u+a-1],p=h.match(l[0])[0].length,f=d.match(l[a-1])[0].length;s.push(new i(u,h.length-p,u+a-1,f))}else for(var m=0;m<r.length;m++)for(var y=o.getMatchOffsets(r[m],l),g=0;g<y.length;g++){var _=y[g];s.push(new i(m,_.offset,m,_.offset+_.length))
11
- }if(n){for(var v=n.start.column,E=n.start.column,m=0,g=s.length-1;g>m&&s[m].start.column<v&&s[m].start.row==n.start.row;)m++;for(;g>m&&s[g].end.column>E&&s[g].end.row==n.end.row;)g--;for(s=s.slice(m,g+1),m=0,g=s.length;g>m;m++)s[m].start.row+=n.start.row,s[m].end.row+=n.start.row}return s},this.replace=function(e,t){var o=this.$options,n=this.$assembleRegExp(o);if(o.$isMultiLine)return t;if(n){var i=n.exec(e);if(!i||i[0].length!=e.length)return null;if(t=e.replace(n,t),o.preserveCase){t=t.split("");for(var r=Math.min(e.length,e.length);r--;){var s=e[r];t[r]=s&&s.toLowerCase()!=s?t[r].toUpperCase():t[r].toLowerCase()}t=t.join("")}return t}},this.$matchIterator=function(e,t){var n=this.$assembleRegExp(t);if(!n)return!1;var r,s=this,l=t.backwards;if(t.$isMultiLine)var a=n.length,c=function(t,o,s){var l=t.search(n[0]);if(-1!=l){for(var c=1;a>c;c++)if(t=e.getLine(o+c),-1==t.search(n[c]))return;var u=t.match(n[a-1])[0].length,g=new i(o,l,o+a-1,u);return 1==n.offset?(g.start.row--,g.start.column=Number.MAX_VALUE):s&&(g.start.column+=s),r(g)?!0:void 0}};else if(l)var c=function(e,t,i){for(var s=o.getMatchOffsets(e,n),l=s.length-1;l>=0;l--)if(r(s[l],t,i))return!0};else var c=function(e,t,i){for(var s=o.getMatchOffsets(e,n),l=0;l<s.length;l++)if(r(s[l],t,i))return!0};return{forEach:function(o){r=o,s.$lineIterator(e,t).forEach(c)}}},this.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var n=e.needle;if(!e.needle)return e.re=!1;e.regExp||(n=o.escapeRegExp(n)),e.wholeWord&&(n="\\b"+n+"\\b");var i=e.caseSensitive?"g":"gi";if(e.$isMultiLine=!t&&/[\n\r]/.test(n),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(n,i);try{var r=new RegExp(n,i)}catch(s){r=!1}return e.re=r},this.$assembleMultilineRegExp=function(e,t){for(var o=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),n=[],i=0;i<o.length;i++)try{n.push(new RegExp(o[i],t))}catch(r){return!1}return""==o[0]?(n.shift(),n.offset=1):n.offset=0,n},this.$lineIterator=function(e,t){var o=1==t.backwards,n=0!=t.skipCurrent,i=t.range,r=t.start;r||(r=i?i[o?"end":"start"]:e.selection.getRange()),r.start&&(r=r[n!=o?"end":"start"]);var s=i?i.start.row:0,l=i?i.end.row:e.getLength()-1,a=o?function(o){var n=r.row,i=e.getLine(n).substring(0,r.column);if(!o(i,n)){for(n--;n>=s;n--)if(o(e.getLine(n),n))return;if(0!=t.wrap)for(n=l,s=r.row;n>=s;n--)if(o(e.getLine(n),n))return}}:function(o){var n=r.row,i=e.getLine(n).substr(r.column);if(!o(i,n,r.column)){for(n+=1;l>=n;n++)if(o(e.getLine(n),n))return;if(0!=t.wrap)for(n=s,l=r.row;l>=n;n++)if(o(e.getLine(n),n))return}};return{forEach:a}}}).call(r.prototype),t.Search=r}),define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t){var o=e("../lib/oop"),n=e("../keyboard/hash_handler").HashHandler,i=e("../lib/event_emitter").EventEmitter,r=function(e,t){n.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};o.inherits(r,n),function(){o.implement(this,i),this.exec=function(e,t,o){if("string"==typeof e&&(e=this.commands[e]),!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;var n={editor:t,command:e,args:o},i=this._emit("exec",n);return this._signal("afterExec",n),i===!1?!1:!0},this.toggleRecording=function(e){return this.$inReplay?void 0:(e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0))},this.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){"string"==typeof t?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}}},this.trimMacro=function(e){return e.map(function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(r.prototype),t.CommandManager=r}),define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t){function o(e,t){if(this.platform=t||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.__defineGetter__&&this.__defineSetter__&&"undefined"!=typeof console&&console.error){var o=!1,n=function(){o||(o=!0,console.error("commmandKeyBinding has too many m's. use commandKeyBinding"))};this.__defineGetter__("commmandKeyBinding",function(){return n(),this.commandKeyBinding}),this.__defineSetter__("commmandKeyBinding",function(e){return n(),this.commandKeyBinding=e})}else this.commmandKeyBinding=this.commandKeyBinding;this.addCommands(e)}var n=e("../lib/keys"),i=e("../lib/useragent");(function(){this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e){var t="string"==typeof e?e:e.name;e=this.commands[t],delete this.commands[t];var o=this.commandKeyBinding;for(var n in o)for(var i in o[n])o[n][i]==e&&delete o[n][i]},this.bindKey=function(e,t){if(e){if("function"==typeof t)return this.addCommand({exec:t,bindKey:e,name:t.name||e}),void 0;var o=this.commandKeyBinding;e.split("|").forEach(function(e){var n=this.parseKeys(e,t),i=n.hashId;(o[i]||(o[i]={}))[n.key]=t},this)}},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var o=e[t];if(o)return"string"==typeof o?this.bindKey(o,t):("function"==typeof o&&(o={exec:o}),o.name||(o.name=t),this.addCommand(o),void 0)},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){var t=e.bindKey;if(t){var o="string"==typeof t?t:t[this.platform];this.bindKey(o,e)}},this.parseKeys=function(e){-1!=e.indexOf(" ")&&(e=e.split(/\s+/).pop());var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),o=t.pop(),i=n[o];if(n.FUNCTION_KEYS[i])o=n.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:o,hashId:-1};if(1==t.length&&"shift"==t[0])return{key:o.toUpperCase(),hashId:-1}}for(var r=0,s=t.length;s--;){var l=n.KEY_MODS[t[s]];if(null==l)return"undefined"!=typeof console&&console.error("invalid modifier "+t[s]+" in "+e),!1;r|=l}return{key:o,hashId:r}},this.findKeyCommand=function(e,t){var o=this.commandKeyBinding;return o[e]&&o[e][t]},this.handleKeyboard=function(e,t,o){return{command:this.findKeyCommand(t,o)}}}).call(o.prototype),t.HashHandler=o}),define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config"],function(e,t){function o(e,t){return{win:e,mac:t}}var n=e("../lib/lang"),i=e("../config");t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){i.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"selectall",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",bindKey:o("Ctrl-L","Command-L"),exec:function(e){var t=parseInt(prompt("Enter line number:"),10);isNaN(t)||e.gotoLine(t)},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},readOnly:!0},{name:"foldall",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll()},readOnly:!0},{name:"unfoldall",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},readOnly:!0},{name:"findnext",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},readOnly:!0},{name:"findprevious",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},readOnly:!0},{name:"find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",bindKey:o("Ctrl-Shift-Home","Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,group:"fileJump"},{name:"gotostart",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,group:"fileJump"},{name:"selectup",bindKey:o("Shift-Up","Shift-Up"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",readOnly:!0},{name:"golineup",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selecttoend",bindKey:o("Ctrl-Shift-End","Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,group:"fileJump"},{name:"gotoend",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,group:"fileJump"},{name:"selectdown",bindKey:o("Shift-Down","Shift-Down"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",readOnly:!0},{name:"golinedown",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selectwordleft",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",readOnly:!0},{name:"gotowordleft",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",readOnly:!0},{name:"selecttolinestart",bindKey:o("Alt-Shift-Left","Command-Shift-Left"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",readOnly:!0},{name:"gotolinestart",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",readOnly:!0},{name:"selectleft",bindKey:o("Shift-Left","Shift-Left"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",readOnly:!0},{name:"gotoleft",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selectwordright",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",readOnly:!0},{name:"gotowordright",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",readOnly:!0},{name:"selecttolineend",bindKey:o("Alt-Shift-Right","Command-Shift-Right"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"gotolineend",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"selectright",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",readOnly:!0},{name:"gotoright",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selectpagedown",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",readOnly:!0},{name:"selectlineend",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"togglerecording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",bindKey:o("Ctrl-P","Ctrl-Shift-P"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",readOnly:!0},{name:"selecttomatching",bindKey:o("Ctrl-Shift-P",null),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",readOnly:!0},{name:"cut",exec:function(e){var t=e.getSelectionRange();e._emit("cut",t),e.selection.isEmpty()||(e.session.remove(t),e.clearSelection())},multiSelectAction:"forEach"},{name:"removeline",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},multiSelectAction:"forEachLine"},{name:"duplicateSelection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},multiSelectAction:"forEach"},{name:"sortlines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},multiSelectAction:"forEachLine"},{name:"togglecomment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine"},{name:"toggleBlockComment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach"},{name:"modifyNumberUp",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},multiSelectAction:"forEach"},{name:"modifyNumberDown",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},multiSelectAction:"forEach"},{name:"replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()}},{name:"movelinesup",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()}},{name:"copylinesdown",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()}},{name:"movelinesdown",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()}},{name:"del",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach"},{name:"backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach"},{name:"cut_or_delete",bindKey:o("Shift-Delete",null),exec:function(e){return e.selection.isEmpty()?(e.remove("left"),void 0):!1},multiSelectAction:"forEach"},{name:"removetolinestart",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach"},{name:"removetolineend",bindKey:o("Alt-Delete","Ctrl-K"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach"},{name:"removewordleft",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach"},{name:"removewordright",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach"},{name:"outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach"},{name:"indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach"},{name:"blockoutdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine"},{name:"blockindent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine"},{name:"insertstring",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach"},{name:"inserttext",exec:function(e,t){e.insert(n.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach"},{name:"splitline",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach"},{name:"transposeletters",bindKey:o("Ctrl-T","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)}},{name:"touppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach"},{name:"tolowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach"}]}),define("ace/undomanager",["require","exports","module"],function(e,t){var o=function(){this.reset()};(function(){this.execute=function(e){var t=e.args[0];this.$doc=e.args[1],e.merge&&this.hasUndo()&&(t=this.$undoStack.pop().concat(t)),this.$undoStack.push(t),this.$redoStack=[],this.dirtyCounter<0&&(this.dirtyCounter=0/0),this.dirtyCounter++},this.undo=function(e){var t=this.$undoStack.pop(),o=null;return t&&(o=this.$doc.undoChanges(t,e),this.$redoStack.push(t),this.dirtyCounter--),o},this.redo=function(e){var t=this.$redoStack.pop(),o=null;return t&&(o=this.$doc.redoChanges(t,e),this.$undoStack.push(t),this.dirtyCounter++),o},this.reset=function(){this.$undoStack=[],this.$redoStack=[],this.dirtyCounter=0},this.hasUndo=function(){return this.$undoStack.length>0},this.hasRedo=function(){return this.$redoStack.length>0},this.markClean=function(){this.dirtyCounter=0},this.isClean=function(){return 0===this.dirtyCounter}}).call(o.prototype),t.UndoManager=o}),define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/useragent","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/renderloop","ace/lib/event_emitter"],function(e,t){var o=e("./lib/oop"),n=e("./lib/dom"),i=(e("./lib/useragent"),e("./config")),r=e("./layer/gutter").Gutter,s=e("./layer/marker").Marker,l=e("./layer/text").Text,a=e("./layer/cursor").Cursor,c=e("./scrollbar").ScrollBarH,u=e("./scrollbar").ScrollBarV,g=e("./renderloop").RenderLoop,h=e("./lib/event_emitter").EventEmitter,d=".ace_editor {position: relative;overflow: hidden;font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;font-size: 12px;line-height: normal;color: black;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;}.ace_content {position: absolute;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: text;}.ace_dragging, .ace_dragging * {cursor: move !important;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: '';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95JqjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=\");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==\");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url(\"data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7\");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=\");}.ace_scrollbar {position: absolute;overflow-x: hidden;overflow-y: auto;right: 0;top: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-h {position: absolute;overflow-x: auto;overflow-y: hidden;right: 0;left: 0;bottom: 0;z-index: 6;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;text-indent: -1em;}.ace_text-input.ace_composition {background: #f8f8f8;color: #111;z-index: 1000;opacity: 1;text-indent: 0;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;white-space: nowrap;height: 100%;width: 100%;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;/* setting pointer-events: auto; on node under the mouse, which changesduring scroll, will break mouse wheel scrolling in Safari */pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;}.ace_text-layer {font: inherit !important;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;border-left: 2px solid}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0px;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_smooth-blinking .ace_cursor {-moz-transition: opacity 0.18s;-webkit-transition: opacity 0.18s;-o-transition: opacity 0.18s;-ms-transition: opacity 0.18s;transition: opacity 0.18s;}.ace_cursor[style*=\"opacity: 0\"]{-ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";}.ace_editor.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_line {white-space: nowrap;}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;}.ace_line .ace_fold {-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82\");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;-moz-border-radius: 2px;-webkit-border-radius: 2px;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82\");background-repeat: no-repeat, repeat-x;background-position: center center, top left;}.ace_gutter-tooltip {background-color: #FFF;background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;display: inline-block;max-width: 500px;padding: 4px;position: fixed;z-index: 999999;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: default;white-space: pre-line;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82\");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block; }.ace_fold-widget.ace_end {background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82\");}.ace_fold-widget.ace_closed {background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82\");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}/*** Dark version for fold widgets*/.ace_dark .ace_fold-widget {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");}.ace_dark .ace_fold-widget.ace_end {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");}.ace_dark .ace_fold-widget.ace_closed {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {-moz-transition: opacity 0.4s ease 0.05s;-webkit-transition: opacity 0.4s ease 0.05s;-o-transition: opacity 0.4s ease 0.05s;-ms-transition: opacity 0.4s ease 0.05s;transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {-moz-transition: opacity 0.05s ease 0.05s;-webkit-transition: opacity 0.05s ease 0.05s;-o-transition: opacity 0.05s ease 0.05s;-ms-transition: opacity 0.05s ease 0.05s;transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}";
12
- n.importCssString(d,"ace_editor");var p=function(e,t){var o=this;this.container=e||n.createElement("div"),this.$keepTextAreaAtCursor=!0,n.addCssClass(this.container,"ace_editor"),this.setTheme(t),this.$gutter=n.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.scroller=n.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=n.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new r(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new s(this.content);var h=this.$textLayer=new l(this.content);this.canvas=h.element,this.$markerFront=new s(this.content),this.$cursorLayer=new a(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new u(this.container,this),this.scrollBarH=new c(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){o.$scrollAnimation||o.session.setScrollTop(e.data-o.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){o.$scrollAnimation||o.session.setScrollLeft(e.data-o.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$textLayer.addEventListener("changeCharacterSize",function(){o.updateCharacterSize(),o.onResize(!0),o._signal("changeCharacterSize")}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$loop=new g(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),i.resetOptions(this),i._emit("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,o.implement(this,h),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin()},this.setSession=function(e){this.session=e,this.scroller.className="ace_scroller",this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),this.$loop.schedule(this.CHANGE_FULL)},this.updateLines=function(e,t){void 0===t&&(t=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<t&&(this.$changedLines.lastRow=t)):this.$changedLines={firstRow:e,lastRow:t},this.$changedLines.firstRow>this.layerConfig.lastRow||this.$changedLines.lastRow<this.layerConfig.firstRow||this.$loop.schedule(this.CHANGE_LINES)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.onResize=function(e,t,o,n){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=e?1:0;var i=this.container;n||(n=i.clientHeight||i.scrollHeight),o||(o=i.clientWidth||i.scrollWidth);var r=this.$updateCachedSize(e,t,o,n);return this.$size.scrollerHeight&&(o||n)?(e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(r,!0):this.$loop.schedule(r|this.$changes),this.resizing&&(this.resizing=0),void 0):this.resizing=0}},this.$updateCachedSize=function(e,t,o,n){var i=0,r=this.$size,s={width:r.width,height:r.height,scrollerHeight:r.scrollerHeight,scrollerWidth:r.scrollerWidth};return n&&(e||r.height!=n)&&(r.height=n,i=this.CHANGE_SIZE,r.scrollerHeight=r.height,this.$horizScroll&&(r.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",this.session&&(this.session.setScrollTop(this.getScrollTop()),i|=this.CHANGE_SCROLL)),o&&(e||r.width!=o)&&(i=this.CHANGE_SIZE,r.width=o,null==t&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,this.scrollBarH.element.style.left=this.scroller.style.left=t+"px",r.scrollerWidth=Math.max(0,o-t-this.scrollBarV.getWidth()),this.scrollBarH.element.style.right=this.scroller.style.right=this.scrollBarV.getWidth()+"px",this.scroller.style.bottom=this.scrollBarH.getHeight()+"px",(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(i|=this.CHANGE_FULL)),i&&this._signal("resize",s),i},this.onGutterResize=function(){var e=this.$showGutter?this.$gutter.offsetWidth:0;e!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,e,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):(this.$computeLayerConfig(),this.$loop.schedule(this.CHANGE_MARKER))},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-2*this.$padding,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updateGutterLineHighlight=function(){var e=this.$cursorLayer.$pixelPos,t=this.layerConfig.lineHeight;if(this.session.getUseWrapMode()){var o=this.session.selection.getCursor();o.column=0,e=this.$cursorLayer.getPixelPosition(o,!0),t*=this.session.getRowLength(o.row)}this.$gutterLineHighlight.style.top=e.top-this.layerConfig.offset+"px",this.$gutterLineHighlight.style.height=t+"px"},this.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=n.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=n.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=this.characterWidth*this.$printMarginColumn+this.$padding+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.content},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(this.$keepTextAreaAtCursor){var e=this.layerConfig,t=this.$cursorLayer.$pixelPos.top,o=this.$cursorLayer.$pixelPos.left;t-=e.offset;var n=this.lineHeight;if(!(0>t||t>e.height-n)){var i=this.characterWidth;if(this.$composition){var r=this.textarea.value.replace(/^\x01+/,"");i*=this.session.$getStringScreenWidth(r)[0]+2,n+=2,t-=1}o-=this.scrollLeft,o>this.$size.scrollerWidth-i&&(o=this.$size.scrollerWidth-i),o-=this.scrollBar.width,this.textarea.style.height=n+"px",this.textarea.style.width=i+"px",this.textarea.style.right=Math.max(0,this.$size.scrollerWidth-o-i)+"px",this.textarea.style.bottom=Math.max(0,this.$size.height-t-n)+"px"}}},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(0===this.layerConfig.offset?0:1)},this.getLastFullyVisibleRow=function(){var e=Math.floor((this.layerConfig.height+this.layerConfig.offset)/this.layerConfig.lineHeight);return this.layerConfig.firstRow-1+e},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,o,n){var i=this.scrollMargin;i.top=0|e,i.bottom=0|t,i.right=0|n,i.left=0|o,i.v=i.top+i.bottom,i.h=i.left+i.right,this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){this.scrollBarV.setInnerHeight(this.layerConfig.maxHeight+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setInnerWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$renderChanges=function(e,t){return this.$changes&&(e|=this.$changes,this.$changes=0),this.session&&this.container.offsetWidth&&(e||t)?this.$size.width?(this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender"),(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL)&&(e|=this.$computeLayerConfig()),e&this.CHANGE_H_SCROLL&&(this.$updateScrollBarH(),this.content.style.marginLeft=-this.scrollLeft+"px",this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left"),e&this.CHANGE_FULL?(this.$updateScrollBarV(),this.$updateScrollBarH(),this.$textLayer.update(this.layerConfig),this.$showGutter&&this.$gutterLayer.update(this.layerConfig),this.$markerBack.update(this.layerConfig),this.$markerFront.update(this.layerConfig),this.$cursorLayer.update(this.layerConfig),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this._signal("afterRender"),void 0):e&this.CHANGE_SCROLL?(this.$updateScrollBarV(),e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(this.layerConfig):this.$textLayer.scrollLines(this.layerConfig),this.$showGutter&&this.$gutterLayer.update(this.layerConfig),this.$markerBack.update(this.layerConfig),this.$markerFront.update(this.layerConfig),this.$cursorLayer.update(this.layerConfig),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this.$moveTextAreaToCursor(),this._signal("afterRender"),void 0):(e&this.CHANGE_TEXT?(this.$textLayer.update(this.layerConfig),this.$showGutter&&this.$gutterLayer.update(this.layerConfig)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(this.layerConfig):(e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER)&&this.$showGutter&&this.$gutterLayer.update(this.layerConfig),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(this.layerConfig),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(this.layerConfig),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(this.layerConfig),(e&this.CHANGE_SIZE||e&this.CHANGE_LINES)&&(this.$updateScrollBarV(),this.$updateScrollBarH()),this._signal("afterRender"),void 0)):(this.$changes|=e,this.onResize(!0)):(this.$changes|=e,void 0)},this.$autosize=function(e){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,o=Math.max((this.$minLines||1)*this.lineHeight,Math.min(t,e)),n=e>t;if(o!=this.desiredHeight||this.$size.height!=this.desiredHeight||n!=this.$vScroll){n!=this.$vScroll&&(this.$vScroll=n,this.scrollBarV.setVisible(n));var i=this.container.clientWidth;this.container.style.height=o+"px",this.$updateCachedSize(!0,this.$gutterWidth,i,o),this.desiredHeight=o}},this.$computeLayerConfig=function(){this.$maxLines&&this.lineHeight>1&&this.$autosize();var e=this.session,t=this.$size.height<=2*this.lineHeight,o=this.session.getScreenLength(),n=o*this.lineHeight,i=this.scrollTop%this.lineHeight,r=this.$size.scrollerHeight+this.lineHeight,s=this.$getLongestLine(),l=!t&&(this.$hScrollBarAlwaysVisible||this.$size.scrollerWidth-s-2*this.$padding<0),a=this.$horizScroll!==l;a&&(this.$horizScroll=l,this.scrollBarH.setVisible(l)),!this.$maxLines&&this.$scrollPastEnd&&this.scrollTop>n-this.$size.scrollerHeight&&(n+=Math.min((this.$size.scrollerHeight-this.lineHeight)*this.$scrollPastEnd,this.scrollTop-n+this.$size.scrollerHeight));var c=!t&&(this.$vScrollBarAlwaysVisible||this.$size.scrollerHeight-n<0),u=this.$vScroll!==c;u&&(this.$vScroll=c,this.scrollBarV.setVisible(c)),this.session.setScrollTop(Math.max(-this.scrollMargin.top,Math.min(this.scrollTop,n-this.$size.scrollerHeight+this.scrollMargin.v))),this.session.setScrollLeft(Math.max(-this.scrollMargin.left,Math.min(this.scrollLeft,s+2*this.$padding-this.$size.scrollerWidth+this.scrollMargin.h)));var g,h,d=Math.ceil(r/this.lineHeight)-1,p=Math.max(0,Math.round((this.scrollTop-i)/this.lineHeight)),f=p+d,m=this.lineHeight;p=e.screenToDocumentRow(p,0);var y=e.getFoldLine(p);y&&(p=y.start.row),g=e.documentToScreenRow(p,0),h=e.getRowLength(p)*m,f=Math.min(e.screenToDocumentRow(f,0),e.getLength()-1),r=this.$size.scrollerHeight+e.getRowLength(f)*m+h,i=this.scrollTop-g*m;var _=0;return(a||u)&&(_=this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this._signal("scrollbarVisibilityChanged"),u&&(s=this.$getLongestLine())),this.layerConfig={width:s,padding:this.$padding,firstRow:p,firstRowScreen:g,lastRow:f,lineHeight:m,characterWidth:this.characterWidth,minHeight:r,maxHeight:n,offset:i,height:this.$size.scrollerHeight},this.$gutterLayer.element.style.marginTop=-i+"px",this.content.style.marginTop=-i+"px",this.content.style.width=s+2*this.$padding+"px",this.content.style.height=r+"px",_},this.$updateLines=function(){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var o=this.layerConfig;if(!(e>o.lastRow+1||t<o.firstRow))return 1/0===t?(this.$showGutter&&this.$gutterLayer.update(o),this.$textLayer.update(o),void 0):(this.$textLayer.updateLines(o,e,t),!0)},this.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},this.updateBreakpoints=function(){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(e,t,o){this.scrollCursorIntoView(e,o),this.scrollCursorIntoView(t,o)},this.scrollCursorIntoView=function(e,t){if(0!==this.$size.scrollerHeight){var o=this.$cursorLayer.getPixelPosition(e),n=o.left,i=o.top,r=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;r>i?(t&&(i-=t*this.$size.scrollerHeight),0==i?i=-this.scrollMargin.top:0==i&&(i=+this.scrollMargin.bottom),this.session.setScrollTop(i)):r+this.$size.scrollerHeight<i+this.lineHeight&&(t&&(i+=t*this.$size.scrollerHeight),this.session.setScrollTop(i+this.lineHeight-this.$size.scrollerHeight));var s=this.scrollLeft;s>n?(n<this.$padding+2*this.layerConfig.characterWidth&&(n=-this.scrollMargin.left),this.session.setScrollLeft(n)):s+this.$size.scrollerWidth<n+this.characterWidth?this.session.setScrollLeft(Math.round(n+this.characterWidth-this.$size.scrollerWidth)):s<=this.$padding&&n-s<this.characterWidth&&this.session.setScrollLeft(0)}},this.getScrollTop=function(){return this.session.getScrollTop()},this.getScrollLeft=function(){return this.session.getScrollLeft()},this.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},this.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},this.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},this.alignCursor=function(e,t){"number"==typeof e&&(e={row:e,column:0});var o=this.$cursorLayer.getPixelPosition(e),n=this.$size.scrollerHeight-this.lineHeight,i=o.top-n*(t||0);return this.session.setScrollTop(i),i},this.STEPS=8,this.$calcSteps=function(e,t){var o=0,n=this.STEPS,i=[],r=function(e,t,o){return o*(Math.pow(e-1,3)+1)+t};for(o=0;n>o;++o)i.push(r(o/this.STEPS,e,t-e));return i},this.scrollToLine=function(e,t,o,n){var i=this.$cursorLayer.getPixelPosition({row:e,column:0}),r=i.top;t&&(r-=this.$size.scrollerHeight/2);var s=this.scrollTop;this.session.setScrollTop(r),o!==!1&&this.animateScrolling(s,n)},this.animateScrolling=function(e,t){var o=this.scrollTop;if(this.$animatedScroll){var n=this;if(e!=o){if(this.$scrollAnimation){var i=this.$scrollAnimation.steps;if(i.length&&(e=i[0],e==o))return}var r=n.$calcSteps(e,o);this.$scrollAnimation={from:e,to:o,steps:r},clearInterval(this.$timer),n.session.setScrollTop(r.shift()),this.$timer=setInterval(function(){r.length?(n.session.setScrollTop(r.shift()),n.session.$scrollTop=o):null!=o?(n.session.$scrollTop=-1,n.session.setScrollTop(o),o=null):(n.$timer=clearInterval(n.$timer),n.$scrollAnimation=null,t&&t())},10)}}},this.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},this.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},this.scrollTo=function(e,t){this.session.setScrollTop(t),this.session.setScrollLeft(t)},this.scrollBy=function(e,t){t&&this.session.setScrollTop(this.session.getScrollTop()+t),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},this.isScrollableBy=function(e,t){return 0>t&&this.session.getScrollTop()>=1-this.scrollMargin.top?!0:t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight-(this.$size.scrollerHeight-this.lineHeight)*this.$scrollPastEnd<-1+this.scrollMargin.bottom?!0:0>e&&this.session.getScrollLeft()>=1-this.scrollMargin.left?!0:e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right?!0:void 0},this.pixelToScreenCoordinates=function(e,t){var o=this.scroller.getBoundingClientRect(),n=(e+this.scrollLeft-o.left-this.$padding)/this.characterWidth,i=Math.floor((t+this.scrollTop-o.top)/this.lineHeight),r=Math.round(n);return{row:i,column:r,side:n-r>0?1:-1}},this.screenToTextCoordinates=function(e,t){var o=this.scroller.getBoundingClientRect(),n=Math.round((e+this.scrollLeft-o.left-this.$padding)/this.characterWidth),i=Math.floor((t+this.scrollTop-o.top)/this.lineHeight);return this.session.screenToDocumentPosition(i,Math.max(n,0))},this.textToScreenCoordinates=function(e,t){var o=this.scroller.getBoundingClientRect(),n=this.session.documentToScreenPosition(e,t),i=this.$padding+Math.round(n.column*this.characterWidth),r=n.row*this.lineHeight;return{pageX:o.left+i-this.scrollLeft,pageY:o.top+r-this.scrollTop}},this.visualizeFocus=function(){n.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){n.removeCssClass(this.container,"ace_focus")},this.showComposition=function(){this.$composition||(this.$composition={keepTextAreaAtCursor:this.$keepTextAreaAtCursor,cssText:this.textarea.style.cssText}),this.$keepTextAreaAtCursor=!0,n.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor()},this.setCompositionText=function(){this.$moveTextAreaToCursor()},this.hideComposition=function(){this.$composition&&(n.removeCssClass(this.textarea,"ace_composition"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null)},this.setTheme=function(e,t){function o(o){if(r.$themeValue!=e)return t&&t();if(o.cssClass){n.importCssString(o.cssText,o.cssClass,r.container.ownerDocument),r.theme&&n.removeCssClass(r.container,r.theme.cssClass),r.$theme=o.cssClass,r.theme=o,n.addCssClass(r.container,o.cssClass),n.setCssClass(r.container,"ace_dark",o.isDark);var i="padding"in o?o.padding:4;r.$padding&&i!=r.$padding&&r.setPadding(i),r.$size&&(r.$size.width=0,r.onResize()),r._dispatchEvent("themeLoaded",{theme:o}),t&&t()}}var r=this;if(this.$themeValue=e,r._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)o(e);else{var s=e||"ace/theme/textmate";i.loadModule(["theme",s],o)}},this.getTheme=function(){return this.$themeValue},this.setStyle=function(e,t){n.setCssClass(this.container,e,0!=t)},this.unsetStyle=function(e){n.removeCssClass(this.container,e)},this.setMouseCursor=function(e){this.content.style.cursor=e},this.destroy=function(){this.$textLayer.destroy(),this.$cursorLayer.destroy()}}).call(p.prototype),i.defineOptions(p.prototype,"renderer",{animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.onGutterResize()},initialValue:!0},fadeFoldWidgets:{set:function(e){n.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightGutterLine:{set:function(e){return this.$gutterLineHighlight?(this.$gutterLineHighlight.style.display=e?"":"none",this.$cursorLayer.$pixelPos&&this.$updateGutterLineHighlight(),void 0):(this.$gutterLineHighlight=n.createElement("div"),this.$gutterLineHighlight.className="ace_gutter-active-line",this.$gutter.appendChild(this.$gutterLineHighlight),void 0)},initialValue:!1,value:!0},hScrollBarAlwaysVisible:{set:function(){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(){this.updateFull()}},minLines:{set:function(){this.updateFull()}},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}}}),t.VirtualRenderer=p}),define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter"],function(e,t){var o=e("../lib/dom"),n=e("../lib/oop"),i=e("../lib/lang"),r=e("../lib/event_emitter").EventEmitter,s=function(e){this.element=o.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$cells=[]};(function(){n.implement(this,r),this.setSession=function(e){this.session&&this.session.removeEventListener("change",this.$updateAnnotations),this.session=e,e.on("change",this.$updateAnnotations)},this.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,t)},this.setAnnotations=function(e){this.$annotations=[];for(var t,o,n=0;n<e.length;n++){var r=e[n],o=r.row,t=this.$annotations[o];t||(t=this.$annotations[o]={text:[]});var s=r.text;s=s?i.escapeHTML(s):r.html||"",-1===t.text.indexOf(s)&&t.text.push(s);var l=r.type;"error"==l?t.className=" ace_error":"warning"==l&&" ace_error"!=t.className?t.className=" ace_warning":"info"==l&&!t.className&&(t.className=" ace_info")}},this.$updateAnnotations=function(e){if(this.$annotations.length){var t=e.data,o=t.range,n=o.start.row,i=o.end.row-n;if(0!==i)if("removeText"==t.action||"removeLines"==t.action)this.$annotations.splice(n,i+1,null);else{var r=Array(i+1);r.unshift(n,1),this.$annotations.splice.apply(this.$annotations,r)}}},this.update=function(e){for(var t=e.firstRow,n=e.lastRow,i=this.session.getNextFoldLine(t),r=i?i.start.row:1/0,s=this.$showFoldWidgets&&this.session.foldWidgets,l=this.session.$breakpoints,a=this.session.$decorations,c=this.session.$firstLineNumber,u=0,g=null,h=-1,d=t;;){if(d>r&&(d=i.end.row+1,i=this.session.getNextFoldLine(d,i),r=i?i.start.row:1/0),d>n){for(;this.$cells.length>h+1;)g=this.$cells.pop(),this.element.removeChild(g.element);break}g=this.$cells[++h],g||(g={element:null,textNode:null,foldWidget:null},g.element=o.createElement("div"),g.textNode=document.createTextNode(""),g.element.appendChild(g.textNode),this.element.appendChild(g.element),this.$cells[h]=g);var p="ace_gutter-cell ";l[d]&&(p+=l[d]),a[d]&&(p+=a[d]),this.$annotations[d]&&(p+=this.$annotations[d].className),g.element.className!=p&&(g.element.className=p);var f=this.session.getRowLength(d)*e.lineHeight+"px";f!=g.element.style.height&&(g.element.style.height=f);var m=u=d+c;if(m!=g.textNode.data&&(g.textNode.data=m),s){var y=s[d];null==y&&(y=s[d]=this.session.getFoldWidget(d))}if(y){g.foldWidget||(g.foldWidget=o.createElement("span"),g.element.appendChild(g.foldWidget));var p="ace_fold-widget ace_"+y;p+="start"==y&&d==r&&d<i.end.row?" ace_closed":" ace_open",g.foldWidget.className!=p&&(g.foldWidget.className=p);var f=e.lineHeight+"px";g.foldWidget.style.height!=f&&(g.foldWidget.style.height=f)}else null!=g.foldWidget&&(g.element.removeChild(g.foldWidget),g.foldWidget=null);d++}this.element.style.height=e.minHeight+"px",(this.$fixedWidth||this.session.$useWrapMode)&&(u=this.session.getLength());var _=u.toString().length*e.characterWidth,v=this.$padding||this.$computePadding();_+=v.left+v.right,_!==this.gutterWidth&&!isNaN(_)&&(this.gutterWidth=_,this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._emit("changeGutterWidth",_))},this.$fixedWidth=!1,this.$showFoldWidgets=!0,this.setShowFoldWidgets=function(e){e?o.addCssClass(this.element,"ace_folding-enabled"):o.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},this.getShowFoldWidgets=function(){return this.$showFoldWidgets},this.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=o.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=parseInt(e.paddingLeft)+1||0,this.$padding.right=parseInt(e.paddingRight)||0,this.$padding},this.getRegion=function(e){var t=this.$padding||this.$computePadding(),o=this.element.getBoundingClientRect();return e.x<t.left+o.left?"markers":this.$showFoldWidgets&&e.x>o.right-t.right?"foldWidgets":void 0}}).call(s.prototype),t.Gutter=s}),define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t){var o=e("../range").Range,n=e("../lib/dom"),i=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.update=function(e){var e=e||this.config;if(e){this.config=e;var t=[];for(var o in this.markers){var i=this.markers[o];if(i.range){var r=i.range.clipRows(e.firstRow,e.lastRow);if(!r.isEmpty())if(r=r.toScreenRange(this.session),i.renderer){var s=this.$getTop(r.start.row,e),l=this.$padding+r.start.column*e.characterWidth;i.renderer(t,r,l,s,e)}else"fullLine"==i.type?this.drawFullLineMarker(t,r,i.clazz,e):"screenLine"==i.type?this.drawScreenLineMarker(t,r,i.clazz,e):r.isMultiLine()?"text"==i.type?this.drawTextMarker(t,r,i.clazz,e):this.drawMultiLineMarker(t,r,i.clazz,e):this.drawSingleLineMarker(t,r,i.clazz+" ace_start",e)}else i.update(t,this,this.session,e)}this.element=n.setInnerHtml(this.element,t.join(""))}},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(e,t,n,i,r){var s=t.start.row,l=new o(s,t.start.column,s,this.session.getScreenLastRowColumn(s));for(this.drawSingleLineMarker(e,l,n+" ace_start",i,1,r),s=t.end.row,l=new o(s,0,s,t.end.column),this.drawSingleLineMarker(e,l,n,i,0,r),s=t.start.row+1;s<t.end.row;s++)l.start.row=s,l.end.row=s,l.end.column=this.session.getScreenLastRowColumn(s),this.drawSingleLineMarker(e,l,n,i,1,r)},this.drawMultiLineMarker=function(e,t,o,n,i){var r=this.$padding,s=n.lineHeight,l=this.$getTop(t.start.row,n),a=r+t.start.column*n.characterWidth;i=i||"",e.push("<div class='",o," ace_start' style='","height:",s,"px;","right:0;","top:",l,"px;","left:",a,"px;",i,"'></div>"),l=this.$getTop(t.end.row,n);var c=t.end.column*n.characterWidth;e.push("<div class='",o,"' style='","height:",s,"px;","width:",c,"px;","top:",l,"px;","left:",r,"px;",i,"'></div>"),s=(t.end.row-t.start.row-1)*n.lineHeight,0>s||(l=this.$getTop(t.start.row+1,n),e.push("<div class='",o,"' style='","height:",s,"px;","right:0;","top:",l,"px;","left:",r,"px;",i,"'></div>"))},this.drawSingleLineMarker=function(e,t,o,n,i,r){var s=n.lineHeight,l=(t.end.column+(i||0)-t.start.column)*n.characterWidth,a=this.$getTop(t.start.row,n),c=this.$padding+t.start.column*n.characterWidth;e.push("<div class='",o,"' style='","height:",s,"px;","width:",l,"px;","top:",a,"px;","left:",c,"px;",r||"","'></div>")},this.drawFullLineMarker=function(e,t,o,n,i){var r=this.$getTop(t.start.row,n),s=n.lineHeight;t.start.row!=t.end.row&&(s+=this.$getTop(t.end.row,n)-r),e.push("<div class='",o,"' style='","height:",s,"px;","top:",r,"px;","left:0;right:0;",i||"","'></div>")},this.drawScreenLineMarker=function(e,t,o,n,i){var r=this.$getTop(t.start.row,n),s=n.lineHeight;e.push("<div class='",o,"' style='","height:",s,"px;","top:",r,"px;","left:0;right:0;",i||"","'></div>")}}).call(i.prototype),t.Marker=i}),define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(e,t){var o=e("../lib/oop"),n=e("../lib/dom"),i=e("../lib/lang"),r=e("../lib/useragent"),s=e("../lib/event_emitter").EventEmitter,l=function(e){this.element=n.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$characterSize={width:0,height:0},this.checkForSizeChanges(),this.$pollSizeChanges()
13
- };(function(){o.implement(this,s),this.EOF_CHAR="¶",this.EOL_CHAR="¬",this.TAB_CHAR="→",this.SPACE_CHAR="·",this.$padding=0,this.setPadding=function(e){this.$padding=e,this.element.style.padding="0 "+e+"px"},this.getLineHeight=function(){return this.$characterSize.height||0},this.getCharacterWidth=function(){return this.$characterSize.width||0},this.checkForSizeChanges=function(){var e=this.$measureSizes();if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$pollSizeChanges=function(){var e=this;this.$pollSizeChangesTimer=setInterval(function(){e.checkForSizeChanges()},500)},this.$fontStyles={fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},this.$measureSizes=r.isIE||r.isOldGecko?function(){var e=1e3;if(!this.$measureNode){var t=this.$measureNode=n.createElement("div"),o=t.style;if(o.width=o.height="auto",o.left=o.top=40*-e+"px",o.visibility="hidden",o.position="fixed",o.overflow="visible",o.whiteSpace="nowrap",t.innerHTML=i.stringRepeat("Xy",e),this.element.ownerDocument.body)this.element.ownerDocument.body.appendChild(t);else{for(var r=this.element.parentNode;!n.hasCssClass(r,"ace_editor");)r=r.parentNode;r.appendChild(t)}}if(!this.element.offsetWidth)return null;var o=this.$measureNode.style,s=n.computedStyle(this.element);for(var l in this.$fontStyles)o[l]=s[l];var a={height:this.$measureNode.offsetHeight,width:this.$measureNode.offsetWidth/(2*e)};return 0==a.width||0==a.height?null:a}:function(){if(!this.$measureNode){var e=this.$measureNode=n.createElement("div"),t=e.style;t.width=t.height="auto",t.left=t.top="-100px",t.visibility="hidden",t.position="fixed",t.overflow="visible",t.whiteSpace="nowrap",e.innerHTML=i.stringRepeat("X",100);for(var o=this.element.parentNode;o&&!n.hasCssClass(o,"ace_editor");)o=o.parentNode;if(!o)return this.$measureNode=null;o.appendChild(e)}var r=this.$measureNode.getBoundingClientRect(),s={height:r.height,width:r.width/100};return 0==s.width||0==s.height?null:s},this.setSession=function(e){this.session=e,this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(e){return this.showInvisibles==e?!1:(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var t=this.$tabStrings=[0],o=1;e+1>o;o++)this.showInvisibles?t.push("<span class='ace_invisible'>"+this.TAB_CHAR+i.stringRepeat(" ",o-1)+"</span>"):t.push(i.stringRepeat(" ",o));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var n="ace_indent-guide";if(this.showInvisibles){n+=" ace_invisible";var r=i.stringRepeat(this.SPACE_CHAR,this.tabSize),s=this.TAB_CHAR+i.stringRepeat(" ",this.tabSize-1)}else var r=i.stringRepeat(" ",this.tabSize),s=r;this.$tabStrings[" "]="<span class='"+n+"'>"+r+"</span>",this.$tabStrings[" "]="<span class='"+n+"'>"+s+"</span>"}},this.updateLines=function(e,t,o){(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)&&this.scrollLines(e),this.config=e;for(var i=Math.max(t,e.firstRow),r=Math.min(o,e.lastRow),s=this.element.childNodes,l=0,a=e.firstRow;i>a;a++){var c=this.session.getFoldLine(a);if(c){if(c.containsRow(i)){i=c.start.row;break}a=c.end.row}l++}for(var a=i,c=this.session.getNextFoldLine(a),u=c?c.start.row:1/0;a>u&&(a=c.end.row+1,c=this.session.getNextFoldLine(a,c),u=c?c.start.row:1/0),!(a>r);){var g=s[l++];if(g){var h=[];this.$renderLine(h,a,!this.$useLineGroups(),a==u?c:!1),n.setInnerHtml(g,h.join(""))}a++}},this.scrollLines=function(e){var t=this.config;if(this.config=e,!t||t.lastRow<e.firstRow)return this.update(e);if(e.lastRow<t.firstRow)return this.update(e);var o=this.element;if(t.firstRow<e.firstRow)for(var n=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);n>0;n--)o.removeChild(o.firstChild);if(t.lastRow>e.lastRow)for(var n=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);n>0;n--)o.removeChild(o.lastChild);if(e.firstRow<t.firstRow){var i=this.$renderLinesFragment(e,e.firstRow,t.firstRow-1);o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i)}if(e.lastRow>t.lastRow){var i=this.$renderLinesFragment(e,t.lastRow+1,e.lastRow);o.appendChild(i)}},this.$renderLinesFragment=function(e,t,o){for(var i=this.element.ownerDocument.createDocumentFragment(),r=t,s=this.session.getNextFoldLine(r),l=s?s.start.row:1/0;r>l&&(r=s.end.row+1,s=this.session.getNextFoldLine(r,s),l=s?s.start.row:1/0),!(r>o);){var a=n.createElement("div"),c=[];if(this.$renderLine(c,r,!1,r==l?s:!1),a.innerHTML=c.join(""),this.$useLineGroups())a.className="ace_line_group",i.appendChild(a);else for(var u=a.childNodes;u.length;)i.appendChild(u[0]);r++}return i},this.update=function(e){this.config=e;for(var t=[],o=e.firstRow,i=e.lastRow,r=o,s=this.session.getNextFoldLine(r),l=s?s.start.row:1/0;r>l&&(r=s.end.row+1,s=this.session.getNextFoldLine(r,s),l=s?s.start.row:1/0),!(r>i);)this.$useLineGroups()&&t.push("<div class='ace_line_group'>"),this.$renderLine(t,r,!1,r==l?s:!1),this.$useLineGroups()&&t.push("</div>"),r++;this.element=n.setInnerHtml(this.element,t.join(""))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,o,n){var r=this,s=/\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g,l=function(e,o,n,s){if(o)return r.showInvisibles?"<span class='ace_invisible'>"+i.stringRepeat(r.SPACE_CHAR,e.length)+"</span>":i.stringRepeat(" ",e.length);if("&"==e)return"&#38;";if("<"==e)return"&#60;";if(" "==e){var l=r.session.getScreenTabSize(t+s);return t+=l-1,r.$tabStrings[l]}if(" "==e){var a=r.showInvisibles?"ace_cjk ace_invisible":"ace_cjk",c=r.showInvisibles?r.SPACE_CHAR:"";return t+=1,"<span class='"+a+"' style='width:"+2*r.config.characterWidth+"px'>"+c+"</span>"}return n?"<span class='ace_invisible ace_invalid'>"+r.SPACE_CHAR+"</span>":(t+=1,"<span class='ace_cjk' style='width:"+2*r.config.characterWidth+"px'>"+e+"</span>")},a=n.replace(s,l);if(this.$textToken[o.type])e.push(a);else{var c="ace_"+o.type.replace(/\./g," ace_"),u="";"fold"==o.type&&(u=" style='width:"+o.value.length*this.config.characterWidth+"px;' "),e.push("<span class='",c,"'",u,">",a,"</span>")}return t+n.length},this.renderIndentGuide=function(e,t,o){var n=t.search(this.$indentGuideRe);return 0>=n||n>=o?t:" "==t[0]?(n-=n%this.tabSize,e.push(i.stringRepeat(this.$tabStrings[" "],n/this.tabSize)),t.substr(n)):" "==t[0]?(e.push(i.stringRepeat(this.$tabStrings[" "],n)),t.substr(n)):t},this.$renderWrappedLine=function(e,t,o,n){for(var i=0,r=0,s=o[0],l=0,a=0;a<t.length;a++){var c=t[a],u=c.value;if(0==a&&this.displayIndentGuides){if(i=u.length,u=this.renderIndentGuide(e,u,s),!u)continue;i-=u.length}if(i+u.length<s)l=this.$renderToken(e,l,c,u),i+=u.length;else{for(;i+u.length>=s;)l=this.$renderToken(e,l,c,u.substring(0,s-i)),u=u.substring(s-i),i=s,n||e.push("</div>","<div class='ace_line' style='height:",this.config.lineHeight,"px'>"),r++,l=0,s=o[r]||Number.MAX_VALUE;0!=u.length&&(i+=u.length,l=this.$renderToken(e,l,c,u))}}},this.$renderSimpleLine=function(e,t){var o=0,n=t[0],i=n.value;this.displayIndentGuides&&(i=this.renderIndentGuide(e,i)),i&&(o=this.$renderToken(e,o,n,i));for(var r=1;r<t.length;r++)n=t[r],i=n.value,o=this.$renderToken(e,o,n,i)},this.$renderLine=function(e,t,o,n){if(!n&&0!=n&&(n=this.session.getFoldLine(t)),n)var i=this.$getFoldLineTokens(t,n);else var i=this.session.getTokens(t);if(o||e.push("<div class='ace_line' style='height:",this.config.lineHeight,"px'>"),i.length){var r=this.session.getRowSplitData(t);r&&r.length?this.$renderWrappedLine(e,i,r,o):this.$renderSimpleLine(e,i)}this.showInvisibles&&(n&&(t=n.end.row),e.push("<span class='ace_invisible'>",t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,"</span>")),o||e.push("</div>")},this.$getFoldLineTokens=function(e,t){function o(e,t,o){for(var n=0,r=0;r+e[n].value.length<t;)if(r+=e[n].value.length,n++,n==e.length)return;if(r!=t){var s=e[n].value.substring(t-r);s.length>o-t&&(s=s.substring(0,o-t)),i.push({type:e[n].type,value:s}),r=t+s.length,n+=1}for(;o>r&&n<e.length;){var s=e[n].value;s.length+r>o?i.push({type:e[n].type,value:s.substring(0,o-r)}):i.push(e[n]),r+=s.length,n+=1}}var n=this.session,i=[],r=n.getTokens(e);return t.walk(function(e,t,s,l,a){null!=e?i.push({type:"fold",value:e}):(a&&(r=n.getTokens(t)),r.length&&o(r,l,s))},t.end.row,this.session.getLine(t.end.row).length),i},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$measureNode&&this.$measureNode.parentNode.removeChild(this.$measureNode),delete this.$measureNode}}).call(l.prototype),t.Text=l}),define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t){var o=e("../lib/dom"),n=function(e){this.element=o.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),o.addCssClass(this.element,"ace_hidden-cursors")};(function(){this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,e?o.addCssClass(this.element,"ace_smooth-blinking"):o.removeCssClass(this.element,"ace_smooth-blinking"),this.restartTimer())},this.addCursor=function(){var e=o.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,o.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,o.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.smoothBlinking&&o.removeCssClass(this.element,"ace_smooth-blinking");for(var e=this.cursors.length;e--;)this.cursors[e].style.opacity="";if(this.isBlinking&&this.blinkInterval&&this.isVisible){this.smoothBlinking&&setTimeout(function(){o.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));var t=function(){this.timeoutId=setTimeout(function(){for(var e=this.cursors.length;e--;)this.cursors[e].style.opacity=0}.bind(this),.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){for(var e=this.cursors.length;e--;)this.cursors[e].style.opacity="";t()}.bind(this),this.blinkInterval),t()}},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var o=this.session.documentToScreenPosition(e),n=this.$padding+o.column*this.config.characterWidth,i=(o.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:n,top:i}},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,o=0,n=0;(void 0===t||0===t.length)&&(t=[{cursor:null}]);for(var o=0,i=t.length;i>o;o++){var r=this.getPixelPosition(t[o].cursor,!0);if(!((r.top>e.height+e.offset||r.top<-e.offset)&&o>1)){var s=(this.cursors[n++]||this.addCursor()).style;s.left=r.left+"px",s.top=r.top+"px",s.width=e.characterWidth+"px",s.height=e.lineHeight+"px"}}for(;this.cursors.length>n;)this.removeCursor();var l=this.session.getOverwrite();this.$setOverwrite(l),this.$pixelPos=r,this.restartTimer()},this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?o.addCssClass(this.element,"ace_overwrite-cursors"):o.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(n.prototype),t.Cursor=n}),define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t){var o=e("./lib/oop"),n=e("./lib/dom"),i=e("./lib/event"),r=e("./lib/event_emitter").EventEmitter,s=function(e,t){this.element=n.createElement("div"),this.element.className="ace_scrollbar",this.inner=n.createElement("div"),this.inner.className="ace_scrollbar-inner",this.element.appendChild(this.inner),e.appendChild(this.element),t.$scrollbarWidth=this.width=n.scrollbarWidth(e.ownerDocument),t.$scrollbarWidth=this.width=n.scrollbarWidth(e.ownerDocument),this.fullWidth=this.width,this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.setVisible(!1),this.element.style.overflowY="scroll",i.addListener(this.element,"scroll",this.onScrollV.bind(this)),i.addListener(this.element,"mousedown",i.preventDefault)},l=function(e,t){this.element=n.createElement("div"),this.element.className="ace_scrollbar-h",this.inner=n.createElement("div"),this.inner.className="ace_scrollbar-inner",this.element.appendChild(this.inner),e.appendChild(this.element),this.height=t.$scrollbarWidth,this.fullHeight=this.height,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px",this.setVisible(!1),this.element.style.overflowX="scroll",i.addListener(this.element,"scroll",this.onScrollH.bind(this)),i.addListener(this.element,"mousedown",i.preventDefault)};(function(){o.implement(this,r),this.setVisible=function(e){e?(this.element.style.display="",this.fullWidth&&(this.width=this.fullWidth),this.fullHeight&&(this.height=this.fullHeight)):(this.element.style.display="none",this.height=this.width=0)},this.onScrollV=function(){this.skipEvent||(this.scrollTop=this.element.scrollTop,this._emit("scroll",{data:this.scrollTop})),this.skipEvent=!1},this.onScrollH=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getWidth=function(){return this.width},this.getHeight=function(){return this.height},this.setHeight=function(e){this.element.style.height=e+"px"},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerHeight=function(e){this.inner.style.height=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=this.element.scrollTop=e)},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}).call(s.prototype),l.prototype=s.prototype,t.ScrollBar=s,t.ScrollBarV=s,t.ScrollBarH=l}),define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t){var o=e("./lib/event"),n=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.window=t||window};(function(){this.schedule=function(e){if(this.changes=this.changes|e,!this.pending){this.pending=!0;var t=this;o.nextFrame(function(){t.pending=!1;for(var e;e=t.changes;)t.changes=0,t.onRender(e)},this.window)}}}).call(n.prototype),t.RenderLoop=n}),define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(e,t){function o(e,t,o){return p.$options.wrap=!0,p.$options.needle=t,p.$options.backwards=-1==o,p.find(e)}function n(e,t){return e.row==t.row&&e.column==t.column}function i(e){e.$multiselectOnSessionChange||(e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",c),e.commands.addCommands(h.defaultCommands),r(e))}function r(e){function t(){n&&(e.renderer.setMouseCursor(""),n=!1)}var o=e.textInput.getElement(),n=!1;u.addListener(o,"keydown",function(o){18!=o.keyCode||o.ctrlKey||o.shiftKey||o.metaKey?n&&t():n||(e.renderer.setMouseCursor("crosshair"),n=!0)}),u.addListener(o,"keyup",t),u.addListener(o,"blur",t)}var s=e("./range_list").RangeList,l=e("./range").Range,a=e("./selection").Selection,c=e("./mouse/multi_select_handler").onMouseDown,u=e("./lib/event"),g=e("./lib/lang"),h=e("./commands/multi_select_commands");t.commands=h.defaultCommands.concat(h.multiSelectCommands);var d=e("./search").Search,p=new d,f=e("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(f.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(e){if(!this.inMultiSelectMode&&0==this.rangeCount){var o=this.toOrientedRange();if(this.rangeList.add(o),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(o),this.$onAddRange(o)}e.cursor||(e.cursor=e.end);var n=this.rangeList.add(e);return this.$onAddRange(e),n.length&&this.$onRemoveRange(n),this.rangeCount>1&&!this.inMultiSelectMode&&(this._emit("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);return t?(this.$onRemoveRange(t),t[0]):void 0},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length?this.$onRemoveRange(e):this.ranges[0]&&this.fromOrientedRange(this.ranges[0])},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._emit("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var o=e.length;o--;){var n=this.ranges.indexOf(e[o]);this.ranges.splice(n,1)}this._emit("removeRange",{ranges:e}),0==this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._emit("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new s,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],o=l.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(o,t.cursor==t.start)}else{var o=this.getRange(),n=this.isBackwards(),i=o.start.row,r=o.end.row;if(i==r){if(n)var s=o.end,a=o.start;else var s=o.start,a=o.end;return this.addRange(l.fromPoints(a,a)),this.addRange(l.fromPoints(s,s)),void 0}var c=[],u=this.getLineRange(i,!0);u.start.column=o.start.column,c.push(u);for(var g=i+1;r>g;g++)c.push(this.getLineRange(g,!0));u=this.getLineRange(r,!0),u.end.column=o.end.column,c.push(u),c.forEach(this.addRange,this)}},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],o=l.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(o,t.cursor==t.start)}else{var n=this.session.documentToScreenPosition(this.selectionLead),i=this.session.documentToScreenPosition(this.selectionAnchor),r=this.rectangularRangeBlock(n,i);r.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,o){var i=[],r=e.column<t.column;if(r)var s=e.column,a=t.column;else var s=t.column,a=e.column;var c=e.row<t.row;if(c)var u=e.row,g=t.row;else var u=t.row,g=e.row;0>s&&(s=0),0>u&&(u=0),u==g&&(o=!0);for(var h=u;g>=h;h++){var d=l.fromPoints(this.session.screenToDocumentPosition(h,s),this.session.screenToDocumentPosition(h,a));if(d.isEmpty()){if(p&&n(d.end,p))break;var p=d.end}d.cursor=r?d.start:d.end,i.push(d)}if(c&&i.reverse(),!o){for(var f=i.length-1;i[f].isEmpty()&&f>0;)f--;if(f>0)for(var m=0;i[m].isEmpty();)m++;for(var y=f;y>=m;y--)i[y].isEmpty()&&i.splice(y,1)}return i}}.call(a.prototype);var m=e("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);-1!=t&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var t=this.session.$selectionMarkers,o=e.length;o--;){var n=e[o];if(n.marker){this.session.removeMarker(n.marker);var i=t.indexOf(n);-1!=i&&t.splice(i,1)}}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(h.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(h.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onMultiSelectExec=function(e){var t=e.command,o=e.editor;if(o.multiSelect){if(t.multiSelectAction)"forEach"==t.multiSelectAction?n=o.forEachSelection(t,e.args):"forEachLine"==t.multiSelectAction?n=o.forEachSelection(t,e.args,!0):"single"==t.multiSelectAction?(o.exitMultiSelectMode(),n=t.exec(o,e.args||{})):n=t.multiSelectAction(o,e.args||{});else{var n=t.exec(o,e.args||{});o.multiSelect.addRange(o.multiSelect.toOrientedRange()),o.multiSelect.mergeOverlappingRanges()}return n}},this.forEachSelection=function(e,t,o){if(!this.inVirtualSelectionMode){var n,i=this.session,r=this.selection,s=r.rangeList,l=r._eventRegistry;r._eventRegistry={};var c=new a(i);this.inVirtualSelectionMode=!0;for(var u=s.ranges.length;u--;){if(o)for(;u>0&&s.ranges[u].start.row==s.ranges[u-1].end.row;)u--;c.fromOrientedRange(s.ranges[u]),this.selection=i.selection=c;var g=e.exec(this,t||{});void 0==!n&&(n=g),c.toOrientedRange(s.ranges[u])}c.detach(),this.selection=i.selection=r,this.inVirtualSelectionMode=!1,r._eventRegistry=l,r.mergeOverlappingRanges();var h=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),h&&h.from==h.to&&this.renderer.animateScrolling(h.from),n}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var t=this.multiSelect.rangeList.ranges,o=[],n=0;n<t.length;n++)o.push(this.session.getTextRange(t[n]));var i=this.session.getDocument().getNewLineCharacter();e=o.join(i),e.length==(o.length-1)*i.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.onPaste=function(e){if(!this.$readOnly){if(this._signal("paste",e),!this.inMultiSelectMode||this.inVirtualSelectionMode)return this.insert(e);var t=e.split(/\r\n|\r|\n/),o=this.selection.rangeList.ranges;if(t.length>o.length||t.length<2||!t[1])return this.commands.exec("insertstring",this,e);for(var n=o.length;n--;){var i=o[n];i.isEmpty()||this.session.remove(i),this.session.insert(i.start,t[n])}}},this.findAll=function(e,t,o){t=t||{},t.needle=e||t.needle,this.$search.set(t);var n=this.$search.findAll(this.session);if(!n.length)return 0;this.$blockScrolling+=1;var i=this.multiSelect;o||i.toSingleRange(n[0]);for(var r=n.length;r--;)i.addRange(n[r],!0);return this.$blockScrolling-=1,n.length},this.selectMoreLines=function(e,t){var o=this.selection.toOrientedRange(),n=o.cursor==o.end,i=this.session.documentToScreenPosition(o.cursor);this.selection.$desiredColumn&&(i.column=this.selection.$desiredColumn);var r=this.session.screenToDocumentPosition(i.row+e,i.column);if(o.isEmpty())var s=r;else var a=this.session.documentToScreenPosition(n?o.end:o.start),s=this.session.screenToDocumentPosition(a.row+e,a.column);if(n){var c=l.fromPoints(r,s);c.cursor=c.start}else{var c=l.fromPoints(s,r);c.cursor=c.end}if(c.desiredColumn=i.column,this.selection.inMultiSelectMode){if(t)var u=o.cursor}else this.selection.addRange(o);this.selection.addRange(c),u&&this.selection.substractPoint(u)},this.transposeSelections=function(e){for(var t=this.session,o=t.multiSelect,n=o.ranges,i=n.length;i--;){var r=n[i];if(r.isEmpty()){var s=t.getWordRange(r.start.row,r.start.column);r.start.row=s.start.row,r.start.column=s.start.column,r.end.row=s.end.row,r.end.column=s.end.column}}o.mergeOverlappingRanges();for(var l=[],i=n.length;i--;){var r=n[i];l.unshift(t.getTextRange(r))}0>e?l.unshift(l.pop()):l.push(l.shift());for(var i=n.length;i--;){var r=n[i],s=r.clone();t.replace(r,l[i]),r.start.row=s.start.row,r.start.column=s.start.column}},this.selectMore=function(e,t){var n=this.session,i=n.multiSelect,r=i.toOrientedRange();if(r.isEmpty()){var r=n.getWordRange(r.start.row,r.start.column);return r.cursor=-1==e?r.start:r.end,this.multiSelect.addRange(r),void 0}var s=n.getTextRange(r),l=o(n,s,e);l&&(l.cursor=-1==e?l.start:l.end,this.multiSelect.addRange(l)),t&&this.multiSelect.substractPoint(r.cursor)},this.alignCursors=function(){var e=this.session,t=e.multiSelect,o=t.ranges;if(o.length){var n=-1,i=o.filter(function(e){return e.cursor.row==n?!0:(n=e.cursor.row,void 0)});t.$onRemoveRange(i);var r=0,s=1/0,a=o.map(function(t){var o=t.cursor,n=e.getLine(o.row),i=n.substr(o.column).search(/\S/g);return-1==i&&(i=0),o.column>r&&(r=o.column),s>i&&(s=i),i});o.forEach(function(t,o){var n=t.cursor,i=r-n.column,c=a[o]-s;i>c?e.insert(n,g.stringRepeat(" ",i-c)):e.remove(new l(n.row,n.column,n.row,n.column-i+c)),t.start.column=t.end.column=r,t.start.row=t.end.row=n.row,t.cursor=t.end}),t.fromOrientedRange(o[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var c=this.selection.getRange(),u=c.start.row,h=c.end.row,d=this.session.doc.removeLines(u,h);d=this.$reAlignText(d),this.session.doc.insertLines(u,d),c.start.column=0,c.end.column=d[d.length-1].length,this.selection.setRange(c)}},this.$reAlignText=function(e){function t(e){return g.stringRepeat(" ",e)}function o(e){return e[2]?t(r)+e[2]+t(s-e[2].length+l)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function n(e){return e[2]?t(r+s-e[2].length)+e[2]+t(l," ")+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function i(e){return e[2]?t(r)+e[2]+t(l)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}var r,s,l,a=!0,c=!0;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?null==r?(r=t[1].length,s=t[2].length,l=t[3].length,t):(r+s+l!=t[1].length+t[2].length+t[3].length&&(c=!1),r!=t[1].length&&(a=!1),r>t[1].length&&(r=t[1].length),s<t[2].length&&(s=t[2].length),l>t[3].length&&(l=t[3].length),t):[e]}).map(a?c?n:o:i)}}).call(m.prototype),t.onSessionChange=function(e){var t=e.session;t.multiSelect||(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t.multiSelect;var o=e.oldSession;o&&(o.multiSelect.removeEventListener("addRange",this.$onAddRange),o.multiSelect.removeEventListener("removeRange",this.$onRemoveRange),o.multiSelect.removeEventListener("multiSelect",this.$onMultiSelect),o.multiSelect.removeEventListener("singleSelect",this.$onSingleSelect)),t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=i,e("./config").defineOptions(m.prototype,"editor",{enableMultiselect:{set:function(e){i(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",c)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",c))},value:!0}})}),define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event"],function(e,t){function o(e,t){return e.row==t.row&&e.column==t.column}function n(e){var t=e.domEvent,n=t.altKey,r=t.shiftKey,s=e.getAccelKey(),l=e.getButton();if(e.editor.inMultiSelectMode&&2==l)return e.editor.textInput.onContextMenu(e.domEvent),void 0;if(!s&&!n)return 0==l&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode(),void 0;var a=e.editor,c=a.selection,u=a.inMultiSelectMode,g=e.getDocumentPosition(),h=c.getCursor(),d=e.inSelection()||c.isEmpty()&&o(g,h),p=e.x,f=e.y,m=function(e){p=e.clientX,f=e.clientY},y=function(){var e=a.renderer.pixelToScreenCoordinates(p,f),t=_.screenToDocumentPosition(e.row,e.column);o(E,e)&&o(t,c.selectionLead)||(E=e,a.selection.moveCursorToPosition(t),a.selection.clearSelection(),a.renderer.scrollCursorIntoView(),a.removeSelectionMarkers(B),B=c.rectangularRangeBlock(E,v),B.forEach(a.addSelectionMarker,a),a.updateSelectionMarkers())},_=a.session,v=a.renderer.pixelToScreenCoordinates(p,f),E=v;if(!s||r||n||0!=l){if(n&&0==l){e.stop(),u&&!s?c.toSingleRange():!u&&s&&c.addRange();var B=[];r?(v=_.documentToScreenPosition(c.lead),y()):(c.moveCursorToPosition(g),c.clearSelection());var C=function(){clearInterval(b),a.removeSelectionMarkers(B);for(var e=0;e<B.length;e++)c.addRange(B[e])},k=y;i.capture(a.container,m,C);var b=setInterval(function(){k()},20);return e.preventDefault()}}else{if(!u&&d)return;if(!u){var A=c.toOrientedRange();a.addSelectionMarker(A)}var T=c.rangeList.rangeAtPoint(g);a.once("mouseup",function(){var e=c.toOrientedRange();T&&e.isEmpty()&&o(T.cursor,e.cursor)?c.substractPoint(e.cursor):(A&&(a.removeSelectionMarker(A),c.addRange(A)),c.addRange(e))})}}var i=e("../lib/event");t.onMouseDown=n}),define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,t){t.defaultCommands=[{name:"addCursorAbove",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},readonly:!0},{name:"addCursorBelow",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},readonly:!0},{name:"addCursorAboveSkipCurrent",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},readonly:!0},{name:"addCursorBelowSkipCurrent",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},readonly:!0},{name:"selectMoreBefore",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},readonly:!0},{name:"selectMoreAfter",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},readonly:!0},{name:"selectNextBefore",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},readonly:!0},{name:"selectNextAfter",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},readonly:!0},{name:"splitIntoLines",exec:function(e){e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readonly:!0},{name:"alignCursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"}}],t.multiSelectCommands=[{name:"singleSelection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()
14
- },readonly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}];var o=e("../keyboard/hash_handler").HashHandler;t.keyboardHandler=new o(t.multiSelectCommands)}),define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/config"],function(e,t){var o=e("../lib/oop"),n=e("../lib/event_emitter").EventEmitter,i=e("../config"),r=function(t,o,n){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.onError=this.onError.bind(this),e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl);var r;if(i.get("packaged")||!e.toUrl)r=i.moduleUrl(o,"worker");else{var s=this.$normalizePath;r=s(e.toUrl("ace/worker/worker.js",null,"_"));var l={};t.forEach(function(t){l[t]=s(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}this.$worker=new Worker(r),this.$worker.postMessage({init:!0,tlns:l,module:o,classname:n}),this.callbackId=1,this.callbacks={},this.$worker.onerror=this.onError,this.$worker.onmessage=this.onMessage};(function(){o.implement(this,n),this.onError=function(e){throw window.console&&console.log&&console.log(e),e},this.onMessage=function(e){var t=e.data;switch(t.type){case"log":window.console&&console.log&&console.log.apply(console,t.data);break;case"event":this._emit(t.name,{data:t.data});break;case"call":var o=this.callbacks[t.id];o&&(o(t.data),delete this.callbacks[t.id])}},this.$normalizePath=function(e){return location.host?(e=e.replace(/^[a-z]+:\/\/[^\/]+/,""),e=location.protocol+"//"+location.host+("/"==e.charAt(0)?"":location.pathname.replace(/\/[^\/]*$/,""))+"/"+e.replace(/^[\/]+/,"")):e},this.terminate=function(){this._emit("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker=null,this.$doc.removeEventListener("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,o){if(o){var n=this.callbackId++;this.callbacks[n]=o,t.push(n)}this.send(e,t)},this.emit=function(e,t){try{this.$worker.postMessage({event:e,data:{data:t.data}})}catch(o){}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener)},this.changeListener=function(e){this.deltaQueue?this.deltaQueue.push(e.data):(this.deltaQueue=[e.data],setTimeout(this.$sendDeltaQueue,1))},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>20&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(r.prototype);var s=function(e,t,o){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.callbackId=1,this.callbacks={},this.messageBuffer=[];var r=null,s=Object.create(n),l=this;this.$worker={},this.$worker.terminate=function(){},this.$worker.postMessage=function(e){l.messageBuffer.push(e),r&&setTimeout(a)};var a=function(){var e=l.messageBuffer.shift();e.command?r[e.command].apply(r,e.args):e.event&&s._emit(e.event,e.data)};s.postMessage=function(e){l.onMessage({data:e})},s.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},s.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},i.loadModule(["worker",t],function(e){for(r=new e[o](s);l.messageBuffer.length;)a()})};s.prototype=r.prototype,t.UIWorkerClient=s,t.WorkerClient=r}),define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t){var o=e("./range").Range,n=e("./lib/event_emitter").EventEmitter,i=e("./lib/oop"),r=function(e,t,o,n,i,r){var s=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=i,this.othersClass=r,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=n,this.$onCursorChange=function(){setTimeout(function(){s.onCursorChange()})},this.$pos=o;var l=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=l.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){i.implement(this,n),this.setup=function(){var e=this,t=this.doc,n=this.session,i=this.$pos;this.pos=t.createAnchor(i.row,i.column),this.markerId=n.addMarker(new o(i.row,i.column,i.row,i.column+this.length),this.mainClass,null,!1),this.pos.on("change",function(t){n.removeMarker(e.markerId),e.markerId=n.addMarker(new o(t.value.row,t.value.column,t.value.row,t.value.column+e.length),e.mainClass,null,!1)}),this.others=[],this.$others.forEach(function(o){var n=t.createAnchor(o.row,o.column);e.others.push(n)}),n.setUndoSelect(!1)},this.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new o(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1),n.on("change",function(i){e.removeMarker(n.markerId),n.markerId=e.addMarker(new o(i.value.row,i.value.column,i.value.row,i.value.column+t.length),t.othersClass,null,!1)})})}},this.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},this.onUpdate=function(e){var t=e.data,n=t.range;if(n.start.row===n.end.row&&n.start.row===this.pos.row&&!this.$updating){this.$updating=!0;var i="insertText"===t.action?n.end.column-n.start.column:n.start.column-n.end.column;if(n.start.column>=this.pos.column&&n.start.column<=this.pos.column+this.length+1){var r=n.start.column-this.pos.column;if(this.length+=i,!this.session.$fromUndo){if("insertText"===t.action)for(var s=this.others.length-1;s>=0;s--){var l=this.others[s],a={row:l.row,column:l.column+r};l.row===n.start.row&&n.start.column<l.column&&(a.column+=i),this.doc.insert(a,t.text)}else if("removeText"===t.action)for(var s=this.others.length-1;s>=0;s--){var l=this.others[s],a={row:l.row,column:l.column+r};l.row===n.start.row&&n.start.column<l.column&&(a.column+=i),this.doc.remove(new o(a.row,a.column,a.row,a.column-i))}n.start.column===this.pos.column&&"insertText"===t.action?setTimeout(function(){this.pos.setPosition(this.pos.row,this.pos.column-i);for(var e=0;e<this.others.length;e++){var t=this.others[e],o={row:t.row,column:t.column-i};t.row===n.start.row&&n.start.column<t.column&&(o.column+=i),t.setPosition(o.row,o.column)}}.bind(this),0):n.start.column===this.pos.column&&"removeText"===t.action&&setTimeout(function(){for(var e=0;e<this.others.length;e++){var t=this.others[e];t.row===n.start.row&&n.start.column<t.column&&t.setPosition(t.row,t.column-i)}}.bind(this),0)}this.pos._emit("change",{value:this.pos});for(var s=0;s<this.others.length;s++)this.others[s]._emit("change",{value:this.others[s]})}this.$updating=!1}},this.onCursorChange=function(e){if(!this.$updating){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},this.detach=function(){this.session.removeMarker(this.markerId),this.hideOtherMarkers(),this.doc.removeEventListener("change",this.$onUpdate),this.session.selection.removeEventListener("changeCursor",this.$onCursorChange),this.pos.detach();for(var e=0;e<this.others.length;e++)this.others[e].detach();this.session.setUndoSelect(!0)},this.cancel=function(){if(-1===this.$undoStackDepth)throw Error("Canceling placeholders only supported with undo manager attached to session.");for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,o=0;t>o;o++)e.undo(!0)}}).call(r.prototype),t.PlaceHolder=r}),define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t){var o=e("../../range").Range,n=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,o){var n=e.getLine(o);return this.foldingStartMarker.test(n)?"start":"markbeginend"==t&&this.foldingStopMarker&&this.foldingStopMarker.test(n)?"end":""},this.getFoldWidgetRange=function(){return null},this.indentationBlock=function(e,t,n){var i=/\S/,r=e.getLine(t),s=r.search(i);if(-1!=s){for(var l=n||r.length,a=e.getLength(),c=t,u=t;++t<a;){var g=e.getLine(t).search(i);if(-1!=g){if(s>=g)break;u=t}}if(u>c){var h=e.getLine(u).length;return new o(c,l,u,h)}}},this.openingBracketBlock=function(e,t,n,i,r){var s={row:n,column:i+1},l=e.$findClosingBracket(t,s,r);if(l){var a=e.foldWidgets[l.row];return null==a&&(a=this.getFoldWidget(e,l.row)),"start"==a&&l.row>s.row&&(l.row--,l.column=e.getLine(l.row).length),o.fromPoints(s,l)}},this.closingBracketBlock=function(e,t,n,i){var r={row:n,column:i},s=e.$findOpeningBracket(t,r);if(s)return s.column++,r.column--,o.fromPoints(s,r)}}).call(n.prototype)}),define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],function(e,t){t.isDark=!1,t.cssClass="ace-tm",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;border-radius: 2px;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}';var o=e("../lib/dom");o.importCssString(t.cssText,t.cssClass)}),function(){window.require(["ace/ace"],function(e){e&&e.config.init(),window.ace||(window.ace={});for(var t in e)e.hasOwnProperty(t)&&(ace[t]=e[t])})}(),define("ace/theme/clouds",["require","exports","module","ace/lib/dom"],function(e,t){t.isDark=!1,t.cssClass="ace-clouds",t.cssText='.ace-clouds .ace_gutter {background: #ebebeb;color: #333}.ace-clouds .ace_print-margin {width: 1px;background: #e8e8e8}.ace-clouds {background-color: #FFFFFF;color: #000000}.ace-clouds .ace_cursor {color: #000000}.ace-clouds .ace_marker-layer .ace_selection {background: #BDD5FC}.ace-clouds.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;border-radius: 2px}.ace-clouds .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-clouds .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #BFBFBF}.ace-clouds .ace_marker-layer .ace_active-line {background: #FFFBD1}.ace-clouds .ace_gutter-active-line {background-color : #dcdcdc}.ace-clouds .ace_marker-layer .ace_selected-word {border: 1px solid #BDD5FC}.ace-clouds .ace_invisible {color: #BFBFBF}.ace-clouds .ace_keyword,.ace-clouds .ace_meta,.ace-clouds .ace_support.ace_constant.ace_property-value {color: #AF956F}.ace-clouds .ace_keyword.ace_operator {color: #484848}.ace-clouds .ace_keyword.ace_other.ace_unit {color: #96DC5F}.ace-clouds .ace_constant.ace_language {color: #39946A}.ace-clouds .ace_constant.ace_numeric {color: #46A609}.ace-clouds .ace_constant.ace_character.ace_entity {color: #BF78CC}.ace-clouds .ace_invalid {background-color: #FF002A}.ace-clouds .ace_fold {background-color: #AF956F;border-color: #000000}.ace-clouds .ace_storage,.ace-clouds .ace_support.ace_class,.ace-clouds .ace_support.ace_function,.ace-clouds .ace_support.ace_other,.ace-clouds .ace_support.ace_type {color: #C52727}.ace-clouds .ace_string {color: #5D90CD}.ace-clouds .ace_comment {color: #BCC8BA}.ace-clouds .ace_entity.ace_name.ace_tag,.ace-clouds .ace_entity.ace_other.ace_attribute-name {color: #606060}.ace-clouds .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y}';var o=e("../lib/dom");o.importCssString(t.cssText,t.cssClass)}),define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/coffee"],function(e,t){var o=e("../lib/oop"),n=e("./text").Mode,i=(e("../tokenizer").Tokenizer,e("./ruby_highlight_rules").RubyHighlightRules),r=e("./matching_brace_outdent").MatchingBraceOutdent,s=e("../range").Range,l=e("./folding/coffee").FoldMode,a=function(){this.HighlightRules=i,this.$outdent=new r,this.foldingRules=new l};o.inherits(a,n),function(){this.lineCommentStart="#",this.getNextLineIndent=function(e,t,o){var n=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),r=i.tokens;if(r.length&&"comment"==r[r.length-1].type)return n;if("start"==e){var s=t.match(/^.*[\{\(\[]\s*$/),l=t.match(/^\s*(class|def)\s.*$/),a=t.match(/.*do(\s*|\s+\|.*\|\s*)$/),c=t.match(/^\s*(if|else)\s*/);(s||l||a||c)&&(n+=o)}return n},this.checkOutdent=function(e,t,o){return/^\s+end$/.test(t+o)||/^\s+}$/.test(t+o)||/^\s+else$/.test(t+o)},this.autoOutdent=function(e,t,o){var n=this.$getIndent(t.getLine(o)),i=t.getTabString();n.slice(-i.length)==i&&t.remove(new s(o,n.length-i.length,o,n.length))}}.call(a.prototype),t.Mode=a}),define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t){var o=e("../lib/oop"),n=e("./text_highlight_rules").TextHighlightRules,i=t.constantOtherSymbol={token:"constant.other.symbol.ruby",regex:"[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"},r=t.qString={token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},s=t.qqString={token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},l=t.tString={token:"string",regex:"[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"},a=t.constantNumericHex={token:"constant.numeric",regex:"0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"},c=t.constantNumericFloat={token:"constant.numeric",regex:"[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"},u=function(){var e="abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|validates_inclusion_of|validates_numericality_of|validates_with|validates_each|authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|cache|expire_fragment|expire_cache_for|observe|cache_sweeper|has_many|has_one|belongs_to|has_and_belongs_to_many",t="alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield",o="true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING",n="$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|$!|root_url|flash|session|cookies|params|request|response|logger|self",u=this.$keywords=this.createKeywordMapper({keyword:t,"constant.language":o,"variable.language":n,"support.function":e,"invalid.deprecated":"debugger"},"identifier");this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin(?:$|\\s.*$)",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},r,s,l,{token:"text",regex:"::"},{token:"variable.instance",regex:"@{1,2}[a-zA-Z_\\d]+"},{token:"support.class",regex:"[A-Z][a-zA-Z_\\d]+"},i,a,c,{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:u,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"punctuation.separator.key-value",regex:"=>"},{stateName:"heredoc",onMatch:function(e,t,o){var n="-"==e[2]?"indentedHeredoc":"heredoc",i=e.split(this.splitRegex);return o.push(n,i[3]),[{type:"constant",value:i[1]},{type:"string",value:i[2]},{type:"support.class",value:i[3]},{type:"string",value:i[4]}]},regex:"(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",rules:{heredoc:[{onMatch:function(e,t,o){return e==o[1]?(o.shift(),o.shift(),"support.class"):"string"},regex:".*$",next:"start"}],indentedHeredoc:[{token:"string",regex:"^ +"},{onMatch:function(e,t,o){return e==o[1]?(o.shift(),o.shift(),"support.class"):"string"},regex:".*$",next:"start"}]}},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:"^=end(?:$|\\s.*$)",next:"start"},{token:"comment",regex:".+"}]},this.normalizeRules()};o.inherits(u,n),t.RubyHighlightRules=u}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t){var o=e("../range").Range,n=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var r=i[1].length,s=e.findMatchingBracket({row:t,column:r});if(!s||s.row==t)return 0;var l=this.$getIndent(e.getLine(s.row));e.replace(new o(t,0,t,r-1),l)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(n.prototype),t.MatchingBraceOutdent=n}),define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t){var o=e("../../lib/oop"),n=e("./fold_mode").FoldMode,i=e("../../range").Range,r=t.FoldMode=function(){};o.inherits(r,n),function(){this.getFoldWidgetRange=function(e,t,o){var n=this.indentationBlock(e,o);if(n)return n;var r=/\S/,s=e.getLine(o),l=s.search(r);if(-1!=l&&"#"==s[l]){for(var a=s.length,c=e.getLength(),u=o,g=o;++o<c;){s=e.getLine(o);var h=s.search(r);if(-1!=h){if("#"!=s[h])break;g=o}}if(g>u){var d=e.getLine(g).length;return new i(u,a,g,d)}}},this.getFoldWidget=function(e,t,o){var n=e.getLine(o),i=n.search(/\S/),r=e.getLine(o+1),s=e.getLine(o-1),l=s.search(/\S/),a=r.search(/\S/);if(-1==i)return e.foldWidgets[o-1]=-1!=l&&a>l?"start":"","";if(-1==l){if(i==a&&"#"==n[i]&&"#"==r[i])return e.foldWidgets[o-1]="",e.foldWidgets[o+1]="","start"}else if(l==i&&"#"==n[i]&&"#"==s[i]&&-1==e.getLine(o-2).search(/\S/))return e.foldWidgets[o-1]="start",e.foldWidgets[o+1]="","";return e.foldWidgets[o-1]=-1!=l&&i>l?"start":"",a>i?"start":""}}.call(r.prototype)}),!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e,t=document.createElement("bootstrap"),o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(e in o)if(void 0!==t.style[e])return o[e]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',o=function(o){e(o).on("click",t,this.close)};o.prototype.close=function(t){function o(){n.trigger("closed").remove()}var n,i=e(this),r=i.attr("data-target");r||(r=i.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),n=e(r),t&&t.preventDefault(),n.length||(n=i.hasClass("alert")?i:i.parent()),n.trigger(t=e.Event("close")),t.isDefaultPrevented()||(n.removeClass("in"),e.support.transition&&n.hasClass("fade")?n.on(e.support.transition.end,o):o())};var n=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var n=e(this),i=n.data("alert");i||n.data("alert",i=new o(this)),"string"==typeof t&&i[t].call(n)})},e.fn.alert.Constructor=o,e.fn.alert.noConflict=function(){return e.fn.alert=n,this},e(document).on("click.alert.data-api",t,o.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,o){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,o)};t.prototype.setState=function(e){var t="disabled",o=this.$element,n=o.data(),i=o.is("input")?"val":"html";e+="Text",n.resetText||o.data("resetText",o[i]()),o[i](n[e]||this.options[e]),setTimeout(function(){"loadingText"==e?o.addClass(t).attr(t,t):o.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var o=e.fn.button;e.fn.button=function(o){return this.each(function(){var n=e(this),i=n.data("button"),r="object"==typeof o&&o;i||n.data("button",i=new t(this,r)),"toggle"==o?i.toggle():o&&i.setState(o)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=o,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var o=e(t.target);o.hasClass("btn")||(o=o.closest(".btn")),o.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,o){this.$element=e(t),this.options=o,"hover"==this.options.pause&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},to:function(t){var o=this.$element.find(".item.active"),n=o.parent().children(),i=n.index(o),r=this;if(!(t>n.length-1||0>t))return this.sliding?this.$element.one("slid",function(){r.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",e(n[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle()),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(t,o){var n,i=this.$element.find(".item.active"),r=o||i[t](),s=this.interval,l="next"==t?"left":"right",a="next"==t?"first":"last",c=this;if(this.sliding=!0,s&&this.pause(),r=r.length?r:this.$element.find(".item")[a](),n=e.Event("slide",{relatedTarget:r[0]}),!r.hasClass("active")){if(e.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(n),n.isDefaultPrevented())return;r.addClass(t),r[0].offsetWidth,i.addClass(l),r.addClass(l),this.$element.one(e.support.transition.end,function(){r.removeClass([t,l].join(" ")).addClass("active"),i.removeClass(["active",l].join(" ")),c.sliding=!1,setTimeout(function(){c.$element.trigger("slid")},0)})}else{if(this.$element.trigger(n),n.isDefaultPrevented())return;i.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}}};var o=e.fn.carousel;e.fn.carousel=function(o){return this.each(function(){var n=e(this),i=n.data("carousel"),r=e.extend({},e.fn.carousel.defaults,"object"==typeof o&&o),s="string"==typeof o?o:r.slide;i||n.data("carousel",i=new t(this,r)),"number"==typeof o?i.to(o):s?i[s]():r.interval&&i.cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=o,this},e(document).on("click.carousel.data-api","[data-slide]",function(t){var o,n=e(this),i=e(n.attr("data-target")||(o=n.attr("href"))&&o.replace(/.*(?=#[^\s]+$)/,"")),r=e.extend({},i.data(),n.data());i.carousel(r),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,o){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,o),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,o,n,i;if(!this.transitioning){if(t=this.dimension(),o=e.camelCase(["scroll",t].join("-")),n=this.$parent&&this.$parent.find("> .accordion-group > .in"),n&&n.length){if(i=n.data("collapse"),i&&i.transitioning)return;n.collapse("hide"),i||n.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][o])}},hide:function(){var t;this.transitioning||(t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0))},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[null!==e?"addClass":"removeClass"]("collapse"),this},transition:function(t,o,n){var i=this,r=function(){"show"==o.type&&i.reset(),i.transitioning=0,i.$element.trigger(n)};this.$element.trigger(o),o.isDefaultPrevented()||(this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,r):r())},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var o=e.fn.collapse;e.fn.collapse=function(o){return this.each(function(){var n=e(this),i=n.data("collapse"),r="object"==typeof o&&o;i||n.data("collapse",i=new t(this,r)),"string"==typeof o&&i[o]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=o,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var o,n=e(this),i=n.attr("data-target")||t.preventDefault()||(o=n.attr("href"))&&o.replace(/.*(?=#[^\s]+$)/,""),r=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(r)})}(window.jQuery),!function(e){"use strict";function t(){e(n).each(function(){o(e(this)).removeClass("open")})}function o(t){var o,n=t.attr("data-target");return n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),o=e(n),o.length||(o=t.parent()),o}var n="[data-toggle=dropdown]",i=function(t){var o=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){o.parent().removeClass("open")})};i.prototype={constructor:i,toggle:function(){var n,i,r=e(this);if(!r.is(".disabled, :disabled"))return n=o(r),i=n.hasClass("open"),t(),i||n.toggleClass("open"),r.focus(),!1},keydown:function(t){var n,i,r,s,l;if(/(38|40|27)/.test(t.keyCode)&&(n=e(this),t.preventDefault(),t.stopPropagation(),!n.is(".disabled, :disabled"))){if(r=o(n),s=r.hasClass("open"),!s||s&&27==t.keyCode)return n.click();i=e("[role=menu] li:not(.divider):visible a",r),i.length&&(l=i.index(i.filter(":focus")),38==t.keyCode&&l>0&&l--,40==t.keyCode&&l<i.length-1&&l++,~l||(l=0),i.eq(l).focus())}}};var r=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var o=e(this),n=o.data("dropdown");n||o.data("dropdown",n=new i(this)),"string"==typeof t&&n[t].call(o)})},e.fn.dropdown.Constructor=i,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=r,this},e(document).on("click.dropdown.data-api touchstart.dropdown.data-api",t).on("click.dropdown touchstart.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("touchstart.dropdown.data-api",".dropdown-menu",function(e){e.stopPropagation()}).on("click.dropdown.data-api touchstart.dropdown.data-api",n,i.prototype.toggle).on("keydown.dropdown.data-api touchstart.dropdown.data-api",n+", [role=menu]",i.prototype.keydown)}(window.jQuery),!function(e){"use strict";var t=function(t,o){this.options=o,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,o=e.Event("show");this.$element.trigger(o),this.isShown||o.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var o=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),o&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),o?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")}))},hide:function(t){t&&t.preventDefault();t=e.Event("hide"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]===e.target||t.$element.has(e.target).length||t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){27==t.which&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,o=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(o),t.hideModal()})},hideModal:function(){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null
15
- },backdrop:function(t){var o=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var n=e.support.transition&&o;this.$backdrop=e('<div class="modal-backdrop '+o+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),n?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(this.removeBackdrop,this)):this.removeBackdrop()):t&&t()}};var o=e.fn.modal;e.fn.modal=function(o){return this.each(function(){var n=e(this),i=n.data("modal"),r=e.extend({},e.fn.modal.defaults,n.data(),"object"==typeof o&&o);i||n.data("modal",i=new t(this,r)),"string"==typeof o?i[o]():r.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=o,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var o=e(this),n=o.attr("href"),i=e(o.attr("data-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),r=i.data("modal")?"toggle":e.extend({remote:!/#/.test(n)&&n},i.data(),o.data());t.preventDefault(),i.modal(r).one("hide",function(){o.focus()})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,o,n){var i,r;this.type=t,this.$element=e(o),this.options=this.getOptions(n),this.enabled=!0,"click"==this.options.trigger?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):"manual"!=this.options.trigger&&(i="hover"==this.options.trigger?"mouseenter":"focus",r="hover"==this.options.trigger?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,e.proxy(this.leave,this))),this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,t,this.$element.data()),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var o=e(t.currentTarget)[this.type](this._options).data(this.type);return o.options.delay&&o.options.delay.show?(clearTimeout(this.timeout),o.hoverState="in",this.timeout=setTimeout(function(){"in"==o.hoverState&&o.show()},o.options.delay.show),void 0):o.show()},leave:function(t){var o=e(t.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),o.options.delay&&o.options.delay.hide?(o.hoverState="out",this.timeout=setTimeout(function(){"out"==o.hoverState&&o.hide()},o.options.delay.hide),void 0):o.hide()},show:function(){var e,t,o,n,i,r,s;if(this.hasContent()&&this.enabled){switch(e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),r="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,t=/in/.test(r),e.detach().css({top:0,left:0,display:"block"}).insertAfter(this.$element),o=this.getPosition(t),n=e[0].offsetWidth,i=e[0].offsetHeight,t?r.split(" ")[1]:r){case"bottom":s={top:o.top+o.height,left:o.left+o.width/2-n/2};break;case"top":s={top:o.top-i,left:o.left+o.width/2-n/2};break;case"left":s={top:o.top+o.height/2-i/2,left:o.left-n};break;case"right":s={top:o.top+o.height/2-i/2,left:o.left+o.width}}e.offset(s).addClass(r).addClass("in")}},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function t(){var t=setTimeout(function(){o.off(e.support.transition.end).detach()},500);o.one(e.support.transition.end,function(){clearTimeout(t),o.detach()})}var o=this.tip();return o.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?t():o.detach(),this},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(t){return e.extend({},t?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var e,t=this.$element,o=this.options;return e=t.attr("data-original-title")||("function"==typeof o.title?o.title.call(t[0]):o.title)},tip:function(){return this.$tip=this.$tip||e(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var o=e(t.currentTarget)[this.type](this._options).data(this.type);o[o.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var o=e.fn.tooltip;e.fn.tooltip=function(o){return this.each(function(){var n=e(this),i=n.data("tooltip"),r="object"==typeof o&&o;i||n.data("tooltip",i=new t(this,r)),"string"==typeof o&&i[o]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=o,this}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),o=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](o),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,o=this.options;return e=t.attr("data-content")||("function"==typeof o.content?o.content.call(t[0]):o.content)},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var o=e.fn.popover;e.fn.popover=function(o){return this.each(function(){var n=e(this),i=n.data("popover"),r="object"==typeof o&&o;i||n.data("popover",i=new t(this,r)),"string"==typeof o&&i[o]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=o,this}}(window.jQuery),!function(e){"use strict";function t(t,o){var n,i=e.proxy(this.process,this),r=e(t).is("body")?e(window):e(t);this.options=e.extend({},e.fn.scrollspy.defaults,o),this.$scrollElement=r.on("scroll.scroll-spy.data-api",i),this.selector=(this.options.target||(n=e(t).attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t,o=this;this.offsets=e([]),this.targets=e([]),t=this.$body.find(this.selector).map(function(){var t=e(this),n=t.data("target")||t.attr("href"),i=/^#\w/.test(n)&&e(n);return i&&i.length&&[[i.position().top+o.$scrollElement.scrollTop(),n]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){o.offsets.push(this[0]),o.targets.push(this[1])})},process:function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,o=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=o-this.$scrollElement.height(),i=this.offsets,r=this.targets,s=this.activeTarget;if(t>=n)return s!=(e=r.last()[0])&&this.activate(e);for(e=i.length;e--;)s!=r[e]&&t>=i[e]&&(!i[e+1]||t<=i[e+1])&&this.activate(r[e])},activate:function(t){var o,n;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',o=e(n).parent("li").addClass("active"),o.parent(".dropdown-menu").length&&(o=o.closest("li.dropdown").addClass("active")),o.trigger("activate")}};var o=e.fn.scrollspy;e.fn.scrollspy=function(o){return this.each(function(){var n=e(this),i=n.data("scrollspy"),r="object"==typeof o&&o;i||n.data("scrollspy",i=new t(this,r)),"string"==typeof o&&i[o]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=o,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t,o,n,i=this.element,r=i.closest("ul:not(.dropdown-menu)"),s=i.attr("data-target");s||(s=i.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,"")),i.parent("li").hasClass("active")||(t=r.find(".active:last a")[0],n=e.Event("show",{relatedTarget:t}),i.trigger(n),n.isDefaultPrevented()||(o=e(s),this.activate(i.parent("li"),r),this.activate(o,o.parent(),function(){i.trigger({type:"shown",relatedTarget:t})})))},activate:function(t,o,n){function i(){r.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),n&&n()}var r=o.find("> .active"),s=n&&e.support.transition&&r.hasClass("fade");s?r.one(e.support.transition.end,i):i(),r.removeClass("in")}};var o=e.fn.tab;e.fn.tab=function(o){return this.each(function(){var n=e(this),i=n.data("tab");i||n.data("tab",i=new t(this)),"string"==typeof o&&i[o]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=o,this},e(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(window.jQuery),!function(e){"use strict";var t=function(t,o){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,o),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=e(this.options.menu),this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var t;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(t=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,t?this.process(t):this)},process:function(t){var o=this;return t=e.grep(t,function(e){return o.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){for(var t,o=[],n=[],i=[];t=e.shift();)t.toLowerCase().indexOf(this.query.toLowerCase())?~t.indexOf(this.query)?n.push(t):i.push(t):o.push(t);return o.concat(n,i)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var o=this;return t=e(t).map(function(t,n){return t=e(o.options.item).attr("data-value",n),t.find("a").html(o.highlighter(n)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(){var t=this.$menu.find(".active").removeClass("active"),o=t.next();o.length||(o=e(this.$menu.find("li")[0])),o.addClass("active")},prev:function(){var e=this.$menu.find(".active").removeClass("active"),t=e.prev();t.length||(t=this.$menu.find("li").last()),t.addClass("active")},listen:function(){this.$element.on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t="function"==typeof this.$element[e]),t},move:function(e){if(this.shown){switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()}},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){this.suppressKeyPressRepeat||this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},blur:function(){var e=this;setTimeout(function(){e.hide()},150)},click:function(e){e.stopPropagation(),e.preventDefault(),this.select()},mouseenter:function(t){this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")}};var o=e.fn.typeahead;e.fn.typeahead=function(o){return this.each(function(){var n=e(this),i=n.data("typeahead"),r="object"==typeof o&&o;i||n.data("typeahead",i=new t(this,r)),"string"==typeof o&&i[o]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=o,this},e(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var o=e(this);o.data("typeahead")||(t.preventDefault(),o.typeahead(o.data()))})}(window.jQuery),!function(e){"use strict";var t=function(t,o){this.options=e.extend({},e.fn.affix.defaults,o),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t,o=e(document).height(),n=this.$window.scrollTop(),i=this.$element.offset(),r=this.options.offset,s=r.bottom,l=r.top,a="affix affix-top affix-bottom";"object"!=typeof r&&(s=l=r),"function"==typeof l&&(l=r.top()),"function"==typeof s&&(s=r.bottom()),t=null!=this.unpin&&n+this.unpin<=i.top?!1:null!=s&&i.top+this.$element.height()>=o-s?"bottom":null!=l&&l>=n?"top":!1,this.affixed!==t&&(this.affixed=t,this.unpin="bottom"==t?i.top-n:null,this.$element.removeClass(a).addClass("affix"+(t?"-"+t:"")))}};var o=e.fn.affix;e.fn.affix=function(o){return this.each(function(){var n=e(this),i=n.data("affix"),r="object"==typeof o&&o;i||n.data("affix",i=new t(this,r)),"string"==typeof o&&i[o]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=o,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),o=t.data();o.offset=o.offset||{},o.offsetBottom&&(o.offset.bottom=o.offsetBottom),o.offsetTop&&(o.offset.top=o.offsetTop),t.affix(o)})})}(window.jQuery),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e,t){var o=0,n=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var o,n=0;null!=(o=t[n]);n++)try{e(o).triggerHandler("remove")}catch(r){}i(t)},e.widget=function(t,o,n){var i,r,s,l,a={},c=t.split(".")[0];t=t.split(".")[1],i=c+"-"+t,n||(n=o,o=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[c]=e[c]||{},r=e[c][t],s=e[c][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new s(e,t)},e.extend(s,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),l=new o,l.options=e.widget.extend({},l.options),e.each(n,function(t,n){return e.isFunction(n)?(a[t]=function(){var e=function(){return o.prototype[t].apply(this,arguments)},i=function(e){return o.prototype[t].apply(this,e)};return function(){var t,o=this._super,r=this._superApply;return this._super=e,this._superApply=i,t=n.apply(this,arguments),this._super=o,this._superApply=r,t}}(),void 0):(a[t]=n,void 0)}),s.prototype=e.widget.extend(l,{widgetEventPrefix:r?l.widgetEventPrefix:t},a,{constructor:s,namespace:c,widgetName:t,widgetFullName:i}),r?(e.each(r._childConstructors,function(t,o){var n=o.prototype;e.widget(n.namespace+"."+n.widgetName,s,o._proto)}),delete r._childConstructors):o._childConstructors.push(s),e.widget.bridge(t,s)},e.widget.extend=function(o){for(var i,r,s=n.call(arguments,1),l=0,a=s.length;a>l;l++)for(i in s[l])r=s[l][i],s[l].hasOwnProperty(i)&&r!==t&&(o[i]=e.isPlainObject(r)?e.isPlainObject(o[i])?e.widget.extend({},o[i],r):e.widget.extend({},r):r);return o},e.widget.bridge=function(o,i){var r=i.prototype.widgetFullName||o;e.fn[o]=function(s){var l="string"==typeof s,a=n.call(arguments,1),c=this;return s=!l&&a.length?e.widget.extend.apply(null,[s].concat(a)):s,l?this.each(function(){var n,i=e.data(this,r);return i?e.isFunction(i[s])&&"_"!==s.charAt(0)?(n=i[s].apply(i,a),n!==i&&n!==t?(c=n&&n.jquery?c.pushStack(n.get()):n,!1):void 0):e.error("no such method '"+s+"' for "+o+" widget instance"):e.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+s+"'")}):this.each(function(){var t=e.data(this,r);t?t.option(s||{})._init():e.data(this,r,new i(s,this))}),c}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=o++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(o,n){var i,r,s,l=o;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof o)if(l={},i=o.split("."),o=i.shift(),i.length){for(r=l[o]=e.widget.extend({},this.options[o]),s=0;s<i.length-1;s++)r[i[s]]=r[i[s]]||{},r=r[i[s]];if(o=i.pop(),n===t)return r[o]===t?null:r[o];r[o]=n}else{if(n===t)return this.options[o]===t?null:this.options[o];l[o]=n}return this._setOptions(l),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,o,n){var i,r=this;"boolean"!=typeof t&&(n=o,o=t,t=!1),n?(o=i=e(o),this.bindings=this.bindings.add(o)):(n=o,o=this.element,i=this.widget()),e.each(n,function(n,s){function l(){return t||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof s?r[s]:s).apply(r,arguments):void 0}"string"!=typeof s&&(l.guid=s.guid=s.guid||l.guid||e.guid++);var a=n.match(/^(\w+)\s*(.*)$/),c=a[1]+r.eventNamespace,u=a[2];u?i.delegate(u,c,l):o.bind(c,l)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function o(){return("string"==typeof e?n[e]:e).apply(n,arguments)}var n=this;return setTimeout(o,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,o,n){var i,r,s=this.options[t];if(n=n||{},o=e.Event(o),o.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),o.target=this.element[0],r=o.originalEvent)for(i in r)i in o||(o[i]=r[i]);return this.element.trigger(o,n),!(e.isFunction(s)&&s.apply(this.element[0],[o].concat(n))===!1||o.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,o){e.Widget.prototype["_"+t]=function(n,i,r){"string"==typeof i&&(i={effect:i});var s,l=i?i===!0||"number"==typeof i?o:i.effect||o:t;i=i||{},"number"==typeof i&&(i={duration:i}),s=!e.isEmptyObject(i),i.complete=r,i.delay&&n.delay(i.delay),s&&e.effects&&e.effects.effect[l]?n[t](i):l!==t&&n[l]?n[l](i.duration,i.easing,r):n.queue(function(o){e(this)[t](),r&&r.call(n[0]),o()})}})}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e(window.jQuery)}(function(e){"use strict";var t=0;e.ajaxTransport("iframe",function(o){if(o.async){var n,i,r;return{send:function(s,l){n=e('<form style="display:none;"></form>'),n.attr("accept-charset",o.formAcceptCharset),r=/\?/.test(o.url)?"&":"?","DELETE"===o.type?(o.url=o.url+r+"_method=DELETE",o.type="POST"):"PUT"===o.type?(o.url=o.url+r+"_method=PUT",o.type="POST"):"PATCH"===o.type&&(o.url=o.url+r+"_method=PATCH",o.type="POST"),t+=1,i=e('<iframe src="javascript:false;" name="iframe-transport-'+t+'"></iframe>').bind("load",function(){var t,r=e.isArray(o.paramName)?o.paramName:[o.paramName];i.unbind("load").bind("load",function(){var t;try{if(t=i.contents(),!t.length||!t[0].firstChild)throw new Error}catch(o){t=void 0}l(200,"success",{iframe:t}),e('<iframe src="javascript:false;"></iframe>').appendTo(n),window.setTimeout(function(){n.remove()},0)}),n.prop("target",i.prop("name")).prop("action",o.url).prop("method",o.type),o.formData&&e.each(o.formData,function(t,o){e('<input type="hidden"/>').prop("name",o.name).val(o.value).appendTo(n)}),o.fileInput&&o.fileInput.length&&"POST"===o.type&&(t=o.fileInput.clone(),o.fileInput.after(function(e){return t[e]}),o.paramName&&o.fileInput.each(function(t){e(this).prop("name",r[t]||o.paramName)}),n.append(o.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data")),n.submit(),t&&t.length&&o.fileInput.each(function(o,n){var i=e(t[o]);e(n).prop("name",i.prop("name")),i.replaceWith(n)})}),n.append(i).appendTo(document.body)},abort:function(){i&&i.unbind("load").prop("src","javascript".concat(":false;")),n&&n.remove()}}}}),e.ajaxSetup({converters:{"iframe text":function(t){return t&&e(t[0].body).text()},"iframe json":function(t){return t&&e.parseJSON(e(t[0].body).text())},"iframe html":function(t){return t&&e(t[0].body).html()},"iframe xml":function(t){var o=t&&t[0];return o&&e.isXMLDoc(o)?o:e.parseXML(o.XMLDocument&&o.XMLDocument.xml||e(o.body).html())},"iframe script":function(t){return t&&e.globalEval(e(t[0].body).text())}}})}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","jquery.ui.widget"],e):e(window.jQuery)}(function(e){"use strict";e.support.fileInput=!(new RegExp("(Android (1\\.[0156]|2\\.[01]))|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)|(w(eb)?OSBrowser)|(webOS)|(Kindle/(1\\.0|2\\.[05]|3\\.0))").test(window.navigator.userAgent)||e('<input type="file">').prop("disabled")),e.support.xhrFileUpload=!(!window.XMLHttpRequestUpload||!window.FileReader),e.support.xhrFormDataFileUpload=!!window.FormData,e.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice),e.widget("blueimp.fileupload",{options:{dropZone:e(document),pasteZone:e(document),fileInput:void 0,replaceFileInput:!0,paramName:void 0,singleFileUploads:!0,limitMultiFileUploads:void 0,sequentialUploads:!1,limitConcurrentUploads:void 0,forceIframeTransport:!1,redirect:void 0,redirectParamName:void 0,postMessage:void 0,multipart:!0,maxChunkSize:void 0,uploadedBytes:void 0,recalculateProgress:!0,progressInterval:100,bitrateInterval:500,autoUpload:!0,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(t,o){return t=this.messages[t]||t.toString(),o&&e.each(o,function(e,o){t=t.replace("{"+e+"}",o)}),t},formData:function(e){return e.serializeArray()},add:function(t,o){(o.autoUpload||o.autoUpload!==!1&&e(this).fileupload("option","autoUpload"))&&o.process().done(function(){o.submit()})},processData:!1,contentType:!1,cache:!1},_specialOptions:["fileInput","dropZone","pasteZone","multipart","forceIframeTransport"],_blobSlice:e.support.blobSlice&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},_BitrateTimer:function(){this.timestamp=Date.now?Date.now():(new Date).getTime(),this.loaded=0,this.bitrate=0,this.getBitrate=function(e,t,o){var n=e-this.timestamp;return(!this.bitrate||!o||n>o)&&(this.bitrate=(t-this.loaded)*(1e3/n)*8,this.loaded=t,this.timestamp=e),this.bitrate}},_isXHRUpload:function(t){return!t.forceIframeTransport&&(!t.multipart&&e.support.xhrFileUpload||e.support.xhrFormDataFileUpload)},_getFormData:function(t){var o;return"function"==typeof t.formData?t.formData(t.form):e.isArray(t.formData)?t.formData:"object"===e.type(t.formData)?(o=[],e.each(t.formData,function(e,t){o.push({name:e,value:t})}),o):[]},_getTotal:function(t){var o=0;return e.each(t,function(e,t){o+=t.size||1}),o},_initProgressObject:function(t){var o={loaded:0,total:0,bitrate:0};t._progress?e.extend(t._progress,o):t._progress=o},_initResponseObject:function(e){var t;if(e._response)for(t in e._response)e._response.hasOwnProperty(t)&&delete e._response[t];else e._response={}},_onProgress:function(e,t){if(e.lengthComputable){var o,n=Date.now?Date.now():(new Date).getTime();if(t._time&&t.progressInterval&&n-t._time<t.progressInterval&&e.loaded!==e.total)return;t._time=n,o=Math.floor(e.loaded/e.total*(t.chunkSize||t._progress.total))+(t.uploadedBytes||0),this._progress.loaded+=o-t._progress.loaded,this._progress.bitrate=this._bitrateTimer.getBitrate(n,this._progress.loaded,t.bitrateInterval),t._progress.loaded=t.loaded=o,t._progress.bitrate=t.bitrate=t._bitrateTimer.getBitrate(n,o,t.bitrateInterval),this._trigger("progress",e,t),this._trigger("progressall",e,this._progress)}},_initProgressListener:function(t){var o=this,n=t.xhr?t.xhr():e.ajaxSettings.xhr();n.upload&&(e(n.upload).bind("progress",function(e){var n=e.originalEvent;e.lengthComputable=n.lengthComputable,e.loaded=n.loaded,e.total=n.total,o._onProgress(e,t)}),t.xhr=function(){return n})},_isInstanceOf:function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},_initXHRData:function(t){var o,n=this,i=t.files[0],r=t.multipart||!e.support.xhrFileUpload,s=t.paramName[0];t.headers=e.extend({},t.headers),t.contentRange&&(t.headers["Content-Range"]=t.contentRange),r&&!t.blob&&this._isInstanceOf("File",i)||(t.headers["Content-Disposition"]='attachment; filename="'+encodeURI(i.name)+'"'),r?e.support.xhrFormDataFileUpload&&(t.postMessage?(o=this._getFormData(t),t.blob?o.push({name:s,value:t.blob}):e.each(t.files,function(e,n){o.push({name:t.paramName[e]||s,value:n})})):(n._isInstanceOf("FormData",t.formData)?o=t.formData:(o=new FormData,e.each(this._getFormData(t),function(e,t){o.append(t.name,t.value)})),t.blob?o.append(s,t.blob,i.name):e.each(t.files,function(e,i){(n._isInstanceOf("File",i)||n._isInstanceOf("Blob",i))&&o.append(t.paramName[e]||s,i,i.name)})),t.data=o):(t.contentType=i.type,t.data=t.blob||i),t.blob=null},_initIframeSettings:function(t){var o=e("<a></a>").prop("href",t.url).prop("host");t.dataType="iframe "+(t.dataType||""),t.formData=this._getFormData(t),t.redirect&&o&&o!==location.host&&t.formData.push({name:t.redirectParamName||"redirect",value:t.redirect})},_initDataSettings:function(e){this._isXHRUpload(e)?(this._chunkedUpload(e,!0)||(e.data||this._initXHRData(e),this._initProgressListener(e)),e.postMessage&&(e.dataType="postmessage "+(e.dataType||""))):this._initIframeSettings(e)},_getParamName:function(t){var o=e(t.fileInput),n=t.paramName;return n?e.isArray(n)||(n=[n]):(n=[],o.each(function(){for(var t=e(this),o=t.prop("name")||"files[]",i=(t.prop("files")||[1]).length;i;)n.push(o),i-=1}),n.length||(n=[o.prop("name")||"files[]"])),n},_initFormSettings:function(t){t.form&&t.form.length||(t.form=e(t.fileInput.prop("form")),t.form.length||(t.form=e(this.options.fileInput.prop("form")))),t.paramName=this._getParamName(t),t.url||(t.url=t.form.prop("action")||location.href),t.type=(t.type||"string"===e.type(t.form.prop("method"))&&t.form.prop("method")||"").toUpperCase(),"POST"!==t.type&&"PUT"!==t.type&&"PATCH"!==t.type&&(t.type="POST"),t.formAcceptCharset||(t.formAcceptCharset=t.form.attr("accept-charset"))},_getAJAXSettings:function(t){var o=e.extend({},this.options,t);return this._initFormSettings(o),this._initDataSettings(o),o},_getDeferredState:function(e){return e.state?e.state():e.isResolved()?"resolved":e.isRejected()?"rejected":"pending"},_enhancePromise:function(e){return e.success=e.done,e.error=e.fail,e.complete=e.always,e},_getXHRPromise:function(t,o,n){var i=e.Deferred(),r=i.promise();return o=o||this.options.context||r,t===!0?i.resolveWith(o,n):t===!1&&i.rejectWith(o,n),r.abort=i.promise,this._enhancePromise(r)},_addConvenienceMethods:function(t,o){var n=this,i=function(t){return e.Deferred().resolveWith(n,[t]).promise()};o.process=function(e,t){return(e||t)&&(o._processQueue=this._processQueue=(this._processQueue||i(this)).pipe(e,t)),this._processQueue||i(this)},o.submit=function(){return"pending"!==this.state()&&(o.jqXHR=this.jqXHR=n._trigger("submit",t,this)!==!1&&n._onSend(t,this)),this.jqXHR||n._getXHRPromise()},o.abort=function(){return this.jqXHR?this.jqXHR.abort():n._getXHRPromise()},o.state=function(){return this.jqXHR?n._getDeferredState(this.jqXHR):this._processQueue?n._getDeferredState(this._processQueue):void 0},o.progress=function(){return this._progress},o.response=function(){return this._response}},_getUploadedBytes:function(e){var t=e.getResponseHeader("Range"),o=t&&t.split("-"),n=o&&o.length>1&&parseInt(o[1],10);return n&&n+1},_chunkedUpload:function(t,o){t.uploadedBytes=t.uploadedBytes||0;var n,i,r=this,s=t.files[0],l=s.size,a=t.uploadedBytes,c=t.maxChunkSize||l,u=this._blobSlice,g=e.Deferred(),h=g.promise();return this._isXHRUpload(t)&&u&&(a||l>c)&&!t.data?o?!0:a>=l?(s.error=t.i18n("uploadedBytes"),this._getXHRPromise(!1,t.context,[null,"error",s.error])):(i=function(){var o=e.extend({},t),h=o._progress.loaded;o.blob=u.call(s,a,a+c,s.type),o.chunkSize=o.blob.size,o.contentRange="bytes "+a+"-"+(a+o.chunkSize-1)+"/"+l,r._initXHRData(o),r._initProgressListener(o),n=(r._trigger("chunksend",null,o)!==!1&&e.ajax(o)||r._getXHRPromise(!1,o.context)).done(function(n,s,c){a=r._getUploadedBytes(c)||a+o.chunkSize,h+o.chunkSize-o._progress.loaded&&r._onProgress(e.Event("progress",{lengthComputable:!0,loaded:a-o.uploadedBytes,total:a-o.uploadedBytes}),o),t.uploadedBytes=o.uploadedBytes=a,o.result=n,o.textStatus=s,o.jqXHR=c,r._trigger("chunkdone",null,o),r._trigger("chunkalways",null,o),l>a?i():g.resolveWith(o.context,[n,s,c])}).fail(function(e,t,n){o.jqXHR=e,o.textStatus=t,o.errorThrown=n,r._trigger("chunkfail",null,o),r._trigger("chunkalways",null,o),g.rejectWith(o.context,[e,t,n])})},this._enhancePromise(h),h.abort=function(){return n.abort()
16
- },i(),h):!1},_beforeSend:function(e,t){0===this._active&&(this._trigger("start"),this._bitrateTimer=new this._BitrateTimer,this._progress.loaded=this._progress.total=0,this._progress.bitrate=0),this._initResponseObject(t),this._initProgressObject(t),t._progress.loaded=t.loaded=t.uploadedBytes||0,t._progress.total=t.total=this._getTotal(t.files)||1,t._progress.bitrate=t.bitrate=0,this._active+=1,this._progress.loaded+=t.loaded,this._progress.total+=t.total},_onDone:function(t,o,n,i){var r=i._progress.total,s=i._response;i._progress.loaded<r&&this._onProgress(e.Event("progress",{lengthComputable:!0,loaded:r,total:r}),i),s.result=i.result=t,s.textStatus=i.textStatus=o,s.jqXHR=i.jqXHR=n,this._trigger("done",null,i)},_onFail:function(e,t,o,n){var i=n._response;n.recalculateProgress&&(this._progress.loaded-=n._progress.loaded,this._progress.total-=n._progress.total),i.jqXHR=n.jqXHR=e,i.textStatus=n.textStatus=t,i.errorThrown=n.errorThrown=o,this._trigger("fail",null,n)},_onAlways:function(e,t,o,n){this._trigger("always",null,n)},_onSend:function(t,o){o.submit||this._addConvenienceMethods(t,o);var n,i,r,s,l=this,a=l._getAJAXSettings(o),c=function(){return l._sending+=1,a._bitrateTimer=new l._BitrateTimer,n=n||((i||l._trigger("send",t,a)===!1)&&l._getXHRPromise(!1,a.context,i)||l._chunkedUpload(a)||e.ajax(a)).done(function(e,t,o){l._onDone(e,t,o,a)}).fail(function(e,t,o){l._onFail(e,t,o,a)}).always(function(e,t,o){if(l._onAlways(e,t,o,a),l._sending-=1,l._active-=1,a.limitConcurrentUploads&&a.limitConcurrentUploads>l._sending)for(var n=l._slots.shift();n;){if("pending"===l._getDeferredState(n)){n.resolve();break}n=l._slots.shift()}0===l._active&&l._trigger("stop")})};return this._beforeSend(t,a),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(r=e.Deferred(),this._slots.push(r),s=r.pipe(c)):(this._sequence=this._sequence.pipe(c,c),s=this._sequence),s.abort=function(){return i=[void 0,"abort","abort"],n?n.abort():(r&&r.rejectWith(a.context,i),c())},this._enhancePromise(s)):c()},_onAdd:function(t,o){var n,i,r,s,l=this,a=!0,c=e.extend({},this.options,o),u=c.limitMultiFileUploads,g=this._getParamName(c);if((c.singleFileUploads||u)&&this._isXHRUpload(c))if(!c.singleFileUploads&&u)for(r=[],n=[],s=0;s<o.files.length;s+=u)r.push(o.files.slice(s,s+u)),i=g.slice(s,s+u),i.length||(i=g),n.push(i);else n=g;else r=[o.files],n=[g];return o.originalFiles=o.files,e.each(r||o.files,function(i,s){var c=e.extend({},o);return c.files=r?s:[s],c.paramName=n[i],l._initResponseObject(c),l._initProgressObject(c),l._addConvenienceMethods(t,c),a=l._trigger("add",t,c)}),a},_replaceFileInput:function(t){var o=t.clone(!0);e("<form></form>").append(o)[0].reset(),t.after(o).detach(),e.cleanData(t.unbind("remove")),this.options.fileInput=this.options.fileInput.map(function(e,n){return n===t[0]?o[0]:n}),t[0]===this.element[0]&&(this.element=o)},_handleFileTreeEntry:function(t,o){var n,i=this,r=e.Deferred(),s=function(e){e&&!e.entry&&(e.entry=t),r.resolve([e])};return o=o||"",t.isFile?t._file?(t._file.relativePath=o,r.resolve(t._file)):t.file(function(e){e.relativePath=o,r.resolve(e)},s):t.isDirectory?(n=t.createReader(),n.readEntries(function(e){i._handleFileTreeEntries(e,o+t.name+"/").done(function(e){r.resolve(e)}).fail(s)},s)):r.resolve([]),r.promise()},_handleFileTreeEntries:function(t,o){var n=this;return e.when.apply(e,e.map(t,function(e){return n._handleFileTreeEntry(e,o)})).pipe(function(){return Array.prototype.concat.apply([],arguments)})},_getDroppedFiles:function(t){t=t||{};var o=t.items;return o&&o.length&&(o[0].webkitGetAsEntry||o[0].getAsEntry)?this._handleFileTreeEntries(e.map(o,function(e){var t;return e.webkitGetAsEntry?(t=e.webkitGetAsEntry(),t&&(t._file=e.getAsFile()),t):e.getAsEntry()})):e.Deferred().resolve(e.makeArray(t.files)).promise()},_getSingleFileInputFiles:function(t){t=e(t);var o,n,i=t.prop("webkitEntries")||t.prop("entries");if(i&&i.length)return this._handleFileTreeEntries(i);if(o=e.makeArray(t.prop("files")),o.length)void 0===o[0].name&&o[0].fileName&&e.each(o,function(e,t){t.name=t.fileName,t.size=t.fileSize});else{if(n=t.prop("value"),!n)return e.Deferred().resolve([]).promise();o=[{name:n.replace(/^.*\\/,"")}]}return e.Deferred().resolve(o).promise()},_getFileInputFiles:function(t){return t instanceof e&&1!==t.length?e.when.apply(e,e.map(t,this._getSingleFileInputFiles)).pipe(function(){return Array.prototype.concat.apply([],arguments)}):this._getSingleFileInputFiles(t)},_onChange:function(t){var o=this,n={fileInput:e(t.target),form:e(t.target.form)};this._getFileInputFiles(n.fileInput).always(function(e){n.files=e,o.options.replaceFileInput&&o._replaceFileInput(n.fileInput),o._trigger("change",t,n)!==!1&&o._onAdd(t,n)})},_onPaste:function(t){var o=t.originalEvent&&t.originalEvent.clipboardData&&t.originalEvent.clipboardData.items,n={files:[]};o&&o.length&&(e.each(o,function(e,t){var o=t.getAsFile&&t.getAsFile();o&&n.files.push(o)}),this._trigger("paste",t,n)!==!1&&this._onAdd(t,n))},_onDrop:function(e){e.dataTransfer=e.originalEvent&&e.originalEvent.dataTransfer;var t=this,o=e.dataTransfer,n={};o&&o.files&&o.files.length&&(e.preventDefault(),this._getDroppedFiles(o).always(function(o){n.files=o,t._trigger("drop",e,n)!==!1&&t._onAdd(e,n)}))},_onDragOver:function(t){t.dataTransfer=t.originalEvent&&t.originalEvent.dataTransfer;var o=t.dataTransfer,n={dropEffect:"copy",preventDefault:!0};o&&-1!==e.inArray("Files",o.types)&&this._trigger("dragover",t,n)!==!1&&(o.dropEffect=n.dropEffect,n.preventDefault&&t.preventDefault())},_initEventHandlers:function(){this._isXHRUpload(this.options)&&(this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop}),this._on(this.options.pasteZone,{paste:this._onPaste})),e.support.fileInput&&this._on(this.options.fileInput,{change:this._onChange})},_destroyEventHandlers:function(){this._off(this.options.dropZone,"dragover drop"),this._off(this.options.pasteZone,"paste"),this._off(this.options.fileInput,"change")},_setOption:function(t,o){var n=-1!==e.inArray(t,this._specialOptions);n&&this._destroyEventHandlers(),this._super(t,o),n&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var t=this.options;void 0===t.fileInput?t.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]'):t.fileInput instanceof e||(t.fileInput=e(t.fileInput)),t.dropZone instanceof e||(t.dropZone=e(t.dropZone)),t.pasteZone instanceof e||(t.pasteZone=e(t.pasteZone))},_getRegExp:function(e){var t=e.split("/"),o=t.pop();return t.shift(),new RegExp(t.join("/"),o)},_isRegExpOption:function(t,o){return"url"!==t&&"string"===e.type(o)&&/^\/.*\/[igm]{0,3}$/.test(o)},_initDataAttributes:function(){var t=this,o=this.options;e.each(e(this.element[0].cloneNode(!1)).data(),function(e,n){t._isRegExpOption(e,n)&&(n=t._getRegExp(n)),o[e]=n})},_create:function(){this._initDataAttributes(),this._initSpecialOptions(),this._slots=[],this._sequence=this._getXHRPromise(!0),this._sending=this._active=0,this._initProgressObject(this),this._initEventHandlers()},active:function(){return this._active},progress:function(){return this._progress},add:function(t){var o=this;t&&!this.options.disabled&&(t.fileInput&&!t.files?this._getFileInputFiles(t.fileInput).always(function(e){t.files=e,o._onAdd(null,t)}):(t.files=e.makeArray(t.files),this._onAdd(null,t)))},send:function(t){if(t&&!this.options.disabled){if(t.fileInput&&!t.files){var o,n,i=this,r=e.Deferred(),s=r.promise();return s.abort=function(){return n=!0,o?o.abort():(r.reject(null,"abort","abort"),s)},this._getFileInputFiles(t.fileInput).always(function(e){if(!n){if(!e.length)return r.reject(),void 0;t.files=e,o=i._onSend(null,t).then(function(e,t,o){r.resolve(e,t,o)},function(e,t,o){r.reject(e,t,o)})}}),this._enhancePromise(s)}if(t.files=e.makeArray(t.files),t.files.length)return this._onSend(null,t)}return this._getXHRPromise(!1,t&&t.context)}})});var COMPILED=!0,goog=goog||{};goog.global=this,goog.exportPath_=function(e,t,o){e=e.split("."),o=o||goog.global,e[0]in o||!o.execScript||o.execScript("var "+e[0]);for(var n;e.length&&(n=e.shift());)e.length||void 0===t?o=o[n]?o[n]:o[n]={}:o[n]=t},goog.define=function(e,t){var o=t;COMPILED||goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,e)&&(o=goog.global.CLOSURE_DEFINES[e]),goog.exportPath_(e,o)},goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.provide=function(e){if(!COMPILED){if(goog.isProvided_(e))throw Error('Namespace "'+e+'" already declared.');delete goog.implicitNamespaces_[e];for(var t=e;(t=t.substring(0,t.lastIndexOf(".")))&&!goog.getObjectByName(t);)goog.implicitNamespaces_[t]=!0}goog.exportPath_(e)},goog.setTestOnly=function(e){if(COMPILED&&!goog.DEBUG)throw e=e||"",Error(": "+e)},COMPILED||(goog.isProvided_=function(e){return!goog.implicitNamespaces_[e]&&!!goog.getObjectByName(e)},goog.implicitNamespaces_={}),goog.getObjectByName=function(e,t){for(var o,n=e.split("."),i=t||goog.global;o=n.shift();){if(!goog.isDefAndNotNull(i[o]))return null;i=i[o]}return i},goog.globalize=function(e,t){var o,n=t||goog.global;for(o in e)n[o]=e[o]},goog.addDependency=function(e,t,o){if(goog.DEPENDENCIES_ENABLED){var n;e=e.replace(/\\/g,"/");for(var i=goog.dependencies_,r=0;n=t[r];r++)i.nameToPath[n]=e,e in i.pathToNames||(i.pathToNames[e]={}),i.pathToNames[e][n]=!0;for(n=0;t=o[n];n++)e in i.requires||(i.requires[e]={}),i.requires[e][t]=!0}},goog.ENABLE_DEBUG_LOADER=!0,goog.require=function(e){if(!COMPILED&&!goog.isProvided_(e)){if(goog.ENABLE_DEBUG_LOADER){var t=goog.getPathFromDeps_(e);if(t)return goog.included_[t]=!0,goog.writeScripts_(),void 0}throw e="goog.require could not find: "+e,goog.global.console&&goog.global.console.error(e),Error(e)}},goog.basePath="",goog.nullFunction=function(){},goog.identityFunction=function(e){return e},goog.abstractMethod=function(){throw Error("unimplemented abstract method")},goog.addSingletonGetter=function(e){e.getInstance=function(){return e.instance_?e.instance_:(goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=e),e.instance_=new e)}},goog.instantiatedSingletons_=[],goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER,goog.DEPENDENCIES_ENABLED&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var e=goog.global.document;return"undefined"!=typeof e&&"write"in e},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var e=goog.global.document.getElementsByTagName("script"),t=e.length-1;t>=0;--t){var o=e[t].src,n=o.lastIndexOf("?"),n=-1==n?o.length:n;if("base.js"==o.substr(n-7,7)){goog.basePath=o.substr(0,n-7);break}}},goog.importScript_=function(e){var t=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[e]&&t(e)&&(goog.dependencies_.written[e]=!0)},goog.writeScriptTag_=function(e){if(goog.inHtmlDocument_()){var t=goog.global.document;if("complete"==t.readyState){if(/\bdeps.js$/.test(e))return!1;throw Error('Cannot write "'+e+'" after document load')}return t.write('<script type="text/javascript" src="'+e+'"></script>'),!0}return!1},goog.writeScripts_=function(){function e(t){if(!(t in i.written)){if(!(t in i.visited)&&(i.visited[t]=!0,t in i.requires))for(var r in i.requires[t])if(!goog.isProvided_(r)){if(!(r in i.nameToPath))throw Error("Undefined nameToPath for "+r);e(i.nameToPath[r])}t in n||(n[t]=!0,o.push(t))}}var t,o=[],n={},i=goog.dependencies_;for(t in goog.included_)i.written[t]||e(t);for(t=0;t<o.length;t++){if(!o[t])throw Error("Undefined script input");goog.importScript_(goog.basePath+o[t])}},goog.getPathFromDeps_=function(e){return e in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[e]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js")),goog.typeOf=function(e){var t=typeof e;if("object"==t){if(!e)return"null";if(e instanceof Array)return"array";if(e instanceof Object)return t;var o=Object.prototype.toString.call(e);if("[object Window]"==o)return"object";if("[object Array]"==o||"number"==typeof e.length&&"undefined"!=typeof e.splice&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("splice"))return"array";if("[object Function]"==o||"undefined"!=typeof e.call&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("call"))return"function"}else if("function"==t&&"undefined"==typeof e.call)return"object";return t},goog.isDef=function(e){return void 0!==e},goog.isNull=function(e){return null===e},goog.isDefAndNotNull=function(e){return null!=e},goog.isArray=function(e){return"array"==goog.typeOf(e)},goog.isArrayLike=function(e){var t=goog.typeOf(e);return"array"==t||"object"==t&&"number"==typeof e.length},goog.isDateLike=function(e){return goog.isObject(e)&&"function"==typeof e.getFullYear},goog.isString=function(e){return"string"==typeof e},goog.isBoolean=function(e){return"boolean"==typeof e},goog.isNumber=function(e){return"number"==typeof e},goog.isFunction=function(e){return"function"==goog.typeOf(e)},goog.isObject=function(e){var t=typeof e;return"object"==t&&null!=e||"function"==t},goog.getUid=function(e){return e[goog.UID_PROPERTY_]||(e[goog.UID_PROPERTY_]=++goog.uidCounter_)},goog.hasUid=function(e){return!!e[goog.UID_PROPERTY_]},goog.removeUid=function(e){"removeAttribute"in e&&e.removeAttribute(goog.UID_PROPERTY_);try{delete e[goog.UID_PROPERTY_]}catch(t){}},goog.UID_PROPERTY_="closure_uid_"+(1e9*Math.random()>>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var t=goog.typeOf(e);if("object"==t||"array"==t){if(e.clone)return e.clone();var o,t="array"==t?[]:{};for(o in e)t[o]=goog.cloneObject(e[o]);return t}return e},goog.bindNative_=function(e){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,t){if(!e)throw Error();if(2<arguments.length){var o=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,o),e.apply(t,n)}}return function(){return e.apply(t,arguments)}},goog.bind=function(){return goog.bind=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bindNative_:goog.bindJs_,goog.bind.apply(null,arguments)},goog.partial=function(e){var t=Array.prototype.slice.call(arguments,1);return function(){var o=t.slice();return o.push.apply(o,arguments),e.apply(this,o)}},goog.mixin=function(e,t){for(var o in t)e[o]=t[o]},goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date},goog.globalEval=function(e){if(goog.global.execScript)goog.global.execScript(e,"JavaScript");else{if(!goog.global.eval)throw Error("goog.globalEval not available");if(null==goog.evalWorksForGlobals_&&(goog.global.eval("var _et_ = 1;"),"undefined"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1),goog.evalWorksForGlobals_)goog.global.eval(e);else{var t=goog.global.document,o=t.createElement("script");o.type="text/javascript",o.defer=!1,o.appendChild(t.createTextNode(e)),t.body.appendChild(o),t.body.removeChild(o)}}},goog.evalWorksForGlobals_=null,goog.getCssName=function(e,t){var o=function(e){return goog.cssNameMapping_[e]||e},n=function(e){e=e.split("-");for(var t=[],n=0;n<e.length;n++)t.push(o(e[n]));return t.join("-")},n=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?o:n:function(e){return e};return t?e+"-"+n(t):n(e)},goog.setCssNameMapping=function(e,t){goog.cssNameMapping_=e,goog.cssNameMappingStyle_=t},!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING),goog.getMsg=function(e,t){var o,n=t||{};for(o in n){var i=(""+n[o]).replace(/\$/g,"$$$$");e=e.replace(RegExp("\\{\\$"+o+"\\}","gi"),i)}return e},goog.getMsgWithFallback=function(e){return e},goog.exportSymbol=function(e,t,o){goog.exportPath_(e,t,o)},goog.exportProperty=function(e,t,o){e[t]=o},goog.inherits=function(e,t){function o(){}o.prototype=t.prototype,e.superClass_=t.prototype,e.prototype=new o,e.prototype.constructor=e},goog.base=function(e,t){var o=arguments.callee.caller;if(goog.DEBUG&&!o)throw Error("arguments.caller not defined. goog.base() expects not to be running in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(o.superClass_)return o.superClass_.constructor.apply(e,Array.prototype.slice.call(arguments,1));for(var n=Array.prototype.slice.call(arguments,2),i=!1,r=e.constructor;r;r=r.superClass_&&r.superClass_.constructor)if(r.prototype[t]===o)i=!0;else if(i)return r.prototype[t].apply(e,n);if(e[t]===o)return e.constructor.prototype[t].apply(e,n);throw Error("goog.base called from a method of one name to a method of a different name")},goog.scope=function(e){e.call(goog.global)},goog.string={},goog.string.Unicode={NBSP:" "},goog.string.startsWith=function(e,t){return 0==e.lastIndexOf(t,0)},goog.string.endsWith=function(e,t){var o=e.length-t.length;return o>=0&&e.indexOf(t,o)==o},goog.string.caseInsensitiveStartsWith=function(e,t){return 0==goog.string.caseInsensitiveCompare(t,e.substr(0,t.length))},goog.string.caseInsensitiveEndsWith=function(e,t){return 0==goog.string.caseInsensitiveCompare(t,e.substr(e.length-t.length,t.length))},goog.string.caseInsensitiveEquals=function(e,t){return e.toLowerCase()==t.toLowerCase()},goog.string.subs=function(e){for(var t=e.split("%s"),o="",n=Array.prototype.slice.call(arguments,1);n.length&&1<t.length;)o+=t.shift()+n.shift();return o+t.join("%s")},goog.string.collapseWhitespace=function(e){return e.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},goog.string.isEmpty=function(e){return/^[\s\xa0]*$/.test(e)},goog.string.isEmptySafe=function(e){return goog.string.isEmpty(goog.string.makeSafe(e))},goog.string.isBreakingWhitespace=function(e){return!/[^\t\n\r ]/.test(e)},goog.string.isAlpha=function(e){return!/[^a-zA-Z]/.test(e)},goog.string.isNumeric=function(e){return!/[^0-9]/.test(e)},goog.string.isAlphaNumeric=function(e){return!/[^a-zA-Z0-9]/.test(e)},goog.string.isSpace=function(e){return" "==e},goog.string.isUnicodeChar=function(e){return 1==e.length&&e>=" "&&"~">=e||e>="€"&&"�">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=function(e,t){var o=String(e).toLowerCase(),n=String(t).toLowerCase();return n>o?-1:o==n?0:1},goog.string.numerateCompareRegExp_=/(\.\d+)|(\d+)|(\D+)/g,goog.string.numerateCompare=function(e,t){if(e==t)return 0;if(!e)return-1;if(!t)return 1;for(var o=e.toLowerCase().match(goog.string.numerateCompareRegExp_),n=t.toLowerCase().match(goog.string.numerateCompareRegExp_),i=Math.min(o.length,n.length),r=0;i>r;r++){var s=o[r],l=n[r];if(s!=l)return o=parseInt(s,10),!isNaN(o)&&(n=parseInt(l,10),!isNaN(n)&&o-n)?o-n:l>s?-1:1}return o.length!=n.length?o.length-n.length:t>e?-1:1},goog.string.urlEncode=function(e){return encodeURIComponent(String(e))},goog.string.urlDecode=function(e){return decodeURIComponent(e.replace(/\+/g," "))},goog.string.newLineToBr=function(e,t){return e.replace(/(\r\n|\r|\n)/g,t?"<br />":"<br>")},goog.string.htmlEscape=function(e,t){return t?e.replace(goog.string.amperRe_,"&amp;").replace(goog.string.ltRe_,"&lt;").replace(goog.string.gtRe_,"&gt;").replace(goog.string.quotRe_,"&quot;"):goog.string.allRe_.test(e)?(-1!=e.indexOf("&")&&(e=e.replace(goog.string.amperRe_,"&amp;")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.ltRe_,"&lt;")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.gtRe_,"&gt;")),-1!=e.indexOf('"')&&(e=e.replace(goog.string.quotRe_,"&quot;")),e):e},goog.string.amperRe_=/&/g,goog.string.ltRe_=/</g,goog.string.gtRe_=/>/g,goog.string.quotRe_=/\"/g,goog.string.allRe_=/[&<>\"]/,goog.string.unescapeEntities=function(e){return goog.string.contains(e,"&")?"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(e):goog.string.unescapePureXmlEntities_(e):e},goog.string.unescapeEntitiesUsingDom_=function(e){var t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"'},o=document.createElement("div");return e.replace(goog.string.HTML_ENTITY_PATTERN_,function(e,n){var i=t[e];if(i)return i;if("#"==n.charAt(0)){var r=Number("0"+n.substr(1));isNaN(r)||(i=String.fromCharCode(r))}return i||(o.innerHTML=e+" ",i=o.firstChild.nodeValue.slice(0,-1)),t[e]=i})},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,function(e,t){switch(t){case"amp":return"&";case"lt":return"<";case"gt":return">";case"quot":return'"';default:if("#"==t.charAt(0)){var o=Number("0"+t.substr(1));if(!isNaN(o))return String.fromCharCode(o)}return e}})},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,t){return goog.string.newLineToBr(e.replace(/ /g," &#160;"),t)},goog.string.stripQuotes=function(e,t){for(var o=t.length,n=0;o>n;n++){var i=1==o?t:t.charAt(n);if(e.charAt(0)==i&&e.charAt(e.length-1)==i)return e.substring(1,e.length-1)}return e},goog.string.truncate=function(e,t,o){return o&&(e=goog.string.unescapeEntities(e)),e.length>t&&(e=e.substring(0,t-3)+"..."),o&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(e,t,o,n){if(o&&(e=goog.string.unescapeEntities(e)),n&&e.length>t){n>t&&(n=t);var i=e.length-n;e=e.substring(0,t-n)+"..."+e.substring(i)}else e.length>t&&(n=Math.floor(t/2),i=e.length-n,e=e.substring(0,n+t%2)+"..."+e.substring(i));return o&&(e=goog.string.htmlEscape(e)),e},goog.string.specialEscapeChars_={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"," ":"\\x0B",'"':'\\"',"\\":"\\\\"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(e){if(e=String(e),e.quote)return e.quote();for(var t=['"'],o=0;o<e.length;o++){var n=e.charAt(o),i=n.charCodeAt(0);t[o+1]=goog.string.specialEscapeChars_[n]||(i>31&&127>i?n:goog.string.escapeChar(n))}return t.push('"'),t.join("")},goog.string.escapeString=function(e){for(var t=[],o=0;o<e.length;o++)t[o]=goog.string.escapeChar(e.charAt(o));return t.join("")},goog.string.escapeChar=function(e){if(e in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[e];if(e in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[e]=goog.string.specialEscapeChars_[e];var t=e,o=e.charCodeAt(0);return o>31&&127>o?t=e:(256>o?(t="\\x",(16>o||o>256)&&(t+="0")):(t="\\u",4096>o&&(t+="0")),t+=o.toString(16).toUpperCase()),goog.string.jsEscapeCache_[e]=t},goog.string.toMap=function(e){for(var t={},o=0;o<e.length;o++)t[e.charAt(o)]=!0;return t},goog.string.contains=function(e,t){return-1!=e.indexOf(t)},goog.string.countOf=function(e,t){return e&&t?e.split(t).length-1:0},goog.string.removeAt=function(e,t,o){var n=e;return t>=0&&t<e.length&&o>0&&(n=e.substr(0,t)+e.substr(t+o,e.length-t-o)),n},goog.string.remove=function(e,t){var o=RegExp(goog.string.regExpEscape(t),"");return e.replace(o,"")},goog.string.removeAll=function(e,t){var o=RegExp(goog.string.regExpEscape(t),"g");return e.replace(o,"")},goog.string.regExpEscape=function(e){return String(e).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},goog.string.repeat=function(e,t){return Array(t+1).join(e)},goog.string.padNumber=function(e,t,o){return e=goog.isDef(o)?e.toFixed(o):String(e),o=e.indexOf("."),-1==o&&(o=e.length),goog.string.repeat("0",Math.max(0,t-o))+e},goog.string.makeSafe=function(e){return null==e?"":String(e)},goog.string.buildString=function(){return Array.prototype.join.call(arguments,"")},goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)},goog.string.compareVersions=function(e,t){for(var o=0,n=goog.string.trim(String(e)).split("."),i=goog.string.trim(String(t)).split("."),r=Math.max(n.length,i.length),s=0;0==o&&r>s;s++){var l=n[s]||"",a=i[s]||"",c=RegExp("(\\d*)(\\D*)","g"),u=RegExp("(\\d*)(\\D*)","g");do{var g=c.exec(l)||["","",""],h=u.exec(a)||["","",""];if(0==g[0].length&&0==h[0].length)break;var o=0==g[1].length?0:parseInt(g[1],10),d=0==h[1].length?0:parseInt(h[1],10),o=goog.string.compareElements_(o,d)||goog.string.compareElements_(0==g[2].length,0==h[2].length)||goog.string.compareElements_(g[2],h[2])}while(0==o)}return o},goog.string.compareElements_=function(e,t){return t>e?-1:e>t?1:0},goog.string.HASHCODE_MAX_=4294967296,goog.string.hashCode=function(e){for(var t=0,o=0;o<e.length;++o)t=31*t+e.charCodeAt(o),t%=goog.string.HASHCODE_MAX_;return t},goog.string.uniqueStringCounter_=2147483648*Math.random()|0,goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var t=Number(e);return 0==t&&goog.string.isEmpty(e)?0/0:t},goog.string.isLowerCamelCase=function(e){return/^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return/^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return String(e).replace(/\-([a-z])/g,function(e,t){return t.toUpperCase()})},goog.string.toSelectorCase=function(e){return String(e).replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,t){var o=goog.isString(t)?goog.string.regExpEscape(t):"\\s";return e.replace(RegExp("(^"+(o?"|["+o+"]+":"")+")([a-z])","g"),function(e,t,o){return t+o.toUpperCase()})},goog.string.parseInt=function(e){return isFinite(e)&&(e=String(e)),goog.isString(e)?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):0/0},goog.string.splitLimit=function(e,t,o){e=e.split(t);for(var n=[];o>0&&e.length;)n.push(e.shift()),o--;return e.length&&n.push(e.join(t)),n},goog.userAgent={},goog.userAgent.ASSUME_IE=!1,goog.userAgent.ASSUME_GECKO=!1,goog.userAgent.ASSUME_WEBKIT=!1,goog.userAgent.ASSUME_MOBILE_WEBKIT=!1,goog.userAgent.ASSUME_OPERA=!1,goog.userAgent.ASSUME_ANY_VERSION=!1,goog.userAgent.BROWSER_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_GECKO||goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_OPERA,goog.userAgent.getUserAgentString=function(){return goog.global.navigator?goog.global.navigator.userAgent:null},goog.userAgent.getNavigator=function(){return goog.global.navigator},goog.userAgent.init_=function(){goog.userAgent.detectedOpera_=!1,goog.userAgent.detectedIe_=!1,goog.userAgent.detectedWebkit_=!1,goog.userAgent.detectedMobile_=!1,goog.userAgent.detectedGecko_=!1;var e;if(!goog.userAgent.BROWSER_KNOWN_&&(e=goog.userAgent.getUserAgentString())){var t=goog.userAgent.getNavigator();goog.userAgent.detectedOpera_=goog.string.startsWith(e,"Opera"),goog.userAgent.detectedIe_=!goog.userAgent.detectedOpera_&&(goog.string.contains(e,"MSIE")||goog.string.contains(e,"Trident")),goog.userAgent.detectedWebkit_=!goog.userAgent.detectedOpera_&&goog.string.contains(e,"WebKit"),goog.userAgent.detectedMobile_=goog.userAgent.detectedWebkit_&&goog.string.contains(e,"Mobile"),goog.userAgent.detectedGecko_=!goog.userAgent.detectedOpera_&&!goog.userAgent.detectedWebkit_&&!goog.userAgent.detectedIe_&&"Gecko"==t.product}},goog.userAgent.BROWSER_KNOWN_||goog.userAgent.init_(),goog.userAgent.OPERA=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_OPERA:goog.userAgent.detectedOpera_,goog.userAgent.IE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_IE:goog.userAgent.detectedIe_,goog.userAgent.GECKO=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_GECKO:goog.userAgent.detectedGecko_,goog.userAgent.WEBKIT=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_MOBILE_WEBKIT:goog.userAgent.detectedWebkit_,goog.userAgent.MOBILE=goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.detectedMobile_,goog.userAgent.SAFARI=goog.userAgent.WEBKIT,goog.userAgent.determinePlatform_=function(){var e=goog.userAgent.getNavigator();return e&&e.platform||""},goog.userAgent.PLATFORM=goog.userAgent.determinePlatform_(),goog.userAgent.ASSUME_MAC=!1,goog.userAgent.ASSUME_WINDOWS=!1,goog.userAgent.ASSUME_LINUX=!1,goog.userAgent.ASSUME_X11=!1,goog.userAgent.ASSUME_ANDROID=!1,goog.userAgent.ASSUME_IPHONE=!1,goog.userAgent.ASSUME_IPAD=!1,goog.userAgent.PLATFORM_KNOWN_=goog.userAgent.ASSUME_MAC||goog.userAgent.ASSUME_WINDOWS||goog.userAgent.ASSUME_LINUX||goog.userAgent.ASSUME_X11||goog.userAgent.ASSUME_ANDROID||goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD,goog.userAgent.initPlatform_=function(){goog.userAgent.detectedMac_=goog.string.contains(goog.userAgent.PLATFORM,"Mac"),goog.userAgent.detectedWindows_=goog.string.contains(goog.userAgent.PLATFORM,"Win"),goog.userAgent.detectedLinux_=goog.string.contains(goog.userAgent.PLATFORM,"Linux"),goog.userAgent.detectedX11_=!!goog.userAgent.getNavigator()&&goog.string.contains(goog.userAgent.getNavigator().appVersion||"","X11");var e=goog.userAgent.getUserAgentString();goog.userAgent.detectedAndroid_=!!e&&goog.string.contains(e,"Android"),goog.userAgent.detectedIPhone_=!!e&&goog.string.contains(e,"iPhone"),goog.userAgent.detectedIPad_=!!e&&goog.string.contains(e,"iPad")},goog.userAgent.PLATFORM_KNOWN_||goog.userAgent.initPlatform_(),goog.userAgent.MAC=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_MAC:goog.userAgent.detectedMac_,goog.userAgent.WINDOWS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_WINDOWS:goog.userAgent.detectedWindows_,goog.userAgent.LINUX=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_LINUX:goog.userAgent.detectedLinux_,goog.userAgent.X11=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_X11:goog.userAgent.detectedX11_,goog.userAgent.ANDROID=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_ANDROID:goog.userAgent.detectedAndroid_,goog.userAgent.IPHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE:goog.userAgent.detectedIPhone_,goog.userAgent.IPAD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPAD:goog.userAgent.detectedIPad_,goog.userAgent.determineVersion_=function(){var e,t="";return goog.userAgent.OPERA&&goog.global.opera?(t=goog.global.opera.version,t="function"==typeof t?t():t):(goog.userAgent.GECKO?e=/rv\:([^\);]+)(\)|;)/:goog.userAgent.IE?e=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:goog.userAgent.WEBKIT&&(e=/WebKit\/(\S+)/),e&&(t=(t=e.exec(goog.userAgent.getUserAgentString()))?t[1]:"")),goog.userAgent.IE&&(e=goog.userAgent.getDocumentMode_(),e>parseFloat(t))?String(e):t},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,t){return goog.string.compareVersions(e,t)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.userAgent.isVersionOrHigherCache_[e]||(goog.userAgent.isVersionOrHigherCache_[e]=0<=goog.string.compareVersions(goog.userAgent.VERSION,e))},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return goog.userAgent.IE&&goog.userAgent.DOCUMENT_MODE>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){var e=goog.global.document;return e&&goog.userAgent.IE?goog.userAgent.getDocumentMode_()||("CSS1Compat"==e.compatMode?parseInt(goog.userAgent.VERSION,10):5):void 0}(),goog.disposable={},goog.disposable.IDisposable=function(){},goog.Disposable=function(){goog.Disposable.MONITORING_MODE!=goog.Disposable.MonitoringMode.OFF&&(goog.Disposable.INCLUDE_STACK_ON_CREATION&&(this.creationStack=Error().stack),goog.Disposable.instances_[goog.getUid(this)]=this)},goog.Disposable.MonitoringMode={OFF:0,PERMANENT:1,INTERACTIVE:2},goog.Disposable.MONITORING_MODE=0,goog.Disposable.INCLUDE_STACK_ON_CREATION=!0,goog.Disposable.instances_={},goog.Disposable.getUndisposedObjects=function(){var e,t=[];for(e in goog.Disposable.instances_)goog.Disposable.instances_.hasOwnProperty(e)&&t.push(goog.Disposable.instances_[Number(e)]);return t},goog.Disposable.clearUndisposedObjects=function(){goog.Disposable.instances_={}},goog.Disposable.prototype.disposed_=!1,goog.Disposable.prototype.isDisposed=function(){return this.disposed_},goog.Disposable.prototype.getDisposed=goog.Disposable.prototype.isDisposed,goog.Disposable.prototype.dispose=function(){if(!this.disposed_&&(this.disposed_=!0,this.disposeInternal(),goog.Disposable.MONITORING_MODE!=goog.Disposable.MonitoringMode.OFF)){var e=goog.getUid(this);
17
- if(goog.Disposable.MONITORING_MODE==goog.Disposable.MonitoringMode.PERMANENT&&!goog.Disposable.instances_.hasOwnProperty(e))throw Error(this+" did not call the goog.Disposable base constructor or was disposed of after a clearUndisposedObjects call");delete goog.Disposable.instances_[e]}},goog.Disposable.prototype.registerDisposable=function(e){this.addOnDisposeCallback(goog.partial(goog.dispose,e))},goog.Disposable.prototype.addOnDisposeCallback=function(e,t){this.onDisposeCallbacks_||(this.onDisposeCallbacks_=[]),this.onDisposeCallbacks_.push(goog.bind(e,t))},goog.Disposable.prototype.disposeInternal=function(){if(this.onDisposeCallbacks_)for(;this.onDisposeCallbacks_.length;)this.onDisposeCallbacks_.shift()()},goog.Disposable.isDisposed=function(e){return e&&"function"==typeof e.isDisposed?e.isDisposed():!1},goog.dispose=function(e){e&&"function"==typeof e.dispose&&e.dispose()},goog.disposeAll=function(){for(var e=0,t=arguments.length;t>e;++e){var o=arguments[e];goog.isArrayLike(o)?goog.disposeAll.apply(null,o):goog.dispose(o)}},goog.debug={},goog.debug.Error=function(e){Error.captureStackTrace?Error.captureStackTrace(this,goog.debug.Error):this.stack=Error().stack||"",e&&(this.message=String(e))},goog.inherits(goog.debug.Error,Error),goog.debug.Error.prototype.name="CustomError",goog.dom={},goog.dom.NodeType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12},goog.asserts={},goog.asserts.ENABLE_ASSERTS=goog.DEBUG,goog.asserts.AssertionError=function(e,t){t.unshift(e),goog.debug.Error.call(this,goog.string.subs.apply(null,t)),t.shift(),this.messagePattern=e},goog.inherits(goog.asserts.AssertionError,goog.debug.Error),goog.asserts.AssertionError.prototype.name="AssertionError",goog.asserts.doAssertFailure_=function(e,t,o,n){var i="Assertion failed";if(o)var i=i+(": "+o),r=n;else e&&(i+=": "+e,r=t);throw new goog.asserts.AssertionError(""+i,r||[])},goog.asserts.assert=function(e,t){return goog.asserts.ENABLE_ASSERTS&&!e&&goog.asserts.doAssertFailure_("",null,t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.fail=function(e){if(goog.asserts.ENABLE_ASSERTS)throw new goog.asserts.AssertionError("Failure"+(e?": "+e:""),Array.prototype.slice.call(arguments,1))},goog.asserts.assertNumber=function(e,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(e)&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(e),e],t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertString=function(e,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isString(e)&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(e),e],t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertFunction=function(e,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(e)&&goog.asserts.doAssertFailure_("Expected function but got %s: %s.",[goog.typeOf(e),e],t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertObject=function(e,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isObject(e)&&goog.asserts.doAssertFailure_("Expected object but got %s: %s.",[goog.typeOf(e),e],t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertArray=function(e,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isArray(e)&&goog.asserts.doAssertFailure_("Expected array but got %s: %s.",[goog.typeOf(e),e],t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertBoolean=function(e,t){return goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(e)&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(e),e],t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertElement=function(e,t){return!goog.asserts.ENABLE_ASSERTS||goog.isObject(e)&&e.nodeType==goog.dom.NodeType.ELEMENT||goog.asserts.doAssertFailure_("Expected Element but got %s: %s.",[goog.typeOf(e),e],t,Array.prototype.slice.call(arguments,2)),e},goog.asserts.assertInstanceof=function(e,t,o){return!goog.asserts.ENABLE_ASSERTS||e instanceof t||goog.asserts.doAssertFailure_("instanceof check failed.",null,o,Array.prototype.slice.call(arguments,3)),e},goog.asserts.assertObjectPrototypeIsIntact=function(){for(var e in Object.prototype)goog.asserts.fail(e+" should not be enumerable in Object.prototype.")},goog.array={},goog.NATIVE_ARRAY_PROTOTYPES=goog.TRUSTED_SITE,goog.array.peek=function(e){return e[e.length-1]},goog.array.ARRAY_PROTOTYPE_=Array.prototype,goog.array.indexOf=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.indexOf?function(e,t,o){return goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.indexOf.call(e,t,o)}:function(e,t,o){if(o=null==o?0:0>o?Math.max(0,e.length+o):o,goog.isString(e))return goog.isString(t)&&1==t.length?e.indexOf(t,o):-1;for(;o<e.length;o++)if(o in e&&e[o]===t)return o;return-1},goog.array.lastIndexOf=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.lastIndexOf?function(e,t,o){return goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(e,t,null==o?e.length-1:o)}:function(e,t,o){if(o=null==o?e.length-1:o,0>o&&(o=Math.max(0,e.length+o)),goog.isString(e))return goog.isString(t)&&1==t.length?e.lastIndexOf(t,o):-1;for(;o>=0;o--)if(o in e&&e[o]===t)return o;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.forEach?function(e,t,o){goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.forEach.call(e,t,o)}:function(e,t,o){for(var n=e.length,i=goog.isString(e)?e.split(""):e,r=0;n>r;r++)r in i&&t.call(o,i[r],r,e)},goog.array.forEachRight=function(e,t,o){for(var n=e.length,i=goog.isString(e)?e.split(""):e,n=n-1;n>=0;--n)n in i&&t.call(o,i[n],n,e)},goog.array.filter=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.filter?function(e,t,o){return goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.filter.call(e,t,o)}:function(e,t,o){for(var n=e.length,i=[],r=0,s=goog.isString(e)?e.split(""):e,l=0;n>l;l++)if(l in s){var a=s[l];t.call(o,a,l,e)&&(i[r++]=a)}return i},goog.array.map=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.map?function(e,t,o){return goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.map.call(e,t,o)}:function(e,t,o){for(var n=e.length,i=Array(n),r=goog.isString(e)?e.split(""):e,s=0;n>s;s++)s in r&&(i[s]=t.call(o,r[s],s,e));return i},goog.array.reduce=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.reduce?function(e,t,o,n){return goog.asserts.assert(null!=e.length),n&&(t=goog.bind(t,n)),goog.array.ARRAY_PROTOTYPE_.reduce.call(e,t,o)}:function(e,t,o,n){var i=o;return goog.array.forEach(e,function(o,r){i=t.call(n,i,o,r,e)}),i},goog.array.reduceRight=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.reduceRight?function(e,t,o,n){return goog.asserts.assert(null!=e.length),n&&(t=goog.bind(t,n)),goog.array.ARRAY_PROTOTYPE_.reduceRight.call(e,t,o)}:function(e,t,o,n){var i=o;return goog.array.forEachRight(e,function(o,r){i=t.call(n,i,o,r,e)}),i},goog.array.some=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.some?function(e,t,o){return goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.some.call(e,t,o)}:function(e,t,o){for(var n=e.length,i=goog.isString(e)?e.split(""):e,r=0;n>r;r++)if(r in i&&t.call(o,i[r],r,e))return!0;return!1},goog.array.every=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.every?function(e,t,o){return goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.every.call(e,t,o)}:function(e,t,o){for(var n=e.length,i=goog.isString(e)?e.split(""):e,r=0;n>r;r++)if(r in i&&!t.call(o,i[r],r,e))return!1;return!0},goog.array.count=function(e,t,o){var n=0;return goog.array.forEach(e,function(e,i,r){t.call(o,e,i,r)&&++n},o),n},goog.array.find=function(e,t,o){return t=goog.array.findIndex(e,t,o),0>t?null:goog.isString(e)?e.charAt(t):e[t]},goog.array.findIndex=function(e,t,o){for(var n=e.length,i=goog.isString(e)?e.split(""):e,r=0;n>r;r++)if(r in i&&t.call(o,i[r],r,e))return r;return-1},goog.array.findRight=function(e,t,o){return t=goog.array.findIndexRight(e,t,o),0>t?null:goog.isString(e)?e.charAt(t):e[t]},goog.array.findIndexRight=function(e,t,o){for(var n=e.length,i=goog.isString(e)?e.split(""):e,n=n-1;n>=0;n--)if(n in i&&t.call(o,i[n],n,e))return n;return-1},goog.array.contains=function(e,t){return 0<=goog.array.indexOf(e,t)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!goog.isArray(e))for(var t=e.length-1;t>=0;t--)delete e[t];e.length=0},goog.array.insert=function(e,t){goog.array.contains(e,t)||e.push(t)},goog.array.insertAt=function(e,t,o){goog.array.splice(e,o,0,t)},goog.array.insertArrayAt=function(e,t,o){goog.partial(goog.array.splice,e,o,0).apply(null,t)},goog.array.insertBefore=function(e,t,o){var n;2==arguments.length||0>(n=goog.array.indexOf(e,o))?e.push(t):goog.array.insertAt(e,t,n)},goog.array.remove=function(e,t){var o,n=goog.array.indexOf(e,t);return(o=n>=0)&&goog.array.removeAt(e,n),o},goog.array.removeAt=function(e,t){return goog.asserts.assert(null!=e.length),1==goog.array.ARRAY_PROTOTYPE_.splice.call(e,t,1).length},goog.array.removeIf=function(e,t,o){return t=goog.array.findIndex(e,t,o),t>=0?(goog.array.removeAt(e,t),!0):!1},goog.array.concat=function(){return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_,arguments)},goog.array.toArray=function(e){var t=e.length;if(t>0){for(var o=Array(t),n=0;t>n;n++)o[n]=e[n];return o}return[]},goog.array.clone=goog.array.toArray,goog.array.extend=function(e){for(var t=1;t<arguments.length;t++){var o,n=arguments[t];if(goog.isArray(n)||(o=goog.isArrayLike(n))&&Object.prototype.hasOwnProperty.call(n,"callee"))e.push.apply(e,n);else if(o)for(var i=e.length,r=n.length,s=0;r>s;s++)e[i+s]=n[s];else e.push(n)}},goog.array.splice=function(e){return goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.splice.apply(e,goog.array.slice(arguments,1))},goog.array.slice=function(e,t,o){return goog.asserts.assert(null!=e.length),2>=arguments.length?goog.array.ARRAY_PROTOTYPE_.slice.call(e,t):goog.array.ARRAY_PROTOTYPE_.slice.call(e,t,o)},goog.array.removeDuplicates=function(e,t,o){t=t||e;var n=function(){return goog.isObject(s)?"o"+goog.getUid(s):(typeof s).charAt(0)+s};o=o||n;for(var n={},i=0,r=0;r<e.length;){var s=e[r++],l=o(s);Object.prototype.hasOwnProperty.call(n,l)||(n[l]=!0,t[i++]=s)}t.length=i},goog.array.binarySearch=function(e,t,o){return goog.array.binarySearch_(e,o||goog.array.defaultCompare,!1,t)},goog.array.binarySelect=function(e,t,o){return goog.array.binarySearch_(e,t,!0,void 0,o)},goog.array.binarySearch_=function(e,t,o,n,i){for(var r,s=0,l=e.length;l>s;){var a,c=s+l>>1;a=o?t.call(i,e[c],c,e):t(n,e[c]),a>0?s=c+1:(l=c,r=!a)}return r?s:~s},goog.array.sort=function(e,t){goog.asserts.assert(null!=e.length),goog.array.ARRAY_PROTOTYPE_.sort.call(e,t||goog.array.defaultCompare)},goog.array.stableSort=function(e,t){for(var o=0;o<e.length;o++)e[o]={index:o,value:e[o]};var n=t||goog.array.defaultCompare;for(goog.array.sort(e,function(e,t){return n(e.value,t.value)||e.index-t.index}),o=0;o<e.length;o++)e[o]=e[o].value},goog.array.sortObjectsByKey=function(e,t,o){var n=o||goog.array.defaultCompare;goog.array.sort(e,function(e,o){return n(e[t],o[t])})},goog.array.isSorted=function(e,t,o){t=t||goog.array.defaultCompare;for(var n=1;n<e.length;n++){var i=t(e[n-1],e[n]);if(i>0||0==i&&o)return!1}return!0},goog.array.equals=function(e,t,o){if(!goog.isArrayLike(e)||!goog.isArrayLike(t)||e.length!=t.length)return!1;var n=e.length;o=o||goog.array.defaultCompareEquality;for(var i=0;n>i;i++)if(!o(e[i],t[i]))return!1;return!0},goog.array.compare=function(e,t,o){return goog.array.equals(e,t,o)},goog.array.compare3=function(e,t,o){o=o||goog.array.defaultCompare;for(var n=Math.min(e.length,t.length),i=0;n>i;i++){var r=o(e[i],t[i]);if(0!=r)return r}return goog.array.defaultCompare(e.length,t.length)},goog.array.defaultCompare=function(e,t){return e>t?1:t>e?-1:0},goog.array.defaultCompareEquality=function(e,t){return e===t},goog.array.binaryInsert=function(e,t,o){return o=goog.array.binarySearch(e,t,o),0>o?(goog.array.insertAt(e,t,-(o+1)),!0):!1},goog.array.binaryRemove=function(e,t,o){return t=goog.array.binarySearch(e,t,o),t>=0?goog.array.removeAt(e,t):!1},goog.array.bucket=function(e,t,o){for(var n={},i=0;i<e.length;i++){var r=e[i],s=t.call(o,r,i,e);goog.isDef(s)&&(n[s]||(n[s]=[])).push(r)}return n},goog.array.toObject=function(e,t,o){var n={};return goog.array.forEach(e,function(i,r){n[t.call(o,i,r,e)]=i}),n},goog.array.range=function(e,t,o){var n=[],i=0,r=e;if(o=o||1,void 0!==t&&(i=e,r=t),0>o*(r-i))return[];if(o>0)for(e=i;r>e;e+=o)n.push(e);else for(e=i;e>r;e+=o)n.push(e);return n},goog.array.repeat=function(e,t){for(var o=[],n=0;t>n;n++)o[n]=e;return o},goog.array.flatten=function(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];goog.isArray(o)?e.push.apply(e,goog.array.flatten.apply(null,o)):e.push(o)}return e},goog.array.rotate=function(e,t){return goog.asserts.assert(null!=e.length),e.length&&(t%=e.length,t>0?goog.array.ARRAY_PROTOTYPE_.unshift.apply(e,e.splice(-t,t)):0>t&&goog.array.ARRAY_PROTOTYPE_.push.apply(e,e.splice(0,-t))),e},goog.array.moveItem=function(e,t,o){goog.asserts.assert(t>=0&&t<e.length),goog.asserts.assert(o>=0&&o<e.length),t=goog.array.ARRAY_PROTOTYPE_.splice.call(e,t,1),goog.array.ARRAY_PROTOTYPE_.splice.call(e,o,0,t[0])},goog.array.zip=function(){if(!arguments.length)return[];for(var e=[],t=0;;t++){for(var o=[],n=0;n<arguments.length;n++){var i=arguments[n];if(t>=i.length)return e;o.push(i[t])}e.push(o)}},goog.array.shuffle=function(e,t){for(var o=t||Math.random,n=e.length-1;n>0;n--){var i=Math.floor(o()*(n+1)),r=e[n];e[n]=e[i],e[i]=r}},goog.debug.entryPointRegistry={},goog.debug.EntryPointMonitor=function(){},goog.debug.entryPointRegistry.refList_=[],goog.debug.entryPointRegistry.monitors_=[],goog.debug.entryPointRegistry.monitorsMayExist_=!1,goog.debug.entryPointRegistry.register=function(e){if(goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length]=e,goog.debug.entryPointRegistry.monitorsMayExist_)for(var t=goog.debug.entryPointRegistry.monitors_,o=0;o<t.length;o++)e(goog.bind(t[o].wrap,t[o]))},goog.debug.entryPointRegistry.monitorAll=function(e){goog.debug.entryPointRegistry.monitorsMayExist_=!0;for(var t=goog.bind(e.wrap,e),o=0;o<goog.debug.entryPointRegistry.refList_.length;o++)goog.debug.entryPointRegistry.refList_[o](t);goog.debug.entryPointRegistry.monitors_.push(e)},goog.debug.entryPointRegistry.unmonitorAllIfPossible=function(e){var t=goog.debug.entryPointRegistry.monitors_;goog.asserts.assert(e==t[t.length-1],"Only the most recent monitor can be unwrapped."),e=goog.bind(e.unwrap,e);for(var o=0;o<goog.debug.entryPointRegistry.refList_.length;o++)goog.debug.entryPointRegistry.refList_[o](e);t.length--},goog.events={},goog.events.BrowserFeature={HAS_W3C_BUTTON:!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9),HAS_W3C_EVENT_SUPPORT:!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9),SET_KEY_CODE_TO_PREVENT_DEFAULT:goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9"),HAS_NAVIGATOR_ONLINE_PROPERTY:!goog.userAgent.WEBKIT||goog.userAgent.isVersionOrHigher("528"),HAS_HTML5_NETWORK_EVENT_SUPPORT:goog.userAgent.GECKO&&goog.userAgent.isVersionOrHigher("1.9b")||goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("8")||goog.userAgent.OPERA&&goog.userAgent.isVersionOrHigher("9.5")||goog.userAgent.WEBKIT&&goog.userAgent.isVersionOrHigher("528"),HTML5_NETWORK_EVENTS_FIRE_ON_BODY:goog.userAgent.GECKO&&!goog.userAgent.isVersionOrHigher("8")||goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9"),TOUCH_ENABLED:"ontouchstart"in goog.global||!!(goog.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!goog.global.navigator||!goog.global.navigator.msMaxTouchPoints)},goog.events.EventId=function(e){this.id=e},goog.events.EventId.prototype.toString=function(){return this.id},goog.events.Event=function(e,t){this.type=e instanceof goog.events.EventId?String(e):e,this.currentTarget=this.target=t},goog.events.Event.prototype.disposeInternal=function(){},goog.events.Event.prototype.dispose=function(){},goog.events.Event.prototype.propagationStopped_=!1,goog.events.Event.prototype.defaultPrevented=!1,goog.events.Event.prototype.returnValue_=!0,goog.events.Event.prototype.stopPropagation=function(){this.propagationStopped_=!0},goog.events.Event.prototype.preventDefault=function(){this.defaultPrevented=!0,this.returnValue_=!1},goog.events.Event.stopPropagation=function(e){e.stopPropagation()},goog.events.Event.preventDefault=function(e){e.preventDefault()},goog.events.getVendorPrefixedName_=function(e){return goog.userAgent.WEBKIT?"webkit"+e:goog.userAgent.OPERA?"o"+e.toLowerCase():e.toLowerCase()},goog.events.EventType={CLICK:"click",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",MOUSEENTER:"mouseenter",MOUSELEAVE:"mouseleave",SELECTSTART:"selectstart",KEYPRESS:"keypress",KEYDOWN:"keydown",KEYUP:"keyup",BLUR:"blur",FOCUS:"focus",DEACTIVATE:"deactivate",FOCUSIN:goog.userAgent.IE?"focusin":"DOMFocusIn",FOCUSOUT:goog.userAgent.IE?"focusout":"DOMFocusOut",CHANGE:"change",SELECT:"select",SUBMIT:"submit",INPUT:"input",PROPERTYCHANGE:"propertychange",DRAGSTART:"dragstart",DRAG:"drag",DRAGENTER:"dragenter",DRAGOVER:"dragover",DRAGLEAVE:"dragleave",DROP:"drop",DRAGEND:"dragend",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel",BEFOREUNLOAD:"beforeunload",CONSOLEMESSAGE:"consolemessage",CONTEXTMENU:"contextmenu",DOMCONTENTLOADED:"DOMContentLoaded",ERROR:"error",HELP:"help",LOAD:"load",LOSECAPTURE:"losecapture",ORIENTATIONCHANGE:"orientationchange",READYSTATECHANGE:"readystatechange",RESIZE:"resize",SCROLL:"scroll",UNLOAD:"unload",HASHCHANGE:"hashchange",PAGEHIDE:"pagehide",PAGESHOW:"pageshow",POPSTATE:"popstate",COPY:"copy",PASTE:"paste",CUT:"cut",BEFORECOPY:"beforecopy",BEFORECUT:"beforecut",BEFOREPASTE:"beforepaste",ONLINE:"online",OFFLINE:"offline",MESSAGE:"message",CONNECT:"connect",ANIMATIONSTART:goog.events.getVendorPrefixedName_("AnimationStart"),ANIMATIONEND:goog.events.getVendorPrefixedName_("AnimationEnd"),ANIMATIONITERATION:goog.events.getVendorPrefixedName_("AnimationIteration"),TRANSITIONEND:goog.events.getVendorPrefixedName_("TransitionEnd"),POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTERCANCEL:"pointercancel",POINTERMOVE:"pointermove",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",GOTPOINTERCAPTURE:"gotpointercapture",LOSTPOINTERCAPTURE:"lostpointercapture",MSGESTURECHANGE:"MSGestureChange",MSGESTUREEND:"MSGestureEnd",MSGESTUREHOLD:"MSGestureHold",MSGESTURESTART:"MSGestureStart",MSGESTURETAP:"MSGestureTap",MSGOTPOINTERCAPTURE:"MSGotPointerCapture",MSINERTIASTART:"MSInertiaStart",MSLOSTPOINTERCAPTURE:"MSLostPointerCapture",MSPOINTERCANCEL:"MSPointerCancel",MSPOINTERDOWN:"MSPointerDown",MSPOINTERENTER:"MSPointerEnter",MSPOINTERHOVER:"MSPointerHover",MSPOINTERLEAVE:"MSPointerLeave",MSPOINTERMOVE:"MSPointerMove",MSPOINTEROUT:"MSPointerOut",MSPOINTEROVER:"MSPointerOver",MSPOINTERUP:"MSPointerUp",TEXTINPUT:"textinput",COMPOSITIONSTART:"compositionstart",COMPOSITIONUPDATE:"compositionupdate",COMPOSITIONEND:"compositionend",EXIT:"exit",LOADABORT:"loadabort",LOADCOMMIT:"loadcommit",LOADREDIRECT:"loadredirect",LOADSTART:"loadstart",LOADSTOP:"loadstop",RESPONSIVE:"responsive",SIZECHANGED:"sizechanged",UNRESPONSIVE:"unresponsive",VISIBILITYCHANGE:"visibilitychange"},goog.reflect={},goog.reflect.object=function(e,t){return t},goog.reflect.sinkValue=function(e){return goog.reflect.sinkValue[" "](e),e},goog.reflect.sinkValue[" "]=goog.nullFunction,goog.reflect.canAccessProperty=function(e,t){try{return goog.reflect.sinkValue(e[t]),!0}catch(o){}return!1},goog.events.BrowserEvent=function(e,t){e&&this.init(e,t)},goog.inherits(goog.events.BrowserEvent,goog.events.Event),goog.events.BrowserEvent.MouseButton={LEFT:0,MIDDLE:1,RIGHT:2},goog.events.BrowserEvent.IEButtonMap=[1,4,2],goog.events.BrowserEvent.prototype.target=null,goog.events.BrowserEvent.prototype.relatedTarget=null,goog.events.BrowserEvent.prototype.offsetX=0,goog.events.BrowserEvent.prototype.offsetY=0,goog.events.BrowserEvent.prototype.clientX=0,goog.events.BrowserEvent.prototype.clientY=0,goog.events.BrowserEvent.prototype.screenX=0,goog.events.BrowserEvent.prototype.screenY=0,goog.events.BrowserEvent.prototype.button=0,goog.events.BrowserEvent.prototype.keyCode=0,goog.events.BrowserEvent.prototype.charCode=0,goog.events.BrowserEvent.prototype.ctrlKey=!1,goog.events.BrowserEvent.prototype.altKey=!1,goog.events.BrowserEvent.prototype.shiftKey=!1,goog.events.BrowserEvent.prototype.metaKey=!1,goog.events.BrowserEvent.prototype.platformModifierKey=!1,goog.events.BrowserEvent.prototype.event_=null,goog.events.BrowserEvent.prototype.init=function(e,t){var o=this.type=e.type;goog.events.Event.call(this,o),this.target=e.target||e.srcElement,this.currentTarget=t;var n=e.relatedTarget;n?goog.userAgent.GECKO&&(goog.reflect.canAccessProperty(n,"nodeName")||(n=null)):o==goog.events.EventType.MOUSEOVER?n=e.fromElement:o==goog.events.EventType.MOUSEOUT&&(n=e.toElement),this.relatedTarget=n,this.offsetX=goog.userAgent.WEBKIT||void 0!==e.offsetX?e.offsetX:e.layerX,this.offsetY=goog.userAgent.WEBKIT||void 0!==e.offsetY?e.offsetY:e.layerY,this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0,this.button=e.button,this.keyCode=e.keyCode||0,this.charCode=e.charCode||("keypress"==o?e.keyCode:0),this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.platformModifierKey=goog.userAgent.MAC?e.metaKey:e.ctrlKey,this.state=e.state,this.event_=e,e.defaultPrevented&&this.preventDefault(),delete this.propagationStopped_},goog.events.BrowserEvent.prototype.isButton=function(e){return goog.events.BrowserFeature.HAS_W3C_BUTTON?this.event_.button==e:"click"==this.type?e==goog.events.BrowserEvent.MouseButton.LEFT:!!(this.event_.button&goog.events.BrowserEvent.IEButtonMap[e])},goog.events.BrowserEvent.prototype.isMouseActionButton=function(){return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT)&&!(goog.userAgent.WEBKIT&&goog.userAgent.MAC&&this.ctrlKey)},goog.events.BrowserEvent.prototype.stopPropagation=function(){goog.events.BrowserEvent.superClass_.stopPropagation.call(this),this.event_.stopPropagation?this.event_.stopPropagation():this.event_.cancelBubble=!0},goog.events.BrowserEvent.prototype.preventDefault=function(){goog.events.BrowserEvent.superClass_.preventDefault.call(this);var e=this.event_;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(t){}},goog.events.BrowserEvent.prototype.getBrowserEvent=function(){return this.event_},goog.events.BrowserEvent.prototype.disposeInternal=function(){},goog.events.Listenable=function(){},goog.events.Listenable.IMPLEMENTED_BY_PROP="closure_listenable_"+(1e6*Math.random()|0),goog.events.Listenable.addImplementation=function(e){e.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP]=!0},goog.events.Listenable.isImplementedBy=function(e){try{return!(!e||!e[goog.events.Listenable.IMPLEMENTED_BY_PROP])}catch(t){return!1}},goog.events.ListenableKey=function(){},goog.events.ListenableKey.counter_=0,goog.events.ListenableKey.reserveKey=function(){return++goog.events.ListenableKey.counter_},goog.events.Listener=function(e,t,o,n,i,r){goog.events.Listener.ENABLE_MONITORING&&(this.creationStack=Error().stack),this.listener=e,this.proxy=t,this.src=o,this.type=n,this.capture=!!i,this.handler=r,this.key=goog.events.ListenableKey.reserveKey(),this.removed=this.callOnce=!1},goog.events.Listener.ENABLE_MONITORING=!1,goog.events.Listener.prototype.markAsRemoved=function(){this.removed=!0,this.handler=this.src=this.proxy=this.listener=null},goog.object={},goog.object.forEach=function(e,t,o){for(var n in e)t.call(o,e[n],n,e)},goog.object.filter=function(e,t,o){var n,i={};for(n in e)t.call(o,e[n],n,e)&&(i[n]=e[n]);return i},goog.object.map=function(e,t,o){var n,i={};for(n in e)i[n]=t.call(o,e[n],n,e);return i},goog.object.some=function(e,t,o){for(var n in e)if(t.call(o,e[n],n,e))return!0;return!1},goog.object.every=function(e,t,o){for(var n in e)if(!t.call(o,e[n],n,e))return!1;return!0},goog.object.getCount=function(e){var t,o=0;for(t in e)o++;return o},goog.object.getAnyKey=function(e){for(var t in e)return t},goog.object.getAnyValue=function(e){for(var t in e)return e[t]},goog.object.contains=function(e,t){return goog.object.containsValue(e,t)},goog.object.getValues=function(e){var t,o=[],n=0;for(t in e)o[n++]=e[t];return o},goog.object.getKeys=function(e){var t,o=[],n=0;for(t in e)o[n++]=t;return o},goog.object.getValueByKeys=function(e,t){for(var o=goog.isArrayLike(t),n=o?t:arguments,o=o?0:1;o<n.length&&(e=e[n[o]],goog.isDef(e));o++);return e},goog.object.containsKey=function(e,t){return t in e},goog.object.containsValue=function(e,t){for(var o in e)if(e[o]==t)return!0;return!1},goog.object.findKey=function(e,t,o){for(var n in e)if(t.call(o,e[n],n,e))return n},goog.object.findValue=function(e,t,o){return(t=goog.object.findKey(e,t,o))&&e[t]},goog.object.isEmpty=function(e){for(var t in e)return!1;return!0},goog.object.clear=function(e){for(var t in e)delete e[t]},goog.object.remove=function(e,t){var o;return(o=t in e)&&delete e[t],o},goog.object.add=function(e,t,o){if(t in e)throw Error('The object already contains the key "'+t+'"');goog.object.set(e,t,o)},goog.object.get=function(e,t,o){return t in e?e[t]:o},goog.object.set=function(e,t,o){e[t]=o},goog.object.setIfUndefined=function(e,t,o){return t in e?e[t]:e[t]=o},goog.object.clone=function(e){var t,o={};for(t in e)o[t]=e[t];return o},goog.object.unsafeClone=function(e){var t=goog.typeOf(e);if("object"==t||"array"==t){if(e.clone)return e.clone();var o,t="array"==t?[]:{};for(o in e)t[o]=goog.object.unsafeClone(e[o]);return t}return e},goog.object.transpose=function(e){var t,o={};for(t in e)o[e[t]]=t;return o},goog.object.PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),goog.object.extend=function(e){for(var t,o,n=1;n<arguments.length;n++){o=arguments[n];for(t in o)e[t]=o[t];for(var i=0;i<goog.object.PROTOTYPE_FIELDS_.length;i++)t=goog.object.PROTOTYPE_FIELDS_[i],Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}},goog.object.create=function(){var e=arguments.length;if(1==e&&goog.isArray(arguments[0]))return goog.object.create.apply(null,arguments[0]);if(e%2)throw Error("Uneven number of arguments");for(var t={},o=0;e>o;o+=2)t[arguments[o]]=arguments[o+1];return t},goog.object.createSet=function(){var e=arguments.length;if(1==e&&goog.isArray(arguments[0]))return goog.object.createSet.apply(null,arguments[0]);for(var t={},o=0;e>o;o++)t[arguments[o]]=!0;return t},goog.object.createImmutableView=function(e){var t=e;return Object.isFrozen&&!Object.isFrozen(e)&&(t=Object.create(e),Object.freeze(t)),t},goog.object.isImmutableView=function(e){return!!Object.isFrozen&&Object.isFrozen(e)},goog.events.ListenerMap=function(e){this.src=e,this.listeners={},this.typeCount_=0},goog.events.ListenerMap.prototype.getTypeCount=function(){return this.typeCount_},goog.events.ListenerMap.prototype.getListenerCount=function(){var e,t=0;for(e in this.listeners)t+=this.listeners[e].length;return t},goog.events.ListenerMap.prototype.add=function(e,t,o,n,i){var r=this.listeners[e];r||(r=this.listeners[e]=[],this.typeCount_++);var s=goog.events.ListenerMap.findListenerIndex_(r,t,n,i);return s>-1?(e=r[s],o||(e.callOnce=!1)):(e=new goog.events.Listener(t,null,this.src,e,!!n,i),e.callOnce=o,r.push(e)),e},goog.events.ListenerMap.prototype.remove=function(e,t,o,n){if(!(e in this.listeners))return!1;var i=this.listeners[e];return t=goog.events.ListenerMap.findListenerIndex_(i,t,o,n),t>-1?(i[t].markAsRemoved(),goog.array.removeAt(i,t),0==i.length&&(delete this.listeners[e],this.typeCount_--),!0):!1},goog.events.ListenerMap.prototype.removeByKey=function(e){var t=e.type;if(!(t in this.listeners))return!1;var o=goog.array.remove(this.listeners[t],e);return o&&(e.markAsRemoved(),0==this.listeners[t].length&&(delete this.listeners[t],this.typeCount_--)),o},goog.events.ListenerMap.prototype.removeAll=function(e){var t,o=0;for(t in this.listeners)if(!e||t==e){for(var n=this.listeners[t],i=0;i<n.length;i++)++o,n[i].markAsRemoved();delete this.listeners[t],this.typeCount_--}return o},goog.events.ListenerMap.prototype.getListeners=function(e,t){var o=this.listeners[e],n=[];if(o)for(var i=0;i<o.length;++i){var r=o[i];r.capture==t&&n.push(r)}return n},goog.events.ListenerMap.prototype.getListener=function(e,t,o,n){e=this.listeners[e];var i=-1;return e&&(i=goog.events.ListenerMap.findListenerIndex_(e,t,o,n)),i>-1?e[i]:null},goog.events.ListenerMap.prototype.hasListener=function(e,t){var o=goog.isDef(e),n=goog.isDef(t);return goog.object.some(this.listeners,function(i){for(var r=0;r<i.length;++r)if(!(o&&i[r].type!=e||n&&i[r].capture!=t))return!0;return!1})},goog.events.ListenerMap.findListenerIndex_=function(e,t,o,n){for(var i=0;i<e.length;++i){var r=e[i];if(!r.removed&&r.listener==t&&r.capture==!!o&&r.handler==n)return i}return-1},goog.events.listeners_={},goog.events.LISTENER_MAP_PROP_="closure_lm_"+(1e6*Math.random()|0),goog.events.onString_="on",goog.events.onStringMap_={},goog.events.CaptureSimulationMode={OFF_AND_FAIL:0,OFF_AND_SILENT:1,ON:2},goog.events.CAPTURE_SIMULATION_MODE=2,goog.events.listenerCountEstimate_=0,goog.events.listen=function(e,t,o,n,i){if(goog.isArray(t)){for(var r=0;r<t.length;r++)goog.events.listen(e,t[r],o,n,i);return null}return o=goog.events.wrapListener_(o),goog.events.Listenable.isImplementedBy(e)?e.listen(t,o,n,i):goog.events.listen_(e,t,o,!1,n,i)},goog.events.listen_=function(e,t,o,n,i,r){if(!t)throw Error("Invalid event type");var s=!!i;if(s&&!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT){if(goog.events.CAPTURE_SIMULATION_MODE==goog.events.CaptureSimulationMode.OFF_AND_FAIL)return goog.asserts.fail("Can not register capture listener in IE8-."),null;if(goog.events.CAPTURE_SIMULATION_MODE==goog.events.CaptureSimulationMode.OFF_AND_SILENT)return null}var l=goog.events.getListenerMap_(e);return l||(e[goog.events.LISTENER_MAP_PROP_]=l=new goog.events.ListenerMap(e)),o=l.add(t,o,n,i,r),o.proxy?o:(n=goog.events.getProxy(),o.proxy=n,n.src=e,n.listener=o,e.addEventListener?e.addEventListener(t,n,s):e.attachEvent(goog.events.getOnString_(t),n),goog.events.listenerCountEstimate_++,o)},goog.events.getProxy=function(){var e=goog.events.handleBrowserEvent_,t=goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT?function(o){return e.call(t.src,t.listener,o)}:function(o){return o=e.call(t.src,t.listener,o),o?void 0:o};return t},goog.events.listenOnce=function(e,t,o,n,i){if(goog.isArray(t)){for(var r=0;r<t.length;r++)goog.events.listenOnce(e,t[r],o,n,i);return null}return o=goog.events.wrapListener_(o),goog.events.Listenable.isImplementedBy(e)?e.listenOnce(t,o,n,i):goog.events.listen_(e,t,o,!0,n,i)},goog.events.listenWithWrapper=function(e,t,o,n,i){t.listen(e,o,n,i)},goog.events.unlisten=function(e,t,o,n,i){if(goog.isArray(t)){for(var r=0;r<t.length;r++)goog.events.unlisten(e,t[r],o,n,i);return null}return o=goog.events.wrapListener_(o),goog.events.Listenable.isImplementedBy(e)?e.unlisten(t,o,n,i):e?(n=!!n,(e=goog.events.getListenerMap_(e))&&(t=e.getListener(t,o,n,i))?goog.events.unlistenByKey(t):!1):!1},goog.events.unlistenByKey=function(e){if(goog.isNumber(e)||!e||e.removed)return!1;var t=e.src;if(goog.events.Listenable.isImplementedBy(t))return t.unlistenByKey(e);var o=e.type,n=e.proxy;return t.removeEventListener?t.removeEventListener(o,n,e.capture):t.detachEvent&&t.detachEvent(goog.events.getOnString_(o),n),goog.events.listenerCountEstimate_--,(o=goog.events.getListenerMap_(t))?(o.removeByKey(e),0==o.getTypeCount()&&(o.src=null,t[goog.events.LISTENER_MAP_PROP_]=null)):e.markAsRemoved(),!0},goog.events.unlistenWithWrapper=function(e,t,o,n,i){t.unlisten(e,o,n,i)},goog.events.removeAll=function(e,t){if(!e)return 0;if(goog.events.Listenable.isImplementedBy(e))return e.removeAllListeners(t);var o=goog.events.getListenerMap_(e);if(!o)return 0;var n,i=0;for(n in o.listeners)if(!t||n==t)for(var r=goog.array.clone(o.listeners[n]),s=0;s<r.length;++s)goog.events.unlistenByKey(r[s])&&++i;return i},goog.events.removeAllNativeListeners=function(){return goog.events.listenerCountEstimate_=0},goog.events.getListeners=function(e,t,o){return goog.events.Listenable.isImplementedBy(e)?e.getListeners(t,o):e?(e=goog.events.getListenerMap_(e))?e.getListeners(t,o):[]:[]
18
- },goog.events.getListener=function(e,t,o,n,i){return o=goog.events.wrapListener_(o),n=!!n,goog.events.Listenable.isImplementedBy(e)?e.getListener(t,o,n,i):e?(e=goog.events.getListenerMap_(e))?e.getListener(t,o,n,i):null:null},goog.events.hasListener=function(e,t,o){return goog.events.Listenable.isImplementedBy(e)?e.hasListener(t,o):(e=goog.events.getListenerMap_(e),!!e&&e.hasListener(t,o))},goog.events.expose=function(e){var t,o=[];for(t in e)e[t]&&e[t].id?o.push(t+" = "+e[t]+" ("+e[t].id+")"):o.push(t+" = "+e[t]);return o.join("\n")},goog.events.getOnString_=function(e){return e in goog.events.onStringMap_?goog.events.onStringMap_[e]:goog.events.onStringMap_[e]=goog.events.onString_+e},goog.events.fireListeners=function(e,t,o,n){return goog.events.Listenable.isImplementedBy(e)?e.fireListeners(t,o,n):goog.events.fireListeners_(e,t,o,n)},goog.events.fireListeners_=function(e,t,o,n){var i=1;if((e=goog.events.getListenerMap_(e))&&(t=e.listeners[t]))for(t=goog.array.clone(t),e=0;e<t.length;e++){var r=t[e];r&&r.capture==o&&!r.removed&&(i&=!1!==goog.events.fireListener(r,n))}return Boolean(i)},goog.events.fireListener=function(e,t){var o=e.listener,n=e.handler||e.src;return e.callOnce&&goog.events.unlistenByKey(e),o.call(n,t)},goog.events.getTotalListenerCount=function(){return goog.events.listenerCountEstimate_},goog.events.dispatchEvent=function(e,t){return goog.asserts.assert(goog.events.Listenable.isImplementedBy(e),"Can not use goog.events.dispatchEvent with non-goog.events.Listenable instance."),e.dispatchEvent(t)},goog.events.protectBrowserEventEntryPoint=function(e){goog.events.handleBrowserEvent_=e.protectEntryPoint(goog.events.handleBrowserEvent_)},goog.events.handleBrowserEvent_=function(e,t){if(e.removed)return!0;if(!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT){var o=t||goog.getObjectByName("window.event"),n=new goog.events.BrowserEvent(o,this),i=!0;if(goog.events.CAPTURE_SIMULATION_MODE==goog.events.CaptureSimulationMode.ON){if(!goog.events.isMarkedIeEvent_(o)){goog.events.markIeEvent_(o);for(var o=[],r=n.currentTarget;r;r=r.parentNode)o.push(r);for(var r=e.type,s=o.length-1;!n.propagationStopped_&&s>=0;s--)n.currentTarget=o[s],i&=goog.events.fireListeners_(o[s],r,!0,n);for(s=0;!n.propagationStopped_&&s<o.length;s++)n.currentTarget=o[s],i&=goog.events.fireListeners_(o[s],r,!1,n)}}else i=goog.events.fireListener(e,n);return i}return goog.events.fireListener(e,new goog.events.BrowserEvent(t,this))},goog.events.markIeEvent_=function(e){var t=!1;if(0==e.keyCode)try{return e.keyCode=-1,void 0}catch(o){t=!0}(t||void 0==e.returnValue)&&(e.returnValue=!0)},goog.events.isMarkedIeEvent_=function(e){return 0>e.keyCode||void 0!=e.returnValue},goog.events.uniqueIdCounter_=0,goog.events.getUniqueId=function(e){return e+"_"+goog.events.uniqueIdCounter_++},goog.events.getListenerMap_=function(e){return e=e[goog.events.LISTENER_MAP_PROP_],e instanceof goog.events.ListenerMap?e:null},goog.events.LISTENER_WRAPPER_PROP_="__closure_events_fn_"+(1e9*Math.random()>>>0),goog.events.wrapListener_=function(e){return goog.asserts.assert(e,"Listener can not be null."),goog.isFunction(e)?e:(goog.asserts.assert(e.handleEvent,"An object listener must have handleEvent method."),e[goog.events.LISTENER_WRAPPER_PROP_]||(e[goog.events.LISTENER_WRAPPER_PROP_]=function(t){return e.handleEvent(t)}))},goog.debug.entryPointRegistry.register(function(e){goog.events.handleBrowserEvent_=e(goog.events.handleBrowserEvent_)}),goog.events.EventTarget=function(){goog.Disposable.call(this),this.eventTargetListeners_=new goog.events.ListenerMap(this),this.actualEventTarget_=this},goog.inherits(goog.events.EventTarget,goog.Disposable),goog.events.Listenable.addImplementation(goog.events.EventTarget),goog.events.EventTarget.MAX_ANCESTORS_=1e3,goog.events.EventTarget.prototype.parentEventTarget_=null,goog.events.EventTarget.prototype.getParentEventTarget=function(){return this.parentEventTarget_},goog.events.EventTarget.prototype.setParentEventTarget=function(e){this.parentEventTarget_=e},goog.events.EventTarget.prototype.addEventListener=function(e,t,o,n){goog.events.listen(this,e,t,o,n)},goog.events.EventTarget.prototype.removeEventListener=function(e,t,o,n){goog.events.unlisten(this,e,t,o,n)},goog.events.EventTarget.prototype.dispatchEvent=function(e){this.assertInitialized_();var t,o=this.getParentEventTarget();if(o){t=[];for(var n=1;o;o=o.getParentEventTarget())t.push(o),goog.asserts.assert(++n<goog.events.EventTarget.MAX_ANCESTORS_,"infinite loop")}return goog.events.EventTarget.dispatchEventInternal_(this.actualEventTarget_,e,t)},goog.events.EventTarget.prototype.disposeInternal=function(){goog.events.EventTarget.superClass_.disposeInternal.call(this),this.removeAllListeners(),this.parentEventTarget_=null},goog.events.EventTarget.prototype.listen=function(e,t,o,n){return this.assertInitialized_(),this.eventTargetListeners_.add(String(e),t,!1,o,n)},goog.events.EventTarget.prototype.listenOnce=function(e,t,o,n){return this.eventTargetListeners_.add(String(e),t,!0,o,n)},goog.events.EventTarget.prototype.unlisten=function(e,t,o,n){return this.eventTargetListeners_.remove(String(e),t,o,n)},goog.events.EventTarget.prototype.unlistenByKey=function(e){return this.eventTargetListeners_.removeByKey(e)},goog.events.EventTarget.prototype.removeAllListeners=function(e){return this.eventTargetListeners_?this.eventTargetListeners_.removeAll(e):0},goog.events.EventTarget.prototype.fireListeners=function(e,t,o){if(e=this.eventTargetListeners_.listeners[String(e)],!e)return!0;e=goog.array.clone(e);for(var n=!0,i=0;i<e.length;++i){var r=e[i];if(r&&!r.removed&&r.capture==t){var s=r.listener,l=r.handler||r.src;r.callOnce&&this.unlistenByKey(r),n=!1!==s.call(l,o)&&n}}return n&&0!=o.returnValue_},goog.events.EventTarget.prototype.getListeners=function(e,t){return this.eventTargetListeners_.getListeners(String(e),t)},goog.events.EventTarget.prototype.getListener=function(e,t,o,n){return this.eventTargetListeners_.getListener(String(e),t,o,n)},goog.events.EventTarget.prototype.hasListener=function(e,t){var o=goog.isDef(e)?String(e):void 0;return this.eventTargetListeners_.hasListener(o,t)},goog.events.EventTarget.prototype.setTargetForTesting=function(e){this.actualEventTarget_=e},goog.events.EventTarget.prototype.assertInitialized_=function(){goog.asserts.assert(this.eventTargetListeners_,"Event target is not initialized. Did you call the superclass (goog.events.EventTarget) constructor?")},goog.events.EventTarget.dispatchEventInternal_=function(e,t,o){var n=t.type||t;if(goog.isString(t))t=new goog.events.Event(t,e);else if(t instanceof goog.events.Event)t.target=t.target||e;else{var i=t;t=new goog.events.Event(n,e),goog.object.extend(t,i)}var r,i=!0;if(o)for(var s=o.length-1;!t.propagationStopped_&&s>=0;s--)r=t.currentTarget=o[s],i=r.fireListeners(n,!0,t)&&i;if(t.propagationStopped_||(r=t.currentTarget=e,i=r.fireListeners(n,!0,t)&&i,t.propagationStopped_||(i=r.fireListeners(n,!1,t)&&i)),o)for(s=0;!t.propagationStopped_&&s<o.length;s++)r=t.currentTarget=o[s],i=r.fireListeners(n,!1,t)&&i;return i},goog.Timer=function(e,t){goog.events.EventTarget.call(this),this.interval_=e||1,this.timerObject_=t||goog.Timer.defaultTimerObject,this.boundTick_=goog.bind(this.tick_,this),this.last_=goog.now()},goog.inherits(goog.Timer,goog.events.EventTarget),goog.Timer.MAX_TIMEOUT_=2147483647,goog.Timer.prototype.enabled=!1,goog.Timer.defaultTimerObject=goog.global,goog.Timer.intervalScale=.8,goog.Timer.prototype.timer_=null,goog.Timer.prototype.getInterval=function(){return this.interval_},goog.Timer.prototype.setInterval=function(e){this.interval_=e,this.timer_&&this.enabled?(this.stop(),this.start()):this.timer_&&this.stop()},goog.Timer.prototype.tick_=function(){if(this.enabled){var e=goog.now()-this.last_;e>0&&e<this.interval_*goog.Timer.intervalScale?this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_-e):(this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null),this.dispatchTick(),this.enabled&&(this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_),this.last_=goog.now()))}},goog.Timer.prototype.dispatchTick=function(){this.dispatchEvent(goog.Timer.TICK)},goog.Timer.prototype.start=function(){this.enabled=!0,this.timer_||(this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_),this.last_=goog.now())},goog.Timer.prototype.stop=function(){this.enabled=!1,this.timer_&&(this.timerObject_.clearTimeout(this.timer_),this.timer_=null)},goog.Timer.prototype.disposeInternal=function(){goog.Timer.superClass_.disposeInternal.call(this),this.stop(),delete this.timerObject_},goog.Timer.TICK="tick",goog.Timer.callOnce=function(e,t,o){if(goog.isFunction(e))o&&(e=goog.bind(e,o));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=goog.bind(e.handleEvent,e)}return t>goog.Timer.MAX_TIMEOUT_?-1:goog.Timer.defaultTimerObject.setTimeout(e,t||0)},goog.Timer.clear=function(e){goog.Timer.defaultTimerObject.clearTimeout(e)},goog.color={},goog.color.names={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},goog.math={},goog.math.randomInt=function(e){return Math.floor(Math.random()*e)},goog.math.uniformRandom=function(e,t){return e+Math.random()*(t-e)},goog.math.clamp=function(e,t,o){return Math.min(Math.max(e,t),o)},goog.math.modulo=function(e,t){var o=e%t;return 0>o*t?o+t:o},goog.math.lerp=function(e,t,o){return e+o*(t-e)},goog.math.nearlyEquals=function(e,t,o){return Math.abs(e-t)<=(o||1e-6)},goog.math.standardAngle=function(e){return goog.math.modulo(e,360)},goog.math.toRadians=function(e){return e*Math.PI/180},goog.math.toDegrees=function(e){return 180*e/Math.PI},goog.math.angleDx=function(e,t){return t*Math.cos(goog.math.toRadians(e))},goog.math.angleDy=function(e,t){return t*Math.sin(goog.math.toRadians(e))},goog.math.angle=function(e,t,o,n){return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(n-t,o-e)))},goog.math.angleDifference=function(e,t){var o=goog.math.standardAngle(t)-goog.math.standardAngle(e);return o>180?o-=360:-180>=o&&(o=360+o),o},goog.math.sign=function(e){return 0==e?0:0>e?-1:1},goog.math.longestCommonSubsequence=function(e,t,o,n){o=o||function(e,t){return e==t},n=n||function(t){return e[t]};for(var i=e.length,r=t.length,s=[],l=0;i+1>l;l++)s[l]=[],s[l][0]=0;for(var a=0;r+1>a;a++)s[0][a]=0;for(l=1;i>=l;l++)for(a=1;r>=a;a++)s[l][a]=o(e[l-1],t[a-1])?s[l-1][a-1]+1:Math.max(s[l-1][a],s[l][a-1]);for(var c=[],l=i,a=r;l>0&&a>0;)o(e[l-1],t[a-1])?(c.unshift(n(l-1,a-1)),l--,a--):s[l-1][a]>s[l][a-1]?l--:a--;return c},goog.math.sum=function(){return goog.array.reduce(arguments,function(e,t){return e+t},0)},goog.math.average=function(){return goog.math.sum.apply(null,arguments)/arguments.length},goog.math.sampleVariance=function(){var e=arguments.length;if(2>e)return 0;var t=goog.math.average.apply(null,arguments);return goog.math.sum.apply(null,goog.array.map(arguments,function(e){return Math.pow(e-t,2)}))/(e-1)},goog.math.standardDeviation=function(){return Math.sqrt(goog.math.sampleVariance.apply(null,arguments))},goog.math.isInt=function(e){return isFinite(e)&&0==e%1},goog.math.isFiniteNumber=function(e){return isFinite(e)&&!isNaN(e)},goog.math.safeFloor=function(e,t){return goog.asserts.assert(!goog.isDef(t)||t>0),Math.floor(e+(t||2e-15))},goog.math.safeCeil=function(e,t){return goog.asserts.assert(!goog.isDef(t)||t>0),Math.ceil(e-(t||2e-15))},goog.color.parse=function(e){var t={};e=String(e);var o=goog.color.prependHashIfNecessaryHelper(e);if(goog.color.isValidHexColor_(o))return t.hex=goog.color.normalizeHex(o),t.type="hex",t;if(o=goog.color.isValidRgbColor_(e),o.length)return t.hex=goog.color.rgbArrayToHex(o),t.type="rgb",t;if(goog.color.names&&(o=goog.color.names[e.toLowerCase()]))return t.hex=o,t.type="named",t;throw Error(e+" is not a valid color string")},goog.color.isValidColor=function(e){var t=goog.color.prependHashIfNecessaryHelper(e);return!!(goog.color.isValidHexColor_(t)||goog.color.isValidRgbColor_(e).length||goog.color.names&&goog.color.names[e.toLowerCase()])},goog.color.parseRgb=function(e){var t=goog.color.isValidRgbColor_(e);if(!t.length)throw Error(e+" is not a valid RGB color");return t},goog.color.hexToRgbStyle=function(e){return goog.color.rgbStyle_(goog.color.hexToRgb(e))},goog.color.hexTripletRe_=/#(.)(.)(.)/,goog.color.normalizeHex=function(e){if(!goog.color.isValidHexColor_(e))throw Error("'"+e+"' is not a valid hex color");return 4==e.length&&(e=e.replace(goog.color.hexTripletRe_,"#$1$1$2$2$3$3")),e.toLowerCase()},goog.color.hexToRgb=function(e){e=goog.color.normalizeHex(e);var t=parseInt(e.substr(1,2),16),o=parseInt(e.substr(3,2),16);return e=parseInt(e.substr(5,2),16),[t,o,e]},goog.color.rgbToHex=function(e,t,o){if(e=Number(e),t=Number(t),o=Number(o),isNaN(e)||0>e||e>255||isNaN(t)||0>t||t>255||isNaN(o)||0>o||o>255)throw Error('"('+e+","+t+","+o+'") is not a valid RGB color');return e=goog.color.prependZeroIfNecessaryHelper(e.toString(16)),t=goog.color.prependZeroIfNecessaryHelper(t.toString(16)),o=goog.color.prependZeroIfNecessaryHelper(o.toString(16)),"#"+e+t+o},goog.color.rgbArrayToHex=function(e){return goog.color.rgbToHex(e[0],e[1],e[2])},goog.color.rgbToHsl=function(e,t,o){e/=255,t/=255,o/=255;var n=Math.max(e,t,o),i=Math.min(e,t,o),r=0,s=0,l=.5*(n+i);return n!=i&&(n==e?r=60*(t-o)/(n-i):n==t?r=60*(o-e)/(n-i)+120:n==o&&(r=60*(e-t)/(n-i)+240),s=l>0&&.5>=l?(n-i)/(2*l):(n-i)/(2-2*l)),[Math.round(r+360)%360,s,l]},goog.color.rgbArrayToHsl=function(e){return goog.color.rgbToHsl(e[0],e[1],e[2])},goog.color.hueToRgb_=function(e,t,o){return 0>o?o+=1:o>1&&(o-=1),1>6*o?e+6*(t-e)*o:1>2*o?t:2>3*o?e+(t-e)*(2/3-o)*6:e},goog.color.hslToRgb=function(e,t,o){var n=0,i=0,r=0;if(e/=360,0==t)n=i=r=255*o;else var s=r=0,s=.5>o?o*(1+t):o+t-t*o,r=2*o-s,n=255*goog.color.hueToRgb_(r,s,e+1/3),i=255*goog.color.hueToRgb_(r,s,e),r=255*goog.color.hueToRgb_(r,s,e-1/3);return[Math.round(n),Math.round(i),Math.round(r)]},goog.color.hslArrayToRgb=function(e){return goog.color.hslToRgb(e[0],e[1],e[2])},goog.color.validHexColorRe_=/^#(?:[0-9a-f]{3}){1,2}$/i,goog.color.isValidHexColor_=function(e){return goog.color.validHexColorRe_.test(e)},goog.color.normalizedHexColorRe_=/^#[0-9a-f]{6}$/,goog.color.isNormalizedHexColor_=function(e){return goog.color.normalizedHexColorRe_.test(e)},goog.color.rgbColorRe_=/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i,goog.color.isValidRgbColor_=function(e){var t=e.match(goog.color.rgbColorRe_);if(t){e=Number(t[1]);var o=Number(t[2]),t=Number(t[3]);if(e>=0&&255>=e&&o>=0&&255>=o&&t>=0&&255>=t)return[e,o,t]}return[]},goog.color.prependZeroIfNecessaryHelper=function(e){return 1==e.length?"0"+e:e},goog.color.prependHashIfNecessaryHelper=function(e){return"#"==e.charAt(0)?e:"#"+e},goog.color.rgbStyle_=function(e){return"rgb("+e.join(",")+")"},goog.color.hsvToRgb=function(e,t,o){var n=0,i=0,r=0;if(0==t)r=i=n=o;else{var s=Math.floor(e/60),l=e/60-s;e=o*(1-t);var a=o*(1-t*l);switch(t=o*(1-t*(1-l)),s){case 1:n=a,i=o,r=e;break;case 2:n=e,i=o,r=t;break;case 3:n=e,i=a,r=o;break;case 4:n=t,i=e,r=o;break;case 5:n=o,i=e,r=a;break;case 6:case 0:n=o,i=t,r=e}}return[Math.floor(n),Math.floor(i),Math.floor(r)]},goog.color.rgbToHsv=function(e,t,o){var n=Math.max(Math.max(e,t),o),i=Math.min(Math.min(e,t),o);if(i==n)i=e=0;else{var r=n-i,i=r/n;e=60*(e==n?(t-o)/r:t==n?2+(o-e)/r:4+(e-t)/r),0>e&&(e+=360),e>360&&(e-=360)}return[e,i,n]},goog.color.rgbArrayToHsv=function(e){return goog.color.rgbToHsv(e[0],e[1],e[2])},goog.color.hsvArrayToRgb=function(e){return goog.color.hsvToRgb(e[0],e[1],e[2])},goog.color.hexToHsl=function(e){return e=goog.color.hexToRgb(e),goog.color.rgbToHsl(e[0],e[1],e[2])},goog.color.hslToHex=function(e,t,o){return goog.color.rgbArrayToHex(goog.color.hslToRgb(e,t,o))},goog.color.hslArrayToHex=function(e){return goog.color.rgbArrayToHex(goog.color.hslToRgb(e[0],e[1],e[2]))},goog.color.hexToHsv=function(e){return goog.color.rgbArrayToHsv(goog.color.hexToRgb(e))},goog.color.hsvToHex=function(e,t,o){return goog.color.rgbArrayToHex(goog.color.hsvToRgb(e,t,o))},goog.color.hsvArrayToHex=function(e){return goog.color.hsvToHex(e[0],e[1],e[2])},goog.color.hslDistance=function(e,t){var o,n;return o=.5>=e[2]?e[1]*e[2]:e[1]*(1-e[2]),n=.5>=t[2]?t[1]*t[2]:t[1]*(1-t[2]),(e[2]-t[2])*(e[2]-t[2])+o*o+n*n-2*o*n*Math.cos(2*(e[0]/360-t[0]/360)*Math.PI)},goog.color.blend=function(e,t,o){return o=goog.math.clamp(o,0,1),[Math.round(o*e[0]+(1-o)*t[0]),Math.round(o*e[1]+(1-o)*t[1]),Math.round(o*e[2]+(1-o)*t[2])]},goog.color.darken=function(e,t){return goog.color.blend([0,0,0],e,t)},goog.color.lighten=function(e,t){return goog.color.blend([255,255,255],e,t)},goog.color.highContrast=function(e,t){for(var o=[],n=0;n<t.length;n++)o.push({color:t[n],diff:goog.color.yiqBrightnessDiff_(t[n],e)+goog.color.colorDiff_(t[n],e)});return o.sort(function(e,t){return t.diff-e.diff}),o[0].color},goog.color.yiqBrightness_=function(e){return Math.round((299*e[0]+587*e[1]+114*e[2])/1e3)},goog.color.yiqBrightnessDiff_=function(e,t){return Math.abs(goog.color.yiqBrightness_(e)-goog.color.yiqBrightness_(t))},goog.color.colorDiff_=function(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])+Math.abs(e[2]-t[2])},goog.dom.BrowserFeature={CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9),CAN_USE_CHILDREN_ATTRIBUTE:!goog.userAgent.GECKO&&!goog.userAgent.IE||goog.userAgent.IE&&goog.userAgent.isDocumentModeOrHigher(9)||goog.userAgent.GECKO&&goog.userAgent.isVersionOrHigher("1.9.1"),CAN_USE_INNER_TEXT:goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("9"),CAN_USE_PARENT_ELEMENT_PROPERTY:goog.userAgent.IE||goog.userAgent.OPERA||goog.userAgent.WEBKIT,INNER_HTML_NEEDS_SCOPED_ELEMENT:goog.userAgent.IE},goog.dom.TagName={A:"A",ABBR:"ABBR",ACRONYM:"ACRONYM",ADDRESS:"ADDRESS",APPLET:"APPLET",AREA:"AREA",ARTICLE:"ARTICLE",ASIDE:"ASIDE",AUDIO:"AUDIO",B:"B",BASE:"BASE",BASEFONT:"BASEFONT",BDI:"BDI",BDO:"BDO",BIG:"BIG",BLOCKQUOTE:"BLOCKQUOTE",BODY:"BODY",BR:"BR",BUTTON:"BUTTON",CANVAS:"CANVAS",CAPTION:"CAPTION",CENTER:"CENTER",CITE:"CITE",CODE:"CODE",COL:"COL",COLGROUP:"COLGROUP",COMMAND:"COMMAND",DATA:"DATA",DATALIST:"DATALIST",DD:"DD",DEL:"DEL",DETAILS:"DETAILS",DFN:"DFN",DIALOG:"DIALOG",DIR:"DIR",DIV:"DIV",DL:"DL",DT:"DT",EM:"EM",EMBED:"EMBED",FIELDSET:"FIELDSET",FIGCAPTION:"FIGCAPTION",FIGURE:"FIGURE",FONT:"FONT",FOOTER:"FOOTER",FORM:"FORM",FRAME:"FRAME",FRAMESET:"FRAMESET",H1:"H1",H2:"H2",H3:"H3",H4:"H4",H5:"H5",H6:"H6",HEAD:"HEAD",HEADER:"HEADER",HGROUP:"HGROUP",HR:"HR",HTML:"HTML",I:"I",IFRAME:"IFRAME",IMG:"IMG",INPUT:"INPUT",INS:"INS",ISINDEX:"ISINDEX",KBD:"KBD",KEYGEN:"KEYGEN",LABEL:"LABEL",LEGEND:"LEGEND",LI:"LI",LINK:"LINK",MAP:"MAP",MARK:"MARK",MATH:"MATH",MENU:"MENU",META:"META",METER:"METER",NAV:"NAV",NOFRAMES:"NOFRAMES",NOSCRIPT:"NOSCRIPT",OBJECT:"OBJECT",OL:"OL",OPTGROUP:"OPTGROUP",OPTION:"OPTION",OUTPUT:"OUTPUT",P:"P",PARAM:"PARAM",PRE:"PRE",PROGRESS:"PROGRESS",Q:"Q",RP:"RP",RT:"RT",RUBY:"RUBY",S:"S",SAMP:"SAMP",SCRIPT:"SCRIPT",SECTION:"SECTION",SELECT:"SELECT",SMALL:"SMALL",SOURCE:"SOURCE",SPAN:"SPAN",STRIKE:"STRIKE",STRONG:"STRONG",STYLE:"STYLE",SUB:"SUB",SUMMARY:"SUMMARY",SUP:"SUP",SVG:"SVG",TABLE:"TABLE",TBODY:"TBODY",TD:"TD",TEXTAREA:"TEXTAREA",TFOOT:"TFOOT",TH:"TH",THEAD:"THEAD",TIME:"TIME",TITLE:"TITLE",TR:"TR",TRACK:"TRACK",TT:"TT",U:"U",UL:"UL",VAR:"VAR",VIDEO:"VIDEO",WBR:"WBR"},goog.dom.classes={},goog.dom.classes.set=function(e,t){e.className=t},goog.dom.classes.get=function(e){return e=e.className,goog.isString(e)&&e.match(/\S+/g)||[]},goog.dom.classes.add=function(e){var t=goog.dom.classes.get(e),o=goog.array.slice(arguments,1),n=t.length+o.length;return goog.dom.classes.add_(t,o),goog.dom.classes.set(e,t.join(" ")),t.length==n},goog.dom.classes.remove=function(e){var t=goog.dom.classes.get(e),o=goog.array.slice(arguments,1),n=goog.dom.classes.getDifference_(t,o);return goog.dom.classes.set(e,n.join(" ")),n.length==t.length-o.length},goog.dom.classes.add_=function(e,t){for(var o=0;o<t.length;o++)goog.array.contains(e,t[o])||e.push(t[o])},goog.dom.classes.getDifference_=function(e,t){return goog.array.filter(e,function(e){return!goog.array.contains(t,e)})},goog.dom.classes.swap=function(e,t,o){for(var n=goog.dom.classes.get(e),i=!1,r=0;r<n.length;r++)n[r]==t&&(goog.array.splice(n,r--,1),i=!0);return i&&(n.push(o),goog.dom.classes.set(e,n.join(" "))),i},goog.dom.classes.addRemove=function(e,t,o){var n=goog.dom.classes.get(e);goog.isString(t)?goog.array.remove(n,t):goog.isArray(t)&&(n=goog.dom.classes.getDifference_(n,t)),goog.isString(o)&&!goog.array.contains(n,o)?n.push(o):goog.isArray(o)&&goog.dom.classes.add_(n,o),goog.dom.classes.set(e,n.join(" "))},goog.dom.classes.has=function(e,t){return goog.array.contains(goog.dom.classes.get(e),t)},goog.dom.classes.enable=function(e,t,o){o?goog.dom.classes.add(e,t):goog.dom.classes.remove(e,t)},goog.dom.classes.toggle=function(e,t){var o=!goog.dom.classes.has(e,t);return goog.dom.classes.enable(e,t,o),o},goog.functions={},goog.functions.constant=function(e){return function(){return e}},goog.functions.FALSE=goog.functions.constant(!1),goog.functions.TRUE=goog.functions.constant(!0),goog.functions.NULL=goog.functions.constant(null),goog.functions.identity=function(e){return e},goog.functions.error=function(e){return function(){throw Error(e)}},goog.functions.fail=function(e){return function(){throw e}},goog.functions.lock=function(e,t){return t=t||0,function(){return e.apply(this,Array.prototype.slice.call(arguments,0,t))}},goog.functions.nth=function(e){return function(){return arguments[e]}},goog.functions.withReturnValue=function(e,t){return goog.functions.sequence(e,goog.functions.constant(t))},goog.functions.compose=function(){var e=arguments,t=e.length;return function(){var o;t&&(o=e[t-1].apply(this,arguments));for(var n=t-2;n>=0;n--)o=e[n].call(this,o);return o}},goog.functions.sequence=function(){var e=arguments,t=e.length;return function(){for(var o,n=0;t>n;n++)o=e[n].apply(this,arguments);return o}},goog.functions.and=function(){var e=arguments,t=e.length;return function(){for(var o=0;t>o;o++)if(!e[o].apply(this,arguments))return!1;return!0}},goog.functions.or=function(){var e=arguments,t=e.length;return function(){for(var o=0;t>o;o++)if(e[o].apply(this,arguments))return!0;return!1}},goog.functions.not=function(e){return function(){return!e.apply(this,arguments)}},goog.functions.create=function(e){var t=function(){};return t.prototype=e.prototype,t=new t,e.apply(t,Array.prototype.slice.call(arguments,1)),t},goog.functions.CACHE_RETURN_VALUE=!0,goog.functions.cacheReturnValue=function(e){var t,o=!1;return function(){return goog.functions.CACHE_RETURN_VALUE?(o||(t=e(),o=!0),t):e()}},goog.math.Coordinate=function(e,t){this.x=goog.isDef(e)?e:0,this.y=goog.isDef(t)?t:0},goog.math.Coordinate.prototype.clone=function(){return new goog.math.Coordinate(this.x,this.y)},goog.DEBUG&&(goog.math.Coordinate.prototype.toString=function(){return"("+this.x+", "+this.y+")"}),goog.math.Coordinate.equals=function(e,t){return e==t?!0:e&&t?e.x==t.x&&e.y==t.y:!1},goog.math.Coordinate.distance=function(e,t){var o=e.x-t.x,n=e.y-t.y;return Math.sqrt(o*o+n*n)},goog.math.Coordinate.magnitude=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},goog.math.Coordinate.azimuth=function(e){return goog.math.angle(0,0,e.x,e.y)},goog.math.Coordinate.squaredDistance=function(e,t){var o=e.x-t.x,n=e.y-t.y;return o*o+n*n},goog.math.Coordinate.difference=function(e,t){return new goog.math.Coordinate(e.x-t.x,e.y-t.y)},goog.math.Coordinate.sum=function(e,t){return new goog.math.Coordinate(e.x+t.x,e.y+t.y)},goog.math.Coordinate.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},goog.math.Coordinate.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},goog.math.Coordinate.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},goog.math.Coordinate.prototype.translate=function(e,t){return e instanceof goog.math.Coordinate?(this.x+=e.x,this.y+=e.y):(this.x+=e,goog.isNumber(t)&&(this.y+=t)),this},goog.math.Coordinate.prototype.scale=function(e,t){var o=goog.isNumber(t)?t:e;return this.x*=e,this.y*=o,this},goog.math.Size=function(e,t){this.width=e,this.height=t},goog.math.Size.equals=function(e,t){return e==t?!0:e&&t?e.width==t.width&&e.height==t.height:!1},goog.math.Size.prototype.clone=function(){return new goog.math.Size(this.width,this.height)},goog.DEBUG&&(goog.math.Size.prototype.toString=function(){return"("+this.width+" x "+this.height+")"}),goog.math.Size.prototype.getLongest=function(){return Math.max(this.width,this.height)},goog.math.Size.prototype.getShortest=function(){return Math.min(this.width,this.height)},goog.math.Size.prototype.area=function(){return this.width*this.height},goog.math.Size.prototype.perimeter=function(){return 2*(this.width+this.height)},goog.math.Size.prototype.aspectRatio=function(){return this.width/this.height},goog.math.Size.prototype.isEmpty=function(){return!this.area()},goog.math.Size.prototype.ceil=function(){return this.width=Math.ceil(this.width),this.height=Math.ceil(this.height),this},goog.math.Size.prototype.fitsInside=function(e){return this.width<=e.width&&this.height<=e.height},goog.math.Size.prototype.floor=function(){return this.width=Math.floor(this.width),this.height=Math.floor(this.height),this},goog.math.Size.prototype.round=function(){return this.width=Math.round(this.width),this.height=Math.round(this.height),this},goog.math.Size.prototype.scale=function(e,t){var o=goog.isNumber(t)?t:e;return this.width*=e,this.height*=o,this},goog.math.Size.prototype.scaleToFit=function(e){return e=this.aspectRatio()>e.aspectRatio()?e.width/this.width:e.height/this.height,this.scale(e)},goog.dom.ASSUME_QUIRKS_MODE=!1,goog.dom.ASSUME_STANDARDS_MODE=!1,goog.dom.COMPAT_MODE_KNOWN_=goog.dom.ASSUME_QUIRKS_MODE||goog.dom.ASSUME_STANDARDS_MODE,goog.dom.getDomHelper=function(e){return e?new goog.dom.DomHelper(goog.dom.getOwnerDocument(e)):goog.dom.defaultDomHelper_||(goog.dom.defaultDomHelper_=new goog.dom.DomHelper)},goog.dom.getDocument=function(){return document},goog.dom.getElement=function(e){return goog.dom.getElementHelper_(document,e)},goog.dom.getElementHelper_=function(e,t){return goog.isString(t)?e.getElementById(t):t},goog.dom.getRequiredElement=function(e){return goog.dom.getRequiredElementHelper_(document,e)},goog.dom.getRequiredElementHelper_=function(e,t){goog.asserts.assertString(t);var o=goog.dom.getElementHelper_(e,t);return o=goog.asserts.assertElement(o,"No element found with id: "+t)},goog.dom.$=goog.dom.getElement,goog.dom.getElementsByTagNameAndClass=function(e,t,o){return goog.dom.getElementsByTagNameAndClass_(document,e,t,o)},goog.dom.getElementsByClass=function(e,t){var o=t||document;return goog.dom.canUseQuerySelector_(o)?o.querySelectorAll("."+e):o.getElementsByClassName?o.getElementsByClassName(e):goog.dom.getElementsByTagNameAndClass_(document,"*",e,t)},goog.dom.getElementByClass=function(e,t){var o=t||document,n=null;return(n=goog.dom.canUseQuerySelector_(o)?o.querySelector("."+e):goog.dom.getElementsByClass(e,t)[0])||null},goog.dom.getRequiredElementByClass=function(e,t){var o=goog.dom.getElementByClass(e,t);return goog.asserts.assert(o,"No element found with className: "+e)},goog.dom.canUseQuerySelector_=function(e){return!(!e.querySelectorAll||!e.querySelector)},goog.dom.getElementsByTagNameAndClass_=function(e,t,o,n){if(e=n||e,t=t&&"*"!=t?t.toUpperCase():"",goog.dom.canUseQuerySelector_(e)&&(t||o))return e.querySelectorAll(t+(o?"."+o:""));if(o&&e.getElementsByClassName){if(e=e.getElementsByClassName(o),t){n={};for(var i,r=0,s=0;i=e[s];s++)t==i.nodeName&&(n[r++]=i);return n.length=r,n}return e}if(e=e.getElementsByTagName(t||"*"),o){for(n={},s=r=0;i=e[s];s++)t=i.className,"function"==typeof t.split&&goog.array.contains(t.split(/\s+/),o)&&(n[r++]=i);return n.length=r,n}return e},goog.dom.$$=goog.dom.getElementsByTagNameAndClass,goog.dom.setProperties=function(e,t){goog.object.forEach(t,function(t,o){"style"==o?e.style.cssText=t:"class"==o?e.className=t:"for"==o?e.htmlFor=t:o in goog.dom.DIRECT_ATTRIBUTE_MAP_?e.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[o],t):goog.string.startsWith(o,"aria-")||goog.string.startsWith(o,"data-")?e.setAttribute(o,t):e[o]=t})},goog.dom.DIRECT_ATTRIBUTE_MAP_={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"},goog.dom.getViewportSize=function(e){return goog.dom.getViewportSize_(e||window)},goog.dom.getViewportSize_=function(e){return e=e.document,e=goog.dom.isCss1CompatMode_(e)?e.documentElement:e.body,new goog.math.Size(e.clientWidth,e.clientHeight)},goog.dom.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(window)},goog.dom.getDocumentHeight_=function(e){var t=e.document,o=0;if(t){e=goog.dom.getViewportSize_(e).height;var o=t.body,n=t.documentElement;if(goog.dom.isCss1CompatMode_(t)&&n.scrollHeight)o=n.scrollHeight!=e?n.scrollHeight:n.offsetHeight;else{var t=n.scrollHeight,i=n.offsetHeight;n.clientHeight!=i&&(t=o.scrollHeight,i=o.offsetHeight),o=t>e?t>i?t:i:i>t?t:i}}return o},goog.dom.getPageScroll=function(e){return goog.dom.getDomHelper((e||goog.global||window).document).getDocumentScroll()},goog.dom.getDocumentScroll=function(){return goog.dom.getDocumentScroll_(document)},goog.dom.getDocumentScroll_=function(e){var t=goog.dom.getDocumentScrollElement_(e);return e=goog.dom.getWindow_(e),goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("10")&&e.pageYOffset!=t.scrollTop?new goog.math.Coordinate(t.scrollLeft,t.scrollTop):new goog.math.Coordinate(e.pageXOffset||t.scrollLeft,e.pageYOffset||t.scrollTop)},goog.dom.getDocumentScrollElement=function(){return goog.dom.getDocumentScrollElement_(document)},goog.dom.getDocumentScrollElement_=function(e){return!goog.userAgent.WEBKIT&&goog.dom.isCss1CompatMode_(e)?e.documentElement:e.body||e.documentElement
19
- },goog.dom.getWindow=function(e){return e?goog.dom.getWindow_(e):window},goog.dom.getWindow_=function(e){return e.parentWindow||e.defaultView},goog.dom.createDom=function(){return goog.dom.createDom_(document,arguments)},goog.dom.createDom_=function(e,t){var o=t[0],n=t[1];if(!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES&&n&&(n.name||n.type)){if(o=["<",o],n.name&&o.push(' name="',goog.string.htmlEscape(n.name),'"'),n.type){o.push(' type="',goog.string.htmlEscape(n.type),'"');var i={};goog.object.extend(i,n),delete i.type,n=i}o.push(">"),o=o.join("")}return o=e.createElement(o),n&&(goog.isString(n)?o.className=n:goog.isArray(n)?goog.dom.classes.add.apply(null,[o].concat(n)):goog.dom.setProperties(o,n)),2<t.length&&goog.dom.append_(e,o,t,2),o},goog.dom.append_=function(e,t,o,n){function i(o){o&&t.appendChild(goog.isString(o)?e.createTextNode(o):o)}for(;n<o.length;n++){var r=o[n];goog.isArrayLike(r)&&!goog.dom.isNodeLike(r)?goog.array.forEach(goog.dom.isNodeList(r)?goog.array.toArray(r):r,i):i(r)}},goog.dom.$dom=goog.dom.createDom,goog.dom.createElement=function(e){return document.createElement(e)},goog.dom.createTextNode=function(e){return document.createTextNode(String(e))},goog.dom.createTable=function(e,t,o){return goog.dom.createTable_(document,e,t,!!o)},goog.dom.createTable_=function(e,t,o,n){for(var i=["<tr>"],r=0;o>r;r++)i.push(n?"<td>&nbsp;</td>":"<td></td>");for(i.push("</tr>"),i=i.join(""),o=["<table>"],r=0;t>r;r++)o.push(i);return o.push("</table>"),e=e.createElement(goog.dom.TagName.DIV),e.innerHTML=o.join(""),e.removeChild(e.firstChild)},goog.dom.htmlToDocumentFragment=function(e){return goog.dom.htmlToDocumentFragment_(document,e)},goog.dom.htmlToDocumentFragment_=function(e,t){var o=e.createElement("div");if(goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT?(o.innerHTML="<br>"+t,o.removeChild(o.firstChild)):o.innerHTML=t,1==o.childNodes.length)return o.removeChild(o.firstChild);for(var n=e.createDocumentFragment();o.firstChild;)n.appendChild(o.firstChild);return n},goog.dom.isCss1CompatMode=function(){return goog.dom.isCss1CompatMode_(document)},goog.dom.isCss1CompatMode_=function(e){return goog.dom.COMPAT_MODE_KNOWN_?goog.dom.ASSUME_STANDARDS_MODE:"CSS1Compat"==e.compatMode},goog.dom.canHaveChildren=function(e){if(e.nodeType!=goog.dom.NodeType.ELEMENT)return!1;switch(e.tagName){case goog.dom.TagName.APPLET:case goog.dom.TagName.AREA:case goog.dom.TagName.BASE:case goog.dom.TagName.BR:case goog.dom.TagName.COL:case goog.dom.TagName.COMMAND:case goog.dom.TagName.EMBED:case goog.dom.TagName.FRAME:case goog.dom.TagName.HR:case goog.dom.TagName.IMG:case goog.dom.TagName.INPUT:case goog.dom.TagName.IFRAME:case goog.dom.TagName.ISINDEX:case goog.dom.TagName.KEYGEN:case goog.dom.TagName.LINK:case goog.dom.TagName.NOFRAMES:case goog.dom.TagName.NOSCRIPT:case goog.dom.TagName.META:case goog.dom.TagName.OBJECT:case goog.dom.TagName.PARAM:case goog.dom.TagName.SCRIPT:case goog.dom.TagName.SOURCE:case goog.dom.TagName.STYLE:case goog.dom.TagName.TRACK:case goog.dom.TagName.WBR:return!1}return!0},goog.dom.appendChild=function(e,t){e.appendChild(t)},goog.dom.append=function(e){goog.dom.append_(goog.dom.getOwnerDocument(e),e,arguments,1)},goog.dom.removeChildren=function(e){for(var t;t=e.firstChild;)e.removeChild(t)},goog.dom.insertSiblingBefore=function(e,t){t.parentNode&&t.parentNode.insertBefore(e,t)},goog.dom.insertSiblingAfter=function(e,t){t.parentNode&&t.parentNode.insertBefore(e,t.nextSibling)},goog.dom.insertChildAt=function(e,t,o){e.insertBefore(t,e.childNodes[o]||null)},goog.dom.removeNode=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},goog.dom.replaceNode=function(e,t){var o=t.parentNode;o&&o.replaceChild(e,t)},goog.dom.flattenElement=function(e){var t,o=e.parentNode;if(o&&o.nodeType!=goog.dom.NodeType.DOCUMENT_FRAGMENT){if(e.removeNode)return e.removeNode(!1);for(;t=e.firstChild;)o.insertBefore(t,e);return goog.dom.removeNode(e)}},goog.dom.getChildren=function(e){return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE&&void 0!=e.children?e.children:goog.array.filter(e.childNodes,function(e){return e.nodeType==goog.dom.NodeType.ELEMENT})},goog.dom.getFirstElementChild=function(e){return void 0!=e.firstElementChild?e.firstElementChild:goog.dom.getNextElementNode_(e.firstChild,!0)},goog.dom.getLastElementChild=function(e){return void 0!=e.lastElementChild?e.lastElementChild:goog.dom.getNextElementNode_(e.lastChild,!1)},goog.dom.getNextElementSibling=function(e){return void 0!=e.nextElementSibling?e.nextElementSibling:goog.dom.getNextElementNode_(e.nextSibling,!0)},goog.dom.getPreviousElementSibling=function(e){return void 0!=e.previousElementSibling?e.previousElementSibling:goog.dom.getNextElementNode_(e.previousSibling,!1)},goog.dom.getNextElementNode_=function(e,t){for(;e&&e.nodeType!=goog.dom.NodeType.ELEMENT;)e=t?e.nextSibling:e.previousSibling;return e},goog.dom.getNextNode=function(e){if(!e)return null;if(e.firstChild)return e.firstChild;for(;e&&!e.nextSibling;)e=e.parentNode;return e?e.nextSibling:null},goog.dom.getPreviousNode=function(e){if(!e)return null;if(!e.previousSibling)return e.parentNode;for(e=e.previousSibling;e&&e.lastChild;)e=e.lastChild;return e},goog.dom.isNodeLike=function(e){return goog.isObject(e)&&0<e.nodeType},goog.dom.isElement=function(e){return goog.isObject(e)&&e.nodeType==goog.dom.NodeType.ELEMENT},goog.dom.isWindow=function(e){return goog.isObject(e)&&e.window==e},goog.dom.getParentElement=function(e){return!goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY||goog.userAgent.IE&&goog.userAgent.isVersionOrHigher("9")&&!goog.userAgent.isVersionOrHigher("10")&&goog.global.SVGElement&&e instanceof goog.global.SVGElement?(e=e.parentNode,goog.dom.isElement(e)?e:null):e.parentElement},goog.dom.contains=function(e,t){if(e.contains&&t.nodeType==goog.dom.NodeType.ELEMENT)return e==t||e.contains(t);if("undefined"!=typeof e.compareDocumentPosition)return e==t||Boolean(16&e.compareDocumentPosition(t));for(;t&&e!=t;)t=t.parentNode;return t==e},goog.dom.compareNodeOrder=function(e,t){if(e==t)return 0;if(e.compareDocumentPosition)return 2&e.compareDocumentPosition(t)?1:-1;if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9)){if(e.nodeType==goog.dom.NodeType.DOCUMENT)return-1;if(t.nodeType==goog.dom.NodeType.DOCUMENT)return 1}if("sourceIndex"in e||e.parentNode&&"sourceIndex"in e.parentNode){var o=e.nodeType==goog.dom.NodeType.ELEMENT,n=t.nodeType==goog.dom.NodeType.ELEMENT;if(o&&n)return e.sourceIndex-t.sourceIndex;var i=e.parentNode,r=t.parentNode;return i==r?goog.dom.compareSiblingOrder_(e,t):!o&&goog.dom.contains(i,t)?-1*goog.dom.compareParentsDescendantNodeIe_(e,t):!n&&goog.dom.contains(r,e)?goog.dom.compareParentsDescendantNodeIe_(t,e):(o?e.sourceIndex:i.sourceIndex)-(n?t.sourceIndex:r.sourceIndex)}return n=goog.dom.getOwnerDocument(e),o=n.createRange(),o.selectNode(e),o.collapse(!0),n=n.createRange(),n.selectNode(t),n.collapse(!0),o.compareBoundaryPoints(goog.global.Range.START_TO_END,n)},goog.dom.compareParentsDescendantNodeIe_=function(e,t){var o=e.parentNode;if(o==t)return-1;for(var n=t;n.parentNode!=o;)n=n.parentNode;return goog.dom.compareSiblingOrder_(n,e)},goog.dom.compareSiblingOrder_=function(e,t){for(var o=t;o=o.previousSibling;)if(o==e)return-1;return 1},goog.dom.findCommonAncestor=function(){var e,t=arguments.length;if(!t)return null;if(1==t)return arguments[0];var o=[],n=1/0;for(e=0;t>e;e++){for(var i=[],r=arguments[e];r;)i.unshift(r),r=r.parentNode;o.push(i),n=Math.min(n,i.length)}for(i=null,e=0;n>e;e++){for(var r=o[0][e],s=1;t>s;s++)if(r!=o[s][e])return i;i=r}return i},goog.dom.getOwnerDocument=function(e){return e.nodeType==goog.dom.NodeType.DOCUMENT?e:e.ownerDocument||e.document},goog.dom.getFrameContentDocument=function(e){return e.contentDocument||e.contentWindow.document},goog.dom.getFrameContentWindow=function(e){return e.contentWindow||goog.dom.getWindow(goog.dom.getFrameContentDocument(e))},goog.dom.setTextContent=function(e,t){if(goog.asserts.assert(null!=e,"goog.dom.setTextContent expects a non-null value for node"),"textContent"in e)e.textContent=t;else if(e.nodeType==goog.dom.NodeType.TEXT)e.data=t;else if(e.firstChild&&e.firstChild.nodeType==goog.dom.NodeType.TEXT){for(;e.lastChild!=e.firstChild;)e.removeChild(e.lastChild);e.firstChild.data=t}else{goog.dom.removeChildren(e);var o=goog.dom.getOwnerDocument(e);e.appendChild(o.createTextNode(String(t)))}},goog.dom.getOuterHtml=function(e){if("outerHTML"in e)return e.outerHTML;var t=goog.dom.getOwnerDocument(e).createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},goog.dom.findNode=function(e,t){var o=[];return goog.dom.findNodes_(e,t,o,!0)?o[0]:void 0},goog.dom.findNodes=function(e,t){var o=[];return goog.dom.findNodes_(e,t,o,!1),o},goog.dom.findNodes_=function(e,t,o,n){if(null!=e)for(e=e.firstChild;e;){if(t(e)&&(o.push(e),n)||goog.dom.findNodes_(e,t,o,n))return!0;e=e.nextSibling}return!1},goog.dom.TAGS_TO_IGNORE_={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},goog.dom.PREDEFINED_TAG_VALUES_={IMG:" ",BR:"\n"},goog.dom.isFocusableTabIndex=function(e){return goog.dom.hasSpecifiedTabIndex_(e)&&goog.dom.isTabIndexFocusable_(e)},goog.dom.setFocusableTabIndex=function(e,t){t?e.tabIndex=0:(e.tabIndex=-1,e.removeAttribute("tabIndex"))},goog.dom.isFocusable=function(e){var t;return(t=goog.dom.nativelySupportsFocus_(e)?!e.disabled&&(!goog.dom.hasSpecifiedTabIndex_(e)||goog.dom.isTabIndexFocusable_(e)):goog.dom.isFocusableTabIndex(e))&&goog.userAgent.IE?goog.dom.hasNonZeroBoundingRect_(e):t},goog.dom.hasSpecifiedTabIndex_=function(e){return e=e.getAttributeNode("tabindex"),goog.isDefAndNotNull(e)&&e.specified},goog.dom.isTabIndexFocusable_=function(e){return e=e.tabIndex,goog.isNumber(e)&&e>=0&&32768>e},goog.dom.nativelySupportsFocus_=function(e){return e.tagName==goog.dom.TagName.A||e.tagName==goog.dom.TagName.INPUT||e.tagName==goog.dom.TagName.TEXTAREA||e.tagName==goog.dom.TagName.SELECT||e.tagName==goog.dom.TagName.BUTTON},goog.dom.hasNonZeroBoundingRect_=function(e){return e=goog.isFunction(e.getBoundingClientRect)?e.getBoundingClientRect():{height:e.offsetHeight,width:e.offsetWidth},goog.isDefAndNotNull(e)&&0<e.height&&0<e.width},goog.dom.getTextContent=function(e){if(goog.dom.BrowserFeature.CAN_USE_INNER_TEXT&&"innerText"in e)e=goog.string.canonicalizeNewlines(e.innerText);else{var t=[];goog.dom.getTextContent_(e,t,!0),e=t.join("")}return e=e.replace(/ \xAD /g," ").replace(/\xAD/g,""),e=e.replace(/\u200B/g,""),goog.dom.BrowserFeature.CAN_USE_INNER_TEXT||(e=e.replace(/ +/g," "))," "!=e&&(e=e.replace(/^\s*/,"")),e},goog.dom.getRawTextContent=function(e){var t=[];return goog.dom.getTextContent_(e,t,!1),t.join("")},goog.dom.getTextContent_=function(e,t,o){if(!(e.nodeName in goog.dom.TAGS_TO_IGNORE_))if(e.nodeType==goog.dom.NodeType.TEXT)o?t.push(String(e.nodeValue).replace(/(\r\n|\r|\n)/g,"")):t.push(e.nodeValue);else if(e.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)t.push(goog.dom.PREDEFINED_TAG_VALUES_[e.nodeName]);else for(e=e.firstChild;e;)goog.dom.getTextContent_(e,t,o),e=e.nextSibling},goog.dom.getNodeTextLength=function(e){return goog.dom.getTextContent(e).length},goog.dom.getNodeTextOffset=function(e,t){for(var o=t||goog.dom.getOwnerDocument(e).body,n=[];e&&e!=o;){for(var i=e;i=i.previousSibling;)n.unshift(goog.dom.getTextContent(i));e=e.parentNode}return goog.string.trimLeft(n.join("")).replace(/ +/g," ").length},goog.dom.getNodeAtOffset=function(e,t,o){e=[e];for(var n=0,i=null;0<e.length&&t>n;)if(i=e.pop(),!(i.nodeName in goog.dom.TAGS_TO_IGNORE_))if(i.nodeType==goog.dom.NodeType.TEXT)var r=i.nodeValue.replace(/(\r\n|\r|\n)/g,"").replace(/ +/g," "),n=n+r.length;else if(i.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)n+=goog.dom.PREDEFINED_TAG_VALUES_[i.nodeName].length;else for(r=i.childNodes.length-1;r>=0;r--)e.push(i.childNodes[r]);return goog.isObject(o)&&(o.remainder=i?i.nodeValue.length+t-n-1:0,o.node=i),i},goog.dom.isNodeList=function(e){if(e&&"number"==typeof e.length){if(goog.isObject(e))return"function"==typeof e.item||"string"==typeof e.item;if(goog.isFunction(e))return"function"==typeof e.item}return!1},goog.dom.getAncestorByTagNameAndClass=function(e,t,o){if(!t&&!o)return null;var n=t?t.toUpperCase():null;return goog.dom.getAncestor(e,function(e){return!(n&&e.nodeName!=n||o&&!goog.dom.classes.has(e,o))},!0)},goog.dom.getAncestorByClass=function(e,t){return goog.dom.getAncestorByTagNameAndClass(e,null,t)},goog.dom.getAncestor=function(e,t,o,n){o||(e=e.parentNode),o=null==n;for(var i=0;e&&(o||n>=i);){if(t(e))return e;e=e.parentNode,i++}return null},goog.dom.getActiveElement=function(e){try{return e&&e.activeElement}catch(t){}return null},goog.dom.getPixelRatio=goog.functions.cacheReturnValue(function(){var e=goog.dom.getWindow(),t=goog.userAgent.GECKO&&goog.userAgent.MOBILE;return goog.isDef(e.devicePixelRatio)&&!t?e.devicePixelRatio:e.matchMedia?goog.dom.matchesPixelRatio_(.75)||goog.dom.matchesPixelRatio_(1.5)||goog.dom.matchesPixelRatio_(2)||goog.dom.matchesPixelRatio_(3)||1:1}),goog.dom.matchesPixelRatio_=function(e){return goog.dom.getWindow().matchMedia("(-webkit-min-device-pixel-ratio: "+e+"),(min--moz-device-pixel-ratio: "+e+"),(min-resolution: "+e+"dppx)").matches?e:0},goog.dom.DomHelper=function(e){this.document_=e||goog.global.document||document},goog.dom.DomHelper.prototype.getDomHelper=goog.dom.getDomHelper,goog.dom.DomHelper.prototype.setDocument=function(e){this.document_=e},goog.dom.DomHelper.prototype.getDocument=function(){return this.document_},goog.dom.DomHelper.prototype.getElement=function(e){return goog.dom.getElementHelper_(this.document_,e)},goog.dom.DomHelper.prototype.getRequiredElement=function(e){return goog.dom.getRequiredElementHelper_(this.document_,e)},goog.dom.DomHelper.prototype.$=goog.dom.DomHelper.prototype.getElement,goog.dom.DomHelper.prototype.getElementsByTagNameAndClass=function(e,t,o){return goog.dom.getElementsByTagNameAndClass_(this.document_,e,t,o)},goog.dom.DomHelper.prototype.getElementsByClass=function(e,t){return goog.dom.getElementsByClass(e,t||this.document_)},goog.dom.DomHelper.prototype.getElementByClass=function(e,t){return goog.dom.getElementByClass(e,t||this.document_)},goog.dom.DomHelper.prototype.getRequiredElementByClass=function(e,t){return goog.dom.getRequiredElementByClass(e,t||this.document_)},goog.dom.DomHelper.prototype.$$=goog.dom.DomHelper.prototype.getElementsByTagNameAndClass,goog.dom.DomHelper.prototype.setProperties=goog.dom.setProperties,goog.dom.DomHelper.prototype.getViewportSize=function(e){return goog.dom.getViewportSize(e||this.getWindow())},goog.dom.DomHelper.prototype.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(this.getWindow())},goog.dom.DomHelper.prototype.createDom=function(){return goog.dom.createDom_(this.document_,arguments)},goog.dom.DomHelper.prototype.$dom=goog.dom.DomHelper.prototype.createDom,goog.dom.DomHelper.prototype.createElement=function(e){return this.document_.createElement(e)},goog.dom.DomHelper.prototype.createTextNode=function(e){return this.document_.createTextNode(String(e))},goog.dom.DomHelper.prototype.createTable=function(e,t,o){return goog.dom.createTable_(this.document_,e,t,!!o)},goog.dom.DomHelper.prototype.htmlToDocumentFragment=function(e){return goog.dom.htmlToDocumentFragment_(this.document_,e)},goog.dom.DomHelper.prototype.isCss1CompatMode=function(){return goog.dom.isCss1CompatMode_(this.document_)},goog.dom.DomHelper.prototype.getWindow=function(){return goog.dom.getWindow_(this.document_)},goog.dom.DomHelper.prototype.getDocumentScrollElement=function(){return goog.dom.getDocumentScrollElement_(this.document_)},goog.dom.DomHelper.prototype.getDocumentScroll=function(){return goog.dom.getDocumentScroll_(this.document_)},goog.dom.DomHelper.prototype.getActiveElement=function(e){return goog.dom.getActiveElement(e||this.document_)},goog.dom.DomHelper.prototype.appendChild=goog.dom.appendChild,goog.dom.DomHelper.prototype.append=goog.dom.append,goog.dom.DomHelper.prototype.canHaveChildren=goog.dom.canHaveChildren,goog.dom.DomHelper.prototype.removeChildren=goog.dom.removeChildren,goog.dom.DomHelper.prototype.insertSiblingBefore=goog.dom.insertSiblingBefore,goog.dom.DomHelper.prototype.insertSiblingAfter=goog.dom.insertSiblingAfter,goog.dom.DomHelper.prototype.insertChildAt=goog.dom.insertChildAt,goog.dom.DomHelper.prototype.removeNode=goog.dom.removeNode,goog.dom.DomHelper.prototype.replaceNode=goog.dom.replaceNode,goog.dom.DomHelper.prototype.flattenElement=goog.dom.flattenElement,goog.dom.DomHelper.prototype.getChildren=goog.dom.getChildren,goog.dom.DomHelper.prototype.getFirstElementChild=goog.dom.getFirstElementChild,goog.dom.DomHelper.prototype.getLastElementChild=goog.dom.getLastElementChild,goog.dom.DomHelper.prototype.getNextElementSibling=goog.dom.getNextElementSibling,goog.dom.DomHelper.prototype.getPreviousElementSibling=goog.dom.getPreviousElementSibling,goog.dom.DomHelper.prototype.getNextNode=goog.dom.getNextNode,goog.dom.DomHelper.prototype.getPreviousNode=goog.dom.getPreviousNode,goog.dom.DomHelper.prototype.isNodeLike=goog.dom.isNodeLike,goog.dom.DomHelper.prototype.isElement=goog.dom.isElement,goog.dom.DomHelper.prototype.isWindow=goog.dom.isWindow,goog.dom.DomHelper.prototype.getParentElement=goog.dom.getParentElement,goog.dom.DomHelper.prototype.contains=goog.dom.contains,goog.dom.DomHelper.prototype.compareNodeOrder=goog.dom.compareNodeOrder,goog.dom.DomHelper.prototype.findCommonAncestor=goog.dom.findCommonAncestor,goog.dom.DomHelper.prototype.getOwnerDocument=goog.dom.getOwnerDocument,goog.dom.DomHelper.prototype.getFrameContentDocument=goog.dom.getFrameContentDocument,goog.dom.DomHelper.prototype.getFrameContentWindow=goog.dom.getFrameContentWindow,goog.dom.DomHelper.prototype.setTextContent=goog.dom.setTextContent,goog.dom.DomHelper.prototype.getOuterHtml=goog.dom.getOuterHtml,goog.dom.DomHelper.prototype.findNode=goog.dom.findNode,goog.dom.DomHelper.prototype.findNodes=goog.dom.findNodes,goog.dom.DomHelper.prototype.isFocusableTabIndex=goog.dom.isFocusableTabIndex,goog.dom.DomHelper.prototype.setFocusableTabIndex=goog.dom.setFocusableTabIndex,goog.dom.DomHelper.prototype.isFocusable=goog.dom.isFocusable,goog.dom.DomHelper.prototype.getTextContent=goog.dom.getTextContent,goog.dom.DomHelper.prototype.getNodeTextLength=goog.dom.getNodeTextLength,goog.dom.DomHelper.prototype.getNodeTextOffset=goog.dom.getNodeTextOffset,goog.dom.DomHelper.prototype.getNodeAtOffset=goog.dom.getNodeAtOffset,goog.dom.DomHelper.prototype.isNodeList=goog.dom.isNodeList,goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass=goog.dom.getAncestorByTagNameAndClass,goog.dom.DomHelper.prototype.getAncestorByClass=goog.dom.getAncestorByClass,goog.dom.DomHelper.prototype.getAncestor=goog.dom.getAncestor,goog.dom.vendor={},goog.dom.vendor.getVendorJsPrefix=function(){return goog.userAgent.WEBKIT?"Webkit":goog.userAgent.GECKO?"Moz":goog.userAgent.IE?"ms":goog.userAgent.OPERA?"O":null},goog.dom.vendor.getVendorPrefix=function(){return goog.userAgent.WEBKIT?"-webkit":goog.userAgent.GECKO?"-moz":goog.userAgent.IE?"-ms":goog.userAgent.OPERA?"-o":null},goog.dom.vendor.getPrefixedPropertyName=function(e,t){if(t&&e in t)return e;var o=goog.dom.vendor.getVendorJsPrefix();return o?(o=o.toLowerCase(),o+=goog.string.toTitleCase(e),!goog.isDef(t)||o in t?o:null):null},goog.dom.vendor.getPrefixedEventType=function(e){return((goog.dom.vendor.getVendorJsPrefix()||"")+e).toLowerCase()},goog.math.Box=function(e,t,o,n){this.top=e,this.right=t,this.bottom=o,this.left=n},goog.math.Box.boundingBox=function(){for(var e=new goog.math.Box(arguments[0].y,arguments[0].x,arguments[0].y,arguments[0].x),t=1;t<arguments.length;t++){var o=arguments[t];e.top=Math.min(e.top,o.y),e.right=Math.max(e.right,o.x),e.bottom=Math.max(e.bottom,o.y),e.left=Math.min(e.left,o.x)}return e},goog.math.Box.prototype.clone=function(){return new goog.math.Box(this.top,this.right,this.bottom,this.left)},goog.DEBUG&&(goog.math.Box.prototype.toString=function(){return"("+this.top+"t, "+this.right+"r, "+this.bottom+"b, "+this.left+"l)"}),goog.math.Box.prototype.contains=function(e){return goog.math.Box.contains(this,e)},goog.math.Box.prototype.expand=function(e,t,o,n){return goog.isObject(e)?(this.top-=e.top,this.right+=e.right,this.bottom+=e.bottom,this.left-=e.left):(this.top-=e,this.right+=t,this.bottom+=o,this.left-=n),this},goog.math.Box.prototype.expandToInclude=function(e){this.left=Math.min(this.left,e.left),this.top=Math.min(this.top,e.top),this.right=Math.max(this.right,e.right),this.bottom=Math.max(this.bottom,e.bottom)},goog.math.Box.equals=function(e,t){return e==t?!0:e&&t?e.top==t.top&&e.right==t.right&&e.bottom==t.bottom&&e.left==t.left:!1},goog.math.Box.contains=function(e,t){return e&&t?t instanceof goog.math.Box?t.left>=e.left&&t.right<=e.right&&t.top>=e.top&&t.bottom<=e.bottom:t.x>=e.left&&t.x<=e.right&&t.y>=e.top&&t.y<=e.bottom:!1},goog.math.Box.relativePositionX=function(e,t){return t.x<e.left?t.x-e.left:t.x>e.right?t.x-e.right:0},goog.math.Box.relativePositionY=function(e,t){return t.y<e.top?t.y-e.top:t.y>e.bottom?t.y-e.bottom:0},goog.math.Box.distance=function(e,t){var o=goog.math.Box.relativePositionX(e,t),n=goog.math.Box.relativePositionY(e,t);return Math.sqrt(o*o+n*n)},goog.math.Box.intersects=function(e,t){return e.left<=t.right&&t.left<=e.right&&e.top<=t.bottom&&t.top<=e.bottom},goog.math.Box.intersectsWithPadding=function(e,t,o){return e.left<=t.right+o&&t.left<=e.right+o&&e.top<=t.bottom+o&&t.top<=e.bottom+o},goog.math.Box.prototype.ceil=function(){return this.top=Math.ceil(this.top),this.right=Math.ceil(this.right),this.bottom=Math.ceil(this.bottom),this.left=Math.ceil(this.left),this},goog.math.Box.prototype.floor=function(){return this.top=Math.floor(this.top),this.right=Math.floor(this.right),this.bottom=Math.floor(this.bottom),this.left=Math.floor(this.left),this},goog.math.Box.prototype.round=function(){return this.top=Math.round(this.top),this.right=Math.round(this.right),this.bottom=Math.round(this.bottom),this.left=Math.round(this.left),this},goog.math.Box.prototype.translate=function(e,t){return e instanceof goog.math.Coordinate?(this.left+=e.x,this.right+=e.x,this.top+=e.y,this.bottom+=e.y):(this.left+=e,this.right+=e,goog.isNumber(t)&&(this.top+=t,this.bottom+=t)),this},goog.math.Box.prototype.scale=function(e,t){var o=goog.isNumber(t)?t:e;return this.left*=e,this.right*=e,this.top*=o,this.bottom*=o,this},goog.math.Rect=function(e,t,o,n){this.left=e,this.top=t,this.width=o,this.height=n},goog.math.Rect.prototype.clone=function(){return new goog.math.Rect(this.left,this.top,this.width,this.height)},goog.math.Rect.prototype.toBox=function(){return new goog.math.Box(this.top,this.left+this.width,this.top+this.height,this.left)},goog.math.Rect.createFromBox=function(e){return new goog.math.Rect(e.left,e.top,e.right-e.left,e.bottom-e.top)},goog.DEBUG&&(goog.math.Rect.prototype.toString=function(){return"("+this.left+", "+this.top+" - "+this.width+"w x "+this.height+"h)"}),goog.math.Rect.equals=function(e,t){return e==t?!0:e&&t?e.left==t.left&&e.width==t.width&&e.top==t.top&&e.height==t.height:!1},goog.math.Rect.prototype.intersection=function(e){var t=Math.max(this.left,e.left),o=Math.min(this.left+this.width,e.left+e.width);if(o>=t){var n=Math.max(this.top,e.top);if(e=Math.min(this.top+this.height,e.top+e.height),e>=n)return this.left=t,this.top=n,this.width=o-t,this.height=e-n,!0}return!1},goog.math.Rect.intersection=function(e,t){var o=Math.max(e.left,t.left),n=Math.min(e.left+e.width,t.left+t.width);if(n>=o){var i=Math.max(e.top,t.top),r=Math.min(e.top+e.height,t.top+t.height);if(r>=i)return new goog.math.Rect(o,i,n-o,r-i)}return null},goog.math.Rect.intersects=function(e,t){return e.left<=t.left+t.width&&t.left<=e.left+e.width&&e.top<=t.top+t.height&&t.top<=e.top+e.height},goog.math.Rect.prototype.intersects=function(e){return goog.math.Rect.intersects(this,e)},goog.math.Rect.difference=function(e,t){var o=goog.math.Rect.intersection(e,t);if(!o||!o.height||!o.width)return[e.clone()];var o=[],n=e.top,i=e.height,r=e.left+e.width,s=e.top+e.height,l=t.left+t.width,a=t.top+t.height;return t.top>e.top&&(o.push(new goog.math.Rect(e.left,e.top,e.width,t.top-e.top)),n=t.top,i-=t.top-e.top),s>a&&(o.push(new goog.math.Rect(e.left,a,e.width,s-a)),i=a-n),t.left>e.left&&o.push(new goog.math.Rect(e.left,n,t.left-e.left,i)),r>l&&o.push(new goog.math.Rect(l,n,r-l,i)),o},goog.math.Rect.prototype.difference=function(e){return goog.math.Rect.difference(this,e)},goog.math.Rect.prototype.boundingRect=function(e){var t=Math.max(this.left+this.width,e.left+e.width),o=Math.max(this.top+this.height,e.top+e.height);this.left=Math.min(this.left,e.left),this.top=Math.min(this.top,e.top),this.width=t-this.left,this.height=o-this.top},goog.math.Rect.boundingRect=function(e,t){if(!e||!t)return null;var o=e.clone();return o.boundingRect(t),o},goog.math.Rect.prototype.contains=function(e){return e instanceof goog.math.Rect?this.left<=e.left&&this.left+this.width>=e.left+e.width&&this.top<=e.top&&this.top+this.height>=e.top+e.height:e.x>=this.left&&e.x<=this.left+this.width&&e.y>=this.top&&e.y<=this.top+this.height},goog.math.Rect.prototype.squaredDistance=function(e){var t=e.x<this.left?this.left-e.x:Math.max(e.x-(this.left+this.width),0);return e=e.y<this.top?this.top-e.y:Math.max(e.y-(this.top+this.height),0),t*t+e*e},goog.math.Rect.prototype.distance=function(e){return Math.sqrt(this.squaredDistance(e))},goog.math.Rect.prototype.getSize=function(){return new goog.math.Size(this.width,this.height)},goog.math.Rect.prototype.getTopLeft=function(){return new goog.math.Coordinate(this.left,this.top)},goog.math.Rect.prototype.getCenter=function(){return new goog.math.Coordinate(this.left+this.width/2,this.top+this.height/2)},goog.math.Rect.prototype.getBottomRight=function(){return new goog.math.Coordinate(this.left+this.width,this.top+this.height)},goog.math.Rect.prototype.ceil=function(){return this.left=Math.ceil(this.left),this.top=Math.ceil(this.top),this.width=Math.ceil(this.width),this.height=Math.ceil(this.height),this},goog.math.Rect.prototype.floor=function(){return this.left=Math.floor(this.left),this.top=Math.floor(this.top),this.width=Math.floor(this.width),this.height=Math.floor(this.height),this},goog.math.Rect.prototype.round=function(){return this.left=Math.round(this.left),this.top=Math.round(this.top),this.width=Math.round(this.width),this.height=Math.round(this.height),this},goog.math.Rect.prototype.translate=function(e,t){return e instanceof goog.math.Coordinate?(this.left+=e.x,this.top+=e.y):(this.left+=e,goog.isNumber(t)&&(this.top+=t)),this},goog.math.Rect.prototype.scale=function(e,t){var o=goog.isNumber(t)?t:e;return this.left*=e,this.width*=e,this.top*=o,this.height*=o,this},goog.style={},goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS=!1,goog.style.setStyle=function(e,t,o){goog.isString(t)?goog.style.setStyle_(e,o,t):goog.object.forEach(t,goog.partial(goog.style.setStyle_,e))},goog.style.setStyle_=function(e,t,o){(o=goog.style.getVendorJsStyleName_(e,o))&&(e.style[o]=t)},goog.style.getVendorJsStyleName_=function(e,t){var o=goog.string.toCamelCase(t);if(void 0===e.style[o]){var n=goog.dom.vendor.getVendorJsPrefix()+goog.string.toTitleCase(t);if(void 0!==e.style[n])return n}return o},goog.style.getVendorStyleName_=function(e,t){var o=goog.string.toCamelCase(t);return void 0===e.style[o]&&(o=goog.dom.vendor.getVendorJsPrefix()+goog.string.toTitleCase(t),void 0!==e.style[o])?goog.dom.vendor.getVendorPrefix()+"-"+t:t},goog.style.getStyle=function(e,t){var o=e.style[goog.string.toCamelCase(t)];return"undefined"!=typeof o?o:e.style[goog.style.getVendorJsStyleName_(e,t)]||""},goog.style.getComputedStyle=function(e,t){var o=goog.dom.getOwnerDocument(e);return o.defaultView&&o.defaultView.getComputedStyle&&(o=o.defaultView.getComputedStyle(e,null))?o[t]||o.getPropertyValue(t)||"":""},goog.style.getCascadedStyle=function(e,t){return e.currentStyle?e.currentStyle[t]:null},goog.style.getStyle_=function(e,t){return goog.style.getComputedStyle(e,t)||goog.style.getCascadedStyle(e,t)||e.style&&e.style[t]},goog.style.getComputedBoxSizing=function(e){return goog.style.getStyle_(e,"boxSizing")||goog.style.getStyle_(e,"MozBoxSizing")||goog.style.getStyle_(e,"WebkitBoxSizing")||null},goog.style.getComputedPosition=function(e){return goog.style.getStyle_(e,"position")},goog.style.getBackgroundColor=function(e){return goog.style.getStyle_(e,"backgroundColor")},goog.style.getComputedOverflowX=function(e){return goog.style.getStyle_(e,"overflowX")},goog.style.getComputedOverflowY=function(e){return goog.style.getStyle_(e,"overflowY")},goog.style.getComputedZIndex=function(e){return goog.style.getStyle_(e,"zIndex")},goog.style.getComputedTextAlign=function(e){return goog.style.getStyle_(e,"textAlign")},goog.style.getComputedCursor=function(e){return goog.style.getStyle_(e,"cursor")},goog.style.setPosition=function(e,t,o){var n,i=goog.userAgent.GECKO&&(goog.userAgent.MAC||goog.userAgent.X11)&&goog.userAgent.isVersionOrHigher("1.9");t instanceof goog.math.Coordinate?(n=t.x,t=t.y):(n=t,t=o),e.style.left=goog.style.getPixelStyleValue_(n,i),e.style.top=goog.style.getPixelStyleValue_(t,i)},goog.style.getPosition=function(e){return new goog.math.Coordinate(e.offsetLeft,e.offsetTop)},goog.style.getClientViewportElement=function(e){return e=e?goog.dom.getOwnerDocument(e):goog.dom.getDocument(),!goog.userAgent.IE||goog.userAgent.isDocumentModeOrHigher(9)||goog.dom.getDomHelper(e).isCss1CompatMode()?e.documentElement:e.body},goog.style.getViewportPageOffset=function(e){var t=e.body;return e=e.documentElement,new goog.math.Coordinate(t.scrollLeft||e.scrollLeft,t.scrollTop||e.scrollTop)},goog.style.getBoundingClientRect_=function(e){var t;try{t=e.getBoundingClientRect()}catch(o){return{left:0,top:0,right:0,bottom:0}}return goog.userAgent.IE&&e.ownerDocument.body&&(e=e.ownerDocument,t.left-=e.documentElement.clientLeft+e.body.clientLeft,t.top-=e.documentElement.clientTop+e.body.clientTop),t},goog.style.getOffsetParent=function(e){if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(8))return e.offsetParent;var t=goog.dom.getOwnerDocument(e),o=goog.style.getStyle_(e,"position"),n="fixed"==o||"absolute"==o;for(e=e.parentNode;e&&e!=t;e=e.parentNode)if(o=goog.style.getStyle_(e,"position"),n=n&&"static"==o&&e!=t.documentElement&&e!=t.body,!n&&(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight||"fixed"==o||"absolute"==o||"relative"==o))return e;return null},goog.style.getVisibleRectForElement=function(e){for(var t=new goog.math.Box(0,1/0,1/0,0),o=goog.dom.getDomHelper(e),n=o.getDocument().body,i=o.getDocument().documentElement,r=o.getDocumentScrollElement();e=goog.style.getOffsetParent(e);)if(!(goog.userAgent.IE&&0==e.clientWidth||goog.userAgent.WEBKIT&&0==e.clientHeight&&e==n||e==n||e==i||"visible"==goog.style.getStyle_(e,"overflow"))){var s=goog.style.getPageOffset(e),l=goog.style.getClientLeftTop(e);s.x+=l.x,s.y+=l.y,t.top=Math.max(t.top,s.y),t.right=Math.min(t.right,s.x+e.clientWidth),t.bottom=Math.min(t.bottom,s.y+e.clientHeight),t.left=Math.max(t.left,s.x)}return n=r.scrollLeft,r=r.scrollTop,t.left=Math.max(t.left,n),t.top=Math.max(t.top,r),o=o.getViewportSize(),t.right=Math.min(t.right,n+o.width),t.bottom=Math.min(t.bottom,r+o.height),0<=t.top&&0<=t.left&&t.bottom>t.top&&t.right>t.left?t:null},goog.style.getContainerOffsetToScrollInto=function(e,t,o){var n=goog.style.getPageOffset(e),i=goog.style.getPageOffset(t),r=goog.style.getBorderBox(t),s=n.x-i.x-r.left,n=n.y-i.y-r.top,i=t.clientWidth-e.offsetWidth;return e=t.clientHeight-e.offsetHeight,r=t.scrollLeft,t=t.scrollTop,o?(r+=s-i/2,t+=n-e/2):(r+=Math.min(s,Math.max(s-i,0)),t+=Math.min(n,Math.max(n-e,0))),new goog.math.Coordinate(r,t)},goog.style.scrollIntoContainerView=function(e,t,o){e=goog.style.getContainerOffsetToScrollInto(e,t,o),t.scrollLeft=e.x,t.scrollTop=e.y},goog.style.getClientLeftTop=function(e){if(goog.userAgent.GECKO&&!goog.userAgent.isVersionOrHigher("1.9")){var t=parseFloat(goog.style.getComputedStyle(e,"borderLeftWidth"));if(goog.style.isRightToLeft(e))var o=e.offsetWidth-e.clientWidth-t-parseFloat(goog.style.getComputedStyle(e,"borderRightWidth")),t=t+o;return new goog.math.Coordinate(t,parseFloat(goog.style.getComputedStyle(e,"borderTopWidth")))}return new goog.math.Coordinate(e.clientLeft,e.clientTop)},goog.style.getPageOffset=function(e){var t,o=goog.dom.getOwnerDocument(e),n=goog.style.getStyle_(e,"position");goog.asserts.assertObject(e,"Parameter is required");var i=!goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS&&goog.userAgent.GECKO&&o.getBoxObjectFor&&!e.getBoundingClientRect&&"absolute"==n&&(t=o.getBoxObjectFor(e))&&(0>t.screenX||0>t.screenY),r=new goog.math.Coordinate(0,0),s=goog.style.getClientViewportElement(o);
20
- if(e==s)return r;if(goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS||e.getBoundingClientRect)t=goog.style.getBoundingClientRect_(e),e=goog.dom.getDomHelper(o).getDocumentScroll(),r.x=t.left+e.x,r.y=t.top+e.y;else if(o.getBoxObjectFor&&!i)t=o.getBoxObjectFor(e),e=o.getBoxObjectFor(s),r.x=t.screenX-e.screenX,r.y=t.screenY-e.screenY;else{t=e;do{if(r.x+=t.offsetLeft,r.y+=t.offsetTop,t!=e&&(r.x+=t.clientLeft||0,r.y+=t.clientTop||0),goog.userAgent.WEBKIT&&"fixed"==goog.style.getComputedPosition(t)){r.x+=o.body.scrollLeft,r.y+=o.body.scrollTop;break}t=t.offsetParent}while(t&&t!=e);for((goog.userAgent.OPERA||goog.userAgent.WEBKIT&&"absolute"==n)&&(r.y-=o.body.offsetTop),t=e;(t=goog.style.getOffsetParent(t))&&t!=o.body&&t!=s;)r.x-=t.scrollLeft,goog.userAgent.OPERA&&"TR"==t.tagName||(r.y-=t.scrollTop)}return r},goog.style.getPageOffsetLeft=function(e){return goog.style.getPageOffset(e).x},goog.style.getPageOffsetTop=function(e){return goog.style.getPageOffset(e).y},goog.style.getFramedPageOffset=function(e,t){var o=new goog.math.Coordinate(0,0),n=goog.dom.getWindow(goog.dom.getOwnerDocument(e)),i=e;do{var r=n==t?goog.style.getPageOffset(i):goog.style.getClientPositionForElement_(goog.asserts.assert(i));o.x+=r.x,o.y+=r.y}while(n&&n!=t&&(i=n.frameElement)&&(n=n.parent));return o},goog.style.translateRectForAnotherFrame=function(e,t,o){if(t.getDocument()!=o.getDocument()){var n=t.getDocument().body;o=goog.style.getFramedPageOffset(n,o.getWindow()),o=goog.math.Coordinate.difference(o,goog.style.getPageOffset(n)),goog.userAgent.IE&&!t.isCss1CompatMode()&&(o=goog.math.Coordinate.difference(o,t.getDocumentScroll())),e.left+=o.x,e.top+=o.y}},goog.style.getRelativePosition=function(e,t){var o=goog.style.getClientPosition(e),n=goog.style.getClientPosition(t);return new goog.math.Coordinate(o.x-n.x,o.y-n.y)},goog.style.getClientPositionForElement_=function(e){var t;if(goog.style.GET_BOUNDING_CLIENT_RECT_ALWAYS_EXISTS||e.getBoundingClientRect)t=goog.style.getBoundingClientRect_(e),t=new goog.math.Coordinate(t.left,t.top);else{t=goog.dom.getDomHelper(e).getDocumentScroll();var o=goog.style.getPageOffset(e);t=new goog.math.Coordinate(o.x-t.x,o.y-t.y)}return goog.userAgent.GECKO&&!goog.userAgent.isVersionOrHigher(12)?goog.math.Coordinate.sum(t,goog.style.getCssTranslation(e)):t},goog.style.getClientPosition=function(e){if(goog.asserts.assert(e),e.nodeType==goog.dom.NodeType.ELEMENT)return goog.style.getClientPositionForElement_(e);var t=goog.isFunction(e.getBrowserEvent),o=e;return e.targetTouches?o=e.targetTouches[0]:t&&e.getBrowserEvent().targetTouches&&(o=e.getBrowserEvent().targetTouches[0]),new goog.math.Coordinate(o.clientX,o.clientY)},goog.style.setPageOffset=function(e,t,o){var n=goog.style.getPageOffset(e);t instanceof goog.math.Coordinate&&(o=t.y,t=t.x),goog.style.setPosition(e,e.offsetLeft+(t-n.x),e.offsetTop+(o-n.y))},goog.style.setSize=function(e,t,o){if(t instanceof goog.math.Size)o=t.height,t=t.width;else if(void 0==o)throw Error("missing height argument");goog.style.setWidth(e,t),goog.style.setHeight(e,o)},goog.style.getPixelStyleValue_=function(e,t){return"number"==typeof e&&(e=(t?Math.round(e):e)+"px"),e},goog.style.setHeight=function(e,t){e.style.height=goog.style.getPixelStyleValue_(t,!0)},goog.style.setWidth=function(e,t){e.style.width=goog.style.getPixelStyleValue_(t,!0)},goog.style.getSize=function(e){return goog.style.evaluateWithTemporaryDisplay_(goog.style.getSizeWithDisplay_,e)},goog.style.evaluateWithTemporaryDisplay_=function(e,t){if("none"!=goog.style.getStyle_(t,"display"))return e(t);var o=t.style,n=o.display,i=o.visibility,r=o.position;o.visibility="hidden",o.position="absolute",o.display="inline";var s=e(t);return o.display=n,o.position=r,o.visibility=i,s},goog.style.getSizeWithDisplay_=function(e){var t=e.offsetWidth,o=e.offsetHeight,n=goog.userAgent.WEBKIT&&!t&&!o;return goog.isDef(t)&&!n||!e.getBoundingClientRect?new goog.math.Size(t,o):(e=goog.style.getBoundingClientRect_(e),new goog.math.Size(e.right-e.left,e.bottom-e.top))},goog.style.getTransformedSize=function(e){return e.getBoundingClientRect?(e=goog.style.evaluateWithTemporaryDisplay_(goog.style.getBoundingClientRect_,e),new goog.math.Size(e.right-e.left,e.bottom-e.top)):null},goog.style.getBounds=function(e){var t=goog.style.getPageOffset(e);return e=goog.style.getSize(e),new goog.math.Rect(t.x,t.y,e.width,e.height)},goog.style.toCamelCase=function(e){return goog.string.toCamelCase(String(e))},goog.style.toSelectorCase=function(e){return goog.string.toSelectorCase(e)},goog.style.getOpacity=function(e){var t=e.style;return e="","opacity"in t?e=t.opacity:"MozOpacity"in t?e=t.MozOpacity:"filter"in t&&(t=t.filter.match(/alpha\(opacity=([\d.]+)\)/))&&(e=String(t[1]/100)),""==e?e:Number(e)},goog.style.setOpacity=function(e,t){var o=e.style;"opacity"in o?o.opacity=t:"MozOpacity"in o?o.MozOpacity=t:"filter"in o&&(o.filter=""===t?"":"alpha(opacity="+100*t+")")},goog.style.setTransparentBackgroundImage=function(e,t){var o=e.style;goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?o.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+t+'", sizingMethod="crop")':(o.backgroundImage="url("+t+")",o.backgroundPosition="top left",o.backgroundRepeat="no-repeat")},goog.style.clearTransparentBackgroundImage=function(e){e=e.style,"filter"in e?e.filter="":e.backgroundImage="none"},goog.style.showElement=function(e,t){goog.style.setElementShown(e,t)},goog.style.setElementShown=function(e,t){e.style.display=t?"":"none"},goog.style.isElementShown=function(e){return"none"!=e.style.display},goog.style.installStyles=function(e,t){var o=goog.dom.getDomHelper(t),n=null,i=o.getDocument();return goog.userAgent.IE&&i.createStyleSheet?(n=i.createStyleSheet(),goog.style.setStyles(n,e)):(i=o.getElementsByTagNameAndClass("head")[0],i||(n=o.getElementsByTagNameAndClass("body")[0],i=o.createDom("head"),n.parentNode.insertBefore(i,n)),n=o.createDom("style"),goog.style.setStyles(n,e),o.appendChild(i,n)),n},goog.style.uninstallStyles=function(e){goog.dom.removeNode(e.ownerNode||e.owningElement||e)},goog.style.setStyles=function(e,t){goog.userAgent.IE&&goog.isDef(e.cssText)?e.cssText=t:e.innerHTML=t},goog.style.setPreWrap=function(e){e=e.style,goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?(e.whiteSpace="pre",e.wordWrap="break-word"):e.whiteSpace=goog.userAgent.GECKO?"-moz-pre-wrap":"pre-wrap"},goog.style.setInlineBlock=function(e){e=e.style,e.position="relative",goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("8")?(e.zoom="1",e.display="inline"):e.display=goog.userAgent.GECKO?goog.userAgent.isVersionOrHigher("1.9a")?"inline-block":"-moz-inline-box":"inline-block"},goog.style.isRightToLeft=function(e){return"rtl"==goog.style.getStyle_(e,"direction")},goog.style.unselectableStyle_=goog.userAgent.GECKO?"MozUserSelect":goog.userAgent.WEBKIT?"WebkitUserSelect":null,goog.style.isUnselectable=function(e){return goog.style.unselectableStyle_?"none"==e.style[goog.style.unselectableStyle_].toLowerCase():goog.userAgent.IE||goog.userAgent.OPERA?"on"==e.getAttribute("unselectable"):!1},goog.style.setUnselectable=function(e,t,o){o=o?null:e.getElementsByTagName("*");var n=goog.style.unselectableStyle_;if(n){if(t=t?"none":"",e.style[n]=t,o){e=0;for(var i;i=o[e];e++)i.style[n]=t}}else if((goog.userAgent.IE||goog.userAgent.OPERA)&&(t=t?"on":"",e.setAttribute("unselectable",t),o))for(e=0;i=o[e];e++)i.setAttribute("unselectable",t)},goog.style.getBorderBoxSize=function(e){return new goog.math.Size(e.offsetWidth,e.offsetHeight)},goog.style.setBorderBoxSize=function(e,t){var o=goog.dom.getOwnerDocument(e),n=goog.dom.getDomHelper(o).isCss1CompatMode();if(!goog.userAgent.IE||n&&goog.userAgent.isVersionOrHigher("8"))goog.style.setBoxSizingSize_(e,t,"border-box");else if(o=e.style,n){var n=goog.style.getPaddingBox(e),i=goog.style.getBorderBox(e);o.pixelWidth=t.width-i.left-n.left-n.right-i.right,o.pixelHeight=t.height-i.top-n.top-n.bottom-i.bottom}else o.pixelWidth=t.width,o.pixelHeight=t.height},goog.style.getContentBoxSize=function(e){var t=goog.dom.getOwnerDocument(e),o=goog.userAgent.IE&&e.currentStyle;return o&&goog.dom.getDomHelper(t).isCss1CompatMode()&&"auto"!=o.width&&"auto"!=o.height&&!o.boxSizing?(t=goog.style.getIePixelValue_(e,o.width,"width","pixelWidth"),e=goog.style.getIePixelValue_(e,o.height,"height","pixelHeight"),new goog.math.Size(t,e)):(o=goog.style.getBorderBoxSize(e),t=goog.style.getPaddingBox(e),e=goog.style.getBorderBox(e),new goog.math.Size(o.width-e.left-t.left-t.right-e.right,o.height-e.top-t.top-t.bottom-e.bottom))},goog.style.setContentBoxSize=function(e,t){var o=goog.dom.getOwnerDocument(e),n=goog.dom.getDomHelper(o).isCss1CompatMode();if(!goog.userAgent.IE||n&&goog.userAgent.isVersionOrHigher("8"))goog.style.setBoxSizingSize_(e,t,"content-box");else if(o=e.style,n)o.pixelWidth=t.width,o.pixelHeight=t.height;else{var n=goog.style.getPaddingBox(e),i=goog.style.getBorderBox(e);o.pixelWidth=t.width+i.left+n.left+n.right+i.right,o.pixelHeight=t.height+i.top+n.top+n.bottom+i.bottom}},goog.style.setBoxSizingSize_=function(e,t,o){e=e.style,goog.userAgent.GECKO?e.MozBoxSizing=o:goog.userAgent.WEBKIT?e.WebkitBoxSizing=o:e.boxSizing=o,e.width=Math.max(t.width,0)+"px",e.height=Math.max(t.height,0)+"px"},goog.style.getIePixelValue_=function(e,t,o,n){if(/^\d+px?$/.test(t))return parseInt(t,10);var i=e.style[o],r=e.runtimeStyle[o];return e.runtimeStyle[o]=e.currentStyle[o],e.style[o]=t,t=e.style[n],e.style[o]=i,e.runtimeStyle[o]=r,t},goog.style.getIePixelDistance_=function(e,t){var o=goog.style.getCascadedStyle(e,t);return o?goog.style.getIePixelValue_(e,o,"left","pixelLeft"):0},goog.style.getBox_=function(e,t){if(goog.userAgent.IE){var o=goog.style.getIePixelDistance_(e,t+"Left"),n=goog.style.getIePixelDistance_(e,t+"Right"),i=goog.style.getIePixelDistance_(e,t+"Top"),r=goog.style.getIePixelDistance_(e,t+"Bottom");return new goog.math.Box(i,n,r,o)}return o=goog.style.getComputedStyle(e,t+"Left"),n=goog.style.getComputedStyle(e,t+"Right"),i=goog.style.getComputedStyle(e,t+"Top"),r=goog.style.getComputedStyle(e,t+"Bottom"),new goog.math.Box(parseFloat(i),parseFloat(n),parseFloat(r),parseFloat(o))},goog.style.getPaddingBox=function(e){return goog.style.getBox_(e,"padding")},goog.style.getMarginBox=function(e){return goog.style.getBox_(e,"margin")},goog.style.ieBorderWidthKeywords_={thin:2,medium:4,thick:6},goog.style.getIePixelBorder_=function(e,t){if("none"==goog.style.getCascadedStyle(e,t+"Style"))return 0;var o=goog.style.getCascadedStyle(e,t+"Width");return o in goog.style.ieBorderWidthKeywords_?goog.style.ieBorderWidthKeywords_[o]:goog.style.getIePixelValue_(e,o,"left","pixelLeft")},goog.style.getBorderBox=function(e){if(goog.userAgent.IE&&!goog.userAgent.isDocumentModeOrHigher(9)){var t=goog.style.getIePixelBorder_(e,"borderLeft"),o=goog.style.getIePixelBorder_(e,"borderRight"),n=goog.style.getIePixelBorder_(e,"borderTop");return e=goog.style.getIePixelBorder_(e,"borderBottom"),new goog.math.Box(n,o,e,t)}return t=goog.style.getComputedStyle(e,"borderLeftWidth"),o=goog.style.getComputedStyle(e,"borderRightWidth"),n=goog.style.getComputedStyle(e,"borderTopWidth"),e=goog.style.getComputedStyle(e,"borderBottomWidth"),new goog.math.Box(parseFloat(n),parseFloat(o),parseFloat(e),parseFloat(t))},goog.style.getFontFamily=function(e){var t=goog.dom.getOwnerDocument(e),o="";if(t.body.createTextRange){t=t.body.createTextRange(),t.moveToElementText(e);try{o=t.queryCommandValue("FontName")}catch(n){o=""}}return o||(o=goog.style.getStyle_(e,"fontFamily")),e=o.split(","),1<e.length&&(o=e[0]),goog.string.stripQuotes(o,"\"'")},goog.style.lengthUnitRegex_=/[^\d]+$/,goog.style.getLengthUnits=function(e){return(e=e.match(goog.style.lengthUnitRegex_))&&e[0]||null},goog.style.ABSOLUTE_CSS_LENGTH_UNITS_={cm:1,"in":1,mm:1,pc:1,pt:1},goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_={em:1,ex:1},goog.style.getFontSize=function(e){var t=goog.style.getStyle_(e,"fontSize"),o=goog.style.getLengthUnits(t);if(t&&"px"==o)return parseInt(t,10);if(goog.userAgent.IE){if(o in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_)return goog.style.getIePixelValue_(e,t,"left","pixelLeft");if(e.parentNode&&e.parentNode.nodeType==goog.dom.NodeType.ELEMENT&&o in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_)return e=e.parentNode,o=goog.style.getStyle_(e,"fontSize"),goog.style.getIePixelValue_(e,t==o?"1em":t,"left","pixelLeft")}return o=goog.dom.createDom("span",{style:"visibility:hidden;position:absolute;line-height:0;padding:0;margin:0;border:0;height:1em;"}),goog.dom.appendChild(e,o),t=o.offsetHeight,goog.dom.removeNode(o),t},goog.style.parseStyleAttribute=function(e){var t={};return goog.array.forEach(e.split(/\s*;\s*/),function(e){e=e.split(/\s*:\s*/),2==e.length&&(t[goog.string.toCamelCase(e[0].toLowerCase())]=e[1])}),t},goog.style.toStyleAttribute=function(e){var t=[];return goog.object.forEach(e,function(e,o){t.push(goog.string.toSelectorCase(o),":",e,";")}),t.join("")},goog.style.setFloat=function(e,t){e.style[goog.userAgent.IE?"styleFloat":"cssFloat"]=t},goog.style.getFloat=function(e){return e.style[goog.userAgent.IE?"styleFloat":"cssFloat"]||""},goog.style.getScrollbarWidth=function(e){var t=goog.dom.createElement("div");return e&&(t.className=e),t.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px",e=goog.dom.createElement("div"),goog.style.setSize(e,"200px","200px"),t.appendChild(e),goog.dom.appendChild(goog.dom.getDocument().body,t),e=t.offsetWidth-t.clientWidth,goog.dom.removeNode(t),e},goog.style.MATRIX_TRANSLATION_REGEX_=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/,goog.style.getCssTranslation=function(e){var t;goog.userAgent.IE?t="-ms-transform":goog.userAgent.WEBKIT?t="-webkit-transform":goog.userAgent.OPERA?t="-o-transform":goog.userAgent.GECKO&&(t="-moz-transform");var o;return t&&(o=goog.style.getStyle_(e,t)),o||(o=goog.style.getStyle_(e,"transform")),o?(e=o.match(goog.style.MATRIX_TRANSLATION_REGEX_))?new goog.math.Coordinate(parseFloat(e[1]),parseFloat(e[2])):new goog.math.Coordinate(0,0):new goog.math.Coordinate(0,0)},goog.events.KeyCodes={WIN_KEY_FF_LINUX:0,MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,FF_SEMICOLON:59,FF_EQUALS:61,FF_DASH:173,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SCROLL_LOCK:145,FIRST_MEDIA_KEY:166,LAST_MEDIA_KEY:183,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,TILDE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,MAC_WK_CMD_LEFT:91,MAC_WK_CMD_RIGHT:93,WIN_IME:229,PHANTOM:255},goog.events.KeyCodes.isTextModifyingKeyEvent=function(e){if(e.altKey&&!e.ctrlKey||e.metaKey||e.keyCode>=goog.events.KeyCodes.F1&&e.keyCode<=goog.events.KeyCodes.F12)return!1;switch(e.keyCode){case goog.events.KeyCodes.ALT:case goog.events.KeyCodes.CAPS_LOCK:case goog.events.KeyCodes.CONTEXT_MENU:case goog.events.KeyCodes.CTRL:case goog.events.KeyCodes.DOWN:case goog.events.KeyCodes.END:case goog.events.KeyCodes.ESC:case goog.events.KeyCodes.HOME:case goog.events.KeyCodes.INSERT:case goog.events.KeyCodes.LEFT:case goog.events.KeyCodes.MAC_FF_META:case goog.events.KeyCodes.META:case goog.events.KeyCodes.NUMLOCK:case goog.events.KeyCodes.NUM_CENTER:case goog.events.KeyCodes.PAGE_DOWN:case goog.events.KeyCodes.PAGE_UP:case goog.events.KeyCodes.PAUSE:case goog.events.KeyCodes.PHANTOM:case goog.events.KeyCodes.PRINT_SCREEN:case goog.events.KeyCodes.RIGHT:case goog.events.KeyCodes.SCROLL_LOCK:case goog.events.KeyCodes.SHIFT:case goog.events.KeyCodes.UP:case goog.events.KeyCodes.WIN_KEY:case goog.events.KeyCodes.WIN_KEY_RIGHT:return!1;case goog.events.KeyCodes.WIN_KEY_FF_LINUX:return!goog.userAgent.GECKO;default:return e.keyCode<goog.events.KeyCodes.FIRST_MEDIA_KEY||e.keyCode>goog.events.KeyCodes.LAST_MEDIA_KEY}},goog.events.KeyCodes.firesKeyPressEvent=function(e,t,o,n,i){if(!(goog.userAgent.IE||goog.userAgent.WEBKIT&&goog.userAgent.isVersionOrHigher("525")))return!0;if(goog.userAgent.MAC&&i)return goog.events.KeyCodes.isCharacterKey(e);if(i&&!n)return!1;if(goog.isNumber(t)&&(t=goog.events.KeyCodes.normalizeKeyCode(t)),!o&&(t==goog.events.KeyCodes.CTRL||t==goog.events.KeyCodes.ALT||goog.userAgent.MAC&&t==goog.events.KeyCodes.META))return!1;if(goog.userAgent.WEBKIT&&n&&o)switch(e){case goog.events.KeyCodes.BACKSLASH:case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:case goog.events.KeyCodes.TILDE:case goog.events.KeyCodes.SEMICOLON:case goog.events.KeyCodes.DASH:case goog.events.KeyCodes.EQUALS:case goog.events.KeyCodes.COMMA:case goog.events.KeyCodes.PERIOD:case goog.events.KeyCodes.SLASH:case goog.events.KeyCodes.APOSTROPHE:case goog.events.KeyCodes.SINGLE_QUOTE:return!1}if(goog.userAgent.IE&&n&&t==e)return!1;switch(e){case goog.events.KeyCodes.ENTER:return!(goog.userAgent.IE&&goog.userAgent.isDocumentModeOrHigher(9));case goog.events.KeyCodes.ESC:return!goog.userAgent.WEBKIT}return goog.events.KeyCodes.isCharacterKey(e)},goog.events.KeyCodes.isCharacterKey=function(e){if(e>=goog.events.KeyCodes.ZERO&&e<=goog.events.KeyCodes.NINE||e>=goog.events.KeyCodes.NUM_ZERO&&e<=goog.events.KeyCodes.NUM_MULTIPLY||e>=goog.events.KeyCodes.A&&e<=goog.events.KeyCodes.Z||goog.userAgent.WEBKIT&&0==e)return!0;switch(e){case goog.events.KeyCodes.SPACE:case goog.events.KeyCodes.QUESTION_MARK:case goog.events.KeyCodes.NUM_PLUS:case goog.events.KeyCodes.NUM_MINUS:case goog.events.KeyCodes.NUM_PERIOD:case goog.events.KeyCodes.NUM_DIVISION:case goog.events.KeyCodes.SEMICOLON:case goog.events.KeyCodes.FF_SEMICOLON:case goog.events.KeyCodes.DASH:case goog.events.KeyCodes.EQUALS:case goog.events.KeyCodes.FF_EQUALS:case goog.events.KeyCodes.COMMA:case goog.events.KeyCodes.PERIOD:case goog.events.KeyCodes.SLASH:case goog.events.KeyCodes.APOSTROPHE:case goog.events.KeyCodes.SINGLE_QUOTE:case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:case goog.events.KeyCodes.BACKSLASH:case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:return!0;default:return!1}},goog.events.KeyCodes.normalizeKeyCode=function(e){return goog.userAgent.GECKO?goog.events.KeyCodes.normalizeGeckoKeyCode(e):goog.userAgent.MAC&&goog.userAgent.WEBKIT?goog.events.KeyCodes.normalizeMacWebKitKeyCode(e):e},goog.events.KeyCodes.normalizeGeckoKeyCode=function(e){switch(e){case goog.events.KeyCodes.FF_EQUALS:return goog.events.KeyCodes.EQUALS;case goog.events.KeyCodes.FF_SEMICOLON:return goog.events.KeyCodes.SEMICOLON;case goog.events.KeyCodes.FF_DASH:return goog.events.KeyCodes.DASH;case goog.events.KeyCodes.MAC_FF_META:return goog.events.KeyCodes.META;case goog.events.KeyCodes.WIN_KEY_FF_LINUX:return goog.events.KeyCodes.WIN_KEY;default:return e}},goog.events.KeyCodes.normalizeMacWebKitKeyCode=function(e){switch(e){case goog.events.KeyCodes.MAC_WK_CMD_RIGHT:return goog.events.KeyCodes.META;default:return e}},goog.events.EventHandler=function(e){goog.Disposable.call(this),this.handler_=e,this.keys_={}},goog.inherits(goog.events.EventHandler,goog.Disposable),goog.events.EventHandler.typeArray_=[],goog.events.EventHandler.prototype.listen=function(e,t,o,n,i){return this.listen_(e,t,o,n,i)},goog.events.EventHandler.prototype.listenWithScope=function(e,t,o,n,i){return this.listen_(e,t,o,n,i)},goog.events.EventHandler.prototype.listen_=function(e,t,o,n,i){goog.isArray(t)||(goog.events.EventHandler.typeArray_[0]=t,t=goog.events.EventHandler.typeArray_);for(var r=0;r<t.length;r++){var s=goog.events.listen(e,t[r],o||this.handleEvent,n||!1,i||this.handler_||this);if(!s)break;this.keys_[s.key]=s}return this},goog.events.EventHandler.prototype.listenOnce=function(e,t,o,n,i){return this.listenOnce_(e,t,o,n,i)},goog.events.EventHandler.prototype.listenOnceWithScope=function(e,t,o,n,i){return this.listenOnce_(e,t,o,n,i)},goog.events.EventHandler.prototype.listenOnce_=function(e,t,o,n,i){if(goog.isArray(t))for(var r=0;r<t.length;r++)this.listenOnce(e,t[r],o,n,i);else{if(e=goog.events.listenOnce(e,t,o||this.handleEvent,n,i||this.handler_||this),!e)return this;this.keys_[e.key]=e}return this},goog.events.EventHandler.prototype.listenWithWrapper=function(e,t,o,n,i){return this.listenWithWrapper_(e,t,o,n,i)},goog.events.EventHandler.prototype.listenWithWrapperAndScope=function(e,t,o,n,i){return this.listenWithWrapper_(e,t,o,n,i)},goog.events.EventHandler.prototype.listenWithWrapper_=function(e,t,o,n,i){return t.listen(e,o,n,i||this.handler_||this,this),this},goog.events.EventHandler.prototype.getListenerCount=function(){var e,t=0;for(e in this.keys_)Object.prototype.hasOwnProperty.call(this.keys_,e)&&t++;return t},goog.events.EventHandler.prototype.unlisten=function(e,t,o,n,i){if(goog.isArray(t))for(var r=0;r<t.length;r++)this.unlisten(e,t[r],o,n,i);else(e=goog.events.getListener(e,t,o||this.handleEvent,n,i||this.handler_||this))&&(goog.events.unlistenByKey(e),delete this.keys_[e.key]);return this},goog.events.EventHandler.prototype.unlistenWithWrapper=function(e,t,o,n,i){return t.unlisten(e,o,n,i||this.handler_||this,this),this},goog.events.EventHandler.prototype.removeAll=function(){goog.object.forEach(this.keys_,goog.events.unlistenByKey),this.keys_={}},goog.events.EventHandler.prototype.disposeInternal=function(){goog.events.EventHandler.superClass_.disposeInternal.call(this),this.removeAll()},goog.events.EventHandler.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},goog.ui={},goog.ui.IdGenerator=function(){},goog.addSingletonGetter(goog.ui.IdGenerator),goog.ui.IdGenerator.prototype.nextId_=0,goog.ui.IdGenerator.prototype.getNextUniqueId=function(){return":"+(this.nextId_++).toString(36)},goog.ui.Component=function(e){goog.events.EventTarget.call(this),this.dom_=e||goog.dom.getDomHelper(),this.rightToLeft_=goog.ui.Component.defaultRightToLeft_},goog.inherits(goog.ui.Component,goog.events.EventTarget),goog.ui.Component.ALLOW_DETACHED_DECORATION=!1,goog.ui.Component.prototype.idGenerator_=goog.ui.IdGenerator.getInstance(),goog.ui.Component.defaultRightToLeft_=null,goog.ui.Component.EventType={BEFORE_SHOW:"beforeshow",SHOW:"show",HIDE:"hide",DISABLE:"disable",ENABLE:"enable",HIGHLIGHT:"highlight",UNHIGHLIGHT:"unhighlight",ACTIVATE:"activate",DEACTIVATE:"deactivate",SELECT:"select",UNSELECT:"unselect",CHECK:"check",UNCHECK:"uncheck",FOCUS:"focus",BLUR:"blur",OPEN:"open",CLOSE:"close",ENTER:"enter",LEAVE:"leave",ACTION:"action",CHANGE:"change"},goog.ui.Component.Error={NOT_SUPPORTED:"Method not supported",DECORATE_INVALID:"Invalid element to decorate",ALREADY_RENDERED:"Component already rendered",PARENT_UNABLE_TO_BE_SET:"Unable to set parent component",CHILD_INDEX_OUT_OF_BOUNDS:"Child component index out of bounds",NOT_OUR_CHILD:"Child is not in parent component",NOT_IN_DOCUMENT:"Operation not supported while component is not in document",STATE_INVALID:"Invalid component state"},goog.ui.Component.State={ALL:255,DISABLED:1,HOVER:2,ACTIVE:4,SELECTED:8,CHECKED:16,FOCUSED:32,OPENED:64},goog.ui.Component.getStateTransitionEvent=function(e,t){switch(e){case goog.ui.Component.State.DISABLED:return t?goog.ui.Component.EventType.DISABLE:goog.ui.Component.EventType.ENABLE;case goog.ui.Component.State.HOVER:return t?goog.ui.Component.EventType.HIGHLIGHT:goog.ui.Component.EventType.UNHIGHLIGHT;case goog.ui.Component.State.ACTIVE:return t?goog.ui.Component.EventType.ACTIVATE:goog.ui.Component.EventType.DEACTIVATE;case goog.ui.Component.State.SELECTED:return t?goog.ui.Component.EventType.SELECT:goog.ui.Component.EventType.UNSELECT;case goog.ui.Component.State.CHECKED:return t?goog.ui.Component.EventType.CHECK:goog.ui.Component.EventType.UNCHECK;case goog.ui.Component.State.FOCUSED:return t?goog.ui.Component.EventType.FOCUS:goog.ui.Component.EventType.BLUR;case goog.ui.Component.State.OPENED:return t?goog.ui.Component.EventType.OPEN:goog.ui.Component.EventType.CLOSE}throw Error(goog.ui.Component.Error.STATE_INVALID)},goog.ui.Component.setDefaultRightToLeft=function(e){goog.ui.Component.defaultRightToLeft_=e},goog.ui.Component.prototype.id_=null,goog.ui.Component.prototype.inDocument_=!1,goog.ui.Component.prototype.element_=null,goog.ui.Component.prototype.rightToLeft_=null,goog.ui.Component.prototype.model_=null,goog.ui.Component.prototype.parent_=null,goog.ui.Component.prototype.children_=null,goog.ui.Component.prototype.childIndex_=null,goog.ui.Component.prototype.wasDecorated_=!1,goog.ui.Component.prototype.getId=function(){return this.id_||(this.id_=this.idGenerator_.getNextUniqueId())},goog.ui.Component.prototype.setId=function(e){this.parent_&&this.parent_.childIndex_&&(goog.object.remove(this.parent_.childIndex_,this.id_),goog.object.add(this.parent_.childIndex_,e,this)),this.id_=e},goog.ui.Component.prototype.getElement=function(){return this.element_},goog.ui.Component.prototype.getElementStrict=function(){var e=this.element_;return goog.asserts.assert(e,"Can not call getElementStrict before rendering/decorating."),e},goog.ui.Component.prototype.setElementInternal=function(e){this.element_=e},goog.ui.Component.prototype.getElementsByClass=function(e){return this.element_?this.dom_.getElementsByClass(e,this.element_):[]},goog.ui.Component.prototype.getElementByClass=function(e){return this.element_?this.dom_.getElementByClass(e,this.element_):null},goog.ui.Component.prototype.getRequiredElementByClass=function(e){var t=this.getElementByClass(e);return goog.asserts.assert(t,"Expected element in component with class: %s",e),t},goog.ui.Component.prototype.getHandler=function(){return this.googUiComponentHandler_||(this.googUiComponentHandler_=new goog.events.EventHandler(this))},goog.ui.Component.prototype.setParent=function(e){if(this==e)throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);if(e&&this.parent_&&this.id_&&this.parent_.getChild(this.id_)&&this.parent_!=e)throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);this.parent_=e,goog.ui.Component.superClass_.setParentEventTarget.call(this,e)},goog.ui.Component.prototype.getParent=function(){return this.parent_},goog.ui.Component.prototype.setParentEventTarget=function(e){if(this.parent_&&this.parent_!=e)throw Error(goog.ui.Component.Error.NOT_SUPPORTED);goog.ui.Component.superClass_.setParentEventTarget.call(this,e)},goog.ui.Component.prototype.getDomHelper=function(){return this.dom_},goog.ui.Component.prototype.isInDocument=function(){return this.inDocument_},goog.ui.Component.prototype.createDom=function(){this.element_=this.dom_.createElement("div")},goog.ui.Component.prototype.render=function(e){this.render_(e)},goog.ui.Component.prototype.renderBefore=function(e){this.render_(e.parentNode,e)},goog.ui.Component.prototype.render_=function(e,t){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.element_||this.createDom(),e?e.insertBefore(this.element_,t||null):this.dom_.getDocument().body.appendChild(this.element_),this.parent_&&!this.parent_.isInDocument()||this.enterDocument()},goog.ui.Component.prototype.decorate=function(e){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);if(!e||!this.canDecorate(e))throw Error(goog.ui.Component.Error.DECORATE_INVALID);this.wasDecorated_=!0;var t=goog.dom.getOwnerDocument(e);this.dom_&&this.dom_.getDocument()==t||(this.dom_=goog.dom.getDomHelper(e)),this.decorateInternal(e),goog.ui.Component.ALLOW_DETACHED_DECORATION&&!goog.dom.contains(t,e)||this.enterDocument()},goog.ui.Component.prototype.canDecorate=function(){return!0},goog.ui.Component.prototype.wasDecorated=function(){return this.wasDecorated_},goog.ui.Component.prototype.decorateInternal=function(e){this.element_=e},goog.ui.Component.prototype.enterDocument=function(){this.inDocument_=!0,this.forEachChild(function(e){!e.isInDocument()&&e.getElement()&&e.enterDocument()})},goog.ui.Component.prototype.exitDocument=function(){this.forEachChild(function(e){e.isInDocument()&&e.exitDocument()}),this.googUiComponentHandler_&&this.googUiComponentHandler_.removeAll(),this.inDocument_=!1},goog.ui.Component.prototype.disposeInternal=function(){this.inDocument_&&this.exitDocument(),this.googUiComponentHandler_&&(this.googUiComponentHandler_.dispose(),delete this.googUiComponentHandler_),this.forEachChild(function(e){e.dispose()}),!this.wasDecorated_&&this.element_&&goog.dom.removeNode(this.element_),this.parent_=this.model_=this.element_=this.childIndex_=this.children_=null,goog.ui.Component.superClass_.disposeInternal.call(this)},goog.ui.Component.prototype.makeId=function(e){return this.getId()+"."+e},goog.ui.Component.prototype.makeIds=function(e){var t,o={};for(t in e)o[t]=this.makeId(e[t]);return o},goog.ui.Component.prototype.getModel=function(){return this.model_},goog.ui.Component.prototype.setModel=function(e){this.model_=e},goog.ui.Component.prototype.getFragmentFromId=function(e){return e.substring(this.getId().length+1)},goog.ui.Component.prototype.getElementByFragment=function(e){if(!this.inDocument_)throw Error(goog.ui.Component.Error.NOT_IN_DOCUMENT);return this.dom_.getElement(this.makeId(e))},goog.ui.Component.prototype.addChild=function(e,t){this.addChildAt(e,this.getChildCount(),t)},goog.ui.Component.prototype.addChildAt=function(e,t,o){if(e.inDocument_&&(o||!this.inDocument_))throw Error(goog.ui.Component.Error.ALREADY_RENDERED);if(0>t||t>this.getChildCount())throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS);this.childIndex_&&this.children_||(this.childIndex_={},this.children_=[]),e.getParent()==this?(goog.object.set(this.childIndex_,e.getId(),e),goog.array.remove(this.children_,e)):goog.object.add(this.childIndex_,e.getId(),e),e.setParent(this),goog.array.insertAt(this.children_,e,t),e.inDocument_&&this.inDocument_&&e.getParent()==this?(o=this.getContentElement(),o.insertBefore(e.getElement(),o.childNodes[t]||null)):o?(this.element_||this.createDom(),t=this.getChildAt(t+1),e.render_(this.getContentElement(),t?t.element_:null)):this.inDocument_&&!e.inDocument_&&e.element_&&e.element_.parentNode&&e.element_.parentNode.nodeType==goog.dom.NodeType.ELEMENT&&e.enterDocument()},goog.ui.Component.prototype.getContentElement=function(){return this.element_},goog.ui.Component.prototype.isRightToLeft=function(){return null==this.rightToLeft_&&(this.rightToLeft_=goog.style.isRightToLeft(this.inDocument_?this.element_:this.dom_.getDocument().body)),this.rightToLeft_},goog.ui.Component.prototype.setRightToLeft=function(e){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.rightToLeft_=e},goog.ui.Component.prototype.hasChildren=function(){return!!this.children_&&0!=this.children_.length},goog.ui.Component.prototype.getChildCount=function(){return this.children_?this.children_.length:0},goog.ui.Component.prototype.getChildIds=function(){var e=[];return this.forEachChild(function(t){e.push(t.getId())}),e},goog.ui.Component.prototype.getChild=function(e){return this.childIndex_&&e?goog.object.get(this.childIndex_,e)||null:null},goog.ui.Component.prototype.getChildAt=function(e){return this.children_?this.children_[e]||null:null},goog.ui.Component.prototype.forEachChild=function(e,t){this.children_&&goog.array.forEach(this.children_,e,t)},goog.ui.Component.prototype.indexOfChild=function(e){return this.children_&&e?goog.array.indexOf(this.children_,e):-1},goog.ui.Component.prototype.removeChild=function(e,t){if(e){var o=goog.isString(e)?e:e.getId();e=this.getChild(o),o&&e&&(goog.object.remove(this.childIndex_,o),goog.array.remove(this.children_,e),t&&(e.exitDocument(),e.element_&&goog.dom.removeNode(e.element_)),e.setParent(null))}if(!e)throw Error(goog.ui.Component.Error.NOT_OUR_CHILD);return e},goog.ui.Component.prototype.removeChildAt=function(e,t){return this.removeChild(this.getChildAt(e),t)},goog.ui.Component.prototype.removeChildren=function(e){for(var t=[];this.hasChildren();)t.push(this.removeChildAt(0,e));return t},goog.events.KeyHandler=function(e,t){goog.events.EventTarget.call(this),e&&this.attach(e,t)},goog.inherits(goog.events.KeyHandler,goog.events.EventTarget),goog.events.KeyHandler.prototype.element_=null,goog.events.KeyHandler.prototype.keyPressKey_=null,goog.events.KeyHandler.prototype.keyDownKey_=null,goog.events.KeyHandler.prototype.keyUpKey_=null,goog.events.KeyHandler.prototype.lastKey_=-1,goog.events.KeyHandler.prototype.keyCode_=-1,goog.events.KeyHandler.prototype.altKey_=!1,goog.events.KeyHandler.EventType={KEY:"key"},goog.events.KeyHandler.safariKey_={3:goog.events.KeyCodes.ENTER,12:goog.events.KeyCodes.NUMLOCK,63232:goog.events.KeyCodes.UP,63233:goog.events.KeyCodes.DOWN,63234:goog.events.KeyCodes.LEFT,63235:goog.events.KeyCodes.RIGHT,63236:goog.events.KeyCodes.F1,63237:goog.events.KeyCodes.F2,63238:goog.events.KeyCodes.F3,63239:goog.events.KeyCodes.F4,63240:goog.events.KeyCodes.F5,63241:goog.events.KeyCodes.F6,63242:goog.events.KeyCodes.F7,63243:goog.events.KeyCodes.F8,63244:goog.events.KeyCodes.F9,63245:goog.events.KeyCodes.F10,63246:goog.events.KeyCodes.F11,63247:goog.events.KeyCodes.F12,63248:goog.events.KeyCodes.PRINT_SCREEN,63272:goog.events.KeyCodes.DELETE,63273:goog.events.KeyCodes.HOME,63275:goog.events.KeyCodes.END,63276:goog.events.KeyCodes.PAGE_UP,63277:goog.events.KeyCodes.PAGE_DOWN,63289:goog.events.KeyCodes.NUMLOCK,63302:goog.events.KeyCodes.INSERT},goog.events.KeyHandler.keyIdentifier_={Up:goog.events.KeyCodes.UP,Down:goog.events.KeyCodes.DOWN,Left:goog.events.KeyCodes.LEFT,Right:goog.events.KeyCodes.RIGHT,Enter:goog.events.KeyCodes.ENTER,F1:goog.events.KeyCodes.F1,F2:goog.events.KeyCodes.F2,F3:goog.events.KeyCodes.F3,F4:goog.events.KeyCodes.F4,F5:goog.events.KeyCodes.F5,F6:goog.events.KeyCodes.F6,F7:goog.events.KeyCodes.F7,F8:goog.events.KeyCodes.F8,F9:goog.events.KeyCodes.F9,F10:goog.events.KeyCodes.F10,F11:goog.events.KeyCodes.F11,F12:goog.events.KeyCodes.F12,"U+007F":goog.events.KeyCodes.DELETE,Home:goog.events.KeyCodes.HOME,End:goog.events.KeyCodes.END,PageUp:goog.events.KeyCodes.PAGE_UP,PageDown:goog.events.KeyCodes.PAGE_DOWN,Insert:goog.events.KeyCodes.INSERT},goog.events.KeyHandler.USES_KEYDOWN_=goog.userAgent.IE||goog.userAgent.WEBKIT&&goog.userAgent.isVersionOrHigher("525"),goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_=goog.userAgent.MAC&&goog.userAgent.GECKO,goog.events.KeyHandler.prototype.handleKeyDown_=function(e){goog.userAgent.WEBKIT&&(this.lastKey_==goog.events.KeyCodes.CTRL&&!e.ctrlKey||this.lastKey_==goog.events.KeyCodes.ALT&&!e.altKey||goog.userAgent.MAC&&this.lastKey_==goog.events.KeyCodes.META&&!e.metaKey)&&(this.keyCode_=this.lastKey_=-1),-1==this.lastKey_&&(e.ctrlKey&&e.keyCode!=goog.events.KeyCodes.CTRL?this.lastKey_=goog.events.KeyCodes.CTRL:e.altKey&&e.keyCode!=goog.events.KeyCodes.ALT?this.lastKey_=goog.events.KeyCodes.ALT:e.metaKey&&e.keyCode!=goog.events.KeyCodes.META&&(this.lastKey_=goog.events.KeyCodes.META)),goog.events.KeyHandler.USES_KEYDOWN_&&!goog.events.KeyCodes.firesKeyPressEvent(e.keyCode,this.lastKey_,e.shiftKey,e.ctrlKey,e.altKey)?this.handleEvent(e):(this.keyCode_=goog.events.KeyCodes.normalizeKeyCode(e.keyCode),goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_&&(this.altKey_=e.altKey))
21
- },goog.events.KeyHandler.prototype.resetState=function(){this.keyCode_=this.lastKey_=-1},goog.events.KeyHandler.prototype.handleKeyup_=function(e){this.resetState(),this.altKey_=e.altKey},goog.events.KeyHandler.prototype.handleEvent=function(e){var t,o,n=e.getBrowserEvent(),i=n.altKey;goog.userAgent.IE&&e.type==goog.events.EventType.KEYPRESS?(t=this.keyCode_,o=t!=goog.events.KeyCodes.ENTER&&t!=goog.events.KeyCodes.ESC?n.keyCode:0):goog.userAgent.WEBKIT&&e.type==goog.events.EventType.KEYPRESS?(t=this.keyCode_,o=0<=n.charCode&&63232>n.charCode&&goog.events.KeyCodes.isCharacterKey(t)?n.charCode:0):goog.userAgent.OPERA?(t=this.keyCode_,o=goog.events.KeyCodes.isCharacterKey(t)?n.keyCode:0):(t=n.keyCode||this.keyCode_,o=n.charCode||0,goog.events.KeyHandler.SAVE_ALT_FOR_KEYPRESS_&&(i=this.altKey_),goog.userAgent.MAC&&o==goog.events.KeyCodes.QUESTION_MARK&&t==goog.events.KeyCodes.WIN_KEY&&(t=goog.events.KeyCodes.SLASH));var r=t=goog.events.KeyCodes.normalizeKeyCode(t),s=n.keyIdentifier;t?t>=63232&&t in goog.events.KeyHandler.safariKey_?r=goog.events.KeyHandler.safariKey_[t]:25==t&&e.shiftKey&&(r=9):s&&s in goog.events.KeyHandler.keyIdentifier_&&(r=goog.events.KeyHandler.keyIdentifier_[s]),e=r==this.lastKey_,this.lastKey_=r,n=new goog.events.KeyEvent(r,o,e,n),n.altKey=i,this.dispatchEvent(n)},goog.events.KeyHandler.prototype.getElement=function(){return this.element_},goog.events.KeyHandler.prototype.attach=function(e,t){this.keyUpKey_&&this.detach(),this.element_=e,this.keyPressKey_=goog.events.listen(this.element_,goog.events.EventType.KEYPRESS,this,t),this.keyDownKey_=goog.events.listen(this.element_,goog.events.EventType.KEYDOWN,this.handleKeyDown_,t,this),this.keyUpKey_=goog.events.listen(this.element_,goog.events.EventType.KEYUP,this.handleKeyup_,t,this)},goog.events.KeyHandler.prototype.detach=function(){this.keyPressKey_&&(goog.events.unlistenByKey(this.keyPressKey_),goog.events.unlistenByKey(this.keyDownKey_),goog.events.unlistenByKey(this.keyUpKey_),this.keyUpKey_=this.keyDownKey_=this.keyPressKey_=null),this.element_=null,this.keyCode_=this.lastKey_=-1},goog.events.KeyHandler.prototype.disposeInternal=function(){goog.events.KeyHandler.superClass_.disposeInternal.call(this),this.detach()},goog.events.KeyEvent=function(e,t,o,n){goog.events.BrowserEvent.call(this,n),this.type=goog.events.KeyHandler.EventType.KEY,this.keyCode=e,this.charCode=t,this.repeat=o},goog.inherits(goog.events.KeyEvent,goog.events.BrowserEvent),goog.a11y={},goog.a11y.aria={},goog.a11y.aria.Role={ALERT:"alert",ALERTDIALOG:"alertdialog",APPLICATION:"application",ARTICLE:"article",BANNER:"banner",BUTTON:"button",CHECKBOX:"checkbox",COLUMNHEADER:"columnheader",COMBOBOX:"combobox",COMPLEMENTARY:"complementary",CONTENTINFO:"contentinfo",DEFINITION:"definition",DIALOG:"dialog",DIRECTORY:"directory",DOCUMENT:"document",FORM:"form",GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",HEADING:"heading",IMG:"img",LINK:"link",LIST:"list",LISTBOX:"listbox",LISTITEM:"listitem",LOG:"log",MAIN:"main",MARQUEE:"marquee",MATH:"math",MENU:"menu",MENUBAR:"menubar",MENU_ITEM:"menuitem",MENU_ITEM_CHECKBOX:"menuitemcheckbox",MENU_ITEM_RADIO:"menuitemradio",NAVIGATION:"navigation",NOTE:"note",OPTION:"option",PRESENTATION:"presentation",PROGRESSBAR:"progressbar",RADIO:"radio",RADIOGROUP:"radiogroup",REGION:"region",ROW:"row",ROWGROUP:"rowgroup",ROWHEADER:"rowheader",SCROLLBAR:"scrollbar",SEARCH:"search",SEPARATOR:"separator",SLIDER:"slider",SPINBUTTON:"spinbutton",STATUS:"status",TAB:"tab",TAB_LIST:"tablist",TAB_PANEL:"tabpanel",TEXTBOX:"textbox",TIMER:"timer",TOOLBAR:"toolbar",TOOLTIP:"tooltip",TREE:"tree",TREEGRID:"treegrid",TREEITEM:"treeitem"},goog.a11y.aria.State={ACTIVEDESCENDANT:"activedescendant",ATOMIC:"atomic",AUTOCOMPLETE:"autocomplete",BUSY:"busy",CHECKED:"checked",CONTROLS:"controls",DESCRIBEDBY:"describedby",DISABLED:"disabled",DROPEFFECT:"dropeffect",EXPANDED:"expanded",FLOWTO:"flowto",GRABBED:"grabbed",HASPOPUP:"haspopup",HIDDEN:"hidden",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",LIVE:"live",MULTILINE:"multiline",MULTISELECTABLE:"multiselectable",ORIENTATION:"orientation",OWNS:"owns",POSINSET:"posinset",PRESSED:"pressed",READONLY:"readonly",RELEVANT:"relevant",REQUIRED:"required",SELECTED:"selected",SETSIZE:"setsize",SORT:"sort",VALUEMAX:"valuemax",VALUEMIN:"valuemin",VALUENOW:"valuenow",VALUETEXT:"valuetext"},goog.a11y.aria.AutoCompleteValues={INLINE:"inline",LIST:"list",BOTH:"both",NONE:"none"},goog.a11y.aria.DropEffectValues={COPY:"copy",MOVE:"move",LINK:"link",EXECUTE:"execute",POPUP:"popup",NONE:"none"},goog.a11y.aria.LivePriority={OFF:"off",POLITE:"polite",ASSERTIVE:"assertive"},goog.a11y.aria.OrientationValues={VERTICAL:"vertical",HORIZONTAL:"horizontal"},goog.a11y.aria.RelevantValues={ADDITIONS:"additions",REMOVALS:"removals",TEXT:"text",ALL:"all"},goog.a11y.aria.SortValues={ASCENDING:"ascending",DESCENDING:"descending",NONE:"none",OTHER:"other"},goog.a11y.aria.CheckedValues={TRUE:"true",FALSE:"false",MIXED:"mixed",UNDEFINED:"undefined"},goog.a11y.aria.ExpandedValues={TRUE:"true",FALSE:"false",UNDEFINED:"undefined"},goog.a11y.aria.GrabbedValues={TRUE:"true",FALSE:"false",UNDEFINED:"undefined"},goog.a11y.aria.InvalidValues={FALSE:"false",TRUE:"true",GRAMMAR:"grammar",SPELLING:"spelling"},goog.a11y.aria.PressedValues={TRUE:"true",FALSE:"false",MIXED:"mixed",UNDEFINED:"undefined"},goog.a11y.aria.SelectedValues={TRUE:"true",FALSE:"false",UNDEFINED:"undefined"},goog.a11y.aria.datatables={},goog.a11y.aria.datatables.getDefaultValuesMap=function(){return goog.a11y.aria.DefaultStateValueMap_||(goog.a11y.aria.DefaultStateValueMap_=goog.object.create(goog.a11y.aria.State.ATOMIC,!1,goog.a11y.aria.State.AUTOCOMPLETE,"none",goog.a11y.aria.State.DROPEFFECT,"none",goog.a11y.aria.State.HASPOPUP,!1,goog.a11y.aria.State.LIVE,"off",goog.a11y.aria.State.MULTILINE,!1,goog.a11y.aria.State.MULTISELECTABLE,!1,goog.a11y.aria.State.ORIENTATION,"vertical",goog.a11y.aria.State.READONLY,!1,goog.a11y.aria.State.RELEVANT,"additions text",goog.a11y.aria.State.REQUIRED,!1,goog.a11y.aria.State.SORT,"none",goog.a11y.aria.State.BUSY,!1,goog.a11y.aria.State.DISABLED,!1,goog.a11y.aria.State.HIDDEN,!1,goog.a11y.aria.State.INVALID,"false")),goog.a11y.aria.DefaultStateValueMap_},goog.a11y.aria.ARIA_PREFIX_="aria-",goog.a11y.aria.ROLE_ATTRIBUTE_="role",goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_=[goog.dom.TagName.A,goog.dom.TagName.AREA,goog.dom.TagName.BUTTON,goog.dom.TagName.HEAD,goog.dom.TagName.INPUT,goog.dom.TagName.LINK,goog.dom.TagName.MENU,goog.dom.TagName.META,goog.dom.TagName.OPTGROUP,goog.dom.TagName.OPTION,goog.dom.TagName.PROGRESS,goog.dom.TagName.STYLE,goog.dom.TagName.SELECT,goog.dom.TagName.SOURCE,goog.dom.TagName.TEXTAREA,goog.dom.TagName.TITLE,goog.dom.TagName.TRACK],goog.a11y.aria.setRole=function(e,t){t?(goog.asserts.ENABLE_ASSERTS&&goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.Role,t),"No such ARIA role "+t),e.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_,t)):goog.a11y.aria.removeRole(e)},goog.a11y.aria.getRole=function(e){return e.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_)||null},goog.a11y.aria.removeRole=function(e){e.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_)},goog.a11y.aria.setState=function(e,t,o){goog.isArrayLike(o)&&(o=o.join(" "));var n=goog.a11y.aria.getAriaAttributeName_(t);""===o||void 0==o?(o=goog.a11y.aria.datatables.getDefaultValuesMap(),t in o?e.setAttribute(n,o[t]):e.removeAttribute(n)):e.setAttribute(n,o)},goog.a11y.aria.removeState=function(e,t){e.removeAttribute(goog.a11y.aria.getAriaAttributeName_(t))},goog.a11y.aria.getState=function(e,t){var o=e.getAttribute(goog.a11y.aria.getAriaAttributeName_(t));return null==o||void 0==o?"":String(o)},goog.a11y.aria.getActiveDescendant=function(e){var t=goog.a11y.aria.getState(e,goog.a11y.aria.State.ACTIVEDESCENDANT);return goog.dom.getOwnerDocument(e).getElementById(t)},goog.a11y.aria.setActiveDescendant=function(e,t){var o="";t&&(o=t.id,goog.asserts.assert(o,"The active element should have an id.")),goog.a11y.aria.setState(e,goog.a11y.aria.State.ACTIVEDESCENDANT,o)},goog.a11y.aria.getLabel=function(e){return goog.a11y.aria.getState(e,goog.a11y.aria.State.LABEL)},goog.a11y.aria.setLabel=function(e,t){goog.a11y.aria.setState(e,goog.a11y.aria.State.LABEL,t)},goog.a11y.aria.assertRoleIsSetInternalUtil=function(e,t){if(!goog.array.contains(goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_,e.tagName)){var o=goog.a11y.aria.getRole(e);goog.asserts.assert(null!=o,"The element ARIA role cannot be null."),goog.asserts.assert(goog.array.contains(t,o),'Non existing or incorrect role set for element.The role set is "'+o+'". The role should be any of "'+t+'". Check the ARIA specification for more details http://www.w3.org/TR/wai-aria/roles.')}},goog.a11y.aria.getStateBoolean=function(e,t){var o=e.getAttribute(goog.a11y.aria.getAriaAttributeName_(t));return goog.asserts.assert(goog.isBoolean(o)||null==o||"true"==o||"false"==o),null==o?o:goog.isBoolean(o)?o:"true"==o},goog.a11y.aria.getStateNumber=function(e,t){var o=e.getAttribute(goog.a11y.aria.getAriaAttributeName_(t));return goog.asserts.assert(!(null!=o&&isNaN(Number(o))||goog.isBoolean(o))),null==o?null:Number(o)},goog.a11y.aria.getStateString=function(e,t){var o=e.getAttribute(goog.a11y.aria.getAriaAttributeName_(t));return goog.asserts.assert((null==o||goog.isString(o))&&isNaN(Number(o))&&"true"!=o&&"false"!=o),null==o?null:o},goog.a11y.aria.getStringArrayStateInternalUtil=function(e,t){var o=e.getAttribute(goog.a11y.aria.getAriaAttributeName_(t));return goog.a11y.aria.splitStringOnWhitespace_(o)},goog.a11y.aria.splitStringOnWhitespace_=function(e){return e?e.split(/\s+/):[]},goog.a11y.aria.getAriaAttributeName_=function(e){return goog.asserts.ENABLE_ASSERTS&&(goog.asserts.assert(e,"ARIA attribute cannot be empty."),goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.State,e),"No such ARIA attribute "+e)),goog.a11y.aria.ARIA_PREFIX_+e},goog.ui.ControlRenderer=function(){},goog.addSingletonGetter(goog.ui.ControlRenderer),goog.ui.ControlRenderer.getCustomRenderer=function(e,t){var o=new e;return o.getCssClass=function(){return t},o},goog.ui.ControlRenderer.CSS_CLASS="goog-control",goog.ui.ControlRenderer.IE6_CLASS_COMBINATIONS=[],goog.ui.ControlRenderer.prototype.getAriaRole=function(){},goog.ui.ControlRenderer.prototype.createDom=function(e){var t=e.getDomHelper().createDom("div",this.getClassNames(e).join(" "),e.getContent());return this.setAriaStates(e,t),t},goog.ui.ControlRenderer.prototype.getContentElement=function(e){return e},goog.ui.ControlRenderer.prototype.enableClassName=function(e,t,o){if(e=e.getElement?e.getElement():e)if(goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("7")){var n=this.getAppliedCombinedClassNames_(goog.dom.classes.get(e),t);n.push(t),goog.partial(o?goog.dom.classes.add:goog.dom.classes.remove,e).apply(null,n)}else goog.dom.classes.enable(e,t,o)},goog.ui.ControlRenderer.prototype.enableExtraClassName=function(e,t,o){this.enableClassName(e,t,o)},goog.ui.ControlRenderer.prototype.canDecorate=function(){return!0},goog.ui.ControlRenderer.prototype.decorate=function(e,t){t.id&&e.setId(t.id);var o=this.getContentElement(t);o&&o.firstChild?e.setContentInternal(o.firstChild.nextSibling?goog.array.clone(o.childNodes):o.firstChild):e.setContentInternal(null);var n=0,i=this.getCssClass(),r=this.getStructuralCssClass(),s=!1,l=!1,o=!1,a=goog.dom.classes.get(t);goog.array.forEach(a,function(e){s||e!=i?l||e!=r?n|=this.getStateFromClass(e):l=!0:(s=!0,r==i&&(l=!0))},this),e.setStateInternal(n),s||(a.push(i),r==i&&(l=!0)),l||a.push(r);var c=e.getExtraClassNames();if(c&&a.push.apply(a,c),goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("7")){var u=this.getAppliedCombinedClassNames_(a);0<u.length&&(a.push.apply(a,u),o=!0)}return s&&l&&!c&&!o||goog.dom.classes.set(t,a.join(" ")),this.setAriaStates(e,t),t},goog.ui.ControlRenderer.prototype.initializeDom=function(e){e.isRightToLeft()&&this.setRightToLeft(e.getElement(),!0),e.isEnabled()&&this.setFocusable(e,e.isVisible())},goog.ui.ControlRenderer.prototype.setAriaRole=function(e,t){var o=t||this.getAriaRole();o&&(goog.asserts.assert(e,"The element passed as a first parameter cannot be null."),goog.a11y.aria.setRole(e,o))},goog.ui.ControlRenderer.prototype.setAriaStates=function(e,t){goog.asserts.assert(e),goog.asserts.assert(t),e.isVisible()||goog.a11y.aria.setState(t,goog.a11y.aria.State.HIDDEN,!e.isVisible()),e.isEnabled()||this.updateAriaState(t,goog.ui.Component.State.DISABLED,!e.isEnabled()),e.isSupportedState(goog.ui.Component.State.SELECTED)&&this.updateAriaState(t,goog.ui.Component.State.SELECTED,e.isSelected()),e.isSupportedState(goog.ui.Component.State.CHECKED)&&this.updateAriaState(t,goog.ui.Component.State.CHECKED,e.isChecked()),e.isSupportedState(goog.ui.Component.State.OPENED)&&this.updateAriaState(t,goog.ui.Component.State.OPENED,e.isOpen())},goog.ui.ControlRenderer.prototype.setAllowTextSelection=function(e,t){goog.style.setUnselectable(e,!t,!goog.userAgent.IE&&!goog.userAgent.OPERA)},goog.ui.ControlRenderer.prototype.setRightToLeft=function(e,t){this.enableClassName(e,this.getStructuralCssClass()+"-rtl",t)},goog.ui.ControlRenderer.prototype.isFocusable=function(e){var t;return e.isSupportedState(goog.ui.Component.State.FOCUSED)&&(t=e.getKeyEventTarget())?goog.dom.isFocusableTabIndex(t):!1},goog.ui.ControlRenderer.prototype.setFocusable=function(e,t){var o;if(e.isSupportedState(goog.ui.Component.State.FOCUSED)&&(o=e.getKeyEventTarget())){if(!t&&e.isFocused()){try{o.blur()}catch(n){}e.isFocused()&&e.handleBlur(null)}goog.dom.isFocusableTabIndex(o)!=t&&goog.dom.setFocusableTabIndex(o,t)}},goog.ui.ControlRenderer.prototype.setVisible=function(e,t){goog.style.setElementShown(e,t),e&&goog.a11y.aria.setState(e,goog.a11y.aria.State.HIDDEN,!t)},goog.ui.ControlRenderer.prototype.setState=function(e,t,o){var n=e.getElement();if(n){var i=this.getClassForState(t);i&&this.enableClassName(e,i,o),this.updateAriaState(n,t,o)}},goog.ui.ControlRenderer.prototype.updateAriaState=function(e,t,o){goog.ui.ControlRenderer.ARIA_STATE_MAP_||(goog.ui.ControlRenderer.ARIA_STATE_MAP_=goog.object.create(goog.ui.Component.State.DISABLED,goog.a11y.aria.State.DISABLED,goog.ui.Component.State.SELECTED,goog.a11y.aria.State.SELECTED,goog.ui.Component.State.CHECKED,goog.a11y.aria.State.CHECKED,goog.ui.Component.State.OPENED,goog.a11y.aria.State.EXPANDED)),(t=goog.ui.ControlRenderer.ARIA_STATE_MAP_[t])&&(goog.asserts.assert(e,"The element passed as a first parameter cannot be null."),goog.a11y.aria.setState(e,t,o))},goog.ui.ControlRenderer.prototype.setContent=function(e,t){var o=this.getContentElement(e);if(o&&(goog.dom.removeChildren(o),t))if(goog.isString(t))goog.dom.setTextContent(o,t);else{var n=function(e){if(e){var t=goog.dom.getOwnerDocument(o);o.appendChild(goog.isString(e)?t.createTextNode(e):e)}};goog.isArray(t)?goog.array.forEach(t,n):!goog.isArrayLike(t)||"nodeType"in t?n(t):goog.array.forEach(goog.array.clone(t),n)}},goog.ui.ControlRenderer.prototype.getKeyEventTarget=function(e){return e.getElement()},goog.ui.ControlRenderer.prototype.getCssClass=function(){return goog.ui.ControlRenderer.CSS_CLASS},goog.ui.ControlRenderer.prototype.getIe6ClassCombinations=function(){return[]},goog.ui.ControlRenderer.prototype.getStructuralCssClass=function(){return this.getCssClass()},goog.ui.ControlRenderer.prototype.getClassNames=function(e){var t=this.getCssClass(),o=[t],n=this.getStructuralCssClass();return n!=t&&o.push(n),t=this.getClassNamesForState(e.getState()),o.push.apply(o,t),(e=e.getExtraClassNames())&&o.push.apply(o,e),goog.userAgent.IE&&!goog.userAgent.isVersionOrHigher("7")&&o.push.apply(o,this.getAppliedCombinedClassNames_(o)),o},goog.ui.ControlRenderer.prototype.getAppliedCombinedClassNames_=function(e,t){var o=[];return t&&(e=e.concat([t])),goog.array.forEach(this.getIe6ClassCombinations(),function(n){!goog.array.every(n,goog.partial(goog.array.contains,e))||t&&!goog.array.contains(n,t)||o.push(n.join("_"))}),o},goog.ui.ControlRenderer.prototype.getClassNamesForState=function(e){for(var t=[];e;){var o=e&-e;t.push(this.getClassForState(o)),e&=~o}return t},goog.ui.ControlRenderer.prototype.getClassForState=function(e){return this.classByState_||this.createClassByStateMap_(),this.classByState_[e]},goog.ui.ControlRenderer.prototype.getStateFromClass=function(e){return this.stateByClass_||this.createStateByClassMap_(),e=parseInt(this.stateByClass_[e],10),isNaN(e)?0:e},goog.ui.ControlRenderer.prototype.createClassByStateMap_=function(){var e=this.getStructuralCssClass();this.classByState_=goog.object.create(goog.ui.Component.State.DISABLED,e+"-disabled",goog.ui.Component.State.HOVER,e+"-hover",goog.ui.Component.State.ACTIVE,e+"-active",goog.ui.Component.State.SELECTED,e+"-selected",goog.ui.Component.State.CHECKED,e+"-checked",goog.ui.Component.State.FOCUSED,e+"-focused",goog.ui.Component.State.OPENED,e+"-open")},goog.ui.ControlRenderer.prototype.createStateByClassMap_=function(){this.classByState_||this.createClassByStateMap_(),this.stateByClass_=goog.object.transpose(this.classByState_)},goog.dom.classlist={},goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST=!1,goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_=goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST||!!goog.global.DOMTokenList,goog.dom.classlist.get=goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_?function(e){return e.classList}:function(e){return e=e.className,goog.isString(e)&&e.match(/\S+/g)||[]},goog.dom.classlist.set=function(e,t){e.className=t},goog.dom.classlist.contains=goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_?function(e,t){return goog.asserts.assert(!!e.classList),e.classList.contains(t)}:function(e,t){return goog.array.contains(goog.dom.classlist.get(e),t)},goog.dom.classlist.add=goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_?function(e,t){e.classList.add(t)}:function(e,t){goog.dom.classlist.contains(e,t)||(e.className+=0<e.className.length?" "+t:t)},goog.dom.classlist.addAll=goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_?function(e,t){goog.array.forEach(t,function(t){goog.dom.classlist.add(e,t)})}:function(e,t){var o={};goog.array.forEach(goog.dom.classlist.get(e),function(e){o[e]=!0}),goog.array.forEach(t,function(e){o[e]=!0}),e.className="";for(var n in o)e.className+=0<e.className.length?" "+n:n},goog.dom.classlist.remove=goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_?function(e,t){e.classList.remove(t)}:function(e,t){goog.dom.classlist.contains(e,t)&&(e.className=goog.array.filter(goog.dom.classlist.get(e),function(e){return e!=t}).join(" "))},goog.dom.classlist.removeAll=goog.dom.classlist.NATIVE_DOM_TOKEN_LIST_?function(e,t){goog.array.forEach(t,function(t){goog.dom.classlist.remove(e,t)})}:function(e,t){e.className=goog.array.filter(goog.dom.classlist.get(e),function(e){return!goog.array.contains(t,e)}).join(" ")},goog.dom.classlist.enable=function(e,t,o){o?goog.dom.classlist.add(e,t):goog.dom.classlist.remove(e,t)},goog.dom.classlist.swap=function(e,t,o){return goog.dom.classlist.contains(e,t)?(goog.dom.classlist.remove(e,t),goog.dom.classlist.add(e,o),!0):!1},goog.dom.classlist.toggle=function(e,t){var o=!goog.dom.classlist.contains(e,t);return goog.dom.classlist.enable(e,t,o),o},goog.dom.classlist.addRemove=function(e,t,o){goog.dom.classlist.remove(e,t),goog.dom.classlist.add(e,o)},goog.ui.registry={},goog.ui.registry.getDefaultRenderer=function(e){for(var t;e&&(t=goog.getUid(e),!(t=goog.ui.registry.defaultRenderers_[t]));)e=e.superClass_?e.superClass_.constructor:null;return t?goog.isFunction(t.getInstance)?t.getInstance():new t:null},goog.ui.registry.setDefaultRenderer=function(e,t){if(!goog.isFunction(e))throw Error("Invalid component class "+e);if(!goog.isFunction(t))throw Error("Invalid renderer class "+t);var o=goog.getUid(e);goog.ui.registry.defaultRenderers_[o]=t},goog.ui.registry.getDecoratorByClassName=function(e){return e in goog.ui.registry.decoratorFunctions_?goog.ui.registry.decoratorFunctions_[e]():null},goog.ui.registry.setDecoratorByClassName=function(e,t){if(!e)throw Error("Invalid class name "+e);if(!goog.isFunction(t))throw Error("Invalid decorator function "+t);goog.ui.registry.decoratorFunctions_[e]=t},goog.ui.registry.getDecorator=function(e){for(var t=goog.dom.classlist.get(e),o=0,n=t.length;n>o;o++)if(e=goog.ui.registry.getDecoratorByClassName(t[o]))return e;return null},goog.ui.registry.reset=function(){goog.ui.registry.defaultRenderers_={},goog.ui.registry.decoratorFunctions_={}},goog.ui.registry.defaultRenderers_={},goog.ui.registry.decoratorFunctions_={},goog.ui.decorate=function(e){var t=goog.ui.registry.getDecorator(e);return t&&t.decorate(e),t},goog.ui.Control=function(e,t,o){goog.ui.Component.call(this,o),this.renderer_=t||goog.ui.registry.getDefaultRenderer(this.constructor),this.setContentInternal(goog.isDef(e)?e:null)},goog.inherits(goog.ui.Control,goog.ui.Component),goog.ui.Control.registerDecorator=goog.ui.registry.setDecoratorByClassName,goog.ui.Control.getDecorator=goog.ui.registry.getDecorator,goog.ui.Control.decorate=goog.ui.decorate,goog.ui.Control.prototype.content_=null,goog.ui.Control.prototype.state_=0,goog.ui.Control.prototype.supportedStates_=goog.ui.Component.State.DISABLED|goog.ui.Component.State.HOVER|goog.ui.Component.State.ACTIVE|goog.ui.Component.State.FOCUSED,goog.ui.Control.prototype.autoStates_=goog.ui.Component.State.ALL,goog.ui.Control.prototype.statesWithTransitionEvents_=0,goog.ui.Control.prototype.visible_=!0,goog.ui.Control.prototype.extraClassNames_=null,goog.ui.Control.prototype.handleMouseEvents_=!0,goog.ui.Control.prototype.allowTextSelection_=!1,goog.ui.Control.prototype.preferredAriaRole_=null,goog.ui.Control.prototype.isHandleMouseEvents=function(){return this.handleMouseEvents_},goog.ui.Control.prototype.setHandleMouseEvents=function(e){this.isInDocument()&&e!=this.handleMouseEvents_&&this.enableMouseEventHandling_(e),this.handleMouseEvents_=e},goog.ui.Control.prototype.getKeyEventTarget=function(){return this.renderer_.getKeyEventTarget(this)},goog.ui.Control.prototype.getKeyHandler=function(){return this.keyHandler_||(this.keyHandler_=new goog.events.KeyHandler)},goog.ui.Control.prototype.getRenderer=function(){return this.renderer_},goog.ui.Control.prototype.setRenderer=function(e){if(this.isInDocument())throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.getElement()&&this.setElementInternal(null),this.renderer_=e},goog.ui.Control.prototype.getExtraClassNames=function(){return this.extraClassNames_},goog.ui.Control.prototype.addClassName=function(e){e&&(this.extraClassNames_?goog.array.contains(this.extraClassNames_,e)||this.extraClassNames_.push(e):this.extraClassNames_=[e],this.renderer_.enableExtraClassName(this,e,!0))},goog.ui.Control.prototype.removeClassName=function(e){e&&this.extraClassNames_&&goog.array.remove(this.extraClassNames_,e)&&(0==this.extraClassNames_.length&&(this.extraClassNames_=null),this.renderer_.enableExtraClassName(this,e,!1))},goog.ui.Control.prototype.enableClassName=function(e,t){t?this.addClassName(e):this.removeClassName(e)},goog.ui.Control.prototype.createDom=function(){var e=this.renderer_.createDom(this);this.setElementInternal(e),this.renderer_.setAriaRole(e,this.getPreferredAriaRole()),this.isAllowTextSelection()||this.renderer_.setAllowTextSelection(e,!1),this.isVisible()||this.renderer_.setVisible(e,!1)},goog.ui.Control.prototype.getPreferredAriaRole=function(){return this.preferredAriaRole_},goog.ui.Control.prototype.setPreferredAriaRole=function(e){this.preferredAriaRole_=e},goog.ui.Control.prototype.getContentElement=function(){return this.renderer_.getContentElement(this.getElement())},goog.ui.Control.prototype.canDecorate=function(e){return this.renderer_.canDecorate(e)},goog.ui.Control.prototype.decorateInternal=function(e){e=this.renderer_.decorate(this,e),this.setElementInternal(e),this.renderer_.setAriaRole(e,this.getPreferredAriaRole()),this.isAllowTextSelection()||this.renderer_.setAllowTextSelection(e,!1),this.visible_="none"!=e.style.display},goog.ui.Control.prototype.enterDocument=function(){if(goog.ui.Control.superClass_.enterDocument.call(this),this.renderer_.initializeDom(this),this.supportedStates_&~goog.ui.Component.State.DISABLED&&(this.isHandleMouseEvents()&&this.enableMouseEventHandling_(!0),this.isSupportedState(goog.ui.Component.State.FOCUSED))){var e=this.getKeyEventTarget();if(e){var t=this.getKeyHandler();t.attach(e),this.getHandler().listen(t,goog.events.KeyHandler.EventType.KEY,this.handleKeyEvent).listen(e,goog.events.EventType.FOCUS,this.handleFocus).listen(e,goog.events.EventType.BLUR,this.handleBlur)}}},goog.ui.Control.prototype.enableMouseEventHandling_=function(e){var t=this.getHandler(),o=this.getElement();e?(t.listen(o,goog.events.EventType.MOUSEOVER,this.handleMouseOver).listen(o,goog.events.EventType.MOUSEDOWN,this.handleMouseDown).listen(o,goog.events.EventType.MOUSEUP,this.handleMouseUp).listen(o,goog.events.EventType.MOUSEOUT,this.handleMouseOut),this.handleContextMenu!=goog.nullFunction&&t.listen(o,goog.events.EventType.CONTEXTMENU,this.handleContextMenu),goog.userAgent.IE&&t.listen(o,goog.events.EventType.DBLCLICK,this.handleDblClick)):(t.unlisten(o,goog.events.EventType.MOUSEOVER,this.handleMouseOver).unlisten(o,goog.events.EventType.MOUSEDOWN,this.handleMouseDown).unlisten(o,goog.events.EventType.MOUSEUP,this.handleMouseUp).unlisten(o,goog.events.EventType.MOUSEOUT,this.handleMouseOut),this.handleContextMenu!=goog.nullFunction&&t.unlisten(o,goog.events.EventType.CONTEXTMENU,this.handleContextMenu),goog.userAgent.IE&&t.unlisten(o,goog.events.EventType.DBLCLICK,this.handleDblClick))},goog.ui.Control.prototype.exitDocument=function(){goog.ui.Control.superClass_.exitDocument.call(this),this.keyHandler_&&this.keyHandler_.detach(),this.isVisible()&&this.isEnabled()&&this.renderer_.setFocusable(this,!1)},goog.ui.Control.prototype.disposeInternal=function(){goog.ui.Control.superClass_.disposeInternal.call(this),this.keyHandler_&&(this.keyHandler_.dispose(),delete this.keyHandler_),delete this.renderer_,this.extraClassNames_=this.content_=null},goog.ui.Control.prototype.getContent=function(){return this.content_},goog.ui.Control.prototype.setContent=function(e){this.renderer_.setContent(this.getElement(),e),this.setContentInternal(e)},goog.ui.Control.prototype.setContentInternal=function(e){this.content_=e},goog.ui.Control.prototype.getCaption=function(){var e=this.getContent();return e?(e=goog.isString(e)?e:goog.isArray(e)?goog.array.map(e,goog.dom.getRawTextContent).join(""):goog.dom.getTextContent(e),goog.string.collapseBreakingSpaces(e)):""},goog.ui.Control.prototype.setCaption=function(e){this.setContent(e)},goog.ui.Control.prototype.setRightToLeft=function(e){goog.ui.Control.superClass_.setRightToLeft.call(this,e);var t=this.getElement();t&&this.renderer_.setRightToLeft(t,e)},goog.ui.Control.prototype.isAllowTextSelection=function(){return this.allowTextSelection_},goog.ui.Control.prototype.setAllowTextSelection=function(e){this.allowTextSelection_=e;var t=this.getElement();t&&this.renderer_.setAllowTextSelection(t,e)},goog.ui.Control.prototype.isVisible=function(){return this.visible_},goog.ui.Control.prototype.setVisible=function(e,t){if(t||this.visible_!=e&&this.dispatchEvent(e?goog.ui.Component.EventType.SHOW:goog.ui.Component.EventType.HIDE)){var o=this.getElement();return o&&this.renderer_.setVisible(o,e),this.isEnabled()&&this.renderer_.setFocusable(this,e),this.visible_=e,!0}return!1},goog.ui.Control.prototype.isEnabled=function(){return!this.hasState(goog.ui.Component.State.DISABLED)},goog.ui.Control.prototype.isParentDisabled_=function(){var e=this.getParent();return!!e&&"function"==typeof e.isEnabled&&!e.isEnabled()},goog.ui.Control.prototype.setEnabled=function(e){!this.isParentDisabled_()&&this.isTransitionAllowed(goog.ui.Component.State.DISABLED,!e)&&(e||(this.setActive(!1),this.setHighlighted(!1)),this.isVisible()&&this.renderer_.setFocusable(this,e),this.setState(goog.ui.Component.State.DISABLED,!e))},goog.ui.Control.prototype.isHighlighted=function(){return this.hasState(goog.ui.Component.State.HOVER)},goog.ui.Control.prototype.setHighlighted=function(e){this.isTransitionAllowed(goog.ui.Component.State.HOVER,e)&&this.setState(goog.ui.Component.State.HOVER,e)},goog.ui.Control.prototype.isActive=function(){return this.hasState(goog.ui.Component.State.ACTIVE)},goog.ui.Control.prototype.setActive=function(e){this.isTransitionAllowed(goog.ui.Component.State.ACTIVE,e)&&this.setState(goog.ui.Component.State.ACTIVE,e)},goog.ui.Control.prototype.isSelected=function(){return this.hasState(goog.ui.Component.State.SELECTED)},goog.ui.Control.prototype.setSelected=function(e){this.isTransitionAllowed(goog.ui.Component.State.SELECTED,e)&&this.setState(goog.ui.Component.State.SELECTED,e)},goog.ui.Control.prototype.isChecked=function(){return this.hasState(goog.ui.Component.State.CHECKED)},goog.ui.Control.prototype.setChecked=function(e){this.isTransitionAllowed(goog.ui.Component.State.CHECKED,e)&&this.setState(goog.ui.Component.State.CHECKED,e)},goog.ui.Control.prototype.isFocused=function(){return this.hasState(goog.ui.Component.State.FOCUSED)},goog.ui.Control.prototype.setFocused=function(e){this.isTransitionAllowed(goog.ui.Component.State.FOCUSED,e)&&this.setState(goog.ui.Component.State.FOCUSED,e)},goog.ui.Control.prototype.isOpen=function(){return this.hasState(goog.ui.Component.State.OPENED)},goog.ui.Control.prototype.setOpen=function(e){this.isTransitionAllowed(goog.ui.Component.State.OPENED,e)&&this.setState(goog.ui.Component.State.OPENED,e)},goog.ui.Control.prototype.getState=function(){return this.state_},goog.ui.Control.prototype.hasState=function(e){return!!(this.state_&e)},goog.ui.Control.prototype.setState=function(e,t){this.isSupportedState(e)&&t!=this.hasState(e)&&(this.renderer_.setState(this,e,t),this.state_=t?this.state_|e:this.state_&~e)},goog.ui.Control.prototype.setStateInternal=function(e){this.state_=e},goog.ui.Control.prototype.isSupportedState=function(e){return!!(this.supportedStates_&e)},goog.ui.Control.prototype.setSupportedState=function(e,t){if(this.isInDocument()&&this.hasState(e)&&!t)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);!t&&this.hasState(e)&&this.setState(e,!1),this.supportedStates_=t?this.supportedStates_|e:this.supportedStates_&~e},goog.ui.Control.prototype.isAutoState=function(e){return!!(this.autoStates_&e)&&this.isSupportedState(e)},goog.ui.Control.prototype.setAutoStates=function(e,t){this.autoStates_=t?this.autoStates_|e:this.autoStates_&~e},goog.ui.Control.prototype.isDispatchTransitionEvents=function(e){return!!(this.statesWithTransitionEvents_&e)&&this.isSupportedState(e)},goog.ui.Control.prototype.setDispatchTransitionEvents=function(e,t){this.statesWithTransitionEvents_=t?this.statesWithTransitionEvents_|e:this.statesWithTransitionEvents_&~e},goog.ui.Control.prototype.isTransitionAllowed=function(e,t){return!(!this.isSupportedState(e)||this.hasState(e)==t||this.statesWithTransitionEvents_&e&&!this.dispatchEvent(goog.ui.Component.getStateTransitionEvent(e,t))||this.isDisposed())},goog.ui.Control.prototype.handleMouseOver=function(e){!goog.ui.Control.isMouseEventWithinElement_(e,this.getElement())&&this.dispatchEvent(goog.ui.Component.EventType.ENTER)&&this.isEnabled()&&this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!0)},goog.ui.Control.prototype.handleMouseOut=function(e){!goog.ui.Control.isMouseEventWithinElement_(e,this.getElement())&&this.dispatchEvent(goog.ui.Component.EventType.LEAVE)&&(this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!1),this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!1))},goog.ui.Control.prototype.handleContextMenu=goog.nullFunction,goog.ui.Control.isMouseEventWithinElement_=function(e,t){return!!e.relatedTarget&&goog.dom.contains(t,e.relatedTarget)},goog.ui.Control.prototype.handleMouseDown=function(e){this.isEnabled()&&(this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!0),e.isMouseActionButton()&&(this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!0),this.renderer_.isFocusable(this)&&this.getKeyEventTarget().focus())),!this.isAllowTextSelection()&&e.isMouseActionButton()&&e.preventDefault()},goog.ui.Control.prototype.handleMouseUp=function(e){this.isEnabled()&&(this.isAutoState(goog.ui.Component.State.HOVER)&&this.setHighlighted(!0),this.isActive()&&this.performActionInternal(e)&&this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!1))},goog.ui.Control.prototype.handleDblClick=function(e){this.isEnabled()&&this.performActionInternal(e)},goog.ui.Control.prototype.performActionInternal=function(e){this.isAutoState(goog.ui.Component.State.CHECKED)&&this.setChecked(!this.isChecked()),this.isAutoState(goog.ui.Component.State.SELECTED)&&this.setSelected(!0),this.isAutoState(goog.ui.Component.State.OPENED)&&this.setOpen(!this.isOpen());
22
- var t=new goog.events.Event(goog.ui.Component.EventType.ACTION,this);return e&&(t.altKey=e.altKey,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.platformModifierKey=e.platformModifierKey),this.dispatchEvent(t)},goog.ui.Control.prototype.handleFocus=function(){this.isAutoState(goog.ui.Component.State.FOCUSED)&&this.setFocused(!0)},goog.ui.Control.prototype.handleBlur=function(){this.isAutoState(goog.ui.Component.State.ACTIVE)&&this.setActive(!1),this.isAutoState(goog.ui.Component.State.FOCUSED)&&this.setFocused(!1)},goog.ui.Control.prototype.handleKeyEvent=function(e){return this.isVisible()&&this.isEnabled()&&this.handleKeyEventInternal(e)?(e.preventDefault(),e.stopPropagation(),!0):!1},goog.ui.Control.prototype.handleKeyEventInternal=function(e){return e.keyCode==goog.events.KeyCodes.ENTER&&this.performActionInternal(e)},goog.ui.registry.setDefaultRenderer(goog.ui.Control,goog.ui.ControlRenderer),goog.ui.registry.setDecoratorByClassName(goog.ui.ControlRenderer.CSS_CLASS,function(){return new goog.ui.Control(null)}),goog.iter={},goog.iter.StopIteration="StopIteration"in goog.global?goog.global.StopIteration:Error("StopIteration"),goog.iter.Iterator=function(){},goog.iter.Iterator.prototype.next=function(){throw goog.iter.StopIteration},goog.iter.Iterator.prototype.__iterator__=function(){return this},goog.iter.toIterator=function(e){if(e instanceof goog.iter.Iterator)return e;if("function"==typeof e.__iterator__)return e.__iterator__(!1);if(goog.isArrayLike(e)){var t=0,o=new goog.iter.Iterator;return o.next=function(){for(;;){if(t>=e.length)throw goog.iter.StopIteration;if(t in e)return e[t++];t++}},o}throw Error("Not implemented")},goog.iter.forEach=function(e,t,o){if(goog.isArrayLike(e))try{goog.array.forEach(e,t,o)}catch(n){if(n!==goog.iter.StopIteration)throw n}else{e=goog.iter.toIterator(e);try{for(;;)t.call(o,e.next(),void 0,e)}catch(i){if(i!==goog.iter.StopIteration)throw i}}},goog.iter.filter=function(e,t,o){var n=goog.iter.toIterator(e);return e=new goog.iter.Iterator,e.next=function(){for(;;){var e=n.next();if(t.call(o,e,void 0,n))return e}},e},goog.iter.range=function(e,t,o){var n=0,i=e,r=o||1;if(1<arguments.length&&(n=e,i=t),0==r)throw Error("Range step argument must not be zero");var s=new goog.iter.Iterator;return s.next=function(){if(r>0&&n>=i||0>r&&i>=n)throw goog.iter.StopIteration;var e=n;return n+=r,e},s},goog.iter.join=function(e,t){return goog.iter.toArray(e).join(t)},goog.iter.map=function(e,t,o){var n=goog.iter.toIterator(e);return e=new goog.iter.Iterator,e.next=function(){for(;;){var e=n.next();return t.call(o,e,void 0,n)}},e},goog.iter.reduce=function(e,t,o,n){var i=o;return goog.iter.forEach(e,function(e){i=t.call(n,i,e)}),i},goog.iter.some=function(e,t,o){e=goog.iter.toIterator(e);try{for(;;)if(t.call(o,e.next(),void 0,e))return!0}catch(n){if(n!==goog.iter.StopIteration)throw n}return!1},goog.iter.every=function(e,t,o){e=goog.iter.toIterator(e);try{for(;;)if(!t.call(o,e.next(),void 0,e))return!1}catch(n){if(n!==goog.iter.StopIteration)throw n}return!0},goog.iter.chain=function(){var e=goog.iter.toIterator(arguments),t=new goog.iter.Iterator,o=null;return t.next=function(){for(;;){if(null==o){var t=e.next();o=goog.iter.toIterator(t)}try{return o.next()}catch(n){if(n!==goog.iter.StopIteration)throw n;o=null}}},t},goog.iter.chainFromIterable=function(e){return goog.iter.chain.apply(void 0,e)},goog.iter.dropWhile=function(e,t,o){var n=goog.iter.toIterator(e);e=new goog.iter.Iterator;var i=!0;return e.next=function(){for(;;){var e=n.next();if(!i||!t.call(o,e,void 0,n))return i=!1,e}},e},goog.iter.takeWhile=function(e,t,o){var n=goog.iter.toIterator(e);e=new goog.iter.Iterator;var i=!0;return e.next=function(){for(;;){if(!i)throw goog.iter.StopIteration;var e=n.next();if(t.call(o,e,void 0,n))return e;i=!1}},e},goog.iter.toArray=function(e){if(goog.isArrayLike(e))return goog.array.toArray(e);e=goog.iter.toIterator(e);var t=[];return goog.iter.forEach(e,function(e){t.push(e)}),t},goog.iter.equals=function(e,t){var o=goog.iter.zipLongest({},e,t);return goog.iter.every(o,function(e){return e[0]==e[1]})},goog.iter.nextOrValue=function(e,t){try{return goog.iter.toIterator(e).next()}catch(o){if(o!=goog.iter.StopIteration)throw o;return t}},goog.iter.product=function(){if(goog.array.some(arguments,function(e){return!e.length})||!arguments.length)return new goog.iter.Iterator;var e=new goog.iter.Iterator,t=arguments,o=goog.array.repeat(0,t.length);return e.next=function(){if(o){for(var e=goog.array.map(o,function(e,o){return t[o][e]}),n=o.length-1;n>=0;n--){if(goog.asserts.assert(o),o[n]<t[n].length-1){o[n]++;break}if(0==n){o=null;break}o[n]=0}return e}throw goog.iter.StopIteration},e},goog.iter.cycle=function(e){var t=goog.iter.toIterator(e),o=[],n=0;e=new goog.iter.Iterator;var i=!1;return e.next=function(){var e=null;if(!i)try{return e=t.next(),o.push(e),e}catch(r){if(r!=goog.iter.StopIteration||goog.array.isEmpty(o))throw r;i=!0}return e=o[n],n=(n+1)%o.length,e},e},goog.iter.count=function(e,t){var o=e||0,n=goog.isDef(t)?t:1,i=new goog.iter.Iterator;return i.next=function(){var e=o;return o+=n,e},i},goog.iter.repeat=function(e){var t=new goog.iter.Iterator;return t.next=goog.functions.constant(e),t},goog.iter.accumulate=function(e){var t=goog.iter.toIterator(e),o=0;return e=new goog.iter.Iterator,e.next=function(){return o+=t.next()},e},goog.iter.zip=function(){var e=arguments,t=new goog.iter.Iterator;if(0<e.length){var o=goog.array.map(e,goog.iter.toIterator);t.next=function(){return goog.array.map(o,function(e){return e.next()})}}return t},goog.iter.zipLongest=function(e){var t=goog.array.slice(arguments,1),o=new goog.iter.Iterator;if(0<t.length){var n=goog.array.map(t,goog.iter.toIterator);o.next=function(){var t=!1,o=goog.array.map(n,function(o){var n;try{n=o.next(),t=!0}catch(i){if(i!==goog.iter.StopIteration)throw i;n=e}return n});if(!t)throw goog.iter.StopIteration;return o}}return o},goog.iter.compress=function(e,t){var o=goog.iter.toIterator(t);return goog.iter.filter(e,function(){return!!o.next()})},goog.iter.GroupByIterator_=function(e,t){this.iterator=goog.iter.toIterator(e),this.keyFunc=t||goog.functions.identity},goog.inherits(goog.iter.GroupByIterator_,goog.iter.Iterator),goog.iter.GroupByIterator_.prototype.next=function(){for(;this.currentKey==this.targetKey;)this.currentValue=this.iterator.next(),this.currentKey=this.keyFunc(this.currentValue);return this.targetKey=this.currentKey,[this.currentKey,this.groupItems_(this.targetKey)]},goog.iter.GroupByIterator_.prototype.groupItems_=function(e){for(var t=[];this.currentKey==e;){t.push(this.currentValue);try{this.currentValue=this.iterator.next()}catch(o){if(o!==goog.iter.StopIteration)throw o;break}this.currentKey=this.keyFunc(this.currentValue)}return t},goog.iter.groupBy=function(e,t){return new goog.iter.GroupByIterator_(e,t)},goog.iter.tee=function(e,t){var o=goog.iter.toIterator(e),n=goog.isNumber(t)?t:2,i=goog.array.map(goog.array.range(n),function(){return[]}),r=function(){var e=o.next();goog.array.forEach(i,function(t){t.push(e)})};return goog.array.map(i,function(e){var t=new goog.iter.Iterator;return t.next=function(){return goog.array.isEmpty(e)&&r(),goog.asserts.assert(!goog.array.isEmpty(e)),e.shift()},t})},goog.iter.enumerate=function(e,t){return goog.iter.zip(goog.iter.count(t),e)},goog.iter.limit=function(e,t){goog.asserts.assert(goog.math.isInt(t)&&t>=0);var o=goog.iter.toIterator(e),n=new goog.iter.Iterator,i=t;return n.next=function(){if(0<i--)return o.next();throw goog.iter.StopIteration},n},goog.iter.consume=function(e,t){goog.asserts.assert(goog.math.isInt(t)&&t>=0);for(var o=goog.iter.toIterator(e);0<t--;)goog.iter.nextOrValue(o,null);return o},goog.iter.slice=function(e,t,o){return goog.asserts.assert(goog.math.isInt(t)&&t>=0),e=goog.iter.consume(e,t),goog.isNumber(o)&&(goog.asserts.assert(goog.math.isInt(o)&&o>=t),e=goog.iter.limit(e,o-t)),e},goog.iter.hasDuplicates_=function(e){var t=[];return goog.array.removeDuplicates(e,t),e.length!=t.length},goog.iter.permutations=function(e,t){var o=goog.iter.toArray(e),n=goog.isNumber(t)?t:o.length,o=goog.array.repeat(o,n),o=goog.iter.product.apply(void 0,o);return goog.iter.filter(o,function(e){return!goog.iter.hasDuplicates_(e)})},goog.iter.combinations=function(e,t){function o(e){return n[e]}var n=goog.iter.toArray(e),i=goog.iter.range(n.length),i=goog.iter.permutations(i,t),r=goog.iter.filter(i,function(e){return goog.array.isSorted(e)}),i=new goog.iter.Iterator;return i.next=function(){return goog.array.map(r.next(),o)},i},goog.iter.combinationsWithReplacement=function(e,t){function o(e){return n[e]}var n=goog.iter.toArray(e),i=goog.array.range(n.length),i=goog.array.repeat(i,t),i=goog.iter.product.apply(void 0,i),r=goog.iter.filter(i,function(e){return goog.array.isSorted(e)}),i=new goog.iter.Iterator;return i.next=function(){return goog.array.map(r.next(),o)},i},goog.dom.TagWalkType={START_TAG:1,OTHER:0,END_TAG:-1},goog.dom.TagIterator=function(e,t,o,n,i){this.reversed=!!t,e&&this.setPosition(e,n),this.depth=void 0!=i?i:this.tagType||0,this.reversed&&(this.depth*=-1),this.constrained=!o},goog.inherits(goog.dom.TagIterator,goog.iter.Iterator),goog.dom.TagIterator.prototype.node=null,goog.dom.TagIterator.prototype.tagType=goog.dom.TagWalkType.OTHER,goog.dom.TagIterator.prototype.started_=!1,goog.dom.TagIterator.prototype.setPosition=function(e,t,o){(this.node=e)&&(this.tagType=goog.isNumber(t)?t:this.node.nodeType!=goog.dom.NodeType.ELEMENT?goog.dom.TagWalkType.OTHER:this.reversed?goog.dom.TagWalkType.END_TAG:goog.dom.TagWalkType.START_TAG),goog.isNumber(o)&&(this.depth=o)},goog.dom.TagIterator.prototype.copyFrom=function(e){this.node=e.node,this.tagType=e.tagType,this.depth=e.depth,this.reversed=e.reversed,this.constrained=e.constrained},goog.dom.TagIterator.prototype.clone=function(){return new goog.dom.TagIterator(this.node,this.reversed,!this.constrained,this.tagType,this.depth)},goog.dom.TagIterator.prototype.skipTag=function(){var e=this.reversed?goog.dom.TagWalkType.END_TAG:goog.dom.TagWalkType.START_TAG;this.tagType==e&&(this.tagType=-1*e,this.depth+=this.tagType*(this.reversed?-1:1))},goog.dom.TagIterator.prototype.restartTag=function(){var e=this.reversed?goog.dom.TagWalkType.START_TAG:goog.dom.TagWalkType.END_TAG;this.tagType==e&&(this.tagType=-1*e,this.depth+=this.tagType*(this.reversed?-1:1))},goog.dom.TagIterator.prototype.next=function(){var e;if(this.started_){if(!this.node||this.constrained&&0==this.depth)throw goog.iter.StopIteration;e=this.node;var t=this.reversed?goog.dom.TagWalkType.END_TAG:goog.dom.TagWalkType.START_TAG;if(this.tagType==t){var o=this.reversed?e.lastChild:e.firstChild;o?this.setPosition(o):this.setPosition(e,-1*t)}else(o=this.reversed?e.previousSibling:e.nextSibling)?this.setPosition(o):this.setPosition(e.parentNode,-1*t);this.depth+=this.tagType*(this.reversed?-1:1)}else this.started_=!0;if(e=this.node,!this.node)throw goog.iter.StopIteration;return e},goog.dom.TagIterator.prototype.isStarted=function(){return this.started_},goog.dom.TagIterator.prototype.isStartTag=function(){return this.tagType==goog.dom.TagWalkType.START_TAG},goog.dom.TagIterator.prototype.isEndTag=function(){return this.tagType==goog.dom.TagWalkType.END_TAG},goog.dom.TagIterator.prototype.isNonElement=function(){return this.tagType==goog.dom.TagWalkType.OTHER},goog.dom.TagIterator.prototype.equals=function(e){return e.node==this.node&&(!this.node||e.tagType==this.tagType)},goog.dom.TagIterator.prototype.splice=function(){var e=this.node;this.restartTag(),this.reversed=!this.reversed,goog.dom.TagIterator.prototype.next.call(this),this.reversed=!this.reversed;for(var t=goog.isArrayLike(arguments[0])?arguments[0]:arguments,o=t.length-1;o>=0;o--)goog.dom.insertSiblingAfter(t[o],e);goog.dom.removeNode(e)},goog.dom.NodeIterator=function(e,t,o,n){goog.dom.TagIterator.call(this,e,t,o,null,n)},goog.inherits(goog.dom.NodeIterator,goog.dom.TagIterator),goog.dom.NodeIterator.prototype.next=function(){do goog.dom.NodeIterator.superClass_.next.call(this);while(this.isEndTag());return this.node},goog.ui.PaletteRenderer=function(){goog.ui.ControlRenderer.call(this)},goog.inherits(goog.ui.PaletteRenderer,goog.ui.ControlRenderer),goog.addSingletonGetter(goog.ui.PaletteRenderer),goog.ui.PaletteRenderer.cellId_=0,goog.ui.PaletteRenderer.CSS_CLASS="goog-palette",goog.ui.PaletteRenderer.prototype.createDom=function(e){var t=this.getClassNames(e);return e=e.getDomHelper().createDom(goog.dom.TagName.DIV,t?t.join(" "):null,this.createGrid(e.getContent(),e.getSize(),e.getDomHelper())),goog.a11y.aria.setRole(e,goog.a11y.aria.Role.GRID),e},goog.ui.PaletteRenderer.prototype.createGrid=function(e,t,o){for(var n=[],i=0,r=0;i<t.height;i++){for(var s=[],l=0;l<t.width;l++){var a=e&&e[r++];s.push(this.createCell(a,o))}n.push(this.createRow(s,o))}return this.createTable(n,o)},goog.ui.PaletteRenderer.prototype.createTable=function(e,t){var o=t.createDom(goog.dom.TagName.TABLE,this.getCssClass()+"-table",t.createDom(goog.dom.TagName.TBODY,this.getCssClass()+"-body",e));return o.cellSpacing=0,o.cellPadding=0,o},goog.ui.PaletteRenderer.prototype.createRow=function(e,t){var o=t.createDom(goog.dom.TagName.TR,this.getCssClass()+"-row",e);return goog.a11y.aria.setRole(o,goog.a11y.aria.Role.ROW),o},goog.ui.PaletteRenderer.prototype.createCell=function(e,t){var o=t.createDom(goog.dom.TagName.TD,{"class":this.getCssClass()+"-cell",id:this.getCssClass()+"-cell-"+goog.ui.PaletteRenderer.cellId_++},e);if(goog.a11y.aria.setRole(o,goog.a11y.aria.Role.GRIDCELL),!goog.dom.getTextContent(o)&&!goog.a11y.aria.getLabel(o)){var n=this.findAriaLabelForCell_(o);n&&goog.a11y.aria.setLabel(o,n)}return o},goog.ui.PaletteRenderer.prototype.findAriaLabelForCell_=function(e){e=new goog.dom.NodeIterator(e);for(var t,o="";!o&&(t=goog.iter.nextOrValue(e,null));)t.nodeType==goog.dom.NodeType.ELEMENT&&(o=goog.a11y.aria.getLabel(t)||t.title);return o},goog.ui.PaletteRenderer.prototype.canDecorate=function(){return!1},goog.ui.PaletteRenderer.prototype.decorate=function(){return null},goog.ui.PaletteRenderer.prototype.setContent=function(e,t){if(e){var o=goog.dom.getElementsByTagNameAndClass(goog.dom.TagName.TBODY,this.getCssClass()+"-body",e)[0];if(o){var n=0;if(goog.array.forEach(o.rows,function(e){goog.array.forEach(e.cells,function(e){if(goog.dom.removeChildren(e),t){var o=t[n++];o&&goog.dom.appendChild(e,o)}})}),n<t.length){for(var i=[],r=goog.dom.getDomHelper(e),s=o.rows[0].cells.length;n<t.length;){var l=t[n++];i.push(this.createCell(l,r)),i.length==s&&(l=this.createRow(i,r),goog.dom.appendChild(o,l),i.length=0)}if(0<i.length){for(;i.length<s;)i.push(this.createCell("",r));l=this.createRow(i,r),goog.dom.appendChild(o,l)}}}goog.style.setUnselectable(e,!0,goog.userAgent.GECKO)}},goog.ui.PaletteRenderer.prototype.getContainingItem=function(e,t){for(var o=e.getElement();t&&t.nodeType==goog.dom.NodeType.ELEMENT&&t!=o;){if(t.tagName==goog.dom.TagName.TD&&goog.dom.classlist.contains(t,this.getCssClass()+"-cell"))return t.firstChild;t=t.parentNode}return null},goog.ui.PaletteRenderer.prototype.highlightCell=function(e,t,o){t&&(t=this.getCellForItem(t),goog.dom.classlist.enable(t,this.getCssClass()+"-cell-hover",o),goog.a11y.aria.setState(e.getElementStrict(),goog.a11y.aria.State.ACTIVEDESCENDANT,t.id))},goog.ui.PaletteRenderer.prototype.getCellForItem=function(e){return e?e.parentNode:null},goog.ui.PaletteRenderer.prototype.selectCell=function(e,t,o){t&&goog.dom.classlist.enable(t.parentNode,this.getCssClass()+"-cell-selected",o)},goog.ui.PaletteRenderer.prototype.getCssClass=function(){return goog.ui.PaletteRenderer.CSS_CLASS},goog.ui.SelectionModel=function(e){goog.events.EventTarget.call(this),this.items_=[],this.addItems(e)},goog.inherits(goog.ui.SelectionModel,goog.events.EventTarget),goog.ui.SelectionModel.prototype.selectedItem_=null,goog.ui.SelectionModel.prototype.selectionHandler_=null,goog.ui.SelectionModel.prototype.getSelectionHandler=function(){return this.selectionHandler_},goog.ui.SelectionModel.prototype.setSelectionHandler=function(e){this.selectionHandler_=e},goog.ui.SelectionModel.prototype.getItemCount=function(){return this.items_.length},goog.ui.SelectionModel.prototype.indexOfItem=function(e){return e?goog.array.indexOf(this.items_,e):-1},goog.ui.SelectionModel.prototype.getFirst=function(){return this.items_[0]},goog.ui.SelectionModel.prototype.getLast=function(){return this.items_[this.items_.length-1]},goog.ui.SelectionModel.prototype.getItemAt=function(e){return this.items_[e]||null},goog.ui.SelectionModel.prototype.addItems=function(e){e&&(goog.array.forEach(e,function(e){this.selectItem_(e,!1)},this),goog.array.extend(this.items_,e))},goog.ui.SelectionModel.prototype.addItem=function(e){this.addItemAt(e,this.getItemCount())},goog.ui.SelectionModel.prototype.addItemAt=function(e,t){e&&(this.selectItem_(e,!1),goog.array.insertAt(this.items_,e,t))},goog.ui.SelectionModel.prototype.removeItem=function(e){e&&goog.array.remove(this.items_,e)&&e==this.selectedItem_&&(this.selectedItem_=null,this.dispatchEvent(goog.events.EventType.SELECT))},goog.ui.SelectionModel.prototype.removeItemAt=function(e){this.removeItem(this.getItemAt(e))},goog.ui.SelectionModel.prototype.getSelectedItem=function(){return this.selectedItem_},goog.ui.SelectionModel.prototype.getItems=function(){return goog.array.clone(this.items_)},goog.ui.SelectionModel.prototype.setSelectedItem=function(e){e!=this.selectedItem_&&(this.selectItem_(this.selectedItem_,!1),this.selectedItem_=e,this.selectItem_(e,!0)),this.dispatchEvent(goog.events.EventType.SELECT)},goog.ui.SelectionModel.prototype.getSelectedIndex=function(){return this.indexOfItem(this.selectedItem_)},goog.ui.SelectionModel.prototype.setSelectedIndex=function(e){this.setSelectedItem(this.getItemAt(e))},goog.ui.SelectionModel.prototype.clear=function(){goog.array.clear(this.items_),this.selectedItem_=null},goog.ui.SelectionModel.prototype.disposeInternal=function(){goog.ui.SelectionModel.superClass_.disposeInternal.call(this),delete this.items_,this.selectedItem_=null},goog.ui.SelectionModel.prototype.selectItem_=function(e,t){e&&("function"==typeof this.selectionHandler_?this.selectionHandler_(e,t):"function"==typeof e.setSelected&&e.setSelected(t))},goog.ui.Palette=function(e,t,o){goog.ui.Control.call(this,e,t||goog.ui.PaletteRenderer.getInstance(),o),this.setAutoStates(goog.ui.Component.State.CHECKED|goog.ui.Component.State.SELECTED|goog.ui.Component.State.OPENED,!1),this.currentCellControl_=new goog.ui.Palette.CurrentCell_,this.currentCellControl_.setParentEventTarget(this)},goog.inherits(goog.ui.Palette,goog.ui.Control),goog.ui.Palette.EventType={AFTER_HIGHLIGHT:goog.events.getUniqueId("afterhighlight")},goog.ui.Palette.prototype.size_=null,goog.ui.Palette.prototype.highlightedIndex_=-1,goog.ui.Palette.prototype.selectionModel_=null,goog.ui.Palette.prototype.disposeInternal=function(){goog.ui.Palette.superClass_.disposeInternal.call(this),this.selectionModel_&&(this.selectionModel_.dispose(),this.selectionModel_=null),this.size_=null,this.currentCellControl_.dispose()},goog.ui.Palette.prototype.setContentInternal=function(e){goog.ui.Palette.superClass_.setContentInternal.call(this,e),this.adjustSize_(),this.selectionModel_?(this.selectionModel_.clear(),this.selectionModel_.addItems(e)):(this.selectionModel_=new goog.ui.SelectionModel(e),this.selectionModel_.setSelectionHandler(goog.bind(this.selectItem_,this)),this.getHandler().listen(this.selectionModel_,goog.events.EventType.SELECT,this.handleSelectionChange)),this.highlightedIndex_=-1},goog.ui.Palette.prototype.getCaption=function(){return""},goog.ui.Palette.prototype.setCaption=function(){},goog.ui.Palette.prototype.handleMouseOver=function(e){goog.ui.Palette.superClass_.handleMouseOver.call(this,e);var t=this.getRenderer().getContainingItem(this,e.target);t&&e.relatedTarget&&goog.dom.contains(t,e.relatedTarget)||t!=this.getHighlightedItem()&&this.setHighlightedItem(t)},goog.ui.Palette.prototype.handleMouseOut=function(e){goog.ui.Palette.superClass_.handleMouseOut.call(this,e);var t=this.getRenderer().getContainingItem(this,e.target);t&&e.relatedTarget&&goog.dom.contains(t,e.relatedTarget)||t==this.getHighlightedItem()&&this.setHighlightedItem(null)},goog.ui.Palette.prototype.handleMouseDown=function(e){goog.ui.Palette.superClass_.handleMouseDown.call(this,e),this.isActive()&&(e=this.getRenderer().getContainingItem(this,e.target),e!=this.getHighlightedItem()&&this.setHighlightedItem(e))},goog.ui.Palette.prototype.performActionInternal=function(e){var t=this.getHighlightedItem();return t?(this.setSelectedItem(t),goog.ui.Palette.superClass_.performActionInternal.call(this,e)):!1},goog.ui.Palette.prototype.handleKeyEvent=function(e){var t=this.getContent(),t=t?t.length:0,o=this.size_.width;if(0==t||!this.isEnabled())return!1;if(e.keyCode==goog.events.KeyCodes.ENTER||e.keyCode==goog.events.KeyCodes.SPACE)return this.performActionInternal(e);if(e.keyCode==goog.events.KeyCodes.HOME)return this.setHighlightedIndex(0),!0;if(e.keyCode==goog.events.KeyCodes.END)return this.setHighlightedIndex(t-1),!0;var n=0>this.highlightedIndex_?this.getSelectedIndex():this.highlightedIndex_;switch(e.keyCode){case goog.events.KeyCodes.LEFT:return(-1==n||0==n)&&(n=t),this.setHighlightedIndex(n-1),e.preventDefault(),!0;case goog.events.KeyCodes.RIGHT:return n==t-1&&(n=-1),this.setHighlightedIndex(n+1),e.preventDefault(),!0;case goog.events.KeyCodes.UP:if(-1==n&&(n=t+o-1),n>=o)return this.setHighlightedIndex(n-o),e.preventDefault(),!0;break;case goog.events.KeyCodes.DOWN:if(-1==n&&(n=-o),t-o>n)return this.setHighlightedIndex(n+o),e.preventDefault(),!0}return!1},goog.ui.Palette.prototype.handleSelectionChange=function(){},goog.ui.Palette.prototype.getSize=function(){return this.size_},goog.ui.Palette.prototype.setSize=function(e,t){if(this.getElement())throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.size_=goog.isNumber(e)?new goog.math.Size(e,t):e,this.adjustSize_()},goog.ui.Palette.prototype.getHighlightedIndex=function(){return this.highlightedIndex_},goog.ui.Palette.prototype.getHighlightedItem=function(){var e=this.getContent();return e&&e[this.highlightedIndex_]},goog.ui.Palette.prototype.getHighlightedCellElement_=function(){return this.getRenderer().getCellForItem(this.getHighlightedItem())},goog.ui.Palette.prototype.setHighlightedIndex=function(e){e!=this.highlightedIndex_&&(this.highlightIndex_(this.highlightedIndex_,!1),this.highlightedIndex_=e,this.highlightIndex_(e,!0),this.dispatchEvent(goog.ui.Palette.EventType.AFTER_HIGHLIGHT))},goog.ui.Palette.prototype.setHighlightedItem=function(e){var t=this.getContent();this.setHighlightedIndex(t?goog.array.indexOf(t,e):-1)},goog.ui.Palette.prototype.getSelectedIndex=function(){return this.selectionModel_?this.selectionModel_.getSelectedIndex():-1},goog.ui.Palette.prototype.getSelectedItem=function(){return this.selectionModel_?this.selectionModel_.getSelectedItem():null},goog.ui.Palette.prototype.setSelectedIndex=function(e){this.selectionModel_&&this.selectionModel_.setSelectedIndex(e)},goog.ui.Palette.prototype.setSelectedItem=function(e){this.selectionModel_&&this.selectionModel_.setSelectedItem(e)},goog.ui.Palette.prototype.highlightIndex_=function(e,t){if(this.getElement()){var o=this.getContent();if(o&&e>=0&&e<o.length){var n=this.getHighlightedCellElement_();this.currentCellControl_.getElement()!=n&&this.currentCellControl_.setElementInternal(n),this.currentCellControl_.tryHighlight(t)&&this.getRenderer().highlightCell(this,o[e],t)}}},goog.ui.Palette.prototype.selectItem_=function(e,t){this.getElement()&&this.getRenderer().selectCell(this,e,t)},goog.ui.Palette.prototype.adjustSize_=function(){var e=this.getContent();e?this.size_&&this.size_.width?(e=Math.ceil(e.length/this.size_.width),(!goog.isNumber(this.size_.height)||this.size_.height<e)&&(this.size_.height=e)):(e=Math.ceil(Math.sqrt(e.length)),this.size_=new goog.math.Size(e,e)):this.size_=new goog.math.Size(0,0)},goog.ui.Palette.CurrentCell_=function(){goog.ui.Control.call(this,null),this.setDispatchTransitionEvents(goog.ui.Component.State.HOVER,!0)},goog.inherits(goog.ui.Palette.CurrentCell_,goog.ui.Control),goog.ui.Palette.CurrentCell_.prototype.tryHighlight=function(e){return this.setHighlighted(e),this.isHighlighted()==e},goog.ui.ColorPalette=function(e,t,o){this.colors_=e||[],goog.ui.Palette.call(this,null,t||goog.ui.PaletteRenderer.getInstance(),o),this.setColors(this.colors_)},goog.inherits(goog.ui.ColorPalette,goog.ui.Palette),goog.ui.ColorPalette.prototype.normalizedColors_=null,goog.ui.ColorPalette.prototype.labels_=null,goog.ui.ColorPalette.prototype.getColors=function(){return this.colors_},goog.ui.ColorPalette.prototype.setColors=function(e,t){this.colors_=e,this.labels_=t||null,this.normalizedColors_=null,this.setContent(this.createColorNodes())},goog.ui.ColorPalette.prototype.getSelectedColor=function(){var e=this.getSelectedItem();return e?(e=goog.style.getStyle(e,"background-color"),goog.ui.ColorPalette.parseColor_(e)):null},goog.ui.ColorPalette.prototype.setSelectedColor=function(e){e=goog.ui.ColorPalette.parseColor_(e),this.normalizedColors_||(this.normalizedColors_=goog.array.map(this.colors_,function(e){return goog.ui.ColorPalette.parseColor_(e)})),this.setSelectedIndex(e?goog.array.indexOf(this.normalizedColors_,e):-1)},goog.ui.ColorPalette.prototype.createColorNodes=function(){return goog.array.map(this.colors_,function(e,t){var o=this.getDomHelper().createDom("div",{"class":this.getRenderer().getCssClass()+"-colorswatch",style:"background-color:"+e});return o.title=this.labels_&&this.labels_[t]?this.labels_[t]:"#"==e.charAt(0)?"RGB ("+goog.color.hexToRgb(e).join(", ")+")":e,o},this)},goog.ui.ColorPalette.parseColor_=function(e){if(e)try{return goog.color.parse(e).hex}catch(t){}return null},goog.ui.ColorPicker=function(e,t){goog.ui.Component.call(this,e),this.colorPalette_=t||null,this.getHandler().listen(this,goog.ui.Component.EventType.ACTION,this.onColorPaletteAction_)},goog.inherits(goog.ui.ColorPicker,goog.ui.Component),goog.ui.ColorPicker.DEFAULT_NUM_COLS=5,goog.ui.ColorPicker.EventType={CHANGE:"change"},goog.ui.ColorPicker.prototype.focusable_=!0,goog.ui.ColorPicker.prototype.getColors=function(){return this.colorPalette_?this.colorPalette_.getColors():null},goog.ui.ColorPicker.prototype.setColors=function(e){this.colorPalette_?this.colorPalette_.setColors(e):this.createColorPalette_(e)},goog.ui.ColorPicker.prototype.addColors=function(e){this.setColors(e)},goog.ui.ColorPicker.prototype.setSize=function(e){this.colorPalette_||this.createColorPalette_([]),this.colorPalette_.setSize(e)},goog.ui.ColorPicker.prototype.getSize=function(){return this.colorPalette_?this.colorPalette_.getSize():null},goog.ui.ColorPicker.prototype.setColumnCount=function(e){this.setSize(e)},goog.ui.ColorPicker.prototype.getSelectedIndex=function(){return this.colorPalette_?this.colorPalette_.getSelectedIndex():-1},goog.ui.ColorPicker.prototype.setSelectedIndex=function(e){this.colorPalette_&&this.colorPalette_.setSelectedIndex(e)},goog.ui.ColorPicker.prototype.getSelectedColor=function(){return this.colorPalette_?this.colorPalette_.getSelectedColor():null},goog.ui.ColorPicker.prototype.setSelectedColor=function(e){this.colorPalette_&&this.colorPalette_.setSelectedColor(e)},goog.ui.ColorPicker.prototype.isFocusable=function(){return this.focusable_},goog.ui.ColorPicker.prototype.setFocusable=function(e){this.focusable_=e,this.colorPalette_&&this.colorPalette_.setSupportedState(goog.ui.Component.State.FOCUSED,e)},goog.ui.ColorPicker.prototype.canDecorate=function(){return!1},goog.ui.ColorPicker.prototype.enterDocument=function(){goog.ui.ColorPicker.superClass_.enterDocument.call(this),this.colorPalette_&&this.colorPalette_.render(this.getElement()),this.getElement().unselectable="on"},goog.ui.ColorPicker.prototype.disposeInternal=function(){goog.ui.ColorPicker.superClass_.disposeInternal.call(this),this.colorPalette_&&(this.colorPalette_.dispose(),this.colorPalette_=null)},goog.ui.ColorPicker.prototype.focus=function(){this.colorPalette_&&this.colorPalette_.getElement().focus()},goog.ui.ColorPicker.prototype.onColorPaletteAction_=function(e){e.stopPropagation(),this.dispatchEvent(goog.ui.ColorPicker.EventType.CHANGE)},goog.ui.ColorPicker.prototype.createColorPalette_=function(e){e=new goog.ui.ColorPalette(e,null,this.getDomHelper()),e.setSize(goog.ui.ColorPicker.DEFAULT_NUM_COLS),e.setSupportedState(goog.ui.Component.State.FOCUSED,this.focusable_),this.addChild(e),this.colorPalette_=e,this.isInDocument()&&this.colorPalette_.render(this.getElement())},goog.ui.ColorPicker.createSimpleColorGrid=function(e){return e=new goog.ui.ColorPicker(e),e.setSize(7),e.setColors(goog.ui.ColorPicker.SIMPLE_GRID_COLORS),e},goog.ui.ColorPicker.SIMPLE_GRID_COLORS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "),goog.events.FocusHandler=function(e){goog.events.EventTarget.call(this),this.element_=e,e=goog.userAgent.IE?"focusout":"blur",this.listenKeyIn_=goog.events.listen(this.element_,goog.userAgent.IE?"focusin":"focus",this,!goog.userAgent.IE),this.listenKeyOut_=goog.events.listen(this.element_,e,this,!goog.userAgent.IE)},goog.inherits(goog.events.FocusHandler,goog.events.EventTarget),goog.events.FocusHandler.EventType={FOCUSIN:"focusin",FOCUSOUT:"focusout"},goog.events.FocusHandler.prototype.handleEvent=function(e){var t=e.getBrowserEvent(),t=new goog.events.BrowserEvent(t);t.type="focusin"==e.type||"focus"==e.type?goog.events.FocusHandler.EventType.FOCUSIN:goog.events.FocusHandler.EventType.FOCUSOUT,this.dispatchEvent(t)},goog.events.FocusHandler.prototype.disposeInternal=function(){goog.events.FocusHandler.superClass_.disposeInternal.call(this),goog.events.unlistenByKey(this.listenKeyIn_),goog.events.unlistenByKey(this.listenKeyOut_),delete this.element_},goog.structs={},goog.structs.getCount=function(e){return"function"==typeof e.getCount?e.getCount():goog.isArrayLike(e)||goog.isString(e)?e.length:goog.object.getCount(e)},goog.structs.getValues=function(e){if("function"==typeof e.getValues)return e.getValues();if(goog.isString(e))return e.split("");if(goog.isArrayLike(e)){for(var t=[],o=e.length,n=0;o>n;n++)t.push(e[n]);return t}return goog.object.getValues(e)},goog.structs.getKeys=function(e){if("function"==typeof e.getKeys)return e.getKeys();if("function"!=typeof e.getValues){if(goog.isArrayLike(e)||goog.isString(e)){var t=[];e=e.length;for(var o=0;e>o;o++)t.push(o);return t}return goog.object.getKeys(e)}},goog.structs.contains=function(e,t){return"function"==typeof e.contains?e.contains(t):"function"==typeof e.containsValue?e.containsValue(t):goog.isArrayLike(e)||goog.isString(e)?goog.array.contains(e,t):goog.object.containsValue(e,t)},goog.structs.isEmpty=function(e){return"function"==typeof e.isEmpty?e.isEmpty():goog.isArrayLike(e)||goog.isString(e)?goog.array.isEmpty(e):goog.object.isEmpty(e)},goog.structs.clear=function(e){"function"==typeof e.clear?e.clear():goog.isArrayLike(e)?goog.array.clear(e):goog.object.clear(e)},goog.structs.forEach=function(e,t,o){if("function"==typeof e.forEach)e.forEach(t,o);else if(goog.isArrayLike(e)||goog.isString(e))goog.array.forEach(e,t,o);else for(var n=goog.structs.getKeys(e),i=goog.structs.getValues(e),r=i.length,s=0;r>s;s++)t.call(o,i[s],n&&n[s],e)},goog.structs.filter=function(e,t,o){if("function"==typeof e.filter)return e.filter(t,o);if(goog.isArrayLike(e)||goog.isString(e))return goog.array.filter(e,t,o);var n,i=goog.structs.getKeys(e),r=goog.structs.getValues(e),s=r.length;if(i){n={};for(var l=0;s>l;l++)t.call(o,r[l],i[l],e)&&(n[i[l]]=r[l])}else for(n=[],l=0;s>l;l++)t.call(o,r[l],void 0,e)&&n.push(r[l]);return n},goog.structs.map=function(e,t,o){if("function"==typeof e.map)return e.map(t,o);if(goog.isArrayLike(e)||goog.isString(e))return goog.array.map(e,t,o);var n,i=goog.structs.getKeys(e),r=goog.structs.getValues(e),s=r.length;if(i){n={};for(var l=0;s>l;l++)n[i[l]]=t.call(o,r[l],i[l],e)}else for(n=[],l=0;s>l;l++)n[l]=t.call(o,r[l],void 0,e);return n},goog.structs.some=function(e,t,o){if("function"==typeof e.some)return e.some(t,o);if(goog.isArrayLike(e)||goog.isString(e))return goog.array.some(e,t,o);for(var n=goog.structs.getKeys(e),i=goog.structs.getValues(e),r=i.length,s=0;r>s;s++)if(t.call(o,i[s],n&&n[s],e))return!0;
23
- return!1},goog.structs.every=function(e,t,o){if("function"==typeof e.every)return e.every(t,o);if(goog.isArrayLike(e)||goog.isString(e))return goog.array.every(e,t,o);for(var n=goog.structs.getKeys(e),i=goog.structs.getValues(e),r=i.length,s=0;r>s;s++)if(!t.call(o,i[s],n&&n[s],e))return!1;return!0},goog.structs.Collection=function(){},goog.structs.Map=function(e){this.map_={},this.keys_=[],this.version_=this.count_=0;var t=arguments.length;if(t>1){if(t%2)throw Error("Uneven number of arguments");for(var o=0;t>o;o+=2)this.set(arguments[o],arguments[o+1])}else e&&this.addAll(e)},goog.structs.Map.prototype.getCount=function(){return this.count_},goog.structs.Map.prototype.getValues=function(){this.cleanupKeysArray_();for(var e=[],t=0;t<this.keys_.length;t++)e.push(this.map_[this.keys_[t]]);return e},goog.structs.Map.prototype.getKeys=function(){return this.cleanupKeysArray_(),this.keys_.concat()},goog.structs.Map.prototype.containsKey=function(e){return goog.structs.Map.hasKey_(this.map_,e)},goog.structs.Map.prototype.containsValue=function(e){for(var t=0;t<this.keys_.length;t++){var o=this.keys_[t];if(goog.structs.Map.hasKey_(this.map_,o)&&this.map_[o]==e)return!0}return!1},goog.structs.Map.prototype.equals=function(e,t){if(this===e)return!0;if(this.count_!=e.getCount())return!1;var o=t||goog.structs.Map.defaultEquals;this.cleanupKeysArray_();for(var n,i=0;n=this.keys_[i];i++)if(!o(this.get(n),e.get(n)))return!1;return!0},goog.structs.Map.defaultEquals=function(e,t){return e===t},goog.structs.Map.prototype.isEmpty=function(){return 0==this.count_},goog.structs.Map.prototype.clear=function(){this.map_={},this.version_=this.count_=this.keys_.length=0},goog.structs.Map.prototype.remove=function(e){return goog.structs.Map.hasKey_(this.map_,e)?(delete this.map_[e],this.count_--,this.version_++,this.keys_.length>2*this.count_&&this.cleanupKeysArray_(),!0):!1},goog.structs.Map.prototype.cleanupKeysArray_=function(){if(this.count_!=this.keys_.length){for(var e=0,t=0;e<this.keys_.length;){var o=this.keys_[e];goog.structs.Map.hasKey_(this.map_,o)&&(this.keys_[t++]=o),e++}this.keys_.length=t}if(this.count_!=this.keys_.length){for(var n={},t=e=0;e<this.keys_.length;)o=this.keys_[e],goog.structs.Map.hasKey_(n,o)||(this.keys_[t++]=o,n[o]=1),e++;this.keys_.length=t}},goog.structs.Map.prototype.get=function(e,t){return goog.structs.Map.hasKey_(this.map_,e)?this.map_[e]:t},goog.structs.Map.prototype.set=function(e,t){goog.structs.Map.hasKey_(this.map_,e)||(this.count_++,this.keys_.push(e),this.version_++),this.map_[e]=t},goog.structs.Map.prototype.addAll=function(e){var t;e instanceof goog.structs.Map?(t=e.getKeys(),e=e.getValues()):(t=goog.object.getKeys(e),e=goog.object.getValues(e));for(var o=0;o<t.length;o++)this.set(t[o],e[o])},goog.structs.Map.prototype.clone=function(){return new goog.structs.Map(this)},goog.structs.Map.prototype.transpose=function(){for(var e=new goog.structs.Map,t=0;t<this.keys_.length;t++){var o=this.keys_[t];e.set(this.map_[o],o)}return e},goog.structs.Map.prototype.toObject=function(){this.cleanupKeysArray_();for(var e={},t=0;t<this.keys_.length;t++){var o=this.keys_[t];e[o]=this.map_[o]}return e},goog.structs.Map.prototype.getKeyIterator=function(){return this.__iterator__(!0)},goog.structs.Map.prototype.getValueIterator=function(){return this.__iterator__(!1)},goog.structs.Map.prototype.__iterator__=function(e){this.cleanupKeysArray_();var t=0,o=this.keys_,n=this.map_,i=this.version_,r=this,s=new goog.iter.Iterator;return s.next=function(){for(;;){if(i!=r.version_)throw Error("The map has changed since the iterator was created");if(t>=o.length)throw goog.iter.StopIteration;var s=o[t++];return e?s:n[s]}},s},goog.structs.Map.hasKey_=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},goog.structs.Set=function(e){this.map_=new goog.structs.Map,e&&this.addAll(e)},goog.structs.Set.getKey_=function(e){var t=typeof e;return"object"==t&&e||"function"==t?"o"+goog.getUid(e):t.substr(0,1)+e},goog.structs.Set.prototype.getCount=function(){return this.map_.getCount()},goog.structs.Set.prototype.add=function(e){this.map_.set(goog.structs.Set.getKey_(e),e)},goog.structs.Set.prototype.addAll=function(e){e=goog.structs.getValues(e);for(var t=e.length,o=0;t>o;o++)this.add(e[o])},goog.structs.Set.prototype.removeAll=function(e){e=goog.structs.getValues(e);for(var t=e.length,o=0;t>o;o++)this.remove(e[o])},goog.structs.Set.prototype.remove=function(e){return this.map_.remove(goog.structs.Set.getKey_(e))},goog.structs.Set.prototype.clear=function(){this.map_.clear()},goog.structs.Set.prototype.isEmpty=function(){return this.map_.isEmpty()},goog.structs.Set.prototype.contains=function(e){return this.map_.containsKey(goog.structs.Set.getKey_(e))},goog.structs.Set.prototype.containsAll=function(e){return goog.structs.every(e,this.contains,this)},goog.structs.Set.prototype.intersection=function(e){var t=new goog.structs.Set;e=goog.structs.getValues(e);for(var o=0;o<e.length;o++){var n=e[o];this.contains(n)&&t.add(n)}return t},goog.structs.Set.prototype.difference=function(e){var t=this.clone();return t.removeAll(e),t},goog.structs.Set.prototype.getValues=function(){return this.map_.getValues()},goog.structs.Set.prototype.clone=function(){return new goog.structs.Set(this)},goog.structs.Set.prototype.equals=function(e){return this.getCount()==goog.structs.getCount(e)&&this.isSubsetOf(e)},goog.structs.Set.prototype.isSubsetOf=function(e){var t=goog.structs.getCount(e);return this.getCount()>t?!1:(!(e instanceof goog.structs.Set)&&t>5&&(e=new goog.structs.Set(e)),goog.structs.every(this,function(t){return goog.structs.contains(e,t)}))},goog.structs.Set.prototype.__iterator__=function(){return this.map_.__iterator__(!1)},goog.debug.LOGGING_ENABLED=goog.DEBUG,goog.debug.catchErrors=function(e,t,o){o=o||goog.global;var n=o.onerror,i=!!t;goog.userAgent.WEBKIT&&!goog.userAgent.isVersionOrHigher("535.3")&&(i=!i),o.onerror=function(t,o,r,s,l){return n&&n(t,o,r,s,l),e({message:t,fileName:o,line:r,col:s,error:l}),i}},goog.debug.expose=function(e,t){if("undefined"==typeof e)return"undefined";if(null==e)return"NULL";var o,n=[];for(o in e)if(t||!goog.isFunction(e[o])){var i=o+" = ";try{i+=e[o]}catch(r){i+="*** "+r+" ***"}n.push(i)}return n.join("\n")},goog.debug.deepExpose=function(e,t){var o=new goog.structs.Set,n=[],i=function(e,r){var s=r+" ";try{if(goog.isDef(e))if(goog.isNull(e))n.push("NULL");else if(goog.isString(e))n.push('"'+e.replace(/\n/g,"\n"+r)+'"');else if(goog.isFunction(e))n.push(String(e).replace(/\n/g,"\n"+r));else if(goog.isObject(e))if(o.contains(e))n.push("*** reference loop detected ***");else{o.add(e),n.push("{");for(var l in e)(t||!goog.isFunction(e[l]))&&(n.push("\n"),n.push(s),n.push(l+" = "),i(e[l],s));n.push("\n"+r+"}")}else n.push(e);else n.push("undefined")}catch(a){n.push("*** "+a+" ***")}};return i(e,""),n.join("")},goog.debug.exposeArray=function(e){for(var t=[],o=0;o<e.length;o++)goog.isArray(e[o])?t.push(goog.debug.exposeArray(e[o])):t.push(e[o]);return"[ "+t.join(", ")+" ]"},goog.debug.exposeException=function(e,t){try{var o=goog.debug.normalizeErrorObject(e);return"Message: "+goog.string.htmlEscape(o.message)+'\nUrl: <a href="view-source:'+o.fileName+'" target="_new">'+o.fileName+"</a>\nLine: "+o.lineNumber+"\n\nBrowser stack:\n"+goog.string.htmlEscape(o.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+goog.string.htmlEscape(goog.debug.getStacktrace(t)+"-> ")}catch(n){return"Exception trying to expose exception! You win, we lose. "+n}},goog.debug.normalizeErrorObject=function(e){var t=goog.getObjectByName("window.location.href");if(goog.isString(e))return{message:e,name:"Unknown error",lineNumber:"Not available",fileName:t,stack:"Not available"};var o,n,i=!1;try{o=e.lineNumber||e.line||"Not available"}catch(r){o="Not available",i=!0}try{n=e.fileName||e.filename||e.sourceURL||goog.global.$googDebugFname||t}catch(s){n="Not available",i=!0}return!i&&e.lineNumber&&e.fileName&&e.stack&&e.message&&e.name?e:{message:e.message||"Not available",name:e.name||"UnknownError",lineNumber:o,fileName:n,stack:e.stack||"Not available"}},goog.debug.enhanceError=function(e,t){var o="string"==typeof e?Error(e):e;if(o.stack||(o.stack=goog.debug.getStacktrace(arguments.callee.caller)),t){for(var n=0;o["message"+n];)++n;o["message"+n]=String(t)}return o},goog.debug.getStacktraceSimple=function(e){for(var t=[],o=arguments.callee.caller,n=0;o&&(!e||e>n);){t.push(goog.debug.getFunctionName(o)),t.push("()\n");try{o=o.caller}catch(i){t.push("[exception trying to get caller]\n");break}if(n++,n>=goog.debug.MAX_STACK_DEPTH){t.push("[...long stack...]");break}}return e&&n>=e?t.push("[...reached max depth limit...]"):t.push("[end]"),t.join("")},goog.debug.MAX_STACK_DEPTH=50,goog.debug.getStacktrace=function(e){return goog.debug.getStacktraceHelper_(e||arguments.callee.caller,[])},goog.debug.getStacktraceHelper_=function(e,t){var o=[];if(goog.array.contains(t,e))o.push("[...circular reference...]");else if(e&&t.length<goog.debug.MAX_STACK_DEPTH){o.push(goog.debug.getFunctionName(e)+"(");for(var n=e.arguments,i=0;i<n.length;i++){i>0&&o.push(", ");var r;switch(r=n[i],typeof r){case"object":r=r?"object":"null";break;case"string":break;case"number":r=String(r);break;case"boolean":r=r?"true":"false";break;case"function":r=(r=goog.debug.getFunctionName(r))?r:"[fn]";break;default:r=typeof r}40<r.length&&(r=r.substr(0,40)+"..."),o.push(r)}t.push(e),o.push(")\n");try{o.push(goog.debug.getStacktraceHelper_(e.caller,t))}catch(s){o.push("[exception trying to get caller]\n")}}else e?o.push("[...long stack...]"):o.push("[end]");return o.join("")},goog.debug.setFunctionResolver=function(e){goog.debug.fnNameResolver_=e},goog.debug.getFunctionName=function(e){if(goog.debug.fnNameCache_[e])return goog.debug.fnNameCache_[e];if(goog.debug.fnNameResolver_){var t=goog.debug.fnNameResolver_(e);if(t)return goog.debug.fnNameCache_[e]=t}return e=String(e),goog.debug.fnNameCache_[e]||(t=/function ([^\(]+)/.exec(e),goog.debug.fnNameCache_[e]=t?t[1]:"[Anonymous]"),goog.debug.fnNameCache_[e]},goog.debug.makeWhitespaceVisible=function(e){return e.replace(/ /g,"[_]").replace(/\f/g,"[f]").replace(/\n/g,"[n]\n").replace(/\r/g,"[r]").replace(/\t/g,"[t]")},goog.debug.fnNameCache_={},goog.debug.LogRecord=function(e,t,o,n,i){this.reset(e,t,o,n,i)},goog.debug.LogRecord.prototype.sequenceNumber_=0,goog.debug.LogRecord.prototype.exception_=null,goog.debug.LogRecord.prototype.exceptionText_=null,goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS=!0,goog.debug.LogRecord.nextSequenceNumber_=0,goog.debug.LogRecord.prototype.reset=function(e,t,o,n,i){goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS&&(this.sequenceNumber_="number"==typeof i?i:goog.debug.LogRecord.nextSequenceNumber_++),this.time_=n||goog.now(),this.level_=e,this.msg_=t,this.loggerName_=o,delete this.exception_,delete this.exceptionText_},goog.debug.LogRecord.prototype.getLoggerName=function(){return this.loggerName_},goog.debug.LogRecord.prototype.getException=function(){return this.exception_},goog.debug.LogRecord.prototype.setException=function(e){this.exception_=e},goog.debug.LogRecord.prototype.getExceptionText=function(){return this.exceptionText_},goog.debug.LogRecord.prototype.setExceptionText=function(e){this.exceptionText_=e},goog.debug.LogRecord.prototype.setLoggerName=function(e){this.loggerName_=e},goog.debug.LogRecord.prototype.getLevel=function(){return this.level_},goog.debug.LogRecord.prototype.setLevel=function(e){this.level_=e},goog.debug.LogRecord.prototype.getMessage=function(){return this.msg_},goog.debug.LogRecord.prototype.setMessage=function(e){this.msg_=e},goog.debug.LogRecord.prototype.getMillis=function(){return this.time_},goog.debug.LogRecord.prototype.setMillis=function(e){this.time_=e},goog.debug.LogRecord.prototype.getSequenceNumber=function(){return this.sequenceNumber_},goog.debug.LogBuffer=function(){goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(),"Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY."),this.clear()},goog.debug.LogBuffer.getInstance=function(){return goog.debug.LogBuffer.instance_||(goog.debug.LogBuffer.instance_=new goog.debug.LogBuffer),goog.debug.LogBuffer.instance_},goog.debug.LogBuffer.CAPACITY=0,goog.debug.LogBuffer.prototype.addRecord=function(e,t,o){var n=(this.curIndex_+1)%goog.debug.LogBuffer.CAPACITY;return this.curIndex_=n,this.isFull_?(n=this.buffer_[n],n.reset(e,t,o),n):(this.isFull_=n==goog.debug.LogBuffer.CAPACITY-1,this.buffer_[n]=new goog.debug.LogRecord(e,t,o))},goog.debug.LogBuffer.isBufferingEnabled=function(){return 0<goog.debug.LogBuffer.CAPACITY},goog.debug.LogBuffer.prototype.clear=function(){this.buffer_=Array(goog.debug.LogBuffer.CAPACITY),this.curIndex_=-1,this.isFull_=!1},goog.debug.LogBuffer.prototype.forEachRecord=function(e){var t=this.buffer_;if(t[0]){var o=this.curIndex_,n=this.isFull_?o:-1;do n=(n+1)%goog.debug.LogBuffer.CAPACITY,e(t[n]);while(n!=o)}},goog.debug.Logger=function(e){this.name_=e},goog.debug.Logger.prototype.parent_=null,goog.debug.Logger.prototype.level_=null,goog.debug.Logger.prototype.children_=null,goog.debug.Logger.prototype.handlers_=null,goog.debug.Logger.ENABLE_HIERARCHY=!0,goog.debug.Logger.ENABLE_HIERARCHY||(goog.debug.Logger.rootHandlers_=[]),goog.debug.Logger.Level=function(e,t){this.name=e,this.value=t},goog.debug.Logger.Level.prototype.toString=function(){return this.name},goog.debug.Logger.Level.OFF=new goog.debug.Logger.Level("OFF",1/0),goog.debug.Logger.Level.SHOUT=new goog.debug.Logger.Level("SHOUT",1200),goog.debug.Logger.Level.SEVERE=new goog.debug.Logger.Level("SEVERE",1e3),goog.debug.Logger.Level.WARNING=new goog.debug.Logger.Level("WARNING",900),goog.debug.Logger.Level.INFO=new goog.debug.Logger.Level("INFO",800),goog.debug.Logger.Level.CONFIG=new goog.debug.Logger.Level("CONFIG",700),goog.debug.Logger.Level.FINE=new goog.debug.Logger.Level("FINE",500),goog.debug.Logger.Level.FINER=new goog.debug.Logger.Level("FINER",400),goog.debug.Logger.Level.FINEST=new goog.debug.Logger.Level("FINEST",300),goog.debug.Logger.Level.ALL=new goog.debug.Logger.Level("ALL",0),goog.debug.Logger.Level.PREDEFINED_LEVELS=[goog.debug.Logger.Level.OFF,goog.debug.Logger.Level.SHOUT,goog.debug.Logger.Level.SEVERE,goog.debug.Logger.Level.WARNING,goog.debug.Logger.Level.INFO,goog.debug.Logger.Level.CONFIG,goog.debug.Logger.Level.FINE,goog.debug.Logger.Level.FINER,goog.debug.Logger.Level.FINEST,goog.debug.Logger.Level.ALL],goog.debug.Logger.Level.predefinedLevelsCache_=null,goog.debug.Logger.Level.createPredefinedLevelsCache_=function(){goog.debug.Logger.Level.predefinedLevelsCache_={};for(var e,t=0;e=goog.debug.Logger.Level.PREDEFINED_LEVELS[t];t++)goog.debug.Logger.Level.predefinedLevelsCache_[e.value]=e,goog.debug.Logger.Level.predefinedLevelsCache_[e.name]=e},goog.debug.Logger.Level.getPredefinedLevel=function(e){return goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_(),goog.debug.Logger.Level.predefinedLevelsCache_[e]||null},goog.debug.Logger.Level.getPredefinedLevelByValue=function(e){if(goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_(),e in goog.debug.Logger.Level.predefinedLevelsCache_)return goog.debug.Logger.Level.predefinedLevelsCache_[e];for(var t=0;t<goog.debug.Logger.Level.PREDEFINED_LEVELS.length;++t){var o=goog.debug.Logger.Level.PREDEFINED_LEVELS[t];if(o.value<=e)return o}return null},goog.debug.Logger.getLogger=function(e){return goog.debug.LogManager.getLogger(e)},goog.debug.Logger.logToProfilers=function(e){goog.global.console&&(goog.global.console.timeStamp?goog.global.console.timeStamp(e):goog.global.console.markTimeline&&goog.global.console.markTimeline(e)),goog.global.msWriteProfilerMark&&goog.global.msWriteProfilerMark(e)},goog.debug.Logger.prototype.getName=function(){return this.name_},goog.debug.Logger.prototype.addHandler=function(e){goog.debug.LOGGING_ENABLED&&(goog.debug.Logger.ENABLE_HIERARCHY?(this.handlers_||(this.handlers_=[]),this.handlers_.push(e)):(goog.asserts.assert(!this.name_,"Cannot call addHandler on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),goog.debug.Logger.rootHandlers_.push(e)))},goog.debug.Logger.prototype.removeHandler=function(e){if(goog.debug.LOGGING_ENABLED){var t=goog.debug.Logger.ENABLE_HIERARCHY?this.handlers_:goog.debug.Logger.rootHandlers_;return!!t&&goog.array.remove(t,e)}return!1},goog.debug.Logger.prototype.getParent=function(){return this.parent_},goog.debug.Logger.prototype.getChildren=function(){return this.children_||(this.children_={}),this.children_},goog.debug.Logger.prototype.setLevel=function(e){goog.debug.LOGGING_ENABLED&&(goog.debug.Logger.ENABLE_HIERARCHY?this.level_=e:(goog.asserts.assert(!this.name_,"Cannot call setLevel() on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),goog.debug.Logger.rootLevel_=e))},goog.debug.Logger.prototype.getLevel=function(){return goog.debug.LOGGING_ENABLED?this.level_:goog.debug.Logger.Level.OFF},goog.debug.Logger.prototype.getEffectiveLevel=function(){return goog.debug.LOGGING_ENABLED?goog.debug.Logger.ENABLE_HIERARCHY?this.level_?this.level_:this.parent_?this.parent_.getEffectiveLevel():(goog.asserts.fail("Root logger has no level set."),null):goog.debug.Logger.rootLevel_:goog.debug.Logger.Level.OFF},goog.debug.Logger.prototype.isLoggable=function(e){return goog.debug.LOGGING_ENABLED&&e.value>=this.getEffectiveLevel().value},goog.debug.Logger.prototype.log=function(e,t,o){goog.debug.LOGGING_ENABLED&&this.isLoggable(e)&&this.doLogRecord_(this.getLogRecord(e,t,o))},goog.debug.Logger.prototype.getLogRecord=function(e,t,o){var n=goog.debug.LogBuffer.isBufferingEnabled()?goog.debug.LogBuffer.getInstance().addRecord(e,t,this.name_):new goog.debug.LogRecord(e,String(t),this.name_);return o&&(n.setException(o),n.setExceptionText(goog.debug.exposeException(o,arguments.callee.caller))),n},goog.debug.Logger.prototype.shout=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.SHOUT,e,t)},goog.debug.Logger.prototype.severe=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.SEVERE,e,t)},goog.debug.Logger.prototype.warning=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.WARNING,e,t)},goog.debug.Logger.prototype.info=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.INFO,e,t)},goog.debug.Logger.prototype.config=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.CONFIG,e,t)},goog.debug.Logger.prototype.fine=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINE,e,t)},goog.debug.Logger.prototype.finer=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINER,e,t)},goog.debug.Logger.prototype.finest=function(e,t){goog.debug.LOGGING_ENABLED&&this.log(goog.debug.Logger.Level.FINEST,e,t)},goog.debug.Logger.prototype.logRecord=function(e){goog.debug.LOGGING_ENABLED&&this.isLoggable(e.getLevel())&&this.doLogRecord_(e)},goog.debug.Logger.prototype.doLogRecord_=function(e){if(goog.debug.Logger.logToProfilers("log:"+e.getMessage()),goog.debug.Logger.ENABLE_HIERARCHY)for(var t=this;t;)t.callPublish_(e),t=t.getParent();else for(var o,t=0;o=goog.debug.Logger.rootHandlers_[t++];)o(e)},goog.debug.Logger.prototype.callPublish_=function(e){if(this.handlers_)for(var t,o=0;t=this.handlers_[o];o++)t(e)},goog.debug.Logger.prototype.setParent_=function(e){this.parent_=e},goog.debug.Logger.prototype.addChild_=function(e,t){this.getChildren()[e]=t},goog.debug.LogManager={},goog.debug.LogManager.loggers_={},goog.debug.LogManager.rootLogger_=null,goog.debug.LogManager.initialize=function(){goog.debug.LogManager.rootLogger_||(goog.debug.LogManager.rootLogger_=new goog.debug.Logger(""),goog.debug.LogManager.loggers_[""]=goog.debug.LogManager.rootLogger_,goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG))},goog.debug.LogManager.getLoggers=function(){return goog.debug.LogManager.loggers_},goog.debug.LogManager.getRoot=function(){return goog.debug.LogManager.initialize(),goog.debug.LogManager.rootLogger_},goog.debug.LogManager.getLogger=function(e){return goog.debug.LogManager.initialize(),goog.debug.LogManager.loggers_[e]||goog.debug.LogManager.createLogger_(e)},goog.debug.LogManager.createFunctionForCatchErrors=function(e){return function(t){(e||goog.debug.LogManager.getRoot()).severe("Error: "+t.message+" ("+t.fileName+" @ Line: "+t.line+")")}},goog.debug.LogManager.createLogger_=function(e){var t=new goog.debug.Logger(e);if(goog.debug.Logger.ENABLE_HIERARCHY){var o=e.lastIndexOf("."),n=e.substr(0,o),o=e.substr(o+1),n=goog.debug.LogManager.getLogger(n);n.addChild_(o,t),t.setParent_(n)}return goog.debug.LogManager.loggers_[e]=t},goog.log={},goog.log.ENABLED=goog.debug.LOGGING_ENABLED,goog.log.Logger=goog.debug.Logger,goog.log.Level=goog.debug.Logger.Level,goog.log.LogRecord=goog.debug.LogRecord,goog.log.getLogger=function(e,t){if(goog.log.ENABLED){var o=goog.debug.Logger.getLogger(e);return t&&o&&o.setLevel(t),o}return null},goog.log.addHandler=function(e,t){goog.log.ENABLED&&e&&e.addHandler(t)},goog.log.removeHandler=function(e,t){return goog.log.ENABLED&&e?e.removeHandler(t):!1},goog.log.log=function(e,t,o,n){goog.log.ENABLED&&e&&e.log(t,o,n)},goog.log.error=function(e,t,o){goog.log.ENABLED&&e&&e.severe(t,o)},goog.log.warning=function(e,t,o){goog.log.ENABLED&&e&&e.warning(t,o)},goog.log.info=function(e,t,o){goog.log.ENABLED&&e&&e.info(t,o)},goog.log.fine=function(e,t,o){goog.log.ENABLED&&e&&e.fine(t,o)},goog.string.StringBuffer=function(e){null!=e&&this.append.apply(this,arguments)},goog.string.StringBuffer.prototype.buffer_="",goog.string.StringBuffer.prototype.set=function(e){this.buffer_=""+e},goog.string.StringBuffer.prototype.append=function(e,t){if(this.buffer_+=e,null!=t)for(var o=1;o<arguments.length;o++)this.buffer_+=arguments[o];return this},goog.string.StringBuffer.prototype.clear=function(){this.buffer_=""},goog.string.StringBuffer.prototype.getLength=function(){return this.buffer_.length},goog.string.StringBuffer.prototype.toString=function(){return this.buffer_},goog.ui.tree={},goog.ui.tree.BaseNode=function(e,t,o){goog.ui.Component.call(this,o),this.config_=t||goog.ui.tree.TreeControl.defaultConfig,this.html_=e},goog.inherits(goog.ui.tree.BaseNode,goog.ui.Component),goog.ui.tree.BaseNode.EventType={BEFORE_EXPAND:"beforeexpand",EXPAND:"expand",BEFORE_COLLAPSE:"beforecollapse",COLLAPSE:"collapse"},goog.ui.tree.BaseNode.allNodes={},goog.ui.tree.BaseNode.prototype.selected_=!1,goog.ui.tree.BaseNode.prototype.expanded_=!1,goog.ui.tree.BaseNode.prototype.toolTip_=null,goog.ui.tree.BaseNode.prototype.afterLabelHtml_="",goog.ui.tree.BaseNode.prototype.isUserCollapsible_=!0,goog.ui.tree.BaseNode.prototype.depth_=-1,goog.ui.tree.BaseNode.prototype.disposeInternal=function(){goog.ui.tree.BaseNode.superClass_.disposeInternal.call(this),this.tree_&&(this.tree_.removeNode(this),this.tree_=null),this.setElementInternal(null)},goog.ui.tree.BaseNode.prototype.initAccessibility=function(){var e=this.getElement();if(e){var t=this.getLabelElement();if(t&&!t.id&&(t.id=this.getId()+".label"),goog.a11y.aria.setRole(e,"treeitem"),goog.a11y.aria.setState(e,"selected",!1),goog.a11y.aria.setState(e,"expanded",!1),goog.a11y.aria.setState(e,"level",this.getDepth()),t&&goog.a11y.aria.setState(e,"labelledby",t.id),(e=this.getIconElement())&&goog.a11y.aria.setRole(e,"presentation"),(e=this.getExpandIconElement())&&goog.a11y.aria.setRole(e,"presentation"),(e=this.getChildrenElement())&&(goog.a11y.aria.setRole(e,"group"),e.hasChildNodes()))for(e=this.getChildCount(),t=1;e>=t;t++){var o=this.getChildAt(t-1).getElement();goog.asserts.assert(o,"The child element cannot be null"),goog.a11y.aria.setState(o,"setsize",e),goog.a11y.aria.setState(o,"posinset",t)}}},goog.ui.tree.BaseNode.prototype.createDom=function(){var e=new goog.string.StringBuffer;this.toHtml(e),e=this.getDomHelper().htmlToDocumentFragment(e.toString()),this.setElementInternal(e)},goog.ui.tree.BaseNode.prototype.enterDocument=function(){goog.ui.tree.BaseNode.superClass_.enterDocument.call(this),goog.ui.tree.BaseNode.allNodes[this.getId()]=this,this.initAccessibility()},goog.ui.tree.BaseNode.prototype.exitDocument=function(){goog.ui.tree.BaseNode.superClass_.exitDocument.call(this),delete goog.ui.tree.BaseNode.allNodes[this.getId()]},goog.ui.tree.BaseNode.prototype.addChildAt=function(e,t,o){goog.asserts.assert(!e.getParent()),o=this.getChildAt(t-1);var n=this.getChildAt(t);if(goog.ui.tree.BaseNode.superClass_.addChildAt.call(this,e,t),e.previousSibling_=o,e.nextSibling_=n,o?o.nextSibling_=e:this.firstChild_=e,n?n.previousSibling_=e:this.lastChild_=e,(t=this.getTree())&&e.setTreeInternal(t),e.setDepth_(this.getDepth()+1),this.getElement()&&(this.updateExpandIcon(),this.getExpanded())){t=this.getChildrenElement(),e.getElement()||e.createDom();var i=e.getElement(),r=n&&n.getElement();t.insertBefore(i,r),this.isInDocument()&&e.enterDocument(),n||(o?o.updateExpandIcon():(goog.style.setElementShown(t,!0),this.setExpanded(this.getExpanded())))}},goog.ui.tree.BaseNode.prototype.add=function(e,t){return goog.asserts.assert(!t||t.getParent()==this,"Can only add nodes before siblings"),e.getParent()&&e.getParent().removeChild(e),this.addChildAt(e,t?this.indexOfChild(t):this.getChildCount()),e},goog.ui.tree.BaseNode.prototype.removeChild=function(e){var t=this.getTree(),o=t?t.getSelectedItem():null;if((o==e||e.contains(o))&&(t.hasFocus()?(this.select(),goog.Timer.callOnce(this.onTimeoutSelect_,10,this)):this.select()),goog.ui.tree.BaseNode.superClass_.removeChild.call(this,e),this.lastChild_==e&&(this.lastChild_=e.previousSibling_),this.firstChild_==e&&(this.firstChild_=e.nextSibling_),e.previousSibling_&&(e.previousSibling_.nextSibling_=e.nextSibling_),e.nextSibling_&&(e.nextSibling_.previousSibling_=e.previousSibling_),o=e.isLastSibling(),e.tree_=null,e.depth_=-1,t&&(t.removeNode(this),this.isInDocument())){if(t=this.getChildrenElement(),e.isInDocument()){var n=e.getElement();t.removeChild(n),e.exitDocument()}o&&(o=this.getLastChild())&&o.updateExpandIcon(),this.hasChildren()||(t.style.display="none",this.updateExpandIcon(),this.updateIcon_())}return e},goog.ui.tree.BaseNode.prototype.remove=goog.ui.tree.BaseNode.prototype.removeChild,goog.ui.tree.BaseNode.prototype.onTimeoutSelect_=function(){this.select()},goog.ui.tree.BaseNode.prototype.getDepth=function(){var e=this.depth_;return 0>e&&(e=this.computeDepth_(),this.setDepth_(e)),e},goog.ui.tree.BaseNode.prototype.computeDepth_=function(){var e=this.getParent();return e?e.getDepth()+1:0},goog.ui.tree.BaseNode.prototype.setDepth_=function(e){if(e!=this.depth_){this.depth_=e;var t=this.getRowElement();if(t){var o=this.getPixelIndent_()+"px";this.isRightToLeft()?t.style.paddingRight=o:t.style.paddingLeft=o}this.forEachChild(function(t){t.setDepth_(e+1)})}},goog.ui.tree.BaseNode.prototype.contains=function(e){for(;e;){if(e==this)return!0;e=e.getParent()}return!1},goog.ui.tree.BaseNode.EMPTY_CHILDREN_=[],goog.ui.tree.BaseNode.prototype.getChildren=function(){var e=[];return this.forEachChild(function(t){e.push(t)}),e},goog.ui.tree.BaseNode.prototype.getFirstChild=function(){return this.getChildAt(0)},goog.ui.tree.BaseNode.prototype.getLastChild=function(){return this.getChildAt(this.getChildCount()-1)},goog.ui.tree.BaseNode.prototype.getPreviousSibling=function(){return this.previousSibling_},goog.ui.tree.BaseNode.prototype.getNextSibling=function(){return this.nextSibling_},goog.ui.tree.BaseNode.prototype.isLastSibling=function(){return!this.nextSibling_},goog.ui.tree.BaseNode.prototype.isSelected=function(){return this.selected_},goog.ui.tree.BaseNode.prototype.select=function(){var e=this.getTree();e&&e.setSelectedItem(this)},goog.ui.tree.BaseNode.prototype.deselect=goog.nullFunction,goog.ui.tree.BaseNode.prototype.setSelectedInternal=function(e){if(this.selected_!=e){this.selected_=e,this.updateRow();var t=this.getElement();t&&(goog.a11y.aria.setState(t,"selected",e),e&&(e=this.getTree().getElement(),goog.asserts.assert(e,"The DOM element for the tree cannot be null"),goog.a11y.aria.setState(e,"activedescendant",this.getId())))}},goog.ui.tree.BaseNode.prototype.getExpanded=function(){return this.expanded_},goog.ui.tree.BaseNode.prototype.setExpandedInternal=function(e){this.expanded_=e},goog.ui.tree.BaseNode.prototype.setExpanded=function(e){var t=e!=this.expanded_;if(!t||this.dispatchEvent(e?goog.ui.tree.BaseNode.EventType.BEFORE_EXPAND:goog.ui.tree.BaseNode.EventType.BEFORE_COLLAPSE)){var o;this.expanded_=e,o=this.getTree();var n=this.getElement();if(this.hasChildren()){if(!e&&o&&this.contains(o.getSelectedItem())&&this.select(),n){if((o=this.getChildrenElement())&&(goog.style.setElementShown(o,e),e&&this.isInDocument()&&!o.hasChildNodes())){var i=new goog.string.StringBuffer;this.forEachChild(function(e){e.toHtml(i)}),o.innerHTML=i.toString(),this.forEachChild(function(e){e.enterDocument()})}this.updateExpandIcon()}}else(o=this.getChildrenElement())&&goog.style.setElementShown(o,!1);n&&(this.updateIcon_(),goog.a11y.aria.setState(n,"expanded",e)),t&&this.dispatchEvent(e?goog.ui.tree.BaseNode.EventType.EXPAND:goog.ui.tree.BaseNode.EventType.COLLAPSE)}},goog.ui.tree.BaseNode.prototype.toggle=function(){this.setExpanded(!this.getExpanded())},goog.ui.tree.BaseNode.prototype.expand=function(){this.setExpanded(!0)},goog.ui.tree.BaseNode.prototype.collapse=function(){this.setExpanded(!1)},goog.ui.tree.BaseNode.prototype.collapseChildren=function(){this.forEachChild(function(e){e.collapseAll()})},goog.ui.tree.BaseNode.prototype.collapseAll=function(){this.collapseChildren(),this.collapse()},goog.ui.tree.BaseNode.prototype.expandChildren=function(){this.forEachChild(function(e){e.expandAll()})},goog.ui.tree.BaseNode.prototype.expandAll=function(){this.expandChildren(),this.expand()},goog.ui.tree.BaseNode.prototype.reveal=function(){var e=this.getParent();e&&(e.setExpanded(!0),e.reveal())},goog.ui.tree.BaseNode.prototype.setIsUserCollapsible=function(e){(this.isUserCollapsible_=e)||this.expand(),this.getElement()&&this.updateExpandIcon()},goog.ui.tree.BaseNode.prototype.isUserCollapsible=function(){return this.isUserCollapsible_},goog.ui.tree.BaseNode.prototype.toHtml=function(e){var t=this.getTree(),t=!t.getShowLines()||t==this.getParent()&&!t.getShowRootLines()?this.config_.cssChildrenNoLines:this.config_.cssChildren,o=this.getExpanded()&&this.hasChildren();e.append('<div class="',this.config_.cssItem,'" id="',this.getId(),'">',this.getRowHtml(),'<div class="',t,'" style="',this.getLineStyle(),o?"":"display:none;",'">'),o&&this.forEachChild(function(t){t.toHtml(e)}),e.append("</div></div>")},goog.ui.tree.BaseNode.prototype.getPixelIndent_=function(){return Math.max(0,(this.getDepth()-1)*this.config_.indentWidth)},goog.ui.tree.BaseNode.prototype.getRowHtml=function(){var e=new goog.string.StringBuffer;return e.append('<div class="',this.getRowClassName(),'" style="padding-',this.isRightToLeft()?"right:":"left:",this.getPixelIndent_(),'px">',this.getExpandIconHtml(),this.getIconHtml(),this.getLabelHtml(),"</div>"),e.toString()},goog.ui.tree.BaseNode.prototype.getRowClassName=function(){var e;return e=this.isSelected()?" "+this.config_.cssSelectedRow:"",this.config_.cssTreeRow+e},goog.ui.tree.BaseNode.prototype.getLabelHtml=function(){var e=this.getToolTip(),t=new goog.string.StringBuffer;return t.append('<span class="',this.config_.cssItemLabel,'"',e?' title="'+goog.string.htmlEscape(e)+'"':"",">",this.getHtml(),"</span>","<span>",this.getAfterLabelHtml(),"</span>"),t.toString()},goog.ui.tree.BaseNode.prototype.getAfterLabelHtml=function(){return this.afterLabelHtml_},goog.ui.tree.BaseNode.prototype.setAfterLabelHtml=function(e){this.afterLabelHtml_=e;var t=this.getAfterLabelElement();t&&(t.innerHTML=e)},goog.ui.tree.BaseNode.prototype.getIconHtml=function(){return'<span style="display:inline-block" class="'+this.getCalculatedIconClass()+'"></span>'},goog.ui.tree.BaseNode.prototype.getExpandIconHtml=function(){return'<span type="expand" style="display:inline-block" class="'+this.getExpandIconClass()+'"></span>'},goog.ui.tree.BaseNode.prototype.getExpandIconClass=function(){var e=this.getTree(),t=!e.getShowLines()||e==this.getParent()&&!e.getShowRootLines(),o=this.config_,n=new goog.string.StringBuffer;if(n.append(o.cssTreeIcon," ",o.cssExpandTreeIcon," "),this.hasChildren()){var i=0;switch(e.getShowExpandIcons()&&this.isUserCollapsible_&&(i=this.getExpanded()?2:1),t||(i=this.isLastSibling()?i+4:i+8),i){case 1:n.append(o.cssExpandTreeIconPlus);break;case 2:n.append(o.cssExpandTreeIconMinus);break;case 4:n.append(o.cssExpandTreeIconL);break;case 5:n.append(o.cssExpandTreeIconLPlus);break;case 6:n.append(o.cssExpandTreeIconLMinus);
24
- break;case 8:n.append(o.cssExpandTreeIconT);break;case 9:n.append(o.cssExpandTreeIconTPlus);break;case 10:n.append(o.cssExpandTreeIconTMinus);break;default:n.append(o.cssExpandTreeIconBlank)}}else t?n.append(o.cssExpandTreeIconBlank):this.isLastSibling()?n.append(o.cssExpandTreeIconL):n.append(o.cssExpandTreeIconT);return n.toString()},goog.ui.tree.BaseNode.prototype.getLineStyle=function(){return"background-position:"+this.getLineStyle2()+";"},goog.ui.tree.BaseNode.prototype.getLineStyle2=function(){return(this.isLastSibling()?"-100":(this.getDepth()-1)*this.config_.indentWidth)+"px 0"},goog.ui.tree.BaseNode.prototype.getElement=function(){var e=goog.ui.tree.BaseNode.superClass_.getElement.call(this);return e||(e=this.getDomHelper().getElement(this.getId()),this.setElementInternal(e)),e},goog.ui.tree.BaseNode.prototype.getRowElement=function(){var e=this.getElement();return e?e.firstChild:null},goog.ui.tree.BaseNode.prototype.getExpandIconElement=function(){var e=this.getRowElement();return e?e.firstChild:null},goog.ui.tree.BaseNode.prototype.getIconElement=function(){var e=this.getRowElement();return e?e.childNodes[1]:null},goog.ui.tree.BaseNode.prototype.getLabelElement=function(){var e=this.getRowElement();return e&&e.lastChild?e.lastChild.previousSibling:null},goog.ui.tree.BaseNode.prototype.getAfterLabelElement=function(){var e=this.getRowElement();return e?e.lastChild:null},goog.ui.tree.BaseNode.prototype.getChildrenElement=function(){var e=this.getElement();return e?e.lastChild:null},goog.ui.tree.BaseNode.prototype.setIconClass=function(e){this.iconClass_=e,this.isInDocument()&&this.updateIcon_()},goog.ui.tree.BaseNode.prototype.getIconClass=function(){return this.iconClass_},goog.ui.tree.BaseNode.prototype.setExpandedIconClass=function(e){this.expandedIconClass_=e,this.isInDocument()&&this.updateIcon_()},goog.ui.tree.BaseNode.prototype.getExpandedIconClass=function(){return this.expandedIconClass_},goog.ui.tree.BaseNode.prototype.setText=function(e){this.setHtml(goog.string.htmlEscape(e))},goog.ui.tree.BaseNode.prototype.getText=function(){return goog.string.unescapeEntities(this.getHtml())},goog.ui.tree.BaseNode.prototype.setHtml=function(e){this.html_=e;var t=this.getLabelElement();t&&(t.innerHTML=e),(e=this.getTree())&&e.setNode(this)},goog.ui.tree.BaseNode.prototype.getHtml=function(){return this.html_},goog.ui.tree.BaseNode.prototype.setToolTip=function(e){this.toolTip_=e;var t=this.getLabelElement();t&&(t.title=e)},goog.ui.tree.BaseNode.prototype.getToolTip=function(){return this.toolTip_},goog.ui.tree.BaseNode.prototype.updateRow=function(){var e=this.getRowElement();e&&(e.className=this.getRowClassName())},goog.ui.tree.BaseNode.prototype.updateExpandIcon=function(){var e=this.getExpandIconElement();e&&(e.className=this.getExpandIconClass()),(e=this.getChildrenElement())&&(e.style.backgroundPosition=this.getLineStyle2())},goog.ui.tree.BaseNode.prototype.updateIcon_=function(){this.getIconElement().className=this.getCalculatedIconClass()},goog.ui.tree.BaseNode.prototype.onMouseDown=function(e){"expand"==e.target.getAttribute("type")&&this.hasChildren()?this.isUserCollapsible_&&this.toggle():(this.select(),this.updateRow())},goog.ui.tree.BaseNode.prototype.onClick_=goog.events.Event.preventDefault,goog.ui.tree.BaseNode.prototype.onDoubleClick_=function(e){"expand"==e.target.getAttribute("type")&&this.hasChildren()||this.isUserCollapsible_&&this.toggle()},goog.ui.tree.BaseNode.prototype.onKeyDown=function(e){var t=!0;switch(e.keyCode){case goog.events.KeyCodes.RIGHT:if(e.altKey)break;this.hasChildren()&&(this.getExpanded()?this.getFirstChild().select():this.setExpanded(!0));break;case goog.events.KeyCodes.LEFT:if(e.altKey)break;if(this.hasChildren()&&this.getExpanded()&&this.isUserCollapsible_)this.setExpanded(!1);else{var o=this.getParent(),n=this.getTree();o&&(n.getShowRootNode()||o!=n)&&o.select()}break;case goog.events.KeyCodes.DOWN:(o=this.getNextShownNode())&&o.select();break;case goog.events.KeyCodes.UP:(o=this.getPreviousShownNode())&&o.select();break;default:t=!1}return t&&(e.preventDefault(),(n=this.getTree())&&n.clearTypeAhead()),t},goog.ui.tree.BaseNode.prototype.onKeyPress_=function(e){!e.altKey&&e.keyCode>=goog.events.KeyCodes.LEFT&&e.keyCode<=goog.events.KeyCodes.DOWN&&e.preventDefault()},goog.ui.tree.BaseNode.prototype.getLastShownDescendant=function(){return this.getExpanded()&&this.hasChildren()?this.getLastChild().getLastShownDescendant():this},goog.ui.tree.BaseNode.prototype.getNextShownNode=function(){if(this.hasChildren()&&this.getExpanded())return this.getFirstChild();for(var e,t=this;t!=this.getTree();){if(e=t.getNextSibling(),null!=e)return e;t=t.getParent()}return null},goog.ui.tree.BaseNode.prototype.getPreviousShownNode=function(){var e=this.getPreviousSibling();if(null!=e)return e.getLastShownDescendant();var e=this.getParent(),t=this.getTree();return t.getShowRootNode()||e!=t?e:null},goog.ui.tree.BaseNode.prototype.getClientData=goog.ui.tree.BaseNode.prototype.getModel,goog.ui.tree.BaseNode.prototype.setClientData=goog.ui.tree.BaseNode.prototype.setModel,goog.ui.tree.BaseNode.prototype.getConfig=function(){return this.config_},goog.ui.tree.BaseNode.prototype.setTreeInternal=function(e){this.tree_!=e&&(this.tree_=e,e.setNode(this),this.forEachChild(function(t){t.setTreeInternal(e)}))},goog.ui.tree.TreeNode=function(e,t,o){goog.ui.tree.BaseNode.call(this,e,t,o)},goog.inherits(goog.ui.tree.TreeNode,goog.ui.tree.BaseNode),goog.ui.tree.TreeNode.prototype.tree_=null,goog.ui.tree.TreeNode.prototype.getTree=function(){if(this.tree_)return this.tree_;var e=this.getParent();return e&&(e=e.getTree())?(this.setTreeInternal(e),e):null},goog.ui.tree.TreeNode.prototype.getCalculatedIconClass=function(){var e=this.getExpanded();if(e&&this.expandedIconClass_)return this.expandedIconClass_;if(!e&&this.iconClass_)return this.iconClass_;var t=this.getConfig();if(this.hasChildren()){if(e&&t.cssExpandedFolderIcon)return t.cssTreeIcon+" "+t.cssExpandedFolderIcon;if(!e&&t.cssCollapsedFolderIcon)return t.cssTreeIcon+" "+t.cssCollapsedFolderIcon}else if(t.cssFileIcon)return t.cssTreeIcon+" "+t.cssFileIcon;return""},goog.structs.Trie=function(e){this.value_=void 0,this.childNodes_={},e&&this.setAll(e)},goog.structs.Trie.prototype.set=function(e,t){this.setOrAdd_(e,t,!1)},goog.structs.Trie.prototype.add=function(e,t){this.setOrAdd_(e,t,!0)},goog.structs.Trie.prototype.setOrAdd_=function(e,t,o){for(var n=this,i=0;i<e.length;i++){var r=e.charAt(i);n.childNodes_[r]||(n.childNodes_[r]=new goog.structs.Trie),n=n.childNodes_[r]}if(o&&void 0!==n.value_)throw Error('The collection already contains the key "'+e+'"');n.value_=t},goog.structs.Trie.prototype.setAll=function(e){var t=goog.structs.getKeys(e);e=goog.structs.getValues(e);for(var o=0;o<t.length;o++)this.set(t[o],e[o])},goog.structs.Trie.prototype.get=function(e){for(var t=this,o=0;o<e.length;o++){var n=e.charAt(o);if(!t.childNodes_[n])return;t=t.childNodes_[n]}return t.value_},goog.structs.Trie.prototype.getKeyAndPrefixes=function(e,t){var o=this,n={},i=t||0;for(void 0!==o.value_&&(n[i]=o.value_);i<e.length;i++){var r=e.charAt(i);if(!(r in o.childNodes_))break;o=o.childNodes_[r],void 0!==o.value_&&(n[i]=o.value_)}return n},goog.structs.Trie.prototype.getValues=function(){var e=[];return this.getValuesInternal_(e),e},goog.structs.Trie.prototype.getValuesInternal_=function(e){void 0!==this.value_&&e.push(this.value_);for(var t in this.childNodes_)this.childNodes_[t].getValuesInternal_(e)},goog.structs.Trie.prototype.getKeys=function(e){var t=[];if(e){for(var o=this,n=0;n<e.length;n++){var i=e.charAt(n);if(!o.childNodes_[i])return[];o=o.childNodes_[i]}o.getKeysInternal_(e,t)}else this.getKeysInternal_("",t);return t},goog.structs.Trie.prototype.getKeysInternal_=function(e,t){void 0!==this.value_&&t.push(e);for(var o in this.childNodes_)this.childNodes_[o].getKeysInternal_(e+o,t)},goog.structs.Trie.prototype.containsKey=function(e){return void 0!==this.get(e)},goog.structs.Trie.prototype.containsValue=function(e){if(this.value_===e)return!0;for(var t in this.childNodes_)if(this.childNodes_[t].containsValue(e))return!0;return!1},goog.structs.Trie.prototype.clear=function(){this.childNodes_={},this.value_=void 0},goog.structs.Trie.prototype.remove=function(e){for(var t=this,o=[],n=0;n<e.length;n++){var i=e.charAt(n);if(!t.childNodes_[i])throw Error('The collection does not have the key "'+e+'"');o.push([t,i]),t=t.childNodes_[i]}for(e=t.value_,delete t.value_;0<o.length&&(i=o.pop(),t=i[0],i=i[1],goog.object.isEmpty(t.childNodes_[i].childNodes_));)delete t.childNodes_[i];return e},goog.structs.Trie.prototype.clone=function(){return new goog.structs.Trie(this)},goog.structs.Trie.prototype.getCount=function(){return goog.structs.getCount(this.getValues())},goog.structs.Trie.prototype.isEmpty=function(){return void 0===this.value_&&goog.structs.isEmpty(this.childNodes_)},goog.ui.tree.TypeAhead=function(){this.nodeMap_=new goog.structs.Trie},goog.ui.tree.TypeAhead.prototype.buffer_="",goog.ui.tree.TypeAhead.prototype.matchingLabels_=null,goog.ui.tree.TypeAhead.prototype.matchingNodes_=null,goog.ui.tree.TypeAhead.prototype.matchingLabelIndex_=0,goog.ui.tree.TypeAhead.prototype.matchingNodeIndex_=0,goog.ui.tree.TypeAhead.Offset={DOWN:1,UP:-1},goog.ui.tree.TypeAhead.prototype.handleNavigation=function(e){var t=!1;switch(e.keyCode){case goog.events.KeyCodes.DOWN:case goog.events.KeyCodes.UP:e.ctrlKey&&(this.jumpTo_(e.keyCode==goog.events.KeyCodes.DOWN?goog.ui.tree.TypeAhead.Offset.DOWN:goog.ui.tree.TypeAhead.Offset.UP),t=!0);break;case goog.events.KeyCodes.BACKSPACE:e=this.buffer_.length-1,t=!0,e>0?(this.buffer_=this.buffer_.substring(0,e),this.jumpToLabel_(this.buffer_)):0==e?this.buffer_="":t=!1;break;case goog.events.KeyCodes.ESC:this.buffer_="",t=!0}return t},goog.ui.tree.TypeAhead.prototype.handleTypeAheadChar=function(e){var t=!1;return e.ctrlKey||e.altKey||(e=String.fromCharCode(e.charCode||e.keyCode).toLowerCase(),goog.string.isUnicodeChar(e)&&(" "!=e||this.buffer_)&&(this.buffer_+=e,t=this.jumpToLabel_(this.buffer_))),t},goog.ui.tree.TypeAhead.prototype.setNodeInMap=function(e){var t=e.getText();if(t&&!goog.string.isEmptySafe(t)){var t=t.toLowerCase(),o=this.nodeMap_.get(t);o?o.push(e):this.nodeMap_.set(t,[e])}},goog.ui.tree.TypeAhead.prototype.removeNodeFromMap=function(e){var t=e.getText();if(t&&!goog.string.isEmptySafe(t)){var t=t.toLowerCase(),o=this.nodeMap_.get(t);o&&(goog.array.remove(o,e),o.length&&this.nodeMap_.remove(t))}},goog.ui.tree.TypeAhead.prototype.jumpToLabel_=function(e){var t=!1;return(e=this.nodeMap_.getKeys(e))&&e.length&&(this.matchingLabelIndex_=this.matchingNodeIndex_=0,t=this.nodeMap_.get(e[0]),t=this.selectMatchingNode_(t))&&(this.matchingLabels_=e),t},goog.ui.tree.TypeAhead.prototype.jumpTo_=function(e){var t=!1,o=this.matchingLabels_;if(o){var t=null,n=!1;if(this.matchingNodes_){var i=this.matchingNodeIndex_+e;i>=0&&i<this.matchingNodes_.length?(this.matchingNodeIndex_=i,t=this.matchingNodes_):n=!0}t||(i=this.matchingLabelIndex_+e,i>=0&&i<o.length&&(this.matchingLabelIndex_=i),o.length>this.matchingLabelIndex_&&(t=this.nodeMap_.get(o[this.matchingLabelIndex_])),t&&t.length&&n&&(this.matchingNodeIndex_=e==goog.ui.tree.TypeAhead.Offset.UP?t.length-1:0)),(t=this.selectMatchingNode_(t))&&(this.matchingLabels_=o)}return t},goog.ui.tree.TypeAhead.prototype.selectMatchingNode_=function(e){var t;return e&&(this.matchingNodeIndex_<e.length&&(t=e[this.matchingNodeIndex_],this.matchingNodes_=e),t&&(t.reveal(),t.select())),!!t},goog.ui.tree.TypeAhead.prototype.clear=function(){this.buffer_=""},goog.ui.tree.TreeControl=function(e,t,o){if(goog.ui.tree.BaseNode.call(this,e,t,o),this.setExpandedInternal(!0),this.setSelectedInternal(!0),this.selectedItem_=this,this.typeAhead_=new goog.ui.tree.TypeAhead,goog.userAgent.IE)try{document.execCommand("BackgroundImageCache",!1,!0)}catch(n){goog.log.warning(this.logger_,"Failed to enable background image cache")}},goog.inherits(goog.ui.tree.TreeControl,goog.ui.tree.BaseNode),goog.ui.tree.TreeControl.prototype.keyHandler_=null,goog.ui.tree.TreeControl.prototype.focusHandler_=null,goog.ui.tree.TreeControl.prototype.logger_=goog.log.getLogger("goog.ui.tree.TreeControl"),goog.ui.tree.TreeControl.prototype.focused_=!1,goog.ui.tree.TreeControl.prototype.focusedNode_=null,goog.ui.tree.TreeControl.prototype.showLines_=!0,goog.ui.tree.TreeControl.prototype.showExpandIcons_=!0,goog.ui.tree.TreeControl.prototype.showRootNode_=!0,goog.ui.tree.TreeControl.prototype.showRootLines_=!0,goog.ui.tree.TreeControl.prototype.getTree=function(){return this},goog.ui.tree.TreeControl.prototype.getDepth=function(){return 0},goog.ui.tree.TreeControl.prototype.reveal=function(){},goog.ui.tree.TreeControl.prototype.handleFocus_=function(){this.focused_=!0,goog.dom.classlist.add(this.getElement(),"focused"),this.selectedItem_&&this.selectedItem_.select()},goog.ui.tree.TreeControl.prototype.handleBlur_=function(){this.focused_=!1,goog.dom.classlist.remove(this.getElement(),"focused")},goog.ui.tree.TreeControl.prototype.hasFocus=function(){return this.focused_},goog.ui.tree.TreeControl.prototype.getExpanded=function(){return!this.showRootNode_||goog.ui.tree.TreeControl.superClass_.getExpanded.call(this)},goog.ui.tree.TreeControl.prototype.setExpanded=function(e){this.showRootNode_?goog.ui.tree.TreeControl.superClass_.setExpanded.call(this,e):this.setExpandedInternal(e)},goog.ui.tree.TreeControl.prototype.getExpandIconHtml=function(){return""},goog.ui.tree.TreeControl.prototype.getIconElement=function(){var e=this.getRowElement();return e?e.firstChild:null},goog.ui.tree.TreeControl.prototype.getExpandIconElement=function(){return null},goog.ui.tree.TreeControl.prototype.updateExpandIcon=function(){},goog.ui.tree.TreeControl.prototype.getRowClassName=function(){return goog.ui.tree.TreeControl.superClass_.getRowClassName.call(this)+(this.showRootNode_?"":" "+this.getConfig().cssHideRoot)},goog.ui.tree.TreeControl.prototype.getCalculatedIconClass=function(){var e=this.getExpanded();if(e&&this.expandedIconClass_)return this.expandedIconClass_;if(!e&&this.iconClass_)return this.iconClass_;var t=this.getConfig();return e&&t.cssExpandedRootIcon?t.cssTreeIcon+" "+t.cssExpandedRootIcon:!e&&t.cssCollapsedRootIcon?t.cssTreeIcon+" "+t.cssCollapsedRootIcon:""},goog.ui.tree.TreeControl.prototype.setSelectedItem=function(e){if(this.selectedItem_!=e){var t=!1;this.selectedItem_&&(t=this.selectedItem_==this.focusedNode_,this.selectedItem_.setSelectedInternal(!1)),(this.selectedItem_=e)&&(e.setSelectedInternal(!0),t&&e.select()),this.dispatchEvent(goog.events.EventType.CHANGE)}},goog.ui.tree.TreeControl.prototype.getSelectedItem=function(){return this.selectedItem_},goog.ui.tree.TreeControl.prototype.setShowLines=function(e){this.showLines_!=e&&(this.showLines_=e,this.isInDocument()&&this.updateLinesAndExpandIcons_())},goog.ui.tree.TreeControl.prototype.getShowLines=function(){return this.showLines_},goog.ui.tree.TreeControl.prototype.updateLinesAndExpandIcons_=function(){function e(i){var r=i.getChildrenElement();if(r){var s=!o||t==i.getParent()&&!n?i.getConfig().cssChildrenNoLines:i.getConfig().cssChildren;r.className=s,(r=i.getExpandIconElement())&&(r.className=i.getExpandIconClass())}i.forEachChild(e)}var t=this,o=t.getShowLines(),n=t.getShowRootLines();e(this)},goog.ui.tree.TreeControl.prototype.setShowRootLines=function(e){this.showRootLines_!=e&&(this.showRootLines_=e,this.isInDocument()&&this.updateLinesAndExpandIcons_())},goog.ui.tree.TreeControl.prototype.getShowRootLines=function(){return this.showRootLines_},goog.ui.tree.TreeControl.prototype.setShowExpandIcons=function(e){this.showExpandIcons_!=e&&(this.showExpandIcons_=e,this.isInDocument()&&this.updateLinesAndExpandIcons_())},goog.ui.tree.TreeControl.prototype.getShowExpandIcons=function(){return this.showExpandIcons_},goog.ui.tree.TreeControl.prototype.setShowRootNode=function(e){if(this.showRootNode_!=e){if(this.showRootNode_=e,this.isInDocument()){var t=this.getRowElement();t&&(t.className=this.getRowClassName())}!e&&this.getSelectedItem()==this&&this.getFirstChild()&&this.setSelectedItem(this.getFirstChild())}},goog.ui.tree.TreeControl.prototype.getShowRootNode=function(){return this.showRootNode_},goog.ui.tree.TreeControl.prototype.initAccessibility=function(){goog.ui.tree.TreeControl.superClass_.initAccessibility.call(this);var e=this.getElement();goog.asserts.assert(e,"The DOM element for the tree cannot be null."),goog.a11y.aria.setRole(e,"tree"),goog.a11y.aria.setState(e,"labelledby",this.getLabelElement().id)},goog.ui.tree.TreeControl.prototype.enterDocument=function(){goog.ui.tree.TreeControl.superClass_.enterDocument.call(this);var e=this.getElement();e.className=this.getConfig().cssRoot,e.setAttribute("hideFocus","true"),this.attachEvents_(),this.initAccessibility()},goog.ui.tree.TreeControl.prototype.exitDocument=function(){goog.ui.tree.TreeControl.superClass_.exitDocument.call(this),this.detachEvents_()},goog.ui.tree.TreeControl.prototype.attachEvents_=function(){var e=this.getElement();e.tabIndex=0;var t=this.keyHandler_=new goog.events.KeyHandler(e),o=this.focusHandler_=new goog.events.FocusHandler(e);this.getHandler().listen(o,goog.events.FocusHandler.EventType.FOCUSOUT,this.handleBlur_).listen(o,goog.events.FocusHandler.EventType.FOCUSIN,this.handleFocus_).listen(t,goog.events.KeyHandler.EventType.KEY,this.handleKeyEvent).listen(e,goog.events.EventType.MOUSEDOWN,this.handleMouseEvent_).listen(e,goog.events.EventType.CLICK,this.handleMouseEvent_).listen(e,goog.events.EventType.DBLCLICK,this.handleMouseEvent_)},goog.ui.tree.TreeControl.prototype.detachEvents_=function(){this.keyHandler_.dispose(),this.keyHandler_=null,this.focusHandler_.dispose(),this.focusHandler_=null},goog.ui.tree.TreeControl.prototype.handleMouseEvent_=function(e){goog.log.fine(this.logger_,"Received event "+e.type);var t=this.getNodeFromEvent_(e);if(t)switch(e.type){case goog.events.EventType.MOUSEDOWN:t.onMouseDown(e);break;case goog.events.EventType.CLICK:t.onClick_(e);break;case goog.events.EventType.DBLCLICK:t.onDoubleClick_(e)}},goog.ui.tree.TreeControl.prototype.handleKeyEvent=function(e){var t=!1;return(t=this.typeAhead_.handleNavigation(e)||this.selectedItem_&&this.selectedItem_.onKeyDown(e)||this.typeAhead_.handleTypeAheadChar(e))&&e.preventDefault(),t},goog.ui.tree.TreeControl.prototype.getNodeFromEvent_=function(e){var t=null;for(e=e.target;null!=e;){if(t=goog.ui.tree.BaseNode.allNodes[e.id])return t;if(e==this.getElement())break;e=e.parentNode}return null},goog.ui.tree.TreeControl.prototype.createNode=function(e){return new goog.ui.tree.TreeNode(e||"",this.getConfig(),this.getDomHelper())},goog.ui.tree.TreeControl.prototype.setNode=function(e){this.typeAhead_.setNodeInMap(e)},goog.ui.tree.TreeControl.prototype.removeNode=function(e){this.typeAhead_.removeNodeFromMap(e)},goog.ui.tree.TreeControl.prototype.clearTypeAhead=function(){this.typeAhead_.clear()},goog.ui.tree.TreeControl.defaultConfig={indentWidth:19,cssRoot:"goog-tree-root goog-tree-item",cssHideRoot:"goog-tree-hide-root",cssItem:"goog-tree-item",cssChildren:"goog-tree-children",cssChildrenNoLines:"goog-tree-children-nolines",cssTreeRow:"goog-tree-row",cssItemLabel:"goog-tree-item-label",cssTreeIcon:"goog-tree-icon",cssExpandTreeIcon:"goog-tree-expand-icon",cssExpandTreeIconPlus:"goog-tree-expand-icon-plus",cssExpandTreeIconMinus:"goog-tree-expand-icon-minus",cssExpandTreeIconTPlus:"goog-tree-expand-icon-tplus",cssExpandTreeIconTMinus:"goog-tree-expand-icon-tminus",cssExpandTreeIconLPlus:"goog-tree-expand-icon-lplus",cssExpandTreeIconLMinus:"goog-tree-expand-icon-lminus",cssExpandTreeIconT:"goog-tree-expand-icon-t",cssExpandTreeIconL:"goog-tree-expand-icon-l",cssExpandTreeIconBlank:"goog-tree-expand-icon-blank",cssExpandedFolderIcon:"goog-tree-expanded-folder-icon",cssCollapsedFolderIcon:"goog-tree-collapsed-folder-icon",cssFileIcon:"goog-tree-file-icon",cssExpandedRootIcon:"goog-tree-expanded-folder-icon",cssCollapsedRootIcon:"goog-tree-collapsed-folder-icon",cssSelectedRow:"selected"},goog.cssom={},goog.cssom.CssRuleType={STYLE:1,IMPORT:3,MEDIA:4,FONT_FACE:5,PAGE:6,NAMESPACE:7},goog.cssom.getAllCssText=function(e){return goog.cssom.getAllCss_(e||document.styleSheets,!0)},goog.cssom.getAllCssStyleRules=function(e){return goog.cssom.getAllCss_(e||document.styleSheets,!1)},goog.cssom.getCssRulesFromStyleSheet=function(e){var t=null;try{t=e.rules||e.cssRules}catch(o){if(15==o.code)throw o.styleSheet=e,o}return t},goog.cssom.getAllCssStyleSheets=function(e,t){var o=[],n=e||document.styleSheets,i=goog.isDef(t)?t:!1;if(n.imports&&n.imports.length)for(var r=0,s=n.imports.length;s>r;r++)goog.array.extend(o,goog.cssom.getAllCssStyleSheets(n.imports[r]));else if(n.length)for(r=0,s=n.length;s>r;r++)goog.array.extend(o,goog.cssom.getAllCssStyleSheets(n[r]));else{var l=goog.cssom.getCssRulesFromStyleSheet(n);if(l&&l.length)for(var a,r=0,s=l.length;s>r;r++)a=l[r],a.styleSheet&&goog.array.extend(o,goog.cssom.getAllCssStyleSheets(a.styleSheet))}return!(n.type||n.rules||n.cssRules)||n.disabled&&!i||o.push(n),o},goog.cssom.getCssTextFromCssRule=function(e){var t="";return e.cssText?t=e.cssText:e.style&&e.style.cssText&&e.selectorText&&(t=e.style.cssText.replace(/\s*-closure-parent-stylesheet:\s*\[object\];?\s*/gi,"").replace(/\s*-closure-rule-index:\s*[\d]+;?\s*/gi,""),t=e.selectorText+" { "+t+" }"),t},goog.cssom.getCssRuleIndexInParentStyleSheet=function(e,t){if(e.style&&e.style["-closure-rule-index"])return e.style["-closure-rule-index"];var o=t||goog.cssom.getParentStyleSheet(e);if(!o)throw Error("Cannot find a parentStyleSheet.");if((o=goog.cssom.getCssRulesFromStyleSheet(o))&&o.length)for(var n,i=0,r=o.length;r>i;i++)if(n=o[i],n==e)return i;return-1},goog.cssom.getParentStyleSheet=function(e){return e.parentStyleSheet||e.style&&e.style["-closure-parent-stylesheet"]},goog.cssom.replaceCssRule=function(e,t,o,n){if(!(o=o||goog.cssom.getParentStyleSheet(e)))throw Error("Cannot proceed without the parentStyleSheet.");if(e=n>=0?n:goog.cssom.getCssRuleIndexInParentStyleSheet(e,o),!(e>=0))throw Error("Cannot proceed without the index of the cssRule.");goog.cssom.removeCssRule(o,e),goog.cssom.addCssRule(o,t,e)},goog.cssom.addCssRule=function(e,t,o){if((0>o||void 0==o)&&(o=(e.cssRules||e.rules).length),e.insertRule)e.insertRule(t,o);else{if(t=/^([^\{]+)\{([^\{]+)\}/.exec(t),3!=t.length)throw Error("Your CSSRule appears to be ill-formatted.");e.addRule(t[1],t[2],o)}},goog.cssom.removeCssRule=function(e,t){e.deleteRule?e.deleteRule(t):e.removeRule(t)},goog.cssom.addCssText=function(e,t){var o=t?t.getDocument():goog.dom.getDocument(),n=o.createElement("style");return n.type="text/css",o.getElementsByTagName("head")[0].appendChild(n),n.styleSheet?n.styleSheet.cssText=e:(o=o.createTextNode(e),n.appendChild(o)),n},goog.cssom.getFileNameFromStyleSheet=function(e){return(e=e.href)?/([^\/\?]+)[^\/]*$/.exec(e)[1]:null},goog.cssom.getAllCss_=function(e,t){for(var o=[],n=goog.cssom.getAllCssStyleSheets(e),i=0;e=n[i];i++){var r=goog.cssom.getCssRulesFromStyleSheet(e);if(r&&r.length){if(!t)var s=0;for(var l,a=0,c=r.length;c>a;a++)l=r[a],t&&!l.href?(l=goog.cssom.getCssTextFromCssRule(l),o.push(l)):l.href||(l.style&&(l.parentStyleSheet||(l.style["-closure-parent-stylesheet"]=e),l.style["-closure-rule-index"]=s),o.push(l)),t||s++}}return t?o.join(" "):o};var Blockly={BlockSvg:function(e){this.block_=e,this.svgGroup_=Blockly.createSvgElement("g",{},null),this.svgPathDark_=Blockly.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1, 1)"},this.svgGroup_),this.svgPath_=Blockly.createSvgElement("path",{"class":"blocklyPath"},this.svgGroup_),this.svgPathLight_=Blockly.createSvgElement("path",{"class":"blocklyPathLight"},this.svgGroup_),this.svgPath_.tooltip=this.block_,Blockly.Tooltip&&Blockly.Tooltip.bindMouseEvents(this.svgPath_),this.updateMovable()}};Blockly.BlockSvg.INLINE=-1,Blockly.BlockSvg.prototype.init=function(){var e=this.block_;this.updateColour();for(var t,o=0;t=e.inputList[o];o++)t.init();e.mutator&&e.mutator.createIcon()},Blockly.BlockSvg.prototype.updateMovable=function(){this.block_.isMovable()?Blockly.addClass_(this.svgGroup_,"blocklyDraggable"):Blockly.removeClass_(this.svgGroup_,"blocklyDraggable")},Blockly.BlockSvg.prototype.getRootElement=function(){return this.svgGroup_},Blockly.BlockSvg.SEP_SPACE_X=10,Blockly.BlockSvg.SEP_SPACE_Y=10,Blockly.BlockSvg.INLINE_PADDING_Y=5,Blockly.BlockSvg.MIN_BLOCK_Y=25,Blockly.BlockSvg.TAB_HEIGHT=20,Blockly.BlockSvg.TAB_WIDTH=8,Blockly.BlockSvg.NOTCH_WIDTH=30,Blockly.BlockSvg.CORNER_RADIUS=8,Blockly.BlockSvg.FIELD_HEIGHT=18,Blockly.BlockSvg.DISTANCE_45_INSIDE=(1-Math.SQRT1_2)*(Blockly.BlockSvg.CORNER_RADIUS-1)+1,Blockly.BlockSvg.DISTANCE_45_OUTSIDE=(1-Math.SQRT1_2)*(Blockly.BlockSvg.CORNER_RADIUS+1)-1,Blockly.BlockSvg.NOTCH_PATH_LEFT="l 6,4 3,0 6,-4",Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT="l 6.5,4 2,0 6.5,-4",Blockly.BlockSvg.NOTCH_PATH_RIGHT="l -6,4 -3,0 -6,-4",Blockly.BlockSvg.JAGGED_TEETH="l 8,0 0,4 8,4 -16,8 8,4",Blockly.BlockSvg.JAGGED_TEETH_HEIGHT=20,Blockly.BlockSvg.TAB_PATH_DOWN="v 5 c 0,10 -"+Blockly.BlockSvg.TAB_WIDTH+",-8 -"+Blockly.BlockSvg.TAB_WIDTH+",7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",-2.5 "+Blockly.BlockSvg.TAB_WIDTH+",7.5",Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL="v 6.5 m -"+.98*Blockly.BlockSvg.TAB_WIDTH+",2.5 q -"+.05*Blockly.BlockSvg.TAB_WIDTH+",10 "+.27*Blockly.BlockSvg.TAB_WIDTH+",10 m "+.71*Blockly.BlockSvg.TAB_WIDTH+",-2.5 v 1.5",Blockly.BlockSvg.TOP_LEFT_CORNER_START="m 0,"+Blockly.BlockSvg.CORNER_RADIUS,Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL="m "+Blockly.BlockSvg.DISTANCE_45_INSIDE+","+Blockly.BlockSvg.DISTANCE_45_INSIDE,Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR="m 1,"+(Blockly.BlockSvg.CORNER_RADIUS-1),Blockly.BlockSvg.TOP_LEFT_CORNER="A "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+",0",Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT="A "+(Blockly.BlockSvg.CORNER_RADIUS-1)+","+(Blockly.BlockSvg.CORNER_RADIUS-1)+" 0 0,1 "+Blockly.BlockSvg.CORNER_RADIUS+",1",Blockly.BlockSvg.INNER_TOP_LEFT_CORNER=Blockly.BlockSvg.NOTCH_PATH_RIGHT+" h -"+(Blockly.BlockSvg.NOTCH_WIDTH-15-Blockly.BlockSvg.CORNER_RADIUS)+" a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 -"+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS,Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER="a "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,0 "+Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS,Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL="a "+(Blockly.BlockSvg.CORNER_RADIUS+1)+","+(Blockly.BlockSvg.CORNER_RADIUS+1)+" 0 0,0 "+(-Blockly.BlockSvg.DISTANCE_45_OUTSIDE-1)+","+(Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.DISTANCE_45_OUTSIDE),Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL="a "+(Blockly.BlockSvg.CORNER_RADIUS+1)+","+(Blockly.BlockSvg.CORNER_RADIUS+1)+" 0 0,0 "+(Blockly.BlockSvg.CORNER_RADIUS+1)+","+(Blockly.BlockSvg.CORNER_RADIUS+1),Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR="a "+(Blockly.BlockSvg.CORNER_RADIUS+1)+","+(Blockly.BlockSvg.CORNER_RADIUS+1)+" 0 0,0 "+(Blockly.BlockSvg.CORNER_RADIUS-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)+","+(Blockly.BlockSvg.DISTANCE_45_OUTSIDE+1),Blockly.BlockSvg.prototype.dispose=function(){goog.dom.removeNode(this.svgGroup_),this.block_=this.svgPathDark_=this.svgPathLight_=this.svgPath_=this.svgGroup_=null},Blockly.BlockSvg.prototype.disposeUiEffect=function(){Blockly.playAudio("delete");var e=Blockly.getSvgXY_(this.svgGroup_),t=this.svgGroup_.cloneNode(!0);t.translateX_=e.x,t.translateY_=e.y,t.setAttribute("transform","translate("+t.translateX_+","+t.translateY_+")"),Blockly.svg.appendChild(t),t.bBox_=t.getBBox(),t.startDate_=new Date,Blockly.BlockSvg.disposeUiStep_(t)},Blockly.BlockSvg.disposeUiStep_=function(e){var t=(new Date-e.startDate_)/150;t>1?goog.dom.removeNode(e):(e.setAttribute("transform","translate("+(e.translateX_+(Blockly.RTL?-1:1)*e.bBox_.width/2*t+", "+(e.translateY_+e.bBox_.height*t))+") scale("+(1-t)+")"),window.setTimeout(function(){Blockly.BlockSvg.disposeUiStep_(e)},10))},Blockly.BlockSvg.prototype.connectionUiEffect=function(){Blockly.playAudio("click");var e=Blockly.getSvgXY_(this.svgGroup_);this.block_.outputConnection?(e.x+=Blockly.RTL?3:-3,e.y+=13):this.block_.previousConnection&&(e.x+=Blockly.RTL?-23:23,e.y+=3),e=Blockly.createSvgElement("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},Blockly.svg),e.startDate_=new Date,Blockly.BlockSvg.connectionUiStep_(e)},Blockly.BlockSvg.connectionUiStep_=function(e){var t=(new Date-e.startDate_)/150;t>1?goog.dom.removeNode(e):(e.setAttribute("r",25*t),e.style.opacity=1-t,window.setTimeout(function(){Blockly.BlockSvg.connectionUiStep_(e)},10))},Blockly.BlockSvg.prototype.updateColour=function(){if(!this.block_.disabled){var e=Blockly.makeColour(this.block_.getColour()),t=goog.color.hexToRgb(e),o=goog.color.lighten(t,.3),t=goog.color.darken(t,.4);this.svgPathLight_.setAttribute("stroke",goog.color.rgbArrayToHex(o)),this.svgPathDark_.setAttribute("fill",goog.color.rgbArrayToHex(t)),this.svgPath_.setAttribute("fill",e)}},Blockly.BlockSvg.prototype.updateDisabled=function(){this.block_.disabled||this.block_.getInheritedDisabled()?(Blockly.addClass_(this.svgGroup_,"blocklyDisabled"),this.svgPath_.setAttribute("fill","url(#blocklyDisabledPattern)")):(Blockly.removeClass_(this.svgGroup_,"blocklyDisabled"),this.updateColour());for(var e,t=this.block_.getChildren(),o=0;e=t[o];o++)e.svg_.updateDisabled()},Blockly.BlockSvg.prototype.addSelect=function(){Blockly.addClass_(this.svgGroup_,"blocklySelected"),this.svgGroup_.parentNode.appendChild(this.svgGroup_)},Blockly.BlockSvg.prototype.removeSelect=function(){Blockly.removeClass_(this.svgGroup_,"blocklySelected")},Blockly.BlockSvg.prototype.addDragging=function(){Blockly.addClass_(this.svgGroup_,"blocklyDragging")},Blockly.BlockSvg.prototype.removeDragging=function(){Blockly.removeClass_(this.svgGroup_,"blocklyDragging")},Blockly.BlockSvg.prototype.render=function(){this.block_.rendered=!0;var e=Blockly.BlockSvg.SEP_SPACE_X;Blockly.RTL&&(e=-e);for(var t=this.block_.getIcons(),o=0;o<t.length;o++)e=t[o].renderIcon(e);e+=Blockly.RTL?Blockly.BlockSvg.SEP_SPACE_X:-Blockly.BlockSvg.SEP_SPACE_X,t=this.renderCompute_(e),this.renderDraw_(e,t),(e=this.block_.getParent())?e.render():Blockly.fireUiEvent(window,"resize")},Blockly.BlockSvg.prototype.renderFields_=function(e,t,o){Blockly.RTL&&(t=-t);for(var n,i=0;n=e[i];i++){var r=n.getSize().width;Blockly.RTL?(t-=r,n.getRootElement().setAttribute("transform","translate("+t+", "+o+")"),r&&(t-=Blockly.BlockSvg.SEP_SPACE_X)):(n.getRootElement().setAttribute("transform","translate("+t+", "+o+")"),r&&(t+=r+Blockly.BlockSvg.SEP_SPACE_X))}return Blockly.RTL?-t:t},Blockly.BlockSvg.prototype.renderCompute_=function(e){var t=this.block_.inputList,o=[];o.rightEdge=e+2*Blockly.BlockSvg.SEP_SPACE_X,(this.block_.previousConnection||this.block_.nextConnection)&&(o.rightEdge=Math.max(o.rightEdge,Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.SEP_SPACE_X));for(var n,i=0,r=0,s=!1,l=!1,a=!1,c=void 0,u=this.block_.inputsInline&&!this.block_.isCollapsed(),g=0;n=t[g];g++)if(n.isVisible()){var h;if(u&&c&&c!=Blockly.NEXT_STATEMENT&&n.type!=Blockly.NEXT_STATEMENT?h=o[o.length-1]:(c=n.type,h=[],h.type=u&&n.type!=Blockly.NEXT_STATEMENT?Blockly.BlockSvg.INLINE:n.type,h.height=0,o.push(h)),h.push(n),n.renderHeight=Blockly.BlockSvg.MIN_BLOCK_Y,n.renderWidth=u&&n.type==Blockly.INPUT_VALUE?Blockly.BlockSvg.TAB_WIDTH+Blockly.BlockSvg.SEP_SPACE_X:0,n.connection&&n.connection.targetConnection){var d=n.connection.targetBlock().getHeightWidth();n.renderHeight=Math.max(n.renderHeight,d.height),n.renderWidth=Math.max(n.renderWidth,d.width)}h.height=Math.max(h.height,n.renderHeight),n.fieldWidth=0,1==o.length&&(n.fieldWidth+=Blockly.RTL?-e:e);for(var p,d=0;p=n.fieldRow[d];d++)0!=d&&(n.fieldWidth+=Blockly.BlockSvg.SEP_SPACE_X),p=p.getSize(),n.fieldWidth+=p.width,h.height=Math.max(h.height,p.height);h.type!=Blockly.BlockSvg.INLINE&&(h.type==Blockly.NEXT_STATEMENT?(l=!0,r=Math.max(r,n.fieldWidth)):(h.type==Blockly.INPUT_VALUE?s=!0:h.type==Blockly.DUMMY_INPUT&&(a=!0),i=Math.max(i,n.fieldWidth)))}for(e=0;h=o[e];e++)if(h.thicker=!1,h.type==Blockly.BlockSvg.INLINE)for(t=0;n=h[t];t++)if(n.type==Blockly.INPUT_VALUE){h.height+=2*Blockly.BlockSvg.INLINE_PADDING_Y,h.thicker=!0;break}return o.statementEdge=2*Blockly.BlockSvg.SEP_SPACE_X+r,l&&(o.rightEdge=Math.max(o.rightEdge,o.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH)),s?o.rightEdge=Math.max(o.rightEdge,i+2*Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.TAB_WIDTH):a&&(o.rightEdge=Math.max(o.rightEdge,i+2*Blockly.BlockSvg.SEP_SPACE_X)),o.hasValue=s,o.hasStatement=l,o.hasDummy=a,o
25
- },Blockly.BlockSvg.prototype.renderDraw_=function(e,t){if(this.block_.outputConnection)this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!0;else{if(this.squareBottomLeftCorner_=this.squareTopLeftCorner_=!1,this.block_.previousConnection){var o=this.block_.previousConnection.targetBlock();o&&o.nextConnection&&o.nextConnection.targetConnection==this.block_.previousConnection&&(this.squareTopLeftCorner_=!0)}this.block_.nextConnection&&(o=this.block_.nextConnection.targetBlock())&&o.previousConnection&&o.previousConnection.targetConnection==this.block_.nextConnection&&(this.squareBottomLeftCorner_=!0)}var n=this.block_.getRelativeToSurfaceXY(),i=[],r=[],o=[],s=[];this.renderDrawTop_(i,o,n,t.rightEdge);var l=this.renderDrawRight_(i,o,r,s,n,t,e);this.renderDrawBottom_(i,o,n,l),this.renderDrawLeft_(i,o,n,l),n=i.join(" ")+"\n"+r.join(" "),this.svgPath_.setAttribute("d",n),this.svgPathDark_.setAttribute("d",n),n=o.join(" ")+"\n"+s.join(" "),this.svgPathLight_.setAttribute("d",n),Blockly.RTL&&(this.svgPath_.setAttribute("transform","scale(-1 1)"),this.svgPathLight_.setAttribute("transform","scale(-1 1)"),this.svgPathDark_.setAttribute("transform","translate(1,1) scale(-1 1)"))},Blockly.BlockSvg.prototype.renderDrawTop_=function(e,t,o,n){this.squareTopLeftCorner_?(e.push("m 0,0"),t.push("m 1,1")):(e.push(Blockly.BlockSvg.TOP_LEFT_CORNER_START),t.push(Blockly.RTL?Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_RTL:Blockly.BlockSvg.TOP_LEFT_CORNER_START_HIGHLIGHT_LTR),e.push(Blockly.BlockSvg.TOP_LEFT_CORNER),t.push(Blockly.BlockSvg.TOP_LEFT_CORNER_HIGHLIGHT)),Blockly.BROKEN_CONTROL_POINTS&&e.push("c 0,5 0,-5 0,0"),this.block_.previousConnection&&(e.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),t.push("H",Blockly.BlockSvg.NOTCH_WIDTH-15),e.push(Blockly.BlockSvg.NOTCH_PATH_LEFT),t.push(Blockly.BlockSvg.NOTCH_PATH_LEFT_HIGHLIGHT),this.block_.previousConnection.moveTo(o.x+(Blockly.RTL?-Blockly.BlockSvg.NOTCH_WIDTH:Blockly.BlockSvg.NOTCH_WIDTH),o.y)),e.push("H",n),t.push("H",n+(Blockly.RTL?-1:0))},Blockly.BlockSvg.prototype.renderDrawRight_=function(e,t,o,n,i,r,s){for(var l,a,c,u,g=0,h=0;u=r[h];h++){if(l=Blockly.BlockSvg.SEP_SPACE_X,0==h&&(l+=Blockly.RTL?-s:s),t.push("M",r.rightEdge-1+","+(g+1)),this.block_.isCollapsed()){var d=u[0];a=g+Blockly.BlockSvg.FIELD_HEIGHT,this.renderFields_(d.fieldRow,l,a),e.push(Blockly.BlockSvg.JAGGED_TEETH),Blockly.RTL?t.push("l 8,0 0,3.8 7,3.2 m -14.5,9 l 8,4"):t.push("h 8"),d=u.height-Blockly.BlockSvg.JAGGED_TEETH_HEIGHT,e.push("v",d),Blockly.RTL&&t.push("v",d-2)}else if(u.type==Blockly.BlockSvg.INLINE){for(var p=0;d=u[p];p++)a=g+Blockly.BlockSvg.FIELD_HEIGHT,u.thicker&&(a+=Blockly.BlockSvg.INLINE_PADDING_Y),l=this.renderFields_(d.fieldRow,l,a),d.type!=Blockly.DUMMY_INPUT&&(l+=d.renderWidth+Blockly.BlockSvg.SEP_SPACE_X),d.type==Blockly.INPUT_VALUE&&(o.push("M",l-Blockly.BlockSvg.SEP_SPACE_X+","+(g+Blockly.BlockSvg.INLINE_PADDING_Y)),o.push("h",Blockly.BlockSvg.TAB_WIDTH-d.renderWidth),o.push(Blockly.BlockSvg.TAB_PATH_DOWN),o.push("v",d.renderHeight-Blockly.BlockSvg.TAB_HEIGHT),o.push("h",d.renderWidth-Blockly.BlockSvg.TAB_WIDTH),o.push("z"),Blockly.RTL?(n.push("M",l-Blockly.BlockSvg.SEP_SPACE_X+Blockly.BlockSvg.TAB_WIDTH-d.renderWidth-1+","+(g+Blockly.BlockSvg.INLINE_PADDING_Y+1)),n.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),n.push("v",d.renderHeight-Blockly.BlockSvg.TAB_HEIGHT+2),n.push("h",d.renderWidth-Blockly.BlockSvg.TAB_WIDTH)):(n.push("M",l-Blockly.BlockSvg.SEP_SPACE_X+1+","+(g+Blockly.BlockSvg.INLINE_PADDING_Y+1)),n.push("v",d.renderHeight),n.push("h",Blockly.BlockSvg.TAB_WIDTH-d.renderWidth),n.push("M",l-d.renderWidth-Blockly.BlockSvg.SEP_SPACE_X+3.8+","+(g+Blockly.BlockSvg.INLINE_PADDING_Y+Blockly.BlockSvg.TAB_HEIGHT-.4)),n.push("l",.42*Blockly.BlockSvg.TAB_WIDTH+",-1.8")),a=Blockly.RTL?i.x-l-Blockly.BlockSvg.TAB_WIDTH+Blockly.BlockSvg.SEP_SPACE_X+d.renderWidth-1:i.x+l+Blockly.BlockSvg.TAB_WIDTH-Blockly.BlockSvg.SEP_SPACE_X-d.renderWidth+1,c=i.y+g+Blockly.BlockSvg.INLINE_PADDING_Y,d.connection.moveTo(a,c),d.connection.targetConnection&&d.connection.tighten_());l=Math.max(l,r.rightEdge),e.push("H",l),t.push("H",l+(Blockly.RTL?-1:0)),e.push("v",u.height),Blockly.RTL&&t.push("v",u.height-2)}else u.type==Blockly.INPUT_VALUE?(d=u[0],a=g+Blockly.BlockSvg.FIELD_HEIGHT,d.align!=Blockly.ALIGN_LEFT&&(p=r.rightEdge-d.fieldWidth-Blockly.BlockSvg.TAB_WIDTH-2*Blockly.BlockSvg.SEP_SPACE_X,d.align==Blockly.ALIGN_RIGHT?l+=p:d.align==Blockly.ALIGN_CENTRE&&(l+=(p+l)/2)),this.renderFields_(d.fieldRow,l,a),e.push(Blockly.BlockSvg.TAB_PATH_DOWN),e.push("v",u.height-Blockly.BlockSvg.TAB_HEIGHT),Blockly.RTL?(t.push(Blockly.BlockSvg.TAB_PATH_DOWN_HIGHLIGHT_RTL),t.push("v",u.height-Blockly.BlockSvg.TAB_HEIGHT)):(t.push("M",r.rightEdge-4.2+","+(g+Blockly.BlockSvg.TAB_HEIGHT-.4)),t.push("l",.42*Blockly.BlockSvg.TAB_WIDTH+",-1.8")),a=i.x+(Blockly.RTL?-r.rightEdge-1:r.rightEdge+1),c=i.y+g,d.connection.moveTo(a,c),d.connection.targetConnection&&d.connection.tighten_()):u.type==Blockly.DUMMY_INPUT?(d=u[0],a=g+Blockly.BlockSvg.FIELD_HEIGHT,d.align!=Blockly.ALIGN_LEFT&&(p=r.rightEdge-d.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,r.hasValue&&(p-=Blockly.BlockSvg.TAB_WIDTH),d.align==Blockly.ALIGN_RIGHT?l+=p:d.align==Blockly.ALIGN_CENTRE&&(l+=(p+l)/2)),this.renderFields_(d.fieldRow,l,a),e.push("v",u.height),Blockly.RTL&&t.push("v",u.height-2)):u.type==Blockly.NEXT_STATEMENT&&(d=u[0],0==h&&(e.push("v",Blockly.BlockSvg.SEP_SPACE_Y),Blockly.RTL&&t.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),g+=Blockly.BlockSvg.SEP_SPACE_Y),a=g+Blockly.BlockSvg.FIELD_HEIGHT,d.align!=Blockly.ALIGN_LEFT&&(p=r.statementEdge-d.fieldWidth-2*Blockly.BlockSvg.SEP_SPACE_X,d.align==Blockly.ALIGN_RIGHT?l+=p:d.align==Blockly.ALIGN_CENTRE&&(l+=(p+l)/2)),this.renderFields_(d.fieldRow,l,a),l=r.statementEdge+Blockly.BlockSvg.NOTCH_WIDTH,e.push("H",l),e.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER),e.push("v",u.height-2*Blockly.BlockSvg.CORNER_RADIUS),e.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER),e.push("H",r.rightEdge),Blockly.RTL?(t.push("M",l-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(g+Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),t.push(Blockly.BlockSvg.INNER_TOP_LEFT_CORNER_HIGHLIGHT_RTL),t.push("v",u.height-2*Blockly.BlockSvg.CORNER_RADIUS),t.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_RTL),t.push("H",r.rightEdge-1)):(t.push("M",l-Blockly.BlockSvg.NOTCH_WIDTH+Blockly.BlockSvg.DISTANCE_45_OUTSIDE+","+(g+u.height-Blockly.BlockSvg.DISTANCE_45_OUTSIDE)),t.push(Blockly.BlockSvg.INNER_BOTTOM_LEFT_CORNER_HIGHLIGHT_LTR),t.push("H",r.rightEdge)),a=i.x+(Blockly.RTL?-l:l),c=i.y+g+1,d.connection.moveTo(a,c),d.connection.targetConnection&&d.connection.tighten_(),h==r.length-1||r[h+1].type==Blockly.NEXT_STATEMENT)&&(e.push("v",Blockly.BlockSvg.SEP_SPACE_Y),Blockly.RTL&&t.push("v",Blockly.BlockSvg.SEP_SPACE_Y-1),g+=Blockly.BlockSvg.SEP_SPACE_Y);g+=u.height}return r.length||(g=Blockly.BlockSvg.MIN_BLOCK_Y,e.push("V",g),Blockly.RTL&&t.push("V",g-1)),g},Blockly.BlockSvg.prototype.renderDrawBottom_=function(e,t,o,n){this.block_.nextConnection&&(e.push("H",Blockly.BlockSvg.NOTCH_WIDTH+" "+Blockly.BlockSvg.NOTCH_PATH_RIGHT),this.block_.nextConnection.moveTo(Blockly.RTL?o.x-Blockly.BlockSvg.NOTCH_WIDTH:o.x+Blockly.BlockSvg.NOTCH_WIDTH,o.y+n+1),this.block_.nextConnection.targetConnection&&this.block_.nextConnection.tighten_()),Blockly.BROKEN_CONTROL_POINTS&&e.push("c 0,5 0,-5 0,0"),this.squareBottomLeftCorner_?(e.push("H 0"),Blockly.RTL||t.push("M","1,"+n)):(e.push("H",Blockly.BlockSvg.CORNER_RADIUS),e.push("a",Blockly.BlockSvg.CORNER_RADIUS+","+Blockly.BlockSvg.CORNER_RADIUS+" 0 0,1 -"+Blockly.BlockSvg.CORNER_RADIUS+",-"+Blockly.BlockSvg.CORNER_RADIUS),Blockly.RTL||(t.push("M",Blockly.BlockSvg.DISTANCE_45_INSIDE+","+(n-Blockly.BlockSvg.DISTANCE_45_INSIDE)),t.push("A",Blockly.BlockSvg.CORNER_RADIUS-1+","+(Blockly.BlockSvg.CORNER_RADIUS-1)+" 0 0,1 1,"+(n-Blockly.BlockSvg.CORNER_RADIUS))))},Blockly.BlockSvg.prototype.renderDrawLeft_=function(e,t,o){this.block_.outputConnection?(this.block_.outputConnection.moveTo(o.x,o.y),e.push("V",Blockly.BlockSvg.TAB_HEIGHT),e.push("c 0,-10 -"+Blockly.BlockSvg.TAB_WIDTH+",8 -"+Blockly.BlockSvg.TAB_WIDTH+",-7.5 s "+Blockly.BlockSvg.TAB_WIDTH+",2.5 "+Blockly.BlockSvg.TAB_WIDTH+",-7.5"),Blockly.RTL?(t.push("M",-.3*Blockly.BlockSvg.TAB_WIDTH+",8.9"),t.push("l",-.45*Blockly.BlockSvg.TAB_WIDTH+",-2.1")):(t.push("V",Blockly.BlockSvg.TAB_HEIGHT-1),t.push("m",-.92*Blockly.BlockSvg.TAB_WIDTH+",-1 q "+-.19*Blockly.BlockSvg.TAB_WIDTH+",-5.5 0,-11"),t.push("m",.92*Blockly.BlockSvg.TAB_WIDTH+",1 V 1 H 2"))):Blockly.RTL||(this.squareTopLeftCorner_?t.push("V",1):t.push("V",Blockly.BlockSvg.CORNER_RADIUS)),e.push("z")},Blockly.Blocks={},Blockly.ScrollbarPair=function(e){this.workspace_=e,this.oldHostMetrics_=null,this.hScroll=new Blockly.Scrollbar(e,!0,!0),this.vScroll=new Blockly.Scrollbar(e,!1,!0),this.corner_=Blockly.createSvgElement("rect",{height:Blockly.Scrollbar.scrollbarThickness,width:Blockly.Scrollbar.scrollbarThickness,style:"fill: #fff"},null),Blockly.Scrollbar.insertAfter_(this.corner_,e.getBubbleCanvas())},Blockly.ScrollbarPair.prototype.dispose=function(){Blockly.unbindEvent_(this.onResizeWrapper_),this.onResizeWrapper_=null,goog.dom.removeNode(this.corner_),this.oldHostMetrics_=this.workspace_=this.corner_=null,this.hScroll.dispose(),this.hScroll=null,this.vScroll.dispose(),this.vScroll=null},Blockly.ScrollbarPair.prototype.resize=function(){var e=this.workspace_.getMetrics();if(e){var t=!1,o=!1;this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==e.viewWidth&&this.oldHostMetrics_.viewHeight==e.viewHeight&&this.oldHostMetrics_.absoluteTop==e.absoluteTop&&this.oldHostMetrics_.absoluteLeft==e.absoluteLeft?(this.oldHostMetrics_&&this.oldHostMetrics_.contentWidth==e.contentWidth&&this.oldHostMetrics_.viewLeft==e.viewLeft&&this.oldHostMetrics_.contentLeft==e.contentLeft||(t=!0),this.oldHostMetrics_&&this.oldHostMetrics_.contentHeight==e.contentHeight&&this.oldHostMetrics_.viewTop==e.viewTop&&this.oldHostMetrics_.contentTop==e.contentTop||(o=!0)):o=t=!0,t&&this.hScroll.resize(e),o&&this.vScroll.resize(e),this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==e.viewWidth&&this.oldHostMetrics_.absoluteLeft==e.absoluteLeft||this.corner_.setAttribute("x",this.vScroll.xCoordinate),this.oldHostMetrics_&&this.oldHostMetrics_.viewHeight==e.viewHeight&&this.oldHostMetrics_.absoluteTop==e.absoluteTop||this.corner_.setAttribute("y",this.hScroll.yCoordinate),this.oldHostMetrics_=e}},Blockly.ScrollbarPair.prototype.set=function(e,t){if(Blockly.Scrollbar===Blockly.ScrollbarNative){this.hScroll.set(e,!1),this.vScroll.set(t,!1);var o={};o.x=this.hScroll.outerDiv_.scrollLeft/this.hScroll.innerImg_.offsetWidth||0,o.y=this.vScroll.outerDiv_.scrollTop/this.vScroll.innerImg_.offsetHeight||0,this.workspace_.setMetrics(o)}else this.hScroll.set(e,!0),this.vScroll.set(t,!0)},Blockly.ScrollbarInterface=function(){},Blockly.ScrollbarInterface.prototype.dispose=function(){},Blockly.ScrollbarInterface.prototype.resize=function(){},Blockly.ScrollbarInterface.prototype.isVisible=function(){},Blockly.ScrollbarInterface.prototype.setVisible=function(){},Blockly.ScrollbarInterface.prototype.set=function(){},Blockly.ScrollbarNative=function(e,t,o){if(this.workspace_=e,this.pair_=o||!1,this.horizontal_=t,this.createDom_(),null!==t){Blockly.Scrollbar.scrollbarThickness||Blockly.ScrollbarNative.measureScrollbarThickness_(e),t?(this.foreignObject_.setAttribute("height",Blockly.Scrollbar.scrollbarThickness),this.outerDiv_.style.height=Blockly.Scrollbar.scrollbarThickness+"px",this.outerDiv_.style.overflowX="scroll",this.outerDiv_.style.overflowY="hidden",this.innerImg_.style.height="1px"):(this.foreignObject_.setAttribute("width",Blockly.Scrollbar.scrollbarThickness),this.outerDiv_.style.width=Blockly.Scrollbar.scrollbarThickness+"px",this.outerDiv_.style.overflowX="hidden",this.outerDiv_.style.overflowY="scroll",this.innerImg_.style.width="1px");var n=this;this.onScrollWrapper_=Blockly.bindEvent_(this.outerDiv_,"scroll",n,function(){n.onScroll_()}),Blockly.bindEvent_(this.foreignObject_,"mousedown",null,function(e){Blockly.hideChaff(!0),Blockly.noEvent(e)})}},Blockly.ScrollbarNative.prototype.dispose=function(){Blockly.unbindEvent_(this.onResizeWrapper_),this.onResizeWrapper_=null,Blockly.unbindEvent_(this.onScrollWrapper_),this.onScrollWrapper_=null,goog.dom.removeNode(this.foreignObject_),this.innerImg_=this.outerDiv_=this.workspace_=this.foreignObject_=null},Blockly.ScrollbarNative.prototype.resize=function(e){if(e||(e=this.workspace_.getMetrics()))if(this.horizontal_){var t=e.viewWidth;this.pair_?t-=Blockly.Scrollbar.scrollbarThickness:this.setVisible(t<e.contentWidth),this.ratio_=t/e.viewWidth;var o=this.ratio_*e.contentWidth,n=(e.viewLeft-e.contentLeft)*this.ratio_;this.outerDiv_.style.width=t+"px",this.innerImg_.style.width=o+"px",this.xCoordinate=e.absoluteLeft,this.pair_&&Blockly.RTL&&(this.xCoordinate+=Blockly.Scrollbar.scrollbarThickness),this.yCoordinate=e.absoluteTop+e.viewHeight-Blockly.Scrollbar.scrollbarThickness,this.foreignObject_.setAttribute("x",this.xCoordinate),this.foreignObject_.setAttribute("y",this.yCoordinate),this.foreignObject_.setAttribute("width",Math.max(0,t)),this.outerDiv_.scrollLeft=Math.round(n)}else t=e.viewHeight,this.pair_?t-=Blockly.Scrollbar.scrollbarThickness:this.setVisible(t<e.contentHeight),this.ratio_=t/e.viewHeight,o=this.ratio_*e.contentHeight,n=(e.viewTop-e.contentTop)*this.ratio_,this.outerDiv_.style.height=t+"px",this.innerImg_.style.height=o+"px",this.xCoordinate=e.absoluteLeft,Blockly.RTL||(this.xCoordinate+=e.viewWidth-Blockly.Scrollbar.scrollbarThickness),this.yCoordinate=e.absoluteTop,this.foreignObject_.setAttribute("x",this.xCoordinate),this.foreignObject_.setAttribute("y",this.yCoordinate),this.foreignObject_.setAttribute("height",Math.max(0,t)),this.outerDiv_.scrollTop=Math.round(n)},Blockly.ScrollbarNative.prototype.createDom_=function(){this.foreignObject_=Blockly.createSvgElement("foreignObject",{},null);var e=document.createElementNS(Blockly.HTML_NS,"body");e.setAttribute("xmlns",Blockly.HTML_NS),e.setAttribute("class","blocklyMinimalBody");var t=document.createElementNS(Blockly.HTML_NS,"div");this.outerDiv_=t;var o=document.createElementNS(Blockly.HTML_NS,"img");o.setAttribute("src",Blockly.pathToBlockly+"media/1x1.gif"),this.innerImg_=o,t.appendChild(o),e.appendChild(t),this.foreignObject_.appendChild(e),Blockly.Scrollbar.insertAfter_(this.foreignObject_,this.workspace_.getBubbleCanvas())},Blockly.ScrollbarNative.prototype.isVisible=function(){return"none"!=this.foreignObject_.style.display},Blockly.ScrollbarNative.prototype.setVisible=function(e){if(e!=this.isVisible()){if(this.pair_)throw"Unable to toggle visibility of paired scrollbars.";e?(this.foreignObject_.style.display="block",this.workspace_.getMetrics()):(this.workspace_.setMetrics({x:0,y:0}),this.foreignObject_.style.display="none")}},Blockly.ScrollbarNative.prototype.onScroll_=function(){var e={};this.horizontal_?e.x=this.outerDiv_.scrollLeft/this.innerImg_.offsetWidth||0:e.y=this.outerDiv_.scrollTop/this.innerImg_.offsetHeight||0,this.workspace_.setMetrics(e)},Blockly.ScrollbarNative.prototype.set=function(e,t){if(!t&&this.onScrollWrapper_)var o=Blockly.unbindEvent_(this.onScrollWrapper_);this.horizontal_?this.outerDiv_.scrollLeft=e*this.ratio_:this.outerDiv_.scrollTop=e*this.ratio_,o&&(this.onScrollWrapper_=Blockly.bindEvent_(this.outerDiv_,"scroll",this,o))},Blockly.ScrollbarNative.measureScrollbarThickness_=function(e){e=new Blockly.ScrollbarNative(e,null,!1),e.outerDiv_.style.width="100px",e.outerDiv_.style.height="100px",e.innerImg_.style.width="100%",e.innerImg_.style.height="200px",e.foreignObject_.setAttribute("width",1),e.foreignObject_.setAttribute("height",1),e.outerDiv_.style.overflowY="scroll";var t=e.innerImg_.offsetWidth;e.outerDiv_.style.overflowY="hidden";var o=e.innerImg_.offsetWidth;goog.dom.removeNode(e.foreignObject_),e=o-t,0>=e&&(e=15),Blockly.Scrollbar.scrollbarThickness=e},Blockly.ScrollbarSvg=function(e,t,o){this.workspace_=e,this.pair_=o||!1,this.horizontal_=t,this.createDom_(),t?(this.svgBackground_.setAttribute("height",Blockly.Scrollbar.scrollbarThickness),this.svgKnob_.setAttribute("height",Blockly.Scrollbar.scrollbarThickness-6),this.svgKnob_.setAttribute("y",3)):(this.svgBackground_.setAttribute("width",Blockly.Scrollbar.scrollbarThickness),this.svgKnob_.setAttribute("width",Blockly.Scrollbar.scrollbarThickness-6),this.svgKnob_.setAttribute("x",3)),this.onMouseDownBarWrapper_=Blockly.bindEvent_(this.svgBackground_,"mousedown",this,this.onMouseDownBar_),this.onMouseDownKnobWrapper_=Blockly.bindEvent_(this.svgKnob_,"mousedown",this,this.onMouseDownKnob_)},Blockly.ScrollbarSvg.prototype.dispose=function(){this.onMouseUpKnob_(),this.onResizeWrapper_&&(Blockly.unbindEvent_(this.onResizeWrapper_),this.onResizeWrapper_=null),Blockly.unbindEvent_(this.onMouseDownBarWrapper_),this.onMouseDownBarWrapper_=null,Blockly.unbindEvent_(this.onMouseDownKnobWrapper_),this.onMouseDownKnobWrapper_=null,goog.dom.removeNode(this.svgGroup_),this.workspace_=this.svgKnob_=this.svgBackground_=this.svgGroup_=null},Blockly.ScrollbarSvg.prototype.resize=function(e){if(e||(e=this.workspace_.getMetrics())){if(this.horizontal_){var t=e.viewWidth;this.pair_?t-=Blockly.Scrollbar.scrollbarThickness:this.setVisible(t<e.contentHeight),this.ratio_=t/e.contentWidth,(-1/0===this.ratio_||1/0===this.ratio_||isNaN(this.ratio_))&&(this.ratio_=0);var o=e.viewWidth*this.ratio_,n=(e.viewLeft-e.contentLeft)*this.ratio_;this.svgKnob_.setAttribute("width",Math.max(0,o)),this.xCoordinate=e.absoluteLeft,this.pair_&&Blockly.RTL&&(this.xCoordinate+=e.absoluteLeft+Blockly.Scrollbar.scrollbarThickness),this.yCoordinate=e.absoluteTop+e.viewHeight-Blockly.Scrollbar.scrollbarThickness,this.svgGroup_.setAttribute("transform","translate("+this.xCoordinate+", "+this.yCoordinate+")"),this.svgBackground_.setAttribute("width",Math.max(0,t)),this.svgKnob_.setAttribute("x",this.constrainKnob_(n))}else t=e.viewHeight,this.pair_?t-=Blockly.Scrollbar.scrollbarThickness:this.setVisible(t<e.contentHeight),this.ratio_=t/e.contentHeight,(-1/0===this.ratio_||1/0===this.ratio_||isNaN(this.ratio_))&&(this.ratio_=0),o=e.viewHeight*this.ratio_,n=(e.viewTop-e.contentTop)*this.ratio_,this.svgKnob_.setAttribute("height",Math.max(0,o)),this.xCoordinate=e.absoluteLeft,Blockly.RTL||(this.xCoordinate+=e.viewWidth-Blockly.Scrollbar.scrollbarThickness),this.yCoordinate=e.absoluteTop,this.svgGroup_.setAttribute("transform","translate("+this.xCoordinate+", "+this.yCoordinate+")"),this.svgBackground_.setAttribute("height",Math.max(0,t)),this.svgKnob_.setAttribute("y",this.constrainKnob_(n));this.onScroll_()}},Blockly.ScrollbarSvg.prototype.createDom_=function(){this.svgGroup_=Blockly.createSvgElement("g",{},null),this.svgBackground_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarBackground"},this.svgGroup_);var e=Math.floor((Blockly.Scrollbar.scrollbarThickness-6)/2);this.svgKnob_=Blockly.createSvgElement("rect",{"class":"blocklyScrollbarKnob",rx:e,ry:e},this.svgGroup_),Blockly.Scrollbar.insertAfter_(this.svgGroup_,this.workspace_.getBubbleCanvas())},Blockly.ScrollbarSvg.prototype.isVisible=function(){return"none"!=this.svgGroup_.getAttribute("display")},Blockly.ScrollbarSvg.prototype.setVisible=function(e){if(e!=this.isVisible()){if(this.pair_)throw"Unable to toggle visibility of paired scrollbars.";e?this.svgGroup_.setAttribute("display","block"):(this.workspace_.setMetrics({x:0,y:0}),this.svgGroup_.setAttribute("display","none"))}},Blockly.ScrollbarSvg.prototype.onMouseDownBar_=function(e){if(Blockly.hideChaff(!0),!Blockly.isRightButton(e)){var t=Blockly.mouseToSvg(e),t=this.horizontal_?t.x:t.y,o=Blockly.getSvgXY_(this.svgKnob_),o=this.horizontal_?o.x:o.y,n=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"width":"height")),i=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),r=.95*n;o>=t?i-=r:t>=o+n&&(i+=r),this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(i)),this.onScroll_()}e.stopPropagation()},Blockly.ScrollbarSvg.prototype.onMouseDownKnob_=function(e){Blockly.hideChaff(!0),this.onMouseUpKnob_(),Blockly.isRightButton(e)||(this.startDragKnob=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),this.startDragMouse=this.horizontal_?e.clientX:e.clientY,Blockly.ScrollbarSvg.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,this.onMouseUpKnob_),Blockly.ScrollbarSvg.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.onMouseMoveKnob_)),e.stopPropagation()},Blockly.ScrollbarSvg.prototype.onMouseMoveKnob_=function(e){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",this.constrainKnob_(this.startDragKnob+((this.horizontal_?e.clientX:e.clientY)-this.startDragMouse))),this.onScroll_()},Blockly.ScrollbarSvg.prototype.onMouseUpKnob_=function(){Blockly.ScrollbarSvg.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.ScrollbarSvg.onMouseUpWrapper_),Blockly.ScrollbarSvg.onMouseUpWrapper_=null),Blockly.ScrollbarSvg.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.ScrollbarSvg.onMouseMoveWrapper_),Blockly.ScrollbarSvg.onMouseMoveWrapper_=null)},Blockly.ScrollbarSvg.prototype.constrainKnob_=function(e){if(0>=e||isNaN(e))e=0;else{var t=this.horizontal_?"width":"height",o=parseFloat(this.svgBackground_.getAttribute(t)),t=parseFloat(this.svgKnob_.getAttribute(t));e=Math.min(e,o-t)}return e},Blockly.ScrollbarSvg.prototype.onScroll_=function(){var e=parseFloat(this.svgKnob_.getAttribute(this.horizontal_?"x":"y")),t=parseFloat(this.svgBackground_.getAttribute(this.horizontal_?"width":"height")),e=e/t;isNaN(e)&&(e=0),t={},this.horizontal_?t.x=e:t.y=e,this.workspace_.setMetrics(t)},Blockly.ScrollbarSvg.prototype.set=function(e,t){this.svgKnob_.setAttribute(this.horizontal_?"x":"y",e*this.ratio_),t&&this.onScroll_()},goog.userAgent.GECKO&&(goog.userAgent.MAC||goog.userAgent.LINUX)?(Blockly.Scrollbar=Blockly.ScrollbarNative,Blockly.Scrollbar.scrollbarThickness=0):(Blockly.Scrollbar=Blockly.ScrollbarSvg,Blockly.Scrollbar.scrollbarThickness=15),Blockly.Scrollbar.insertAfter_=function(e,t){var o=t.nextSibling,n=t.parentNode;if(!n)throw"Reference node has no parent.";o?n.insertBefore(e,o):n.appendChild(e)},Blockly.Trashcan=function(e){this.workspace_=e},Blockly.Trashcan.prototype.BODY_URL_="media/trashbody.png",Blockly.Trashcan.prototype.LID_URL_="media/trashlid.png",Blockly.Trashcan.prototype.WIDTH_=47,Blockly.Trashcan.prototype.BODY_HEIGHT_=45,Blockly.Trashcan.prototype.LID_HEIGHT_=15,Blockly.Trashcan.prototype.MARGIN_BOTTOM_=35,Blockly.Trashcan.prototype.MARGIN_SIDE_=35,Blockly.Trashcan.prototype.isOpen=!1,Blockly.Trashcan.prototype.svgGroup_=null,Blockly.Trashcan.prototype.svgBody_=null,Blockly.Trashcan.prototype.svgLid_=null,Blockly.Trashcan.prototype.lidTask_=0,Blockly.Trashcan.prototype.lidAngle_=0,Blockly.Trashcan.prototype.left_=0,Blockly.Trashcan.prototype.top_=0,Blockly.Trashcan.prototype.createDom=function(){return this.svgGroup_=Blockly.createSvgElement("g",{filter:"url(#blocklyTrashcanShadowFilter)"},null),this.svgBody_=Blockly.createSvgElement("image",{width:this.WIDTH_,height:this.BODY_HEIGHT_},this.svgGroup_),this.svgBody_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.pathToBlockly+this.BODY_URL_),this.svgBody_.setAttribute("y",this.LID_HEIGHT_),this.svgLid_=Blockly.createSvgElement("image",{width:this.WIDTH_,height:this.LID_HEIGHT_},this.svgGroup_),this.svgLid_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Blockly.pathToBlockly+this.LID_URL_),this.svgGroup_},Blockly.Trashcan.prototype.init=function(){this.setOpen_(!1),this.position_(),Blockly.bindEvent_(window,"resize",this,this.position_)},Blockly.Trashcan.prototype.dispose=function(){this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.workspace_=this.svgLid_=this.svgBody_=null,goog.Timer.clear(this.lidTask_)},Blockly.Trashcan.prototype.position_=function(){var e=this.workspace_.getMetrics();e&&(this.left_=Blockly.RTL?this.MARGIN_SIDE_:e.viewWidth+e.absoluteLeft-this.WIDTH_-this.MARGIN_SIDE_,this.top_=e.viewHeight+e.absoluteTop-(this.BODY_HEIGHT_+this.LID_HEIGHT_)-this.MARGIN_BOTTOM_,this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")"))},Blockly.Trashcan.prototype.onMouseMove=function(e){if(this.svgGroup_){e=Blockly.mouseToSvg(e);var t=Blockly.getSvgXY_(this.svgGroup_);e=e.x>t.x&&e.x<t.x+this.WIDTH_&&e.y>t.y&&e.y<t.y+this.BODY_HEIGHT_+this.LID_HEIGHT_,this.isOpen!=e&&this.setOpen_(e)}},Blockly.Trashcan.prototype.setOpen_=function(e){this.isOpen!=e&&(goog.Timer.clear(this.lidTask_),this.isOpen=e,this.animateLid_())},Blockly.Trashcan.prototype.animateLid_=function(){this.lidAngle_+=this.isOpen?10:-10,this.lidAngle_=Math.max(0,this.lidAngle_),this.svgLid_.setAttribute("transform","rotate("+(Blockly.RTL?-this.lidAngle_:this.lidAngle_)+", "+(Blockly.RTL?4:this.WIDTH_-4)+", "+(this.LID_HEIGHT_-2)+")"),(this.isOpen?45>this.lidAngle_:0<this.lidAngle_)&&(this.lidTask_=goog.Timer.callOnce(this.animateLid_,5,this))},Blockly.Trashcan.prototype.close=function(){this.setOpen_(!1)},Blockly.Xml={},Blockly.Xml.workspaceToDom=function(e){var t=Blockly.svgSize().width,o=goog.dom.createDom("xml");e=e.getTopBlocks(!0);for(var n,i=0;n=e[i];i++){var r=Blockly.Xml.blockToDom_(n);n=n.getRelativeToSurfaceXY(),r.setAttribute("x",Blockly.RTL?t-n.x:n.x),r.setAttribute("y",n.y),o.appendChild(r)}return o},Blockly.Xml.blockToDom_=function(e){var t=goog.dom.createDom("block");if(t.setAttribute("type",e.type),e.mutationToDom){var o=e.mutationToDom();o&&t.appendChild(o)}for(var n=0;o=e.inputList[n];n++)for(var i,r=0;i=o.fieldRow[r];r++)if(i.name&&i.EDITABLE){var s=goog.dom.createDom("field",null,i.getValue());s.setAttribute("name",i.name),t.appendChild(s)}for(e.comment&&(o=goog.dom.createDom("comment",null,e.comment.getText()),o.setAttribute("pinned",e.comment.isVisible()),n=e.comment.getBubbleSize(),o.setAttribute("h",n.height),o.setAttribute("w",n.width),t.appendChild(o)),n=!1,r=0;o=e.inputList[r];r++){var l;i=!0,o.type!=Blockly.DUMMY_INPUT&&(s=o.connection.targetBlock(),o.type==Blockly.INPUT_VALUE?(l=goog.dom.createDom("value"),n=!0):o.type==Blockly.NEXT_STATEMENT&&(l=goog.dom.createDom("statement")),s&&(l.appendChild(Blockly.Xml.blockToDom_(s)),i=!1),l.setAttribute("name",o.name),i||t.appendChild(l))}return n&&t.setAttribute("inline",e.inputsInline),e.isCollapsed()&&t.setAttribute("collapsed",!0),e.disabled&&t.setAttribute("disabled",!0),e.isDeletable()||t.setAttribute("deletable",!1),e.isMovable()||t.setAttribute("movable",!1),e.isEditable()||t.setAttribute("editable",!1),e.nextConnection&&(e=e.nextConnection.targetBlock())&&(l=goog.dom.createDom("next",null,Blockly.Xml.blockToDom_(e)),t.appendChild(l)),t},Blockly.Xml.domToText=function(e){return(new XMLSerializer).serializeToString(e)},Blockly.Xml.domToPrettyText=function(e){e=Blockly.Xml.domToText(e).split("<");for(var t="",o=1;o<e.length;o++){var n=e[o];"/"==n[0]&&(t=t.substring(2)),e[o]=t+"<"+n,"/"!=n[0]&&"/>"!=n.slice(-2)&&(t+=" ")}return e=e.join("\n"),e=e.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>"),e.replace(/^\n/,"")},Blockly.Xml.textToDom=function(e){if(e=(new DOMParser).parseFromString(e,"text/xml"),!e||!e.firstChild||"xml"!=e.firstChild.nodeName.toLowerCase()||e.firstChild!==e.lastChild)throw"Blockly.Xml.textToDom did not obtain a valid XML tree.";return e.firstChild},Blockly.Xml.domToWorkspace=function(e,t){for(var o,n=Blockly.svgSize().width,i=0;o=t.childNodes[i];i++)if("block"==o.nodeName.toLowerCase()){var r=Blockly.Xml.domToBlock_(e,o),s=parseInt(o.getAttribute("x"),10);o=parseInt(o.getAttribute("y"),10),isNaN(s)||isNaN(o)||r.moveBy(Blockly.RTL?n-s:s,o)}},Blockly.Xml.domToBlock_=function(e,t){var o=t.getAttribute("type");if(!o)throw"Block type unspecified: \n"+t.outerHTML;var n=new Blockly.Block(e,o);n.initSvg();var i=t.getAttribute("inline");i&&n.setInputsInline("true"==i),(i=t.getAttribute("collapsed"))&&n.setCollapsed("true"==i),(i=t.getAttribute("disabled"))&&n.setDisabled("true"==i),(i=t.getAttribute("deletable"))&&n.setDeletable("true"==i),(i=t.getAttribute("movable"))&&n.setMovable("true"==i),(i=t.getAttribute("editable"))&&n.setEditable("true"==i);for(var r,s=null,i=0;r=t.childNodes[i];i++)if(3!=r.nodeType||!r.data.match(/^\s*$/)){for(var l,s=null,a=0;l=r.childNodes[a];a++)3==l.nodeType&&l.data.match(/^\s*$/)||(s=l);switch(a=r.getAttribute("name"),r.nodeName.toLowerCase()){case"mutation":n.domToMutation&&n.domToMutation(r);break;case"comment":n.setCommentText(r.textContent),(s=r.getAttribute("pinned"))&&n.comment.setVisible("true"==s),s=parseInt(r.getAttribute("w"),10),r=parseInt(r.getAttribute("h"),10),isNaN(s)||isNaN(r)||n.comment.setBubbleSize(s,r);break;case"title":case"field":n.setFieldValue(r.textContent,a);break;case"value":case"statement":if(r=n.getInput(a),!r)throw"Input "+a+" does not exist in block "+o;if(s&&"block"==s.nodeName.toLowerCase())if(s=Blockly.Xml.domToBlock_(e,s),s.outputConnection)r.connection.connect(s.outputConnection);else{if(!s.previousConnection)throw"Child block does not have output or previous statement.";r.connection.connect(s.previousConnection)}break;case"next":if(s&&"block"==s.nodeName.toLowerCase()){if(!n.nextConnection)throw"Next statement does not exist.";if(n.nextConnection.targetConnection)throw"Next statement is already connected.";if(s=Blockly.Xml.domToBlock_(e,s),!s.previousConnection)throw"Next block does not have previous statement.";n.nextConnection.connect(s.previousConnection)}}}return(o=n.nextConnection&&n.nextConnection.targetBlock())?o.render():n.render(),n},Blockly.Xml.deleteNext=function(e){for(var t,o=0;t=e.childNodes[o];o++)if("next"==t.nodeName.toLowerCase()){e.removeChild(t);break}},Blockly.Xml=Blockly.Xml,Blockly.Xml.domToText=Blockly.Xml.domToText,Blockly.Xml.domToWorkspace=Blockly.Xml.domToWorkspace,Blockly.Xml.textToDom=Blockly.Xml.textToDom,Blockly.Xml.workspaceToDom=Blockly.Xml.workspaceToDom,Blockly.Workspace=function(e,t){this.getMetrics=e,this.setMetrics=t,this.isFlyout=!1,this.topBlocks_=[],this.maxBlocks=1/0,Blockly.ConnectionDB.init(this)},Blockly.Workspace.SCAN_ANGLE=3,Blockly.Workspace.prototype.dragMode=!1,Blockly.Workspace.prototype.scrollX=0,Blockly.Workspace.prototype.scrollY=0,Blockly.Workspace.prototype.trashcan=null,Blockly.Workspace.prototype.fireChangeEventPid_=null,Blockly.Workspace.prototype.scrollbar=null,Blockly.Workspace.prototype.createDom=function(){return this.svgGroup_=Blockly.createSvgElement("g",{},null),this.svgBlockCanvas_=Blockly.createSvgElement("g",{},this.svgGroup_),this.svgBubbleCanvas_=Blockly.createSvgElement("g",{},this.svgGroup_),this.fireChangeEvent(),this.svgGroup_},Blockly.Workspace.prototype.dispose=function(){this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.svgBubbleCanvas_=this.svgBlockCanvas_=null,this.trashcan&&(this.trashcan.dispose(),this.trashcan=null)},Blockly.Workspace.prototype.addTrashcan=function(){if(Blockly.hasTrashcan&&!Blockly.readOnly){this.trashcan=new Blockly.Trashcan(this);var e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.svgBlockCanvas_),this.trashcan.init()}},Blockly.Workspace.prototype.getCanvas=function(){return this.svgBlockCanvas_},Blockly.Workspace.prototype.getBubbleCanvas=function(){return this.svgBubbleCanvas_},Blockly.Workspace.prototype.addTopBlock=function(e){this.topBlocks_.push(e),this.fireChangeEvent()},Blockly.Workspace.prototype.removeTopBlock=function(e){for(var t,o=!1,n=0;t=this.topBlocks_[n];n++)if(t==e){this.topBlocks_.splice(n,1),o=!0;break}if(!o)throw"Block not present in workspace's list of top-most blocks.";this.fireChangeEvent()},Blockly.Workspace.prototype.getTopBlocks=function(e){var t=[].concat(this.topBlocks_);if(e&&1<t.length){var o=Math.sin(Blockly.Workspace.SCAN_ANGLE/180*Math.PI);Blockly.RTL&&(o*=-1),t.sort(function(e,t){var n=e.getRelativeToSurfaceXY(),i=t.getRelativeToSurfaceXY();return n.y+o*n.x-(i.y+o*i.x)})}return t},Blockly.Workspace.prototype.getAllBlocks=function(){for(var e=this.getTopBlocks(!1),t=0;t<e.length;t++)e=e.concat(e[t].getChildren());return e},Blockly.Workspace.prototype.clear=function(){for(Blockly.hideChaff();this.topBlocks_.length;)this.topBlocks_[0].dispose()},Blockly.Workspace.prototype.render=function(){for(var e,t=this.getAllBlocks(),o=0;e=t[o];o++)e.getChildren().length||e.render()},Blockly.Workspace.prototype.getBlockById=function(e){for(var t,o=this.getAllBlocks(),n=0;t=o[n];n++)if(t.id==e)return t;return null},Blockly.Workspace.prototype.traceOn=function(e){this.traceOn_=e,this.traceWrapper_&&(Blockly.unbindEvent_(this.traceWrapper_),this.traceWrapper_=null),e&&(this.traceWrapper_=Blockly.bindEvent_(this.svgBlockCanvas_,"blocklySelectChange",this,function(){this.traceOn_=!1}))},Blockly.Workspace.prototype.highlightBlock=function(e){if(this.traceOn_){var t=null;
26
- if(e&&(t=this.getBlockById(e),!t))return;this.traceOn(!1),t?t.select():Blockly.selected&&Blockly.selected.unselect(),this.traceOn(!0)}},Blockly.Workspace.prototype.fireChangeEvent=function(){this.fireChangeEventPid_&&window.clearTimeout(this.fireChangeEventPid_);var e=this.svgBlockCanvas_;e&&(this.fireChangeEventPid_=window.setTimeout(function(){Blockly.fireUiEvent(e,"blocklyWorkspaceChange")},0))},Blockly.Workspace.prototype.paste=function(e){if(!(e.getElementsByTagName("block").length>=this.remainingCapacity())){var t=Blockly.Xml.domToBlock_(this,e),o=parseInt(e.getAttribute("x"),10);if(e=parseInt(e.getAttribute("y"),10),!isNaN(o)&&!isNaN(e)){Blockly.RTL&&(o=-o);do for(var n,i=!1,r=this.getAllBlocks(),s=0;n=r[s];s++)n=n.getRelativeToSurfaceXY(),1>=Math.abs(o-n.x)&&1>=Math.abs(e-n.y)&&(o=Blockly.RTL?o-Blockly.SNAP_RADIUS:o+Blockly.SNAP_RADIUS,e+=2*Blockly.SNAP_RADIUS,i=!0);while(i);t.moveBy(o,e)}t.select()}},Blockly.Workspace.prototype.remainingCapacity=function(){return 1/0==this.maxBlocks?1/0:this.maxBlocks-this.getAllBlocks().length},Blockly.Workspace.prototype.clear=Blockly.Workspace.prototype.clear,Blockly.Bubble=function(e,t,o,n,i,r,s){var l=Blockly.Bubble.ARROW_ANGLE;Blockly.RTL&&(l=-l),this.arrow_radians_=l/360*Math.PI*2,this.workspace_=e,this.content_=t,this.shape_=o,e.getBubbleCanvas().appendChild(this.createDom_(t,!(!r||!s))),this.setAnchorLocation(n,i),r&&s||(e=this.content_.getBBox(),r=e.width+2*Blockly.Bubble.BORDER_WIDTH,s=e.height+2*Blockly.Bubble.BORDER_WIDTH),this.setBubbleSize(r,s),this.positionBubble_(),this.renderArrow_(),this.rendered_=!0,Blockly.readOnly||(Blockly.bindEvent_(this.bubbleBack_,"mousedown",this,this.bubbleMouseDown_),this.resizeGroup_&&Blockly.bindEvent_(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_))},Blockly.Bubble.BORDER_WIDTH=6,Blockly.Bubble.ARROW_THICKNESS=10,Blockly.Bubble.ARROW_ANGLE=20,Blockly.Bubble.ARROW_BEND=4,Blockly.Bubble.ANCHOR_RADIUS=8,Blockly.Bubble.onMouseUpWrapper_=null,Blockly.Bubble.onMouseMoveWrapper_=null,Blockly.Bubble.unbindDragEvents_=function(){Blockly.Bubble.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Bubble.onMouseUpWrapper_),Blockly.Bubble.onMouseUpWrapper_=null),Blockly.Bubble.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Bubble.onMouseMoveWrapper_),Blockly.Bubble.onMouseMoveWrapper_=null)},Blockly.Bubble.prototype.rendered_=!1,Blockly.Bubble.prototype.anchorX_=0,Blockly.Bubble.prototype.anchorY_=0,Blockly.Bubble.prototype.relativeLeft_=0,Blockly.Bubble.prototype.relativeTop_=0,Blockly.Bubble.prototype.width_=0,Blockly.Bubble.prototype.height_=0,Blockly.Bubble.prototype.autoLayout_=!0,Blockly.Bubble.prototype.createDom_=function(e,t){this.bubbleGroup_=Blockly.createSvgElement("g",{},null);var o=Blockly.createSvgElement("g",{filter:"url(#blocklyEmboss)"},this.bubbleGroup_);return this.bubbleArrow_=Blockly.createSvgElement("path",{},o),this.bubbleBack_=Blockly.createSvgElement("rect",{"class":"blocklyDraggable",x:0,y:0,rx:Blockly.Bubble.BORDER_WIDTH,ry:Blockly.Bubble.BORDER_WIDTH},o),t?(this.resizeGroup_=Blockly.createSvgElement("g",{"class":Blockly.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),o=2*Blockly.Bubble.BORDER_WIDTH,Blockly.createSvgElement("polygon",{points:"0,x x,x x,0".replace(/x/g,o.toString())},this.resizeGroup_),Blockly.createSvgElement("line",{"class":"blocklyResizeLine",x1:o/3,y1:o-1,x2:o-1,y2:o/3},this.resizeGroup_),Blockly.createSvgElement("line",{"class":"blocklyResizeLine",x1:2*o/3,y1:o-1,x2:o-1,y2:2*o/3},this.resizeGroup_)):this.resizeGroup_=null,this.bubbleGroup_.appendChild(e),this.bubbleGroup_},Blockly.Bubble.prototype.bubbleMouseDown_=function(e){this.promote_(),Blockly.Bubble.unbindDragEvents_(),Blockly.isRightButton(e)||Blockly.isTargetInput_(e)||(Blockly.setCursorHand_(!0),this.dragDeltaX=Blockly.RTL?this.relativeLeft_+e.clientX:this.relativeLeft_-e.clientX,this.dragDeltaY=this.relativeTop_-e.clientY,Blockly.Bubble.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,Blockly.Bubble.unbindDragEvents_),Blockly.Bubble.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.bubbleMouseMove_),Blockly.hideChaff(),e.stopPropagation())},Blockly.Bubble.prototype.bubbleMouseMove_=function(e){this.autoLayout_=!1,this.relativeLeft_=Blockly.RTL?this.dragDeltaX-e.clientX:this.dragDeltaX+e.clientX,this.relativeTop_=this.dragDeltaY+e.clientY,this.positionBubble_(),this.renderArrow_()},Blockly.Bubble.prototype.resizeMouseDown_=function(e){this.promote_(),Blockly.Bubble.unbindDragEvents_(),Blockly.isRightButton(e)||(Blockly.setCursorHand_(!0),this.resizeDeltaWidth=Blockly.RTL?this.width_+e.clientX:this.width_-e.clientX,this.resizeDeltaHeight=this.height_-e.clientY,Blockly.Bubble.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,Blockly.Bubble.unbindDragEvents_),Blockly.Bubble.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.resizeMouseMove_),Blockly.hideChaff(),e.stopPropagation())},Blockly.Bubble.prototype.resizeMouseMove_=function(e){this.autoLayout_=!1;var t=this.resizeDeltaWidth,o=this.resizeDeltaHeight+e.clientY,t=Blockly.RTL?t-e.clientX:t+e.clientX;this.setBubbleSize(t,o),Blockly.RTL&&this.positionBubble_()},Blockly.Bubble.prototype.registerResizeEvent=function(e,t){Blockly.bindEvent_(this.bubbleGroup_,"resize",e,t)},Blockly.Bubble.prototype.promote_=function(){this.bubbleGroup_.parentNode.appendChild(this.bubbleGroup_)},Blockly.Bubble.prototype.setAnchorLocation=function(e,t){this.anchorX_=e,this.anchorY_=t,this.rendered_&&this.positionBubble_()},Blockly.Bubble.prototype.layoutBubble_=function(){var e=-this.width_/4,t=-this.height_-Blockly.BlockSvg.MIN_BLOCK_Y;if(this.workspace_.scrollbar){var o=this.workspace_.getMetrics();this.anchorX_+e<Blockly.BlockSvg.SEP_SPACE_X+o.viewLeft?e=Blockly.BlockSvg.SEP_SPACE_X+o.viewLeft-this.anchorX_:o.viewLeft+o.viewWidth<this.anchorX_+e+this.width_+Blockly.BlockSvg.SEP_SPACE_X+Blockly.Scrollbar.scrollbarThickness&&(e=o.viewLeft+o.viewWidth-this.anchorX_-this.width_-Blockly.BlockSvg.SEP_SPACE_X-Blockly.Scrollbar.scrollbarThickness),this.anchorY_+t<Blockly.BlockSvg.SEP_SPACE_Y+o.viewTop&&(t=this.shape_.getBBox().height)}this.relativeLeft_=e,this.relativeTop_=t},Blockly.Bubble.prototype.positionBubble_=function(){this.bubbleGroup_.setAttribute("transform","translate("+(Blockly.RTL?this.anchorX_-this.relativeLeft_-this.width_:this.anchorX_+this.relativeLeft_)+", "+(this.relativeTop_+this.anchorY_)+")")},Blockly.Bubble.prototype.getBubbleSize=function(){return{width:this.width_,height:this.height_}},Blockly.Bubble.prototype.setBubbleSize=function(e,t){var o=2*Blockly.Bubble.BORDER_WIDTH;e=Math.max(e,o+45),t=Math.max(t,o+Blockly.BlockSvg.FIELD_HEIGHT),this.width_=e,this.height_=t,this.bubbleBack_.setAttribute("width",e),this.bubbleBack_.setAttribute("height",t),this.resizeGroup_&&(Blockly.RTL?this.resizeGroup_.setAttribute("transform","translate("+2*Blockly.Bubble.BORDER_WIDTH+", "+(t-o)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(e-o)+", "+(t-o)+")")),this.rendered_&&(this.autoLayout_&&this.layoutBubble_(),this.positionBubble_(),this.renderArrow_()),Blockly.fireUiEvent(this.bubbleGroup_,"resize")},Blockly.Bubble.prototype.renderArrow_=function(){var e=[],t=this.width_/2,o=this.height_/2,n=-this.relativeLeft_,i=-this.relativeTop_;if(t==n&&o==i)e.push("M "+t+","+o);else{i-=o,n-=t,Blockly.RTL&&(n*=-1);var r=Math.sqrt(i*i+n*n),s=Math.acos(n/r);0>i&&(s=2*Math.PI-s);var l=s+Math.PI/2;l>2*Math.PI&&(l-=2*Math.PI);var a=Math.sin(l),c=Math.cos(l),u=this.getBubbleSize(),l=(u.width+u.height)/Blockly.Bubble.ARROW_THICKNESS,l=Math.min(l,u.width,u.height)/2,u=1-Blockly.Bubble.ANCHOR_RADIUS/r,n=t+u*n,i=o+u*i,u=t+l*c,g=o+l*a,t=t-l*c,o=o-l*a,a=s+this.arrow_radians_;a>2*Math.PI&&(a-=2*Math.PI),s=Math.sin(a)*r/Blockly.Bubble.ARROW_BEND,r=Math.cos(a)*r/Blockly.Bubble.ARROW_BEND,e.push("M"+u+","+g),e.push("C"+(u+r)+","+(g+s)+" "+n+","+i+" "+n+","+i),e.push("C"+n+","+i+" "+(t+r)+","+(o+s)+" "+t+","+o)}e.push("z"),this.bubbleArrow_.setAttribute("d",e.join(" "))},Blockly.Bubble.prototype.setColour=function(e){this.bubbleBack_.setAttribute("fill",e),this.bubbleArrow_.setAttribute("fill",e)},Blockly.Bubble.prototype.dispose=function(){Blockly.Bubble.unbindDragEvents_(),goog.dom.removeNode(this.bubbleGroup_),this.shape_=this.content_=this.workspace_=this.bubbleGroup_=null},Blockly.Icon=function(e){this.block_=e},Blockly.Icon.RADIUS=8,Blockly.Icon.prototype.bubble_=null,Blockly.Icon.prototype.iconX_=0,Blockly.Icon.prototype.iconY_=0,Blockly.Icon.prototype.createIcon_=function(){this.iconGroup_=Blockly.createSvgElement("g",{},null),this.block_.getSvgRoot().appendChild(this.iconGroup_),Blockly.bindEvent_(this.iconGroup_,"mouseup",this,this.iconClick_),this.updateEditable()},Blockly.Icon.prototype.dispose=function(){goog.dom.removeNode(this.iconGroup_),this.iconGroup_=null,this.setVisible(!1),this.block_=null},Blockly.Icon.prototype.updateEditable=function(){this.block_.isEditable()&&!this.block_.isInFlyout?Blockly.addClass_(this.iconGroup_,"blocklyIconGroup"):Blockly.removeClass_(this.iconGroup_,"blocklyIconGroup")},Blockly.Icon.prototype.isVisible=function(){return!!this.bubble_},Blockly.Icon.prototype.iconClick_=function(){this.block_.isEditable()&&!this.block_.isInFlyout&&this.setVisible(!this.isVisible())},Blockly.Icon.prototype.updateColour=function(){if(this.isVisible()){var e=Blockly.makeColour(this.block_.getColour());this.bubble_.setColour(e)}},Blockly.Icon.prototype.renderIcon=function(e){if(this.block_.isCollapsed())return this.iconGroup_.setAttribute("display","none"),e;this.iconGroup_.setAttribute("display","block");var t=2*Blockly.Icon.RADIUS;return Blockly.RTL&&(e-=t),this.iconGroup_.setAttribute("transform","translate("+e+", 5)"),this.computeIconLocation(),e=Blockly.RTL?e-Blockly.BlockSvg.SEP_SPACE_X:e+(t+Blockly.BlockSvg.SEP_SPACE_X)},Blockly.Icon.prototype.setIconLocation=function(e,t){this.iconX_=e,this.iconY_=t,this.isVisible()&&this.bubble_.setAnchorLocation(e,t)},Blockly.Icon.prototype.computeIconLocation=function(){var e=this.block_.getRelativeToSurfaceXY(),t=Blockly.getRelativeXY_(this.iconGroup_),o=e.x+t.x+Blockly.Icon.RADIUS,e=e.y+t.y+Blockly.Icon.RADIUS;o===this.iconX_&&e===this.iconY_||this.setIconLocation(o,e)},Blockly.Icon.prototype.getIconLocation=function(){return{x:this.iconX_,y:this.iconY_}},Blockly.Comment=function(e){Blockly.Comment.superClass_.constructor.call(this,e),this.createIcon_()},goog.inherits(Blockly.Comment,Blockly.Icon),Blockly.Comment.prototype.text_="",Blockly.Comment.prototype.width_=160,Blockly.Comment.prototype.height_=80,Blockly.Comment.prototype.createIcon_=function(){Blockly.Icon.prototype.createIcon_.call(this),Blockly.createSvgElement("circle",{"class":"blocklyIconShield",r:Blockly.Icon.RADIUS,cx:Blockly.Icon.RADIUS,cy:Blockly.Icon.RADIUS},this.iconGroup_),this.iconMark_=Blockly.createSvgElement("text",{"class":"blocklyIconMark",x:Blockly.Icon.RADIUS,y:2*Blockly.Icon.RADIUS-3},this.iconGroup_),this.iconMark_.appendChild(document.createTextNode("?"))},Blockly.Comment.prototype.createEditor_=function(){this.foreignObject_=Blockly.createSvgElement("foreignObject",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null);var e=document.createElementNS(Blockly.HTML_NS,"body");return e.setAttribute("xmlns",Blockly.HTML_NS),e.className="blocklyMinimalBody",this.textarea_=document.createElementNS(Blockly.HTML_NS,"textarea"),this.textarea_.className="blocklyCommentTextarea",this.textarea_.setAttribute("dir",Blockly.RTL?"RTL":"LTR"),e.appendChild(this.textarea_),this.foreignObject_.appendChild(e),Blockly.bindEvent_(this.textarea_,"mouseup",this,this.textareaFocus_),this.foreignObject_},Blockly.Comment.prototype.resizeBubble_=function(){var e=this.bubble_.getBubbleSize(),t=2*Blockly.Bubble.BORDER_WIDTH;this.foreignObject_.setAttribute("width",e.width-t),this.foreignObject_.setAttribute("height",e.height-t),this.textarea_.style.width=e.width-t-4+"px",this.textarea_.style.height=e.height-t-4+"px"},Blockly.Comment.prototype.setVisible=function(e){if(e!=this.isVisible()){var t=this.getText(),o=this.getBubbleSize();e?(this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.svg_.svgGroup_,this.iconX_,this.iconY_,this.width_,this.height_),this.bubble_.registerResizeEvent(this,this.resizeBubble_),this.updateColour(),this.text_=null):(this.bubble_.dispose(),this.foreignObject_=this.textarea_=this.bubble_=null),this.setText(t),this.setBubbleSize(o.width,o.height)}},Blockly.Comment.prototype.textareaFocus_=function(){this.bubble_.promote_(),this.textarea_.focus()},Blockly.Comment.prototype.getBubbleSize=function(){return this.isVisible()?this.bubble_.getBubbleSize():{width:this.width_,height:this.height_}},Blockly.Comment.prototype.setBubbleSize=function(e,t){this.isVisible()?this.bubble_.setBubbleSize(e,t):(this.width_=e,this.height_=t)},Blockly.Comment.prototype.getText=function(){return this.isVisible()?this.textarea_.value:this.text_},Blockly.Comment.prototype.setText=function(e){this.isVisible()?this.textarea_.value=e:this.text_=e},Blockly.Comment.prototype.dispose=function(){this.block_.comment=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Connection=function(e,t){this.sourceBlock_=e,this.targetConnection=null,this.type=t,this.y_=this.x_=0,this.inDB_=!1,this.dbList_=this.sourceBlock_.workspace.connectionDBList},Blockly.Connection.prototype.dispose=function(){if(this.targetConnection)throw"Disconnect connection before disposing of it.";this.inDB_&&this.dbList_[this.type].removeConnection_(this),this.inDB_=!1,Blockly.highlightedConnection_==this&&(Blockly.highlightedConnection_=null),Blockly.localConnection_==this&&(Blockly.localConnection_=null)},Blockly.Connection.prototype.isSuperior=function(){return this.type==Blockly.INPUT_VALUE||this.type==Blockly.NEXT_STATEMENT},Blockly.Connection.prototype.connect=function(e){if(this.sourceBlock_==e.sourceBlock_)throw"Attempted to connect a block to itself.";if(this.sourceBlock_.workspace!==e.sourceBlock_.workspace)throw"Blocks are on different workspaces.";if(Blockly.OPPOSITE_TYPE[this.type]!=e.type)throw"Attempt to connect incompatible types.";if(this.type==Blockly.INPUT_VALUE||this.type==Blockly.OUTPUT_VALUE){if(this.targetConnection)throw"Source connection already connected (value).";if(e.targetConnection){var t=e.targetBlock();if(t.setParent(null),!t.outputConnection)throw"Orphan block does not have an output connection.";for(var o=this.sourceBlock_;o=Blockly.Connection.singleConnection_(o,t);){if(!o.targetBlock()){o.connect(t.outputConnection),t=null;break}o=o.targetBlock()}t&&window.setTimeout(function(){t.outputConnection.bumpAwayFrom_(e)},Blockly.BUMP_DELAY)}}else{if(this.targetConnection)throw"Source connection already connected (block).";if(e.targetConnection){if(this.type!=Blockly.PREVIOUS_STATEMENT)throw"Can only do a mid-stack connection with the top of a block.";if(t=e.targetBlock(),t.setParent(null),!t.previousConnection)throw"Orphan block does not have a previous connection.";for(o=this.sourceBlock_;o.nextConnection;){if(!o.nextConnection.targetConnection){o.nextConnection.connect(t.previousConnection),t=null;break}o=o.nextConnection.targetBlock()}t&&window.setTimeout(function(){t.previousConnection.bumpAwayFrom_(e)},Blockly.BUMP_DELAY)}}var n;this.isSuperior()?(o=this.sourceBlock_,n=e.sourceBlock_):(o=e.sourceBlock_,n=this.sourceBlock_),this.targetConnection=e,e.targetConnection=this,n.setParent(o),o.rendered&&o.svg_.updateDisabled(),n.rendered&&n.svg_.updateDisabled(),o.rendered&&n.rendered&&(this.type==Blockly.NEXT_STATEMENT||this.type==Blockly.PREVIOUS_STATEMENT?n.render():o.render())},Blockly.Connection.singleConnection_=function(e,t){for(var o=!1,n=0;n<e.inputList.length;n++){var i=e.inputList[n].connection;if(i&&i.type==Blockly.INPUT_VALUE&&t.outputConnection.checkType_(i)){if(o)return null;o=i}}return o},Blockly.Connection.prototype.disconnect=function(){var e=this.targetConnection;if(!e)throw"Source connection not connected.";if(e.targetConnection!=this)throw"Target connection not connected to source connection.";this.targetConnection=e.targetConnection=null;var t;this.isSuperior()?(t=this.sourceBlock_,e=e.sourceBlock_):(t=e.sourceBlock_,e=this.sourceBlock_),t.rendered&&t.render(),e.rendered&&(e.svg_.updateDisabled(),e.render())},Blockly.Connection.prototype.targetBlock=function(){return this.targetConnection?this.targetConnection.sourceBlock_:null},Blockly.Connection.prototype.bumpAwayFrom_=function(e){if(0==Blockly.Block.dragMode_){var t=this.sourceBlock_.getRootBlock();if(!t.isInFlyout){var o=!1;if(!t.isMovable()){if(t=e.sourceBlock_.getRootBlock(),!t.isMovable())return;e=this,o=!0}t.getSvgRoot().parentNode.appendChild(t.getSvgRoot());var n=e.x_+Blockly.SNAP_RADIUS-this.x_;e=e.y_+2*Blockly.SNAP_RADIUS-this.y_,o&&(e=-e),Blockly.RTL&&(n=-n),t.moveBy(n,e)}}},Blockly.Connection.prototype.moveTo=function(e,t){this.inDB_&&this.dbList_[this.type].removeConnection_(this),this.x_=e,this.y_=t,this.dbList_[this.type].addConnection_(this)},Blockly.Connection.prototype.moveBy=function(e,t){this.moveTo(this.x_+e,this.y_+t)},Blockly.Connection.prototype.highlight=function(){var e;this.type==Blockly.INPUT_VALUE||this.type==Blockly.OUTPUT_VALUE?(e=Blockly.RTL?-Blockly.BlockSvg.TAB_WIDTH:Blockly.BlockSvg.TAB_WIDTH,e="m 0,0 v 5 c 0,10 "+-e+",-8 "+-e+",7.5 s "+e+",-2.5 "+e+",7.5 v 5"):e=Blockly.RTL?"m 20,0 h -5 l -6,4 -3,0 -6,-4 h -5":"m -20,0 h 5 l 6,4 3,0 6,-4 h 5";var t=this.sourceBlock_.getRelativeToSurfaceXY();Blockly.Connection.highlightedPath_=Blockly.createSvgElement("path",{"class":"blocklyHighlightedConnectionPath",d:e,transform:"translate("+(this.x_-t.x)+", "+(this.y_-t.y)+")"},this.sourceBlock_.getSvgRoot())},Blockly.Connection.prototype.unhighlight=function(){goog.dom.removeNode(Blockly.Connection.highlightedPath_),delete Blockly.Connection.highlightedPath_},Blockly.Connection.prototype.tighten_=function(){var e=Math.round(this.targetConnection.x_-this.x_),t=Math.round(this.targetConnection.y_-this.y_);if(0!=e||0!=t){var o=this.targetBlock(),n=o.getSvgRoot();if(!n)throw"block is not rendered.";n=Blockly.getRelativeXY_(n),o.getSvgRoot().setAttribute("transform","translate("+(n.x-e)+", "+(n.y-t)+")"),o.moveConnections_(-e,-t)}},Blockly.Connection.prototype.closest=function(e,t,o){function n(t){var o=i[t];if((o.type==Blockly.OUTPUT_VALUE||o.type==Blockly.PREVIOUS_STATEMENT)&&o.targetConnection||!u.checkType_(o))return!0;o=o.sourceBlock_;do{if(c==o)return!0;o=o.getParent()}while(o);var n=r-i[t].x_,o=s-i[t].y_,n=Math.sqrt(n*n+o*o);return e>=n&&(a=i[t],e=n),e>o}if(this.targetConnection)return{connection:null,radius:e};var i=this.dbList_[Blockly.OPPOSITE_TYPE[this.type]],r=this.x_+t,s=this.y_+o;t=0;for(var l=o=i.length-2;l>t;)i[l].y_<s?t=l:o=l,l=Math.floor((t+o)/2);o=t=l;var a=null,c=this.sourceBlock_,u=this;if(i.length){for(;t>=0&&n(t);)t--;do o++;while(o<i.length&&n(o))}return{connection:a,radius:e}},Blockly.Connection.prototype.checkType_=function(e){if(!this.check_||!e.check_)return!0;for(var t=0;t<this.check_.length;t++)if(-1!=e.check_.indexOf(this.check_[t]))return!0;return!1},Blockly.Connection.prototype.setCheck=function(e){return e?(e instanceof Array||(e=[e]),this.check_=e,this.targetConnection&&!this.checkType_(this.targetConnection)&&(this.isSuperior()?this.targetBlock().setParent(null):this.sourceBlock_.setParent(null),this.sourceBlock_.bumpNeighbours_())):this.check_=null,this},Blockly.Connection.prototype.neighbours_=function(e){function t(t){var r=n-o[t].x_,s=i-o[t].y_;return Math.sqrt(r*r+s*s)<=e&&a.push(o[t]),e>s}for(var o=this.dbList_[Blockly.OPPOSITE_TYPE[this.type]],n=this.x_,i=this.y_,r=0,s=o.length-2,l=s;l>r;)o[l].y_<i?r=l:s=l,l=Math.floor((r+s)/2);var s=r=l,a=[];if(o.length){for(;r>=0&&t(r);)r--;do s++;while(s<o.length&&t(s))}return a},Blockly.Connection.prototype.hideAll=function(){if(this.inDB_&&this.dbList_[this.type].removeConnection_(this),this.targetConnection)for(var e=this.targetBlock().getDescendants(),t=0;t<e.length;t++){for(var o=e[t],n=o.getConnections_(!0),i=0;i<n.length;i++){var r=n[i];r.inDB_&&this.dbList_[r.type].removeConnection_(r)}for(o=o.getIcons(),n=0;n<o.length;n++)o[n].setVisible(!1)}},Blockly.Connection.prototype.unhideAll=function(){this.inDB_||this.dbList_[this.type].addConnection_(this);var e=[];if(this.type!=Blockly.INPUT_VALUE&&this.type!=Blockly.NEXT_STATEMENT)return e;var t=this.targetBlock();if(t){var o;t.isCollapsed()?(o=[],t.outputConnection&&o.push(t.outputConnection),t.nextConnection&&o.push(t.nextConnection),t.previousConnection&&o.push(t.previousConnection)):o=t.getConnections_(!0);for(var n=0;n<o.length;n++)e=e.concat(o[n].unhideAll());0==e.length&&(e[0]=t)}return e},Blockly.ConnectionDB=function(){},Blockly.ConnectionDB.prototype=[],Blockly.ConnectionDB.constructor=Blockly.ConnectionDB,Blockly.ConnectionDB.prototype.addConnection_=function(e){if(e.inDB_)throw"Connection already in database.";for(var t=0,o=this.length;o>t;){var n=Math.floor((t+o)/2);if(this[n].y_<e.y_)t=n+1;else{if(!(this[n].y_>e.y_)){t=n;break}o=n}}this.splice(t,0,e),e.inDB_=!0},Blockly.ConnectionDB.prototype.removeConnection_=function(e){if(!e.inDB_)throw"Connection not in database.";e.inDB_=!1;for(var t=0,o=this.length-2,n=o;n>t;)this[n].y_<e.y_?t=n:o=n,n=Math.floor((t+o)/2);for(o=t=n;t>=0&&this[t].y_==e.y_;){if(this[t]==e)return this.splice(t,1),void 0;t--}do{if(this[o]==e)return this.splice(o,1),void 0;o++}while(o<this.length&&this[o].y_==e.y_);throw"Unable to find connection in connectionDB."},Blockly.ConnectionDB.init=function(e){var t=[];t[Blockly.INPUT_VALUE]=new Blockly.ConnectionDB,t[Blockly.OUTPUT_VALUE]=new Blockly.ConnectionDB,t[Blockly.NEXT_STATEMENT]=new Blockly.ConnectionDB,t[Blockly.PREVIOUS_STATEMENT]=new Blockly.ConnectionDB,e.connectionDBList=t},Blockly.ContextMenu={},Blockly.ContextMenu.X_PADDING=20,Blockly.ContextMenu.Y_HEIGHT=20,Blockly.ContextMenu.visible=!1,Blockly.ContextMenu.createDom=function(){var e=Blockly.createSvgElement("g",{"class":"blocklyHidden"},null);return Blockly.ContextMenu.svgGroup=e,Blockly.ContextMenu.svgShadow=Blockly.createSvgElement("rect",{"class":"blocklyContextMenuShadow",x:2,y:-2,rx:4,ry:4},e),Blockly.ContextMenu.svgBackground=Blockly.createSvgElement("rect",{"class":"blocklyContextMenuBackground",y:-4,rx:4,ry:4},e),Blockly.ContextMenu.svgOptions=Blockly.createSvgElement("g",{"class":"blocklyContextMenuOptions"},e),e},Blockly.ContextMenu.show=function(e,t){if(t.length){goog.dom.removeChildren(Blockly.ContextMenu.svgOptions),Blockly.ContextMenu.svgGroup.style.display="block";for(var o,n=0,i=[Blockly.ContextMenu.svgBackground,Blockly.ContextMenu.svgShadow],r=0;o=t[r];r++){var s=Blockly.ContextMenu.optionToDom(o.text),l=s.firstChild,a=s.lastChild;Blockly.ContextMenu.svgOptions.appendChild(s),s.setAttribute("transform","translate(0, "+r*Blockly.ContextMenu.Y_HEIGHT+")"),i.push(l),Blockly.bindEvent_(s,"mousedown",null,Blockly.noEvent),o.enabled?(Blockly.bindEvent_(s,"mouseup",null,o.callback),Blockly.bindEvent_(s,"mouseup",null,Blockly.ContextMenu.hide)):s.setAttribute("class","blocklyMenuDivDisabled"),n=Math.max(n,a.getComputedTextLength())}for(n+=2*Blockly.ContextMenu.X_PADDING,r=0;r<i.length;r++)i[r].setAttribute("width",n);if(Blockly.RTL)for(r=0;s=Blockly.ContextMenu.svgOptions.childNodes[r];r++)a=s.lastChild,a.setAttribute("text-anchor","end"),a.setAttribute("x",n-Blockly.ContextMenu.X_PADDING);Blockly.ContextMenu.svgBackground.setAttribute("height",t.length*Blockly.ContextMenu.Y_HEIGHT+8),Blockly.ContextMenu.svgShadow.setAttribute("height",t.length*Blockly.ContextMenu.Y_HEIGHT+10),n=e.x,i=e.y,r=Blockly.ContextMenu.svgGroup.getBBox(),o=Blockly.svgSize(),i+r.height>o.height&&(i-=r.height-10),Blockly.RTL?0>=n-r.width?n++:n-=r.width:n+r.width>o.width?n-=r.width:n++,Blockly.ContextMenu.svgGroup.setAttribute("transform","translate("+n+", "+i+")"),Blockly.ContextMenu.visible=!0}else Blockly.ContextMenu.hide()},Blockly.ContextMenu.optionToDom=function(e){var t=Blockly.createSvgElement("g",{"class":"blocklyMenuDiv"},null);Blockly.createSvgElement("rect",{height:Blockly.ContextMenu.Y_HEIGHT},t);var o=Blockly.createSvgElement("text",{"class":"blocklyMenuText",x:Blockly.ContextMenu.X_PADDING,y:15},t);return e=document.createTextNode(e),o.appendChild(e),t},Blockly.ContextMenu.hide=function(){Blockly.ContextMenu.visible&&(Blockly.ContextMenu.svgGroup.style.display="none",Blockly.ContextMenu.visible=!1)},Blockly.ContextMenu.callbackFactory=function(e,t){return function(){var o=Blockly.Xml.domToBlock_(e.workspace,t),n=e.getRelativeToSurfaceXY();n.x=Blockly.RTL?n.x-Blockly.SNAP_RADIUS:n.x+Blockly.SNAP_RADIUS,n.y+=2*Blockly.SNAP_RADIUS,o.moveBy(n.x,n.y),o.select()}},Blockly.Field=function(e){this.sourceBlock_=null,this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.borderRect_=Blockly.createSvgElement("rect",{rx:4,ry:4,x:-Blockly.BlockSvg.SEP_SPACE_X/2,y:-12,height:16},this.fieldGroup_),this.textElement_=Blockly.createSvgElement("text",{"class":"blocklyText"},this.fieldGroup_),this.size_={height:25,width:0},this.setText(e),this.visible_=!0},Blockly.Field.prototype.clone=function(){goog.asserts.fail("There should never be an instance of Field, only its derived classes.")},Blockly.Field.NBSP=" ",Blockly.Field.prototype.EDITABLE=!0,Blockly.Field.prototype.init=function(e){if(this.sourceBlock_)throw"Field has already been initialized once.";this.sourceBlock_=e,this.updateEditable(),e.getSvgRoot().appendChild(this.fieldGroup_),this.mouseUpWrapper_=Blockly.bindEvent_(this.fieldGroup_,"mouseup",this,this.onMouseUp_),this.setText(null)},Blockly.Field.prototype.dispose=function(){this.mouseUpWrapper_&&(Blockly.unbindEvent_(this.mouseUpWrapper_),this.mouseUpWrapper_=null),this.sourceBlock_=null,goog.dom.removeNode(this.fieldGroup_),this.borderRect_=this.textElement_=this.fieldGroup_=null},Blockly.Field.prototype.updateEditable=function(){this.EDITABLE&&(this.sourceBlock_.isEditable()?(Blockly.addClass_(this.fieldGroup_,"blocklyEditableText"),Blockly.removeClass_(this.fieldGroup_,"blocklyNoNEditableText"),this.fieldGroup_.style.cursor=this.CURSOR):(Blockly.addClass_(this.fieldGroup_,"blocklyNonEditableText"),Blockly.removeClass_(this.fieldGroup_,"blocklyEditableText"),this.fieldGroup_.style.cursor=""))},Blockly.Field.prototype.isVisible=function(){return this.visible_},Blockly.Field.prototype.setVisible=function(e){this.visible_=e,this.getRootElement().style.display=e?"block":"none"},Blockly.Field.prototype.getRootElement=function(){return this.fieldGroup_},Blockly.Field.prototype.render_=function(){var e=this.textElement_.getComputedTextLength();this.borderRect_&&this.borderRect_.setAttribute("width",e+Blockly.BlockSvg.SEP_SPACE_X),this.size_.width=e},Blockly.Field.prototype.getSize=function(){return this.size_.width||this.render_(),this.size_},Blockly.Field.prototype.getText=function(){return this.text_},Blockly.Field.prototype.setText=function(e){null!==e&&e!==this.text_&&(this.text_=e,goog.dom.removeChildren(this.textElement_),e=e.replace(/\s/g,Blockly.Field.NBSP),e||(e=Blockly.Field.NBSP),e=document.createTextNode(e),this.textElement_.appendChild(e),this.size_.width=0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_(),this.sourceBlock_.workspace.fireChangeEvent()))},Blockly.Field.prototype.getValue=function(){return this.getText()},Blockly.Field.prototype.setValue=function(e){this.setText(e)},Blockly.Field.prototype.onMouseUp_=function(e){Blockly.isRightButton(e)||2!=Blockly.Block.dragMode_&&this.sourceBlock_.isEditable()&&this.showEditor_()},Blockly.Field.prototype.setTooltip=function(){},Blockly.Tooltip={},Blockly.Tooltip.visible=!1,Blockly.Tooltip.mouseOutPid_=0,Blockly.Tooltip.showPid_=0,Blockly.Tooltip.lastXY_={x:0,y:0},Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.svgGroup_=null,Blockly.Tooltip.svgText_=null,Blockly.Tooltip.svgBackground_=null,Blockly.Tooltip.svgShadow_=null,Blockly.Tooltip.OFFSET_X=0,Blockly.Tooltip.OFFSET_Y=10,Blockly.Tooltip.RADIUS_OK=10,Blockly.Tooltip.HOVER_MS=1e3,Blockly.Tooltip.MARGINS=5,Blockly.Tooltip.createDom=function(){var e=Blockly.createSvgElement("g",{"class":"blocklyHidden"},null);return Blockly.Tooltip.svgGroup_=e,Blockly.Tooltip.svgShadow_=Blockly.createSvgElement("rect",{"class":"blocklyTooltipShadow",x:2,y:2},e),Blockly.Tooltip.svgBackground_=Blockly.createSvgElement("rect",{"class":"blocklyTooltipBackground"},e),Blockly.Tooltip.svgText_=Blockly.createSvgElement("text",{"class":"blocklyTooltipText"},e),e},Blockly.Tooltip.bindMouseEvents=function(e){Blockly.bindEvent_(e,"mouseover",null,Blockly.Tooltip.onMouseOver_),Blockly.bindEvent_(e,"mouseout",null,Blockly.Tooltip.onMouseOut_),Blockly.bindEvent_(e,"mousemove",null,Blockly.Tooltip.onMouseMove_)},Blockly.Tooltip.onMouseOver_=function(e){for(e=e.target;!goog.isString(e.tooltip)&&!goog.isFunction(e.tooltip);)e=e.tooltip;Blockly.Tooltip.element_!=e&&(Blockly.Tooltip.hide(),Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.element_=e),window.clearTimeout(Blockly.Tooltip.mouseOutPid_)},Blockly.Tooltip.onMouseOut_=function(){Blockly.Tooltip.mouseOutPid_=window.setTimeout(function(){Blockly.Tooltip.element_=null,Blockly.Tooltip.poisonedElement_=null,Blockly.Tooltip.hide()},1),window.clearTimeout(Blockly.Tooltip.showPid_)},Blockly.Tooltip.onMouseMove_=function(e){if(Blockly.Tooltip.element_&&Blockly.Tooltip.element_.tooltip&&!(Blockly.ContextMenu&&Blockly.ContextMenu.visible||0!=Blockly.Block.dragMode_))if(Blockly.Tooltip.visible){e=Blockly.mouseToSvg(e);var t=Blockly.Tooltip.lastXY_.y-e.y;Math.sqrt(Math.pow(Blockly.Tooltip.lastXY_.x-e.x,2)+Math.pow(t,2))>Blockly.Tooltip.RADIUS_OK&&Blockly.Tooltip.hide()}else Blockly.Tooltip.poisonedElement_!=Blockly.Tooltip.element_&&(window.clearTimeout(Blockly.Tooltip.showPid_),Blockly.Tooltip.lastXY_=Blockly.mouseToSvg(e),Blockly.Tooltip.showPid_=window.setTimeout(Blockly.Tooltip.show_,Blockly.Tooltip.HOVER_MS))},Blockly.Tooltip.hide=function(){Blockly.Tooltip.visible&&(Blockly.Tooltip.visible=!1,Blockly.Tooltip.svgGroup_&&(Blockly.Tooltip.svgGroup_.style.display="none")),window.clearTimeout(Blockly.Tooltip.showPid_)},Blockly.Tooltip.show_=function(){if(Blockly.Tooltip.poisonedElement_=Blockly.Tooltip.element_,Blockly.Tooltip.svgGroup_){goog.dom.removeChildren(Blockly.Tooltip.svgText_);var e=Blockly.Tooltip.element_.tooltip;goog.isFunction(e)&&(e=e());for(var e=e.split("\n"),t=0;t<e.length;t++){var o=Blockly.createSvgElement("tspan",{dy:"1em",x:Blockly.Tooltip.MARGINS},Blockly.Tooltip.svgText_),n=document.createTextNode(e[t]);o.appendChild(n)}if(Blockly.Tooltip.visible=!0,Blockly.Tooltip.svgGroup_.style.display="block",e=Blockly.Tooltip.svgText_.getBBox(),t=2*Blockly.Tooltip.MARGINS+e.width,o=e.height,Blockly.Tooltip.svgBackground_.setAttribute("width",t),Blockly.Tooltip.svgBackground_.setAttribute("height",o),Blockly.Tooltip.svgShadow_.setAttribute("width",t),Blockly.Tooltip.svgShadow_.setAttribute("height",o),Blockly.RTL)for(var i,o=e.width,n=0;i=Blockly.Tooltip.svgText_.childNodes[n];n++)i.setAttribute("text-anchor","end"),i.setAttribute("x",o+Blockly.Tooltip.MARGINS);o=Blockly.Tooltip.lastXY_.x,o=Blockly.RTL?o-(Blockly.Tooltip.OFFSET_X+t):o+Blockly.Tooltip.OFFSET_X,t=Blockly.Tooltip.lastXY_.y+Blockly.Tooltip.OFFSET_Y,n=Blockly.svgSize(),t+e.height>n.height&&(t-=e.height+2*Blockly.Tooltip.OFFSET_Y),Blockly.RTL?o=Math.max(Blockly.Tooltip.MARGINS,o):o+e.width>n.width-2*Blockly.Tooltip.MARGINS&&(o=n.width-e.width-2*Blockly.Tooltip.MARGINS),Blockly.Tooltip.svgGroup_.setAttribute("transform","translate("+o+","+t+")")}},Blockly.FieldLabel=function(e){this.sourceBlock_=null,this.textElement_=Blockly.createSvgElement("text",{"class":"blocklyText"},null),this.size_={height:25,width:0},this.setText(e)},goog.inherits(Blockly.FieldLabel,Blockly.Field),Blockly.FieldLabel.prototype.clone=function(){return new Blockly.FieldLabel(this.getText())},Blockly.FieldLabel.prototype.EDITABLE=!1,Blockly.FieldLabel.prototype.init=function(e){if(this.sourceBlock_)throw"Text has already been initialized once.";this.sourceBlock_=e,e.getSvgRoot().appendChild(this.textElement_),this.textElement_.tooltip=this.sourceBlock_,Blockly.Tooltip&&Blockly.Tooltip.bindMouseEvents(this.textElement_)},Blockly.FieldLabel.prototype.dispose=function(){goog.dom.removeNode(this.textElement_),this.textElement_=null},Blockly.FieldLabel.prototype.getRootElement=function(){return this.textElement_},Blockly.FieldLabel.prototype.setTooltip=function(e){this.textElement_.tooltip=e},Blockly.Input=function(e,t,o,n){this.type=e,this.name=t,this.sourceBlock_=o,this.connection=n,this.fieldRow=[],this.align=Blockly.ALIGN_LEFT,this.visible_=!0},Blockly.Input.prototype.appendField=function(e,t){return e||t?(goog.isString(e)&&(e=new Blockly.FieldLabel(e)),this.sourceBlock_.svg_&&e.init(this.sourceBlock_),e.name=t,e.prefixField&&this.appendField(e.prefixField),this.fieldRow.push(e),e.suffixField&&this.appendField(e.suffixField),this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()),this):this
27
- },Blockly.Input.prototype.appendTitle=function(e,t){console.log("Deprecated call to appendTitle, use appendField instead."),this.appendField(e,t)},Blockly.Input.prototype.removeField=function(e){for(var t,o=0;t=this.fieldRow[o];o++)if(t.name===e)return t.dispose(),this.fieldRow.splice(o,1),this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_()),void 0;goog.asserts.fail('Field "%s" not found.',e)},Blockly.Input.prototype.isVisible=function(){return this.visible_},Blockly.Input.prototype.setVisible=function(e){var t=[];if(this.visible_==e)return t;for(var o,n=(this.visible_=e)?"block":"none",i=0;o=this.fieldRow[i];i++)o.setVisible(e);return this.connection&&(t=e?this.connection.unhideAll():this.connection.hideAll(),i=this.connection.targetBlock())&&(i.svg_.getRootElement().style.display=n,e||(i.rendered=!1)),t},Blockly.Input.prototype.setCheck=function(e){if(!this.connection)throw"This input does not have a connection.";return this.connection.setCheck(e),this},Blockly.Input.prototype.setAlign=function(e){return this.align=e,this.sourceBlock_.rendered&&this.sourceBlock_.render(),this},Blockly.Input.prototype.init=function(){for(var e=0;e<this.fieldRow.length;e++)this.fieldRow[e].init(this.sourceBlock_)},Blockly.Input.prototype.dispose=function(){for(var e,t=0;e=this.fieldRow[t];t++)e.dispose();this.connection&&this.connection.dispose(),this.sourceBlock_=null},Blockly.Msg={},Blockly.Mutator=function(e){Blockly.Mutator.superClass_.constructor.call(this,null),this.quarkXml_=[];for(var t=0;t<e.length;t++){var o=goog.dom.createDom("block",{type:e[t]});this.quarkXml_[t]=o}},goog.inherits(Blockly.Mutator,Blockly.Icon),Blockly.Mutator.prototype.workspaceWidth_=0,Blockly.Mutator.prototype.workspaceHeight_=0,Blockly.Mutator.prototype.createIcon=function(){Blockly.Icon.prototype.createIcon_.call(this);var e=Blockly.Icon.RADIUS/2;Blockly.createSvgElement("rect",{"class":"blocklyIconShield",width:4*e,height:4*e,rx:e,ry:e},this.iconGroup_),this.iconMark_=Blockly.createSvgElement("text",{"class":"blocklyIconMark",x:Blockly.Icon.RADIUS,y:2*Blockly.Icon.RADIUS-4},this.iconGroup_),this.iconMark_.appendChild(document.createTextNode("★"))},Blockly.Mutator.prototype.createEditor_=function(){this.svgDialog_=Blockly.createSvgElement("svg",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null),this.svgBackground_=Blockly.createSvgElement("rect",{"class":"blocklyMutatorBackground",height:"100%",width:"100%"},this.svgDialog_);var e=this;return this.workspace_=new Blockly.Workspace(function(){return e.getFlyoutMetrics_()},null),this.flyout_=new Blockly.Flyout,this.flyout_.autoClose=!1,this.svgDialog_.appendChild(this.flyout_.createDom()),this.svgDialog_.appendChild(this.workspace_.createDom()),this.svgDialog_},Blockly.Mutator.prototype.resizeBubble_=function(){var e,t=2*Blockly.Bubble.BORDER_WIDTH,o=this.workspace_.getCanvas().getBBox(),n=this.flyout_.getMetrics_();e=Blockly.RTL?-o.x:o.width+o.x,o=Math.max(o.height+3*t,n.contentHeight+20),e+=3*t,(Math.abs(this.workspaceWidth_-e)>t||Math.abs(this.workspaceHeight_-o)>t)&&(this.workspaceWidth_=e,this.workspaceHeight_=o,this.bubble_.setBubbleSize(e+t,o+t),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height",this.workspaceHeight_)),Blockly.RTL&&(t="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",t))},Blockly.Mutator.prototype.setVisible=function(e){if(e!=this.isVisible())if(e){this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.svg_.svgGroup_,this.iconX_,this.iconY_,null,null);var t=this;this.flyout_.init(this.workspace_,!1),this.flyout_.show(this.quarkXml_),this.rootBlock_=this.block_.decompose(this.workspace_),e=this.rootBlock_.getDescendants();for(var o,n=0;o=e[n];n++)o.render();this.rootBlock_.setMovable(!1),this.rootBlock_.setDeletable(!1),e=2*this.flyout_.CORNER_RADIUS,n=this.flyout_.width_+e,Blockly.RTL&&(n=-n),this.rootBlock_.moveBy(n,e),this.block_.saveConnections&&(this.block_.saveConnections(this.rootBlock_),this.sourceListener_=Blockly.bindEvent_(this.block_.workspace.getCanvas(),"blocklyWorkspaceChange",this.block_,function(){t.block_.saveConnections(t.rootBlock_)})),this.resizeBubble_(),Blockly.bindEvent_(this.workspace_.getCanvas(),"blocklyWorkspaceChange",this.block_,function(){t.workspaceChanged_()}),this.updateColour()}else this.svgBackground_=this.svgDialog_=null,this.flyout_.dispose(),this.flyout_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,this.bubble_.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(Blockly.unbindEvent_(this.sourceListener_),this.sourceListener_=null)},Blockly.Mutator.prototype.workspaceChanged_=function(){if(0==Blockly.Block.dragMode_)for(var e,t=this.workspace_.getTopBlocks(!1),o=0;e=t[o];o++){var n=e.getRelativeToSurfaceXY(),i=e.getHeightWidth();(Blockly.RTL?n.x>-this.flyout_.width_+20:n.x<this.flyout_.width_-20)?e.dispose(!1,!0):20>n.y+i.height&&e.moveBy(0,20-i.height-n.y)}this.rootBlock_.workspace==this.workspace_&&(t=this.block_.rendered,this.block_.rendered=!1,this.block_.compose(this.rootBlock_),this.block_.rendered=t,this.block_.rendered&&this.block_.render(),this.resizeBubble_(),this.block_.workspace.fireChangeEvent())},Blockly.Mutator.prototype.getFlyoutMetrics_=function(){var e=0;return Blockly.RTL&&(e+=this.workspaceWidth_),{viewHeight:this.workspaceHeight_,viewWidth:0,absoluteTop:0,absoluteLeft:e}},Blockly.Mutator.prototype.dispose=function(){this.block_.mutator=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.Warning=function(e){Blockly.Warning.superClass_.constructor.call(this,e),this.createIcon_()},goog.inherits(Blockly.Warning,Blockly.Icon),Blockly.Warning.prototype.text_="",Blockly.Warning.prototype.createIcon_=function(){Blockly.Icon.prototype.createIcon_.call(this),Blockly.createSvgElement("path",{"class":"blocklyIconShield",d:"M 2,15 Q -1,15 0.5,12 L 6.5,1.7 Q 8,-1 9.5,1.7 L 15.5,12 Q 17,15 14,15 z"},this.iconGroup_),this.iconMark_=Blockly.createSvgElement("text",{"class":"blocklyIconMark",x:Blockly.Icon.RADIUS,y:2*Blockly.Icon.RADIUS-3},this.iconGroup_),this.iconMark_.appendChild(document.createTextNode("!"))},Blockly.Warning.prototype.textToDom_=function(e){var t=Blockly.createSvgElement("text",{"class":"blocklyText",y:Blockly.Bubble.BORDER_WIDTH},null);e=e.split("\n");for(var o=0;o<e.length;o++){var n=Blockly.createSvgElement("tspan",{dy:"1em",x:Blockly.Bubble.BORDER_WIDTH},t),i=document.createTextNode(e[o]);n.appendChild(i)}return t},Blockly.Warning.prototype.setVisible=function(e){if(e!=this.isVisible())if(e){if(e=this.textToDom_(this.text_),this.bubble_=new Blockly.Bubble(this.block_.workspace,e,this.block_.svg_.svgGroup_,this.iconX_,this.iconY_,null,null),Blockly.RTL)for(var t,o=e.getBBox().width,n=0;t=e.childNodes[n];n++)t.setAttribute("text-anchor","end"),t.setAttribute("x",o+Blockly.Bubble.BORDER_WIDTH);this.updateColour(),e=this.bubble_.getBubbleSize(),this.bubble_.setBubbleSize(e.width,e.height)}else this.bubble_.dispose(),this.foreignObject_=this.body_=this.bubble_=null},Blockly.Warning.prototype.bodyFocus_=function(){this.bubble_.promote_()},Blockly.Warning.prototype.setText=function(e){this.text_=e,this.isVisible()&&(this.setVisible(!1),this.setVisible(!0))},Blockly.Warning.prototype.dispose=function(){this.block_.warning=null,Blockly.Icon.prototype.dispose.call(this)},Blockly.uidCounter_=0,Blockly.Block=function(e,t){if(this.id=++Blockly.uidCounter_,this.previousConnection=this.nextConnection=this.outputConnection=null,this.inputList=[],this.disabled=this.rendered=this.inputsInline=!1,this.tooltip="",this.contextMenu=!0,this.parentBlock_=null,this.childBlocks_=[],this.editable_=this.movable_=this.deletable_=!0,this.collapsed_=!1,this.workspace=e,this.isInFlyout=e.isFlyout,e.addTopBlock(this),t){this.type=t;var o=Blockly.Blocks[t];goog.asserts.assertObject(o,'Error: "%s" is an unknown language block.',t),goog.mixin(this,o)}goog.isFunction(this.init)&&this.init(),goog.isFunction(this.onchange)&&Blockly.bindEvent_(e.getCanvas(),"blocklyWorkspaceChange",this,this.onchange)},Blockly.Block.prototype.svg_=null,Blockly.Block.prototype.mutator=null,Blockly.Block.prototype.comment=null,Blockly.Block.prototype.warning=null,Blockly.Block.prototype.getIcons=function(){var e=[];return this.mutator&&e.push(this.mutator),this.comment&&e.push(this.comment),this.warning&&e.push(this.warning),e},Blockly.Block.prototype.initSvg=function(){this.svg_=new Blockly.BlockSvg(this),this.svg_.init(),Blockly.readOnly||Blockly.bindEvent_(this.svg_.getRootElement(),"mousedown",this,this.onMouseDown_),this.workspace.getCanvas().appendChild(this.svg_.getRootElement())},Blockly.Block.prototype.getSvgRoot=function(){return this.svg_&&this.svg_.getRootElement()},Blockly.Block.dragMode_=0,Blockly.Block.onMouseUpWrapper_=null,Blockly.Block.onMouseMoveWrapper_=null,Blockly.Block.terminateDrag_=function(){Blockly.Block.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Block.onMouseUpWrapper_),Blockly.Block.onMouseUpWrapper_=null),Blockly.Block.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Block.onMouseMoveWrapper_),Blockly.Block.onMouseMoveWrapper_=null);var e=Blockly.selected;if(2==Blockly.Block.dragMode_&&e){var t=e.getRelativeToSurfaceXY();e.moveConnections_(t.x-e.startDragX,t.y-e.startDragY),delete e.draggedBubbles_,e.setDragging_(!1),e.render(),goog.Timer.callOnce(e.bumpNeighbours_,Blockly.BUMP_DELAY,e),Blockly.fireUiEvent(window,"resize")}e&&e.workspace.fireChangeEvent(),Blockly.Block.dragMode_=0},Blockly.Block.prototype.select=function(){goog.asserts.assertObject(this.svg_,"Block is not rendered."),Blockly.selected&&Blockly.selected.unselect(),Blockly.selected=this,this.svg_.addSelect(),Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")},Blockly.Block.prototype.unselect=function(){goog.asserts.assertObject(this.svg_,"Block is not rendered."),Blockly.selected=null,this.svg_.removeSelect(),Blockly.fireUiEvent(this.workspace.getCanvas(),"blocklySelectChange")},Blockly.Block.prototype.dispose=function(e,t){this.rendered=!1,this.unplug(e),t&&this.svg_&&this.svg_.disposeUiEffect(),this.workspace.removeTopBlock(this),this.workspace=null,Blockly.selected==this&&(Blockly.selected=null,Blockly.terminateDrag_());for(var o=this.childBlocks_.length-1;o>=0;o--)this.childBlocks_[o].dispose(!1);for(var n=this.getIcons(),o=0;o<n.length;o++)n[o].dispose();for(o=0;n=this.inputList[o];o++)n.dispose();for(this.inputList=[],n=this.getConnections_(!0),o=0;o<n.length;o++){var i=n[o];i.targetConnection&&i.disconnect(),n[o].dispose()}this.svg_&&(this.svg_.dispose(),this.svg_=null)},Blockly.Block.prototype.unplug=function(e,t){if(t=t&&!!this.getParent(),this.outputConnection)this.outputConnection.targetConnection&&this.setParent(null);else{var o=null;if(this.previousConnection&&this.previousConnection.targetConnection&&(o=this.previousConnection.targetConnection,this.setParent(null)),e&&this.nextConnection&&this.nextConnection.targetConnection){var n=this.nextConnection.targetConnection;this.nextConnection.targetBlock().setParent(null),o&&o.connect(n)}}t&&this.moveBy(Blockly.SNAP_RADIUS*(Blockly.RTL?-1:1),2*Blockly.SNAP_RADIUS)},Blockly.Block.prototype.getRelativeToSurfaceXY=function(){var e=0,t=0;if(this.svg_){var o=this.svg_.getRootElement();do var n=Blockly.getRelativeXY_(o),e=e+n.x,t=t+n.y,o=o.parentNode;while(o&&o!=this.workspace.getCanvas())}return{x:e,y:t}},Blockly.Block.prototype.moveBy=function(e,t){var o=this.getRelativeToSurfaceXY();this.svg_.getRootElement().setAttribute("transform","translate("+(o.x+e)+", "+(o.y+t)+")"),this.moveConnections_(e,t)},Blockly.Block.prototype.getHeightWidth=function(){try{var e=this.getSvgRoot().getBBox(),t=e.height}catch(o){return{height:0,width:0}}return Blockly.BROKEN_CONTROL_POINTS&&(t-=10,this.nextConnection&&(t+=4)),{height:t-1,width:e.width}},Blockly.Block.prototype.onMouseDown_=function(e){if(!this.isInFlyout){if(Blockly.svgResize(),Blockly.terminateDrag_(),this.select(),Blockly.hideChaff(),Blockly.isRightButton(e))Blockly.ContextMenu&&this.showContextMenu_(Blockly.mouseToSvg(e));else{if(!this.isMovable())return;Blockly.removeAllRanges(),Blockly.setCursorHand_(!0);var t=this.getRelativeToSurfaceXY();this.startDragX=t.x,this.startDragY=t.y,this.startDragMouseX=e.clientX,this.startDragMouseY=e.clientY,Blockly.Block.dragMode_=1,Blockly.Block.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,this.onMouseUp_),Blockly.Block.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,this.onMouseMove_),this.draggedBubbles_=[];for(var o,t=this.getDescendants(),n=0;o=t[n];n++){o=o.getIcons();for(var i=0;i<o.length;i++){var r=o[i].getIconLocation();r.bubble=o[i],this.draggedBubbles_.push(r)}}}e.stopPropagation()}},Blockly.Block.prototype.onMouseUp_=function(e){Blockly.terminateDrag_(),Blockly.selected&&Blockly.highlightedConnection_?(Blockly.localConnection_.connect(Blockly.highlightedConnection_),this.svg_&&(Blockly.localConnection_.isSuperior()?Blockly.highlightedConnection_:Blockly.localConnection_).sourceBlock_.svg_.connectionUiEffect(),this.workspace.trashcan&&this.workspace.trashcan.isOpen&&this.workspace.trashcan.close()):this.workspace.trashcan&&this.workspace.trashcan.isOpen&&(e=this.workspace.trashcan,goog.Timer.callOnce(e.close,100,e),Blockly.selected.dispose(!1,!0),Blockly.fireUiEvent(window,"resize")),Blockly.highlightedConnection_&&(Blockly.highlightedConnection_.unhighlight(),Blockly.highlightedConnection_=null)},Blockly.Block.prototype.showHelp_=function(){var e=goog.isFunction(this.helpUrl)?this.helpUrl():this.helpUrl;e&&window.open(e)},Blockly.Block.prototype.duplicate_=function(){var e=Blockly.Xml.blockToDom_(this);Blockly.Xml.deleteNext(e);var e=Blockly.Xml.domToBlock_(this.workspace,e),t=this.getRelativeToSurfaceXY();return t.x=Blockly.RTL?t.x-Blockly.SNAP_RADIUS:t.x+Blockly.SNAP_RADIUS,t.y+=2*Blockly.SNAP_RADIUS,e.moveBy(t.x,t.y),e},Blockly.Block.prototype.showContextMenu_=function(e){if(!Blockly.readOnly&&this.contextMenu){var t=this,o=[];if(this.isDeletable()&&!t.isInFlyout){var n={text:Blockly.Msg.DUPLICATE_BLOCK,enabled:!0,callback:function(){t.duplicate_()}};if(this.getDescendants().length>this.workspace.remainingCapacity()&&(n.enabled=!1),o.push(n),Blockly.Comment&&!this.collapsed_&&(n={enabled:!0},this.comment?(n.text=Blockly.Msg.REMOVE_COMMENT,n.callback=function(){t.setCommentText(null)}):(n.text=Blockly.Msg.ADD_COMMENT,n.callback=function(){t.setCommentText("")}),o.push(n)),!this.collapsed_)for(n=0;n<this.inputList.length;n++)if(this.inputList[n].type==Blockly.INPUT_VALUE){n={enabled:!0},n.text=this.inputsInline?Blockly.Msg.EXTERNAL_INPUTS:Blockly.Msg.INLINE_INPUTS,n.callback=function(){t.setInputsInline(!t.inputsInline)},o.push(n);break}Blockly.collapse&&(this.collapsed_?(n={enabled:!0},n.text=Blockly.Msg.EXPAND_BLOCK,n.callback=function(){t.setCollapsed(!1)}):(n={enabled:!0},n.text=Blockly.Msg.COLLAPSE_BLOCK,n.callback=function(){t.setCollapsed(!0)}),o.push(n)),n={text:this.disabled?Blockly.Msg.ENABLE_BLOCK:Blockly.Msg.DISABLE_BLOCK,enabled:!this.getInheritedDisabled(),callback:function(){t.setDisabled(!t.disabled)}},o.push(n),n=this.getDescendants().length,t.nextConnection&&t.nextConnection.targetConnection&&(n-=this.nextConnection.targetBlock().getDescendants().length),n={text:1==n?Blockly.Msg.DELETE_BLOCK:Blockly.Msg.DELETE_X_BLOCKS.replace("%1",n),enabled:!0,callback:function(){t.dispose(!0,!0)}},o.push(n)}n={enabled:!(goog.isFunction(this.helpUrl)?!this.helpUrl():!this.helpUrl)},n.text=Blockly.Msg.HELP,n.callback=function(){t.showHelp_()},o.push(n),this.customContextMenu&&!t.isInFlyout&&this.customContextMenu(o),Blockly.ContextMenu.show(e,o)}},Blockly.Block.prototype.getConnections_=function(e){var t=[];if((e||this.rendered)&&(this.outputConnection&&t.push(this.outputConnection),this.nextConnection&&t.push(this.nextConnection),this.previousConnection&&t.push(this.previousConnection),e||!this.collapsed_)){e=0;for(var o;o=this.inputList[e];e++)o.connection&&t.push(o.connection)}return t},Blockly.Block.prototype.moveConnections_=function(e,t){if(this.rendered){for(var o=this.getConnections_(!1),n=0;n<o.length;n++)o[n].moveBy(e,t);for(o=this.getIcons(),n=0;n<o.length;n++)o[n].computeIconLocation();for(n=0;n<this.childBlocks_.length;n++)this.childBlocks_[n].moveConnections_(e,t)}},Blockly.Block.prototype.setDragging_=function(e){e?this.svg_.addDragging():this.svg_.removeDragging();for(var t=0;t<this.childBlocks_.length;t++)this.childBlocks_[t].setDragging_(e)},Blockly.Block.prototype.onMouseMove_=function(e){if(!("mousemove"==e.type&&1>=e.clientX&&0==e.clientY&&0==e.button)){Blockly.removeAllRanges();var t=e.clientX-this.startDragMouseX,o=e.clientY-this.startDragMouseY;if(1==Blockly.Block.dragMode_&&Math.sqrt(Math.pow(t,2)+Math.pow(o,2))>Blockly.DRAG_RADIUS&&(Blockly.Block.dragMode_=2,this.setParent(null),this.setDragging_(!0)),2==Blockly.Block.dragMode_){var n=this.startDragX+t,i=this.startDragY+o;for(this.svg_.getRootElement().setAttribute("transform","translate("+n+", "+i+")"),n=0;n<this.draggedBubbles_.length;n++)i=this.draggedBubbles_[n],i.bubble.setIconLocation(i.x+t,i.y+o);for(var i=this.getConnections_(!1),r=null,s=null,l=Blockly.SNAP_RADIUS,n=0;n<i.length;n++){var a=i[n],c=a.closest(l,t,o);c.connection&&(r=c.connection,s=a,l=c.radius)}Blockly.highlightedConnection_&&Blockly.highlightedConnection_!=r&&(Blockly.highlightedConnection_.unhighlight(),Blockly.highlightedConnection_=null,Blockly.localConnection_=null),r&&r!=Blockly.highlightedConnection_&&(r.highlight(),Blockly.highlightedConnection_=r,Blockly.localConnection_=s),this.workspace.trashcan&&this.isDeletable()&&this.workspace.trashcan.onMouseMove(e)}}e.stopPropagation()},Blockly.Block.prototype.bumpNeighbours_=function(){if(0==Blockly.Block.dragMode_){var e=this.getRootBlock();if(!e.isInFlyout)for(var t=this.getConnections_(!1),o=0;o<t.length;o++){var n=t[o];n.targetConnection&&n.isSuperior()&&n.targetBlock().bumpNeighbours_();for(var i=n.neighbours_(Blockly.SNAP_RADIUS),r=0;r<i.length;r++){var s=i[r];n.targetConnection&&s.targetConnection||s.sourceBlock_.getRootBlock()!=e&&(n.isSuperior()?s.bumpAwayFrom_(n):n.bumpAwayFrom_(s))}}}},Blockly.Block.prototype.getParent=function(){return this.parentBlock_},Blockly.Block.prototype.getSurroundParent=function(){for(var e=this;;){do{var t=e,e=e.getParent();if(!e)return null}while(e.nextConnection&&e.nextConnection.targetBlock()==t);return e}},Blockly.Block.prototype.getRootBlock=function(){var e,t=this;do e=t,t=e.parentBlock_;while(t);return e},Blockly.Block.prototype.getChildren=function(){return this.childBlocks_},Blockly.Block.prototype.setParent=function(e){if(this.parentBlock_){for(var t,o=this.parentBlock_.childBlocks_,n=0;t=o[n];n++)if(t==this){o.splice(n,1);break}o=this.getRelativeToSurfaceXY(),this.workspace.getCanvas().appendChild(this.svg_.getRootElement()),this.svg_.getRootElement().setAttribute("transform","translate("+o.x+", "+o.y+")"),this.parentBlock_=null,this.previousConnection&&this.previousConnection.targetConnection&&this.previousConnection.disconnect(),this.outputConnection&&this.outputConnection.targetConnection&&this.outputConnection.disconnect()}else this.workspace.removeTopBlock(this);(this.parentBlock_=e)?(e.childBlocks_.push(this),o=this.getRelativeToSurfaceXY(),e.svg_&&this.svg_&&e.svg_.getRootElement().appendChild(this.svg_.getRootElement()),e=this.getRelativeToSurfaceXY(),this.moveConnections_(e.x-o.x,e.y-o.y)):this.workspace.addTopBlock(this)},Blockly.Block.prototype.getDescendants=function(){for(var e,t=[this],o=0;e=this.childBlocks_[o];o++)t=t.concat(e.getDescendants());return t},Blockly.Block.prototype.isDeletable=function(){return this.deletable_&&!Blockly.readOnly},Blockly.Block.prototype.setDeletable=function(e){this.deletable_=e,this.svg_&&this.svg_.updateMovable()},Blockly.Block.prototype.isMovable=function(){return this.movable_&&!Blockly.readOnly},Blockly.Block.prototype.setMovable=function(e){this.movable_=e},Blockly.Block.prototype.isEditable=function(){return this.editable_&&!Blockly.readOnly},Blockly.Block.prototype.setEditable=function(e){this.editable_=e,e=0;for(var t;t=this.inputList[e];e++)for(var o,n=0;o=t.fieldRow[n];n++)o.updateEditable();for(t=this.getIcons(),e=0;e<t.length;e++)t[e].updateEditable()},Blockly.Block.prototype.setHelpUrl=function(e){this.helpUrl=e},Blockly.Block.prototype.getColour=function(){return this.colourHue_},Blockly.Block.prototype.setColour=function(e){this.colourHue_=e,this.svg_&&this.svg_.updateColour();var t=this.getIcons();for(e=0;e<t.length;e++)t[e].updateColour();if(this.rendered){for(e=0;t=this.inputList[e];e++)for(var o,n=0;o=t.fieldRow[n];n++)o.setText(null);this.render()}},Blockly.Block.prototype.getField_=function(e){for(var t,o=0;t=this.inputList[o];o++)for(var n,i=0;n=t.fieldRow[i];i++)if(n.name===e)return n;return null},Blockly.Block.prototype.getFieldValue=function(e){return(e=this.getField_(e))?e.getValue():null},Blockly.Block.prototype.getTitleValue=function(e){return console.log("Deprecated call to getTitleValue, use getFieldValue instead."),this.getFieldValue(e)},Blockly.Block.prototype.setFieldValue=function(e,t){var o=this.getField_(t);goog.asserts.assertObject(o,'Field "%s" not found.',t),o.setValue(e)},Blockly.Block.prototype.setTitleValue=function(e,t){console.log("Deprecated call to setTitleValue, use setFieldValue instead."),this.setFieldValue(e,t)},Blockly.Block.prototype.setTooltip=function(e){this.tooltip=e},Blockly.Block.prototype.setPreviousStatement=function(e,t){this.previousConnection&&(goog.asserts.assert(!this.previousConnection.targetConnection,"Must disconnect previous statement before removing connection."),this.previousConnection.dispose(),this.previousConnection=null),e&&(goog.asserts.assert(!this.outputConnection,"Remove output connection prior to adding previous connection."),void 0===t&&(t=null),this.previousConnection=new Blockly.Connection(this,Blockly.PREVIOUS_STATEMENT),this.previousConnection.setCheck(t)),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.Block.prototype.setNextStatement=function(e,t){this.nextConnection&&(goog.asserts.assert(!this.nextConnection.targetConnection,"Must disconnect next statement before removing connection."),this.nextConnection.dispose(),this.nextConnection=null),e&&(void 0===t&&(t=null),this.nextConnection=new Blockly.Connection(this,Blockly.NEXT_STATEMENT),this.nextConnection.setCheck(t)),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.Block.prototype.setOutput=function(e,t){this.outputConnection&&(goog.asserts.assert(!this.outputConnection.targetConnection,"Must disconnect output value before removing connection."),this.outputConnection.dispose(),this.outputConnection=null),e&&(goog.asserts.assert(!this.previousConnection,"Remove previous connection prior to adding output connection."),void 0===t&&(t=null),this.outputConnection=new Blockly.Connection(this,Blockly.OUTPUT_VALUE),this.outputConnection.setCheck(t)),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.Block.prototype.changeOutput=function(e){goog.asserts.assert(this.outputConnection,"Only use changeOutput() on blocks that already have an output."),this.outputConnection.setCheck(e)},Blockly.Block.prototype.setInputsInline=function(e){this.inputsInline=e,this.rendered&&(this.render(),this.bumpNeighbours_(),this.workspace.fireChangeEvent())},Blockly.Block.prototype.setDisabled=function(e){this.disabled!=e&&(this.disabled=e,this.svg_.updateDisabled(),this.workspace.fireChangeEvent())},Blockly.Block.prototype.getInheritedDisabled=function(){for(var e=this;;){if(e=e.getSurroundParent(),!e)return!1;if(e.disabled)return!0}},Blockly.Block.prototype.isCollapsed=function(){return this.collapsed_},Blockly.Block.prototype.setCollapsed=function(e){if(this.collapsed_!=e){this.collapsed_=e;for(var t,o=[],n=0;t=this.inputList[n];n++)o=o.concat(t.setVisible(!e));if(e){for(e=this.getIcons(),n=0;n<e.length;n++)e[n].setVisible(!1);n=this.toString(Blockly.COLLAPSE_CHARS),this.appendDummyInput("_TEMP_COLLAPSED_INPUT").appendField(n)}else this.removeInput("_TEMP_COLLAPSED_INPUT");if(o.length||(o[0]=this),this.rendered){for(n=0;e=o[n];n++)e.render();this.bumpNeighbours_()}}},Blockly.Block.prototype.toString=function(e){for(var t,o=[],n=0;t=this.inputList[n];n++){for(var i,r=0;i=t.fieldRow[r];r++)o.push(i.getText());t.connection&&((t=t.connection.targetBlock())?o.push(t.toString()):o.push("?"))}return o=goog.string.trim(o.join(" "))||"???",e&&(o=goog.string.truncate(o,e)),o},Blockly.Block.prototype.appendValueInput=function(e){return this.appendInput_(Blockly.INPUT_VALUE,e)},Blockly.Block.prototype.appendStatementInput=function(e){return this.appendInput_(Blockly.NEXT_STATEMENT,e)},Blockly.Block.prototype.appendDummyInput=function(e){return this.appendInput_(Blockly.DUMMY_INPUT,e||"")},Blockly.Block.prototype.interpolateMsg=function(e){goog.asserts.assertString(e);var t=arguments[arguments.length-1];goog.asserts.assert(t===Blockly.ALIGN_LEFT||t===Blockly.ALIGN_CENTRE||t===Blockly.ALIGN_RIGHT,'Illegal final argument "%d" is not an alignment.',t),arguments.length-=1;for(var o=e.split(/(%\d)/),n=0;n<o.length;n+=2){var i=goog.string.trim(o[n]),r=o[n+1];if(r){var s=parseInt(r.charAt(1),10),l=arguments[s];goog.asserts.assertArray(l,'Message symbol "%s" is out of range.',r),this.appendValueInput(l[0]).setCheck(l[1]).setAlign(l[2]).appendField(i),arguments[s]=null}else i&&this.appendDummyInput().setAlign(t).appendField(i)}for(n=1;n<arguments.length-1;n++)goog.asserts.assert(null===arguments[n],'Input "%%s" not used in message: "%s"',n,e);this.setInputsInline(!e.match(/%1\s*$/))},Blockly.Block.prototype.appendInput_=function(e,t){var o=null;return(e==Blockly.INPUT_VALUE||e==Blockly.NEXT_STATEMENT)&&(o=new Blockly.Connection(this,e)),o=new Blockly.Input(e,t,this,o),this.inputList.push(o),this.rendered&&(this.render(),this.bumpNeighbours_()),o},Blockly.Block.prototype.moveInputBefore=function(e,t){if(e!=t){for(var o,n=-1,i=t?-1:this.inputList.length,r=0;o=this.inputList[r];r++)if(o.name==e){if(n=r,-1!=i)break}else if(t&&o.name==t&&(i=r,-1!=n))break;goog.asserts.assert(-1!=n,'Named input "%s" not found.',e),goog.asserts.assert(-1!=i,'Reference input "%s" not found.',t),this.moveNumberedInputBefore(n,i)}},Blockly.Block.prototype.moveNumberedInputBefore=function(e,t){goog.asserts.assert(e!=t,"Can't move input to itself."),goog.asserts.assert(e<this.inputList.length,"Input index "+e+" out of bounds."),goog.asserts.assert(t<=this.inputList.length,"Reference input "+t+" out of bounds.");var o=this.inputList[e];this.inputList.splice(e,1),t>e&&t--,this.inputList.splice(t,0,o),this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.Block.prototype.removeInput=function(e,t){for(var o,n=0;o=this.inputList[n];n++)if(o.name==e)return o.connection&&o.connection.targetConnection&&o.connection.targetBlock().setParent(null),o.dispose(),this.inputList.splice(n,1),this.rendered&&(this.render(),this.bumpNeighbours_()),void 0;t||goog.asserts.fail('Input "%s" not found.',e)},Blockly.Block.prototype.getInput=function(e){for(var t,o=0;t=this.inputList[o];o++)if(t.name==e)return t;return null},Blockly.Block.prototype.getInputTargetBlock=function(e){return(e=this.getInput(e))&&e.connection&&e.connection.targetBlock()},Blockly.Block.prototype.setMutator=function(e){this.mutator&&this.mutator!==e&&this.mutator.dispose(),e&&(e.block_=this,this.mutator=e,this.svg_&&e.createIcon())},Blockly.Block.prototype.getCommentText=function(){return this.comment?this.comment.getText().replace(/\s+$/,"").replace(/ +\n/g,"\n"):""},Blockly.Block.prototype.setCommentText=function(e){var t=!1;goog.isString(e)?(this.comment||(this.comment=new Blockly.Comment(this),t=!0),this.comment.setText(e)):this.comment&&(this.comment.dispose(),t=!0),this.rendered&&(this.render(),t&&this.bumpNeighbours_())},Blockly.Block.prototype.setWarningText=function(e){this.isInFlyout&&(e=null);var t=!1;goog.isString(e)?(this.warning||(this.warning=new Blockly.Warning(this),t=!0),this.warning.setText(e)):this.warning&&(this.warning.dispose(),t=!0),t&&this.rendered&&(this.render(),this.bumpNeighbours_())},Blockly.Block.prototype.render=function(){goog.asserts.assertObject(this.svg_,"Uninitialized block cannot be rendered. Call block.initSvg()"),this.svg_.render()},Blockly.FieldTextInput=function(e,t){Blockly.FieldTextInput.superClass_.constructor.call(this,e),this.changeHandler_=t},goog.inherits(Blockly.FieldTextInput,Blockly.Field),Blockly.FieldTextInput.prototype.clone=function(){return new Blockly.FieldTextInput(this.getText(),this.changeHandler_)},Blockly.FieldTextInput.prototype.CURSOR="text",Blockly.FieldTextInput.prototype.dispose=function(){Blockly.WidgetDiv.hideIfField(this),Blockly.FieldTextInput.superClass_.dispose.call(this)},Blockly.FieldTextInput.prototype.setText=function(e){if(null!==e){if(this.changeHandler_){var t=this.changeHandler_(e);null!==t&&void 0!==t&&(e=t)}Blockly.Field.prototype.setText.call(this,e)}},Blockly.FieldTextInput.prototype.showEditor_=function(){if(goog.userAgent.MOBILE){var e=window.prompt(Blockly.Msg.CHANGE_VALUE_TITLE,this.text_);if(this.changeHandler_){var t=this.changeHandler_(e);void 0!==t&&(e=t)}null!==e&&this.setText(e)}else Blockly.WidgetDiv.show(this,this.dispose_()),t=Blockly.WidgetDiv.DIV,e=goog.dom.createDom("input","blocklyHtmlInput"),Blockly.FieldTextInput.htmlInput_=e,t.appendChild(e),e.value=e.defaultValue=this.text_,e.oldValue_=null,this.validate_(),this.resizeEditor_(),e.focus(),e.select(),e.onKeyUpWrapper_=Blockly.bindEvent_(e,"keyup",this,this.onHtmlInputChange_),e.onKeyPressWrapper_=Blockly.bindEvent_(e,"keypress",this,this.onHtmlInputChange_),t=this.sourceBlock_.workspace.getCanvas(),e.onWorkspaceChangeWrapper_=Blockly.bindEvent_(t,"blocklyWorkspaceChange",this,this.resizeEditor_)},Blockly.FieldTextInput.prototype.onHtmlInputChange_=function(e){var t=Blockly.FieldTextInput.htmlInput_;13==e.keyCode?Blockly.WidgetDiv.hide():27==e.keyCode?(this.setText(t.defaultValue),Blockly.WidgetDiv.hide()):(e=t.value,e!==t.oldValue_?(t.oldValue_=e,this.setText(e),this.validate_()):goog.userAgent.WEBKIT&&this.sourceBlock_.render())},Blockly.FieldTextInput.prototype.validate_=function(){var e=!0;goog.asserts.assertObject(Blockly.FieldTextInput.htmlInput_);var t=Blockly.FieldTextInput.htmlInput_;this.changeHandler_&&(e=this.changeHandler_(t.value)),null===e?Blockly.addClass_(t,"blocklyInvalidInput"):Blockly.removeClass_(t,"blocklyInvalidInput")},Blockly.FieldTextInput.prototype.resizeEditor_=function(){var e=Blockly.WidgetDiv.DIV,t=this.fieldGroup_.getBBox();if(e.style.width=t.width+"px",t=Blockly.getAbsoluteXY_(this.borderRect_),Blockly.RTL){var o=this.borderRect_.getBBox();t.x+=o.width,t.x-=e.offsetWidth}t.y+=1,goog.userAgent.WEBKIT&&(t.y-=3),e.style.left=t.x+"px",e.style.top=t.y+"px"},Blockly.FieldTextInput.prototype.dispose_=function(){var e=this;return function(){var t,o=Blockly.FieldTextInput.htmlInput_;t=o.value,e.changeHandler_&&(t=e.changeHandler_(t),null===t&&(t=o.defaultValue)),e.setText(t),e.sourceBlock_.render(),Blockly.unbindEvent_(o.onKeyUpWrapper_),Blockly.unbindEvent_(o.onKeyPressWrapper_),Blockly.unbindEvent_(o.onWorkspaceChangeWrapper_),Blockly.FieldTextInput.htmlInput_=null}},Blockly.FieldTextInput.numberValidator=function(e){return e=e.replace(/O/gi,"0"),e=e.replace(/,/g,""),e=parseFloat(e||0),isNaN(e)?null:String(e)},Blockly.FieldTextInput.nonnegativeIntegerValidator=function(e){return(e=Blockly.FieldTextInput.numberValidator(e))&&(e=String(Math.max(0,Math.floor(e)))),e},Blockly.FieldAngle=function(e,t){var o;if(t){var n=this;o=function(e){return e=Blockly.FieldAngle.angleValidator.call(n,e),null!==e&&t.call(n,e),e}}else o=Blockly.FieldAngle.angleValidator;this.symbol_=Blockly.createSvgElement("tspan",{},null),this.symbol_.appendChild(document.createTextNode("°")),Blockly.FieldAngle.superClass_.constructor.call(this,e,o)},goog.inherits(Blockly.FieldAngle,Blockly.FieldTextInput),Blockly.FieldAngle.prototype.clone=function(){return new Blockly.FieldAngle(this.getText(),this.changeHandler_)},Blockly.FieldAngle.ROUND=15,Blockly.FieldAngle.HALF=50,Blockly.FieldAngle.RADIUS=Blockly.FieldAngle.HALF-1,Blockly.FieldAngle.prototype.dispose_=function(){var e=this;return function(){Blockly.FieldAngle.superClass_.dispose_.call(e)(),e.gauge_=null,e.clickWrapper_&&Blockly.unbindEvent_(e.clickWrapper_),e.moveWrapper1_&&Blockly.unbindEvent_(e.moveWrapper1_),e.moveWrapper2_&&Blockly.unbindEvent_(e.moveWrapper2_)}},Blockly.FieldAngle.prototype.showEditor_=function(){Blockly.FieldAngle.superClass_.showEditor_.call(this);var e=Blockly.WidgetDiv.DIV;if(e.firstChild){var e=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",height:2*Blockly.FieldAngle.HALF+"px",width:2*Blockly.FieldAngle.HALF+"px"},e),t=Blockly.createSvgElement("circle",{cx:Blockly.FieldAngle.HALF,cy:Blockly.FieldAngle.HALF,r:Blockly.FieldAngle.RADIUS,"class":"blocklyAngleCircle"},e);
28
- this.gauge_=Blockly.createSvgElement("path",{"class":"blocklyAngleGauge"},e),this.line_=Blockly.createSvgElement("line",{x1:Blockly.FieldAngle.HALF,y1:Blockly.FieldAngle.HALF,"class":"blocklyAngleLine"},e);for(var o=0;360>o;o+=15)Blockly.createSvgElement("line",{x1:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS,y1:Blockly.FieldAngle.HALF,x2:Blockly.FieldAngle.HALF+Blockly.FieldAngle.RADIUS-(0==o%45?10:5),y2:Blockly.FieldAngle.HALF,"class":"blocklyAngleMarks",transform:"rotate("+o+", "+Blockly.FieldAngle.HALF+", "+Blockly.FieldAngle.HALF+")"},e);e.style.marginLeft="-35px",this.clickWrapper_=Blockly.bindEvent_(e,"click",this,Blockly.WidgetDiv.hide),this.moveWrapper1_=Blockly.bindEvent_(t,"mousemove",this,this.onMouseMove),this.moveWrapper2_=Blockly.bindEvent_(this.gauge_,"mousemove",this,this.onMouseMove),this.updateGraph()}},Blockly.FieldAngle.prototype.onMouseMove=function(e){var t=this.gauge_.ownerSVGElement.getBoundingClientRect(),o=e.clientX-t.left-Blockly.FieldAngle.HALF;e=e.clientY-t.top-Blockly.FieldAngle.HALF,t=Math.atan(-e/o),isNaN(t)||(t=t/Math.PI*180,0>o?t+=180:e>0&&(t+=360),Blockly.FieldAngle.ROUND&&(t=Math.round(t/Blockly.FieldAngle.ROUND)*Blockly.FieldAngle.ROUND),t>=360&&(t-=360),t=String(t),Blockly.FieldTextInput.htmlInput_.value=t,this.setText(t))},Blockly.FieldAngle.prototype.setText=function(e){Blockly.FieldAngle.superClass_.setText.call(this,e),this.updateGraph(),Blockly.RTL?this.textElement_.insertBefore(this.symbol_,this.textElement_.firstChild):this.textElement_.appendChild(this.symbol_),this.size_.width=0},Blockly.FieldAngle.prototype.updateGraph=function(){if(this.gauge_){var e=Number(this.getText())/180*Math.PI;if(isNaN(e))this.gauge_.setAttribute("d","M "+Blockly.FieldAngle.HALF+", "+Blockly.FieldAngle.HALF),this.line_.setAttribute("x2",Blockly.FieldAngle.HALF),this.line_.setAttribute("y2",Blockly.FieldAngle.HALF);else{var t=Blockly.FieldAngle.HALF+Math.cos(e)*Blockly.FieldAngle.RADIUS,o=Blockly.FieldAngle.HALF+Math.sin(e)*-Blockly.FieldAngle.RADIUS;this.gauge_.setAttribute("d","M "+Blockly.FieldAngle.HALF+", "+Blockly.FieldAngle.HALF+" h "+Blockly.FieldAngle.RADIUS+" A "+Blockly.FieldAngle.RADIUS+","+Blockly.FieldAngle.RADIUS+" 0 "+(e>Math.PI?1:0)+" 0 "+t+","+o+" z"),this.line_.setAttribute("x2",t),this.line_.setAttribute("y2",o)}}},Blockly.FieldAngle.angleValidator=function(e){return e=Blockly.FieldTextInput.numberValidator(e),null!==e&&(e%=360,0>e&&(e+=360),e=String(e)),e},Blockly.FieldCheckbox=function(e,t){Blockly.FieldCheckbox.superClass_.constructor.call(this,""),this.changeHandler_=t,this.checkElement_=Blockly.createSvgElement("text",{"class":"blocklyText",x:-3},this.fieldGroup_);var o=document.createTextNode("✓");this.checkElement_.appendChild(o),this.setValue(e)},goog.inherits(Blockly.FieldCheckbox,Blockly.Field),Blockly.FieldCheckbox.prototype.clone=function(){return new Blockly.FieldCheckbox(this.getValue(),this.changeHandler_)},Blockly.FieldCheckbox.prototype.CURSOR="default",Blockly.FieldCheckbox.prototype.getValue=function(){return String(this.state_).toUpperCase()},Blockly.FieldCheckbox.prototype.setValue=function(e){e="TRUE"==e,this.state_!==e&&(this.state_=e,this.checkElement_.style.display=e?"block":"none",this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_.workspace.fireChangeEvent())},Blockly.FieldCheckbox.prototype.showEditor_=function(){var e=!this.state_;if(this.changeHandler_){var t=this.changeHandler_(e);void 0!==t&&(e=t)}null!==e&&this.setValue(String(e).toUpperCase())},Blockly.FieldColour=function(e,t){Blockly.FieldColour.superClass_.constructor.call(this,"   "),this.changeHandler_=t,this.borderRect_.style.fillOpacity=1,this.setValue(e)},goog.inherits(Blockly.FieldColour,Blockly.Field),Blockly.FieldColour.prototype.clone=function(){return new Blockly.FieldColour(this.getValue(),this.changeHandler_)},Blockly.FieldColour.prototype.CURSOR="default",Blockly.FieldColour.prototype.dispose=function(){Blockly.WidgetDiv.hideIfField(this),Blockly.FieldColour.superClass_.dispose.call(this)},Blockly.FieldColour.prototype.getValue=function(){return this.colour_},Blockly.FieldColour.prototype.setValue=function(e){this.colour_=e,this.borderRect_.style.fill=e,this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_.workspace.fireChangeEvent()},Blockly.FieldColour.COLOURS=goog.ui.ColorPicker.SIMPLE_GRID_COLORS,Blockly.FieldColour.COLUMNS=7,Blockly.FieldColour.prototype.showEditor_=function(){Blockly.WidgetDiv.show(this,Blockly.FieldColour.dispose_);var e=Blockly.WidgetDiv.DIV,t=new goog.ui.ColorPicker;t.setSize(Blockly.FieldColour.COLUMNS),t.setColors(Blockly.FieldColour.COLOURS),t.render(e),t.setSelectedColor(this.getValue());var o=Blockly.getAbsoluteXY_(this.borderRect_),n=this.borderRect_.getBBox();Blockly.RTL&&(o.x+=n.width),o.y+=n.height-1,Blockly.RTL&&(o.x-=e.offsetWidth),e.style.left=o.x+"px",e.style.top=o.y+"px";var i=this;Blockly.FieldColour.changeEventKey_=goog.events.listen(t,goog.ui.ColorPicker.EventType.CHANGE,function(e){if(e=e.target.getSelectedColor()||"#000000",Blockly.WidgetDiv.hide(),i.changeHandler_){var t=i.changeHandler_(e);void 0!==t&&(e=t)}null!==e&&i.setValue(e)})},Blockly.FieldColour.dispose_=function(){Blockly.FieldColour.changeEventKey_&&goog.events.unlistenByKey(Blockly.FieldColour.changeEventKey_)},Blockly.FieldDropdown=function(e,t){this.menuGenerator_=e,this.changeHandler_=t,this.trimOptions_();var o=this.getOptions_()[0];this.value_=o[1],this.arrow_=Blockly.createSvgElement("tspan",{},null),this.arrow_.appendChild(document.createTextNode(Blockly.RTL?"▾ ":" ▾")),Blockly.FieldDropdown.superClass_.constructor.call(this,o[0])},goog.inherits(Blockly.FieldDropdown,Blockly.Field),Blockly.FieldDropdown.prototype.clone=function(){return new Blockly.FieldDropdown(this.menuGenerator_,this.changeHandler_)},Blockly.FieldDropdown.createDom=function(){var e=Blockly.createSvgElement("g",{"class":"blocklyHidden blocklyFieldDropdown"},null);return Blockly.FieldDropdown.svgGroup_=e,Blockly.FieldDropdown.svgShadow_=Blockly.createSvgElement("rect",{"class":"blocklyDropdownMenuShadow",x:0,y:1,rx:2,ry:2},e),Blockly.FieldDropdown.svgBackground_=Blockly.createSvgElement("rect",{x:-2,y:-1,rx:2,ry:2,filter:"url(#blocklyEmboss)"},e),Blockly.FieldDropdown.svgOptions_=Blockly.createSvgElement("g",{"class":"blocklyDropdownMenuOptions"},e),e},Blockly.FieldDropdown.prototype.dispose=function(){Blockly.FieldDropdown.openDropdown_==this&&Blockly.FieldDropdown.hide(),Blockly.Field.prototype.dispose.call(this)},Blockly.FieldDropdown.CORNER_RADIUS=2,Blockly.FieldDropdown.prototype.CURSOR="default",Blockly.FieldDropdown.openDropdown_=null,Blockly.FieldDropdown.prototype.showEditor_=function(){function e(e){return function(t){if(this.changeHandler_){var o=this.changeHandler_(e);void 0!==o&&(e=o)}null!==e&&this.setValue(e),t.stopPropagation()}}var t=Blockly.FieldDropdown.svgGroup_,o=Blockly.FieldDropdown.svgOptions_,n=Blockly.FieldDropdown.svgBackground_,i=Blockly.FieldDropdown.svgShadow_;goog.dom.removeChildren(o),Blockly.removeClass_(t,"blocklyHidden"),Blockly.FieldDropdown.openDropdown_=this;for(var r=0,s=[],l=null,a=this.getOptions_(),c=0;c<a.length;c++){var u=a[c][1],g=Blockly.ContextMenu.optionToDom(a[c][0]),h=g.firstChild,d=g.lastChild;o.appendChild(g),l||u!=this.value_||(l=Blockly.createSvgElement("text",{"class":"blocklyMenuText",y:15},null),g.insertBefore(l,d),l.appendChild(document.createTextNode("✓"))),g.setAttribute("transform","translate(0, "+c*Blockly.ContextMenu.Y_HEIGHT+")"),s.push(h),Blockly.bindEvent_(g,"mousedown",null,Blockly.noEvent),Blockly.bindEvent_(g,"mouseup",this,e(u)),Blockly.bindEvent_(g,"mouseup",null,Blockly.FieldDropdown.hide),r=Math.max(r,d.getComputedTextLength())}for(r+=2*Blockly.ContextMenu.X_PADDING,c=0;c<s.length;c++)s[c].setAttribute("width",r);if(Blockly.RTL)for(c=0;g=o.childNodes[c];c++)d=g.lastChild,d.setAttribute("text-anchor","end"),d.setAttribute("x",r-Blockly.ContextMenu.X_PADDING);l&&(Blockly.RTL?(l.setAttribute("text-anchor","end"),l.setAttribute("x",r-5)):l.setAttribute("x",5)),c=r+2*Blockly.FieldDropdown.CORNER_RADIUS,a=a.length*Blockly.ContextMenu.Y_HEIGHT+Blockly.FieldDropdown.CORNER_RADIUS+1,i.setAttribute("width",c),i.setAttribute("height",a),n.setAttribute("width",c),n.setAttribute("height",a),i=Blockly.makeColour(this.sourceBlock_.getColour()),n.setAttribute("fill",i),n=Blockly.getSvgXY_(this.borderRect_),i=this.borderRect_.getBBox(),c=Blockly.RTL?n.x-r+Blockly.ContextMenu.X_PADDING+i.width-Blockly.BlockSvg.SEP_SPACE_X/2:n.x-Blockly.ContextMenu.X_PADDING+Blockly.BlockSvg.SEP_SPACE_X/2,t.setAttribute("transform","translate("+c+", "+(n.y+i.height)+")")},Blockly.FieldDropdown.prototype.trimOptions_=function(){this.suffixField=this.prefixField=null;var e=this.menuGenerator_;if(goog.isArray(e)&&!(2>e.length)){var t=e.map(function(e){return e[0]}),o=Blockly.shortestStringLength(t),n=Blockly.commonWordPrefix(t,o),i=Blockly.commonWordSuffix(t,o);if((n||i)&&!(n+i>=o)){for(n&&(this.prefixField=t[0].substring(0,n-1)),i&&(this.suffixField=t[0].substr(1-i)),t=[],o=0;o<e.length;o++){var r=e[o][0],s=e[o][1],r=r.substring(n,r.length-i);t[o]=[r,s]}this.menuGenerator_=t}}},Blockly.FieldDropdown.prototype.getOptions_=function(){return goog.isFunction(this.menuGenerator_)?this.menuGenerator_.call(this):this.menuGenerator_},Blockly.FieldDropdown.prototype.getValue=function(){return this.value_},Blockly.FieldDropdown.prototype.setValue=function(e){this.value_=e;for(var t=this.getOptions_(),o=0;o<t.length;o++)if(t[o][1]==e)return this.setText(t[o][0]),void 0;this.setText(e)},Blockly.FieldDropdown.prototype.setText=function(e){this.sourceBlock_&&(this.arrow_.style.fill=Blockly.makeColour(this.sourceBlock_.getColour())),null!==e&&(this.text_=e,goog.dom.removeChildren(this.textElement_),e=e.replace(/\s/g,Blockly.Field.NBSP),e||(e=Blockly.Field.NBSP),e=document.createTextNode(e),this.textElement_.appendChild(e),Blockly.RTL?this.textElement_.insertBefore(this.arrow_,this.textElement_.firstChild):this.textElement_.appendChild(this.arrow_),this.size_.width=0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours_(),this.sourceBlock_.workspace.fireChangeEvent()))},Blockly.FieldDropdown.hide=function(){var e=Blockly.FieldDropdown.svgGroup_;e&&Blockly.addClass_(e,"blocklyHidden"),Blockly.FieldDropdown.openDropdown_=null},Blockly.FieldImage=function(e,t,o){this.sourceBlock_=null,this.height_=Number(o),this.width_=Number(t),this.size_={height:this.height_+10,width:this.width_},t=6-Blockly.BlockSvg.FIELD_HEIGHT,this.fieldGroup_=Blockly.createSvgElement("g",{},null),this.imageElement_=Blockly.createSvgElement("image",{height:this.height_+"px",width:this.width_+"px",y:t},this.fieldGroup_),this.setText(e),goog.userAgent.GECKO&&(this.rectElement_=Blockly.createSvgElement("rect",{height:this.height_+"px",width:this.width_+"px",y:t,"fill-opacity":0},this.fieldGroup_))},goog.inherits(Blockly.FieldImage,Blockly.Field),Blockly.FieldImage.prototype.clone=function(){return new Blockly.FieldImage(this.getText(),this.width_,this.height_)},Blockly.FieldImage.prototype.rectElement_=null,Blockly.FieldImage.prototype.EDITABLE=!1,Blockly.FieldImage.prototype.init=function(e){if(this.sourceBlock_)throw"Image has already been initialized once.";this.sourceBlock_=e,e.getSvgRoot().appendChild(this.fieldGroup_),e=this.rectElement_||this.imageElement_,e.tooltip=this.sourceBlock_,Blockly.Tooltip&&Blockly.Tooltip.bindMouseEvents(e)},Blockly.FieldImage.prototype.dispose=function(){goog.dom.removeNode(this.fieldGroup_),this.rectElement_=this.imageElement_=this.fieldGroup_=null},Blockly.FieldImage.prototype.setTooltip=function(e){(this.rectElement_||this.imageElement_).tooltip=e},Blockly.FieldImage.prototype.getText=function(){return this.src_},Blockly.FieldImage.prototype.setText=function(e){null!==e&&(this.src_=e,this.imageElement_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",goog.isString(e)?e:""))},Blockly.Flyout=function(){var e=this;this.workspace_=new Blockly.Workspace(function(){return e.getMetrics_()},function(t){return e.setMetrics_(t)}),this.workspace_.isFlyout=!0,this.changeWrapper_=null,this.height_=this.width_=0,this.buttons_=[],this.listeners_=[]},Blockly.Flyout.prototype.autoClose=!0,Blockly.Flyout.prototype.CORNER_RADIUS=8,Blockly.Flyout.prototype.onResizeWrapper_=null,Blockly.Flyout.prototype.createDom=function(){return this.svgGroup_=Blockly.createSvgElement("g",{},null),this.svgBackground_=Blockly.createSvgElement("path",{"class":"blocklyFlyoutBackground"},this.svgGroup_),this.svgGroup_.appendChild(this.workspace_.createDom()),this.svgGroup_},Blockly.Flyout.prototype.dispose=function(){this.hide(),this.onResizeWrapper_&&(Blockly.unbindEvent_(this.onResizeWrapper_),this.onResizeWrapper_=null),this.changeWrapper_&&(Blockly.unbindEvent_(this.changeWrapper_),this.changeWrapper_=null),this.scrollbar_&&(this.scrollbar_.dispose(),this.scrollbar_=null),this.workspace_=null,this.svgGroup_&&(goog.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.targetWorkspace_=this.svgBackground_=null},Blockly.Flyout.prototype.getMetrics_=function(){if(!this.isVisible())return null;var e=this.height_-2*this.CORNER_RADIUS,t=this.width_;try{var o=this.workspace_.getCanvas().getBBox()}catch(n){o={height:0,y:0}}return{viewHeight:e,viewWidth:t,contentHeight:o.height+o.y,viewTop:-this.workspace_.scrollY,contentTop:0,absoluteTop:this.CORNER_RADIUS,absoluteLeft:0}},Blockly.Flyout.prototype.setMetrics_=function(e){var t=this.getMetrics_();t&&(goog.isNumber(e.y)&&(this.workspace_.scrollY=-t.contentHeight*e.y-t.contentTop),e=this.workspace_.scrollY+t.absoluteTop,this.workspace_.getCanvas().setAttribute("transform","translate(0,"+e+")"))},Blockly.Flyout.prototype.init=function(e,t){this.targetWorkspace_=e,t&&(this.scrollbar_=new Blockly.Scrollbar(this.workspace_,!1,!1)),this.hide(),this.onResizeWrapper_=Blockly.bindEvent_(window,goog.events.EventType.RESIZE,this,this.position_),this.position_(),this.changeWrapper_=Blockly.bindEvent_(this.targetWorkspace_.getCanvas(),"blocklyWorkspaceChange",this,this.filterForCapacity_)},Blockly.Flyout.prototype.position_=function(){if(this.isVisible()){var e=this.targetWorkspace_.getMetrics();if(e){var t=this.width_-this.CORNER_RADIUS;Blockly.RTL&&(t*=-1);var o=["M "+(Blockly.RTL?this.width_:0)+",0"];o.push("h",t),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,Blockly.RTL?0:1,Blockly.RTL?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("v",Math.max(0,e.viewHeight-2*this.CORNER_RADIUS)),o.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,Blockly.RTL?0:1,Blockly.RTL?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),o.push("h",-t),o.push("z"),this.svgBackground_.setAttribute("d",o.join(" ")),t=e.absoluteLeft,Blockly.RTL&&(t+=e.viewWidth,t-=this.width_),this.svgGroup_.setAttribute("transform","translate("+t+","+e.absoluteTop+")"),this.height_=e.viewHeight,this.scrollbar_&&this.scrollbar_.resize()}}},Blockly.Flyout.prototype.isVisible=function(){return"block"==this.svgGroup_.style.display},Blockly.Flyout.prototype.hide=function(){if(this.isVisible()){this.svgGroup_.style.display="none";for(var e,t=0;e=this.listeners_[t];t++)Blockly.unbindEvent_(e);this.listeners_.splice(0),this.reflowWrapper_&&(Blockly.unbindEvent_(this.reflowWrapper_),this.reflowWrapper_=null),e=this.workspace_.getTopBlocks(!1);for(var o,t=0;o=e[t];t++)o.workspace==this.workspace_&&o.dispose(!1,!1);for(t=0;e=this.buttons_[t];t++)goog.dom.removeNode(e);this.buttons_.splice(0)}},Blockly.Flyout.prototype.show=function(e){this.hide();var t=this.CORNER_RADIUS;this.svgGroup_.style.display="block";var o=[],n=[];if(e==Blockly.Variables.NAME_TYPE)Blockly.Variables.flyoutCategory(o,n,t,this.workspace_);else if(e==Blockly.Procedures.NAME_TYPE)Blockly.Procedures.flyoutCategory(o,n,t,this.workspace_);else for(var i,r=0;i=e[r];r++)i.tagName&&"BLOCK"==i.tagName.toUpperCase()&&(i=Blockly.Xml.domToBlock_(this.workspace_,i),o.push(i),n.push(3*t));for(e=t,r=0;i=o[r];r++){for(var s,l=i.getDescendants(),a=0;s=l[a];a++)s.isInFlyout=!0,Blockly.Comment&&s.setCommentText(null);i.render(),l=i.getSvgRoot(),a=i.getHeightWidth(),i.moveBy(Blockly.RTL?0:t+Blockly.BlockSvg.TAB_WIDTH,e),e+=a.height+n[r],a=Blockly.createSvgElement("rect",{"fill-opacity":0},null),this.workspace_.getCanvas().insertBefore(a,i.getSvgRoot()),i.flyoutRect_=a,this.buttons_[r]=a,this.autoClose?this.listeners_.push(Blockly.bindEvent_(l,"mousedown",null,this.createBlockFunc_(i))):this.listeners_.push(Blockly.bindEvent_(l,"mousedown",null,this.blockMouseDown_(i))),this.listeners_.push(Blockly.bindEvent_(l,"mouseover",i.svg_,i.svg_.addSelect)),this.listeners_.push(Blockly.bindEvent_(l,"mouseout",i.svg_,i.svg_.removeSelect)),this.listeners_.push(Blockly.bindEvent_(a,"mousedown",null,this.createBlockFunc_(i))),this.listeners_.push(Blockly.bindEvent_(a,"mouseover",i.svg_,i.svg_.addSelect)),this.listeners_.push(Blockly.bindEvent_(a,"mouseout",i.svg_,i.svg_.removeSelect))}this.width_=0,this.reflow(),this.filterForCapacity_(),Blockly.fireUiEvent(window,"resize"),this.reflowWrapper_=Blockly.bindEvent_(this.workspace_.getCanvas(),"blocklyWorkspaceChange",this,this.reflow),this.workspace_.fireChangeEvent()},Blockly.Flyout.prototype.reflow=function(){for(var e,t=0,o=this.CORNER_RADIUS,n=this.workspace_.getTopBlocks(!1),i=0;e=n[i];i++){e.getSvgRoot();var r=e.getHeightWidth(),t=Math.max(t,r.width)}if(t+=o+Blockly.BlockSvg.TAB_WIDTH+o/2+Blockly.Scrollbar.scrollbarThickness,this.width_!=t){for(i=0;e=n[i];i++){var r=e.getHeightWidth(),s=e.getRelativeToSurfaceXY();if(Blockly.RTL){var l=t-o-Blockly.BlockSvg.TAB_WIDTH-s.x;e.moveBy(l,0),s.x+=l}e.flyoutRect_&&(e.flyoutRect_.setAttribute("width",r.width),e.flyoutRect_.setAttribute("height",r.height),e.flyoutRect_.setAttribute("x",Blockly.RTL?s.x-r.width:s.x),e.flyoutRect_.setAttribute("y",s.y))}this.width_=t,Blockly.fireUiEvent(window,"resize")}},Blockly.Block.prototype.moveTo=function(e,t){var o=this.getRelativeToSurfaceXY();this.svg_.getRootElement().setAttribute("transform","translate("+e+", "+t+")"),this.moveConnections_(e-o.x,t-o.y)},Blockly.Flyout.prototype.blockMouseDown_=function(e){var t=this;return function(o){Blockly.terminateDrag_(),Blockly.hideChaff(),Blockly.isRightButton(o)?Blockly.ContextMenu&&e.showContextMenu_(Blockly.mouseToSvg(o)):(Blockly.removeAllRanges(),Blockly.setCursorHand_(!0),Blockly.Flyout.startDragMouseX_=o.clientX,Blockly.Flyout.startDragMouseY_=o.clientY,Blockly.Flyout.startBlock_=e,Blockly.Flyout.startFlyout_=t,Blockly.Flyout.onMouseUpWrapper_=Blockly.bindEvent_(document,"mouseup",this,Blockly.terminateDrag_),Blockly.Flyout.onMouseMoveWrapper_=Blockly.bindEvent_(document,"mousemove",this,t.onMouseMove_)),o.stopPropagation()}},Blockly.Flyout.prototype.onMouseMove_=function(e){if("mousemove"==e.type&&1>=e.clientX&&0==e.clientY&&0==e.button)e.stopPropagation();else{Blockly.removeAllRanges();var t=e.clientY-Blockly.Flyout.startDragMouseY_;Math.sqrt(Math.pow(e.clientX-Blockly.Flyout.startDragMouseX_,2)+Math.pow(t,2))>Blockly.DRAG_RADIUS&&Blockly.Flyout.startFlyout_.createBlockFunc_(Blockly.Flyout.startBlock_)(e)}},Blockly.Flyout.prototype.createBlockFunc_=function(e){var t=this;return function(o){if(!Blockly.isRightButton(o)&&!e.disabled){var n=Blockly.Xml.blockToDom_(e),n=Blockly.Xml.domToBlock_(t.targetWorkspace_,n),i=e.getSvgRoot();if(!i)throw"originBlock is not rendered.";var i=Blockly.getSvgXY_(i),r=n.getSvgRoot();if(!r)throw"block is not rendered.";r=Blockly.getSvgXY_(r),n.moveBy(i.x-r.x,i.y-r.y),t.autoClose?t.hide():t.filterForCapacity_(),n.onMouseDown_(o)}}},Blockly.Flyout.prototype.filterForCapacity_=function(){for(var e,t=this.targetWorkspace_.remainingCapacity(),o=this.workspace_.getTopBlocks(!1),n=0;e=o[n];n++){var i=e.getDescendants().length>t;e.setDisabled(i)}},Blockly.Flyout.terminateDrag_=function(){Blockly.Flyout.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseUpWrapper_),Blockly.Flyout.onMouseUpWrapper_=null),Blockly.Flyout.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Flyout.onMouseMoveWrapper_),Blockly.Flyout.onMouseMoveWrapper_=null),Blockly.Flyout.startDragMouseX_=0,Blockly.Flyout.startDragMouseY_=0,Blockly.Flyout.startBlock_=null,Blockly.Flyout.startFlyout_=null},Blockly.Toolbox={},Blockly.Toolbox.width=0,Blockly.Toolbox.selectedOption_=null,Blockly.Toolbox.CONFIG_={indentWidth:19,cssRoot:"blocklyTreeRoot",cssHideRoot:"blocklyHidden",cssItem:"",cssTreeRow:"blocklyTreeRow",cssItemLabel:"blocklyTreeLabel",cssTreeIcon:"blocklyTreeIcon",cssExpandedFolderIcon:"blocklyTreeIconOpen",cssFileIcon:"blocklyTreeIconNone",cssSelectedRow:"blocklyTreeSelected"},Blockly.Toolbox.createDom=function(e,t){Blockly.Toolbox.HtmlDiv=goog.dom.createDom("div","blocklyToolboxDiv"),Blockly.Toolbox.HtmlDiv.setAttribute("dir",Blockly.RTL?"RTL":"LTR"),t.appendChild(Blockly.Toolbox.HtmlDiv),Blockly.Toolbox.flyout_=new Blockly.Flyout,e.appendChild(Blockly.Toolbox.flyout_.createDom()),Blockly.bindEvent_(Blockly.Toolbox.HtmlDiv,"mousedown",null,function(e){Blockly.isRightButton(e)||e.target==Blockly.Toolbox.HtmlDiv?Blockly.hideChaff(!1):Blockly.hideChaff(!0)})},Blockly.Toolbox.init=function(){Blockly.Toolbox.CONFIG_.cleardotPath=Blockly.pathToBlockly+"media/1x1.gif",Blockly.Toolbox.CONFIG_.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(Blockly.RTL?"Rtl":"Ltr");var e=new Blockly.Toolbox.TreeControl("root",Blockly.Toolbox.CONFIG_);Blockly.Toolbox.tree_=e,e.setShowRootNode(!1),e.setShowLines(!1),e.setShowExpandIcons(!1),e.setSelectedItem(null),Blockly.Toolbox.HtmlDiv.style.display="block",Blockly.Toolbox.flyout_.init(Blockly.mainWorkspace,!0),Blockly.Toolbox.populate_(),e.render(Blockly.Toolbox.HtmlDiv),goog.events.listen(window,goog.events.EventType.RESIZE,Blockly.Toolbox.position_),Blockly.Toolbox.position_()},Blockly.Toolbox.position_=function(){var e=Blockly.Toolbox.HtmlDiv,t=goog.style.getBorderBox(Blockly.svg),o=Blockly.svgSize();Blockly.RTL?(t=Blockly.convertCoordinates(0,0,!1),e.style.left=t.x+o.width-e.offsetWidth+"px"):e.style.marginLeft=t.left,e.style.height=o.height+1+"px",Blockly.Toolbox.width=e.offsetWidth,Blockly.RTL||(Blockly.Toolbox.width-=1)},Blockly.Toolbox.populate_=function(){function e(o,n){for(var i,r=0;i=o.childNodes[r];r++)if(i.tagName){var s=i.tagName.toUpperCase();if("CATEGORY"==s){s=t.createNode(i.getAttribute("name")),s.blocks=[],n.add(s);var l=i.getAttribute("custom");l?s.blocks=l:e(i,s)}else"BLOCK"==s&&n.blocks.push(i)}}var t=Blockly.Toolbox.tree_;if(t.blocks=[],e(Blockly.languageTree,Blockly.Toolbox.tree_),t.blocks.length)throw"Toolbox cannot have both blocks and categories in the root level.";Blockly.fireUiEvent(window,"resize")},Blockly.Toolbox.clearSelection=function(){Blockly.Toolbox.tree_.setSelectedItem(null)},Blockly.Toolbox.TreeControl=function(e,t,o){goog.ui.tree.TreeControl.call(this,e,t,o)},goog.inherits(Blockly.Toolbox.TreeControl,goog.ui.tree.TreeControl),Blockly.Toolbox.TreeControl.prototype.enterDocument=function(){if(Blockly.Toolbox.TreeControl.superClass_.enterDocument.call(this),goog.events.BrowserFeature.TOUCH_ENABLED){var e=this.getElement();Blockly.bindEvent_(e,goog.events.EventType.TOUCHSTART,this,this.handleTouchEvent_)}},Blockly.Toolbox.TreeControl.prototype.handleTouchEvent_=function(e){e.preventDefault();var t=this.getNodeFromEvent_(e);t&&e.type===goog.events.EventType.TOUCHSTART&&window.setTimeout(function(){t.onMouseDown(e)},1)},Blockly.Toolbox.TreeControl.prototype.createNode=function(e){return new Blockly.Toolbox.TreeNode(e||"",this.getConfig(),this.getDomHelper())},Blockly.Toolbox.TreeControl.prototype.setSelectedItem=function(e){this.selectedItem_!=e&&(goog.ui.tree.TreeControl.prototype.setSelectedItem.call(this,e),e&&e.blocks&&e.blocks.length?Blockly.Toolbox.flyout_.show(e.blocks):Blockly.Toolbox.flyout_.hide())},Blockly.Toolbox.TreeNode=function(e,t,o){goog.ui.tree.TreeNode.call(this,e,t,o),e=function(){Blockly.fireUiEvent(window,"resize")},goog.events.listen(Blockly.Toolbox.tree_,goog.ui.tree.BaseNode.EventType.EXPAND,e),goog.events.listen(Blockly.Toolbox.tree_,goog.ui.tree.BaseNode.EventType.COLLAPSE,e)},goog.inherits(Blockly.Toolbox.TreeNode,goog.ui.tree.TreeNode),Blockly.Toolbox.TreeNode.prototype.getExpandIconHtml=function(){return"<span></span>"},Blockly.Toolbox.TreeNode.prototype.getExpandIconElement=function(){return null},Blockly.Toolbox.TreeNode.prototype.onMouseDown=function(){this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select(),this.updateRow()},Blockly.Toolbox.TreeNode.prototype.onDoubleClick_=function(){},Blockly.Variables={},Blockly.Variables.NAME_TYPE="VARIABLE",Blockly.Variables.allVariables=function(e){var t;t=e?e.getDescendants():Blockly.mainWorkspace.getAllBlocks(),e=Object.create(null);for(var o=0;o<t.length;o++){var n=t[o].getVars;if(n)for(var n=n.call(t[o]),i=0;i<n.length;i++){var r=n[i];r&&(e[r.toLowerCase()]=r)}}t=[];for(var s in e)t.push(e[s]);return t},Blockly.Variables.renameVariable=function(e,t){for(var o=Blockly.mainWorkspace.getAllBlocks(),n=0;n<o.length;n++){var i=o[n].renameVar;i&&i.call(o[n],e,t)}},Blockly.Variables.flyoutCategory=function(e,t,o,n){var i=Blockly.Variables.allVariables();i.sort(goog.string.caseInsensitiveCompare),i.unshift(null);for(var r=void 0,s=0;s<i.length;s++)if(i[s]!==r){var l=Blockly.Blocks.variables_get?new Blockly.Block(n,"variables_get"):null;l&&l.initSvg();var a=Blockly.Blocks.variables_set?new Blockly.Block(n,"variables_set"):null;a&&a.initSvg(),null===i[s]?r=(l||a).getVars()[0]:(l&&l.setFieldValue(i[s],"VAR"),a&&a.setFieldValue(i[s],"VAR")),a&&e.push(a),l&&e.push(l),l&&a?t.push(o,3*o):t.push(2*o)}},Blockly.Variables.generateUniqueName=function(){var e=Blockly.Variables.allVariables(),t="";if(e.length){e.sort(goog.string.caseInsensitiveCompare);for(var o=0,n="i",i=0,r=!1;!t;){for(i=0,r=!1;i<e.length&&!r;)e[i].toLowerCase()==n&&(r=!0),i++;r?("z"===n[0]?(o++,n="a"):(n=String.fromCharCode(n.charCodeAt(0)+1),"l"==n[0]&&(n=String.fromCharCode(n.charCodeAt(0)+1))),o>0&&(n+=o)):t=n}}else t="i";return t},Blockly.FieldVariable=function(e,t){var o;if(t){var n=this;o=function(e){var o=Blockly.FieldVariable.dropdownChange.call(n,e);return e=void 0===o?e:null===o?n.getValue():o,t.call(n,e),o}}else o=Blockly.FieldVariable.dropdownChange;Blockly.FieldVariable.superClass_.constructor.call(this,Blockly.FieldVariable.dropdownCreate,o),e?this.setValue(e):this.setValue(Blockly.Variables.generateUniqueName())},goog.inherits(Blockly.FieldVariable,Blockly.FieldDropdown),Blockly.FieldVariable.prototype.clone=function(){return new Blockly.FieldVariable(this.getValue(),this.changeHandler_)},Blockly.FieldVariable.prototype.getValue=function(){return this.getText()},Blockly.FieldVariable.prototype.setValue=function(e){this.value_=e,this.setText(e)},Blockly.FieldVariable.dropdownCreate=function(){var e=Blockly.Variables.allVariables(),t=this.getText();t&&-1==e.indexOf(t)&&e.push(t),e.sort(goog.string.caseInsensitiveCompare),e.push(Blockly.Msg.RENAME_VARIABLE),e.push(Blockly.Msg.NEW_VARIABLE);for(var t=[],o=0;o<e.length;o++)t[o]=[e[o],e[o]];return t},Blockly.FieldVariable.dropdownChange=function(e){function t(e,t){Blockly.hideChaff();var o=window.prompt(e,t);return o&&o.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")}if(e==Blockly.Msg.RENAME_VARIABLE){var o=this.getText();return(e=t(Blockly.Msg.RENAME_VARIABLE_TITLE.replace("%1",o),o))&&Blockly.Variables.renameVariable(o,e),null}return e==Blockly.Msg.NEW_VARIABLE?(e=t(Blockly.Msg.NEW_VARIABLE_TITLE,""))?(Blockly.Variables.renameVariable(e,e),e):null:void 0},Blockly.Generator=function(e){this.name_=e,this.RESERVED_WORDS_=""},Blockly.Generator.NAME_TYPE="generated_function",Blockly.Generator.prototype.workspaceToCode=function(){var e=[];this.init();for(var t,o=Blockly.mainWorkspace.getTopBlocks(!0),n=0;t=o[n];n++){var i=this.blockToCode(t);i instanceof Array&&(i=i[0]),i&&(t.outputConnection&&this.scrubNakedValue&&(i=this.scrubNakedValue(i)),e.push(i))}return e=e.join("\n"),e=this.finish(e),e=e.replace(/^\s+\n/,""),e=e.replace(/\n\s+$/,"\n"),e=e.replace(/[ \t]+\n/g,"\n")},Blockly.Generator.prototype.prefixLines=function(e,t){return t+e.replace(/\n(.)/g,"\n"+t+"$1")},Blockly.Generator.prototype.allNestedComments=function(e){var t=[];e=e.getDescendants();for(var o=0;o<e.length;o++){var n=e[o].getCommentText();n&&t.push(n)}return t.length&&t.push(""),t.join("\n")},Blockly.Generator.prototype.blockToCode=function(e){if(!e)return"";if(e.disabled)return e=e.nextConnection&&e.nextConnection.targetBlock(),this.blockToCode(e);var t=this[e.type];if(!t)throw'Language "'+this.name_+'" does not know how to generate code for block type "'+e.type+'".';return t=t.call(e,e),t instanceof Array?[this.scrub_(e,t[0]),t[1]]:this.scrub_(e,t)},Blockly.Generator.prototype.valueToCode=function(e,t,o){if(isNaN(o))throw'Expecting valid order from block "'+e.type+'".';if(e=e.getInputTargetBlock(t),!e)return"";var n=this.blockToCode(e);if(""===n)return"";if(!(n instanceof Array))throw'Expecting tuple from value block "'+e.type+'".';if(t=n[0],n=n[1],isNaN(n))throw'Expecting valid order from value block "'+e.type+'".';return t&&n>=o&&o!=n&&0!=o&&99!=o&&(t="("+t+")"),t},Blockly.Generator.prototype.statementToCode=function(e,t){var o=e.getInputTargetBlock(t),n=this.blockToCode(o);if(!goog.isString(n))throw'Expecting code from statement block "'+o.type+'".';return n&&(n=this.prefixLines(n," ")),n},Blockly.Generator.prototype.addReservedWords=function(e){this.RESERVED_WORDS_+=e+","},Blockly.Names=function(e){if(this.reservedDict_=Object.create(null),e){e=e.split(",");for(var t=0;t<e.length;t++)this.reservedDict_[e[t]]=!0}this.reset()},Blockly.Names.prototype.reset=function(){this.db_=Object.create(null),this.dbReverse_=Object.create(null)},Blockly.Names.prototype.getName=function(e,t){var o=e.toLowerCase()+"_"+t;if(o in this.db_)return this.db_[o];var n=this.getDistinctName(e,t);return this.db_[o]=n},Blockly.Names.prototype.getDistinctName=function(e){for(var t=this.safeName_(e),o="";this.dbReverse_[t+o]||t+o in this.reservedDict_;)o=o?o+1:2;return t+=o,this.dbReverse_[t]=!0,t},Blockly.Names.prototype.safeName_=function(e){return e?(e=encodeURI(e.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!="0123456789".indexOf(e[0])&&(e="my_"+e)):e="unnamed",e},Blockly.Names.equals=function(e,t){return e.toLowerCase()==t.toLowerCase()},Blockly.Procedures={},Blockly.Procedures.NAME_TYPE="PROCEDURE",Blockly.Procedures.allProcedures=function(){for(var e=Blockly.mainWorkspace.getAllBlocks(),t=[],o=[],n=0;n<e.length;n++){var i=e[n].getProcedureDef;i&&(i=i.call(e[n]))&&(i[2]?t.push(i):o.push(i))}return o.sort(Blockly.Procedures.procTupleComparator_),t.sort(Blockly.Procedures.procTupleComparator_),[o,t]},Blockly.Procedures.procTupleComparator_=function(e,t){var o=e[0].toLowerCase(),n=t[0].toLowerCase();return o>n?1:n>o?-1:0},Blockly.Procedures.findLegalName=function(e,t){if(t.isInFlyout)return e;for(;!Blockly.Procedures.isLegalName(e,t.workspace,t);){var o=e.match(/^(.*?)(\d+)$/);e=o?o[1]+(parseInt(o[2],10)+1):e+"2"}return e},Blockly.Procedures.isLegalName=function(e,t,o){t=t.getAllBlocks();for(var n=0;n<t.length;n++)if(t[n]!=o){var i=t[n].getProcedureDef;if(i&&(i=i.call(t[n]),Blockly.Names.equals(i[0],e)))return!1}return!0},Blockly.Procedures.rename=function(e){e=e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),e=Blockly.Procedures.findLegalName(e,this.sourceBlock_);for(var t=this.sourceBlock_.workspace.getAllBlocks(),o=0;o<t.length;o++){var n=t[o].renameProcedure;n&&n.call(t[o],this.text_,e)}return e},Blockly.Procedures.flyoutCategory=function(e,t,o,n){function i(i,r){for(var s=0;s<i.length;s++){var l=new Blockly.Block(n,r);l.setFieldValue(i[s][0],"NAME");for(var a=[],c=0;c<i[s][1].length;c++)a[c]="ARG"+c;l.setProcedureParameters(i[s][1],a),l.initSvg(),e.push(l),t.push(2*o)}}if(Blockly.Blocks.procedures_defnoreturn){var r=new Blockly.Block(n,"procedures_defnoreturn");r.initSvg(),e.push(r),t.push(2*o)}Blockly.Blocks.procedures_defreturn&&(r=new Blockly.Block(n,"procedures_defreturn"),r.initSvg(),e.push(r),t.push(2*o)),Blockly.Blocks.procedures_ifreturn&&(r=new Blockly.Block(n,"procedures_ifreturn"),r.initSvg(),e.push(r),t.push(2*o)),t.length&&(t[t.length-1]=3*o),r=Blockly.Procedures.allProcedures(),i(r[0],"procedures_callnoreturn"),i(r[1],"procedures_callreturn")},Blockly.Procedures.getCallers=function(e,t){for(var o=[],n=t.getAllBlocks(),i=0;i<n.length;i++){var r=n[i].getProcedureCall;r&&(r=r.call(n[i]))&&Blockly.Names.equals(r,e)&&o.push(n[i])}return o},Blockly.Procedures.disposeCallers=function(e,t){for(var o=Blockly.Procedures.getCallers(e,t),n=0;n<o.length;n++)o[n].dispose(!0,!1)},Blockly.Procedures.mutateCallers=function(e,t,o,n){for(e=Blockly.Procedures.getCallers(e,t),t=0;t<e.length;t++)e[t].setProcedureParameters(o,n)},Blockly.Procedures.getDefinition=function(e,t){for(var o=t.getAllBlocks(),n=0;n<o.length;n++){var i=o[n].getProcedureDef;
29
- if(i&&(i=i.call(o[n]))&&Blockly.Names.equals(i[0],e))return o[n]}return null},Blockly.Css={},Blockly.Css.inject=function(){var e=Blockly.Css.CONTENT.join("\n"),t=Blockly.pathToBlockly.replace(/[\\\/]$/,""),e=e.replace(/<<<PATH>>>/g,t);goog.cssom.addCssText(e)},Blockly.Css.CONTENT=[".blocklySvg {"," background-color: #fff;"," border: 1px solid #ddd;","}",".blocklyWidgetDiv {"," position: absolute;"," display: none;"," z-index: 999;","}",".blocklyDraggable {"," /* Hotspot coordinates are baked into the CUR file, but they are still"," required in the CSS due to a Chrome bug."," http://code.google.com/p/chromium/issues/detail?id=1446 */"," cursor: url(<<<PATH>>>/media/handopen.cur) 8 5, auto;","}",".blocklyResizeSE {"," fill: #aaa;"," cursor: se-resize;","}",".blocklyResizeSW {"," fill: #aaa;"," cursor: sw-resize;","}",".blocklyResizeLine {"," stroke-width: 1;"," stroke: #888;","}",".blocklyHighlightedConnectionPath {"," stroke-width: 4px;"," stroke: #fc3;"," fill: none;","}",".blocklyPathLight {"," fill: none;"," stroke-width: 2;"," stroke-linecap: round;","}",".blocklySelected>.blocklyPath {"," stroke-width: 3px;"," stroke: #fc3;","}",".blocklySelected>.blocklyPathLight {"," display: none;","}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {"," fill-opacity: 0.8;"," stroke-opacity: 0.8;","}",".blocklyDragging>.blocklyPathDark {"," display: none;","}",".blocklyDisabled>.blocklyPath {"," fill-opacity: 0.50;"," stroke-opacity: 0.50;","}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {"," display: none;","}",".blocklyText {"," cursor: default;"," font-family: sans-serif;"," font-size: 11pt;"," fill: #fff;","}",".blocklyNonEditableText>text {"," pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {"," fill: #fff;"," fill-opacity: 0.6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {"," fill: #000;","}",".blocklyEditableText:hover>rect {"," stroke-width: 2;"," stroke: #fff;","}","/*"," * Don't allow users to select text. It gets annoying when trying to"," * drag a block and selected text moves instead."," */",".blocklySvg text {"," -moz-user-select: none;"," -webkit-user-select: none;"," user-select: none;"," cursor: inherit;","}","",".blocklyHidden {"," display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {"," display: block;","}",".blocklyTooltipBackground {"," fill: #ffffc7;"," stroke-width: 1px;"," stroke: #d8d8d8;","}",".blocklyTooltipShadow,",".blocklyContextMenuShadow,",".blocklyDropdownMenuShadow {"," fill: #bbb;"," filter: url(#blocklyShadowFilter);","}",".blocklyTooltipText {"," font-family: sans-serif;"," font-size: 9pt;"," fill: #000;","}","",".blocklyIconShield {"," cursor: default;"," fill: #00c;"," stroke-width: 1px;"," stroke: #ccc;","}",".blocklyIconGroup:hover>.blocklyIconShield {"," fill: #00f;"," stroke: #fff;","}",".blocklyIconGroup:hover>.blocklyIconMark {"," fill: #fff;","}",".blocklyIconMark {"," cursor: default !important;"," font-family: sans-serif;"," font-size: 9pt;"," font-weight: bold;"," fill: #ccc;"," text-anchor: middle;","}",".blocklyWarningBody {","}",".blocklyMinimalBody {"," margin: 0;"," padding: 0;","}",".blocklyCommentTextarea {"," margin: 0;"," padding: 2px;"," border: 0;"," resize: none;"," background-color: #ffc;","}",".blocklyHtmlInput {"," font-family: sans-serif;"," font-size: 11pt;"," border: none;"," outline: none;"," width: 100%","}",".blocklyContextMenuBackground,",".blocklyMutatorBackground {"," fill: #fff;"," stroke-width: 1;"," stroke: #ddd;","}",".blocklyContextMenuOptions>.blocklyMenuDiv,",".blocklyContextMenuOptions>.blocklyMenuDivDisabled,",".blocklyDropdownMenuOptions>.blocklyMenuDiv {"," fill: #fff;","}",".blocklyContextMenuOptions>.blocklyMenuDiv:hover>rect,",".blocklyDropdownMenuOptions>.blocklyMenuDiv:hover>rect {"," fill: #57e;","}",".blocklyMenuSelected>rect {"," fill: #57e;","}",".blocklyMenuText {"," cursor: default !important;"," font-family: sans-serif;"," font-size: 15px; /* All context menu sizes are based on pixels. */"," fill: #000;","}",".blocklyContextMenuOptions>.blocklyMenuDiv:hover>.blocklyMenuText,",".blocklyDropdownMenuOptions>.blocklyMenuDiv:hover>.blocklyMenuText {"," fill: #fff;","}",".blocklyMenuSelected>.blocklyMenuText {"," fill: #fff;","}",".blocklyMenuDivDisabled>.blocklyMenuText {"," fill: #ccc;","}",".blocklyFlyoutBackground {"," fill: #ddd;"," fill-opacity: 0.8;","}",".blocklyColourBackground {"," fill: #666;","}",".blocklyScrollbarBackground {"," fill: #fff;"," stroke-width: 1;"," stroke: #e4e4e4;","}",".blocklyScrollbarKnob {"," fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarKnob,",".blocklyScrollbarKnob:hover {"," fill: #bbb;","}",".blocklyInvalidInput {"," background: #faa;","}",".blocklyAngleCircle {"," stroke: #444;"," stroke-width: 1;"," fill: #ddd;"," fill-opacity: 0.8;","}",".blocklyAngleMarks {"," stroke: #444;"," stroke-width: 1;","}",".blocklyAngleGauge {"," fill: #f88;"," fill-opacity: 0.8; ","}",".blocklyAngleLine {"," stroke: #f00;"," stroke-width: 2;"," stroke-linecap: round;","}","","/* Category tree in Toolbox. */",".blocklyToolboxDiv {"," background-color: #ddd;"," display: none;"," overflow-x: visible;"," overflow-y: auto;"," position: absolute;","}",".blocklyTreeRoot {"," padding: 4px 0;","}",".blocklyTreeRoot:focus {"," outline: none;","}",".blocklyTreeRow {"," line-height: 22px;"," height: 22px;"," padding-right: 1em;"," white-space: nowrap;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {'," padding-right: 0;"," padding-left: 1em !important;","}",".blocklyTreeRow:hover {"," background-color: #e4e4e4;","}",".blocklyTreeIcon {"," height: 16px;"," width: 16px;"," vertical-align: middle;"," background-image: url(<<<PATH>>>/media/tree.png);","}",".blocklyTreeIconClosedLtr {"," background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {"," background-position: 0px -1px;","}",".blocklyTreeIconOpen {"," background-position: -16px -1px;","}",".blocklyTreeIconNone {"," background-position: -48px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {"," background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {"," background-position: 0px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {"," background-position: -16px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconNone {"," background-position: -48px -17px;","}",".blocklyTreeLabel {"," cursor: default;"," font-family: sans-serif;"," font-size: 16px;"," padding: 0 3px;"," vertical-align: middle;","}",".blocklyTreeSelected {"," background-color: #57e !important;","}",".blocklyTreeSelected .blocklyTreeLabel {"," color: #fff;","}","","/*"," * Copyright 2007 The Closure Library Authors. All Rights Reserved."," *"," * Use of this source code is governed by the Apache License, Version 2.0."," * See the COPYING file for details."," */","","/* Author: pupius@google.com (Daniel Pupius) */","","/*"," Styles to make the colorpicker look like the old gmail color picker"," NOTE: without CSS scoping this will override styles defined in palette.css","*/",".goog-palette {"," outline: none;"," cursor: default;","}","",".goog-palette-table {"," border: 1px solid #666;"," border-collapse: collapse;","}","",".goog-palette-cell {"," height: 13px;"," width: 15px;"," margin: 0;"," border: 0;"," text-align: center;"," vertical-align: middle;"," border-right: 1px solid #666;"," font-size: 1px;","}","",".goog-palette-colorswatch {"," position: relative;"," height: 13px;"," width: 15px;"," border: 1px solid #666;","}","",".goog-palette-cell-hover .goog-palette-colorswatch {"," border: 1px solid #FFF;","}","",".goog-palette-cell-selected .goog-palette-colorswatch {"," border: 1px solid #000;"," color: #fff;","}",""],Blockly.WidgetDiv={},Blockly.WidgetDiv.DIV=null,Blockly.WidgetDiv.field_=null,Blockly.WidgetDiv.dispose_=null,Blockly.WidgetDiv.show=function(e,t){Blockly.WidgetDiv.hide(),Blockly.WidgetDiv.field_=e,Blockly.WidgetDiv.dispose_=t,Blockly.WidgetDiv.DIV.style.display="block"},Blockly.WidgetDiv.hide=function(){Blockly.WidgetDiv.field_&&(Blockly.WidgetDiv.DIV.style.display="none",Blockly.WidgetDiv.dispose_&&Blockly.WidgetDiv.dispose_(),Blockly.WidgetDiv.field_=null,Blockly.WidgetDiv.dispose_=null,goog.dom.removeChildren(Blockly.WidgetDiv.DIV))},Blockly.WidgetDiv.hideIfField=function(e){Blockly.WidgetDiv.field_==e&&Blockly.WidgetDiv.hide()},Blockly.inject=function(e,t){if(!goog.dom.contains(document,e))throw"Error: container is not in current document.";t&&goog.mixin(Blockly,Blockly.parseOptions_(t)),Blockly.createDom_(e),Blockly.init_()},Blockly.parseOptions_=function(e){var t=!!e.readOnly;if(t)var o=!1,n=!1,i=!1,r=null;else(r=e.toolbox)?("string"!=typeof r&&"undefined"==typeof XSLTProcessor&&(r=r.outerHTML),"string"==typeof r&&(r=Blockly.Xml.textToDom(r)),o=!!r.getElementsByTagName("category").length):(r=null,o=!1),n=e.trashcan,void 0===n&&(n=o),i=e.collapse,void 0===i&&(i=o);if(r&&!o)var s=!1;else s=e.scrollbars,void 0===s&&(s=!0);return{RTL:!!e.rtl,collapse:i,readOnly:t,maxBlocks:e.maxBlocks||1/0,pathToBlockly:e.path||"./",hasCategories:o,hasScrollbars:s,hasTrashcan:n,languageTree:r}},Blockly.createDom_=function(e){e.setAttribute("dir","LTR"),goog.ui.Component.setDefaultRightToLeft(Blockly.RTL),Blockly.Css.inject();var t,o,n=Blockly.createSvgElement("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:html":"http://www.w3.org/1999/xhtml","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1","class":"blocklySvg"},null),i=Blockly.createSvgElement("defs",{},n);t=Blockly.createSvgElement("filter",{id:"blocklyEmboss"},i),Blockly.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},t),o=Blockly.createSvgElement("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},t),Blockly.createSvgElement("fePointLight",{x:-5e3,y:-1e4,z:2e4},o),Blockly.createSvgElement("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},t),Blockly.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},t),t=Blockly.createSvgElement("filter",{id:"blocklyTrashcanShadowFilter"},i),Blockly.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:2,result:"blur"},t),Blockly.createSvgElement("feOffset",{"in":"blur",dx:1,dy:1,result:"offsetBlur"},t),t=Blockly.createSvgElement("feMerge",{},t),Blockly.createSvgElement("feMergeNode",{"in":"offsetBlur"},t),Blockly.createSvgElement("feMergeNode",{"in":"SourceGraphic"},t),t=Blockly.createSvgElement("filter",{id:"blocklyShadowFilter"},i),Blockly.createSvgElement("feGaussianBlur",{stdDeviation:2},t),i=Blockly.createSvgElement("pattern",{id:"blocklyDisabledPattern",patternUnits:"userSpaceOnUse",width:10,height:10},i),Blockly.createSvgElement("rect",{width:10,height:10,fill:"#aaa"},i),Blockly.createSvgElement("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},i),Blockly.mainWorkspace=new Blockly.Workspace(Blockly.getMainWorkspaceMetrics_,Blockly.setMainWorkspaceMetrics_),n.appendChild(Blockly.mainWorkspace.createDom()),Blockly.mainWorkspace.maxBlocks=Blockly.maxBlocks,Blockly.readOnly||(Blockly.hasCategories?Blockly.Toolbox.createDom(n,e):(Blockly.mainWorkspace.flyout_=new Blockly.Flyout,i=Blockly.mainWorkspace.flyout_,t=i.createDom(),i.init(Blockly.mainWorkspace,!0),i.autoClose=!1,goog.dom.insertSiblingBefore(t,Blockly.mainWorkspace.svgGroup_),Blockly.addChangeListener(function(){if(0==Blockly.Block.dragMode_){var e=Blockly.mainWorkspace.getMetrics();if(0>e.contentTop||e.contentTop+e.contentHeight>e.viewHeight+e.viewTop||e.contentLeft<(Blockly.RTL?e.viewLeft:0)||e.contentLeft+e.contentWidth>e.viewWidth+(Blockly.RTL?2:1)*e.viewLeft)for(var t,o=Blockly.mainWorkspace.getTopBlocks(!1),n=0;t=o[n];n++){var i=t.getRelativeToSurfaceXY(),r=t.getHeightWidth(),s=e.viewTop+25-r.height-i.y;s>0&&t.moveBy(0,s),s=e.viewTop+e.viewHeight-25-i.y,0>s&&t.moveBy(0,s),s=25+e.viewLeft-i.x-(Blockly.RTL?0:r.width),s>0&&t.moveBy(s,0),s=e.viewLeft+e.viewWidth-25-i.x+(Blockly.RTL?r.width:0),0>s&&t.moveBy(s,0),t.isDeletable()&&50<(Blockly.RTL?i.x-2*e.viewLeft-e.viewWidth:-i.x)&&t.dispose(!1,!0)}}}))),Blockly.Tooltip&&n.appendChild(Blockly.Tooltip.createDom()),!Blockly.readOnly&&Blockly.FieldDropdown&&n.appendChild(Blockly.FieldDropdown.createDom()),Blockly.ContextMenu&&Blockly.ContextMenu&&n.appendChild(Blockly.ContextMenu.createDom()),e.appendChild(n),Blockly.svg=n,Blockly.svgResize(),Blockly.WidgetDiv.DIV=goog.dom.createDom("div","blocklyWidgetDiv"),document.body.appendChild(Blockly.WidgetDiv.DIV)},Blockly.init_=function(){if(goog.userAgent.WEBKIT){var e=Blockly.createSvgElement("path",{d:"m 0,0 c 0,-5 0,-5 0,0 H 50 V 50 z"},Blockly.svg);50<e.getBBox().height&&(Blockly.BROKEN_CONTROL_POINTS=!0),Blockly.svg.removeChild(e)}Blockly.bindEvent_(Blockly.svg,"mousedown",null,Blockly.onMouseDown_),Blockly.bindEvent_(Blockly.svg,"mousemove",null,Blockly.onMouseMove_),Blockly.bindEvent_(Blockly.svg,"contextmenu",null,Blockly.onContextMenu_),Blockly.documentEventsBound_||(Blockly.bindEvent_(window,"resize",document,Blockly.svgResize),Blockly.bindEvent_(document,"mouseup",null,Blockly.onMouseUp_),Blockly.bindEvent_(document,"keydown",null,Blockly.onKeyDown_),goog.userAgent.IPAD&&Blockly.bindEvent_(window,"orientationchange",document,function(){Blockly.fireUiEvent(window,"resize")},!1),Blockly.documentEventsBound_=!0),Blockly.languageTree&&(Blockly.hasCategories?Blockly.Toolbox.init():(Blockly.mainWorkspace.flyout_.init(Blockly.mainWorkspace,!0),Blockly.mainWorkspace.flyout_.show(Blockly.languageTree.childNodes),Blockly.mainWorkspace.scrollX=Blockly.mainWorkspace.flyout_.width_,e="translate("+Blockly.mainWorkspace.scrollX+", 0)",Blockly.mainWorkspace.getCanvas().setAttribute("transform",e),Blockly.mainWorkspace.getBubbleCanvas().setAttribute("transform",e))),Blockly.hasScrollbars&&(Blockly.mainWorkspace.scrollbar=new Blockly.ScrollbarPair(Blockly.mainWorkspace),Blockly.mainWorkspace.scrollbar.resize()),Blockly.mainWorkspace.addTrashcan(),Blockly.loadAudio_(["media/click.mp3","media/click.wav","media/click.ogg"],"click"),Blockly.loadAudio_(["media/delete.mp3","media/delete.ogg","media/delete.wav"],"delete")},Blockly.utils={},Blockly.addClass_=function(e,t){var o=e.getAttribute("class")||"";-1==(" "+o+" ").indexOf(" "+t+" ")&&(o&&(o+=" "),e.setAttribute("class",o+t))},Blockly.removeClass_=function(e,t){var o=e.getAttribute("class");if(-1!=(" "+o+" ").indexOf(" "+t+" ")){for(var o=o.split(/\s+/),n=0;n<o.length;n++)o[n]&&o[n]!=t||(o.splice(n,1),n--);o.length?e.setAttribute("class",o.join(" ")):e.removeAttribute("class")}},Blockly.bindEvent_=function(e,t,o,n){var i,r=[];if(!e.addEventListener)throw"Element is not a DOM node with addEventListener.";return i=function(){n.apply(o,arguments)},e.addEventListener(t,i,!1),r.push([e,t,i]),t in Blockly.bindEvent_.TOUCH_MAP&&(i=function(e){if(1==e.changedTouches.length){var t=e.changedTouches[0];e.clientX=t.clientX,e.clientY=t.clientY}n.apply(o,arguments),e.preventDefault()},e.addEventListener(Blockly.bindEvent_.TOUCH_MAP[t],i,!1),r.push([e,Blockly.bindEvent_.TOUCH_MAP[t],i])),r},Blockly.bindEvent_.TOUCH_MAP={},"ontouchstart"in document.documentElement&&(Blockly.bindEvent_.TOUCH_MAP={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"}),Blockly.unbindEvent_=function(e){for(;e.length;){var t=e.pop(),o=t[2];t[0].removeEventListener(t[1],o,!1)}return o},Blockly.fireUiEvent=function(e,t){var o=document;if(o.createEvent)o=o.createEvent("UIEvents"),o.initEvent(t,!0,!0),e.dispatchEvent(o);else{if(!o.createEventObject)throw"FireEvent: No event creation mechanism.";o=o.createEventObject(),e.fireEvent("on"+t,o)}},Blockly.noEvent=function(e){e.preventDefault(),e.stopPropagation()},Blockly.getRelativeXY_=function(e){var t={x:0,y:0},o=e.getAttribute("x");return o&&(t.x=parseInt(o,10)),(o=e.getAttribute("y"))&&(t.y=parseInt(o,10)),(e=(e=e.getAttribute("transform"))&&e.match(/translate\(\s*([-\d.]+)([ ,]\s*([-\d.]+)\s*\))?/))&&(t.x+=parseInt(e[1],10),e[3]&&(t.y+=parseInt(e[3],10))),t},Blockly.getSvgXY_=function(e){var t=0,o=0;do{var n=Blockly.getRelativeXY_(e),t=t+n.x,o=o+n.y;e=e.parentNode}while(e&&e!=Blockly.svg);return{x:t,y:o}},Blockly.getAbsoluteXY_=function(e){return e=Blockly.getSvgXY_(e),Blockly.convertCoordinates(e.x,e.y,!1)},Blockly.createSvgElement=function(e,t,o){e=document.createElementNS(Blockly.SVG_NS,e);for(var n in t)e.setAttribute(n,t[n]);return document.body.runtimeStyle&&(e.runtimeStyle=e.currentStyle=e.style),o&&o.appendChild(e),e},Blockly.isRightButton=function(e){return 2==e.button||e.ctrlKey},Blockly.convertCoordinates=function(e,t,o){o&&(e-=window.scrollX||window.pageXOffset,t-=window.scrollY||window.pageYOffset);var n=Blockly.svg.createSVGPoint();return n.x=e,n.y=t,e=Blockly.svg.getScreenCTM(),o&&(e=e.inverse()),n=n.matrixTransform(e),o||(n.x+=window.scrollX||window.pageXOffset,n.y+=window.scrollY||window.pageYOffset),n},Blockly.mouseToSvg=function(e){return Blockly.convertCoordinates(e.clientX+(window.scrollX||window.pageXOffset),e.clientY+(window.scrollY||window.pageYOffset),!0)},Blockly.shortestStringLength=function(e){if(!e.length)return 0;for(var t=e[0].length,o=1;o<e.length;o++)t=Math.min(t,e[o].length);return t},Blockly.commonWordPrefix=function(e,t){if(!e.length)return 0;if(1==e.length)return e[0].length;for(var o=0,n=t||Blockly.shortestStringLength(e),i=0;n>i;i++){for(var r=e[0][i],s=1;s<e.length;s++)if(r!=e[s][i])return o;" "==r&&(o=i+1)}for(s=1;s<e.length;s++)if((r=e[s][i])&&" "!=r)return o;return n},Blockly.commonWordSuffix=function(e,t){if(!e.length)return 0;if(1==e.length)return e[0].length;for(var o=0,n=t||Blockly.shortestStringLength(e),i=0;n>i;i++){for(var r=e[0].substr(-i-1,1),s=1;s<e.length;s++)if(r!=e[s].substr(-i-1,1))return o;" "==r&&(o=i+1)}for(s=1;s<e.length;s++)if((r=e[s].charAt(e[s].length-i-1))&&" "!=r)return o;return n},Blockly.isNumber=function(e){return!!e.match(/^\s*-?\d+(\.\d+)?\s*$/)},Blockly.pathToBlockly="./",Blockly.SVG_NS="http://www.w3.org/2000/svg",Blockly.HTML_NS="http://www.w3.org/1999/xhtml",Blockly.HSV_SATURATION=.45,Blockly.HSV_VALUE=.65,Blockly.makeColour=function(e){return goog.color.hsvToHex(e,Blockly.HSV_SATURATION,256*Blockly.HSV_VALUE)},Blockly.INPUT_VALUE=1,Blockly.OUTPUT_VALUE=2,Blockly.NEXT_STATEMENT=3,Blockly.PREVIOUS_STATEMENT=4,Blockly.DUMMY_INPUT=5,Blockly.ALIGN_LEFT=-1,Blockly.ALIGN_CENTRE=0,Blockly.ALIGN_RIGHT=1,Blockly.OPPOSITE_TYPE=[],Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE,Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE,Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT,Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT,Blockly.SOUNDS_=Object.create(null),Blockly.selected=null,Blockly.readOnly=!1,Blockly.highlightedConnection_=null,Blockly.localConnection_=null,Blockly.DRAG_RADIUS=5,Blockly.SNAP_RADIUS=15,Blockly.BUMP_DELAY=250,Blockly.COLLAPSE_CHARS=30,Blockly.mainWorkspace=null,Blockly.clipboard_=null,Blockly.svgSize=function(){return{width:Blockly.svg.cachedWidth_,height:Blockly.svg.cachedHeight_}},Blockly.svgResize=function(){var e=Blockly.svg,t=e.parentNode,o=t.offsetWidth,t=t.offsetHeight;e.cachedWidth_!=o&&(e.setAttribute("width",o+"px"),e.cachedWidth_=o),e.cachedHeight_!=t&&(e.setAttribute("height",t+"px"),e.cachedHeight_=t),Blockly.mainWorkspace.scrollbar&&Blockly.mainWorkspace.scrollbar.resize()},Blockly.onMouseDown_=function(e){Blockly.terminateDrag_(),Blockly.hideChaff();var t=e.target&&e.target.nodeName&&"svg"==e.target.nodeName.toLowerCase();!Blockly.readOnly&&Blockly.selected&&t&&Blockly.selected.unselect(),Blockly.isRightButton(e)?Blockly.ContextMenu&&Blockly.showContextMenu_(Blockly.mouseToSvg(e)):(Blockly.readOnly||t)&&Blockly.mainWorkspace.scrollbar&&(Blockly.mainWorkspace.dragMode=!0,Blockly.mainWorkspace.startDragMouseX=e.clientX,Blockly.mainWorkspace.startDragMouseY=e.clientY,Blockly.mainWorkspace.startDragMetrics=Blockly.mainWorkspace.getMetrics(),Blockly.mainWorkspace.startScrollX=Blockly.mainWorkspace.scrollX,Blockly.mainWorkspace.startScrollY=Blockly.mainWorkspace.scrollY)},Blockly.onMouseUp_=function(){Blockly.setCursorHand_(!1),Blockly.mainWorkspace.dragMode=!1},Blockly.onMouseMove_=function(e){if(Blockly.mainWorkspace.dragMode){Blockly.removeAllRanges();var t=Blockly.mainWorkspace.startDragMetrics,o=Blockly.mainWorkspace.startScrollX+(e.clientX-Blockly.mainWorkspace.startDragMouseX);e=Blockly.mainWorkspace.startScrollY+(e.clientY-Blockly.mainWorkspace.startDragMouseY),o=Math.min(o,-t.contentLeft),e=Math.min(e,-t.contentTop),o=Math.max(o,t.viewWidth-t.contentLeft-t.contentWidth),e=Math.max(e,t.viewHeight-t.contentTop-t.contentHeight),Blockly.mainWorkspace.scrollbar.set(-o-t.contentLeft,-e-t.contentTop)}},Blockly.onKeyDown_=function(e){if(!Blockly.isTargetInput_(e))if(27==e.keyCode)Blockly.hideChaff();else if(8==e.keyCode||46==e.keyCode)try{Blockly.selected&&Blockly.selected.isDeletable()&&(Blockly.hideChaff(),Blockly.selected.dispose(!0,!0))}finally{e.preventDefault()}else(e.altKey||e.ctrlKey||e.metaKey)&&(Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.workspace==Blockly.mainWorkspace&&(Blockly.hideChaff(),67==e.keyCode?Blockly.copy_(Blockly.selected):88==e.keyCode&&(Blockly.copy_(Blockly.selected),Blockly.selected.dispose(!0,!0))),86==e.keyCode&&Blockly.clipboard_&&Blockly.mainWorkspace.paste(Blockly.clipboard_))},Blockly.terminateDrag_=function(){Blockly.Block.terminateDrag_(),Blockly.Flyout.terminateDrag_()},Blockly.copy_=function(e){var t=Blockly.Xml.blockToDom_(e);Blockly.Xml.deleteNext(t),e=e.getRelativeToSurfaceXY(),t.setAttribute("x",Blockly.RTL?-e.x:e.x),t.setAttribute("y",e.y),Blockly.clipboard_=t},Blockly.showContextMenu_=function(e){if(!Blockly.readOnly){var t=[];if(Blockly.collapse){for(var o=!1,n=!1,i=Blockly.mainWorkspace.getTopBlocks(!1),r=0;r<i.length;r++)i[r].isCollapsed()?o=!0:n=!0;n={enabled:n},n.text=Blockly.Msg.COLLAPSE_ALL,n.callback=function(){for(var e=0;e<i.length;e++)i[e].setCollapsed(!0)},t.push(n),o={enabled:o},o.text=Blockly.Msg.EXPAND_ALL,o.callback=function(){for(var e=0;e<i.length;e++)i[e].setCollapsed(!1)},t.push(o)}o={enabled:!1},o.text=Blockly.Msg.HELP,o.callback=function(){},t.push(o),Blockly.ContextMenu.show(e,t)}},Blockly.onContextMenu_=function(e){!Blockly.isTargetInput_(e)&&Blockly.ContextMenu&&e.preventDefault()},Blockly.hideChaff=function(e){Blockly.Tooltip&&Blockly.Tooltip.hide(),Blockly.ContextMenu&&Blockly.ContextMenu.hide(),Blockly.FieldDropdown&&Blockly.FieldDropdown.hide(),Blockly.WidgetDiv.hide(),!e&&Blockly.Toolbox.flyout_&&Blockly.Toolbox.flyout_.autoClose&&Blockly.Toolbox.clearSelection()},Blockly.removeAllRanges=function(){if(window.getSelection){var e=window.getSelection();e&&e.removeAllRanges&&(e.removeAllRanges(),window.setTimeout(function(){window.getSelection().removeAllRanges()},0))}},Blockly.isTargetInput_=function(e){return"textarea"==e.target.type||"text"==e.target.type},Blockly.loadAudio_=function(e,t){if(window.Audio&&e.length){for(var o,n=new window.Audio,i=0;i<e.length;i++){var r=e[i],s=r.match(/\.(\w+)$/);if(s&&n.canPlayType("audio/"+s[1])){o=new window.Audio(Blockly.pathToBlockly+r);break}}o&&o.play&&(o.volume=.01,o.play(),Blockly.SOUNDS_[t]=o)}},Blockly.playAudio=function(e,t){var o=Blockly.SOUNDS_[e];o&&(o=goog.userAgent.DOCUMENT_MODE&&9===goog.userAgent.DOCUMENT_MODE||goog.userAgent.IPAD||goog.userAgent.ANDROID?o:o.cloneNode(),o.volume=void 0===t?1:t,o.play())},Blockly.setCursorHand_=function(e){if(!Blockly.readOnly){var t="";e&&(t="url("+Blockly.pathToBlockly+"media/handclosed.cur) 7 3, auto"),Blockly.selected&&(Blockly.selected.getSvgRoot().style.cursor=t),Blockly.svg.style.cursor=t}},Blockly.getMainWorkspaceMetrics_=function(){var e=Blockly.svgSize();e.width-=Blockly.Toolbox.width;var t=e.width-Blockly.Scrollbar.scrollbarThickness,o=e.height-Blockly.Scrollbar.scrollbarThickness;try{var n=Blockly.mainWorkspace.getCanvas().getBBox()}catch(i){return null}if(Blockly.mainWorkspace.scrollbar)var r=Math.min(n.x-t/2,n.x+n.width-t),t=Math.max(n.x+n.width+t/2,n.x+t),s=Math.min(n.y-o/2,n.y+n.height-o),o=Math.max(n.y+n.height+o/2,n.y+o);else r=n.x,t=r+n.width,s=n.y,o=s+n.height;return{viewHeight:e.height,viewWidth:e.width,contentHeight:o-s,contentWidth:t-r,viewTop:-Blockly.mainWorkspace.scrollY,viewLeft:-Blockly.mainWorkspace.scrollX,contentTop:s,contentLeft:r,absoluteTop:0,absoluteLeft:Blockly.RTL?0:Blockly.Toolbox.width}},Blockly.setMainWorkspaceMetrics_=function(e){if(!Blockly.mainWorkspace.scrollbar)throw"Attempt to set main workspace scroll without scrollbars.";var t=Blockly.getMainWorkspaceMetrics_();goog.isNumber(e.x)&&(Blockly.mainWorkspace.scrollX=-t.contentWidth*e.x-t.contentLeft),goog.isNumber(e.y)&&(Blockly.mainWorkspace.scrollY=-t.contentHeight*e.y-t.contentTop),e="translate("+(Blockly.mainWorkspace.scrollX+t.absoluteLeft)+","+(Blockly.mainWorkspace.scrollY+t.absoluteTop)+")",Blockly.mainWorkspace.getCanvas().setAttribute("transform",e),Blockly.mainWorkspace.getBubbleCanvas().setAttribute("transform",e)},Blockly.addChangeListener=function(e){return Blockly.bindEvent_(Blockly.mainWorkspace.getCanvas(),"blocklyWorkspaceChange",null,e)},Blockly.removeChangeListener=function(e){Blockly.unbindEvent_(e)},Blockly.getMainWorkspace=function(){return Blockly.mainWorkspace},window.Blockly=Blockly,Blockly.getMainWorkspace=Blockly.getMainWorkspace,Blockly.addChangeListener=Blockly.addChangeListener,Blockly.removeChangeListener=Blockly.removeChangeListener,Blockly.Blocks.colour={},Blockly.Blocks.colour_picker={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_PICKER_HELPURL),this.setColour(20),this.appendDummyInput().appendField(new Blockly.FieldColour("#ff0000"),"COLOUR"),this.setOutput(!0,"Colour"),this.setTooltip(Blockly.Msg.COLOUR_PICKER_TOOLTIP)}},Blockly.Blocks.colour_random={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_RANDOM_HELPURL),this.setColour(20),this.appendDummyInput().appendField(Blockly.Msg.COLOUR_RANDOM_TITLE),this.setOutput(!0,"Colour"),this.setTooltip(Blockly.Msg.COLOUR_RANDOM_TOOLTIP)}},Blockly.Blocks.colour_rgb={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_RGB_HELPURL),this.setColour(20),this.appendValueInput("RED").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_TITLE).appendField(Blockly.Msg.COLOUR_RGB_RED),this.appendValueInput("GREEN").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_GREEN),this.appendValueInput("BLUE").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_RGB_BLUE),this.setOutput(!0,"Colour"),this.setTooltip(Blockly.Msg.COLOUR_RGB_TOOLTIP)}},Blockly.Blocks.colour_blend={init:function(){this.setHelpUrl(Blockly.Msg.COLOUR_BLEND_HELPURL),this.setColour(20),this.appendValueInput("COLOUR1").setCheck("Colour").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_TITLE).appendField(Blockly.Msg.COLOUR_BLEND_COLOUR1),this.appendValueInput("COLOUR2").setCheck("Colour").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_COLOUR2),this.appendValueInput("RATIO").setCheck("Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.COLOUR_BLEND_RATIO),this.setOutput(!0,"Colour"),this.setTooltip(Blockly.Msg.COLOUR_BLEND_TOOLTIP)}},Blockly.Blocks.lists={},Blockly.Blocks.lists_create_empty={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL),this.setColour(260),this.setOutput(!0,"Array"),this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE),this.setTooltip(Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP)}},Blockly.Blocks.lists_create_with={init:function(){this.setColour(260),this.appendValueInput("ADD0").appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH),this.appendValueInput("ADD1"),this.appendValueInput("ADD2"),this.setOutput(!0,"Array"),this.setMutator(new Blockly.Mutator(["lists_create_with_item"])),this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP),this.itemCount_=3},mutationToDom:function(e){return e=document.createElement("mutation"),e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){for(var t=0;t<this.itemCount_;t++)this.removeInput("ADD"+t);for(this.itemCount_=parseInt(e.getAttribute("items"),10),t=0;t<this.itemCount_;t++)e=this.appendValueInput("ADD"+t),0==t&&e.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);0==this.itemCount_&&this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE)},decompose:function(e){var t=new Blockly.Block(e,"lists_create_with_container");t.initSvg();for(var o=t.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var i=new Blockly.Block(e,"lists_create_with_item");i.initSvg(),o.connect(i.previousConnection),o=i.nextConnection}return t},compose:function(e){if(0==this.itemCount_)this.removeInput("EMPTY");else for(var t=this.itemCount_-1;t>=0;t--)this.removeInput("ADD"+t);for(this.itemCount_=0,e=e.getInputTargetBlock("STACK");e;)t=this.appendValueInput("ADD"+this.itemCount_),0==this.itemCount_&&t.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH),e.valueConnection_&&t.connection.connect(e.valueConnection_),this.itemCount_++,e=e.nextConnection&&e.nextConnection.targetBlock();0==this.itemCount_&&this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE)},saveConnections:function(e){e=e.getInputTargetBlock("STACK");for(var t=0;e;){var o=this.getInput("ADD"+t);e.valueConnection_=o&&o.connection.targetConnection,t++,e=e.nextConnection&&e.nextConnection.targetBlock()}}},Blockly.Blocks.lists_create_with_container={init:function(){this.setColour(260),this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},Blockly.Blocks.lists_create_with_item={init:function(){this.setColour(260),this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},Blockly.Blocks.lists_repeat={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_REPEAT_HELPURL),this.setColour(260),this.setOutput(!0,"Array"),this.interpolateMsg(Blockly.Msg.LISTS_REPEAT_TITLE,["ITEM",null,Blockly.ALIGN_RIGHT],["NUM","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setTooltip(Blockly.Msg.LISTS_REPEAT_TOOLTIP)}},Blockly.Blocks.lists_length={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_LENGTH_HELPURL),this.setColour(260),this.interpolateMsg(Blockly.Msg.LISTS_LENGTH_TITLE,["VALUE",["Array","String"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Number"),this.setTooltip(Blockly.Msg.LISTS_LENGTH_TOOLTIP)}},Blockly.Blocks.lists_isEmpty={init:function(){this.setHelpUrl(Blockly.Msg.LISTS_IS_EMPTY_HELPURL),this.setColour(260),this.interpolateMsg(Blockly.Msg.LISTS_IS_EMPTY_TITLE,["VALUE",["Array","String"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip(Blockly.Msg.LISTS_TOOLTIP)}},Blockly.Blocks.lists_indexOf={init:function(){var e=[[Blockly.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[Blockly.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_INDEX_OF_HELPURL),this.setColour(260),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST),this.appendValueInput("FIND").appendField(new Blockly.FieldDropdown(e),"END"),this.setInputsInline(!0),this.setTooltip(Blockly.Msg.LISTS_INDEX_OF_TOOLTIP)}},Blockly.Blocks.lists_getIndex={init:function(){var e=[[Blockly.Msg.LISTS_GET_INDEX_GET,"GET"],[Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[Blockly.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(Blockly.Msg.LISTS_GET_INDEX_HELPURL),this.setColour(260),e=new Blockly.FieldDropdown(e,function(e){this.sourceBlock_.updateStatement("REMOVE"==e)}),this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt(!0);var t=this;
30
- this.setTooltip(function(){var e=t.getFieldValue("MODE")+"_"+t.getFieldValue("WHERE");return Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_"+e]})},mutationToDom:function(){var e=document.createElement("mutation");e.setAttribute("statement",!this.outputConnection);var t=this.getInput("AT").type==Blockly.INPUT_VALUE;return e.setAttribute("at",t),e},domToMutation:function(e){var t="true"==e.getAttribute("statement");this.updateStatement(t),e="false"!=e.getAttribute("at"),this.updateAt(e)},updateStatement:function(e){e!=!this.outputConnection&&(this.unplug(!0,!0),e?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var t=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(t){var o="FROM_START"==t||"FROM_END"==t;if(o!=e){var n=this.sourceBlock_;return n.updateAt(o),n.setFieldValue(t,"WHERE"),null}});this.getInput("AT").appendField(t,"WHERE"),Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},Blockly.Blocks.lists_setIndex={init:function(){var e=[[Blockly.Msg.LISTS_SET_INDEX_SET,"SET"],[Blockly.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(Blockly.Msg.LISTS_SET_INDEX_HELPURL),this.setColour(260),this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(new Blockly.FieldDropdown(e),"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("MODE")+"_"+t.getFieldValue("WHERE");return Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_"+e]})},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT").type==Blockly.INPUT_VALUE;return e.setAttribute("at",t),e},domToMutation:function(e){e="false"!=e.getAttribute("at"),this.updateAt(e)},updateAt:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var t=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(t){var o="FROM_START"==t||"FROM_END"==t;if(o!=e){var n=this.sourceBlock_;return n.updateAt(o),n.setFieldValue(t,"WHERE"),null}});this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO"),this.getInput("AT").appendField(t,"WHERE")}},Blockly.Blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(Blockly.Msg.LISTS_GET_SUBLIST_HELPURL),this.setColour(260),this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt(1,!0),this.updateAt(2,!0),this.setTooltip(Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT1").type==Blockly.INPUT_VALUE;return e.setAttribute("at1",t),t=this.getInput("AT2").type==Blockly.INPUT_VALUE,e.setAttribute("at2",t),e},domToMutation:function(e){var t="true"==e.getAttribute("at1");e="true"==e.getAttribute("at2"),this.updateAt(1,t),this.updateAt(2,e)},updateAt:function(e,t){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),t?(this.appendValueInput("AT"+e).setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e);var o=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+e],function(o){var n="FROM_START"==o||"FROM_END"==o;if(n!=t){var i=this.sourceBlock_;return i.updateAt(e,n),i.setFieldValue(o,"WHERE"+e),null}});this.getInput("AT"+e).appendField(o,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2")),Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}},Blockly.Blocks.logic={},Blockly.Blocks.controls_if={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_IF_HELPURL),this.setColour(210),this.appendValueInput("IF0").setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_IF),this.appendStatementInput("DO0").appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setMutator(new Blockly.Mutator(["controls_if_elseif","controls_if_else"]));var e=this;this.setTooltip(function(){return e.elseifCount_||e.elseCount_?!e.elseifCount_&&e.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_2:e.elseifCount_&&!e.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_3:e.elseifCount_&&e.elseCount_?Blockly.Msg.CONTROLS_IF_TOOLTIP_4:"":Blockly.Msg.CONTROLS_IF_TOOLTIP_1}),this.elseCount_=this.elseifCount_=0},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=document.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(e){for(this.elseifCount_=parseInt(e.getAttribute("elseif"),10),this.elseCount_=parseInt(e.getAttribute("else"),10),e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)},decompose:function(e){var t=new Blockly.Block(e,"controls_if_if");t.initSvg();for(var o=t.getInput("STACK").connection,n=1;n<=this.elseifCount_;n++){var i=new Blockly.Block(e,"controls_if_elseif");i.initSvg(),o.connect(i.previousConnection),o=i.nextConnection}return this.elseCount_&&(e=new Blockly.Block(e,"controls_if_else"),e.initSvg(),o.connect(e.previousConnection)),t},compose:function(e){this.elseCount_&&this.removeInput("ELSE"),this.elseCount_=0;for(var t=this.elseifCount_;t>0;t--)this.removeInput("IF"+t),this.removeInput("DO"+t);for(this.elseifCount_=0,e=e.getInputTargetBlock("STACK");e;){switch(e.type){case"controls_if_elseif":this.elseifCount_++;var t=this.appendValueInput("IF"+this.elseifCount_).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),o=this.appendStatementInput("DO"+this.elseifCount_);o.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN),e.valueConnection_&&t.connection.connect(e.valueConnection_),e.statementConnection_&&o.connection.connect(e.statementConnection_);break;case"controls_if_else":this.elseCount_++,t=this.appendStatementInput("ELSE"),t.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE),e.statementConnection_&&t.connection.connect(e.statementConnection_);break;default:throw"Unknown block type."}e=e.nextConnection&&e.nextConnection.targetBlock()}},saveConnections:function(e){e=e.getInputTargetBlock("STACK");for(var t=1;e;){switch(e.type){case"controls_if_elseif":var o=this.getInput("IF"+t),n=this.getInput("DO"+t);e.valueConnection_=o&&o.connection.targetConnection,e.statementConnection_=n&&n.connection.targetConnection,t++;break;case"controls_if_else":n=this.getInput("ELSE"),e.statementConnection_=n&&n.connection.targetConnection;break;default:throw"Unknown block type."}e=e.nextConnection&&e.nextConnection.targetBlock()}}},Blockly.Blocks.controls_if_if={init:function(){this.setColour(210),this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF),this.appendStatementInput("STACK"),this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP),this.contextMenu=!1}},Blockly.Blocks.controls_if_elseif={init:function(){this.setColour(210),this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP),this.contextMenu=!1}},Blockly.Blocks.controls_if_else={init:function(){this.setColour(210),this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE),this.setPreviousStatement(!0),this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP),this.contextMenu=!1}},Blockly.Blocks.logic_compare={init:function(){var e=Blockly.RTL?[["=","EQ"],["≠","NEQ"],[">","LT"],["≥","LTE"],["<","GT"],["≤","GTE"]]:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]];this.setHelpUrl(Blockly.Msg.LOGIC_COMPARE_HELPURL),this.setColour(210),this.setOutput(!0,"Boolean"),this.appendValueInput("A"),this.appendValueInput("B").appendField(new Blockly.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{EQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,LT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT,LTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE,GT:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT,GTE:Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE}[e]})}},Blockly.Blocks.logic_operation={init:function(){var e=[[Blockly.Msg.LOGIC_OPERATION_AND,"AND"],[Blockly.Msg.LOGIC_OPERATION_OR,"OR"]];this.setHelpUrl(Blockly.Msg.LOGIC_OPERATION_HELPURL),this.setColour(210),this.setOutput(!0,"Boolean"),this.appendValueInput("A").setCheck("Boolean"),this.appendValueInput("B").setCheck("Boolean").appendField(new Blockly.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{AND:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND,OR:Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR}[e]})}},Blockly.Blocks.logic_negate={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NEGATE_HELPURL),this.setColour(210),this.setOutput(!0,"Boolean"),this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE,["BOOL","Boolean",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP)}},Blockly.Blocks.logic_boolean={init:function(){var e=[[Blockly.Msg.LOGIC_BOOLEAN_TRUE,"TRUE"],[Blockly.Msg.LOGIC_BOOLEAN_FALSE,"FALSE"]];this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL),this.setColour(210),this.setOutput(!0,"Boolean"),this.appendDummyInput().appendField(new Blockly.FieldDropdown(e),"BOOL"),this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP)}},Blockly.Blocks.logic_null={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_NULL_HELPURL),this.setColour(210),this.setOutput(!0),this.appendDummyInput().appendField(Blockly.Msg.LOGIC_NULL),this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP)}},Blockly.Blocks.logic_ternary={init:function(){this.setHelpUrl(Blockly.Msg.LOGIC_TERNARY_HELPURL),this.setColour(210),this.appendValueInput("IF").setCheck("Boolean").appendField(Blockly.Msg.LOGIC_TERNARY_CONDITION),this.appendValueInput("THEN").appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE),this.appendValueInput("ELSE").appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE),this.setOutput(!0),this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP)}},Blockly.Blocks.loops={},Blockly.Blocks.controls_repeat={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_REPEAT_HELPURL),this.setColour(120),this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_REPEAT).appendField(new Blockly.FieldTextInput("10",Blockly.FieldTextInput.nonnegativeIntegerValidator),"TIMES").appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_TIMES),this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.CONTROLS_REPEAT_TOOLTIP)}},Blockly.Blocks.controls_repeat_ext={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_REPEAT_HELPURL),this.setColour(120),this.interpolateMsg(Blockly.Msg.CONTROLS_REPEAT_TITLE,["TIMES","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip(Blockly.Msg.CONTROLS_REPEAT_TOOLTIP)}},Blockly.Blocks.controls_whileUntil={init:function(){var e=[[Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE,"WHILE"],[Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL,"UNTIL"]];this.setHelpUrl(Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL),this.setColour(120),this.appendValueInput("BOOL").setCheck("Boolean").appendField(new Blockly.FieldDropdown(e),"MODE"),this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO),this.setPreviousStatement(!0),this.setNextStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("MODE");return{WHILE:Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,UNTIL:Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}[e]})}},Blockly.Blocks.controls_for={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_FOR_HELPURL),this.setColour(120),this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_FOR_INPUT_WITH).appendField(new Blockly.FieldVariable(null),"VAR"),this.interpolateMsg(Blockly.Msg.CONTROLS_FOR_INPUT_FROM_TO_BY,["FROM","Number",Blockly.ALIGN_RIGHT],["TO","Number",Blockly.ALIGN_RIGHT],["BY","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOR_INPUT_DO),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0);var e=this;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOR_TOOLTIP.replace("%1",e.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){Blockly.Names.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")},customContextMenu:function(e){var t={enabled:!0},o=this.getFieldValue("VAR");t.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",o),o=goog.dom.createDom("field",null,o),o.setAttribute("name","VAR"),o=goog.dom.createDom("block",null,o),o.setAttribute("type","variables_get"),t.callback=Blockly.ContextMenu.callbackFactory(this,o),e.push(t)}},Blockly.Blocks.controls_forEach={init:function(){this.setHelpUrl(Blockly.Msg.CONTROLS_FOREACH_HELPURL),this.setColour(120),this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM).appendField(new Blockly.FieldVariable(null),"VAR").appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST),Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL&&(this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL),this.setInputsInline(!0)),this.appendStatementInput("DO").appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_DO),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){return Blockly.Msg.CONTROLS_FOREACH_TOOLTIP.replace("%1",e.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){Blockly.Names.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")},customContextMenu:Blockly.Blocks.controls_for.customContextMenu},Blockly.Blocks.controls_flow_statements={init:function(){var e=[[Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK,"BREAK"],[Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE,"CONTINUE"]];this.setHelpUrl(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL),this.setColour(120),this.appendDummyInput().appendField(new Blockly.FieldDropdown(e),"FLOW"),this.setPreviousStatement(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("FLOW");return t.TOOLTIPS[e]})},onchange:function(){if(this.workspace){var e=!1,t=this;do{if("controls_repeat"==t.type||"controls_repeat_ext"==t.type||"controls_forEach"==t.type||"controls_for"==t.type||"controls_whileUntil"==t.type){e=!0;break}t=t.getSurroundParent()}while(t);e?this.setWarningText(null):this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING)}}},Blockly.Blocks.math={},Blockly.Blocks.math_number={init:function(){this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL),this.setColour(230),this.appendDummyInput().appendField(new Blockly.FieldTextInput("0",Blockly.FieldTextInput.numberValidator),"NUM"),this.setOutput(!0,"Number"),this.setTooltip(Blockly.Msg.MATH_NUMBER_TOOLTIP)}},Blockly.Blocks.math_arithmetic={init:function(){var e=[[Blockly.Msg.MATH_ADDITION_SYMBOL,"ADD"],[Blockly.Msg.MATH_SUBTRACTION_SYMBOL,"MINUS"],[Blockly.Msg.MATH_MULTIPLICATION_SYMBOL,"MULTIPLY"],[Blockly.Msg.MATH_DIVISION_SYMBOL,"DIVIDE"],[Blockly.Msg.MATH_POWER_SYMBOL,"POWER"]];this.setHelpUrl(Blockly.Msg.MATH_ARITHMETIC_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.appendValueInput("A").setCheck("Number"),this.appendValueInput("B").setCheck("Number").appendField(new Blockly.FieldDropdown(e),"OP"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{ADD:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY,DIVIDE:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE,POWER:Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_POWER}[e]})}},Blockly.Blocks.math_single={init:function(){var e=[[Blockly.Msg.MATH_SINGLE_OP_ROOT,"ROOT"],[Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE,"ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]];this.setHelpUrl(Blockly.Msg.MATH_SINGLE_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.appendValueInput("NUM").setCheck("Number").appendField(new Blockly.FieldDropdown(e),"OP");var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{ROOT:Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT,ABS:Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS,NEG:Blockly.Msg.MATH_SINGLE_TOOLTIP_NEG,LN:Blockly.Msg.MATH_SINGLE_TOOLTIP_LN,LOG10:Blockly.Msg.MATH_SINGLE_TOOLTIP_LOG10,EXP:Blockly.Msg.MATH_SINGLE_TOOLTIP_EXP,POW10:Blockly.Msg.MATH_SINGLE_TOOLTIP_POW10}[e]})}},Blockly.Blocks.math_trig={init:function(){var e=[[Blockly.Msg.MATH_TRIG_SIN,"SIN"],[Blockly.Msg.MATH_TRIG_COS,"COS"],[Blockly.Msg.MATH_TRIG_TAN,"TAN"],[Blockly.Msg.MATH_TRIG_ASIN,"ASIN"],[Blockly.Msg.MATH_TRIG_ACOS,"ACOS"],[Blockly.Msg.MATH_TRIG_ATAN,"ATAN"]];this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.appendValueInput("NUM").setCheck("Number").appendField(new Blockly.FieldDropdown(e),"OP");var t=this;this.setTooltip(function(){var e=t.getFieldValue("OP");return{SIN:Blockly.Msg.MATH_TRIG_TOOLTIP_SIN,COS:Blockly.Msg.MATH_TRIG_TOOLTIP_COS,TAN:Blockly.Msg.MATH_TRIG_TOOLTIP_TAN,ASIN:Blockly.Msg.MATH_TRIG_TOOLTIP_ASIN,ACOS:Blockly.Msg.MATH_TRIG_TOOLTIP_ACOS,ATAN:Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN}[e]})}},Blockly.Blocks.math_constant={init:function(){this.setHelpUrl(Blockly.Msg.MATH_CONSTANT_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.appendDummyInput().appendField(new Blockly.FieldDropdown([["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]),"CONSTANT"),this.setTooltip(Blockly.Msg.MATH_CONSTANT_TOOLTIP)}},Blockly.Blocks.math_number_property={init:function(){var e=[[Blockly.Msg.MATH_IS_EVEN,"EVEN"],[Blockly.Msg.MATH_IS_ODD,"ODD"],[Blockly.Msg.MATH_IS_PRIME,"PRIME"],[Blockly.Msg.MATH_IS_WHOLE,"WHOLE"],[Blockly.Msg.MATH_IS_POSITIVE,"POSITIVE"],[Blockly.Msg.MATH_IS_NEGATIVE,"NEGATIVE"],[Blockly.Msg.MATH_IS_DIVISIBLE_BY,"DIVISIBLE_BY"]];this.setColour(230),this.appendValueInput("NUMBER_TO_CHECK").setCheck("Number"),e=new Blockly.FieldDropdown(e,function(e){this.sourceBlock_.updateShape("DIVISIBLE_BY"==e)}),this.appendDummyInput().appendField(e,"PROPERTY"),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip(Blockly.Msg.MATH_IS_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",t),e},domToMutation:function(e){e="true"==e.getAttribute("divisor_input"),this.updateShape(e)},updateShape:function(e){var t=this.getInput("DIVISOR");e?t||this.appendValueInput("DIVISOR").setCheck("Number"):t&&this.removeInput("DIVISOR")}},Blockly.Blocks.math_change={init:function(){this.setHelpUrl(Blockly.Msg.MATH_CHANGE_HELPURL),this.setColour(230),this.appendValueInput("DELTA").setCheck("Number").appendField(Blockly.Msg.MATH_CHANGE_TITLE_CHANGE).appendField(new Blockly.FieldVariable(Blockly.Msg.MATH_CHANGE_TITLE_ITEM),"VAR").appendField(Blockly.Msg.MATH_CHANGE_INPUT_BY),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){return Blockly.Msg.MATH_CHANGE_TOOLTIP.replace("%1",e.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){Blockly.Names.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")}},Blockly.Blocks.math_round={init:function(){var e=[[Blockly.Msg.MATH_ROUND_OPERATOR_ROUND,"ROUND"],[Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP,"ROUNDUP"],[Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN,"ROUNDDOWN"]];this.setHelpUrl(Blockly.Msg.MATH_ROUND_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.appendValueInput("NUM").setCheck("Number").appendField(new Blockly.FieldDropdown(e),"OP"),this.setTooltip(Blockly.Msg.MATH_ROUND_TOOLTIP)}},Blockly.Blocks.math_on_list={init:function(){var e=[[Blockly.Msg.MATH_ONLIST_OPERATOR_SUM,"SUM"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MIN,"MIN"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MAX,"MAX"],[Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE,"AVERAGE"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MEDIAN,"MEDIAN"],[Blockly.Msg.MATH_ONLIST_OPERATOR_MODE,"MODE"],[Blockly.Msg.MATH_ONLIST_OPERATOR_STD_DEV,"STD_DEV"],[Blockly.Msg.MATH_ONLIST_OPERATOR_RANDOM,"RANDOM"]],t=this;this.setHelpUrl(Blockly.Msg.MATH_ONLIST_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),e=new Blockly.FieldDropdown(e,function(e){"MODE"==e?t.outputConnection.setCheck("Array"):t.outputConnection.setCheck("Number")}),this.appendValueInput("LIST").setCheck("Array").appendField(e,"OP"),this.setTooltip(function(){var e=t.getFieldValue("OP");return{SUM:Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM,MIN:Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN,MAX:Blockly.Msg.MATH_ONLIST_TOOLTIP_MAX,AVERAGE:Blockly.Msg.MATH_ONLIST_TOOLTIP_AVERAGE,MEDIAN:Blockly.Msg.MATH_ONLIST_TOOLTIP_MEDIAN,MODE:Blockly.Msg.MATH_ONLIST_TOOLTIP_MODE,STD_DEV:Blockly.Msg.MATH_ONLIST_TOOLTIP_STD_DEV,RANDOM:Blockly.Msg.MATH_ONLIST_TOOLTIP_RANDOM}[e]})}},Blockly.Blocks.math_modulo={init:function(){this.setHelpUrl(Blockly.Msg.MATH_MODULO_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.interpolateMsg(Blockly.Msg.MATH_MODULO_TITLE,["DIVIDEND","Number",Blockly.ALIGN_RIGHT],["DIVISOR","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setTooltip(Blockly.Msg.MATH_MODULO_TOOLTIP)}},Blockly.Blocks.math_constrain={init:function(){this.setHelpUrl(Blockly.Msg.MATH_CONSTRAIN_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.interpolateMsg(Blockly.Msg.MATH_CONSTRAIN_TITLE,["VALUE","Number",Blockly.ALIGN_RIGHT],["LOW","Number",Blockly.ALIGN_RIGHT],["HIGH","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setTooltip(Blockly.Msg.MATH_CONSTRAIN_TOOLTIP)}},Blockly.Blocks.math_random_int={init:function(){this.setHelpUrl(Blockly.Msg.MATH_RANDOM_INT_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.interpolateMsg(Blockly.Msg.MATH_RANDOM_INT_TITLE,["FROM","Number",Blockly.ALIGN_RIGHT],["TO","Number",Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setTooltip(Blockly.Msg.MATH_RANDOM_INT_TOOLTIP)}},Blockly.Blocks.math_random_float={init:function(){this.setHelpUrl(Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL),this.setColour(230),this.setOutput(!0,"Number"),this.appendDummyInput().appendField(Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM),this.setTooltip(Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP)}},Blockly.Blocks.procedures={},Blockly.Blocks.procedures_defnoreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.setColour(290);var e=Blockly.Procedures.findLegalName(Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,this);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(new Blockly.FieldTextInput(e,Blockly.Procedures.rename),"NAME").appendField("","PARAMS"),this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"])),this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.arguments_=[]},updateParams_:function(){for(var e=!1,t={},o=0;o<this.arguments_.length;o++){if(t["arg_"+this.arguments_[o].toLowerCase()]){e=!0;break}t["arg_"+this.arguments_[o].toLowerCase()]=!0}e?this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING):this.setWarningText(null),e="",this.arguments_.length&&(e=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),this.setFieldValue(e,"PARAMS")},mutationToDom:function(){for(var e=document.createElement("mutation"),t=0;t<this.arguments_.length;t++){var o=document.createElement("arg");o.setAttribute("name",this.arguments_[t]),e.appendChild(o)}return e},domToMutation:function(e){this.arguments_=[];for(var t,o=0;t=e.childNodes[o];o++)"arg"==t.nodeName.toLowerCase()&&this.arguments_.push(t.getAttribute("name"));this.updateParams_()},decompose:function(e){var t=new Blockly.Block(e,"procedures_mutatorcontainer");t.initSvg();for(var o=t.getInput("STACK").connection,n=0;n<this.arguments_.length;n++){var i=new Blockly.Block(e,"procedures_mutatorarg");i.initSvg(),i.setFieldValue(this.arguments_[n],"NAME"),i.oldLocation=n,o.connect(i.previousConnection),o=i.nextConnection}return Blockly.Procedures.mutateCallers(this.getFieldValue("NAME"),this.workspace,this.arguments_,null),t},compose:function(e){for(this.arguments_=[],this.paramIds_=[],e=e.getInputTargetBlock("STACK");e;)this.arguments_.push(e.getFieldValue("NAME")),this.paramIds_.push(e.id),e=e.nextConnection&&e.nextConnection.targetBlock();this.updateParams_(),Blockly.Procedures.mutateCallers(this.getFieldValue("NAME"),this.workspace,this.arguments_,this.paramIds_)},dispose:function(){var e=this.getFieldValue("NAME");Blockly.Procedures.disposeCallers(e,this.workspace),Blockly.Block.prototype.dispose.apply(this,arguments)},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},renameVar:function(e,t){for(var o=!1,n=0;n<this.arguments_.length;n++)Blockly.Names.equals(e,this.arguments_[n])&&(this.arguments_[n]=t,o=!0);if(o&&(this.updateParams_(),this.mutator.isVisible_()))for(var i,o=this.mutator.workspace_.getAllBlocks(),n=0;i=o[n];n++)"procedures_mutatorarg"==i.type&&Blockly.Names.equals(e,i.getFieldValue("NAME"))&&i.setFieldValue(t,"NAME")},customContextMenu:function(e){var t={enabled:!0},o=this.getFieldValue("NAME");t.text=Blockly.Msg.PROCEDURES_CREATE_DO.replace("%1",o);var n=goog.dom.createDom("mutation");n.setAttribute("name",o);for(var i=0;i<this.arguments_.length;i++)o=goog.dom.createDom("arg"),o.setAttribute("name",this.arguments_[i]),n.appendChild(o);for(n=goog.dom.createDom("block",null,n),n.setAttribute("type",this.callType_),t.callback=Blockly.ContextMenu.callbackFactory(this,n),e.push(t),i=0;i<this.arguments_.length;i++)t={enabled:!0},o=this.arguments_[i],t.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",o),n=goog.dom.createDom("field",null,o),n.setAttribute("name","VAR"),n=goog.dom.createDom("block",null,n),n.setAttribute("type","variables_get"),t.callback=Blockly.ContextMenu.callbackFactory(this,n),e.push(t)},callType_:"procedures_callnoreturn"},Blockly.Blocks.procedures_defreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL),this.setColour(290);var e=Blockly.Procedures.findLegalName(Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE,this);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(new Blockly.FieldTextInput(e,Blockly.Procedures.rename),"NAME").appendField("","PARAMS"),this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_DO),this.appendValueInput("RETURN").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"])),this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP),this.arguments_=[]},updateParams_:Blockly.Blocks.procedures_defnoreturn.updateParams_,mutationToDom:Blockly.Blocks.procedures_defnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_defnoreturn.domToMutation,decompose:Blockly.Blocks.procedures_defnoreturn.decompose,compose:Blockly.Blocks.procedures_defnoreturn.compose,dispose:Blockly.Blocks.procedures_defnoreturn.dispose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:Blockly.Blocks.procedures_defnoreturn.getVars,renameVar:Blockly.Blocks.procedures_defnoreturn.renameVar,customContextMenu:Blockly.Blocks.procedures_defnoreturn.customContextMenu,callType_:"procedures_callreturn"},Blockly.Blocks.procedures_mutatorcontainer={init:function(){this.setColour(290),this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.setTooltip(""),this.contextMenu=!1}},Blockly.Blocks.procedures_mutatorarg={init:function(){this.setColour(290),this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(new Blockly.FieldTextInput("x",this.validator),"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.contextMenu=!1},validator:function(e){return(e=e.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,""))||null}},Blockly.Blocks.procedures_callnoreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL),this.setColour(290),this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL).appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP),this.arguments_=[],this.quarkArguments_=this.quarkConnections_=null},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(e,t){Blockly.Names.equals(e,this.getFieldValue("NAME"))&&(this.setFieldValue(t,"NAME"),this.setTooltip((this.outputConnection?Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",t)))},setProcedureParameters:function(e,t){if(t){if(t.length!=e.length)throw"Error: paramNames and paramIds must be the same length.";this.quarkArguments_||(this.quarkConnections_={},this.quarkArguments_=e.join("\n")==this.arguments_.join("\n")?t:[]);var o=this.rendered;this.rendered=!1;for(var n=this.arguments_.length-1;n>=0;n--){var i=this.getInput("ARG"+n);if(i){var r=i.connection.targetConnection;this.quarkConnections_[this.quarkArguments_[n]]=r,this.removeInput("ARG"+n)}}for(this.arguments_=[].concat(e),this.quarkArguments_=t,n=0;n<this.arguments_.length;n++)if(i=this.appendValueInput("ARG"+n).setAlign(Blockly.ALIGN_RIGHT).appendField(this.arguments_[n]),this.quarkArguments_){var s=this.quarkArguments_[n];s in this.quarkConnections_&&(r=this.quarkConnections_[s],!r||r.targetConnection||r.sourceBlock_.workspace!=this.workspace?delete this.quarkConnections_[s]:i.connection.connect(r))}(this.rendered=o)&&this.render()}else this.quarkConnections_={},this.quarkArguments_=null},mutationToDom:function(){var e=document.createElement("mutation");e.setAttribute("name",this.getFieldValue("NAME"));for(var t=0;t<this.arguments_.length;t++){var o=document.createElement("arg");o.setAttribute("name",this.arguments_[t]),e.appendChild(o)}return e},domToMutation:function(e){var t=e.getAttribute("name");if(this.setFieldValue(t,"NAME"),this.setTooltip((this.outputConnection?Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",t)),(t=Blockly.Procedures.getDefinition(t,this.workspace))&&t.mutator.isVisible())this.setProcedureParameters(t.arguments_,t.paramIds_);else{this.arguments_=[];for(var o,t=0;o=e.childNodes[t];t++)"arg"==o.nodeName.toLowerCase()&&this.arguments_.push(o.getAttribute("name"));
31
- this.setProcedureParameters(this.arguments_,this.arguments_)}},renameVar:function(e,t){for(var o=0;o<this.arguments_.length;o++)Blockly.Names.equals(e,this.arguments_[o])&&(this.arguments_[o]=t,this.getInput("ARG"+o).fieldRow[0].setText(t))},customContextMenu:function(e){var t={enabled:!0};t.text=Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;var o=this.getFieldValue("NAME"),n=this.workspace;t.callback=function(){var e=Blockly.Procedures.getDefinition(o,n);e&&e.select()},e.push(t)}},Blockly.Blocks.procedures_callreturn={init:function(){this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL),this.setColour(290),this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL).appendField("","NAME"),this.setOutput(!0),this.setTooltip(Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP),this.arguments_=[],this.quarkArguments_=this.quarkConnections_=null},getProcedureCall:Blockly.Blocks.procedures_callnoreturn.getProcedureCall,renameProcedure:Blockly.Blocks.procedures_callnoreturn.renameProcedure,setProcedureParameters:Blockly.Blocks.procedures_callnoreturn.setProcedureParameters,mutationToDom:Blockly.Blocks.procedures_callnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_callnoreturn.domToMutation,renameVar:Blockly.Blocks.procedures_callnoreturn.renameVar,customContextMenu:Blockly.Blocks.procedures_callnoreturn.customContextMenu},Blockly.Blocks.procedures_ifreturn={init:function(){this.setHelpUrl("http://c2.com/cgi/wiki?GuardClause"),this.setColour(290),this.appendValueInput("CONDITION").setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.hasReturnValue_=!0},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("value",Number(this.hasReturnValue_)),e},domToMutation:function(e){this.hasReturnValue_=1==e.getAttribute("value"),this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.workspace){var e=!1,t=this;do{if("procedures_defnoreturn"==t.type||"procedures_defreturn"==t.type){e=!0;break}t=t.getSurroundParent()}while(t);e?("procedures_defnoreturn"==t.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=t.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING)}}},Blockly.Blocks.text={},Blockly.Blocks.text={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL),this.setColour(160),this.appendDummyInput().appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote0.png",12,12)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote1.png",12,12)),this.setOutput(!0,"String"),this.setTooltip(Blockly.Msg.TEXT_TEXT_TOOLTIP)}},Blockly.Blocks.text_join={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_JOIN_HELPURL),this.setColour(160),this.appendValueInput("ADD0").appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH),this.appendValueInput("ADD1"),this.setOutput(!0,"String"),this.setMutator(new Blockly.Mutator(["text_create_join_item"])),this.setTooltip(Blockly.Msg.TEXT_JOIN_TOOLTIP),this.itemCount_=2},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){for(var t=0;t<this.itemCount_;t++)this.removeInput("ADD"+t);for(this.itemCount_=parseInt(e.getAttribute("items"),10),t=0;t<this.itemCount_;t++)e=this.appendValueInput("ADD"+t),0==t&&e.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);0==this.itemCount_&&this.appendDummyInput("EMPTY").appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote0.png",12,12)).appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote1.png",12,12))},decompose:function(e){var t=new Blockly.Block(e,"text_create_join_container");t.initSvg();for(var o=t.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var i=new Blockly.Block(e,"text_create_join_item");i.initSvg(),o.connect(i.previousConnection),o=i.nextConnection}return t},compose:function(e){if(0==this.itemCount_)this.removeInput("EMPTY");else for(var t=this.itemCount_-1;t>=0;t--)this.removeInput("ADD"+t);for(this.itemCount_=0,e=e.getInputTargetBlock("STACK");e;)t=this.appendValueInput("ADD"+this.itemCount_),0==this.itemCount_&&t.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH),e.valueConnection_&&t.connection.connect(e.valueConnection_),this.itemCount_++,e=e.nextConnection&&e.nextConnection.targetBlock();0==this.itemCount_&&this.appendDummyInput("EMPTY").appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote0.png",12,12)).appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote1.png",12,12))},saveConnections:function(e){e=e.getInputTargetBlock("STACK");for(var t=0;e;){var o=this.getInput("ADD"+t);e.valueConnection_=o&&o.connection.targetConnection,t++,e=e.nextConnection&&e.nextConnection.targetBlock()}}},Blockly.Blocks.text_create_join_container={init:function(){this.setColour(160),this.appendDummyInput().appendField(Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN),this.appendStatementInput("STACK"),this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP),this.contextMenu=!1}},Blockly.Blocks.text_create_join_item={init:function(){this.setColour(160),this.appendDummyInput().appendField(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP),this.contextMenu=!1}},Blockly.Blocks.text_append={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_APPEND_HELPURL),this.setColour(160),this.appendValueInput("TEXT").appendField(Blockly.Msg.TEXT_APPEND_TO).appendField(new Blockly.FieldVariable(Blockly.Msg.TEXT_APPEND_VARIABLE),"VAR").appendField(Blockly.Msg.TEXT_APPEND_APPENDTEXT),this.setPreviousStatement(!0),this.setNextStatement(!0);var e=this;this.setTooltip(function(){return Blockly.Msg.TEXT_APPEND_TOOLTIP.replace("%1",e.getFieldValue("VAR"))})},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){Blockly.Names.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")}},Blockly.Blocks.text_length={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_LENGTH_HELPURL),this.setColour(160),this.interpolateMsg(Blockly.Msg.TEXT_LENGTH_TITLE,["VALUE",["String","Array"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Number"),this.setTooltip(Blockly.Msg.TEXT_LENGTH_TOOLTIP)}},Blockly.Blocks.text_isEmpty={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_ISEMPTY_HELPURL),this.setColour(160),this.interpolateMsg(Blockly.Msg.TEXT_ISEMPTY_TITLE,["VALUE",["String","Array"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Boolean"),this.setTooltip(Blockly.Msg.TEXT_ISEMPTY_TOOLTIP)}},Blockly.Blocks.text_indexOf={init:function(){var e=[[Blockly.Msg.TEXT_INDEXOF_OPERATOR_FIRST,"FIRST"],[Blockly.Msg.TEXT_INDEXOF_OPERATOR_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.TEXT_INDEXOF_HELPURL),this.setColour(160),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("String").appendField(Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT),this.appendValueInput("FIND").setCheck("String").appendField(new Blockly.FieldDropdown(e),"END"),Blockly.Msg.TEXT_INDEXOF_TAIL&&this.appendDummyInput().appendField(Blockly.Msg.TEXT_INDEXOF_TAIL),this.setInputsInline(!0),this.setTooltip(Blockly.Msg.TEXT_INDEXOF_TOOLTIP)}},Blockly.Blocks.text_charAt={init:function(){this.WHERE_OPTIONS=[[Blockly.Msg.TEXT_CHARAT_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_CHARAT_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_CHARAT_FIRST,"FIRST"],[Blockly.Msg.TEXT_CHARAT_LAST,"LAST"],[Blockly.Msg.TEXT_CHARAT_RANDOM,"RANDOM"]],this.setHelpUrl(Blockly.Msg.TEXT_CHARAT_HELPURL),this.setColour(160),this.setOutput(!0,"String"),this.appendValueInput("VALUE").setCheck("String").appendField(Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT),this.appendDummyInput("AT"),this.setInputsInline(!0),this.updateAt(!0),this.setTooltip(Blockly.Msg.TEXT_CHARAT_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT").type==Blockly.INPUT_VALUE;return e.setAttribute("at",t),e},domToMutation:function(e){e="false"!=e.getAttribute("at"),this.updateAt(e)},updateAt:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),Blockly.Msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_CHARAT_TAIL));var t=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(t){var o="FROM_START"==t||"FROM_END"==t;if(o!=e){var n=this.sourceBlock_;return n.updateAt(o),n.setFieldValue(t,"WHERE"),null}});this.getInput("AT").appendField(t,"WHERE")}},Blockly.Blocks.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]],this.setHelpUrl(Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL),this.setColour(160),this.appendValueInput("STRING").setCheck("String").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL),this.setInputsInline(!0),this.setOutput(!0,"String"),this.updateAt(1,!0),this.updateAt(2,!0),this.setTooltip(Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT1").type==Blockly.INPUT_VALUE;return e.setAttribute("at1",t),t=this.getInput("AT2").type==Blockly.INPUT_VALUE,e.setAttribute("at2",t),e},domToMutation:function(e){var t="true"==e.getAttribute("at1");e="true"==e.getAttribute("at2"),this.updateAt(1,t),this.updateAt(2,e)},updateAt:function(e,t){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),t?(this.appendValueInput("AT"+e).setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),2==e&&Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL));var o=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+e],function(o){var n="FROM_START"==o||"FROM_END"==o;if(n!=t){var i=this.sourceBlock_;return i.updateAt(e,n),i.setFieldValue(o,"WHERE"+e),null}});this.getInput("AT"+e).appendField(o,"WHERE"+e),1==e&&this.moveInputBefore("AT1","AT2")}},Blockly.Blocks.text_changeCase={init:function(){var e=[[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(Blockly.Msg.TEXT_CHANGECASE_HELPURL),this.setColour(160),this.appendValueInput("TEXT").setCheck("String").appendField(new Blockly.FieldDropdown(e),"CASE"),this.setOutput(!0,"String"),this.setTooltip(Blockly.Msg.TEXT_CHANGECASE_TOOLTIP)}},Blockly.Blocks.text_trim={init:function(){var e=[[Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(Blockly.Msg.TEXT_TRIM_HELPURL),this.setColour(160),this.appendValueInput("TEXT").setCheck("String").appendField(new Blockly.FieldDropdown(e),"MODE"),this.setOutput(!0,"String"),this.setTooltip(Blockly.Msg.TEXT_TRIM_TOOLTIP)}},Blockly.Blocks.text_print={init:function(){this.setHelpUrl(Blockly.Msg.TEXT_PRINT_HELPURL),this.setColour(160),this.interpolateMsg(Blockly.Msg.TEXT_PRINT_TITLE,["TEXT",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP)}},Blockly.Blocks.text_prompt={init:function(){var e=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],t=this;this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL),this.setColour(160),e=new Blockly.FieldDropdown(e,function(e){"NUMBER"==e?t.changeOutput("Number"):t.changeOutput("String")}),this.appendDummyInput().appendField(e,"TYPE").appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote0.png",12,12)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(new Blockly.FieldImage(Blockly.pathToBlockly+"media/quote1.png",12,12)),this.setOutput(!0,"String"),t=this,this.setTooltip(function(){return"TEXT"==t.getFieldValue("TYPE")?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})}},Blockly.Blocks.variables={},Blockly.Blocks.variables_get={init:function(){this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL),this.setColour(330),this.appendDummyInput().appendField(Blockly.Msg.VARIABLES_GET_TITLE).appendField(new Blockly.FieldVariable(Blockly.Msg.VARIABLES_GET_ITEM),"VAR").appendField(Blockly.Msg.VARIABLES_GET_TAIL),this.setOutput(!0),this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP),this.contextMenuMsg_=Blockly.Msg.VARIABLES_GET_CREATE_SET,this.contextMenuType_="variables_set"},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){Blockly.Names.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")},customContextMenu:function(e){var t={enabled:!0},o=this.getFieldValue("VAR");t.text=this.contextMenuMsg_.replace("%1",o),o=goog.dom.createDom("field",null,o),o.setAttribute("name","VAR"),o=goog.dom.createDom("block",null,o),o.setAttribute("type",this.contextMenuType_),t.callback=Blockly.ContextMenu.callbackFactory(this,o),e.push(t)}},Blockly.Blocks.variables_set={init:function(){this.setHelpUrl(Blockly.Msg.VARIABLES_SET_HELPURL),this.setColour(330),this.appendValueInput("VALUE").appendField(Blockly.Msg.VARIABLES_SET_TITLE).appendField(new Blockly.FieldVariable(Blockly.Msg.VARIABLES_SET_ITEM),"VAR").appendField(Blockly.Msg.VARIABLES_SET_TAIL),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP),this.contextMenuMsg_=Blockly.Msg.VARIABLES_SET_CREATE_GET,this.contextMenuType_="variables_get"},getVars:function(){return[this.getFieldValue("VAR")]},renameVar:function(e,t){Blockly.Names.equals(e,this.getFieldValue("VAR"))&&this.setFieldValue(t,"VAR")},customContextMenu:Blockly.Blocks.variables_get.customContextMenu},Blockly.Names.prototype.safeName_=function(e){return e?(e=e.replace(/[ !"#$%&'()=\-~^\\|`@{\[+;*:}\]<>,.?\/]/g,"_"),-1!="0123456789".indexOf(e[0])&&(e="_"+e)):e="unnamed",e};var originalBlocksMathNumberInit=Blockly.Blocks.math_number.init;Blockly.Blocks.math_number.init=function(){originalBlocksMathNumberInit.call(this),this.setColour(100)};var originalBlocksTextInit=Blockly.Blocks.text.init;Blockly.Blocks.text.init=function(){originalBlocksTextInit.call(this),this.setColour(100)},Blockly.loadAudio_=function(e,t){if(window.Audio&&e.length){for(var o,n=new window.Audio,i=0;i<e.length;i++){var r=e[i],s=r.match(/\.(\w+)$/);if(s&&n.canPlayType("audio/"+s[1])){o=new window.Audio(Blockly.pathToBlockly+r);break}}o&&o.play&&(o.volume=.01,o.play(),o.pause(),Blockly.SOUNDS_[t]=o)}},Blockly.Block.prototype.interpolateMsg=function(e){goog.asserts.assertString(e);var t=arguments[arguments.length-1];goog.asserts.assert(t===Blockly.ALIGN_LEFT||t===Blockly.ALIGN_CENTRE||t===Blockly.ALIGN_RIGHT,'Illegal final argument "%d" is not an alignment.',t),arguments.length=arguments.length-1;for(var o=e.split(/(%\d)/),n=0;n<o.length;n+=2){var i=goog.string.trim(o[n]),r=o[n+1];if(r){var s=parseInt(r.charAt(1),10),l=arguments[s];goog.asserts.assertArray(l,'Message symbol "%s" is out of range.',r),"array"==goog.typeOf(l[1])&&"Dropdown"==l[1][0]?this.appendDummyInput().appendField(i).setAlign(l[2]).appendField(new Blockly.FieldDropdown(l[1][1]),l[0]):"array"==goog.typeOf(l[1])&&"Colour"==l[1][0]?this.appendDummyInput().appendField(i).setAlign(l[2]).appendField(new Blockly.FieldColour(l[1][1]),l[0]):this.appendValueInput(l[0]).setCheck(l[1]).setAlign(l[2]).appendField(i),arguments[s]=null}else i&&this.appendDummyInput().setAlign(t).appendField(i)}for(var n=1;n<arguments.length-1;n++)goog.asserts.assert(null===arguments[n],'Input "%%s" not used in message: "%s"',n,e);this.setInputsInline(!e.match(/%1\s*$/))},function(){var e=this,t=e._,o={},n=Array.prototype,i=Object.prototype,r=Function.prototype,s=n.push,l=n.slice,a=n.concat,c=i.toString,u=i.hasOwnProperty,g=n.forEach,h=n.map,d=n.reduce,p=n.reduceRight,f=n.filter,m=n.every,y=n.some,_=n.indexOf,v=n.lastIndexOf,E=Array.isArray,B=Object.keys,C=r.bind,k=function(e){return e instanceof k?e:this instanceof k?(this._wrapped=e,void 0):new k(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=k),exports._=k):e._=k,k.VERSION="1.5.2";var b=k.each=k.forEach=function(e,t,n){if(null!=e)if(g&&e.forEach===g)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,r=e.length;r>i;i++)if(t.call(n,e[i],i,e)===o)return}else for(var s=k.keys(e),i=0,r=s.length;r>i;i++)if(t.call(n,e[s[i]],s[i],e)===o)return};k.map=k.collect=function(e,t,o){var n=[];return null==e?n:h&&e.map===h?e.map(t,o):(b(e,function(e,i,r){n.push(t.call(o,e,i,r))}),n)};var A="Reduce of empty array with no initial value";k.reduce=k.foldl=k.inject=function(e,t,o,n){var i=arguments.length>2;if(null==e&&(e=[]),d&&e.reduce===d)return n&&(t=k.bind(t,n)),i?e.reduce(t,o):e.reduce(t);if(b(e,function(e,r,s){i?o=t.call(n,o,e,r,s):(o=e,i=!0)}),!i)throw new TypeError(A);return o},k.reduceRight=k.foldr=function(e,t,o,n){var i=arguments.length>2;if(null==e&&(e=[]),p&&e.reduceRight===p)return n&&(t=k.bind(t,n)),i?e.reduceRight(t,o):e.reduceRight(t);var r=e.length;if(r!==+r){var s=k.keys(e);r=s.length}if(b(e,function(l,a,c){a=s?s[--r]:--r,i?o=t.call(n,o,e[a],a,c):(o=e[a],i=!0)}),!i)throw new TypeError(A);return o},k.find=k.detect=function(e,t,o){var n;return T(e,function(e,i,r){return t.call(o,e,i,r)?(n=e,!0):void 0}),n},k.filter=k.select=function(e,t,o){var n=[];return null==e?n:f&&e.filter===f?e.filter(t,o):(b(e,function(e,i,r){t.call(o,e,i,r)&&n.push(e)}),n)},k.reject=function(e,t,o){return k.filter(e,function(e,n,i){return!t.call(o,e,n,i)},o)},k.every=k.all=function(e,t,n){t||(t=k.identity);var i=!0;return null==e?i:m&&e.every===m?e.every(t,n):(b(e,function(e,r,s){return(i=i&&t.call(n,e,r,s))?void 0:o}),!!i)};var T=k.some=k.any=function(e,t,n){t||(t=k.identity);var i=!1;return null==e?i:y&&e.some===y?e.some(t,n):(b(e,function(e,r,s){return i||(i=t.call(n,e,r,s))?o:void 0}),!!i)};k.contains=k.include=function(e,t){return null==e?!1:_&&e.indexOf===_?-1!=e.indexOf(t):T(e,function(e){return e===t})},k.invoke=function(e,t){var o=l.call(arguments,2),n=k.isFunction(t);return k.map(e,function(e){return(n?t:e[t]).apply(e,o)})},k.pluck=function(e,t){return k.map(e,function(e){return e[t]})},k.where=function(e,t,o){return k.isEmpty(t)?o?void 0:[]:k[o?"find":"filter"](e,function(e){for(var o in t)if(t[o]!==e[o])return!1;return!0})},k.findWhere=function(e,t){return k.where(e,t,!0)},k.max=function(e,t,o){if(!t&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&k.isEmpty(e))return-1/0;var n={computed:-1/0,value:-1/0};return b(e,function(e,i,r){var s=t?t.call(o,e,i,r):e;s>n.computed&&(n={value:e,computed:s})}),n.value},k.min=function(e,t,o){if(!t&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&k.isEmpty(e))return 1/0;var n={computed:1/0,value:1/0};return b(e,function(e,i,r){var s=t?t.call(o,e,i,r):e;s<n.computed&&(n={value:e,computed:s})}),n.value},k.shuffle=function(e){var t,o=0,n=[];return b(e,function(e){t=k.random(o++),n[o-1]=n[t],n[t]=e}),n},k.sample=function(e,t,o){return arguments.length<2||o?e[k.random(e.length-1)]:k.shuffle(e).slice(0,Math.max(0,t))};var S=function(e){return k.isFunction(e)?e:function(t){return t[e]}};k.sortBy=function(e,t,o){var n=S(t);return k.pluck(k.map(e,function(e,t,i){return{value:e,index:t,criteria:n.call(o,e,t,i)}}).sort(function(e,t){var o=e.criteria,n=t.criteria;if(o!==n){if(o>n||void 0===o)return 1;if(n>o||void 0===n)return-1}return e.index-t.index}),"value")};var R=function(e){return function(t,o,n){var i={},r=null==o?k.identity:S(o);return b(t,function(o,s){var l=r.call(n,o,s,t);e(i,l,o)}),i}};k.groupBy=R(function(e,t,o){(k.has(e,t)?e[t]:e[t]=[]).push(o)}),k.indexBy=R(function(e,t,o){e[t]=o}),k.countBy=R(function(e,t){k.has(e,t)?e[t]++:e[t]=1}),k.sortedIndex=function(e,t,o,n){o=null==o?k.identity:S(o);for(var i=o.call(n,t),r=0,s=e.length;s>r;){var l=r+s>>>1;o.call(n,e[l])<i?r=l+1:s=l}return r},k.toArray=function(e){return e?k.isArray(e)?l.call(e):e.length===+e.length?k.map(e,k.identity):k.values(e):[]},k.size=function(e){return null==e?0:e.length===+e.length?e.length:k.keys(e).length},k.first=k.head=k.take=function(e,t,o){return null==e?void 0:null==t||o?e[0]:l.call(e,0,t)},k.initial=function(e,t,o){return l.call(e,0,e.length-(null==t||o?1:t))},k.last=function(e,t,o){return null==e?void 0:null==t||o?e[e.length-1]:l.call(e,Math.max(e.length-t,0))},k.rest=k.tail=k.drop=function(e,t,o){return l.call(e,null==t||o?1:t)},k.compact=function(e){return k.filter(e,k.identity)};var w=function(e,t,o){return t&&k.every(e,k.isArray)?a.apply(o,e):(b(e,function(e){k.isArray(e)||k.isArguments(e)?t?s.apply(o,e):w(e,t,o):o.push(e)}),o)};k.flatten=function(e,t){return w(e,t,[])},k.without=function(e){return k.difference(e,l.call(arguments,1))},k.uniq=k.unique=function(e,t,o,n){k.isFunction(t)&&(n=o,o=t,t=!1);var i=o?k.map(e,o,n):e,r=[],s=[];return b(i,function(o,n){(t?n&&s[s.length-1]===o:k.contains(s,o))||(s.push(o),r.push(e[n]))}),r},k.union=function(){return k.uniq(k.flatten(arguments,!0))},k.intersection=function(e){var t=l.call(arguments,1);return k.filter(k.uniq(e),function(e){return k.every(t,function(t){return k.indexOf(t,e)>=0})})},k.difference=function(e){var t=a.apply(n,l.call(arguments,1));return k.filter(e,function(e){return!k.contains(t,e)})},k.zip=function(){for(var e=k.max(k.pluck(arguments,"length").concat(0)),t=new Array(e),o=0;e>o;o++)t[o]=k.pluck(arguments,""+o);return t},k.object=function(e,t){if(null==e)return{};for(var o={},n=0,i=e.length;i>n;n++)t?o[e[n]]=t[n]:o[e[n][0]]=e[n][1];return o},k.indexOf=function(e,t,o){if(null==e)return-1;var n=0,i=e.length;if(o){if("number"!=typeof o)return n=k.sortedIndex(e,t),e[n]===t?n:-1;n=0>o?Math.max(0,i+o):o}if(_&&e.indexOf===_)return e.indexOf(t,o);for(;i>n;n++)if(e[n]===t)return n;return-1},k.lastIndexOf=function(e,t,o){if(null==e)return-1;var n=null!=o;if(v&&e.lastIndexOf===v)return n?e.lastIndexOf(t,o):e.lastIndexOf(t);for(var i=n?o:e.length;i--;)if(e[i]===t)return i;return-1},k.range=function(e,t,o){arguments.length<=1&&(t=e||0,e=0),o=arguments[2]||1;for(var n=Math.max(Math.ceil((t-e)/o),0),i=0,r=new Array(n);n>i;)r[i++]=e,e+=o;return r};var D=function(){};k.bind=function(e,t){var o,n;if(C&&e.bind===C)return C.apply(e,l.call(arguments,1));if(!k.isFunction(e))throw new TypeError;return o=l.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,o.concat(l.call(arguments)));D.prototype=e.prototype;var i=new D;D.prototype=null;var r=e.apply(i,o.concat(l.call(arguments)));return Object(r)===r?r:i}},k.partial=function(e){var t=l.call(arguments,1);return function(){return e.apply(this,t.concat(l.call(arguments)))}},k.bindAll=function(e){var t=l.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return b(t,function(t){e[t]=k.bind(e[t],e)}),e},k.memoize=function(e,t){var o={};return t||(t=k.identity),function(){var n=t.apply(this,arguments);return k.has(o,n)?o[n]:o[n]=e.apply(this,arguments)}},k.delay=function(e,t){var o=l.call(arguments,2);return setTimeout(function(){return e.apply(null,o)},t)},k.defer=function(e){return k.delay.apply(k,[e,1].concat(l.call(arguments,1)))},k.throttle=function(e,t,o){var n,i,r,s=null,l=0;o||(o={});var a=function(){l=o.leading===!1?0:new Date,s=null,r=e.apply(n,i)};return function(){var c=new Date;l||o.leading!==!1||(l=c);var u=t-(c-l);return n=this,i=arguments,0>=u?(clearTimeout(s),s=null,l=c,r=e.apply(n,i)):s||o.trailing===!1||(s=setTimeout(a,u)),r}},k.debounce=function(e,t,o){var n,i,r,s,l;return function(){r=this,i=arguments,s=new Date;var a=function(){var c=new Date-s;t>c?n=setTimeout(a,t-c):(n=null,o||(l=e.apply(r,i)))},c=o&&!n;return n||(n=setTimeout(a,t)),c&&(l=e.apply(r,i)),l}},k.once=function(e){var t,o=!1;return function(){return o?t:(o=!0,t=e.apply(this,arguments),e=null,t)}},k.wrap=function(e,t){return function(){var o=[e];return s.apply(o,arguments),t.apply(this,o)}},k.compose=function(){var e=arguments;return function(){for(var t=arguments,o=e.length-1;o>=0;o--)t=[e[o].apply(this,t)];return t[0]}},k.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},k.keys=B||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var o in e)k.has(e,o)&&t.push(o);return t},k.values=function(e){for(var t=k.keys(e),o=t.length,n=new Array(o),i=0;o>i;i++)n[i]=e[t[i]];return n},k.pairs=function(e){for(var t=k.keys(e),o=t.length,n=new Array(o),i=0;o>i;i++)n[i]=[t[i],e[t[i]]];return n},k.invert=function(e){for(var t={},o=k.keys(e),n=0,i=o.length;i>n;n++)t[e[o[n]]]=o[n];return t},k.functions=k.methods=function(e){var t=[];for(var o in e)k.isFunction(e[o])&&t.push(o);return t.sort()},k.extend=function(e){return b(l.call(arguments,1),function(t){if(t)for(var o in t)e[o]=t[o]}),e},k.pick=function(e){var t={},o=a.apply(n,l.call(arguments,1));return b(o,function(o){o in e&&(t[o]=e[o])}),t},k.omit=function(e){var t={},o=a.apply(n,l.call(arguments,1));for(var i in e)k.contains(o,i)||(t[i]=e[i]);return t},k.defaults=function(e){return b(l.call(arguments,1),function(t){if(t)for(var o in t)void 0===e[o]&&(e[o]=t[o])}),e},k.clone=function(e){return k.isObject(e)?k.isArray(e)?e.slice():k.extend({},e):e},k.tap=function(e,t){return t(e),e};var I=function(e,t,o,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof k&&(e=e._wrapped),t instanceof k&&(t=t._wrapped);var i=c.call(e);if(i!=c.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var r=o.length;r--;)if(o[r]==e)return n[r]==t;var s=e.constructor,l=t.constructor;if(s!==l&&!(k.isFunction(s)&&s instanceof s&&k.isFunction(l)&&l instanceof l))return!1;o.push(e),n.push(t);var a=0,u=!0;if("[object Array]"==i){if(a=e.length,u=a==t.length)for(;a--&&(u=I(e[a],t[a],o,n)););}else{for(var g in e)if(k.has(e,g)&&(a++,!(u=k.has(t,g)&&I(e[g],t[g],o,n))))break;if(u){for(g in t)if(k.has(t,g)&&!a--)break;u=!a}}return o.pop(),n.pop(),u};k.isEqual=function(e,t){return I(e,t,[],[])},k.isEmpty=function(e){if(null==e)return!0;if(k.isArray(e)||k.isString(e))return 0===e.length;for(var t in e)if(k.has(e,t))return!1;return!0},k.isElement=function(e){return!(!e||1!==e.nodeType)},k.isArray=E||function(e){return"[object Array]"==c.call(e)},k.isObject=function(e){return e===Object(e)},b(["Arguments","Function","String","Number","Date","RegExp"],function(e){k["is"+e]=function(t){return c.call(t)=="[object "+e+"]"}}),k.isArguments(arguments)||(k.isArguments=function(e){return!(!e||!k.has(e,"callee"))}),"function"!=typeof/./&&(k.isFunction=function(e){return"function"==typeof e}),k.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},k.isNaN=function(e){return k.isNumber(e)&&e!=+e},k.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},k.isNull=function(e){return null===e},k.isUndefined=function(e){return void 0===e},k.has=function(e,t){return u.call(e,t)},k.noConflict=function(){return e._=t,this},k.identity=function(e){return e},k.times=function(e,t,o){for(var n=Array(Math.max(0,e)),i=0;e>i;i++)n[i]=t.call(o,i);return n},k.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var F={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};F.unescape=k.invert(F.escape);var L={escape:new RegExp("["+k.keys(F.escape).join("")+"]","g"),unescape:new RegExp("("+k.keys(F.unescape).join("|")+")","g")};k.each(["escape","unescape"],function(e){k[e]=function(t){return null==t?"":(""+t).replace(L[e],function(t){return F[e][t]})}}),k.result=function(e,t){if(null==e)return void 0;var o=e[t];return k.isFunction(o)?o.call(e):o},k.mixin=function(e){b(k.functions(e),function(t){var o=k[t]=e[t];k.prototype[t]=function(){var e=[this._wrapped];return s.apply(e,arguments),P.call(this,o.apply(k,e))}})};var N=0;k.uniqueId=function(e){var t=++N+"";return e?e+t:t},k.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,x={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},M=/\\|'|\r|\n|\t|\u2028|\u2029/g;k.template=function(e,t,o){var n;o=k.defaults({},o,k.templateSettings);var i=new RegExp([(o.escape||O).source,(o.interpolate||O).source,(o.evaluate||O).source].join("|")+"|$","g"),r=0,s="__p+='";e.replace(i,function(t,o,n,i,l){return s+=e.slice(r,l).replace(M,function(e){return"\\"+x[e]}),o&&(s+="'+\n((__t=("+o+"))==null?'':_.escape(__t))+\n'"),n&&(s+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),i&&(s+="';\n"+i+"\n__p+='"),r=l+t.length,t}),s+="';\n",o.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{n=new Function(o.variable||"obj","_",s)}catch(l){throw l.source=s,l}if(t)return n(t,k);var a=function(e){return n.call(this,e,k)};return a.source="function("+(o.variable||"obj")+"){\n"+s+"}",a},k.chain=function(e){return k(e).chain()};var P=function(e){return this._chain?k(e).chain():e};k.mixin(k),b(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];k.prototype[e]=function(){var o=this._wrapped;return t.apply(o,arguments),"shift"!=e&&"splice"!=e||0!==o.length||delete o[0],P.call(this,o)}}),b(["concat","join","slice"],function(e){var t=n[e];k.prototype[e]=function(){return P.call(this,t.apply(this._wrapped,arguments))}}),k.extend(k.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(){{var e,t=this,o=t.Backbone,n=[],i=(n.push,n.slice);n.splice}e="undefined"!=typeof exports?exports:t.Backbone={},e.VERSION="1.1.0";var r=t._;r||"undefined"==typeof require||(r=require("underscore")),e.$=t.jQuery||t.Zepto||t.ender||t.$,e.noConflict=function(){return t.Backbone=o,this},e.emulateHTTP=!1,e.emulateJSON=!1;var s=e.Events={on:function(e,t,o){if(!a(this,"on",e,[t,o])||!t)return this;this._events||(this._events={});var n=this._events[e]||(this._events[e]=[]);return n.push({callback:t,context:o,ctx:o||this}),this},once:function(e,t,o){if(!a(this,"once",e,[t,o])||!t)return this;var n=this,i=r.once(function(){n.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,o)},off:function(e,t,o){var n,i,s,l,c,u,g,h;if(!this._events||!a(this,"off",e,[t,o]))return this;if(!e&&!t&&!o)return this._events={},this;for(l=e?[e]:r.keys(this._events),c=0,u=l.length;u>c;c++)if(e=l[c],s=this._events[e]){if(this._events[e]=n=[],t||o)for(g=0,h=s.length;h>g;g++)i=s[g],(t&&t!==i.callback&&t!==i.callback._callback||o&&o!==i.context)&&n.push(i);n.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=i.call(arguments,1);if(!a(this,"trigger",e,t))return this;var o=this._events[e],n=this._events.all;return o&&c(o,t),n&&c(n,arguments),this},stopListening:function(e,t,o){var n=this._listeningTo;if(!n)return this;var i=!t&&!o;o||"object"!=typeof t||(o=this),e&&((n={})[e._listenId]=e);for(var s in n)e=n[s],e.off(t,o,this),(i||r.isEmpty(e._events))&&delete this._listeningTo[s];return this}},l=/\s+/,a=function(e,t,o,n){if(!o)return!0;if("object"==typeof o){for(var i in o)e[t].apply(e,[i,o[i]].concat(n));return!1}if(l.test(o)){for(var r=o.split(l),s=0,a=r.length;a>s;s++)e[t].apply(e,[r[s]].concat(n));
32
- return!1}return!0},c=function(e,t){var o,n=-1,i=e.length,r=t[0],s=t[1],l=t[2];switch(t.length){case 0:for(;++n<i;)(o=e[n]).callback.call(o.ctx);return;case 1:for(;++n<i;)(o=e[n]).callback.call(o.ctx,r);return;case 2:for(;++n<i;)(o=e[n]).callback.call(o.ctx,r,s);return;case 3:for(;++n<i;)(o=e[n]).callback.call(o.ctx,r,s,l);return;default:for(;++n<i;)(o=e[n]).callback.apply(o.ctx,t)}},u={listenTo:"on",listenToOnce:"once"};r.each(u,function(e,t){s[t]=function(t,o,n){var i=this._listeningTo||(this._listeningTo={}),s=t._listenId||(t._listenId=r.uniqueId("l"));return i[s]=t,n||"object"!=typeof o||(n=this),t[e](o,n,this),this}}),s.bind=s.on,s.unbind=s.off,r.extend(e,s);var g=e.Model=function(e,t){var o=e||{};t||(t={}),this.cid=r.uniqueId("c"),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(o=this.parse(o,t)||{}),o=r.defaults({},o,r.result(this,"defaults")),this.set(o,t),this.changed={},this.initialize.apply(this,arguments)};r.extend(g.prototype,s,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(){return r.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return r.escape(this.get(e))},has:function(e){return null!=this.get(e)},set:function(e,t,o){var n,i,s,l,a,c,u,g;if(null==e)return this;if("object"==typeof e?(i=e,o=t):(i={})[e]=t,o||(o={}),!this._validate(i,o))return!1;s=o.unset,a=o.silent,l=[],c=this._changing,this._changing=!0,c||(this._previousAttributes=r.clone(this.attributes),this.changed={}),g=this.attributes,u=this._previousAttributes,this.idAttribute in i&&(this.id=i[this.idAttribute]);for(n in i)t=i[n],r.isEqual(g[n],t)||l.push(n),r.isEqual(u[n],t)?delete this.changed[n]:this.changed[n]=t,s?delete g[n]:g[n]=t;if(!a){l.length&&(this._pending=!0);for(var h=0,d=l.length;d>h;h++)this.trigger("change:"+l[h],this,g[l[h]],o)}if(c)return this;if(!a)for(;this._pending;)this._pending=!1,this.trigger("change",this,o);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,r.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var o in this.attributes)t[o]=void 0;return this.set(t,r.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!r.isEmpty(this.changed):r.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?r.clone(this.changed):!1;var t,o=!1,n=this._changing?this._previousAttributes:this.attributes;for(var i in e)r.isEqual(n[i],t=e[i])||((o||(o={}))[i]=t);return o},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return r.clone(this._previousAttributes)},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,o=e.success;return e.success=function(n){return t.set(t.parse(n,e),e)?(o&&o(t,n,e),t.trigger("sync",t,n,e),void 0):!1},x(this,e),this.sync("read",this,e)},save:function(e,t,o){var n,i,s,l=this.attributes;if(null==e||"object"==typeof e?(n=e,o=t):(n={})[e]=t,o=r.extend({validate:!0},o),n&&!o.wait){if(!this.set(n,o))return!1}else if(!this._validate(n,o))return!1;n&&o.wait&&(this.attributes=r.extend({},l,n)),void 0===o.parse&&(o.parse=!0);var a=this,c=o.success;return o.success=function(e){a.attributes=l;var t=a.parse(e,o);return o.wait&&(t=r.extend(n||{},t)),r.isObject(t)&&!a.set(t,o)?!1:(c&&c(a,e,o),a.trigger("sync",a,e,o),void 0)},x(this,o),i=this.isNew()?"create":o.patch?"patch":"update","patch"===i&&(o.attrs=n),s=this.sync(i,this,o),n&&o.wait&&(this.attributes=l),s},destroy:function(e){e=e?r.clone(e):{};var t=this,o=e.success,n=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(i){(e.wait||t.isNew())&&n(),o&&o(t,i,e),t.isNew()||t.trigger("sync",t,i,e)},this.isNew())return e.success(),!1;x(this,e);var i=this.sync("delete",this,e);return e.wait||n(),i},url:function(){var e=r.result(this,"urlRoot")||r.result(this.collection,"url")||O();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(e){return this._validate({},r.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=r.extend({},this.attributes,e);var o=this.validationError=this.validate(e,t)||null;return o?(this.trigger("invalid",this,o,r.extend(t,{validationError:o})),!1):!0}});var h=["keys","values","pairs","invert","pick","omit"];r.each(h,function(e){g.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.attributes),r[e].apply(r,t)}});var d=e.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,r.extend({silent:!0},t))},p={add:!0,remove:!0,merge:!0},f={add:!0,remove:!1};r.extend(d.prototype,s,{model:g,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return e.sync.apply(this,arguments)},add:function(e,t){return this.set(e,r.extend({merge:!1},t,f))},remove:function(e,t){var o=!r.isArray(e);e=o?[e]:r.clone(e),t||(t={});var n,i,s,l;for(n=0,i=e.length;i>n;n++)l=e[n]=this.get(e[n]),l&&(delete this._byId[l.id],delete this._byId[l.cid],s=this.indexOf(l),this.models.splice(s,1),this.length--,t.silent||(t.index=s,l.trigger("remove",l,this,t)),this._removeReference(l));return o?e[0]:e},set:function(e,t){t=r.defaults({},t,p),t.parse&&(e=this.parse(e,t));var o=!r.isArray(e);e=o?e?[e]:[]:r.clone(e);var n,i,s,l,a,c,u,h=t.at,d=this.model,f=this.comparator&&null==h&&t.sort!==!1,m=r.isString(this.comparator)?this.comparator:null,y=[],_=[],v={},E=t.add,B=t.merge,C=t.remove,k=!f&&E&&C?[]:!1;for(n=0,i=e.length;i>n;n++){if(a=e[n],s=a instanceof g?l=a:a[d.prototype.idAttribute],c=this.get(s))C&&(v[c.cid]=!0),B&&(a=a===l?l.attributes:a,t.parse&&(a=c.parse(a,t)),c.set(a,t),f&&!u&&c.hasChanged(m)&&(u=!0)),e[n]=c;else if(E){if(l=e[n]=this._prepareModel(a,t),!l)continue;y.push(l),l.on("all",this._onModelEvent,this),this._byId[l.cid]=l,null!=l.id&&(this._byId[l.id]=l)}k&&k.push(c||l)}if(C){for(n=0,i=this.length;i>n;++n)v[(l=this.models[n]).cid]||_.push(l);_.length&&this.remove(_,t)}if(y.length||k&&k.length)if(f&&(u=!0),this.length+=y.length,null!=h)for(n=0,i=y.length;i>n;n++)this.models.splice(h+n,0,y[n]);else{k&&(this.models.length=0);var b=k||y;for(n=0,i=b.length;i>n;n++)this.models.push(b[n])}if(u&&this.sort({silent:!0}),!t.silent){for(n=0,i=y.length;i>n;n++)(l=y[n]).trigger("add",l,this,t);(u||k&&k.length)&&this.trigger("sort",this,t)}return o?e[0]:e},reset:function(e,t){t||(t={});for(var o=0,n=this.models.length;n>o;o++)this._removeReference(this.models[o]);return t.previousModels=this.models,this._reset(),e=this.add(e,r.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,r.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,r.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return i.apply(this.models,arguments)},get:function(e){return null==e?void 0:this._byId[e.id]||this._byId[e.cid]||this._byId[e]},at:function(e){return this.models[e]},where:function(e,t){return r.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var o in e)if(e[o]!==t.get(o))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),r.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(r.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return r.invoke(this.models,"get",e)},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,o=this;return e.success=function(n){var i=e.reset?"reset":"set";o[i](n,e),t&&t(o,n,e),o.trigger("sync",o,n,e)},x(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?r.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var o=this,n=t.success;return t.success=function(e,t,i){i.wait&&o.add(e,i),n&&n(e,t,i)},e.save(null,t),e},parse:function(e){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof g)return e.collection||(e.collection=this),e;t=t?r.clone(t):{},t.collection=this;var o=new this.model(e,t);return o.validationError?(this.trigger("invalid",this,o.validationError,t),!1):o},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,o,n){("add"!==e&&"remove"!==e||o===this)&&("destroy"===e&&this.remove(t,n),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var m=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];r.each(m,function(e){d.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.models),r[e].apply(r,t)}});var y=["groupBy","countBy","sortBy"];r.each(y,function(e){d.prototype[e]=function(t,o){var n=r.isFunction(t)?t:function(e){return e.get(t)};return r[e](this.models,n,o)}});var _=e.View=function(e){this.cid=r.uniqueId("view"),e||(e={}),r.extend(this,r.pick(e,E)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},v=/^(\S+)\s*(.*)$/,E=["model","collection","el","id","attributes","className","tagName","events"];r.extend(_.prototype,s,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(t,o){return this.$el&&this.undelegateEvents(),this.$el=t instanceof e.$?t:e.$(t),this.el=this.$el[0],o!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=r.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var o=e[t];if(r.isFunction(o)||(o=this[e[t]]),o){var n=t.match(v),i=n[1],s=n[2];o=r.bind(o,this),i+=".delegateEvents"+this.cid,""===s?this.$el.on(i,o):this.$el.on(i,s,o)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(this.el)this.setElement(r.result(this,"el"),!1);else{var t=r.extend({},r.result(this,"attributes"));this.id&&(t.id=r.result(this,"id")),this.className&&(t["class"]=r.result(this,"className"));var o=e.$("<"+r.result(this,"tagName")+">").attr(t);this.setElement(o,!1)}}}),e.sync=function(t,o,n){var i=C[t];r.defaults(n||(n={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var s={type:i,dataType:"json"};if(n.url||(s.url=r.result(o,"url")||O()),null!=n.data||!o||"create"!==t&&"update"!==t&&"patch"!==t||(s.contentType="application/json",s.data=JSON.stringify(n.attrs||o.toJSON(n))),n.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),n.emulateHTTP&&("PUT"===i||"DELETE"===i||"PATCH"===i)){s.type="POST",n.emulateJSON&&(s.data._method=i);var l=n.beforeSend;n.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",i),l?l.apply(this,arguments):void 0}}"GET"===s.type||n.emulateJSON||(s.processData=!1),"PATCH"===s.type&&B&&(s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var a=n.xhr=e.ajax(r.extend(s,n));return o.trigger("request",o,a,n),a};var B=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),C={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var k=e.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},b=/\((.*?)\)/g,A=/(\(\?)?:\w+/g,T=/\*\w+/g,S=/[\-{}\[\]+?.,\\\^$|#\s]/g;r.extend(k.prototype,s,{initialize:function(){},route:function(t,o,n){r.isRegExp(t)||(t=this._routeToRegExp(t)),r.isFunction(o)&&(n=o,o=""),n||(n=this[o]);var i=this;return e.history.route(t,function(r){var s=i._extractParameters(t,r);n&&n.apply(i,s),i.trigger.apply(i,["route:"+o].concat(s)),i.trigger("route",o,s),e.history.trigger("route",i,o,s)}),this},navigate:function(t,o){return e.history.navigate(t,o),this},_bindRoutes:function(){if(this.routes){this.routes=r.result(this,"routes");for(var e,t=r.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(S,"\\$&").replace(b,"(?:$1)?").replace(A,function(e,t){return t?e:"([^/]+)"}).replace(T,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var o=e.exec(t).slice(1);return r.map(o,function(e){return e?decodeURIComponent(e):null})}});var R=e.History=function(){this.handlers=[],r.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},w=/^[#\/]|\s+$/g,D=/^\/+|\/+$/g,I=/msie [\w.]+/,F=/\/$/,L=/[?#].*$/;R.started=!1,r.extend(R.prototype,s,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var o=this.root.replace(F,"");e.indexOf(o)||(e=e.slice(o.length))}else e=this.getHash();return e.replace(w,"")},start:function(t){if(R.started)throw new Error("Backbone.history has already been started");R.started=!0,this.options=r.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var o=this.getFragment(),n=document.documentMode,i=I.exec(navigator.userAgent.toLowerCase())&&(!n||7>=n);this.root=("/"+this.root+"/").replace(D,"/"),i&&this._wantsHashChange&&(this.iframe=e.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(o)),this._hasPushState?e.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!i?e.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=o;var s=this.location,l=s.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!l)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&l&&s.hash&&(this.fragment=this.getHash().replace(w,""),this.history.replaceState({},document.title,this.root+this.fragment+s.search))}return this.options.silent?void 0:this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),R.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getFragment(this.getHash(this.iframe))),e===this.fragment?!1:(this.iframe&&this.navigate(e),this.loadUrl(),void 0)},loadUrl:function(e){return e=this.fragment=this.getFragment(e),r.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0})},navigate:function(e,t){if(!R.started)return!1;t&&t!==!0||(t={trigger:!!t});var o=this.root+(e=this.getFragment(e||""));if(e=e.replace(L,""),this.fragment!==e){if(this.fragment=e,""===e&&"/"!==o&&(o=o.slice(0,-1)),this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,o);else{if(!this._wantsHashChange)return this.location.assign(o);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,o){if(o){var n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}}),e.history=new R;var N=function(e,t){var o,n=this;o=e&&r.has(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},r.extend(o,n,t);var i=function(){this.constructor=o};return i.prototype=n.prototype,o.prototype=new i,e&&r.extend(o.prototype,e),o.__super__=n.prototype,o};g.extend=d.extend=k.extend=_.extend=R.extend=N;var O=function(){throw new Error('A "url" property or function must be specified')},x=function(e,t){var o=t.error;t.error=function(n){o&&o(e,n,t),e.trigger("error",e,n,t)}}}.call(this),function(){window.SmalrubyEditor={},window.changed=!1,window.textEditor=null,window.blockMode=!0,window.successMessage=function(e,t,o){var n;null==t&&(t=""),null==o&&(o="#messages"),n=$('<div class="alert alert-success" style="display: none">').append('<h4><i class="icon-star"></i>'+e+"</h4>").append(t),$(o).append(n),n.fadeIn("slow").delay(3e3).fadeOut("slow")},window.errorMessage=function(e,t){var o;null==t&&(t="#messages"),o=$('<div class="alert alert-error" style="display: none">').append('<button type="button" class="close" data-dismiss="alert">×</button>').append('<h4><i class="icon-exclamation-sign"></i>エラー</h4>').append(e),$(t).append(o),o.fadeIn("slow")},window.clearMessages=function(e){return null==e&&(e="#messages"),$(e).empty()},window.Smalruby={Models:{},Collections:{},Views:{},Routers:{},initialize:function(){var e,t,o=this;return $.ajaxSetup({headers:{"X-CSRF-Token":$('meta[name="csrf-token"]').attr("content")}}),_.extend(_.templateSettings,{escape:/{{-([\s\S]+?)}}/,evaluate:/{{([\s\S]+?)}}/,interpolate:/{{=([\s\S]+?)}}/}),Blockly.Toolbox.TreeNode.prototype.onMouseDown=function(){return this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()||this.select(),this.updateRow()},this.Collections.CharacterSet=new Smalruby.CharacterSet,this.Views.MainMenuView=new Smalruby.MainMenuView,this.Views.SigninModalView=new Smalruby.SigninModalView({el:$("#signin-modal")}),this.Views.CharacterSelectorView=new Smalruby.CharacterSelectorView({model:this.Collections.CharacterSet}),this.Views.CharacterModalView=new Smalruby.CharacterModalView({el:$("#character-modal")}),this.Views.LoadModalView=new Smalruby.LoadModalView({el:$("#load-modal")}),this.Views.ResetModalView=new Smalruby.ResetModalView({el:$("#reset-modal")}),Smalruby.downloading=!1,window.onbeforeunload=function(){return!Smalruby.downloading&&window.changed?"作成中のプログラムが消えてしまうよ!":(Smalruby.downloading=!1,void 0)},Blockly.HSV_SATURATION=1,Blockly.HSV_VALUE=.8,Blockly.inject(document.getElementById("blockly-div"),{path:"/blockly/",toolbox:document.getElementById("toolbox"),trashcan:!0}),Blockly.Toolbox.tree_.expandAll(),this.blocklyFirst=!0,this.blocklyLoading=!1,Blockly.addChangeListener(function(){return Smalruby.changedAfterTranslating=!0,o.blocklyFirst?(o.blocklyFirst=!1,void 0):o.blocklyLoading?(o.blocklyLoading=!1,void 0):window.changed=!0}),window.textEditor=t=ace.edit("text-editor"),t.setTheme("ace/theme/clouds"),t.setShowInvisibles(!0),t.gotoLine(0,0),t.on("change",function(){return o.translating?void 0:(window.changed=!0,Smalruby.changedAfterTranslating=!0)}),e=t.getSession(),e.setMode("ace/mode/ruby"),e.setTabSize(2),e.setUseSoftTabs(!0)},loadXml:function(e,t){var o,n,i,r,s;for(null==t&&(t=Blockly.mainWorkspace),r=Blockly.Xml.textToDom(e),t.clear(),n=[],i=0;s=r.childNodes[i];)"character"===s.nodeName.toLowerCase()&&(o=new Smalruby.Character({name:s.getAttribute("name"),costumes:s.getAttribute("costumes").split(","),x:parseInt(s.getAttribute("x"),10),y:parseInt(s.getAttribute("y"),10),angle:parseInt(s.getAttribute("angle"),10),rotationStyle:s.getAttribute("rotation_style")||"free"}),n.push(o)),i++;return Smalruby.Collections.CharacterSet.reset(n),Blockly.Xml.domToWorkspace(t,r)},dumpXml:function(e,t){var o,n;return null==e&&(e=Blockly.mainWorkspace),null==t&&(t=Smalruby.Collections.CharacterSet),n=Blockly.Xml.workspaceToDom(e),o=n.firstChild,t.each(function(e){var t,i;return t=goog.dom.createDom("character"),t.setAttribute("x",e.get("x")),t.setAttribute("y",e.get("y")),t.setAttribute("name",e.get("name")),t.setAttribute("costumes",e.get("costumes").join(",")),t.setAttribute("angle",e.get("angle")),i=e.get("rotationStyle"),"free"!==i&&t.setAttribute("rotation_style",i),n.insertBefore(t,o)}),Blockly.Xml.domToPrettyText(n)},ignoreEnterKey:function(e){return e.find("input[type=text]").keypress(function(e){return e||(e=window.event),13===e.keyCode?!1:!0})},reset:function(){return this.blocklyLoading=!0,Blockly.mainWorkspace.clear(),this.Collections.CharacterSet.reset(),$("#filename").val(""),window.textEditor.getSession().getDocument().setValue(""),window.textEditor.moveCursorTo(0,0),window.changed=!1},bm:function(e){var t;return t=Blockly.Msg[e],"string"==typeof t?t:e}},$(document).ready(function(){return Smalruby.initialize()})}.call(this),function(){Smalruby.Character=Backbone.Model.extend({defaults:{name:null,costumes:[],costumeIndex:0,x:0,y:0,angle:0,rotationStyle:"free",visible:!0,using:!1},initialize:function(){return this.objects=[],0===this.get("costumes").length?this.set({costumes:[Smalruby.Character.PRESET_COSTUMES[0]]}):void 0},validate:function(e){var t,o;return t=[],o=e.name,(_.isUndefined(o)||_.isNull(o)||_.isString(o)&&0===o.length)&&t.push({attr:"name",message:"Name is required"}),_.isString(o)&&o.match(/^[0-9A-Z]|[!\"\#$%&\'()\-=^~\\|@`\[{;+:*\]},<.>/?]/)&&t.push({attr:"name",message:"Name is invalid"}),t.length>0?t:void 0},link:function(e){return this.objects.push(e),this.objects=_.uniq(this.objects),this.objects.length>0?this.set("using",!0):void 0},unlink:function(e){return this.objects=_.without(this.objects,e),0===this.objects.length?this.set("using",!1):void 0},namePrefix:function(){return Smalruby.Character.costumeToNamePrefix(this.get("name"))},costume:function(){return this.get("costumes")[this.get("costumeIndex")]},costumeUrl:function(e){var t;return null==e&&(e=this.get("costumeIndex")),t=this.get("costumes")[e],-1===_.indexOf(Smalruby.Character.PRESET_COSTUMES,t)?t:"/smalruby/assets/"+t},nextCostume:function(){var e;return e=this.get("costumeIndex")+1,e>=this.get("costumes").length&&(e=0),this.set({costumeIndex:e}),e},rotationStyleIconName:function(){switch(this.get("rotationStyle")){case"free":return"icon-repeat";case"left_right":return"icon-resize-horizontal";case"none":return"icon-arrow-right"}},rotateImage:function(e){var t,o;switch(t=this.get("angle"),this.get("rotationStyle")){case"free":o="rotate("+t+"deg) scaleX(1)";break;case"left_right":o=90>t||t>=270?"rotate(0deg) scaleX(1)":"rotate(0deg) scaleX(-1)";break;case"none":o="rotate(0deg) scaleX(1)"}return $(e).css({"-moz-transform":o,"-webkit-transform":o,transform:o})}},{PRESET_COSTUMES:["car1.png","car2.png","car3.png","car4.png","ball1.png","ball2.png","ball3.png","ball4.png","ball5.png","ball6.png","cat1.png","cat2.png","cat3.png","frog1.png","ryu1.png","ryu2.png","taichi1.png","taichi2.png"],costumeToNamePrefix:function(e){return e.substring(e.lastIndexOf("/")+1).replace(/\.[^.]*$/,"").replace(/[\d]*$/,"")}})}.call(this),function(){Smalruby.Scene=Backbone.Model.extend({defaults:{width:640,height:480,color:"black"}})}.call(this),function(){Smalruby.SourceCode=Backbone.Model.extend({defaults:{filename:null,data:null},initialize:function(){var e,t,o;return this.get("filename")||(o=Smalruby.Views.MainMenuView.getFilename(),0===o.length&&(e=Smalruby.Collections.CharacterSet.first(),o=e?""+e.get("name")+".rb":"1.rb"),this.set("filename",o)),this.get("data")?void 0:(t=this.get("filename").match(/\.xml$/)?Smalruby.dumpXml():window.blockMode?Blockly.Ruby.workspaceToCode():window.textEditor.getSession().getDocument().getValue(),this.set("data",t))},getRbxmlFilename:function(){var e;return e=this.get("filename"),e.match(/\.rb\.xml$/)?e:e.match(/\.rb$/)?e+".xml":e.match(/\.xml$/)?e.replace(/\.xml$/,".rb.xml"):e+".rb.xml"},run:function(){return this.post_("run")},check:function(){return this.post_("check")},save2:function(){return this.post_("")},write:function(e){var t;return null==e&&(e=!1),t="write",e&&(t+="?force=1"),this.delete_(t)},toBlocks:function(){return this.post_("to_blocks","html")},post_:function(e,t){var o;return null==t&&(t="json"),o=$.Deferred(),$.ajax({url:"/source_codes/"+e,type:"POST",data:{source_code:{filename:this.get("filename"),data:this.get("data")}},dataType:t,success:function(e){return o.resolve(e)},error:o.reject}),o.promise()},delete_:function(e){var t;return t=$.Deferred(),$.ajax({url:"/source_codes/"+e,type:"DELETE",dataType:"json",success:function(e){return t.resolve(e)},error:t.reject}),t.promise()}})}.call(this),function(){Smalruby.CharacterSet=Backbone.Collection.extend({model:Smalruby.Character,uniqueName:function(e){var t,o,n;return null==e&&(e=Smalruby.Character.PRESET_COSTUMES[0]),o=e.substring(e.lastIndexOf("/")+1).replace(/\.[^.]*$/,"").replace(/[\d]*$/,""),t=0,n=new RegExp("^"+o+"(\\d+)$"),_.each(this.pluck("name"),function(e){return e.match(n)?t=_.max([t,parseInt(RegExp.$1)]):void 0}),""+o+(t+1)}})}.call(this),function(){Smalruby.CharacterModalView=Backbone.View.extend({model:new Smalruby.Character,events:{"click #character-modal-costume-selector a":"onSelectCostume","click #character_rotation_style_free":"onRotationStyleFree","click #character_rotation_style_left_right":"onRotationStyleLeftRight","click #character_rotation_style_none":"onRotationStyleNone","click #character-modal-ok-button":"onOk"},previewZoomLevel:.5,initialize:function(){var e,t,o,n=this;return this.target=null,$("#character-modal-costume-selector img").on("dragstart",function(e){return e.preventDefault()}),o=function(e){return n.model.set({x:parseInt(e.left/n.previewZoomLevel),y:parseInt(e.top/n.previewZoomLevel)})},$("#character-modal-character").draggable({containment:"#character-modal-preview",cursor:"move",drag:function(e,t){return o(t.position)}}),$("#character-modal-preview").droppable({drop:function(e,t){return o(t.draggable.position())}}),this.$el.find('input[name="character[name]"]').keypress(function(e){return e||(e=window.event),13===e.keyCode?!1:!0}),t=this,e=function(){return t.model.set({name:$(this).val()}),t.nameChanged=!0},this.$el.find('input[name="character[name]"]').change(e),this.$el.find('input[name="character[name]"]').keyup(e),this.$el.find('input[name="character[x]"]').change(function(){return t.model.set({x:$(this).val()})}),this.$el.find('input[name="character[y]"]').change(function(){return t.model.set({y:$(this).val()})}),this.$el.find('input[name="character[angle]"]').change(function(){return t.model.set({angle:$(this).val()})}),this.listenTo(this.model,"change:name",this.onChangeName),this.listenTo(this.model,"change:x",this.onChangeX),this.listenTo(this.model,"change:y",this.onChangeY),this.listenTo(this.model,"change:angle",this.onChangeAngle),this.listenTo(this.model,"change:costumes",this.onChangeCostumes),this.listenTo(this.model,"change:rotationStyle",this.onChangeRotationStyle),this.listenTo(this.model,"change",this.onChange),this.callAllOnChangeAttributes_()},render:function(){var e;return this.onChange(this.model),this.$el.modal("show"),e=function(){var t;return this.readImageSizeflag?(t=$("#character-modal-costume-selector .active img"),t.width()>0?($("#character-modal-character").css({width:""+t.width()/2+"px",height:""+t.height()/2+"px"}),this.readImageSizeflag=!1):setTimeout(_.bind(e,this),50)):void 0},this.readImageSizeflag?setTimeout(_.bind(e,this),1):void 0},callAllOnChangeAttributes_:function(){return this.onChangeName(this.model,this.model.get("name")),this.onChangeX(this.model,this.model.get("x")),this.onChangeY(this.model,this.model.get("y")),this.onChangeAngle(this.model,this.model.get("angle")),this.onChangeCostumes(this.model,this.model.get("costumes")),this.onChangeRotationStyle(this.model,this.model.get("rotationStyle"))},onChangeName:function(e,t){return this.$el.find('input[name="character[name]"]').val(t)},onChangeX:function(e,t){return this.$el.find('input[name="character[x]"]').val(t),$("#character_x_value").text(t),$("#character-modal-character").css("left",parseInt(t*this.previewZoomLevel))},onChangeY:function(e,t){return this.$el.find('input[name="character[y]"]').val(t),$("#character_y_value").text(t),$("#character-modal-character").css("top",parseInt(t*this.previewZoomLevel))},onChangeAngle:function(e,t){var o;return this.$el.find('input[name="character[angle]"]').val(t),$("#character_angle_value").text(""+t+"°"),o="rotate("+t+"deg)",$("#character_angle_vector").css({"-moz-transform":o,"-webkit-transform":o,transform:o}),this.model.rotateImage("#character-modal-character")},onChangeCostumes:function(e){var t,o;return t=$("<img>").attr({src:e.costumeUrl(),alt:e.costume()}),$("#character-modal-character img").replaceWith(t),this.$el.find("#character-modal-costume-selector a.thumbnail").removeClass("active"),o=this.$el.find('#character-modal-costume-selector img[alt="'+e.costume()+'"]'),o.parent().addClass("active"),o.width()>0?$("#character-modal-character").css({width:""+o.width()/2+"px",height:""+o.height()/2+"px"}):this.readImageSizeflag=!0},onChangeRotationStyle:function(e,t){return $("#character_rotation_style button.btn").removeClass("btn-primary"),$("#character_rotation_style_"+t).addClass("btn-primary"),this.onChangeAngle(this.model,this.model.get("angle"))},onChange:function(){var e;if(this.target)return this.$el.find('.control-group[for="character[name]"]').removeClass("error"),this.$el.find("#character-modal-ok-button").removeClass("disabled").removeAttr("disabled"),this.model.isValid()||(this.$el.find('.control-group[for="character[name]"]').addClass("error"),this.$el.find("#character-modal-ok-button").addClass("disabled").attr({disabled:"disabled"})),e=this.model.get("name"),this.target.get("name")!==e&&Smalruby.Collections.CharacterSet.findWhere({name:e})?(this.$el.find('.control-group[for="character[name]"]').addClass("error"),this.$el.find("#character-modal-ok-button").addClass("disabled").attr({disabled:"disabled"})):void 0},onSelectCostume:function(e){var t,o,n;return e.preventDefault(),o=$(e.target).attr("alt")||$(e.target).find("img").attr("alt"),t={costumes:[o]},this.nameChanged||(n=Smalruby.Character.costumeToNamePrefix(o),n!==this.model.namePrefix()&&(t.name=n===this.target.namePrefix()?this.target.get("name"):Smalruby.Collections.CharacterSet.uniqueName(o))),this.model.set(t)},onRotationStyleFree:function(){return this.model.set({rotationStyle:"free"})},onRotationStyleLeftRight:function(){return this.model.set({rotationStyle:"left_right"})},onRotationStyleNone:function(){return this.model.set({rotationStyle:"none"})},onOk:function(){return this.$el.modal("hide"),this.target?this.target.set(_.clone(this.model.attributes)):void 0},setCharacter:function(e){return this.target=e,this.model.set(_.clone(this.target.attributes)),this.nameChanged=!1,this}})}.call(this),function(){Smalruby.CharacterSelectorView=Backbone.View.extend({el:"#character-selector-tab",initialize:function(){var e,t,o,n;for(this.klass=Smalruby.CharacterSelectorView,n=["add","remove","reset","change"],t=0,o=n.length;o>t;t++)e=n[t],this.listenTo(this.model,e,this.onChange);return this.templateText=$("#character-selector-template").text(),$("#add-character-button").click(function(e){var t,o,n,i;return e.preventDefault(),n=Smalruby.Collections.CharacterSet,t=(i=_.last(n.models))?{name:n.uniqueName(i.costume()),costumes:_.clone(i.get("costumes"))}:{name:n.uniqueName()},o=new Smalruby.Character(t),n.add(o),Smalruby.Views.CharacterModalView.setCharacter(o).render()}),this.render()},render:function(){var e,t=this;return e=$("#character-selector-character-set"),e.children().remove(),this.model.each(function(o){var n,i,r;return n=$(_.template(t.templateText,o)),e.append(n),n.find("a.character").click(function(e){return e.preventDefault(),Smalruby.Views.CharacterModalView.setCharacter(o).render()}),n.find("a.add-block-button").click(function(e){return e.preventDefault(),t.addBlock_(o)}),r=n.find("a.remove-button"),r.click(function(e){return e.preventDefault(),t.removeCharacter_(o)}),o.get("using")&&r.hide(),i=n.find("img"),o.rotateImage(i),i.on("dragstart",function(e){return e.preventDefault()})})},onChange:function(){return Smalruby.blocklyLoading||(Smalruby.changedAfterTranslating=!0,window.changed=!0),this.render()
33
- },addBlock_:function(e){var t,o;return t=new Blockly.Block(Blockly.mainWorkspace,"character_new"),t.setCharacter(e),t.initSvg(),t.render(),this.moveByNewBlock_(t),t.select(),o=new Blockly.Block(Blockly.mainWorkspace,"events_on_start"),o.initSvg(),o.render(),t.getInput("DO").connection.connect(o.previousConnection)},moveByNewBlock_:function(e){var t,o,n,i,r,s,l;return o=Blockly.mainWorkspace.getMetrics(),i={x:o.viewLeft+this.klass.NEW_BLOCK_MARGIN.LEFT,y:o.viewTop+this.klass.NEW_BLOCK_MARGIN.TOP},this.prevBlock&&(s=this.prevBlock.getRelativeToSurfaceXY(),t=this.prevBlock.getHeightWidth(),n=e.getHeightWidth(),s.x===this.prevXY.x&&s.y===this.prevXY.y?(r=s.x,l=s.y+t.height+this.klass.NEW_BLOCK_MARGIN.TOP,l+n.height>o.viewTop+o.viewHeight&&(r+=t.width+this.klass.NEW_BLOCK_MARGIN.LEFT,l=i.y)):(r=this.prevXY.x,l=this.prevXY.y),r>=o.viewLeft&&r+n.width<=o.viewLeft+o.viewWidth&&l>=o.viewTop&&l+n.height<=o.viewTop+o.viewHeight&&(i.x=r,i.y=l)),e.moveBy(i.x,i.y),this.prevBlock=e,this.prevXY=e.getRelativeToSurfaceXY()},removeCharacter_:function(e){return e.get("using")?void 0:Smalruby.Collections.CharacterSet.remove(e)}},{NEW_BLOCK_MARGIN:{LEFT:20,TOP:20}})}.call(this),function(){Smalruby.LoadModalView=Backbone.View.extend({events:{"click #load-modal-ok-button":"onOk","click #load-modal-remix-button":"onRemix"},initialize:function(){var e=this;return this.$el.find("#load-modal-find-from-computer").click(function(t){return t.preventDefault(),e.onFindFromComputerClick.call(e,t)})},render:function(){var e,t,o,n,i=this;return this.type=null,this.program=null,this.setRemix(!1),this.unselect(),o=this.$el.find("#load-modal-local-programs"),o.empty(),t=this.$el.find("#load-modal-demo-programs"),t.empty(),this.$el.find(".modal-body").block({message:null}),n=function(){return i.$el.find(".modal-body").unblock()},this.$el.modal("show"),e=$.Deferred(),$.ajax({url:"/source_codes/",type:"GET",dataType:"json",success:function(t){return e.resolve(t)},error:e.reject}),e.promise().then(function(e){var n,r,s,l,a,c,u,g,h;for(u=e.localPrograms,r=function(e){var t;return t=i.programToHtml(e,i.onLocalProgramClick),o.append(t)},s=0,a=u.length;a>s;s++)n=u[s],r(n);for(g=e.demoPrograms,h=[],l=0,c=g.length;c>l;l++)n=g[l],h.push(function(e){var o;return o=i.programToHtml(e,i.onDemoProgramClick),t.append(o)}(n));return h}).then(n,n).fail(function(){return i.$el.modal("hide"),errorMessage("ロードに失敗しました")})},onOk:function(){switch(this.type){case"local":$.ajax({url:"/source_codes/load_local",type:"POST",data:{source_code:{filename:this.program.filename,remix:this.remix}},dataType:"json",success:function(e){return Smalruby.Views.MainMenuView.load(e.source_code)}});break;case"demo":$.ajax({url:"/source_codes/load_demo",type:"POST",data:{source_code:{filename:this.program.filename,remix:this.remix}},dataType:"json",success:function(e){return Smalruby.Views.MainMenuView.load(e.source_code)}});break;case"find-from-computer":$('input#load-file[name="source_code[file]"]').click()}return this.$el.modal("hide")},onRemix:function(){return this.setRemix(!this.remix)},setRemix:function(e){var t,o;return this.remix=e,o=$("#load-modal-remix-button"),t="btn-success",this.remix?o.addClass(t):o.removeClass(t)},onLocalProgramClick:function(e,t){return this.select(e.currentTarget,"local",t)},onDemoProgramClick:function(e,t){return this.select(e.currentTarget,"demo",t)},onFindFromComputerClick:function(e){return this.select(e.currentTarget,"find-from-computer")},select:function(e,t,o){return null==o&&(o=null),this.unselect(),$(e).addClass("active"),this.type=t,this.program=o},unselect:function(){return this.$el.find("a.thumbnail").removeClass("active")},programToHtml:function(e,t){var o,n,i=this;return n=e.imageUrl?'<img src="'+e.imageUrl+'">':'<h1 class="icon"><i class="icon-file" /></h1>',o='<li>\n <a class="thumbnail">\n '+n+"\n <blockquote>\n <p>\n "+e.title+"\n </p>\n <small>"+e.filename+"</small>\n </blockquote>\n </div>\n</li>",o=$(o),o.find("a.thumbnail").click(function(o){return o.preventDefault(),t.call(i,o,e)}),o}})}.call(this),function(){Smalruby.MainMenuView=Backbone.View.extend({el:"#main-menu",events:{"click #block-mode-button":"onBlockMode","click #ruby-mode-button":"onRubyMode","click #run-button":"onRun","click #download-button":"onDownload","click #load-local-button":"onLoadLocal","click #load-button":"onLoad","click #save-button":"onSave","click #check-button":"onCheck","click #reset-button":"onReset","click #signin-button":"onSignin","click #signout-button":"onSignout","click #username-button":"onUsername"},initialize:function(){var e=this;return $("#filename").keypress(function(e){return e||(e=window.event),13===e.keyCode?($("#save-button").click(),!1):!0}),$("#file-form").fileupload({dataType:"json",done:function(t,o){return e.load(o.result.source_code)}})},onBlockMode:function(e){var t;return e.preventDefault(),window.blockMode?void 0:Smalruby.changedAfterTranslating?(this.blockUI({title:'<i class="icon-filter"></i>\n'+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_BLOCK_MODE_BLOCKUI_TITLE"),message:Smalruby.bm("VIEWS_MAIN_MENU_VIEW_BLOCK_MODE_BLOCKUI_MESSAGE")}),t=new Smalruby.SourceCode,t.toBlocks().then(function(e){return window.blockMode=!0,$('#tabs a[href="#block-tab"]').tab("show"),e.length>0?(Smalruby.blocklyLoading=!0,Smalruby.translating=!0,Smalruby.loadXml(e),Smalruby.translating=!1,Smalruby.changedAfterTranslating=!1):void 0}).then(this.unblockUI,this.unblockUI).fail(function(){return window.errorMessage(Smalruby.bm("VIEWS_MAIN_MENU_VIEW_BLOCK_MODE_ERROR"))})):(window.blockMode=!0,$('#tabs a[href="#block-tab"]').tab("show"),void 0)},onRubyMode:function(e){var t;return e.preventDefault(),window.blockMode&&(window.blockMode=!1,$('#tabs a[href="#ruby-tab"]').tab("show"),Smalruby.changedAfterTranslating)?(t=Blockly.Ruby.workspaceToCode(),Smalruby.translating=!0,window.textEditor.getSession().getDocument().setValue(t),Smalruby.translating=!1,Smalruby.changedAfterTranslating=!1,window.textEditor.moveCursorTo(0,0),window.textEditor.focus()):void 0},onRun:function(e){var t,o,n,i=this;return e.preventDefault(),o=this.getSourceCode(),n=new Smalruby.SourceCode({filename:o.getRbxmlFilename()}),clearMessages(),this.blockUI({title:'<i class="icon-play"></i>\n'+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_RUN_BLOCKUI_TITLE"),message:Smalruby.bm("VIEWS_MAIN_MENU_VIEW_RUN_BLOCKUI_MESSAGE"),notice:Smalruby.bm("VIEWS_MAIN_MENU_VIEW_RUN_BLOCKUI_NOTICE")}),t=Smalruby.bm("VIEWS_MAIN_MENU_VIEW_RUN_ERROR_CANT_RUN"),o.save2().then(function(){return o.write()}).then(function(e){return i.confirmOverwrite_.call(i,e,o,function(){return t=Smalruby.bm("VIEWS_MAIN_MENU_VIEW_RUN_ERROR_CANCEL_TO_RUN")})}).then(function(){return Smalruby.savedFilename=o.get("filename"),window.changed=!1,o.check()}).then(function(e){var t,o,n,i;if(e.length>0){for(o=function(e){var t;return t=""+e.row+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_COMMON_LINES"),e.column>0&&(t+=""+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_COMMON_COMMA")+e.column+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_COMMON_LETTERS")),window.errorMessage(t+(": "+e.message))},n=0,i=e.length;i>n;n++)t=e[n],o(t);return $.Deferred().reject().promise()}}).then(function(){return n.save2()}).then(function(){return n.write(!0)}).then(function(){return o.run()}).then(function(e){var t,o,n,i;if(e.length>0){for(o=function(e){var t;return t=""+e.row+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_COMMON_LINES"),e.column>0&&(t+=""+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_COMMON_COMMA")+e.column+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_COMMON_LETTERS")),errorMessage(t+(": "+e.message))},n=0,i=e.length;i>n;n++)t=e[n],o(t);return $.Deferred().reject().promise()}}).then(this.unblockUI,this.unblockUI).fail(function(){return errorMessage(t)})},onDownload:function(e){var t;return e.preventDefault(),t=this.getSourceCode(),clearMessages(),this.blockUI({title:""+Smalruby.bm("VIEWS_MAIN_MENU_VIEW_DOWNLOAD_BLOCKUI_TITLE"),message:Smalruby.bm("VIEWS_MAIN_MENU_VIEW_DOWNLOAD_BLOCKUI_MESSAGE"),notice:"ダウンロードしたプログラムは、<br>\nWindowsだと「ruby "+t.get("filename")+"」、<br>\nMacだと「rsdl "+t.get("filename")+"」で実行できます。"}),t.save2().then(function(){return window.changed=!1,window.successMessage("ダウンロードしました"),Smalruby.downloading=!0,$("#download-link").click()}).then(this.unblockUI,this.unblockUI).fail(function(){return window.errorMessage("ダウンロードできませんでした")})},onLoadLocal:function(e){return e.preventDefault(),!window.changed||confirm("まだセーブしていないのでロードするとプログラムが消えてしまうよ!\nそれでもロードしますか?")?Smalruby.Views.LoadModalView.render():void 0},onLoad:function(e){return e.preventDefault(),!window.changed||confirm("まだセーブしていないのでロードするとプログラムが消えてしまうよ!\nそれでもロードしますか?")?$('input#load-file[name="source_code[file]"]').click():void 0},onSave:function(e){var t,o,n,i=this;return e.preventDefault(),o=$.trim($("#filename").val()),o.length<=0?(window.errorMessage("セーブする前にプログラムに名前をつけてね!"),$("#filename").focus(),void 0):(n=this.getSourceCode(),window.blockMode&&(n=new Smalruby.SourceCode({filename:n.getRbxmlFilename()})),clearMessages(),this.blockUI({title:"プログラムのセーブ中",message:"プログラムをセーブしています。",notice:"プログラムの名前は「"+n.get("filename")+"」です。<br>\nプログラムはホームディレクトリにセーブします。<br>"}),t="セーブできませんでした",n.save2().then(function(){return n.write()}).then(function(e){return i.confirmOverwrite_.call(i,e,n,function(){return t="セーブをキャンセルしました"})}).then(this.unblockUI,this.unblockUI).done(function(){return Smalruby.savedFilename=n.get("filename"),window.changed=!1,window.successMessage("セーブしました")}).fail(function(){return window.errorMessage(t)}))},onCheck:function(e){var t;return e.preventDefault(),clearMessages(),t=this.getSourceCode(),this.blockUI({title:"プログラムのチェック中",message:"プログラムの文法をチェックしています。",notice:"このチェックは簡易的なものですので、<br>\nプログラムを動かすとエラーが見つかるかもしれません。"}),t.check().then(function(e){var t,o,n,i;if(0===e.length)return window.successMessage("チェックしました","ただし、プログラムを動かすとエラーが見つかるかもしれません。");for(i=[],o=0,n=e.length;n>o;o++)t=e[o],i.push(function(e){var t;return t=""+e.row+"行",e.column>0&&(t+="、"+e.column+"文字"),window.errorMessage(t+(": "+e.message))}(t));return i}).then(this.unblockUI,this.unblockUI).fail(function(){return errorMessage("チェックできませんでした")})},onReset:function(e){return e.preventDefault(),window.changed?Smalruby.Views.ResetModalView.render():Smalruby.reset(),!0},onSignin:function(e){return e.preventDefault(),Smalruby.Views.SigninModalView.render()},onSignout:function(e){return e.preventDefault(),$.ajax({url:"/signout",type:"DELETE"}).then(function(){return $("#signin-button").show(),$("#signout-button").hide(),$("#username-label").text(""),$("#username-button").hide(),successMessage("ログアウトしました")},function(){return errorMessage("ログアウトに失敗しました")})},onUsername:function(e){return e.preventDefault()},getFilename:function(){return $.trim($("#filename").val())},getSourceCode:function(){var e;return e=new Smalruby.SourceCode,$("#filename").val(e.get("filename")),e},blockUI:function(e){var t,o;return t="",e.title&&(t+="<h3>\n "+e.title+"\n</h3>"),(e.message||e.notice)&&(o="",e.message&&(o+="<p>\n "+e.message+"\n</p>"),e.notice&&(o+="<small>\n "+e.notice+"\n</small>"),t+="<blockquote>\n "+o+"\n</blockquote>"),$.blockUI({message:t,css:{border:"none","text-align":"left","padding-left":"2em"}})},unblockUI:function(){return $.unblockUI()},confirmOverwrite_:function(e,t,o){return null==o&&(o=$.noop),e.source_code.error?t.get("filename")===Smalruby.savedFilename||confirm("前に"+t.get("filename")+"という名前でセーブしているけど本当にセーブしますか?\nセーブすると前に作成したプログラムは消えてしまうよ!")?t.write(!0):(o.call(),$.Deferred().reject().promise()):void 0},load:function(e){var t;return e.error?window.errorMessage(e.filename+"は"+e.error):(clearMessages(),t=e.filename,t.match(/\.xml$/)?(window.blockMode||(window.blockMode=!0,$('#tabs a[href="#block-tab"]').tab("show")),t=t.replace(/(\.rb)?\.xml$/,".rb"),Smalruby.blocklyLoading=!0,Smalruby.loadXml(e.data),e.data=Blockly.Ruby.workspaceToCode()):(Smalruby.Collections.CharacterSet.reset(),Blockly.mainWorkspace.clear(),window.blockMode&&(window.blockMode=!1,$('#tabs a[href="#ruby-tab"]').tab("show"),window.textEditor.focus())),$("#filename").val(t),window.textEditor.getSession().getDocument().setValue(e.data),window.textEditor.moveCursorTo(0,0),window.changed=!1,Smalruby.changedAfterTranslating=!0,window.successMessage("ロードしました"))}})}.call(this),function(){Smalruby.ResetModalView=Backbone.View.extend({events:{"click #reset-modal-ok-button":"onOk"},render:function(){return this.$el.modal("show")},onOk:function(){return Smalruby.reset(),this.$el.modal("hide")}})}.call(this),function(){Smalruby.SigninModalView=Backbone.View.extend({events:{"click #signin-modal-ok-button":"onOk"},initialize:function(){var e=this;return Smalruby.ignoreEnterKey(this.$el),this.$el.on("shown",function(){return e.$el.find("#signin-modal-username").focus()})},render:function(){return this.$el.find("#signin-modal-username").val($("#username-label").text()),this.$el.modal("show")},onOk:function(){var e,t=this;return e=this.$el.find("input[name=username]").val(),$.post("/sessions/",{username:e}).then(function(e){return $("#signin-button").hide(),$("#signout-button").show(),$("#username-label").text(e),$("#username-button").show(),successMessage("ログインしました"),(new $.Deferred).resolve().promise()},function(){return errorMessage("ログインに失敗しました"),(new $.Deferred).resolve().promise()}).done(function(){return t.$el.modal("hide")})}})}.call(this),function(){Blockly.Ruby=new Blockly.Generator("Ruby"),Blockly.Ruby.addReservedWords("BEGIN class ensure nil self whenEND def false not super whilealias defined? for or then yieldand do if redo true __LINE__begin else in rescue undef __FILE__break elsif module retry unless __ENCODING__case end next return until".split(/\s+/)),Blockly.Ruby.ORDER_ATOMIC=0,Blockly.Ruby.ORDER_COLLECTION=1,Blockly.Ruby.ORDER_STRING_CONVERSION=1,Blockly.Ruby.ORDER_MEMBER=2,Blockly.Ruby.ORDER_INDEX=3,Blockly.Ruby.ORDER_FUNCTION_CALL=4,Blockly.Ruby.ORDER_UNARY_SIGN=5,Blockly.Ruby.ORDER_EXPONENTIATION=6,Blockly.Ruby.ORDER_UNARY_MINUS_SIGN=7,Blockly.Ruby.ORDER_MULTIPLICATIVE=8,Blockly.Ruby.ORDER_ADDITIVE=9,Blockly.Ruby.ORDER_BITWISE_SHIFT=10,Blockly.Ruby.ORDER_BITWISE_AND=11,Blockly.Ruby.ORDER_BITWISE_XOR=12,Blockly.Ruby.ORDER_BITWISE_OR=12,Blockly.Ruby.ORDER_RELATIONAL=13,Blockly.Ruby.ORDER_EQUALS=14,Blockly.Ruby.ORDER_LOGICAL_AND=15,Blockly.Ruby.ORDER_LOGICAL_OR=16,Blockly.Ruby.ORDER_RANGE=17,Blockly.Ruby.ORDER_CONDITIONAL=18,Blockly.Ruby.ORDER_ASSIGNMENT=19,Blockly.Ruby.ORDER_NOT=20,Blockly.Ruby.ORDER_AND_OR=21,Blockly.Ruby.ORDER_NONE=99,Blockly.Ruby.INFINITE_LOOP_TRAP=null,Blockly.Ruby.init=function(){return this.definitions_=Object.create(null),Blockly.Variables?(this.variableDB_?this.variableDB_.reset():this.variableDB_=new Blockly.Names(Blockly.Ruby.RESERVED_WORDS_),this.definitions_.require_smalruby='require "smalruby"',this.definitions_.receiver_stack=["main"],this.definitions_.character_stack=[]):void 0},Blockly.Ruby.defineCharacter=function(e){var t,o,n;if(o=e.get("name"),t="character_"+o,!Blockly.Ruby.definitions_[t]){switch(e.get("rotationStyle")){case"left_right":n=", rotation_style: :left_right";break;case"none":n=", rotation_style: :none";break;default:n=""}return Blockly.Ruby.definitions_[t]=""+o+" = Character.new(costume: "+Blockly.Ruby.quote_(e.costume())+", x: "+e.get("x")+", y: "+e.get("y")+", angle: "+e.get("angle")+n+")"}},Blockly.Ruby.characterStack=function(){return this.definitions_.character_stack},Blockly.Ruby.character=function(){return _.last(this.characterStack())},Blockly.Ruby.receiverStack=function(){return this.definitions_.receiver_stack},Blockly.Ruby.receiver=function(){return _.last(this.receiverStack())},Blockly.Ruby.receiverName=function(e){var t,o;return null==e&&(e={}),t={object:Blockly.Ruby.character(),dropSelf:!0},_.extend(t,e),o=this.receiver(),o===t.object?t.dropSelf?"":"self.":""+t.object.get("name")+"."},Blockly.Ruby.cs=Blockly.Ruby.characterStack,Blockly.Ruby.cs_=Blockly.Ruby.characterStack,Blockly.Ruby.c=Blockly.Ruby.character,Blockly.Ruby.c_=Blockly.Ruby.character,Blockly.Ruby.rs=Blockly.Ruby.receiverStack,Blockly.Ruby.rs_=Blockly.Ruby.receiverStack,Blockly.Ruby.r=Blockly.Ruby.receiver,Blockly.Ruby.r_=Blockly.Ruby.receiver,Blockly.Ruby.rn=Blockly.Ruby.receiverName,Blockly.Ruby.rn_=Blockly.Ruby.receiverName,Blockly.Ruby.characterMethodCall_=function(e,t,o){var n;return null==o&&(o={}),n=this.characterMethodCallInput_(e,t,o),n[0]?""+n[0]+"\n":""},Blockly.Ruby.characterMethodCallInput_=function(e,t,o){var n;return null==o&&(o={}),n=this.c_()?t&&t.length>0?""+this.rn_(o)+e+"("+t+")":""+this.rn_(o)+e:null,[n,this.ORDER_FUNCTION_CALL]},Blockly.Ruby.characterSetVariable_=function(e,t,o){return null==o&&(o="="),this.c_()?""+this.rn_({dropSelf:!1})+e+" "+o+" "+t+"\n":""},Blockly.Ruby.characterEvent_=function(e,t,o,n){var i,r;if(null==n&&(n=null),r=this.c_()){this.rs_().push(r);try{i=Blockly.Ruby.statementToCode(e,t)||"\n"}finally{this.rs_().pop()}return n=n?", "+n:"","\n"+this.rn_()+"on(:"+o+n+") do\n"+i+"end\n"}return""},Blockly.Ruby.finish=function(e){var t,o,n,i,r;i=[],o=[],r=function(e){var t;return t=Blockly.Ruby.definitions_[e],_.isString(t)?t.match(/^require\s*('\S+'|"\S+")/)?i.push(t):o.push(t):void 0};for(n in Blockly.Ruby.definitions_)r(n);return 0===o.length&&0===e.length?"":(t=i.join("\n")+"\n\n",o.length>0&&(t+=o.join("\n").replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n")),t+e)},Blockly.Ruby.scrubNakedValue=function(e){return e+"\n"},Blockly.Ruby.escapeChars_={'"':'\\"'},Blockly.Ruby.quote_=function(e){var t,o,n,i,r,s;for(o=String(e),n=['"'],i=function(e){var t;return t=o.charAt(e),n[e+1]=Blockly.Ruby.escapeChars_[t]||t},t=r=0,s=o.length;s>=0?s>r:r>s;t=s>=0?++r:--r)i(t);return n.push('"'),n.join("")},Blockly.Ruby.scrub_=function(e,t){var o,n,i,r,s,l,a,c,u,g=this;if(null===t)return"";if(n="",!e.outputConnection||!e.outputConnection.targetConnection)for(o=e.getCommentText(),o&&(n+=this.prefixLines(o,"# ")+"\n"),u=e.inputList,l=function(e){var t;return e.type===Blockly.INPUT_VALUE&&(t=e.connection.targetBlock(),t&&(o=g.allNestedComments(t)))?n+=g.prefixLines(o,"# "):void 0},a=0,c=u.length;c>a;a++)i=u[a],l(i);return r=e.nextConnection&&e.nextConnection.targetBlock(),s=this.blockToCode(r),n+t+s}}.call(this),function(){"use strict";goog.provide("Smalruby.FieldCharacter"),goog.require("Blockly.FieldDropdown"),Smalruby.FieldCharacter=function(e,t){var o,n,i=this;return o=t?function(e){var o,n;return n=Smalruby.FieldCharacter.dropdownChange.call(i,e),n?o=n:n=i.getValue(),t.call(i,o),n}:Smalruby.FieldCharacter.dropdownChange,Smalruby.FieldCharacter.superClass_.constructor.call(this,Smalruby.FieldCharacter.dropdownCreate,o),n=Smalruby.Collections.CharacterSet,n.on("add",this.onCharacterSetAdd_,this),n.on("remove",this.onCharacterSetRemove_,this),n.on("reset",this.onCharacterSetReset_,this),this.character=Smalruby.FieldCharacter.NullCharacter,e||(e=Smalruby.Collections.CharacterSet.first()),this.setCharacter(e)},goog.inherits(Smalruby.FieldCharacter,Blockly.FieldDropdown),Smalruby.FieldCharacter.prototype.setCharacter=function(e){return e!==this.character?(this.character.unlink(this),this.character.off("change:name",this.onCharacterChangeName_,this),this.character=e?e:Smalruby.FieldCharacter.NullCharacter,this.character.link(this),this.character.on("change:name",this.onCharacterChangeName_,this),this.setValue(this.character.get("name"))):void 0},Smalruby.FieldCharacter.prototype.onCharacterSetAdd_=function(e){return this.character===Smalruby.FieldCharacter.NullCharacter?this.setCharacter(e):void 0},Smalruby.FieldCharacter.prototype.onCharacterSetRemove_=function(e){return e===this.character?this.setCharacter():void 0},Smalruby.FieldCharacter.prototype.onCharacterSetReset_=function(e){return this.character===Smalruby.FieldCharacter.NullCharacter?this.setCharacter(e.first()):this.setCharacter(e.findWhere({name:this.getValue()}))},Smalruby.FieldCharacter.prototype.onCharacterChangeName_=function(e,t){return this.setValue(t)},Smalruby.FieldCharacter.prototype.clone=function(){return new Smalruby.FieldCharacter(this.character,this.changeHandler_)},Smalruby.FieldCharacter.prototype.dispose=function(){var e;return e=Smalruby.Collections.CharacterSet,e.off("add",this.onCharacterSetAdd_,this),e.off("remove",this.onCharacterSetRemove_,this),e.off("reset",this.onCharacterSetReset_,this),this.setCharacter(),Blockly.FieldDropdown.prototype.dispose.call(this)},Smalruby.FieldCharacter.prototype.setText=function(e){var t;return this.character||(this.character=Smalruby.FieldCharacter.NullCharacter,t=Smalruby.Collections.CharacterSet,this.setCharacter(t.findWhere({name:e}))),Blockly.FieldDropdown.prototype.setText.call(this,e)},Smalruby.FieldCharacter.dropdownCreate=function(){var e;return e=Smalruby.Collections.CharacterSet,e.length>0?Smalruby.Collections.CharacterSet.map(function(e){var t;return t=e.get("name"),[t,t]}):[[Smalruby.FieldCharacter.NullCharacter.get("name"),""]]},Smalruby.FieldCharacter.dropdownChange=function(e){var t;return t=Smalruby.Collections.CharacterSet.findWhere({name:e}),t?(this.setCharacter(t),e):null},Smalruby.FieldCharacter.NullCharacter={get:function(){return Smalruby.bm("BLOCKS_FIELD_CHARACTER_NO_CHARACTER")},on:function(){return $.noop},off:function(){return $.noop},link:function(){return $.noop},unlink:function(){return $.noop}},Blockly.Block.prototype.getCharacterFieldValue=function(e){var t,o;return null==e&&(e="CHAR"),o=this.getFieldValue(e),Blockly.Ruby.c()&&(t=Smalruby.Collections.CharacterSet.findWhere({name:o}),Blockly.Ruby.defineCharacter(t)),o}}.call(this),function(){Blockly.Ruby.math_number=function(){var e,t;return e=parseFloat(this.getFieldValue("NUM")),t=0>e?Blockly.Ruby.ORDER_UNARY_MINUS_SIGN:Blockly.Ruby.ORDER_ATOMIC,[e,t]},Blockly.Ruby.text=function(){var e;return e=Blockly.Ruby.quote_(this.getFieldValue("TEXT")),[e,Blockly.Ruby.ORDER_ATOMIC]},Blockly.Ruby.variables_get=function(e){var t;return t=Blockly.Ruby.variableDB_.getName(e.getFieldValue("VAR"),Blockly.Variables.NAME_TYPE),[t,Blockly.Ruby.ORDER_ATOMIC]},Blockly.Ruby.variables_set=function(e){var t,o;return o=Blockly.Ruby.valueToCode(e,"VALUE",Blockly.Ruby.ORDER_NONE)||"0",t=Blockly.Ruby.variableDB_.getName(e.getFieldValue("VAR"),Blockly.Variables.NAME_TYPE),t+" = "+o+"\n"}}.call(this),function(){Blockly.Blocks.character_new={init:function(){var e,t,o;return this.setHelpUrl(""),this.setColour(198),o=2*Blockly.BlockSvg.FIELD_HEIGHT,e=new Blockly.FieldImage(null,o,o),t=new Blockly.FieldLabel(""),t.EDITABLE=!0,t.textElement_.setAttribute("y",10),t.setText=_.bind(this.nameFieldSetText_,this),this.appendDummyInput().appendField(e,"COSTUME").appendField(t,"NAME"),this.appendStatementInput("DO"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")},dispose:function(){var e;return this.character.off("change",this.changeHandler),"function"==typeof(e=this.character).unlink&&e.unlink(this),Blockly.Block.prototype.dispose.apply(this,arguments)},nameFieldSetText_:function(e){var t,o;return o=Smalruby.Collections.CharacterSet,t=o.findWhere({name:e}),t?this.setCharacter(t):this.fieldLableSetText_(this.getField_("NAME"),e)},fieldLableSetText_:function(e,t){return Blockly.FieldLabel.prototype.setText.call(e,t)},setCharacter:function(e){var t=this;return this.changeHandler&&this.character.off("change",this.changeHandler),this.character=e,this.setFieldValue(e.costumeUrl(),"COSTUME"),this.fieldLableSetText_(this.getField_("NAME"),e.get("name")),e.link(this),this.changeHandler=function(o){return t.setFieldValue(o.costumeUrl(),"COSTUME"),t.fieldLableSetText_(t.getField_("NAME"),e.get("name"))},e.on("change",this.changeHandler),this}},Blockly.Ruby.character_new=function(e){var t,o,n;t=e.character,Blockly.Ruby.defineCharacter(t),Blockly.Ruby.cs_().push(t);try{n=e.getInputTargetBlock("DO"),o=Blockly.Ruby.blockToCode(n)||"\n"}finally{Blockly.Ruby.cs_().pop()}return o}}.call(this),function(){Blockly.Blocks.control_sleep={init:function(){return this.setHelpUrl(""),this.setColour(43),this.interpolateMsg(Smalruby.bm("BLOCKS_CONTROL_SLEEP"),["SEC",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_sleep=function(){var e;return e=Blockly.Ruby.valueToCode(this,"SEC",Blockly.Ruby.ORDER_FUNCTION_CALL)||"0","sleep("+e+")\n"},Blockly.Blocks.control_loop={init:function(){return this.setHelpUrl(""),this.setColour(43),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_LOOP")),this.appendStatementInput("DO"),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_LOOP_END")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_loop=function(e){var t;return"main"===Blockly.Ruby.r_()?"":(t=Blockly.Ruby.statementToCode(e,"DO")||"\n","loop do\n"+t+"end\n")},Blockly.Blocks.control_break={init:function(){return this.setHelpUrl(""),this.setColour(43),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_BREAK")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_break=function(){return"main"===Blockly.Ruby.receiver()?"":"break\n"},Blockly.Blocks.control_next={init:function(){return this.setHelpUrl(""),this.setColour(43),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_NEXT")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_next=function(){return"main"===Blockly.Ruby.receiver()?"":"next\n"},Blockly.Blocks.control_redo={init:function(){return this.setHelpUrl(""),this.setColour(43),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_REDO")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_redo=function(){return"main"===Blockly.Ruby.receiver()?"":"redo\n"},Blockly.Blocks.control_if={init:function(){return this.setHelpUrl(""),this.setColour(43),this.appendValueInput("COND").setCheck("Boolean").appendField(Smalruby.bm("BLOCKS_CONTROL_IF")),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_THEN")),this.appendStatementInput("THEN"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip("")}},Blockly.Ruby.control_if=function(e){var t,o;return o=Blockly.Ruby.valueToCode(e,"COND",Blockly.Ruby.ORDER_CONDITIONAL)||"false",t=Blockly.Ruby.statementToCode(e,"THEN")||"\n","if "+o+"\n"+t+"end\n"},Blockly.Blocks.control_if_else={init:function(){return this.setHelpUrl(""),this.setColour(43),this.appendValueInput("COND").setCheck("Boolean").appendField(Smalruby.bm("BLOCKS_CONTROL_IF")),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_THEN")),this.appendStatementInput("THEN"),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_ELSE")),this.appendStatementInput("ELSE"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setInputsInline(!0),this.setTooltip("")}},Blockly.Ruby.control_if_else=function(e){var t,o,n;return n=Blockly.Ruby.valueToCode(e,"COND",Blockly.Ruby.ORDER_CONDITIONAL)||"false",t=Blockly.Ruby.statementToCode(e,"THEN")||"\n",o=Blockly.Ruby.statementToCode(e,"ELSE")||"\n","if "+n+"\n"+t+"else\n"+o+"end\n"},Blockly.Blocks.control_times={init:function(){return this.setHelpUrl(""),this.setColour(43),this.interpolateMsg(Smalruby.bm("BLOCKS_CONTROL_TIMES"),["COUNT",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.appendStatementInput("DO"),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_times=function(e){var t,o;return o=Blockly.Ruby.valueToCode(this,"COUNT",Blockly.Ruby.ORDER_NONE)||0,t=Blockly.Ruby.statementToCode(e,"DO")||"\n",""+o+".times do\n"+t+"end\n"},Blockly.Blocks.control_await_until={init:function(){return this.setHelpUrl(""),this.setColour(43),this.interpolateMsg(Smalruby.bm("BLOCKS_CONTROL_AWAIT_UNTIL"),["COND",["Boolean"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_await_until=function(){var e,t;return"main"===Blockly.Ruby.receiver()?"":(e=Blockly.Ruby.characterMethodCallInput_("await")[0],t=Blockly.Ruby.valueToCode(this,"COND",Blockly.Ruby.ORDER_CONDITIONAL)||"true",""+e+" until "+t+"\n")},Blockly.Blocks.control_until={init:function(){return this.setHelpUrl(""),this.setColour(43),this.interpolateMsg(Smalruby.bm("BLOCKS_CONTROL_UNTIL"),["COND",["Boolean"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.appendStatementInput("DO"),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_LOOP_END")).setAlign(Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_until=function(e){var t,o;return o=Blockly.Ruby.valueToCode(this,"COND",Blockly.Ruby.ORDER_CONDITIONAL)||"true",t=Blockly.Ruby.statementToCode(e,"DO")||"\n","until "+o+"\n"+t+"end\n"},Blockly.Blocks.control_await={init:function(){return this.setHelpUrl(""),this.setColour(43),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_CONTROL_AWAIT")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.control_await=function(){return"main"===Blockly.Ruby.receiver()?"":Blockly.Ruby.characterMethodCall_("await")}}.call(this),function(){}.call(this),function(){}.call(this),function(){Blockly.Blocks.events_on_start={init:function(){return this.setHelpUrl(""),this.setColour(33),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_EVENTS_ON_START")),this.appendStatementInput("DO"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.events_on_start=function(e){return Blockly.Ruby.characterEvent_(e,"DO","start")},Blockly.Blocks.events_on_key_push_or_down={init:function(){var e,t;return e=window.SmalrubyEditor.Sensing.KeyDropdown,t=window.SmalrubyEditor.Sensing.PushOrDownDropdown,this.setHelpUrl(""),this.setColour(33),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_EVENTS_ON_KEY_PUSH_OR_DOWN_PREFIX")).appendField(new Blockly.FieldDropdown(e),"KEY").appendField(Smalruby.bm("BLOCKS_EVENTS_ON_KEY_PUSH_OR_DOWN_MIDDLE")).appendField(new Blockly.FieldDropdown(t),"POD").appendField(Smalruby.bm("BLOCKS_EVENTS_ON_KEY_PUSH_OR_DOWN_SUFFIX")),this.appendStatementInput("DO"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.events_on_key_push_or_down=function(e){var t,o;return t=this.getFieldValue("KEY"),o=this.getFieldValue("POD"),Blockly.Ruby.characterEvent_(e,"DO","key_"+o,t)},Blockly.Blocks.events_on_click={init:function(){return this.setHelpUrl(""),this.setColour(33),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_EVENTS_ON_CLICK")),this.appendStatementInput("DO"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.events_on_click=function(e){return Blockly.Ruby.characterEvent_(e,"DO","click")},Blockly.Blocks.events_on_hit={init:function(){return this.setHelpUrl(""),this.setColour(33),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_EVENTS_ON_HIT_PREFIX")).appendField(new Smalruby.FieldCharacter,"CHAR").appendField(Smalruby.bm("BLOCKS_EVENTS_ON_HIT_SUFFIX")),this.appendStatementInput("DO"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.events_on_hit=function(e){var t;return t=this.getCharacterFieldValue(),Blockly.Ruby.characterEvent_(e,"DO","hit",t)}}.call(this),function(){var e,t,o,n,i,r,s,l;n=null,r=null,s=null,o=null,e=null,i=null,l=null,t=null,$(document).ready(function(){var a;return window.SmalrubyEditor.Hardware={Type:"Arduino",DioPins:[2,3,4,5,6,7,8,9,10,11,12,13],PwmPins:[3,5,6,9,10,11],AiPins:[0,1,2,3,4,5]},n=function(){var e,t,o,n;for(o=window.SmalrubyEditor.Hardware.DioPins,n=[],e=0,t=o.length;t>e;e++)a=o[e],n.push(["D"+a,"D"+a]);return n}(),r=function(){var e,t,o,n;for(o=window.SmalrubyEditor.Hardware.PwmPins,n=[],e=0,t=o.length;t>e;e++)a=o[e],n.push(["D"+a,"D"+a]);return n}(),s=function(){var e,t,o,n;for(o=[3,9],n=[],e=0,t=o.length;t>e;e++)a=o[e],n.push(["D"+a,"D"+a]);return n}(),o=function(){var e,t,o,n;for(o=window.SmalrubyEditor.Hardware.AiPins,n=[],e=0,t=o.length;t>e;e++)a=o[e],n.push(["A"+a,"A"+a]);return n}(),e=[[Smalruby.bm("BLOCKS_HARDWARE_ANODE"),"anode"],[Smalruby.bm("BLOCKS_HARDWARE_CATHODE"),"cathode"]],i=[[Smalruby.bm("BLOCKS_HARDWARE_LEFT"),"left"],[Smalruby.bm("BLOCKS_HARDWARE_RIGHT"),"right"]],l=function(){var e,t,o,n;for(o=[5,6],n=[],e=0,t=o.length;t>e;e++)a=o[e],n.push(["D"+a,"D"+a]);return n}(),t=[[Smalruby.bm("COMMON_FORWARD"),"forward"],[Smalruby.bm("COMMON_BACKWARD"),"backward"],[Smalruby.bm("COMMON_TURN_LEFT"),"turn_left"],[Smalruby.bm("COMMON_TURN_RIGHT"),"turn_right"],[Smalruby.bm("COMMON_STOP"),"stop"]]
34
- }),Blockly.Blocks.hardware_init_hardware={init:function(){return this.setHelpUrl(""),this.setColour(340),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_HARDWARE_INIT_HARDWARE")),this.setTooltip("")}},Blockly.Ruby.hardware_init_hardware=function(){return Blockly.Ruby.definitions_.init_hardware="init_hardware",""},Blockly.Blocks.hardware_led_turn_on={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_LED_TURN_ON"),["PIN",["Dropdown",n],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.setFieldValue("D2","PIN")}},Blockly.Ruby.hardware_led_turn_on=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("led("+Blockly.Ruby.quote_(e)+").turn_on")},Blockly.Blocks.hardware_led_turn_off={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_LED_TURN_OFF"),["PIN",["Dropdown",n],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(""),this.setFieldValue("D2","PIN")}},Blockly.Ruby.hardware_led_turn_off=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("led("+Blockly.Ruby.quote_(e)+").turn_off")},Blockly.Blocks.hardware_rgb_led_set_color={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_RGB_LED_SET_COLOR"),["AC",["Dropdown",e],Blockly.ALIGN_RIGHT],["PIN",["Dropdown",s],Blockly.ALIGN_RIGHT],["COLOUR",["Colour","#ff0000"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_rgb_led_set_color=function(e){var t,o,n,i,r,s;return t=this.getFieldValue("AC"),r=this.getFieldValue("PIN"),n=e.getFieldValue("COLOUR"),s=parseInt(n.slice(1,3),16),i=parseInt(n.slice(3,5),16),o=parseInt(n.slice(5,7),16),Blockly.Ruby.characterSetVariable_("rgb_led_"+t+"("+Blockly.Ruby.quote_(r)+").color","["+s+", "+i+", "+o+"]")},Blockly.Blocks.hardware_rgb_led_turn_off={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_RGB_LED_TURN_OFF"),["AC",["Dropdown",e],Blockly.ALIGN_RIGHT],["PIN",["Dropdown",s],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_rgb_led_turn_off=function(){var e,t;return e=this.getFieldValue("AC"),t=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("rgb_led_"+e+"("+Blockly.Ruby.quote_(t)+").turn_off")},Blockly.Blocks.hardware_seven_segment_display_show={init:function(){var e,t;return e=function(){var e,o;for(o=[],t=e=0;9>=e;t=++e)o.push([String(t),String(t)]);return o}(),this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SEVEN_SEGMENT_DISPLAY_SHOW"),["NUM",["Dropdown",e],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_seven_segment_display_show=function(){var e;return e=parseInt(this.getFieldValue("NUM")),Blockly.Ruby.characterMethodCall_("seven_segment_display.show("+e+")")},Blockly.Blocks.hardware_seven_segment_display_off={init:function(){return this.setHelpUrl(""),this.setColour(270),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_HARDWARE_SEVEN_SEGMENT_DISPLAY_OFF")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_seven_segment_display_off=function(){return Blockly.Ruby.characterMethodCall_("seven_segment_display.off")},Blockly.Blocks.hardware_lcd_puts={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_LCD_PUTS"),["TEXT",["String"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_lcd_puts=function(){var e;return e=Blockly.Ruby.valueToCode(this,"TEXT",Blockly.Ruby.ORDER_NONE)||"",Blockly.Ruby.characterMethodCall_("lcd.puts("+e+")")},Blockly.Blocks.hardware_lcd_clear={init:function(){return this.setHelpUrl(""),this.setColour(270),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_HARDWARE_LCD_CLEAR")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_lcd_clear=function(){return Blockly.Ruby.characterMethodCall_("lcd.clear")},Blockly.Blocks.hardware_servo_set_position={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SERVO_SET_POSITION"),["PIN",["Dropdown",r],Blockly.ALIGN_RIGHT],["POS",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_servo_set_position=function(){var e,t;return e=this.getFieldValue("PIN"),t=Blockly.Ruby.valueToCode(this,"POS",Blockly.Ruby.ORDER_FUNCTION_CALL)||"5",Blockly.Ruby.characterMethodCall_("servo("+Blockly.Ruby.quote_(e)+").position = "+t)},Blockly.Blocks.hardware_two_wheel_drive_car_forward={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_FORWARD"),["PIN",["Dropdown",l],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_forward=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("two_wheel_drive_car("+Blockly.Ruby.quote_(e)+").forward")},Blockly.Blocks.hardware_two_wheel_drive_car_backward={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_BACKWARD"),["PIN",["Dropdown",l],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_backward=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("two_wheel_drive_car("+Blockly.Ruby.quote_(e)+").backward")},Blockly.Blocks.hardware_two_wheel_drive_car_turn_left={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_TURN_LEFT"),["PIN",["Dropdown",l],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_turn_left=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("two_wheel_drive_car("+Blockly.Ruby.quote_(e)+").turn_left")},Blockly.Blocks.hardware_two_wheel_drive_car_turn_right={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_TURN_RIGHT"),["PIN",["Dropdown",l],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_turn_right=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("two_wheel_drive_car("+Blockly.Ruby.quote_(e)+").turn_right")},Blockly.Blocks.hardware_two_wheel_drive_car_stop={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_STOP"),["PIN",["Dropdown",l],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_stop=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCall_("two_wheel_drive_car("+Blockly.Ruby.quote_(e)+").stop")},Blockly.Blocks.hardware_two_wheel_drive_car_run={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_RUN"),["COMMAND",["String"],Blockly.ALIGN_RIGHT],["PIN",["Dropdown",l],Blockly.ALIGN_RIGHT],["SEC",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_run=function(){var e,t,o;return t=this.getFieldValue("PIN"),o=Blockly.Ruby.valueToCode(this,"SEC",Blockly.Ruby.ORDER_NONE)||0,e=Blockly.Ruby.valueToCode(this,"COMMAND",Blockly.Ruby.ORDER_NONE)||Blockly.Ruby.quote_("stop"),Blockly.Ruby.characterMethodCall_("two_wheel_drive_car("+Blockly.Ruby.quote_(t)+").run(command: "+e+", sec: "+o+")")},Blockly.Blocks.hardware_two_wheel_drive_car_commands={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(new Blockly.FieldDropdown(t),"COMMAND"),this.setOutput(!0,"String"),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_commands=function(){var e;return e=Blockly.Ruby.quote_(this.getFieldValue("COMMAND")),[e,Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.hardware_two_wheel_drive_car_set_speed={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_SET_SPEED"),["PIN",["Dropdown",r],Blockly.ALIGN_RIGHT],["LOR",["Dropdown",i],Blockly.ALIGN_RIGHT],["SPEED",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_set_speed=function(){var e,t,o;return t=this.getFieldValue("PIN"),e=this.getFieldValue("LOR"),o=Blockly.Ruby.valueToCode(this,"SPEED",Blockly.Ruby.ORDER_NONE)||"100",Blockly.Ruby.characterMethodCall_("two_wheel_drive_car("+Blockly.Ruby.quote_(t)+")."+e+"_speed = "+o)},Blockly.Blocks.hardware_two_wheel_drive_car_speed={init:function(){return this.setHelpUrl(""),this.setColour(190),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_TWO_WHEEL_DRIVE_CAR_SPEED"),["PIN",["Dropdown",r],Blockly.ALIGN_RIGHT],["LOR",["Dropdown",i],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.hardware_two_wheel_drive_car_speed=function(){var e,t;return t=this.getFieldValue("PIN"),e=this.getFieldValue("LOR"),Blockly.Ruby.characterMethodCallInput_("two_wheel_drive_car("+Blockly.Ruby.quote_(t)+")."+e+"_speed")},Blockly.Blocks.hardware_motor_driver={init:function(){var e;return e=[[Smalruby.bm("BLOCKS_HARDWARE_MOTOR_DRIVER_FORWARD"),"forward"],[Smalruby.bm("BLOCKS_HARDWARE_MOTOR_DRIVER_BACKWARD"),"backward"],[Smalruby.bm("BLOCKS_HARDWARE_MOTOR_DRIVER_STOP"),"stop"]],this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_MOTOR_DRIVER"),["PIN",["Dropdown",r],Blockly.ALIGN_RIGHT],["METHOD",["Dropdown",e],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_motor_driver=function(){var e,t;return t=this.getFieldValue("PIN"),e=this.getFieldValue("METHOD"),Blockly.Ruby.characterMethodCall_("motor_driver("+Blockly.Ruby.quote_(t)+")."+e)},Blockly.Blocks.hardware_motor_driver_set_speed={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_MOTOR_DRIVER_SET_SPEED"),["PIN",["Dropdown",r],Blockly.ALIGN_RIGHT],["SPEED",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_motor_driver_set_speed=function(){var e,t;return e=this.getFieldValue("PIN"),t=Blockly.Ruby.valueToCode(this,"SPEED",Blockly.Ruby.ORDER_NONE)||"100",Blockly.Ruby.characterMethodCall_("motor_driver("+Blockly.Ruby.quote_(e)+").speed = "+t)},Blockly.Blocks.hardware_motor_driver_speed={init:function(){return this.setHelpUrl(""),this.setColour(190),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_MOTOR_DRIVER_SPEED"),["PIN",["Dropdown",r],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.hardware_motor_driver_speed=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCallInput_("motor_driver("+Blockly.Ruby.quote_(e)+").speed")},Blockly.Blocks.hardware_button_pressed_or_released={init:function(){var e;return e=window.SmalrubyEditor.Sensing.PressedOrReleasedDropdown,this.setHelpUrl(""),this.setColour(190),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_BUTTON_PRESSED_OR_RELEASED"),["PIN",["Dropdown",n],Blockly.ALIGN_RIGHT],["POR",["Dropdown",e],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.hardware_button_pressed_or_released=function(){var e,t;return e=this.getFieldValue("PIN"),t=this.getFieldValue("POR"),Blockly.Ruby.characterMethodCallInput_("button("+Blockly.Ruby.quote_(e)+")."+t+"?")},Blockly.Blocks.hardware_sensor_value={init:function(){return this.setHelpUrl(""),this.setColour(190),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SENSOR_VALUE"),["PIN",["Dropdown",o],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.hardware_sensor_value=function(){var e;return e=this.getFieldValue("PIN"),Blockly.Ruby.characterMethodCallInput_("sensor("+Blockly.Ruby.quote_(e)+").value")},Blockly.Blocks.hardware_smalrubot_v3_led_turn_on_or_off={init:function(){var e,t;return e=[[Smalruby.bm("COLOUR_RED"),"red"],[Smalruby.bm("COLOUR_GREEN"),"green"]],t=[[Smalruby.bm("COMMON_TURN_ON"),"turn_on"],[Smalruby.bm("COMMON_TURN_OFF"),"turn_off"]],this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SMALRUBOT_V3_LED_TURN_ON_OR_OFF"),["COLOUR",["Dropdown",e],Blockly.ALIGN_RIGHT],["OOO",["Dropdown",t],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_smalrubot_v3_led_turn_on_or_off=function(){var e,t;return e=this.getFieldValue("COLOUR"),t=this.getFieldValue("OOO"),Blockly.Ruby.characterMethodCall_("smalrubot_v3."+e+"_led."+t)},Blockly.Blocks.hardware_smalrubot_v3_motor_speed={init:function(){return this.setHelpUrl(""),this.setColour(190),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SPEED"),["LOR",["Dropdown",i],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.hardware_smalrubot_v3_motor_speed=function(){var e;return e=this.getFieldValue("LOR"),Blockly.Ruby.characterMethodCallInput_("smalrubot_v3."+e+"_motor.speed")},Blockly.Blocks.hardware_smalrubot_v3_motor_set_speed={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SET_SPEED"),["LOR",["Dropdown",i],Blockly.ALIGN_RIGHT],["SPEED",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_smalrubot_v3_motor_set_speed=function(){var e,t;return e=this.getFieldValue("LOR"),t=Blockly.Ruby.valueToCode(this,"SPEED",Blockly.Ruby.ORDER_NONE)||"100",Blockly.Ruby.characterSetVariable_("smalrubot_v3."+e+"_motor.speed",t)},Blockly.Blocks.hardware_smalrubot_v3_action={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION"),["ACTION",["Dropdown",t],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_smalrubot_v3_action=function(){var e;return e=this.getFieldValue("ACTION"),Blockly.Ruby.characterMethodCall_("smalrubot_v3."+e)},Blockly.Blocks.hardware_smalrubot_v3_action_with_sec={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION_WITH_SEC"),["ACTION",["Dropdown",t],Blockly.ALIGN_RIGHT],["SEC",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.hardware_smalrubot_v3_action_with_sec=function(){var e,t;return e=this.getFieldValue("ACTION"),t=Blockly.Ruby.valueToCode(this,"SEC",Blockly.Ruby.ORDER_FUNCTION_CALL)||"nil",Blockly.Ruby.characterMethodCall_("smalrubot_v3."+e+"(sec: "+t+")")},Blockly.Blocks.hardware_smalrubot_v3_touch_sensor_pressed_or_released={init:function(){var e;return e=window.SmalrubyEditor.Sensing.PressedOrReleasedDropdown,this.setHelpUrl(""),this.setColour(190),this.interpolateMsg(Smalruby.bm("BLOCKS_HARDWARE_SMALRUBOT_V3_TOUCH_SENSOR_PRESSED_OR_RELEASED"),["LOR",["Dropdown",i],Blockly.ALIGN_RIGHT],["POR",["Dropdown",e],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.hardware_smalrubot_v3_touch_sensor_pressed_or_released=function(){var e,t;return e=this.getFieldValue("LOR"),t=this.getFieldValue("POR"),Blockly.Ruby.characterMethodCallInput_("smalrubot_v3."+e+"_touch_sensor."+t+"?")},Blockly.Blocks.hardware_smalrubot_v3_light_sensor_value={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_HARDWARE_SMALRUBOT_V3_LIGHT_SENSOR_VALUE")),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.hardware_smalrubot_v3_light_sensor_value=function(){return Blockly.Ruby.characterMethodCallInput_("smalrubot_v3.light_sensor.value")}}.call(this),function(){Blockly.Blocks.looks_say_second={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_LOOKS_SAY_WITH_SECOND"),["TEXT",null,Blockly.ALIGN_RIGHT],["SEC",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_say_second=function(){var e,t;return e=Blockly.Ruby.valueToCode(this,"SEC",Blockly.Ruby.ORDER_NONE)||"0",t=Blockly.Ruby.valueToCode(this,"TEXT",Blockly.Ruby.ORDER_NONE)||Blockly.Ruby.quote_(""),Blockly.Ruby.characterMethodCall_("say","message: "+t+", second: "+e)},Blockly.Blocks.looks_say={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_LOOKS_SAY"),["TEXT",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_say=function(){var e;return e=Blockly.Ruby.valueToCode(this,"TEXT",Blockly.Ruby.ORDER_NONE)||Blockly.Ruby.quote_(""),Blockly.Ruby.characterMethodCall_("say","message: "+e)},Blockly.Blocks.looks_think_second={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_LOOKS_THINK_WITH_SECOND"),["TEXT",null,Blockly.ALIGN_RIGHT],["SEC",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_think_second=function(){var e,t;return e=Blockly.Ruby.valueToCode(this,"SEC",Blockly.Ruby.ORDER_NONE)||"0",t=Blockly.Ruby.valueToCode(this,"TEXT",Blockly.Ruby.ORDER_NONE)||Blockly.Ruby.quote_(""),Blockly.Ruby.characterMethodCall_("think","message: "+t+", second: "+e)},Blockly.Blocks.looks_think={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg(Smalruby.bm("BLOCKS_LOOKS_THINK"),["TEXT",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_think=function(){var e;return e=Blockly.Ruby.valueToCode(this,"TEXT",Blockly.Ruby.ORDER_NONE)||Blockly.Ruby.quote_(""),Blockly.Ruby.characterMethodCall_("think","message: "+e)},Blockly.Blocks.looks_show={init:function(){return this.setHelpUrl(""),this.setColour(270),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_LOOKS_SHOW")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_show=function(){return Blockly.Ruby.characterSetVariable_("visible","true")},Blockly.Blocks.looks_hide={init:function(){return this.setHelpUrl(""),this.setColour(270),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_LOOKS_HIDE")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_hide=function(){return Blockly.Ruby.characterSetVariable_("visible","false")},Blockly.Blocks.looks_vanish={init:function(){return this.setHelpUrl(""),this.setColour(270),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_LOOKS_VANISH")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_vanish=function(){return Blockly.Ruby.characterMethodCall_("vanish")},Blockly.Blocks.looks_change_scale_by={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg("大きさを%1%ずつ変える",["SCALE",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_change_scale_by=function(){var e;return e=Blockly.Ruby.valueToCode(this,"SCALE",Blockly.Ruby.ORDER_NONE)||"0",e=parseInt(e)/100,"self.scale += "+e+"\n"},Blockly.Blocks.looks_set_scale={init:function(){return this.setHelpUrl(""),this.setColour(270),this.interpolateMsg("大きさを%1%にする",["SCALE",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.looks_set_scale=function(){var e;return e=Blockly.Ruby.valueToCode(this,"SCALE",Blockly.Ruby.ORDER_NONE)||"0",e=parseInt(e)/100,"self.scale = "+e+"\n"},Blockly.Blocks.looks_self_scale={init:function(){return this.setHelpUrl(""),this.setColour(270),this.appendDummyInput().appendField("大きさ"),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.looks_self_scale=function(){return["scale",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.looks_preset_images={init:function(){var e;return e=[["車1","car1.png"],["車2","car2.png"],["車3","car3.png"],["車4","car4.png"],["ボール1","ball1.png"],["ボール2","ball2.png"],["ボール3","ball3.png"],["ボール4","ball4.png"],["ボール5","ball5.png"],["ボール6","ball6.png"],["猫1","cat1.png"],["猫2","cat2.png"],["猫3","cat3.png"],["かえる1","frog1.png"],["コウガ リュウ1","ryu1.png"],["コウガ リュウ2","ryu2.png"],["イタチのタイチ","taichi1.png"],["イタチのタイチ","taichi2.png"]],this.setHelpUrl(""),this.setColour(270),this.appendDummyInput().appendField(new Blockly.FieldDropdown(e),"NAME"),this.setOutput(!0,"String"),this.setTooltip("")}},Blockly.Ruby.looks_preset_images=function(){var e;return e=Blockly.Ruby.quote_(this.getFieldValue("NAME")),[e,Blockly.Ruby.ORDER_ATOMIC]}}.call(this),function(){Blockly.Blocks.motion_move={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_MOVE"),["STEP",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_move=function(){var e;return e=Blockly.Ruby.valueToCode(this,"STEP",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterMethodCall_("move",""+e)},Blockly.Blocks.motion_rotate_right={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_TURN_RIGHT_DEGREES"),["ANGLE",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_rotate_right=function(){var e;return e=Blockly.Ruby.valueToCode(this,"ANGLE",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterMethodCall_("rotate",""+e)},Blockly.Blocks.motion_rotate_left={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_TURN_LEFT_DEGREES"),["ANGLE",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_rotate_left=function(){var e;return e=Blockly.Ruby.valueToCode(this,"ANGLE",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterMethodCall_("rotate","-"+e)},Blockly.Blocks.motion_set_angle={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_POINT_IN_DIRECTION"),["ANGLE",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_set_angle=function(){var e;return e=Blockly.Ruby.valueToCode(this,"ANGLE",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterSetVariable_("angle",e)},Blockly.Blocks.motion_point_towards_mouse={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_POINT_TOWARDS_MOUSE")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_point_towards_mouse=function(){return""+Blockly.Ruby.rn()+"point_towards(:mouse)\n"},Blockly.Blocks.motion_point_towards_character={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(new Smalruby.FieldCharacter,"CHAR").appendField(Smalruby.bm("BLOCKS_MOTION_POINT_TOWARDS_CHARACTER")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_point_towards_character=function(){var e;return e=this.getCharacterFieldValue(),Blockly.Ruby.characterMethodCall_("point_towards",e)},Blockly.Blocks.motion_set_x_y={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_SET_X_Y_X")),this.appendValueInput("X").setCheck("Number"),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_SET_X_Y_Y")),this.appendValueInput("Y").setCheck("Number"),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_SET_X_Y_SUFFIX")),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_set_x_y=function(){var e,t;return e=Blockly.Ruby.valueToCode(this,"X",Blockly.Ruby.ORDER_NONE)||"0",t=Blockly.Ruby.valueToCode(this,"Y",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterSetVariable_("position","["+e+", "+t+"]")},Blockly.Blocks.motion_go_to_mouse={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_GO_TO_MOUSE")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_go_to_mouse=function(){return Blockly.Ruby.characterMethodCall_("go_to(:mouse)")},Blockly.Blocks.motion_go_to_character={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_GO_TO_CHARACTER_PREFIX")).appendField(new Smalruby.FieldCharacter,"CHAR").appendField(Smalruby.bm("BLOCKS_MOTION_GO_TO_CHARACTER_SUFFIX")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_go_to_character=function(){var e;return e=this.getCharacterFieldValue(),Blockly.Ruby.characterMethodCall_("go_to("+e+")")},Blockly.Blocks.motion_glide_to_x_y={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg("%1秒でx座標を%2、y座標を%3に変える",["SEC",["Number"],Blockly.ALIGN_RIGHT],["X",["Number"],Blockly.ALIGN_RIGHT],["Y",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_glide_to_x_y=function(){var e,t,o;return e=Blockly.Ruby.valueToCode(this,"SEC",Blockly.Ruby.ORDER_NONE)||"0",t=Blockly.Ruby.valueToCode(this,"X",Blockly.Ruby.ORDER_NONE)||"0",o=Blockly.Ruby.valueToCode(this,"Y",Blockly.Ruby.ORDER_NONE)||"0",""+Blockly.Ruby.rn()+"glide_to(second: "+e+", x: "+t+", y: "+o+")\n"},Blockly.Blocks.motion_change_x_by={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_CHANGE_X_BY"),["X",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_change_x_by=function(){var e;return e=Blockly.Ruby.valueToCode(this,"X",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterSetVariable_("x",e,"+=")},Blockly.Blocks.motion_set_x={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_SET_X"),["X",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_set_x=function(){var e;return e=Blockly.Ruby.valueToCode(this,"X",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterSetVariable_("x",e,"=")},Blockly.Blocks.motion_change_y_by={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_CHANGE_Y_BY"),["Y",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_change_y_by=function(){var e;return e=Blockly.Ruby.valueToCode(this,"Y",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterSetVariable_("y",e,"+=")},Blockly.Blocks.motion_set_y={init:function(){return this.setHelpUrl(""),this.setColour(208),this.interpolateMsg(Smalruby.bm("BLOCKS_MOTION_SET_Y"),["Y",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_set_y=function(){var e;return e=Blockly.Ruby.valueToCode(this,"Y",Blockly.Ruby.ORDER_NONE)||"0",Blockly.Ruby.characterSetVariable_("y",e,"=")},Blockly.Blocks.motion_turn_if_reach_wall={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_TURN_IF_REACH_WALL")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_turn_if_reach_wall=function(){return Blockly.Ruby.characterMethodCall_("turn_if_reach_wall")},Blockly.Blocks.motion_turn={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_TURN")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_turn=function(){return Blockly.Ruby.characterMethodCall_("turn")},Blockly.Blocks.motion_turn_xy={init:function(){var e;return e=[[Smalruby.bm("BLOCKS_MOTION_TURN_XY_X"),"x"],[Smalruby.bm("BLOCKS_MOTION_TURN_XY_Y"),"y"]],this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_TURN_XY_PREFIX")).appendField(new Blockly.FieldDropdown(e),"XY").appendField(Smalruby.bm("BLOCKS_MOTION_TURN_XY_SUFFIX")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_turn_xy=function(){var e;return e=this.getFieldValue("XY"),Blockly.Ruby.characterMethodCall_("turn_"+e)},Blockly.Blocks.motion_set_rotation_style={init:function(){var e;return e=[[Smalruby.bm("BLOCKS_MOTION_SET_ROTATION_STYLE_LEFT_RIGHT"),"left_right"],[Smalruby.bm("BLOCKS_MOTION_SET_ROTATION_STYLE_NONE"),"none"],[Smalruby.bm("BLOCKS_MOTION_SET_ROTATION_STYLE_FREE"),"free"]],this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_SET_ROTATION_STYLE_PREFIX")).appendField(new Blockly.FieldDropdown(e),"STYLE").appendField(Smalruby.bm("BLOCKS_MOTION_SET_ROTATION_STYLE_SUFFIX")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.motion_set_rotation_style=function(){var e;return e=this.getFieldValue("STYLE"),Blockly.Ruby.characterSetVariable_("rotation_style",":"+e)},Blockly.Blocks.motion_self_x={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_SELF_X")),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.motion_self_x=function(){return Blockly.Ruby.characterMethodCallInput_("x")},Blockly.Blocks.motion_self_y={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_SELF_Y")),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.motion_self_y=function(){return Blockly.Ruby.characterMethodCallInput_("y")
35
- },Blockly.Blocks.motion_self_angle={init:function(){return this.setHelpUrl(""),this.setColour(208),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_MOTION_SELF_ANGLE")),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.motion_self_angle=function(){return Blockly.Ruby.characterMethodCallInput_("angle")}}.call(this),function(){Blockly.Blocks.operators_add={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_ADD"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,null),this.setTooltip("")}},Blockly.Ruby.operators_add=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_ADDITIVE,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" + "+o,n]},Blockly.Blocks.operators_minus={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_MINUS"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,null),this.setTooltip("")}},Blockly.Ruby.operators_minus=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_ADDITIVE,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" - "+o,n]},Blockly.Blocks.operators_multiply={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_MULTIPLY"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,null),this.setTooltip("")}},Blockly.Ruby.operators_multiply=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_MULTIPLICATIVE,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" * "+o,n]},Blockly.Blocks.operators_divide={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_DIVIDE"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,null),this.setTooltip("")}},Blockly.Ruby.operators_divide=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_MULTIPLICATIVE,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"1",[t+" / "+o,n]},Blockly.Blocks.operators_compare_lt={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_COMPARE_LT"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_compare_lt=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_RELATIONAL,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" < "+o,n]},Blockly.Blocks.operators_compare_lte={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_COMPARE_LTE"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_compare_lte=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_RELATIONAL,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" <= "+o,n]},Blockly.Blocks.operators_compare_eq={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_COMPARE_EQ"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_compare_eq=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_EQUALS,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" == "+o,n]},Blockly.Blocks.operators_compare_gte={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_COMPARE_GTE"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_compare_gte=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_RELATIONAL,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" >= "+o,n]},Blockly.Blocks.operators_compare_gt={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_COMPARE_GT"),["A",null,Blockly.ALIGN_RIGHT],["B",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_compare_gt=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_RELATIONAL,t=Blockly.Ruby.valueToCode(e,"A",n)||"0",o=Blockly.Ruby.valueToCode(e,"B",n)||"0",[t+" > "+o,n]},Blockly.Blocks.operators_rand={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_RAND"),["A",["Number"],Blockly.ALIGN_RIGHT],["B",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.operators_rand=function(e){var t,o;return t=Blockly.Ruby.valueToCode(e,"A",Blockly.Ruby.ORDER_RANGE)||"0",o=Blockly.Ruby.valueToCode(e,"B",Blockly.Ruby.ORDER_RANGE)||"0",["rand("+t+".."+o+")",Blockly.Ruby.ORDER_FUNCTION_CALL]},Blockly.Blocks.operators_and={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_AND"),["A",["Boolean"],Blockly.ALIGN_RIGHT],["B",["Boolean"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_and=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_LOGICAL_AND,t=Blockly.Ruby.valueToCode(e,"A",n)||"true",o=Blockly.Ruby.valueToCode(e,"B",n)||"true",[""+t+" && "+o,n]},Blockly.Blocks.operators_or={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_OR"),["A",["Boolean"],Blockly.ALIGN_RIGHT],["B",["Boolean"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_or=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_LOGICAL_OR,t=Blockly.Ruby.valueToCode(e,"A",n)||"true",o=Blockly.Ruby.valueToCode(e,"B",n)||"true",[""+t+" || "+o,n]},Blockly.Blocks.operators_negate={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_NOT"),["A",["Boolean"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_negate=function(e){var t,o;return o=Blockly.Ruby.ORDER_UNARY_SIGN,t=Blockly.Ruby.valueToCode(e,"A",o)||"true",["!"+t,o]},Blockly.Blocks.operators_index_of={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_INDEX_OF"),["A",null,Blockly.ALIGN_RIGHT],["INDEX",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,null),this.setTooltip("")}},Blockly.Ruby.operators_index_of=function(e){var t,o;return t=Blockly.Ruby.valueToCode(e,"A",Blockly.Ruby.ORDER_FUNCTION_CALL)||'""',o=Blockly.Ruby.valueToCode(e,"INDEX",Blockly.Ruby.ORDER_INDEX)||"0",[""+t+"["+o+"]",Blockly.Ruby.ORDER_FUNCTION_CALL]},Blockly.Blocks.operators_length={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_LENGTH"),["A",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,null),this.setTooltip("")}},Blockly.Ruby.operators_length=function(e){var t,o;return o=Blockly.Ruby.ORDER_FUNCTION_CALL,t=Blockly.Ruby.valueToCode(e,"A",o)||'""',[""+t+".length",o]},Blockly.Blocks.operators_modulo={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_MODULO"),["A",["Number"],Blockly.ALIGN_RIGHT],["B",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.operators_modulo=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_MULTIPLICATIVE,t=Blockly.Ruby.valueToCode(e,"A",n)||"1",o=Blockly.Ruby.valueToCode(e,"B",n)||"1",[""+t+" % "+o,n]},Blockly.Blocks.operators_round={init:function(){return this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_ROUND"),["A",["Number"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.operators_round=function(e){var t,o;return o=Blockly.Ruby.ORDER_FUNCTION_CALL,t=Blockly.Ruby.valueToCode(e,"A",o)||"0",[""+t+".round",o]},Blockly.Blocks.operators_math_method={init:function(){var e;return e=[[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_ABS"),"%num%.abs"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_FLOOR"),"%num%.floor"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_CEIL"),"%num%.ceil"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_SQRT"),"Math.sqrt(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_SIN"),"Math.sin(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_COS"),"Math.cos(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_TAN"),"Math.tan(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_ASIN"),"Math.asin(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_ACOS"),"Math.acos(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_ATAN"),"Math.atan(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_LN"),"Math.log(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_LOG"),"Math.log10(%num%)"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_E_SQUARE"),"Math::E ** %num%"],[Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD_10_SQUARE"),"10 ** %num%"]],this.setHelpUrl(""),this.setColour(100),this.interpolateMsg(Smalruby.bm("BLOCKS_OPERATORS_MATH_METHOD"),["NUM",["Number"],Blockly.ALIGN_RIGHT],["METHOD",["Dropdown",e],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.operators_math_method=function(e){var t,o,n;return n=Blockly.Ruby.ORDER_FUNCTION_CALL,t=this.getFieldValue("METHOD"),o=Blockly.Ruby.valueToCode(e,"NUM",n)||"0",[t.replace(/%num%/,o),n]},Blockly.Blocks.operators_true={init:function(){return this.setHelpUrl(""),this.setColour(100),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_OPERATORS_TRUE")),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_true=function(){return["true",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.operators_false={init:function(){return this.setHelpUrl(""),this.setColour(100),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_OPERATORS_FALSE")),this.setInputsInline(!0),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.operators_false=function(){return["false",Blockly.Ruby.ORDER_ATOMIC]}}.call(this),function(){Blockly.Blocks.pen_down_pen={init:function(){return this.setHelpUrl(""),this.setColour(160),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_PEN_DOWN_PEN")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.pen_down_pen=function(){return Blockly.Ruby.characterMethodCall_("down_pen")},Blockly.Blocks.pen_up_pen={init:function(){return this.setHelpUrl(""),this.setColour(160),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_PEN_UP_PEN")),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.pen_up_pen=function(){return Blockly.Ruby.characterMethodCall_("up_pen")},Blockly.Blocks.pen_set_pen_color={init:function(){return this.setHelpUrl(""),this.setColour(160),this.interpolateMsg(Smalruby.bm("BLOCKS_PEN_SET_PEN_COLOR"),["COLOUR",["Colour","#ff0000"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.pen_set_pen_color=function(){var e,t,o,n;return t=this.getFieldValue("COLOUR"),n=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),e=parseInt(t.slice(5,7),16),Blockly.Ruby.characterSetVariable_("pen_color","["+n+", "+o+", "+e+"]")}}.call(this),function(){Blockly.Blocks.ruby_statement={init:function(){return this.setHelpUrl(""),this.setColour(340),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_RUBY_STATEMENT")).appendField(new Blockly.FieldTextInput(""),"STATEMENT"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.ruby_statement=function(){var e;return e=this.getFieldValue("STATEMENT"),""+e+"\n"},Blockly.Blocks.ruby_expression={init:function(){return this.setHelpUrl(""),this.setColour(340),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_RUBY_EXPRESSION")).appendField(new Blockly.FieldTextInput(""),"EXP"),this.setOutput(!0,null),this.setTooltip("")}},Blockly.Ruby.ruby_expression=function(){var e;return e=this.getFieldValue("EXP"),["("+e+")",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.ruby_comment={init:function(){return this.setHelpUrl(""),this.setColour(340),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_RUBY_COMMENT")).appendField(new Blockly.FieldTextInput(""),"COMMENT"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.ruby_comment=function(){var e;return e=this.getFieldValue("COMMENT"),"# "+e+"\n"},Blockly.Blocks.ruby_p={init:function(){return this.setHelpUrl(""),this.setColour(340),this.interpolateMsg("p %1",["ARG",null,Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.ruby_p=function(){var e;return e=Blockly.Ruby.valueToCode(this,"ARG",Blockly.Ruby.ORDER_NONE)||'""',"p("+e+")\n"}}.call(this),function(){$(document).ready(function(){return window.SmalrubyEditor.Sensing={KeyDropdown:[[Smalruby.bm("BLOCKS_SENSING_K_UP"),"K_UP"],[Smalruby.bm("BLOCKS_SENSING_K_DOWN"),"K_DOWN"],[Smalruby.bm("BLOCKS_SENSING_K_LEFT"),"K_LEFT"],[Smalruby.bm("BLOCKS_SENSING_K_RIGHT"),"K_RIGHT"],[Smalruby.bm("BLOCKS_SENSING_K_SPACE"),"K_SPACE"],["a","K_A"],["b","K_B"],["c","K_C"],["d","K_D"],["e","K_E"],["f","K_F"],["g","K_G"],["h","K_H"],["i","K_I"],["j","K_J"],["k","K_K"],["l","K_L"],["m","K_M"],["n","K_N"],["o","K_O"],["p","K_P"],["q","K_Q"],["r","K_R"],["s","K_S"],["t","K_T"],["u","K_U"],["v","K_V"],["w","K_W"],["x","K_X"],["y","K_Y"],["z","K_Z"],["0","K_0"],["1","K_1"],["2","K_2"],["3","K_3"],["4","K_4"],["5","K_5"],["6","K_6"],["7","K_7"],["8","K_8"],["9","K_9"]],PushOrDownDropdown:[[Smalruby.bm("BLOCKS_SENSING_PUSH"),"push"],[Smalruby.bm("BLOCKS_SENSING_HOLD_DOWN"),"down"]],MouseButtonDropdown:[[Smalruby.bm("BLOCKS_SENSING_M_LBUTTON"),"M_LBUTTON"],[Smalruby.bm("BLOCKS_SENSING_M_MBUTTON"),"M_MBUTTON"],[Smalruby.bm("BLOCKS_SENSING_M_RBUTTON"),"M_RBUTTON"]],DownOrUpDropdown:[[Smalruby.bm("BLOCKS_SENSING_DOWN"),"down"],[Smalruby.bm("BLOCKS_SENSING_UP"),"up"]],PressedOrReleasedDropdown:[[Smalruby.bm("BLOCKS_SENSING_PRESSED"),"pressed"],[Smalruby.bm("BLOCKS_SENSING_RELEASED"),"released"]]}}),Blockly.Blocks.sensing_reach_wall={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_SENSING_REACH_WALL")),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.sensing_reach_wall=function(){return Blockly.Ruby.characterMethodCallInput_("reach_wall?")},Blockly.Blocks.motion_reach_wall=Blockly.Blocks.sensing_reach_wall,Blockly.Ruby.motion_reach_wall=Blockly.Ruby.sensing_reach_wall,Blockly.Blocks.sensing_input_key_push_or_down={init:function(){var e,t;return e=window.SmalrubyEditor.Sensing.KeyDropdown,t=window.SmalrubyEditor.Sensing.PushOrDownDropdown,this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_PREFIX")).appendField(new Blockly.FieldDropdown(e),"KEY").appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_MIDDLE")).appendField(new Blockly.FieldDropdown(t),"POD").appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_SUFFIX")),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.sensing_input_key_push_or_down=function(){var e,t;return e=this.getFieldValue("KEY"),t=this.getFieldValue("POD"),["Input.key_"+t+"?("+e+")",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sensing_input_mouse_push_or_down={init:function(){var e,t;return e=window.SmalrubyEditor.Sensing.MouseButtonDropdown,t=window.SmalrubyEditor.Sensing.PushOrDownDropdown,this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_MOUSE_PUSH_OR_DOWN_PREFIX")).appendField(new Blockly.FieldDropdown(e),"MOUSE_BUTTON").appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_MOUSE_PUSH_OR_DOWN_MIDDLE")).appendField(new Blockly.FieldDropdown(t),"POD").appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_MOUSE_PUSH_OR_DOWN_SUFFIX")),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.sensing_input_mouse_push_or_down=function(){var e,t;return e=this.getFieldValue("MOUSE_BUTTON"),t=this.getFieldValue("POD"),["Input.mouse_"+t+"?("+e+")",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sensing_input_mouse_pos_x={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_MOUSE_POS_X")),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.sensing_input_mouse_pos_x=function(){return["Input.mouse_pos_x",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sensing_input_mouse_pos_y={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_SENSING_INPUT_MOUSE_POS_Y")),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.sensing_input_mouse_pos_y=function(){return["Input.mouse_pos_y",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sensing_hit={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_SENSING_HIT_PREFIX")).appendField(new Smalruby.FieldCharacter,"CHAR").appendField(Smalruby.bm("BLOCKS_SENSING_HIT_SUFFIX")),this.setOutput(!0,"Boolean"),this.setTooltip("")}},Blockly.Ruby.sensing_hit=function(){var e;return e=this.getCharacterFieldValue(),Blockly.Ruby.characterMethodCallInput_("hit?",e)},Blockly.Blocks.sensing_ask={init:function(){return this.setHelpUrl(""),this.setColour(190),this.interpolateMsg("%1と聞いて待つ",["TEXT",["String"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.sensing_ask=function(){var e;return e=Blockly.Ruby.valueToCode(this,"TEXT",Blockly.Ruby.ORDER_NONE)||'""',"ask("+e+")\n"},Blockly.Blocks.sensing_answer={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField("答え"),this.setOutput(!0,"String"),this.setTooltip("")}},Blockly.Ruby.sensing_answer=function(){return["answer",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sensing_timer_count={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField("タイマー"),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.sensing_timer_count=function(){return["timer.count",Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sensing_timer_reset={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField("タイマーをリセット"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.sensing_timer_reset=function(){return"timer.reset\n"},Blockly.Blocks.sensing_character_property={init:function(){var e;return e=[[Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_X"),"x"],[Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_Y"),"y"],[Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_ANGLE"),"angle"],[Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_COSTUME_INDEX"),"costume_index"],[Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_COSTUME"),"costume"],[Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_SCALE"),"scale"],[Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_VOLUME"),"volume"]],this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(new Smalruby.FieldCharacter,"CHAR").appendField(Smalruby.bm("BLOCKS_SENSING_CHARACTER_PROPERTY_MIDDLE")).appendField(new Blockly.FieldDropdown(e),"PROPERTY"),this.setOutput(!0,["Number","String"]),this.setTooltip("")}},Blockly.Ruby.sensing_character_property=function(){var e,t,o;return t=this.getCharacterFieldValue(),o=this.getFieldValue("PROPERTY"),e=Smalruby.Collections.CharacterSet.findWhere({name:t}),Blockly.Ruby.characterMethodCallInput_(o,null,{object:e})},Blockly.Blocks.sensing_time_now={init:function(){var e;return e=[[Smalruby.bm("BLOCKS_SENSING_TIME_NOW_YEAR"),"year"],[Smalruby.bm("BLOCKS_SENSING_TIME_NOW_MONTH"),"month"],[Smalruby.bm("BLOCKS_SENSING_TIME_NOW_DAY"),"day"],[Smalruby.bm("BLOCKS_SENSING_TIME_NOW_WDAY"),"wday"],[Smalruby.bm("BLOCKS_SENSING_TIME_NOW_HOUR"),"hour"],[Smalruby.bm("BLOCKS_SENSING_TIME_NOW_MIN"),"min"],[Smalruby.bm("BLOCKS_SENSING_TIME_NOW_SEC"),"sec"]],this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField(Smalruby.bm("BLOCKS_SENSING_TIME_NOW")).appendField(new Blockly.FieldDropdown(e),"METHOD"),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.sensing_time_now=function(){var e;return e=this.getFieldValue("METHOD"),["Time.now."+e,Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sensing_days_since_2000={init:function(){return this.setHelpUrl(""),this.setColour(190),this.appendDummyInput().appendField("2000年からの日数"),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.sensing_days_since_2000=function(){return["(Time.now - Time.mktime(2000, 1, 1)).to_i / 1.day",Blockly.Ruby.ORDER_ATOMIC]}}.call(this),function(){Blockly.Blocks.sound_preset_sounds={init:function(){var e;return e=[[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_DO"),"piano_do.wav"],[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_RE"),"piano_re.wav"],[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_MI"),"piano_mi.wav"],[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_FA"),"piano_fa.wav"],[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_SO"),"piano_so.wav"],[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_RA"),"piano_ra.wav"],[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_SI"),"piano_si.wav"],[Smalruby.bm("BLOCKS_SOUND_PRESET_SOUNDS_PIANO_DO_2"),"piano_do_2.wav"]],this.setHelpUrl(""),this.setColour(300),this.appendDummyInput().appendField(new Blockly.FieldDropdown(e),"NAME"),this.setOutput(!0,"String"),this.setTooltip("")}},Blockly.Ruby.sound_preset_sounds=function(){var e;return e=Blockly.Ruby.quote_(this.getFieldValue("NAME")),[e,Blockly.Ruby.ORDER_ATOMIC]},Blockly.Blocks.sound_play={init:function(){return this.setHelpUrl(""),this.setColour(300),this.interpolateMsg(Smalruby.bm("BLOCKS_SOUND_PLAY"),["NAME",["String"],Blockly.ALIGN_RIGHT],Blockly.ALIGN_RIGHT),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.sound_play=function(){var e;return e=Blockly.Ruby.valueToCode(this,"NAME",Blockly.Ruby.ORDER_NONE)||"",Blockly.Ruby.characterMethodCall_("play","name: "+e)},Blockly.Blocks.sound_stop={init:function(){return this.setHelpUrl(""),this.setColour(300),this.appendDummyInput().appendField("すべての音を止める"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip("")}},Blockly.Ruby.sound_stop=function(){return"stop\n"},Blockly.Blocks.sound_volume={init:function(){return this.setHelpUrl(""),this.setColour(300),this.appendDummyInput().appendField("ボリューム"),this.setOutput(!0,"Number"),this.setTooltip("")}},Blockly.Ruby.sound_volume=function(){return["volume",Blockly.Ruby.ORDER_ATOMIC]}}.call(this);