4 |
(function(e){"use strict";function t(t,n){this.$element=e(t),e.ime.defaults.languages=d(e.ime.languages),this.options=e.extend({},e.ime.defaults,n),this.active=!1,this.shifted=!1,this.inputmethod=null,this.language=null,this.context="",this.selector=this.$element.imeselector(this.options),this.listen()}function n(e){window.console&&window.console.log&&window.console.log(e)}function i(e){var t,n,i,r,s,a,u=e.get(0),c=0,l=0;return e.is("[contenteditable]")?o(u):("number"==typeof u.selectionStart&&"number"==typeof u.selectionEnd?(c=u.selectionStart,l=u.selectionEnd):(n=document.selection.createRange(),n&&n.parentElement()===u&&(r=u.value.length,t=u.value.replace(/\r\n/g,"\n"),s=t.match(/\n/g),i=u.createTextRange(),i.moveToBookmark(n.getBookmark()),a=u.createTextRange(),a.collapse(!1),i.compareEndPoints("StartToEnd",a)>-1?c=l=s?r-s.length:r:(c=-i.moveStart("character",-r),l=i.compareEndPoints("EndToEnd",a)>-1?r:-i.moveEnd("character",-r)))),[c,l])}function r(e){var t;return"input"===e.nodeName.toLowerCase()?t=e.createTextRange():(t=document.body.createTextRange(),t.moveToElementText(e)),t}function s(e,t,n,i){var s,o,u,c,l,d,h,m=e.get(0);return e.is("[contenteditable]")?(d=a(e,{start:n,end:i}),s=rangy.getSelection(),l=s.getRangeAt(0),d[0]>0&&(t=(""+s).substring(0,d[0])+t),h=document.createTextNode(t),l.deleteContents(),l.insertNode(h),l.commonAncestorContainer.normalize(),n=i=n+t.length-d[0],a(e,{start:n,end:i}),void 0):("number"==typeof m.selectionStart&&"number"==typeof m.selectionEnd?(c=m.scrollTop,m.value=m.value.substring(0,n)+t+m.value.substring(i,m.value.length),m.scrollTop=c,m.selectionStart=m.selectionEnd=n+t.length):(s=r(m),o=m.value.length,u=m.value.match(/\n/g),u&&(o-=u.length),s.moveStart("character",n),s.moveEnd("character",i-o),s.text=t,s.collapse(!1),s.select()),void 0)}function o(e){function t(e,a){var u,c;if(e.nodeType===Node.TEXT_NODE)s||e!==a.startContainer||(i=n+a.startOffset,s=!0),s&&e===a.endContainer&&(r=n+a.endOffset,o=!0),n+=e.length;else for(c=e.childNodes.length,u=0;c>u&&(t(e.childNodes[u],a),!o);++u);}var n=0,i=0,r=0,s=!1,o=!1,a=rangy.getSelection();return a.rangeCount&&t(e,a.getRangeAt(0)),[i,r]}function a(e,t){var n,i=0,r=0,s=e[0];for(u(s,t),n=o(s);t.start!==n[0]&&(t.start-=1,!(0>t.start));)u(s,t),n=o(s),i+=1;for(;t.end!==n[1]&&(t.end+=1,u(s,t),n=o(s),r+=1,!(r>10)););return[i,r]}function u(e,t){function n(e){var u,c;if(3===e.nodeType)i=r+e.length,!o&&t.start>=r&&i>=t.start&&(s.setStart(e,t.start-r),o=!0),o&&t.end>=r&&i>=t.end&&(s.setEnd(e,t.end-r),a=!0),r=i;else for(u=0,c=e.childNodes.length;c>u;++u)if(n(e.childNodes[u]),a){rangy.getSelection().setSingleRange(s);break}}var i,r=0,s=rangy.createRange(),o=!1,a=!1;s.collapseToPoint(e,0),n(e)}function c(e,t){var n,i;for(n=e.length<t.length?e.length:t.length,i=0;n>i;i++)if(e.charCodeAt(i)!==t.charCodeAt(i))return i;return-1}function l(e,t,n){return 0===n?"":n>=t?e.substr(0,t):e.substr(t-n,n)}function d(t){return e.map(t,function(e,t){return t})}t.prototype={constructor:t,listen:function(){this.$element.on("keypress.ime",e.proxy(this.keypress,this)),this.$element.on("keyup.ime",e.proxy(this.keyup,this)),this.$element.on("keydown.ime",e.proxy(this.keydown,this)),this.$element.on("destroy.ime",e.proxy(this.destroy,this)),this.$element.on("enable.ime",e.proxy(this.enable,this)),this.$element.on("disable.ime",e.proxy(this.disable,this))},transliterate:function(t,n,i){var r,s,o,a,u,c;if(r=i?this.inputmethod.patterns_x||[]:this.inputmethod.patterns||[],this.shifted&&(r=(this.inputmethod.patterns_shift||[]).concat(r)),e.isFunction(r))return c=r.call(this,t,n),"string"==typeof c?{noop:t===c,output:c}:c;for(u=0;r.length>u;u++)if(o=r[u],s=RegExp(o[0]+"$"),a=o.slice(-1)[0],s.test(t)){if(3!==o.length)return{noop:!1,output:t.replace(s,a)};if(RegExp(o[1]+"$").test(n))return{noop:!1,output:t.replace(s,a)}}return{noop:!0,output:t}},keyup:function(e){16===e.which&&(this.shifted=!1)},keydown:function(e){16===e.which&&(this.shifted=!0)},keypress:function(e){var t,n,i,r,o,a,u,c=!1;return this.active?this.inputmethod?8===e.which?(this.context="",!0):((e.altKey||e.altGraphKey)&&(c=!0),32>e.which&&13!==e.which&&!c||e.ctrlKey||e.metaKey?(this.context="",!0):(t=String.fromCharCode(e.which),i=this.getCaretPosition(this.$element),n=i[0],r=i[1],a=this.lastNChars(this.$element.val()||this.$element.text(),n,this.inputmethod.maxKeyLength),a+=t,u=this.transliterate(a,this.context,c),this.context+=t,this.context.length>this.inputmethod.contextLength&&(this.context=this.context.substring(this.context.length-this.inputmethod.contextLength)),u.noop?!0:(o=this.firstDivergence(a,u.output),a=a.substring(o),u.output=u.output.substring(o),s(this.$element,u.output,n-a.length+1,r),e.stopPropagation(),!1))):!0:!0},isActive:function(){return this.active},disable:function(){this.active=!1,e.ime.preferences.setIM("system")},enable:function(){this.active=!0},toggle:function(){this.active=!this.active},destroy:function(){e("body").off(".ime"),this.$element.off(".ime").removeData("ime").removeData("imeselector")},getIM:function(){return this.inputmethod},setIM:function(t){this.inputmethod=e.ime.inputmethods[t],e.ime.preferences.setIM(t)},setLanguage:function(t){return e.ime.languages[t]?(this.language=t,e.ime.preferences.setLanguage(t),!0):(n("Language "+t+" is not known to jquery.ime."),!1)},getLanguage:function(){return this.language},load:function(t){var i,r=this,s=e.Deferred();return e.ime.inputmethods[t]?s.resolve():e.ime.sources[t]?(i=e.ime.sources[t].depends,i&&!e.ime.inputmethods[i]?(r.load(i).done(function(){r.load(t).done(function(){s.resolve()})}),s):(n("Loading "+t),s=e.ajax({url:r.options.imePath+e.ime.sources[t].source,dataType:"script",cache:!0}).done(function(){n(t+" loaded")}).fail(function(e,i,r){n("Error in loading inputmethod "+t+" Exception: "+r)}),s.promise())):s.reject()},getCaretPosition:function(e){return i(e)},setCaretPosition:function(e,t){return a(e,t)},firstDivergence:function(e,t){return c(e,t)},lastNChars:function(e,t,n){return l(e,t,n)}},e.fn.ime=function(n){return this.each(function(){var i,r=e(this),s="object"==typeof n&&n;r.prop("readonly")||r.prop("disabled")||r.hasClass("noime")||(i=r.data("ime"),i||(i=new t(this,s),r.data("ime",i)),"string"==typeof n&&i[n]())})},e.ime={},e.ime.inputmethods={},e.ime.sources={},e.ime.preferences={},e.ime.languages={};var h={contextLength:0,maxKeyLength:1};e.ime.register=function(t){e.ime.inputmethods[t.id]=e.extend({},h,t)},e.ime.defaults={imePath:"/intranet-tmpl/lib/jquery.ime/",languages:[],helpHandler:null}})(jQuery),function(e){"use strict";function t(n,i){this.$element=e(n),this.options=e.extend({},t.defaults,i),this.active=!1,this.$imeSetting=null,this.$menu=null,this.inputmethod=null,this.timer=null,this.init(),this.listen()}function n(){return e("<h3>").addClass("ime-lang-title").attr("data-i18n","jquery-ime-other-languages").text("Other languages")}function i(){return e("<ul>").addClass("ime-list")}function r(){return e("<h3>").addClass("ime-list-title autonym")}function s(){return e('<div class="ime-disable selectable-row">').append(e("<span>").attr({"class":"ime-disable-link","data-i18n":"jquery-ime-disable-text"}).addClass("ime-checked").text("System input method"),e("<span>").addClass("ime-disable-shortcut").text("CTRL+M"))}function o(e){return e.ctrlKey&&!e.altKey&&(77===e.which||13===e.which)}function a(){var e=document.createElement("p"),t=!1;if(e.addEventListener)e.addEventListener("DOMAttrModified",function(){t=!0},!1);else{if(!e.attachEvent)return!1;e.attachEvent("onDOMAttrModified",function(){t=!0})}return e.setAttribute("id","target"),t}var u,c;t.prototype={constructor:t,init:function(){this.prepareSelectorMenu(),this.position(),this.$imeSetting.hide()},prepareSelectorMenu:function(){this.$imeSetting=e(u),this.$menu=e('<div class="imeselector-menu" role="menu">'),this.$menu.append(r(),i(),s(),n()),this.prepareLanguageList(),this.$menu.append(this.helpLink()),e.i18n&&this.$menu.i18n(),this.$imeSetting.append(this.$menu),e("body").append(this.$imeSetting)},stopTimer:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.$imeSetting.stop(!0,!0)},resetTimer:function(){var e=this;this.stopTimer(),this.timer=setTimeout(function(){e.$imeSetting.animate({opacity:0,marginTop:"-20px"},500,function(){e.$imeSetting.hide(),e.$imeSetting.css("opacity",1),e.$imeSetting.css("margin-top",0)})},this.options.timeout)},focus:function(){e("div.imeselector").hide(),e("div.imeselector-menu").removeClass("ime-open"),this.$imeSetting.show(),this.resetTimer()},show:function(){return this.$menu.addClass("ime-open"),this.stopTimer(),this.$imeSetting.show(),!1},hide:function(){return this.$menu.removeClass("ime-open"),this.resetTimer(),!1},toggle:function(){this.$menu.hasClass("ime-open")?this.hide():this.show()},listen:function(){var t=this;t.$imeSetting.on("click.ime",function(n){var i=e(n.target);return i.hasClass("imeselector-toggle")&&t.toggle(),!1}),t.$element.on("blur.ime",function(){t.$imeSetting.hasClass("ime-onfocus")||(t.$imeSetting.hide(),t.hide())}),e("html").click(function(){t.hide()}),this.$menu.on("click",function(e){e.stopPropagation()}),t.$imeSetting.mouseenter(function(){t.stopTimer(),t.$imeSetting.addClass("ime-onfocus")}).mouseleave(function(){t.resetTimer(),t.$imeSetting.removeClass("ime-onfocus")}),t.$menu.on("click.ime","li",function(){return t.$element.focus(),!1}),t.$menu.on("click.ime","li.ime-im",function(){return t.selectIM(e(this).data("ime-inputmethod")),t.$element.trigger("setim.ime",e(this).data("ime-inputmethod")),!1}),t.$menu.on("click.ime","li.ime-lang",function(){var n=t.selectLanguage(e(this).attr("lang"));return t.$element.trigger("setim.ime",n),!1}),t.$menu.on("click.ime","div.ime-disable",function(){return t.disableIM(),!1}),t.$menu.on("click.ime",".ime-help-link",function(e){e.stopPropagation()}),t.$element.on("focus.ime",function(e){t.selectLanguage(t.decideLanguage()),t.focus(),e.stopPropagation()}),t.$element.attrchange(function(){t.$element.is(":hidden")&&t.$imeSetting.hide()}),t.$element.on("mouseup.ime",e.proxy(this.position,this)),t.$element.on("keydown.ime",e.proxy(this.keydown,this)),e(window).resize(function(){t.position()})},keydown:function(t){var n,i,r,s=e(t.target).data("ime");return this.focus(),o(t)?(s.isActive()?(this.disableIM(),this.$element.trigger("setim.ime","system")):null!==this.inputmethod?(this.selectIM(this.inputmethod.id),this.$element.trigger("setim.ime",this.inputmethod.id)):(r=this.decideLanguage(),this.selectLanguage(r),!s.isActive()&&e.ime.languages[r]&&(i=e.ime.preferences.getPreviousInputMethods(),i[0]?this.selectIM(i[0]):(n=e.ime.languages[r].inputmethods[0],this.selectIM(n)))),t.preventDefault(),t.stopPropagation(),!1):!0},position:function(){var t,n,i,r,s,o,a,u,c=this,l="rtl"===this.$element.css("direction"),d=e(window);this.focus(),r=this.$element.offset(),s=r.top+this.$element.outerHeight(),o=r.left,l||(o=r.left+this.$element.outerWidth()-this.$imeSetting.outerWidth()),a=d.height()+e(document).scrollTop()-s,this.$imeSetting.outerHeight()>a&&(s=r.top-this.$imeSetting.outerHeight(),n=this.$menu.outerHeight()+this.$imeSetting.outerHeight(),s>n&&this.$menu.addClass("ime-position-top").css("top",-n)),this.$element.parents().each(function(){return"fixed"===e(this).css("position")?(c.$imeSetting.css("position","fixed"),!1):void 0}),this.$imeSetting.css({top:s,left:o}),t=this.$menu.width(),u=o+t>d.width(),(t>o||l&&u)&&(l?u?(this.$menu.addClass("ime-right"),i=this.$imeSetting.outerWidth()-t):i=0:(this.$menu.addClass("ime-right"),i=r.left),this.$menu.css("left",i))},selectLanguage:function(t){var n,i,r;return t=t&&t.toLowerCase(),n=this.$element.data("ime"),i=e.ime.preferences.getIM(t),r=e.ime.languages[t],this.setMenuTitle(this.getAutonym(t)),r?n.getLanguage()===t?(n.inputmethod&&n.inputmethod.id!==i&&this.selectIM(e.ime.preferences.getIM(t)),e.ime.preferences.getIM(t)):(this.$menu.find("li.ime-lang").show(),this.$menu.find("li[lang="+t+"]").hide(),this.prepareInputMethods(t),this.hide(),n.setLanguage(t),this.inputmethod=null,this.selectIM(e.ime.preferences.getIM(t)),e.ime.preferences.getIM(t)):!1},getAutonym:function(t){return e.ime.languages[t]&&e.ime.languages[t].autonym},setMenuTitle:function(e){this.$menu.find(".ime-list-title").text(e)},decideLanguage:function(){return e.ime.preferences.getLanguage()?e.ime.preferences.getLanguage():this.$element.attr("lang")&&e.ime.languages[this.$element.attr("lang")]?this.$element.attr("lang"):e.ime.preferences.getDefaultLanguage()},selectIM:function(t){var n,i=this;if(t)return this.$menu.find(".ime-checked").removeClass("ime-checked"),this.$menu.find("li[data-ime-inputmethod="+t+"]").addClass("ime-checked"),n=this.$element.data("ime"),"system"===t?(this.disableIM(),void 0):(n.load(t).done(function(){i.inputmethod=e.ime.inputmethods[t],i.hide(),n.enable(),n.setIM(t),i.$imeSetting.find("a.ime-name").text(e.ime.sources[t].name),i.position(),e.ime.preferences.save()}),void 0)},disableIM:function(){this.$menu.find(".ime-checked").removeClass("ime-checked"),this.$menu.find("div.ime-disable").addClass("ime-checked"),this.$element.data("ime").disable(),this.$imeSetting.find("a.ime-name").text(""),this.hide(),this.position(),e.ime.preferences.save()},prepareLanguageList:function(){var t,n,i,r,s,o,a,u;n=e('<div class="ime-language-list-wrapper">'),i=e('<ul class="ime-language-list">'),r=e.isFunction(this.options.languages)?this.options.languages():this.options.languages;for(t in r)a=r[t],u=e.ime.languages[a],u&&(s=e("<a>").attr("href","#").text(this.getAutonym(a)).addClass("selectable-row-item autonym"),o=e('<li class="ime-lang selectable-row">').attr("lang",a),o.append(s),i.append(o));n.append(i),this.$menu.append(n),this.options.languageSelector&&this.$menu.append(this.options.languageSelector())},prepareInputMethods:function(t){var n=e.ime.languages[t],i=this.$menu.find(".ime-list"),r=this;i.empty(),e.each(n.inputmethods,function(t,n){var s,o,a,u;a=e.ime.sources[n],a&&(u=a.name,s=e("<a>").attr("href","#").text(u).addClass("selectable-row-item"),o=e("<li>").attr("data-ime-inputmethod",n).addClass("ime-im selectable-row").append('<span class="ime-im-check"></span>',s),r.options.helpHandler&&o.append(r.options.helpHandler.call(r,n)),i.append(o))})},helpLink:function(){return e('<div class="ime-help-link selectable-row">').append(e("<a>").text("Help").addClass("selectable-row-item").attr({href:"http://github.com/wikimedia/jquery.ime",target:"_blank","data-i18n":"jquery-ime-help"}))}},t.defaults={defaultLanguage:"en",timeout:2500},e.fn.imeselector=function(n){return this.each(function(){var i=e(this),r=i.data("imeselector");r||i.data("imeselector",r=new t(this,n)),"string"==typeof n&&r[n].call(i)})},e.fn.imeselector.Constructor=t,u='<div class="imeselector imeselector-toggle"><a class="ime-name imeselector-toggle" href="#"></a><b class="ime-setting-caret imeselector-toggle"></b></div>',c=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,e.fn.attrchange=function(e){if(c){var t;return t=new c(function(t){t.forEach(function(t){e.call(t.target,t.attributeName)})}),this.each(function(){t.observe(this,{subtree:!1,attributes:!0})})}return a()?this.on("DOMAttrModified",function(t){e.call(this,t.originalEvent.attrName)}):"onpropertychange"in document.body?this.on("propertychange",function(){e.call(this,window.event.propertyName)}):void 0}}(jQuery),function(e){"use strict";e.extend(e.ime.preferences,{registry:{isDirty:!1,language:null,previousLanguages:[],previousInputMethods:[],imes:{en:"system"}},setLanguage:function(t){t!==this.registry.language&&(this.registry.language=t,this.registry.isDirty=!0,this.registry.previousLanguages||(this.registry.previousLanguages=[]),-1===e.inArray(t,this.registry.previousLanguages)&&(this.registry.previousLanguages.unshift(t),this.registry.previousLanguages=this.registry.previousLanguages.slice(0,5)))},getLanguage:function(){return this.registry.language},getDefaultLanguage:function(){return"en"},getPreviousLanguages:function(){return this.registry.previousLanguages},getPreviousInputMethods:function(){return this.registry.previousInputMethods},setIM:function(e){this.registry.imes||(this.registry.imes={}),e!==this.registry.imes[this.registry.language]&&(this.registry.imes[this.getLanguage()]=e,this.registry.isDirty=!0,this.registry.previousInputMethods||(this.registry.previousInputMethods=[]),"system"!==e&&(this.registry.previousInputMethods.unshift(e),this.registry.previousInputMethods=this.registry.previousInputMethods.slice(0,5)))},getIM:function(e){return this.registry.imes||(this.registry.imes={}),this.registry.imes[e]||"system"},save:function(){},load:function(){}})}(jQuery),function(e){"use strict";e.extend(e.ime.sources,{"am-transliteration":{name:"ትራንስልተራትዖን",source:"rules/am/am-transliteration.js"},"ar-kbd":{name:"أرابيك",source:"rules/ar/ar-kbd.js"},"as-avro":{name:"অভ্ৰ",source:"rules/as/as-avro.js"},"as-bornona":{name:"বৰ্ণনা",source:"rules/as/as-bornona.js"},"as-inscript":{name:"ইনস্ক্ৰিপ্ট",source:"rules/as/as-inscript.js"},"as-inscript2":{name:"ইনস্ক্ৰিপ্ট ২",source:"rules/as/as-inscript2.js"},"as-phonetic":{name:"ফনেটিক",source:"rules/as/as-phonetic.js"},"as-transliteration":{name:"প্ৰতিৰূপান্তৰণ",source:"rules/as/as-transliteration.js"},"batak-qwerty":{name:"Batak QWERTY",source:"rules/bbc/batak-qwerty.js"},"be-kbd":{name:"Стандартная",source:"rules/be/be-kbd.js"},"be-latin":{name:"Łacinka",source:"rules/be/be-latin.js"},"be-transliteration":{name:"Транслітэрацыя",source:"rules/be/be-transliteration.js"},"ber-tfng":{name:"Tifinagh",source:"rules/ber/ber-tfng.js"},"bn-avro":{name:"অভ্র",source:"rules/bn/bn-avro.js"},"bn-inscript":{name:"ইনস্ক্ৰিপ্ট",source:"rules/bn/bn-inscript.js"},"bn-inscript2":{name:"ইনস্ক্ৰিপ্ট ২",source:"rules/bn/bn-inscript2.js"},"bn-nkb":{name:"ন্যাশনাল কিবোর্ড",source:"rules/bn/bn-nkb.js"},"bn-probhat":{name:"প্রভাত",source:"rules/bn/bn-probhat.js"},"bo-ewts":{name:"Tibetan EWTS",source:"rules/bo/bo-ewts.js"},"brx-inscript":{name:"इनस्क्रिप्ट",source:"rules/brx/brx-inscript.js"},"brx-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/brx/brx-inscript2.js"},"ckb-transliteration-arkbd":{name:"باشووری",source:"rules/ckb/ckb-transliteration-arkbd.js"},"ckb-transliteration-fakbd":{name:"ڕۆژھەڵاتی",source:"rules/ckb/ckb-transliteration-fakbd.js"},"ckb-transliteration-lakbd":{name:"لاتینی",source:"rules/ckb/ckb-transliteration-lakbd.js"},"cv-cyr-altgr":{name:"Чăвашла (AltGr)",source:"rules/cv/cv-cyr-altgr.js"},"cv-lat-altgr":{name:"Căvašla (AltGr)",source:"rules/cv/cv-lat-altgr.js"},"cv-cyr-numbers":{name:"Чăвашла (цифрилисем)",source:"rules/cv/cv-cyr-numbers.js"},"cyrl-palochka":{name:"Palochka",source:"rules/cyrl/cyrl-palochka.js"},"da-normforms":{name:"normalformer",source:"rules/da/da-normforms.js"},"doi-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/doi/doi-inscript2.js"},"eo-transliteration":{name:"transliterigo",source:"rules/eo/eo-transliteration.js"},"eo-h":{name:"Esperanto h",source:"rules/eo/eo-h.js"},"eo-h-f":{name:"Esperanto h fundamente",source:"rules/eo/eo-h-f.js"},"eo-plena":{name:"Esperanto plena",source:"rules/eo/eo-plena.js"},"eo-q":{name:"Esperanto q sistemo",source:"rules/eo/eo-q.js"},"eo-vi":{name:"Esperanto vi sistemo",source:"rules/eo/eo-vi.js"},"eo-x":{name:"Esperanto x sistemo",source:"rules/eo/eo-x.js"},"fa-kbd":{name:"فارسی",source:"rules/fa/fa-kbd.js"},"fo-normforms":{name:"Føroyskt",source:"rules/fo/fo-normforms.js"},"fi-transliteration":{name:"translitterointi",source:"rules/fi/fi-transliteration.js"},"lud-transliteration":{name:"lud",source:"rules/lud/lud-transliteration.js"},"hi-transliteration":{name:"लिप्यंतरण",source:"rules/hi/hi-transliteration.js"},"hi-inscript":{name:"इनस्क्रिप्ट",source:"rules/hi/hi-inscript.js"},"hi-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/hi/hi-inscript2.js"},"hi-phonetic":{name:"फोनेटिक",source:"rules/hi/hi-phonetic.js"},"is-normforms":{name:"Venjuleg eyðublöð",source:"rules/is/is-normforms.js"},"jv-transliteration":{name:"Transliteration",source:"rules/jv/jv-transliteration.js"},"mai-inscript":{name:"इनस्क्रिप्ट",source:"rules/mai/mai-inscript.js",depends:"hi-inscript"},"mai-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/mai/mai-inscript2.js",depends:"hi-inscript2"},"hi-bolnagri":{name:"बोलनागरी",source:"rules/hi/hi-bolnagri.js"},"ml-transliteration":{name:"ലിപ്യന്തരണം",source:"rules/ml/ml-transliteration.js"},"ml-inscript":{name:"ഇൻസ്ക്രിപ്റ്റ്",source:"rules/ml/ml-inscript.js"},"ml-inscript2":{name:"ഇൻസ്ക്രിപ്റ്റ് 2",source:"rules/ml/ml-inscript2.js"},"sv-normforms":{name:"Normal forms",source:"rules/sv/sv-normforms.js"},"ta-inscript":{name:"இன்ஸ்கிரிப்ட்",source:"rules/ta/ta-inscript.js"},"ta-inscript2":{name:"இன்ஸ்கிரிப்ட் 2",source:"rules/ta/ta-inscript2.js"},"ta-transliteration":{name:"எழுத்துப்பெயர்ப்பு",source:"rules/ta/ta-transliteration.js"},"ta-99":{name:"தமிழ்99",source:"rules/ta/ta-99.js"},"ta-bamini":{name:"பாமினி",source:"rules/ta/ta-bamini.js"},"th-kedmanee":{name:"เกษมณี",source:"rules/th/th-kedmanee.js"},"th-pattachote":{name:"ปัตตะโชติ",source:"rules/th/th-pattachote.js"},"de-transliteration":{name:"Deutsch Tilde",source:"rules/de/de-transliteration.js"},"el-kbd":{name:"Τυπική πληκτρολόγιο",source:"rules/el/el-kbd.js"},"he-standard-2012":{name:"עברית עם ניקוד על בסיס אנגלית",source:"rules/he/he-standard-2012.js"},"he-standard-2012-extonly":{name:"עברית עם ניקוד",source:"rules/he/he-standard-2012-extonly.js"},"hr-kbd":{name:"Croatian kbd",source:"rules/hr/hr-kbd.js"},"hy-ephonetic":{name:"Հնչյունային դասավորություն",source:"rules/hy/hy-ephonetic.js"},"hy-typewriter":{name:"Գրամեքենայի դասավորություն",source:"rules/hy/hy-typewriter.js"},"hy-ephoneticalt":{name:"Հնչյունային նոր (R→Ր, F→Թ)",source:"rules/hy/hy-ephoneticalt.js"},"hy-emslegacy":{name:"Մայքրոսոֆթի հին արևելահայերեն",source:"rules/hy/hy-emslegacy.js"},"hy-wmslegacy":{name:"Մայքրոսոֆթի հին արևմտահայերեն",source:"rules/hy/hy-wmslegacy.js"},"gu-inscript":{name:"ઇનસ્ક્રિપ્ટ",source:"rules/gu/gu-inscript.js"},"gu-inscript2":{name:"ઇનસ્ક્રિપ્ટ ૨",source:"rules/gu/gu-inscript2.js"},"gu-phonetic":{name:"ફોનૅટિક",source:"rules/gu/gu-phonetic.js"},"gu-transliteration":{name:"લિપ્યાંતરણ",source:"rules/gu/gu-transliteration.js"},"ka-transliteration":{name:"ტრანსლიტერაცია",source:"rules/ka/ka-transliteration.js"},"ka-kbd":{name:"სტანდარტული კლავიატურის",source:"rules/ka/ka-kbd.js"},"kk-arabic":{name:"Kazakh Arabic transliteration",source:"rules/kk/kk-arabic.js"},"kk-kbd":{name:"Кирил",source:"rules/kk/kk-kbd.js"},"kn-inscript":{name:"ಇನ್ಸ್ಕ್ರಿಪ್ಟ್",source:"rules/kn/kn-inscript.js"},"kn-inscript2":{name:"ಇನ್ಸ್ಕ್ರಿಪ್ಟ್ ೨",source:"rules/kn/kn-inscript2.js"},"kn-transliteration":{name:"ಲಿಪ್ಯಂತರಣ",source:"rules/kn/kn-transliteration.js"},"kn-kgp":{name:"KGP/Nudi/KP Rao",source:"rules/kn/kn-kgp.js"},"ky-cyrl-alt":{name:"Кыргыз Alt",source:"rules/ky/ky-cyrl-alt.js"},"gom-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/gom/gom-inscript2.js"},"ks-inscript":{name:"इनस्क्रिप्ट",source:"rules/ks/ks-inscript.js"},"ks-kbd":{name:"Kashmiri Arabic",source:"rules/ks/ks-kbd.js"},"ku-h":{name:"Kurdî-h",source:"rules/ku/ku-h.js"},"ku-tr":{name:"Kurdî-tr",source:"rules/ku/ku-tr.js"},"lo-kbd":{name:"າຶກ",source:"rules/lo/lo-kbd.js"},mh:{name:"Kajin M̧ajeļ",source:"rules/mh/mh.js"},"mn-cyrl":{name:"Кирилл",source:"rules/mn/mn-cyrl.js"},"mni-inscript2":{name:"ইনস্ক্ৰিপ্ট ২",source:"rules/mni/mni-inscript2.js"},"mr-inscript":{name:"मराठी लिपी",source:"rules/mr/mr-inscript.js"},"mr-inscript2":{name:"मराठी इनस्क्रिप्ट २",source:"rules/mr/mr-inscript2.js"},"mr-transliteration":{name:"अक्षरांतरण",source:"rules/mr/mr-transliteration.js"},"mr-phonetic":{name:"फोनेटिक",source:"rules/mr/mr-phonetic.js"},"my-xkb":{name:"မြန်မာဘာသာ xkb",source:"rules/my/my-xkb.js"},"ne-inscript":{name:"इनस्क्रिप्ट",source:"rules/ne/ne-inscript.js"},"ne-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/ne/ne-inscript2.js"},"ne-transliteration":{name:"ट्रांस्लितेरेशन",source:"rules/ne/ne-transliteration.js"},"ne-rom":{name:"Romanized",source:"rules/ne/ne-rom.js"},"ne-trad":{name:"Traditional",source:"rules/ne/ne-trad.js"},"nb-normforms":{name:"Normal transliterasjon",source:"rules/nb/nb-normforms.js"},"nb-tildeforms":{name:"Tildemerket transliterasjon",source:"rules/nb/nb-tildeforms.js"},"nn-tildeforms":{name:"Tildemerkt transliterasjon",source:"rules/nb/nb-tildeforms.js"},"or-transliteration":{name:"ଟ୍ରାନ୍ସଲିଟରେସନ",source:"rules/or/or-transliteration.js"},"or-inscript":{name:"ଇନସ୍କ୍ରିପ୍ଟ",source:"rules/or/or-inscript.js"},"or-inscript2":{name:"ଇନସ୍କ୍ରିପ୍ଟ2",source:"rules/or/or-inscript2.js"},"or-lekhani":{name:"ଲେଖନୀ",source:"rules/or/or-lekhani.js"},"or-phonetic":{name:"ଫୋନେଟିକ",source:"rules/or/or-phonetic.js"},"sd-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/sd/sd-inscript2.js"},"se-normforms":{name:"Normal forms",source:"rules/se/se-normforms.js"},"sk-kbd":{name:"Štandardná",source:"rules/sk/sk-kbd.js"},"sr-kbd":{name:"Стандардна",source:"rules/sr/sr-kbd.js"},"te-inscript":{name:"ఇన్స్క్రిప్ట్",source:"rules/te/te-inscript.js"},"te-inscript2":{name:"ఇన్స్క్రిప్ట్ 2",source:"rules/te/te-inscript2.js"},"te-transliteration":{name:"లిప్యంతరీకరణ",source:"rules/te/te-transliteration.js"},"pa-inscript":{name:"ਇਨਸ੍ਕ੍ਰਿਪ੍ਟ",source:"rules/pa/pa-inscript.js"},"pa-inscript2":{name:"ਇਨਸ੍ਕ੍ਰਿਪ੍ਟ2",source:"rules/pa/pa-inscript2.js"},"pa-jhelum":{name:"ਜੇਹਲਮ",source:"rules/pa/pa-jhelum.js"},"pa-transliteration":{name:"ਤ੍ਰਾਨ੍ਸ੍ਲਿਤੇਰਾਤਿਓਂ",source:"rules/pa/pa-transliteration.js"},"pa-phonetic":{name:"ਫੋਨੇਟਿਕ",source:"rules/pa/pa-phonetic.js"},"ru-jcuken":{name:"ЙЦУКЕН",source:"rules/ru/ru-jcuken.js"},"ru-kbd":{name:"кбд",source:"rules/ru/ru-kbd.js"},"ru-phonetic":{name:"фонетический",source:"rules/ru/ru-phonetic.js"},"ru-yawerty":{name:"yawerty",source:"rules/ru/ru-yawerty.js"},"sa-iast":{name:"Romanized",source:"rules/sa/sa-iast.js"},"sa-inscript":{name:"इनस्क्रिप्ट",source:"rules/sa/sa-inscript.js"},"sa-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/sa/sa-inscript2.js"},"sa-transliteration":{name:"ट्रन्स्लितेरतिओन्",source:"rules/sa/sa-transliteration.js"},"sah-transliteration":{name:"Transliteration",source:"rules/sah/sah-transliteration.js"},"sat-inscript2":{name:"इनस्क्रिप्ट २",source:"rules/sat/sat-inscript2.js"},"si-singlish":{name:"සිංග්ලිෂ්",source:"rules/si/si-singlish.js"},"si-wijesekara":{name:"විජේසේකර",source:"rules/si/si-wijesekara.js"},"ur-phonetic":{name:"صوتی",source:"rules/ur/ur-phonetic.js"},"ur-transliteration":{name:"ٹرانسلٹریشن",source:"rules/ur/ur-transliteration.js"},"ipa-sil":{name:"International Phonetic Alphabet - SIL",source:"rules/fonipa/ipa-sil.js"},"ipa-x-sampa":{name:"International Phonetic Alphabet - X-SAMPA",source:"rules/fonipa/ipa-x-sampa.js"},"udm-alt":{name:"Удмурт ALT",source:"rules/udm/udm-alt.js"},"uk-kbd":{name:"кбд",source:"rules/uk/uk-kbd.js"},"ug-kbd":{name:"Uyghur kbd",source:"rules/ug/ug-kbd.js"},"uz-kbd":{name:"Uzbek kbd",source:"rules/uz/uz-kbd.js"},"vec-GVU":{name:"Venetian",source:"rules/vec/vec-GVU.js"}}),e.extend(e.ime.languages,{ady:{autonym:"адыгэбзэ",inputmethods:["cyrl-palochka"]},ahr:{autonym:"अहिराणी",inputmethods:["mr-transliteration","mr-inscript"]},am:{autonym:"አማርኛ",inputmethods:["am-transliteration"]},ar:{autonym:"العربية",inputmethods:["ar-kbd"]},as:{autonym:"অসমীয়া",inputmethods:["as-transliteration","as-avro","as-bornona","as-inscript","as-phonetic","as-inscript2"]},av:{autonym:"авар",inputmethods:["cyrl-palochka"]},bbc:{autonym:"Batak",inputmethods:["batak-qwerty"]},be:{autonym:"беларуская",inputmethods:["be-transliteration","be-latin","be-kbd"]},"be-tarask":{autonym:"беларуская (тарашкевіца)",inputmethods:["be-transliteration","be-latin"]},bh:{autonym:"भोजपुरी",inputmethods:["hi-transliteration"]},bho:{autonym:"भोजपुरी",inputmethods:["hi-transliteration"]},bn:{autonym:"বাংলা",inputmethods:["bn-avro","bn-inscript","bn-nkb","bn-probhat","bn-inscript2"]},bo:{autonym:"བོད་ཡིག།",inputmethods:["bo-ewts"]},brx:{autonym:"बोड़ो",inputmethods:["brx-inscript","brx-inscript2"]},ckb:{autonym:"کوردی",inputmethods:["ckb-transliteration-arkbd","ckb-transliteration-fakbd","ckb-transliteration-lakbd"]},ce:{autonym:"нохчийн",inputmethods:["cyrl-palochka"]},cv:{autonym:"Чăвашла",inputmethods:["cv-cyr-altgr","cv-lat-altgr","cv-cyr-numbers"]},da:{autonym:"Dansk",inputmethods:["da-normforms"]},de:{autonym:"Deutsch",inputmethods:["de-transliteration"]},diq:{autonym:"Kirdkî",inputmethods:["ku-h","ku-tr"]},doi:{autonym:"डोगरी",inputmethods:["doi-inscript2"]},en:{autonym:"English",inputmethods:["ipa-sil","ipa-x-sampa"]},el:{autonym:"Ελληνικά",inputmethods:["el-kbd"]},eo:{autonym:"Esperanto",inputmethods:["eo-transliteration","eo-h","eo-h-f","eo-plena","eo-q","eo-vi","eo-x"]},fa:{autonym:"فارسی",inputmethods:["fa-kbd"]},fo:{autonym:"Føroyskt",inputmethods:["fo-normforms"]},fi:{autonym:"Suomi",inputmethods:["fi-transliteration"]},lud:{autonym:"lüüdi",inputmethods:["lud-transliteration"]},gom:{autonym:"कोंकणी",inputmethods:["hi-transliteration","hi-inscript","gom-inscript2"]},gu:{autonym:"ગુજરાતી",inputmethods:["gu-transliteration","gu-inscript","gu-inscript2","gu-phonetic"]},he:{autonym:"עברית",inputmethods:["he-standard-2012-extonly","he-standard-2012"]},hi:{autonym:"हिन्दी",inputmethods:["hi-transliteration","hi-inscript","hi-bolnagri","hi-phonetic","hi-inscript2"]},hr:{autonym:"Hrvatski",inputmethods:["hr-kbd"]},hy:{autonym:"հայերեն",inputmethods:["hy-ephonetic","hy-typewriter","hy-ephoneticalt","hy-emslegacy","hy-wmslegacy"]},hne:{autonym:"छत्तीसगढ़ी",inputmethods:["hi-transliteration"]},is:{autonym:"Íslenska",inputmethods:["is-normforms"]},fonipa:{autonym:"International Phonetic Alphabet",inputmethods:["ipa-sil","ipa-x-sampa"]},jv:{autonym:"ꦧꦱꦗꦮ",inputmethods:["jv-transliteration"]},ka:{autonym:"ქართული ენა",inputmethods:["ka-transliteration","ka-kbd"]},kbd:{autonym:"адыгэбзэ (къэбэрдеибзэ)",inputmethods:["cyrl-palochka"]},kk:{autonym:"Қазақша",inputmethods:["kk-kbd","kk-arabic"]},kn:{autonym:"ಕನ್ನಡ",inputmethods:["kn-transliteration","kn-inscript","kn-kgp","kn-inscript2"]},ks:{autonym:"कॉशुर / کٲشُر",inputmethods:["ks-inscript","ks-kbd"]},ky:{autonym:"Кыргыз",inputmethods:["ky-cyrl-alt"]},kab:{autonym:"ⵜⴰⵇⴱⴰⵢⵍⵉⵜ",inputmethods:["ber-tfng"]},ku:{autonym:"Kurdî",inputmethods:["ku-h","ku-tr"]},lbe:{autonym:"лакку",inputmethods:["cyrl-palochka"]},lez:{autonym:"лезги",inputmethods:["cyrl-palochka"]},lo:{autonym:"ລາວ",inputmethods:["lo-kbd"]},mai:{autonym:"मैथिली",inputmethods:["mai-inscript","mai-inscript2"]},mh:{autonym:"Kajin M̧ajeļ",inputmethods:["mh"]},ml:{autonym:"മലയാളം",inputmethods:["ml-transliteration","ml-inscript","ml-inscript2"]},mn:{autonym:"Монгол",inputmethods:["mn-cyrl"]},mni:{autonym:"Manipuri",inputmethods:["mni-inscript2"]},mr:{autonym:"मराठी",inputmethods:["mr-transliteration","mr-inscript2","mr-inscript","mr-phonetic"]},my:{autonym:"မြန်မာ",inputmethods:["my-xkb"]},ne:{autonym:"नेपाली",inputmethods:["ne-transliteration","ne-inscript2","ne-inscript","ne-rom","ne-trad"]},"new":{autonym:"नेपाल भाषा",inputmethods:["hi-transliteration","hi-inscript"]},nb:{autonym:"Norsk (bokmål)",inputmethods:["nb-normforms","nb-tildeforms"]},nn:{autonym:"Norsk (nynorsk)",inputmethods:["nb-normforms","nn-tildeforms"]},or:{autonym:"ଓଡ଼ିଆ",inputmethods:["or-phonetic","or-transliteration","or-inscript","or-inscript2","or-lekhani"]},pa:{autonym:"ਪੰਜਾਬੀ",inputmethods:["pa-transliteration","pa-inscript","pa-phonetic","pa-inscript2","pa-jhelum"]},rif:{autonym:"ⵜⴰⵔⵉⴼⵉⵜ",inputmethods:["ber-tfng"]},ru:{autonym:"русский",inputmethods:["ru-jcuken","ru-kbd","ru-phonetic","ru-yawerty"]},sah:{autonym:"саха тыла",inputmethods:["sah-transliteration"]},sa:{autonym:"संस्कृत",inputmethods:["sa-transliteration","sa-inscript2","sa-inscript","sa-iast"]},sat:{autonym:"संताली",inputmethods:["sat-inscript2"]},sd:{autonym:"सिंधी",inputmethods:["sd-inscript2"]},se:{autonym:"Davvisámegiella",inputmethods:["se-normforms"]},shi:{autonym:"ⵜⴰⵛⵍⵃⵉⵜ",inputmethods:["ber-tfng"]},si:{autonym:"සිංහල",inputmethods:["si-singlish","si-wijesekara"]},sk:{autonym:"Slovenčina",inputmethods:["sk-kbd"]},sr:{autonym:"Српски / srpski",inputmethods:["sr-kbd"]},sv:{autonym:"Svenska",inputmethods:["sv-normforms"]},ta:{autonym:"தமிழ்",inputmethods:["ta-transliteration","ta-99","ta-inscript","ta-bamini","ta-inscript2"]},tcy:{autonym:"ತುಳು",inputmethods:["kn-transliteration"]},te:{autonym:"తెలుగు",inputmethods:["te-transliteration","te-inscript","te-inscript2"]},th:{autonym:"ไทย",inputmethods:["th-kedmanee","th-pattachote"]},tkr:{autonym:"цӀаӀхна миз",inputmethods:["cyrl-palochka"]},tzm:{autonym:"ⵜⴰⵎⴰⵣⵉⵖⵜ",inputmethods:["ber-tfng"]},udm:{autonym:"удмурт",inputmethods:["udm-alt"]},uk:{autonym:"Українська",inputmethods:["uk-kbd"]},ug:{autonym:"ئۇيغۇرچە / Uyghurche",inputmethods:["ug-kbd"]},ur:{autonym:"اردو",inputmethods:["ur-transliteration","ur-phonetic"]},uz:{autonym:"Oʻzbekcha",inputmethods:["uz-kbd"]},vec:{autonym:"Venetian",inputmethods:["vec-GVU"]}}) |
5 |
}(jQuery),function(e){function t(e,t){var n=typeof e[t];return n==C||!(n!=R||!e[t])||"unknown"==n}function n(e,t){return!(typeof e[t]!=R||!e[t])}function i(e,t){return typeof e[t]!=b}function r(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}function s(e){return e&&S(e,w)&&O(e,E)}function o(e){return n(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(e){n(window,"console")&&t(window.console,"log")&&window.console.log(e)}function u(e,t){t?window.alert(e):a(e)}function c(e){x.initialized=!0,x.supported=!1,u("Rangy is not supported on this page in your browser. Reason: "+e,x.config.alertOnFail)}function l(e){u("Rangy warning: "+e,x.config.alertOnWarn)}function d(e){return e.message||e.description||e+""}function h(){if(!x.initialized){var e,n=!1,i=!1;t(document,"createRange")&&(e=document.createRange(),S(e,k)&&O(e,N)&&(n=!0),e.detach());var r=o(document);if(!r||"body"!=r.nodeName.toLowerCase())return c("No body element found"),void 0;if(r&&t(r,"createTextRange")&&(e=r.createTextRange(),s(e)&&(i=!0)),!n&&!i)return c("Neither Range nor TextRange are available"),void 0;x.initialized=!0,x.features={implementsDomRange:n,implementsTextRange:i};var u,l;for(var h in j)(u=j[h])instanceof f&&u.init(u,x);for(var m=0,p=D.length;p>m;++m)try{D[m](x)}catch(g){l="Rangy init listener threw an exception. Continuing. Detail: "+d(g),a(l)}}}function m(e){e=e||window,h();for(var t=0,n=A.length;n>t;++t)A[t](e)}function f(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function p(e,t,n,i){var r=new f(t,n,function(e){if(!e.initialized){e.initialized=!0;try{i(x,e),e.supported=!0}catch(n){var r="Module '"+t+"' failed to load: "+d(n);a(r)}}});j[t]=r}function g(){}function v(){}var y="function"==typeof e.define&&e.define.amd,R="object",C="function",b="undefined",N=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],k=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],E=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],w=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],S=r(t),T=r(n),O=r(i),j={},x={version:"1.3alpha.804",initialized:!1,supported:!0,util:{isHostMethod:t,isHostObject:n,isHostProperty:i,areHostMethods:S,areHostObjects:T,areHostProperties:O,isTextRange:s,getBody:o},features:{},modules:j,config:{alertOnFail:!0,alertOnWarn:!1,preferTextRange:!1}};x.fail=c,x.warn=l,{}.hasOwnProperty?x.util.extend=function(e,t,n){var i,r;for(var s in t)t.hasOwnProperty(s)&&(i=e[s],r=t[s],n&&null!==i&&"object"==typeof i&&null!==r&&"object"==typeof r&&x.util.extend(i,r,!0),e[s]=r);return e}:c("hasOwnProperty not supported"),function(){var e=document.createElement("div");e.appendChild(document.createElement("span"));var t,n=[].slice;try{1==n.call(e.childNodes,0)[0].nodeType&&(t=function(e){return n.call(e,0)})}catch(i){}t||(t=function(e){for(var t=[],n=0,i=e.length;i>n;++n)t[n]=e[n];return t}),x.util.toArray=t}();var _;t(document,"addEventListener")?_=function(e,t,n){e.addEventListener(t,n,!1)}:t(document,"attachEvent")?_=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),x.util.addListener=_;var D=[];x.init=h,x.addInitListener=function(e){x.initialized?e(x):D.push(e)};var A=[];x.addCreateMissingNativeApiListener=function(e){A.push(e)},x.createMissingNativeApi=m,f.prototype={init:function(){for(var e,t,n=this.dependencies||[],i=0,r=n.length;r>i;++i){if(t=n[i],e=j[t],!(e&&e instanceof f))throw Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,Error("Module '"+this.name+"' failed to load: "+e)},warn:function(e){x.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){x.warn("DEPRECATED: "+e+" in module "+this.name+"is deprecated. Please use "+t+" instead")},createError:function(e){return Error("Error in Rangy "+this.name+" module: "+e)}},x.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]),p(!1,e,n,t)},x.createCoreModule=function(e,t,n){p(!0,e,t,n)},x.RangePrototype=g,x.rangePrototype=new g,x.selectionPrototype=new v;var I=!1,M=function(){I||(I=!0,x.initialized||h())};return typeof window==b?(c("No window found"),void 0):typeof document==b?(c("No document found"),void 0):(t(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",M,!1),_(window,"load",M),y&&e.define(function(){return x.amd=!0,x}),e.rangy=x,void 0)}(this),rangy.createCoreModule("DomUtil",[],function(e,t){function n(e){var t;return typeof e.namespaceURI==j||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function i(e){var t=e.parentNode;return 1==t.nodeType?t:null}function r(e){for(var t=0;e=e.previousSibling;)++t;return t}function s(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function o(e,t){var n,i=[];for(n=e;n;n=n.parentNode)i.push(n);for(n=t;n;n=n.parentNode)if(A(i,n))return n;return null}function a(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function u(e,t){return a(e,t,!0)}function c(e,t,n){for(var i,r=n?e:e.parentNode;r;){if(i=r.parentNode,i===t)return r;r=i}return null}function l(e){var t=e.nodeType;return 3==t||4==t||8==t}function d(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function h(e,t){var n=t.nextSibling,i=t.parentNode;return n?i.insertBefore(e,n):i.appendChild(e),e}function m(e,t,n){var i=e.cloneNode(!1);if(i.deleteData(0,t),e.deleteData(t,e.length-t),h(i,e),n)for(var s,o=0;s=n[o++];)s.node==e&&s.offset>t?(s.node=i,s.offset-=t):s.node==e.parentNode&&s.offset>r(e)&&++s.offset;return i}function f(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=j)return e.ownerDocument;if(typeof e.document!=j)return e.document;if(e.parentNode)return f(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var n=f(e);if(typeof n.defaultView!=j)return n.defaultView;if(typeof n.parentWindow!=j)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function g(e){if(typeof e.contentDocument!=j)return e.contentDocument;if(typeof e.contentWindow!=j)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function v(e){if(typeof e.contentWindow!=j)return e.contentWindow;if(typeof e.contentDocument!=j)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function y(e){return e&&x.isHostMethod(e,"setTimeout")&&x.isHostObject(e,"document")}function R(e,t,n){var i;if(e?x.isHostProperty(e,"nodeType")?i=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?g(e):f(e):y(e)&&(i=e.document):i=document,!i)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return i}function C(e){for(var t;t=e.parentNode;)e=t;return e}function b(e,n,i,s){var a,u,l,d,h;if(e==i)return n===s?0:s>n?-1:1;if(a=c(i,e,!0))return r(a)>=n?-1:1;if(a=c(e,i,!0))return s>r(a)?-1:1;if(u=o(e,i),!u)throw Error("comparePoints error: nodes have no common ancestor");if(l=e===u?u:c(e,u,!0),d=i===u?u:c(i,u,!0),l===d)throw t.createError("comparePoints got to case 4 and childA and childB are the same!");for(h=u.firstChild;h;){if(h===l)return-1;if(h===d)return 1;h=h.nextSibling}}function N(e){try{return e.parentNode,!1}catch(t){return!0}}function k(e){if(!e)return"[No node]";if(I&&N(e))return"[Broken node]";if(l(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">["+r(e)+"]["+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function E(e){for(var t,n=f(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function w(e){this.root=e,this._next=e}function S(e){return new w(e)}function T(e,t){this.node=e,this.offset=t}function O(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var j="undefined",x=e.util;x.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),x.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var _=document.createElement("div");x.areHostMethods(_,["insertBefore","appendChild","cloneNode"]||!x.areHostObjects(_,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),x.isHostProperty(_,"innerHTML")||t.fail("Element is missing innerHTML property");var D=document.createTextNode("test");x.areHostMethods(D,["splitText","deleteData","insertData","appendData","cloneNode"]||!x.areHostObjects(_,["previousSibling","nextSibling","childNodes","parentNode"])||!x.areHostProperties(D,["data"]))||t.fail("Incomplete Text Node implementation");var A=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},I=!1;(function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="<br>",I=N(n),e.features.crashyTextNodes=I})();var M;typeof window.getComputedStyle!=j?M=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=j?M=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found"),w.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},T.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+k(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},O.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11},O.prototype.toString=function(){return this.message},e.dom={arrayContains:A,isHtmlNamespace:n,parentElement:i,getNodeIndex:r,getNodeLength:s,getCommonAncestor:o,isAncestorOf:a,isOrIsAncestorOf:u,getClosestAncestorIn:c,isCharacterDataNode:l,isTextOrCommentNode:d,insertAfter:h,splitDataNode:m,getDocument:f,getWindow:p,getIframeWindow:v,getIframeDocument:g,getBody:x.getBody,isWindow:y,getContentDocument:R,getRootContainer:C,comparePoints:b,isBrokenNode:N,inspectNode:k,getComputedStyleProperty:M,fragmentFromNodeChildren:E,createIterator:S,DomPosition:T},e.DOMException=O}),rangy.createCoreModule("DomRange",["DomUtil"],function(e){function t(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function n(e){return e.document||z(e.startContainer)}function i(e){return new L(e.parentNode,W(e))}function r(e){return new L(e.parentNode,W(e)+1)}function s(e,t,n){var i=11==e.nodeType?e.firstChild:e;return B(t)?n==t.length?P.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:q(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),i}function o(e,t,i){if(S(e),S(t),n(t)!=n(e))throw new H("WRONG_DOCUMENT_ERR");var r=U(e.startContainer,e.startOffset,t.endContainer,t.endOffset),s=U(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return i?0>=r&&s>=0:0>r&&s>0}function a(e){for(var t,i,r,s=n(e.range).createDocumentFragment();i=e.next();){if(t=e.isPartiallySelectedSubtree(),i=i.cloneNode(!t),t&&(r=e.getSubtreeIterator(),i.appendChild(a(r)),r.detach(!0)),10==i.nodeType)throw new H("HIERARCHY_REQUEST_ERR");s.appendChild(i)}return s}function u(e,t,n){var i,r;n=n||{stop:!1};for(var s,o;s=e.next();)if(e.isPartiallySelectedSubtree()){if(t(s)===!1)return n.stop=!0,void 0;if(o=e.getSubtreeIterator(),u(o,t,n),o.detach(!0),n.stop)return}else for(i=P.createIterator(s);r=i.next();)if(t(r)===!1)return n.stop=!0,void 0}function c(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),c(t),t.detach(!0)):e.remove()}function l(e){for(var t,i,r=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),i=e.getSubtreeIterator(),t.appendChild(l(i)),i.detach(!0)):e.remove(),10==t.nodeType)throw new H("HIERARCHY_REQUEST_ERR");r.appendChild(t)}return r}function d(e,t,n){var i,r=!(!t||!t.length),s=!!n;r&&(i=RegExp("^("+t.join("|")+")$"));var o=[];return u(new m(e,!1),function(t){if(!(r&&!i.test(t.nodeType)||s&&!n(t))){var a=e.startContainer;if(t!=a||!B(a)||e.startOffset!=a.length){var u=e.endContainer;t==u&&B(u)&&0==e.endOffset||o.push(t)}}}),o}function h(e){var t=e.getName===void 0?"Range":e.getName();return"["+t+"("+P.inspectNode(e.startContainer)+":"+e.startOffset+", "+P.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function m(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&B(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||B(this.sc)?V(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||B(this.ec)?V(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function f(e){this.code=this[e],this.codeName=e,this.message="RangeException: "+this.codeName}function p(e){return function(t,n){for(var i,r=n?t:t.parentNode;r;){if(i=r.nodeType,G(e,i))return r;r=r.parentNode}return null}}function g(e,t){if(rt(e,t))throw new f("INVALID_NODE_TYPE_ERR")}function v(e){if(!e.startContainer)throw new H("INVALID_STATE_ERR")}function y(e,t){if(!G(t,e.nodeType))throw new f("INVALID_NODE_TYPE_ERR")}function R(e,t){if(0>t||t>(B(e)?e.length:e.childNodes.length))throw new H("INDEX_SIZE_ERR")}function C(e,t){if(nt(e,!0)!==nt(t,!0))throw new H("WRONG_DOCUMENT_ERR")}function b(e){if(it(e,!0))throw new H("NO_MODIFICATION_ALLOWED_ERR")}function N(e,t){if(!e)throw new H(t)}function k(e){return Q&&P.isBrokenNode(e)||!G(Z,e.nodeType)&&!nt(e,!0)}function E(e,t){return(B(e)?e.length:e.childNodes.length)>=t}function w(e){return!!e.startContainer&&!!e.endContainer&&!k(e.startContainer)&&!k(e.endContainer)&&E(e.startContainer,e.startOffset)&&E(e.endContainer,e.endOffset)}function S(e){if(v(e),!w(e))throw Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}function T(e,t){S(e);var n=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=n===r;B(r)&&s>0&&r.length>s&&q(r,s,t),B(n)&&i>0&&n.length>i&&(n=q(n,i,t),o?(s-=i,r=n):r==n.parentNode&&s>=W(n)&&s++,i=0),e.setStartAndEnd(n,i,r,s)}function O(e){e.START_TO_START=lt,e.START_TO_END=dt,e.END_TO_END=ht,e.END_TO_START=mt,e.NODE_BEFORE=ft,e.NODE_AFTER=pt,e.NODE_BEFORE_AND_AFTER=gt,e.NODE_INSIDE=vt}function j(e){O(e),O(e.prototype)}function x(e,t){return function(){S(this);var n,i,s=this.startContainer,o=this.startOffset,a=this.commonAncestorContainer,c=new m(this,!0);s!==a&&(n=V(s,a,!0),i=r(n),s=i.node,o=i.offset),u(c,b),c.reset();var l=e(c);return c.detach(),t(this,s,o,s,o),l}}function _(n,s,o){function a(e,t){return function(n){v(this),y(n,X),y(Y(n),Z);var s=(e?i:r)(n);(t?u:d)(this,s.node,s.offset)}}function u(e,t,n){var i=e.endContainer,r=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((Y(t)!=Y(i)||1==U(t,n,i,r))&&(i=t,r=n),s(e,t,n,i,r))}function d(e,t,n){var i=e.startContainer,r=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((Y(t)!=Y(i)||-1==U(t,n,i,r))&&(i=t,r=n),s(e,i,r,t,n))}var h=function(){};h.prototype=e.rangePrototype,n.prototype=new h,$.extend(n.prototype,{setStart:function(e,t){v(this),g(e,!0),R(e,t),u(this,e,t)},setEnd:function(e,t){v(this),g(e,!0),R(e,t),d(this,e,t)},setStartAndEnd:function(){v(this);var e=arguments,t=e[0],n=e[1],i=t,r=n;switch(e.length){case 3:r=e[2];break;case 4:i=e[2],r=e[3]}s(this,t,n,i,r)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){S(this),e?s(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):s(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){v(this),g(e,!0),s(this,e,0,e,K(e))},selectNode:function(e){v(this),g(e,!1),y(e,X);var t=i(e),n=r(e);s(this,t.node,t.offset,n.node,n.offset)},extractContents:x(l,s),deleteContents:x(c,s),canSurroundContents:function(){S(this),b(this.startContainer),b(this.endContainer);var e=new m(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},detach:function(){o(this)},splitBoundaries:function(){T(this)},splitBoundariesPreservingPositions:function(e){T(this,e)},normalizeBoundaries:function(){S(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,i=this.endOffset,r=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(n=e,i=e.length,e.appendData(t.data),t.parentNode.removeChild(t))},o=function(r){var s=r.previousSibling;if(s&&s.nodeType==r.nodeType){e=r;var o=r.length;if(t=s.length,r.insertData(0,s.data),s.parentNode.removeChild(s),e==n)i+=t,n=e;else if(n==r.parentNode){var a=W(r);i==a?(n=r,i=o):i>a&&i--}}},a=!0;if(B(n))n.length==i&&r(n);else{if(i>0){var u=n.childNodes[i-1];u&&B(u)&&r(u)}a=!this.collapsed}if(a){if(B(e))0==t&&o(e);else if(e.childNodes.length>t){var c=e.childNodes[t];c&&B(c)&&o(c)}}else e=n,t=i;s(this,e,t,n,i)},collapseToPoint:function(e,t){v(this),g(e,!0),R(e,t),this.setStartAndEnd(e,t)}}),j(n)}function D(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:P.getCommonAncestor(e.startContainer,e.endContainer)}function A(e,t,n,i,r){e.startContainer=t,e.startOffset=n,e.endContainer=i,e.endOffset=r,e.document=P.getDocument(t),D(e)}function I(e){v(e),e.startContainer=e.startOffset=e.endContainer=e.endOffset=e.document=null,e.collapsed=e.commonAncestorContainer=null}function M(e){this.startContainer=e,this.startOffset=0,this.endContainer=e,this.endOffset=0,this.document=e,D(this)}var P=e.dom,$=e.util,L=P.DomPosition,H=e.DOMException,B=P.isCharacterDataNode,W=P.getNodeIndex,F=P.isOrIsAncestorOf,z=P.getDocument,U=P.comparePoints,q=P.splitDataNode,V=P.getClosestAncestorIn,K=P.getNodeLength,G=P.arrayContains,Y=P.getRootContainer,Q=e.features.crashyTextNodes;m.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,B(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!B(n)||n!==this.sc&&n!==this.ec?n.parentNode&&n.parentNode.removeChild(n):(e=n===this.sc?this.so:0,t=n===this.ec?this.eo:n.length,e!=t&&n.deleteData(e,t-e))},isPartiallySelectedSubtree:function(){var e=this._current;return t(e,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)e=this.range.cloneRange(),e.collapse(!1);else{e=new M(n(this.range));var t=this._current,i=t,r=0,s=t,o=K(t);F(t,this.sc)&&(i=this.sc,r=this.so),F(t,this.ec)&&(s=this.ec,o=this.eo),A(e,i,r,s,o)}return new m(e,this.clonePartiallySelectedTextNodes)},detach:function(e){e&&this.range.detach(),this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}},f.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2},f.prototype.toString=function(){return this.message};var X=[1,3,4,5,7,8,10],Z=[2,9,11],J=[5,6,10,12],et=[1,3,4,5,7,8,10,11],tt=[1,3,4,5,7,8],nt=p([9,11]),it=p(J),rt=p([6,10,12]),st=document.createElement("style"),ot=!1;try{st.innerHTML="<b>x</b>",ot=3==st.firstChild.nodeType}catch(at){}e.features.htmlParsingConforms=ot;var ut=ot?function(e){var t=this.startContainer,n=z(t);if(!t)throw new H("INVALID_STATE_ERR");var i=null;return 1==t.nodeType?i=t:B(t)&&(i=P.parentElement(t)),i=null===i||"HTML"==i.nodeName&&P.isHtmlNamespace(z(i).documentElement)&&P.isHtmlNamespace(i)?n.createElement("body"):i.cloneNode(!1),i.innerHTML=e,P.fragmentFromNodeChildren(i)}:function(e){v(this);var t=n(this),i=t.createElement("body");return i.innerHTML=e,P.fragmentFromNodeChildren(i)},ct=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],lt=0,dt=1,ht=2,mt=3,ft=0,pt=1,gt=2,vt=3;$.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){S(this),C(this.startContainer,t.startContainer);var n,i,r,s,o=e==mt||e==lt?"start":"end",a=e==dt||e==lt?"start":"end";return n=this[o+"Container"],i=this[o+"Offset"],r=t[a+"Container"],s=t[a+"Offset"],U(n,i,r,s)},insertNode:function(e){if(S(this),y(e,et),b(this.startContainer),F(e,this.startContainer))throw new H("HIERARCHY_REQUEST_ERR");var t=s(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){S(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&B(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var i=new m(this,!0);return e=a(i),i.detach(),e},canSurroundContents:function(){S(this),b(this.startContainer),b(this.endContainer);var e=new m(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(y(e,tt),!this.canSurroundContents())throw new f("BAD_BOUNDARYPOINTS_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);s(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){S(this);for(var e,t=new M(n(this)),i=ct.length;i--;)e=ct[i],t[e]=this[e];return t},toString:function(){S(this);var e=this.startContainer;if(e===this.endContainer&&B(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new m(this,!0);return u(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){S(this);var t=e.parentNode,n=W(e);if(!t)throw new H("NOT_FOUND_ERR");var i=this.comparePoint(t,n),r=this.comparePoint(t,n+1);return 0>i?r>0?gt:ft:r>0?pt:vt},comparePoint:function(e,t){return S(this),N(e,"HIERARCHY_REQUEST_ERR"),C(e,this.startContainer),0>U(e,t,this.startContainer,this.startOffset)?-1:U(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:ut,toHtml:function(){S(this);var e=this.commonAncestorContainer.parentNode.cloneNode(!1);return e.appendChild(this.cloneContents()),e.innerHTML},intersectsNode:function(e,t){if(S(this),N(e,"NOT_FOUND_ERR"),z(e)!==n(this))return!1;var i=e.parentNode,r=W(e);N(i,"NOT_FOUND_ERR");var s=U(i,r,this.endContainer,this.endOffset),o=U(i,r+1,this.startContainer,this.startOffset);return t?0>=s&&o>=0:0>s&&o>0},isPointInRange:function(e,t){return S(this),N(e,"HIERARCHY_REQUEST_ERR"),C(e,this.startContainer),U(e,t,this.startContainer,this.startOffset)>=0&&0>=U(e,t,this.endContainer,this.endOffset)},intersectsRange:function(e){return o(this,e,!1)},intersectsOrTouchesRange:function(e){return o(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=U(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=U(this.endContainer,this.endOffset,e.endContainer,e.endOffset),i=this.cloneRange();return-1==t&&i.setStart(e.startContainer,e.startOffset),1==n&&i.setEnd(e.endContainer,e.endOffset),i}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==U(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==U(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new f("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==vt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&0>=this.comparePoint(e,K(e))},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var i=n.pop();t.setEnd(i,i.length);var r=this.containsRange(t);return t.detach(),r}return this.containsNodeContents(e)},getNodes:function(e,t){return S(this),d(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){v(this),this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){v(this),this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var i=n(this),r=e.createRange(i);t=t||P.getBody(i),r.selectNodeContents(t);var s=this.intersection(r),o=0,a=0;return s&&(r.setEnd(s.startContainer,s.startOffset),o=(""+r).length,a=o+(""+s).length,r.detach()),{start:o,end:a,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var i,r,s,o,a=[t],u=!1,c=!1;!c&&(i=a.pop());)if(3==i.nodeType)r=n+i.length,!u&&e.start>=n&&r>=e.start&&(this.setStart(i,e.start-n),u=!0),u&&e.end>=n&&r>=e.end&&(this.setEnd(i,e.end-n),c=!0),n=r;else for(o=i.childNodes,s=o.length;s--;)a.push(o[s])},getName:function(){return"DomRange"},equals:function(e){return M.rangesEqual(this,e)},isValid:function(){return w(this)},inspect:function(){return h(this)}}),_(M,A,I),$.extend(M,{rangeProperties:ct,RangeIterator:m,copyComparisonConstants:j,createPrototypeRange:_,inspect:h,getRangeDocument:n,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=M,e.RangeException=f}),rangy.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,i,r=e.dom,s=e.util,o=r.DomPosition,a=e.DomRange,u=r.getBody,c=r.getContentDocument,l=r.isCharacterDataNode;if(e.features.implementsDomRange&&function(){function i(e){for(var t,n=m.length;n--;)t=m[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function o(e,t,n,i,r){var s=e.startContainer!==t||e.startOffset!=n,o=e.endContainer!==i||e.endOffset!=r,a=!e.equals(e.nativeRange);(s||o||a)&&(e.setEnd(i,r),e.setStart(t,n))}function l(e){e.nativeRange.detach(),e.detached=!0;for(var t=m.length;t--;)e[m[t]]=null}var d,h,m=a.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,i(this)},a.createPrototypeRange(n,o,l),d=n.prototype,d.selectNode=function(e){this.nativeRange.selectNode(e),i(this)},d.cloneContents=function(){return this.nativeRange.cloneContents()},d.surroundContents=function(e){this.nativeRange.surroundContents(e),i(this)},d.collapse=function(e){this.nativeRange.collapse(e),i(this)},d.cloneRange=function(){return new n(this.nativeRange.cloneRange())},d.refresh=function(){i(this)},d.toString=function(){return""+this.nativeRange};var f=document.createTextNode("test");u(document).appendChild(f);var p=document.createRange();p.setStart(f,0),p.setEnd(f,0);try{p.setStart(f,1),d.setStart=function(e,t){this.nativeRange.setStart(e,t),i(this)},d.setEnd=function(e,t){this.nativeRange.setEnd(e,t),i(this)},h=function(e){return function(t){this.nativeRange[e](t),i(this)}}}catch(g){d.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}i(this)},d.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}i(this)},h=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(r){this.nativeRange[t](n),this.nativeRange[e](n)}i(this)}}}d.setStartBefore=h("setStartBefore","setEndBefore"),d.setStartAfter=h("setStartAfter","setEndAfter"),d.setEndBefore=h("setEndBefore","setStartBefore"),d.setEndAfter=h("setEndAfter","setStartAfter"),d.selectNodeContents=function(e){this.setStartAndEnd(e,0,r.getNodeLength(e))},p.selectNodeContents(f),p.setEnd(f,3);var v=document.createRange();v.selectNodeContents(f),v.setEnd(f,4),v.setStart(f,2),d.compareBoundaryPoints=-1==p.compareBoundaryPoints(p.START_TO_END,v)&&1==p.compareBoundaryPoints(p.END_TO_START,v)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var y=document.createElement("div");y.innerHTML="123";var R=y.firstChild,C=u(document);C.appendChild(y),p.setStart(R,1),p.setEnd(R,2),p.deleteContents(),"13"==R.data&&(d.deleteContents=function(){this.nativeRange.deleteContents(),i(this)},d.extractContents=function(){var e=this.nativeRange.extractContents();return i(this),e}),C.removeChild(y),C=null,s.isHostMethod(p,"createContextualFragment")&&(d.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),u(document).removeChild(f),p.detach(),v.detach(),d.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=c(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var d=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();n=e.duplicate(),n.collapse(!1);var s=n.parentElement(),o=i==s?i:r.getCommonAncestor(i,s);return o==t?o:r.getCommonAncestor(t,o)},h=function(e){return 0==e.compareEndPoints("StartToEnd",e)},m=function(e,t,n,i,s){var a=e.duplicate();a.collapse(n);var u=a.parentElement();if(r.isOrIsAncestorOf(t,u)||(u=t),!u.canHaveHTML){var c=new o(u.parentNode,r.getNodeIndex(u));return{boundaryPosition:c,nodeInfo:{nodeIndex:c.offset,containerElement:c.node}}}var d=r.getDocument(u).createElement("span");d.parentNode&&d.parentNode.removeChild(d);for(var h,m,f,p,g,v=n?"StartToStart":"StartToEnd",y=s&&s.containerElement==u?s.nodeIndex:0,R=u.childNodes.length,C=R,b=C;;){if(b==R?u.appendChild(d):u.insertBefore(d,u.childNodes[b]),a.moveToElementText(d),h=a.compareEndPoints(v,e),0==h||y==C)break;if(-1==h){if(C==y+1)break;y=b}else C=C==y+1?y:b;b=Math.floor((y+C)/2),u.removeChild(d)}if(g=d.nextSibling,-1==h&&g&&l(g)){a.setEndPoint(n?"EndToStart":"EndToEnd",e);var N;if(/[\r\n]/.test(g.data)){var k=a.duplicate(),E=k.text.replace(/\r\n/g,"\r").length;for(N=k.moveStart("character",E);-1==(h=k.compareEndPoints("StartToEnd",k));)N++,k.moveStart("character",1)}else N=a.text.length;p=new o(g,N)}else m=(i||!n)&&d.previousSibling,f=(i||n)&&d.nextSibling,p=f&&l(f)?new o(f,0):m&&l(m)?new o(m,m.data.length):new o(u,r.getNodeIndex(d));return d.parentNode.removeChild(d),{boundaryPosition:p,nodeInfo:{nodeIndex:b,containerElement:u}}},f=function(e,t){var n,i,s,o,a=e.offset,c=r.getDocument(e.node),d=u(c).createTextRange(),h=l(e.node);return h?(n=e.node,i=n.parentNode):(o=e.node.childNodes,n=o.length>a?o[a]:null,i=e.node),s=c.createElement("span"),s.innerHTML="&#feff;",n?i.insertBefore(s,n):i.appendChild(s),d.moveToElementText(s),d.collapse(!t),i.removeChild(s),h&&d[t?"moveStart":"moveEnd"]("character",a),d};if(i=function(e){this.textRange=e,this.refresh()},i.prototype=new a(document),i.prototype.refresh=function(){var e,t,n,i=d(this.textRange);h(this.textRange)?t=e=m(this.textRange,i,!0,!0).boundaryPosition:(n=m(this.textRange,i,!0,!1),e=n.boundaryPosition,t=m(this.textRange,i,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},i.prototype.getName=function(){return"WrappedTextRange" |
6 |
},a.copyComparisonConstants(i),i.rangeToTextRange=function(e){if(e.collapsed)return f(new o(e.startContainer,e.startOffset),!0);var t=f(new o(e.startContainer,e.startOffset),!0),n=f(new o(e.endContainer,e.endOffset),!1),i=u(a.getRangeDocument(e)).createTextRange();return i.setEndPoint("StartToStart",t),i.setEndPoint("EndToEnd",n),i},e.WrappedTextRange=i,!e.features.implementsDomRange||e.config.preferTextRange){var p=function(){return this}();p.Range===void 0&&(p.Range=i),e.createNativeRange=function(e){return e=c(e,t,"createNativeRange"),u(e).createTextRange()},e.WrappedRange=i}}e.createRange=function(n){return n=c(n,t,"createRange"),new e.WrappedRange(e.createNativeRange(n))},e.createRangyRange=function(e){return e=c(e,t,"createRangyRange"),new a(e)},e.createIframeRange=function(n){return t.deprecationNotice("createIframeRange()","createRange(iframeEl)"),e.createRange(n)},e.createIframeRangyRange=function(n){return t.deprecationNotice("createIframeRangyRange()","createRangyRange(iframeEl)"),e.createRangyRange(n)},e.addCreateMissingNativeApiListener(function(t){var n=t.document;n.createRange===void 0&&(n.createRange=function(){return e.createRange(n)}),n=t=null})}),rangy.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],function(e,t){function n(e){return"string"==typeof e?/^backward(s)?$/i.test(e):!!e}function i(e,n){if(e){if(O.isWindow(e))return e;if(e instanceof v)return e.win;var i=O.getContentDocument(e,t,n);return O.getWindow(i)}return window}function r(e){return i(e,"getWinSelection").getSelection()}function s(e){return i(e,"getDocSelection").document.selection}function o(e){var t=!1;return e.anchorNode&&(t=1==O.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t}function a(e,t,n){var i=n?"end":"start",r=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[r+"Container"],e.focusOffset=t[r+"Offset"]}function u(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}function c(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function l(t){var n;return t instanceof _?(n=e.createNativeRange(t.getDocument()),n.setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset)):t instanceof D?n=t.nativeRange:M.implementsDomRange&&t instanceof O.getWindow(t.startContainer).Range&&(n=t),n}function d(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;n>t;++t)if(!O.isAncestorOf(e[0],e[t]))return!1;return!0}function h(e){var n=e.getNodes();if(!d(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function m(e){return!!e&&e.text!==void 0}function f(e,t){var n=new D(t);e._ranges=[n],a(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed}function p(t){if(t._ranges.length=0,"None"==t.docSelection.type)c(t);else{var n=t.docSelection.createRange();if(m(n))f(t,n);else{t.rangeCount=n.length;for(var i,r=$(n.item(0)),s=0;t.rangeCount>s;++s)i=e.createRange(r),i.selectNode(n.item(s)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,a(t,t._ranges[t.rangeCount-1],!1)}}}function g(e,n){for(var i=e.docSelection.createRange(),r=h(n),s=$(i.item(0)),o=L(s).createControlRange(),a=0,u=i.length;u>a;++a)o.add(i.item(a));try{o.add(r)}catch(c){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}o.select(),p(e)}function v(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function y(e){e.win=e.anchorNode=e.focusNode=e._ranges=null,e.rangeCount=e.anchorOffset=e.focusOffset=0,e.detached=!0}function R(e,t){for(var n,i,r=tt.length;r--;)if(n=tt[r],i=n.selection,"deleteAll"==t)y(i);else if(n.win==e)return"delete"==t?(tt.splice(r,1),!0):i;return"deleteAll"==t&&(tt.length=0),null}function C(e,n){for(var i,r=$(n[0].startContainer),s=L(r).createControlRange(),o=0,a=n.length;a>o;++o){i=h(n[o]);try{s.add(i)}catch(u){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}s.select(),p(e)}function b(e,t){if(e.win.document!=$(t))throw new A("WRONG_DOCUMENT_ERR")}function N(t){return function(n,i){var r;this.rangeCount?(r=this.getRangeAt(0),r["set"+(t?"Start":"End")](n,i)):(r=e.createRange(this.win.document),r.setStartAndEnd(n,i)),this.setSingleRange(r,this.isBackward())}}function k(e){var t=[],n=new I(e.anchorNode,e.anchorOffset),i=new I(e.focusNode,e.focusOffset),r="function"==typeof e.getName?e.getName():"Selection";if(e.rangeCount!==void 0)for(var s=0,o=e.rangeCount;o>s;++s)t[s]=_.inspect(e.getRangeAt(s));return"["+r+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}e.config.checkSelectionRanges=!0;var E,w,S="boolean",T="number",O=e.dom,j=e.util,x=j.isHostMethod,_=e.DomRange,D=e.WrappedRange,A=e.DOMException,I=O.DomPosition,M=e.features,P="Control",$=O.getDocument,L=O.getBody,H=_.rangesEqual,B=x(window,"getSelection"),W=j.isHostObject(document,"selection");M.implementsWinGetSelection=B,M.implementsDocSelection=W;var F=W&&(!B||e.config.preferTextRange);F?(E=s,e.isSelectionValid=function(e){var t=i(e,"isSelectionValid").document,n=t.selection;return"None"!=n.type||$(n.createRange().parentElement())==t}):B?(E=r,e.isSelectionValid=function(){return!0}):t.fail("Neither document.selection or window.getSelection() detected."),e.getNativeSelection=E;var z=E(),U=e.createNativeRange(document),q=L(document),V=j.areHostProperties(z,["anchorNode","focusNode","anchorOffset","focusOffset"]);M.selectionHasAnchorAndFocus=V;var K=x(z,"extend");M.selectionHasExtend=K;var G=typeof z.rangeCount==T;M.selectionHasRangeCount=G;var Y=!1,Q=!0,X=K?function(t,n){var i=_.getRangeDocument(n),r=e.createRange(i);r.collapseToPoint(n.endContainer,n.endOffset),t.addRange(l(r)),t.extend(n.startContainer,n.startOffset)}:null;j.areHostMethods(z,["addRange","getRangeAt","removeAllRanges"])&&typeof z.rangeCount==T&&M.implementsDomRange&&function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,i=n>1,r=[],s=o(t),a=0;n>a;++a)r[a]=t.getRangeAt(a);var u=L(document),c=u.appendChild(document.createElement("div"));c.contentEditable="false";var l=c.appendChild(document.createTextNode(" ")),d=document.createRange();if(d.setStart(l,1),d.collapse(!0),t.addRange(d),Q=1==t.rangeCount,t.removeAllRanges(),!i){var h=d.cloneRange();d.setStart(l,0),h.setEnd(l,3),h.setStart(l,2),t.addRange(d),t.addRange(h),Y=2==t.rangeCount,h.detach()}for(u.removeChild(c),t.removeAllRanges(),d.detach(),a=0;n>a;++a)0==a&&s?X?X(t,r[a]):(e.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because browser does not support Selection.extend"),t.addRange(r[a])):t.addRange(r[a])}}(),M.selectionSupportsMultipleRanges=Y,M.collapsedNonEditableSelectionsSupported=Q;var Z,J=!1;q&&x(q,"createControlRange")&&(Z=q.createControlRange(),j.areHostProperties(Z,["item","add"])&&(J=!0)),M.implementsControlRange=J,w=V?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return e.rangeCount?e.getRangeAt(e.rangeCount-1).collapsed:!1};var et;x(z,"getRangeAt")?et=function(e,t){try{return e.getRangeAt(t)}catch(n){return null}}:V&&(et=function(t){var n=$(t.anchorNode),i=e.createRange(n);return i.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),i}),v.prototype=e.selectionPrototype;var tt=[],nt=function(e){if(e&&e instanceof v)return e.refresh(),e;e=i(e,"getNativeSelection");var t=R(e),n=E(e),r=W?s(e):null;return t?(t.nativeSelection=n,t.docSelection=r,t.refresh()):(t=new v(n,r,e),tt.push({win:e,selection:t})),t};e.getSelection=nt,e.getIframeSelection=function(n){return t.deprecationNotice("getIframeSelection()","getSelection(iframeEl)"),e.getSelection(O.getIframeWindow(n))};var it=v.prototype;if(!F&&V&&j.areHostMethods(z,["removeAllRanges","addRange"])){it.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),c(this)};var rt=function(e,t){X(e.nativeSelection,t),e.refresh()};it.addRange=G?function(t,i){if(J&&W&&this.docSelection.type==P)g(this,t);else if(n(i)&&K)rt(this,t);else{var r;if(Y?r=this.rangeCount:(this.removeAllRanges(),r=0),this.nativeSelection.addRange(l(t).cloneRange()),this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==r+1){if(e.config.checkSelectionRanges){var s=et(this.nativeSelection,this.rangeCount-1);s&&!H(s,t)&&(t=new D(s))}this._ranges[this.rangeCount-1]=t,a(this,t,at(this.nativeSelection)),this.isCollapsed=w(this)}else this.refresh()}}:function(e,t){n(t)&&K?rt(this,e):(this.nativeSelection.addRange(l(e)),this.refresh())},it.setRanges=function(e){if(J&&e.length>1)C(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;n>t;++t)this.addRange(e[t])}}}else{if(!(x(z,"empty")&&x(U,"select")&&J&&F))return t.fail("No means of selecting a Range or TextRange was found"),!1;it.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=$(this.anchorNode);else if(this.docSelection.type==P){var t=this.docSelection.createRange();t.length&&(e=$(t.item(0)))}if(e){var n=L(e).createTextRange();n.select(),this.docSelection.empty()}}}catch(i){}c(this)},it.addRange=function(t){this.docSelection.type==P?g(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,a(this,t,!1))},it.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?C(this,e):t&&this.addRange(e[0])}}it.getRangeAt=function(e){if(0>e||e>=this.rangeCount)throw new A("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()};var st;if(F)st=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=L(t.win.document).createTextRange(),n.collapse(!0)),t.docSelection.type==P?p(t):m(n)?f(t,n):c(t)};else if(x(z,"getRangeAt")&&typeof z.rangeCount==T)st=function(t){if(J&&W&&t.docSelection.type==P)p(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,i=t.rangeCount;i>n;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));a(t,t._ranges[t.rangeCount-1],at(t.nativeSelection)),t.isCollapsed=w(t)}else c(t)};else{if(!V||typeof z.isCollapsed!=S||typeof U.collapsed!=S||!M.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;st=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=et(n,0),e._ranges=[t],e.rangeCount=1,u(e),e.isCollapsed=w(e)):c(e)}}it.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if(st(this),e){var r=t.length;if(r!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;r--;)if(!H(t[r],this._ranges[r]))return!0;return!1}};var ot=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var i=0,r=n.length;r>i;++i)H(t,n[i])||e.addRange(n[i]);e.rangeCount||c(e)};it.removeRange=J?function(e){if(this.docSelection.type==P){for(var t,n=this.docSelection.createRange(),i=h(e),r=$(n.item(0)),s=L(r).createControlRange(),o=!1,a=0,u=n.length;u>a;++a)t=n.item(a),t!==i||o?s.add(n.item(a)):o=!0;s.select(),p(this)}else ot(this,e)}:function(e){ot(this,e)};var at;!F&&V&&M.implementsDomRange?(at=o,it.isBackward=function(){return at(this)}):at=it.isBackward=function(){return!1},it.isBackwards=it.isBackward,it.toString=function(){for(var e=[],t=0,n=this.rangeCount;n>t;++t)e[t]=""+this._ranges[t];return e.join("")},it.collapse=function(t,n){b(this,t);var i=e.createRange(t);i.collapseToPoint(t,n),this.setSingleRange(i),this.isCollapsed=!0},it.collapseToStart=function(){if(!this.rangeCount)throw new A("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},it.collapseToEnd=function(){if(!this.rangeCount)throw new A("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},it.selectAllChildren=function(t){b(this,t);var n=e.createRange(t);n.selectNodeContents(t),this.setSingleRange(n)},it.deleteFromDocument=function(){if(J&&W&&this.docSelection.type==P){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),e.parentNode.removeChild(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var i=0,r=n.length;r>i;++i)n[i].deleteContents();this.addRange(n[r-1])}}},it.eachRange=function(e,t){for(var n=0,i=this._ranges.length;i>n;++n)if(e(this.getRangeAt(n)))return t},it.getAllRanges=function(){var e=[];return this.eachRange(function(t){e.push(t)}),e},it.setSingleRange=function(e,t){this.removeAllRanges(),this.addRange(e,t)},it.callMethodOnEachRange=function(e,t){var n=[];return this.eachRange(function(i){n.push(i[e].apply(i,t))}),n},it.setStart=N(!0),it.setEnd=N(!1),e.rangePrototype.select=function(e){nt(this.getDocument()).setSingleRange(this,e)},it.changeEachRange=function(e){var t=[],n=this.isBackward();this.eachRange(function(n){e(n),t.push(n)}),this.removeAllRanges(),n&&1==t.length?this.addRange(t[0],"backward"):this.setRanges(t)},it.containsNode=function(e,t){return this.eachRange(function(n){return n.containsNode(e,t)},!0)},it.getBookmark=function(e){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[e])}},it.moveToBookmark=function(t){for(var n,i,r=[],s=0;n=t.rangeBookmarks[s++];)i=e.createRange(this.win),i.moveToBookmark(n),r.push(i);t.backward?this.setSingleRange(r[0],"backward"):this.setRanges(r)},it.toHtml=function(){return this.callMethodOnEachRange("toHtml").join("")},it.getName=function(){return"WrappedSelection"},it.inspect=function(){return k(this)},it.detach=function(){R(this.win,"delete"),y(this)},v.detachAll=function(){R(null,"deleteAll")},v.inspect=k,v.isDirectionBackward=n,e.Selection=v,e.selectionPrototype=it,e.addCreateMissingNativeApiListener(function(e){e.getSelection===void 0&&(e.getSelection=function(){return nt(e)}),e=null})}); |