window.kentico = window.kentico || {};
window.kentico._forms = window.kentico._forms || {};
window.kentico._forms.formFileUploaderComponent = (function (document) {

    function disableElements(form) {
        form.fileUploaderDisabledElements = [];
        var elements = form.elements;
        for (var i = 0; i < elements.length; i++) {
            var element = elements[i];
            if (!element.disabled) {
                form.fileUploaderDisabledElements.push(i);
                element.disabled = true;
            }
        }
    }

    function enableElements(form) {
        form.fileUploaderDisabledElements.forEach(function (disabledElement) {
            form.elements[disabledElement].disabled = false;
        });
    }

    function clearTempFile(fileInput, inputReplacementFilename, inputPlaceholder, tempFileIdentifierInput, inputTextButton, inputIconButton) {
        fileInput.value = null;
        fileInput.removeAttribute("hidden");
        inputReplacementFilename.setAttribute("hidden", "hidden");

        inputPlaceholder.innerText = inputPlaceholder.originalText;
        tempFileIdentifierInput.value = "";

        inputTextButton.setAttribute("hidden", "hidden");
        inputIconButton.setAttribute("data-icon", "select");
        inputIconButton.removeAttribute("title");
    }

    function attachScript(config) {
        var fileInput = document.getElementById(config.fileInputId);
        var inputPlaceholder = document.getElementById(config.fileInputId + "-placeholder");
        var inputReplacementFilename = document.getElementById(config.fileInputId + "-replacement");
        var inputTextButton = document.getElementById(config.fileInputId + "-button");
        var inputIconButton = document.getElementById(config.fileInputId + "-icon");

        var tempFileIdentifierInput = document.getElementById(config.tempFileIdentifierInputId);
        var systemFileNameInput = document.getElementById(config.systemFileNameInputId);
        var originalFileNameInput = document.getElementById(config.originalFileNameInputId);
        var deletePersistentFileInput = document.getElementById(config.deletePersistentFileInputId);
        var tempFileOriginalName = config.tempFileOriginalName;

        var deleteFileIconButtonTitle = config.deleteFileIconButtonTitle;

        inputPlaceholder.originalText = inputPlaceholder.innerText;
        inputTextButton.originalText = inputTextButton.innerText;

        // If a file is selected, set text of the label and file input replacement to its filename.
        if ((originalFileNameInput.value || tempFileOriginalName)
            && deletePersistentFileInput.value.toUpperCase() === "FALSE") {
            inputPlaceholder.innerText = config.originalFileNamePlain || tempFileOriginalName;

            inputTextButton.removeAttribute("hidden");
            inputIconButton.setAttribute("data-icon", "remove");
            inputIconButton.setAttribute("title", deleteFileIconButtonTitle);

            inputReplacementFilename.removeAttribute("hidden");
            fileInput.setAttribute("hidden", "hidden");
        }

        // If file has not yet been persisted, send a request to delete it.
        var deleteTempFile = function () {
            if (tempFileIdentifierInput.value) {
                var deleteRequest = new XMLHttpRequest();

                deleteRequest.open("POST", config.deleteEndpoint + "&tempFileIdentifier=" + tempFileIdentifierInput.value);
                deleteRequest.send();
            }
        };
        // Deletes both permanent and temp files.
        var deleteFile = function () {
            if (systemFileNameInput.value) {
                deletePersistentFileInput.value = true;
            }

            deleteTempFile();

            clearTempFile(fileInput, inputReplacementFilename, inputPlaceholder, tempFileIdentifierInput, inputTextButton, inputIconButton);
        };
        // Wrapper for the deleteFile function used when the icon button is clicked.
        var deleteFileIcon = function (event) {
            if (inputIconButton.getAttribute("data-icon") === "remove") {
                event.preventDefault();
                deleteFile();
            }
        };

        inputTextButton.addEventListener("click", deleteFile);
        inputIconButton.addEventListener("click", deleteFileIcon);

        fileInput.addEventListener("change", function () {
            // In IE11 change fires also when setting fileInput value to null.
            if (!fileInput.value) {
                return;
            }

            inputTextButton.removeAttribute("hidden");
            inputIconButton.setAttribute("data-icon", "loading");
            disableElements(fileInput.form);

            // Validate file size.
            var file = fileInput.files[0];
            if (file !== undefined) {
                if (file.size > config.maxFileSize * 1024) {

                    fileInput.value = null;
                    tempFileIdentifierInput.value = "";
                    originalFileNameInput = "";

                    window.alert(config.maxFileSizeExceededErrorMessage);
                    enableElements(fileInput.form);
                    inputIconButton.setAttribute("data-icon", "select");

                    return;
                }
            }

            var data = new FormData();
            var submitRequest = new XMLHttpRequest();
            submitRequest.contentType = "multipart/form-data";

            data.append("file", file);

            submitRequest.addEventListener("load", function (e) {
                if (submitRequest.readyState === 4) {
                    if (submitRequest.status === 200) {
                        var result = submitRequest.response;
                        // IE11 and Edge do not support response type 'json'
                        if (typeof result === "string") {
                            result = JSON.parse(result);
                        }

                        if (result.errorMessage) {
                            fileInput.value = null;
                            alert(result.errorMessage);

                            inputIconButton.setAttribute("data-icon", "select");
                            inputTextButton.setAttribute("hidden", "hidden");
                        } else {
                            if (systemFileNameInput.value) {
                                deletePersistentFileInput.value = true;
                            }
                            deleteTempFile();

                            var filename = fileInput.files[0].name;

                            tempFileIdentifierInput.value = result.fileIdentifier;

                            inputPlaceholder.innerText = filename;
                            inputTextButton.removeAttribute("hidden");
                            inputIconButton.setAttribute("data-icon", "remove");
                            inputIconButton.setAttribute("title", deleteFileIconButtonTitle);

                            inputReplacementFilename.innerText = filename;
                            inputReplacementFilename.removeAttribute("hidden");
                            fileInput.setAttribute("hidden", "hidden");
                        }
                    } else {
                        alert("Error sending file: " + submitRequest.statusText);

                        inputIconButton.setAttribute("data-icon", "select");
                        inputTextButton.setAttribute("hidden", "hidden");
                    }

                    inputTextButton.innerHTML = inputTextButton.originalText;
                    enableElements(fileInput.form);
                }
            });

            submitRequest.upload.addEventListener("progress", function (event) {
                inputTextButton.innerText = parseInt(event.loaded / event.total * 100) + "%";
            });

            submitRequest.open("POST", config.submitEndpoint);
            submitRequest.responseType = "json";
            submitRequest.send(data);
        });
    }

    return {
        attachScript: attachScript
    };
}(document));

/*!
* inputmask.min.js
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2019 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.9
*/

(function(factory){if(typeof define==="function"&&define.amd){define(["./dependencyLibs/inputmask.dependencyLib","./global/window"],factory)}else if(typeof exports==="object"){module.exports=factory(require("./dependencyLibs/inputmask.dependencyLib"),require("./global/window"))}else{window.Inputmask=factory(window.dependencyLib||jQuery,window)}})(function($,window,undefined){var document=window.document,ua=navigator.userAgent,ie=ua.indexOf("MSIE ")>0||ua.indexOf("Trident/")>0,mobile=isInputEventSupported("touchstart"),iemobile=/iemobile/i.test(ua),iphone=/iphone/i.test(ua)&&!iemobile;function Inputmask(alias,options,internal){if(!(this instanceof Inputmask)){return new Inputmask(alias,options,internal)}this.el=undefined;this.events={};this.maskset=undefined;this.refreshValue=false;if(internal!==true){if($.isPlainObject(alias)){options=alias}else{options=options||{};if(alias)options.alias=alias}this.opts=$.extend(true,{},this.defaults,options);this.noMasksCache=options&&options.definitions!==undefined;this.userOptions=options||{};this.isRTL=this.opts.numericInput;resolveAlias(this.opts.alias,options,this.opts)}}Inputmask.prototype={dataAttribute:"data-inputmask",defaults:{placeholder:"_",optionalmarker:["[","]"],quantifiermarker:["{","}"],groupmarker:["(",")"],alternatormarker:"|",escapeChar:"\\",mask:null,regex:null,oncomplete:$.noop,onincomplete:$.noop,oncleared:$.noop,repeat:0,greedy:false,autoUnmask:false,removeMaskOnSubmit:false,clearMaskOnLostFocus:true,insertMode:true,clearIncomplete:false,alias:null,onKeyDown:$.noop,onBeforeMask:null,onBeforePaste:function(pastedValue,opts){return $.isFunction(opts.onBeforeMask)?opts.onBeforeMask.call(this,pastedValue,opts):pastedValue},onBeforeWrite:null,onUnMask:null,showMaskOnFocus:true,showMaskOnHover:true,onKeyValidation:$.noop,skipOptionalPartCharacter:" ",numericInput:false,rightAlign:false,undoOnEscape:true,radixPoint:"",_radixDance:false,groupSeparator:"",keepStatic:null,positionCaretOnTab:true,tabThrough:false,supportsInputType:["text","tel","url","password","search"],ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123,0,229],isComplete:null,preValidation:null,postValidation:null,staticDefinitionSymbol:undefined,jitMasking:false,nullable:true,inputEventOnly:false,noValuePatching:false,positionCaretOnClick:"lvp",casing:null,inputmode:"verbatim",colorMask:false,disablePredictiveText:false,importDataAttributes:true,shiftPositions:true},definitions:{9:{validator:"[0-9\uff11-\uff19]",definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",definitionSymbol:"*"},"*":{validator:"[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]"}},aliases:{},masksCache:{},mask:function(elems){var that=this;function importAttributeOptions(npt,opts,userOptions,dataAttribute){if(opts.importDataAttributes===true){var attrOptions=npt.getAttribute(dataAttribute),option,dataoptions,optionData,p;var importOption=function(option,optionData){optionData=optionData!==undefined?optionData:npt.getAttribute(dataAttribute+"-"+option);if(optionData!==null){if(typeof optionData==="string"){if(option.indexOf("on")===0)optionData=window[optionData];else if(optionData==="false")optionData=false;else if(optionData==="true")optionData=true}userOptions[option]=optionData}};if(attrOptions&&attrOptions!==""){attrOptions=attrOptions.replace(/'/g,'"');dataoptions=JSON.parse("{"+attrOptions+"}")}if(dataoptions){optionData=undefined;for(p in dataoptions){if(p.toLowerCase()==="alias"){optionData=dataoptions[p];break}}}importOption("alias",optionData);if(userOptions.alias){resolveAlias(userOptions.alias,userOptions,opts)}for(option in opts){if(dataoptions){optionData=undefined;for(p in dataoptions){if(p.toLowerCase()===option.toLowerCase()){optionData=dataoptions[p];break}}}importOption(option,optionData)}}$.extend(true,opts,userOptions);if(npt.dir==="rtl"||opts.rightAlign){npt.style.textAlign="right"}if(npt.dir==="rtl"||opts.numericInput){npt.dir="ltr";npt.removeAttribute("dir");opts.isRTL=true}return Object.keys(userOptions).length}if(typeof elems==="string"){elems=document.getElementById(elems)||document.querySelectorAll(elems)}elems=elems.nodeName?[elems]:elems;$.each(elems,function(ndx,el){var scopedOpts=$.extend(true,{},that.opts);if(importAttributeOptions(el,scopedOpts,$.extend(true,{},that.userOptions),that.dataAttribute)){var maskset=generateMaskSet(scopedOpts,that.noMasksCache);if(maskset!==undefined){if(el.inputmask!==undefined){el.inputmask.opts.autoUnmask=true;el.inputmask.remove()}el.inputmask=new Inputmask(undefined,undefined,true);el.inputmask.opts=scopedOpts;el.inputmask.noMasksCache=that.noMasksCache;el.inputmask.userOptions=$.extend(true,{},that.userOptions);el.inputmask.isRTL=scopedOpts.isRTL||scopedOpts.numericInput;el.inputmask.el=el;el.inputmask.maskset=maskset;$.data(el,"_inputmask_opts",scopedOpts);maskScope.call(el.inputmask,{action:"mask"})}}});return elems&&elems[0]?elems[0].inputmask||this:this},option:function(options,noremask){if(typeof options==="string"){return this.opts[options]}else if(typeof options==="object"){$.extend(this.userOptions,options);if(this.el&&noremask!==true){this.mask(this.el)}return this}},unmaskedvalue:function(value){this.maskset=this.maskset||generateMaskSet(this.opts,this.noMasksCache);return maskScope.call(this,{action:"unmaskedvalue",value:value})},remove:function(){return maskScope.call(this,{action:"remove"})},getemptymask:function(){this.maskset=this.maskset||generateMaskSet(this.opts,this.noMasksCache);return maskScope.call(this,{action:"getemptymask"})},hasMaskedValue:function(){return!this.opts.autoUnmask},isComplete:function(){this.maskset=this.maskset||generateMaskSet(this.opts,this.noMasksCache);return maskScope.call(this,{action:"isComplete"})},getmetadata:function(){this.maskset=this.maskset||generateMaskSet(this.opts,this.noMasksCache);return maskScope.call(this,{action:"getmetadata"})},isValid:function(value){this.maskset=this.maskset||generateMaskSet(this.opts,this.noMasksCache);return maskScope.call(this,{action:"isValid",value:value})},format:function(value,metadata){this.maskset=this.maskset||generateMaskSet(this.opts,this.noMasksCache);return maskScope.call(this,{action:"format",value:value,metadata:metadata})},setValue:function(value){if(this.el){$(this.el).trigger("setvalue",[value])}},analyseMask:function(mask,regexMask,opts){var tokenizer=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?(?:\|[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g,regexTokenizer=/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,escaped=false,currentToken=new MaskToken,match,m,openenings=[],maskTokens=[],openingToken,currentOpeningToken,alternator,lastMatch,groupToken;function MaskToken(isGroup,isOptional,isQuantifier,isAlternator){this.matches=[];this.openGroup=isGroup||false;this.alternatorGroup=false;this.isGroup=isGroup||false;this.isOptional=isOptional||false;this.isQuantifier=isQuantifier||false;this.isAlternator=isAlternator||false;this.quantifier={min:1,max:1}}function insertTestDefinition(mtoken,element,position){position=position!==undefined?position:mtoken.matches.length;var prevMatch=mtoken.matches[position-1];if(regexMask){if(element.indexOf("[")===0||escaped&&/\\d|\\s|\\w]/i.test(element)||element==="."){mtoken.matches.splice(position++,0,{fn:new RegExp(element,opts.casing?"i":""),optionality:false,newBlockMarker:prevMatch===undefined?"master":prevMatch.def!==element,casing:null,def:element,placeholder:undefined,nativeDef:element})}else{if(escaped)element=element[element.length-1];$.each(element.split(""),function(ndx,lmnt){prevMatch=mtoken.matches[position-1];mtoken.matches.splice(position++,0,{fn:null,optionality:false,newBlockMarker:prevMatch===undefined?"master":prevMatch.def!==lmnt&&prevMatch.fn!==null,casing:null,def:opts.staticDefinitionSymbol||lmnt,placeholder:opts.staticDefinitionSymbol!==undefined?lmnt:undefined,nativeDef:(escaped?"'":"")+lmnt})})}escaped=false}else{var maskdef=(opts.definitions?opts.definitions[element]:undefined)||Inputmask.prototype.definitions[element];if(maskdef&&!escaped){mtoken.matches.splice(position++,0,{fn:maskdef.validator?typeof maskdef.validator=="string"?new RegExp(maskdef.validator,opts.casing?"i":""):new function(){this.test=maskdef.validator}:new RegExp("."),optionality:false,newBlockMarker:prevMatch===undefined?"master":prevMatch.def!==(maskdef.definitionSymbol||element),casing:maskdef.casing,def:maskdef.definitionSymbol||element,placeholder:maskdef.placeholder,nativeDef:element})}else{mtoken.matches.splice(position++,0,{fn:null,optionality:false,newBlockMarker:prevMatch===undefined?"master":prevMatch.def!==element&&prevMatch.fn!==null,casing:null,def:opts.staticDefinitionSymbol||element,placeholder:opts.staticDefinitionSymbol!==undefined?element:undefined,nativeDef:(escaped?"'":"")+element});escaped=false}}}function verifyGroupMarker(maskToken){if(maskToken&&maskToken.matches){$.each(maskToken.matches,function(ndx,token){var nextToken=maskToken.matches[ndx+1];if((nextToken===undefined||(nextToken.matches===undefined||nextToken.isQuantifier===false))&&token&&token.isGroup){token.isGroup=false;if(!regexMask){insertTestDefinition(token,opts.groupmarker[0],0);if(token.openGroup!==true){insertTestDefinition(token,opts.groupmarker[1])}}}verifyGroupMarker(token)})}}function defaultCase(){if(openenings.length>0){currentOpeningToken=openenings[openenings.length-1];insertTestDefinition(currentOpeningToken,m);if(currentOpeningToken.isAlternator){alternator=openenings.pop();for(var mndx=0;mndx<alternator.matches.length;mndx++){if(alternator.matches[mndx].isGroup)alternator.matches[mndx].isGroup=false}if(openenings.length>0){currentOpeningToken=openenings[openenings.length-1];currentOpeningToken.matches.push(alternator)}else{currentToken.matches.push(alternator)}}}else{insertTestDefinition(currentToken,m)}}function reverseTokens(maskToken){function reverseStatic(st){if(st===opts.optionalmarker[0])st=opts.optionalmarker[1];else if(st===opts.optionalmarker[1])st=opts.optionalmarker[0];else if(st===opts.groupmarker[0])st=opts.groupmarker[1];else if(st===opts.groupmarker[1])st=opts.groupmarker[0];return st}maskToken.matches=maskToken.matches.reverse();for(var match in maskToken.matches){if(maskToken.matches.hasOwnProperty(match)){var intMatch=parseInt(match);if(maskToken.matches[match].isQuantifier&&maskToken.matches[intMatch+1]&&maskToken.matches[intMatch+1].isGroup){var qt=maskToken.matches[match];maskToken.matches.splice(match,1);maskToken.matches.splice(intMatch+1,0,qt)}if(maskToken.matches[match].matches!==undefined){maskToken.matches[match]=reverseTokens(maskToken.matches[match])}else{maskToken.matches[match]=reverseStatic(maskToken.matches[match])}}}return maskToken}function groupify(matches){var groupToken=new MaskToken(true);groupToken.openGroup=false;groupToken.matches=matches;return groupToken}if(regexMask){opts.optionalmarker[0]=undefined;opts.optionalmarker[1]=undefined}while(match=regexMask?regexTokenizer.exec(mask):tokenizer.exec(mask)){m=match[0];if(regexMask){switch(m.charAt(0)){case"?":m="{0,1}";break;case"+":case"*":m="{"+m+"}";break}}if(escaped){defaultCase();continue}switch(m.charAt(0)){case"(?=":break;case"(?!":break;case"(?<=":break;case"(?<!":break;case opts.escapeChar:escaped=true;if(regexMask){defaultCase()}break;case opts.optionalmarker[1]:case opts.groupmarker[1]:openingToken=openenings.pop();openingToken.openGroup=false;if(openingToken!==undefined){if(openenings.length>0){currentOpeningToken=openenings[openenings.length-1];currentOpeningToken.matches.push(openingToken);if(currentOpeningToken.isAlternator){alternator=openenings.pop();for(var mndx=0;mndx<alternator.matches.length;mndx++){alternator.matches[mndx].isGroup=false;alternator.matches[mndx].alternatorGroup=false}if(openenings.length>0){currentOpeningToken=openenings[openenings.length-1];currentOpeningToken.matches.push(alternator)}else{currentToken.matches.push(alternator)}}}else{currentToken.matches.push(openingToken)}}else defaultCase();break;case opts.optionalmarker[0]:openenings.push(new MaskToken(false,true));break;case opts.groupmarker[0]:openenings.push(new MaskToken(true));break;case opts.quantifiermarker[0]:var quantifier=new MaskToken(false,false,true);m=m.replace(/[{}]/g,"");var mqj=m.split("|"),mq=mqj[0].split(","),mq0=isNaN(mq[0])?mq[0]:parseInt(mq[0]),mq1=mq.length===1?mq0:isNaN(mq[1])?mq[1]:parseInt(mq[1]);if(mq0==="*"||mq0==="+"){mq0=mq1==="*"?0:1}quantifier.quantifier={min:mq0,max:mq1,jit:mqj[1]};var matches=openenings.length>0?openenings[openenings.length-1].matches:currentToken.matches;match=matches.pop();if(match.isAlternator){matches.push(match);matches=match.matches;var groupToken=new MaskToken(true);var tmpMatch=matches.pop();matches.push(groupToken);matches=groupToken.matches;match=tmpMatch}if(!match.isGroup){match=groupify([match])}matches.push(match);matches.push(quantifier);break;case opts.alternatormarker:var groupQuantifier=function(matches){var lastMatch=matches.pop();if(lastMatch.isQuantifier){lastMatch=groupify([matches.pop(),lastMatch])}return lastMatch};if(openenings.length>0){currentOpeningToken=openenings[openenings.length-1];var subToken=currentOpeningToken.matches[currentOpeningToken.matches.length-1];if(currentOpeningToken.openGroup&&(subToken.matches===undefined||subToken.isGroup===false&&subToken.isAlternator===false)){lastMatch=openenings.pop()}else{lastMatch=groupQuantifier(currentOpeningToken.matches)}}else{lastMatch=groupQuantifier(currentToken.matches)}if(lastMatch.isAlternator){openenings.push(lastMatch)}else{if(lastMatch.alternatorGroup){alternator=openenings.pop();lastMatch.alternatorGroup=false}else{alternator=new MaskToken(false,false,false,true)}alternator.matches.push(lastMatch);openenings.push(alternator);if(lastMatch.openGroup){lastMatch.openGroup=false;var alternatorGroup=new MaskToken(true);alternatorGroup.alternatorGroup=true;openenings.push(alternatorGroup)}}break;default:defaultCase()}}while(openenings.length>0){openingToken=openenings.pop();currentToken.matches.push(openingToken)}if(currentToken.matches.length>0){verifyGroupMarker(currentToken);maskTokens.push(currentToken)}if(opts.numericInput||opts.isRTL){reverseTokens(maskTokens[0])}return maskTokens},positionColorMask:function(input,template){input.style.left=template.offsetLeft+"px"}};Inputmask.extendDefaults=function(options){$.extend(true,Inputmask.prototype.defaults,options)};Inputmask.extendDefinitions=function(definition){$.extend(true,Inputmask.prototype.definitions,definition)};Inputmask.extendAliases=function(alias){$.extend(true,Inputmask.prototype.aliases,alias)};Inputmask.format=function(value,options,metadata){return Inputmask(options).format(value,metadata)};Inputmask.unmask=function(value,options){return Inputmask(options).unmaskedvalue(value)};Inputmask.isValid=function(value,options){return Inputmask(options).isValid(value)};Inputmask.remove=function(elems){if(typeof elems==="string"){elems=document.getElementById(elems)||document.querySelectorAll(elems)}elems=elems.nodeName?[elems]:elems;$.each(elems,function(ndx,el){if(el.inputmask)el.inputmask.remove()})};Inputmask.setValue=function(elems,value){if(typeof elems==="string"){elems=document.getElementById(elems)||document.querySelectorAll(elems)}elems=elems.nodeName?[elems]:elems;$.each(elems,function(ndx,el){if(el.inputmask)el.inputmask.setValue(value);else $(el).trigger("setvalue",[value])})};Inputmask.escapeRegex=function(str){var specials=["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"];return str.replace(new RegExp("(\\"+specials.join("|\\")+")","gim"),"\\$1")};Inputmask.keyCode={BACKSPACE:8,BACKSPACE_SAFARI:127,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,RIGHT:39,SPACE:32,TAB:9,UP:38,X:88,CONTROL:17};Inputmask.dependencyLib=$;function resolveAlias(aliasStr,options,opts){var aliasDefinition=Inputmask.prototype.aliases[aliasStr];if(aliasDefinition){if(aliasDefinition.alias)resolveAlias(aliasDefinition.alias,undefined,opts);$.extend(true,opts,aliasDefinition);$.extend(true,opts,options);return true}else if(opts.mask===null){opts.mask=aliasStr}return false}function generateMaskSet(opts,nocache){function generateMask(mask,metadata,opts){var regexMask=false;if(mask===null||mask===""){regexMask=opts.regex!==null;if(regexMask){mask=opts.regex;mask=mask.replace(/^(\^)(.*)(\$)$/,"$2")}else{regexMask=true;mask=".*"}}if(mask.length===1&&opts.greedy===false&&opts.repeat!==0){opts.placeholder=""}if(opts.repeat>0||opts.repeat==="*"||opts.repeat==="+"){var repeatStart=opts.repeat==="*"?0:opts.repeat==="+"?1:opts.repeat;mask=opts.groupmarker[0]+mask+opts.groupmarker[1]+opts.quantifiermarker[0]+repeatStart+","+opts.repeat+opts.quantifiermarker[1]}var masksetDefinition,maskdefKey=regexMask?"regex_"+opts.regex:opts.numericInput?mask.split("").reverse().join(""):mask;if(Inputmask.prototype.masksCache[maskdefKey]===undefined||nocache===true){masksetDefinition={mask:mask,maskToken:Inputmask.prototype.analyseMask(mask,regexMask,opts),validPositions:{},_buffer:undefined,buffer:undefined,tests:{},excludes:{},metadata:metadata,maskLength:undefined,jitOffset:{}};if(nocache!==true){Inputmask.prototype.masksCache[maskdefKey]=masksetDefinition;masksetDefinition=$.extend(true,{},Inputmask.prototype.masksCache[maskdefKey])}}else masksetDefinition=$.extend(true,{},Inputmask.prototype.masksCache[maskdefKey]);return masksetDefinition}var ms;if($.isFunction(opts.mask)){opts.mask=opts.mask(opts)}if($.isArray(opts.mask)){if(opts.mask.length>1){if(opts.keepStatic===null){opts.keepStatic="auto";for(var i=0;i<opts.mask.length;i++){if(opts.mask[i].charAt(0)!==opts.mask[0].charAt(0)){opts.keepStatic=true;break}}}var altMask=opts.groupmarker[0];$.each(opts.isRTL?opts.mask.reverse():opts.mask,function(ndx,msk){if(altMask.length>1){altMask+=opts.groupmarker[1]+opts.alternatormarker+opts.groupmarker[0]}if(msk.mask!==undefined&&!$.isFunction(msk.mask)){altMask+=msk.mask}else{altMask+=msk}});altMask+=opts.groupmarker[1];return generateMask(altMask,opts.mask,opts)}else opts.mask=opts.mask.pop()}if(opts.mask&&opts.mask.mask!==undefined&&!$.isFunction(opts.mask.mask)){ms=generateMask(opts.mask.mask,opts.mask,opts)}else{ms=generateMask(opts.mask,opts.mask,opts)}return ms}function isInputEventSupported(eventName){var el=document.createElement("input"),evName="on"+eventName,isSupported=evName in el;if(!isSupported){el.setAttribute(evName,"return;");isSupported=typeof el[evName]==="function"}el=null;return isSupported}function maskScope(actionObj,maskset,opts){maskset=maskset||this.maskset;opts=opts||this.opts;var inputmask=this,el=this.el,isRTL=this.isRTL,undoValue,$el,skipKeyPressEvent=false,skipInputEvent=false,ignorable=false,maxLength,mouseEnter=false,colorMask,originalPlaceholder;var getMaskTemplate=function(baseOnInput,minimalPos,includeMode,noJit,clearOptionalTail){var greedy=opts.greedy;if(clearOptionalTail)opts.greedy=false;minimalPos=minimalPos||0;var maskTemplate=[],ndxIntlzr,pos=0,test,testPos,lvp=getLastValidPosition();do{if(baseOnInput===true&&getMaskSet().validPositions[pos]){testPos=clearOptionalTail&&getMaskSet().validPositions[pos].match.optionality===true&&getMaskSet().validPositions[pos+1]===undefined&&(getMaskSet().validPositions[pos].generatedInput===true||getMaskSet().validPositions[pos].input==opts.skipOptionalPartCharacter&&pos>0)?determineTestTemplate(pos,getTests(pos,ndxIntlzr,pos-1)):getMaskSet().validPositions[pos];test=testPos.match;ndxIntlzr=testPos.locator.slice();maskTemplate.push(includeMode===true?testPos.input:includeMode===false?test.nativeDef:getPlaceholder(pos,test))}else{testPos=getTestTemplate(pos,ndxIntlzr,pos-1);test=testPos.match;ndxIntlzr=testPos.locator.slice();var jitMasking=noJit===true?false:opts.jitMasking!==false?opts.jitMasking:test.jit;if(jitMasking===false||jitMasking===undefined||typeof jitMasking==="number"&&isFinite(jitMasking)&&jitMasking>pos){maskTemplate.push(includeMode===false?test.nativeDef:getPlaceholder(pos,test))}}if(opts.keepStatic==="auto"){if(test.newBlockMarker&&test.fn!==null){opts.keepStatic=pos-1}}pos++}while((maxLength===undefined||pos<maxLength)&&(test.fn!==null||test.def!=="")||minimalPos>pos);if(maskTemplate[maskTemplate.length-1]===""){maskTemplate.pop()}if(includeMode!==false||getMaskSet().maskLength===undefined)getMaskSet().maskLength=pos-1;opts.greedy=greedy;return maskTemplate};function getMaskSet(){return maskset}function resetMaskSet(soft){var maskset=getMaskSet();maskset.buffer=undefined;if(soft!==true){maskset.validPositions={};maskset.p=0}}function getLastValidPosition(closestTo,strict,validPositions){var before=-1,after=-1,valids=validPositions||getMaskSet().validPositions;if(closestTo===undefined)closestTo=-1;for(var posNdx in valids){var psNdx=parseInt(posNdx);if(valids[psNdx]&&(strict||valids[psNdx].generatedInput!==true)){if(psNdx<=closestTo)before=psNdx;if(psNdx>=closestTo)after=psNdx}}return before===-1||before==closestTo?after:after==-1?before:closestTo-before<after-closestTo?before:after}function getDecisionTaker(tst){var decisionTaker=tst.locator[tst.alternation];if(typeof decisionTaker=="string"&&decisionTaker.length>0){decisionTaker=decisionTaker.split(",")[0]}return decisionTaker!==undefined?decisionTaker.toString():""}function getLocator(tst,align){var locator=(tst.alternation!=undefined?tst.mloc[getDecisionTaker(tst)]:tst.locator).join("");if(locator!=="")while(locator.length<align)locator+="0";return locator}function determineTestTemplate(pos,tests){pos=pos>0?pos-1:0;var altTest=getTest(pos),targetLocator=getLocator(altTest),tstLocator,closest,bestMatch;for(var ndx=0;ndx<tests.length;ndx++){var tst=tests[ndx];tstLocator=getLocator(tst,targetLocator.length);var distance=Math.abs(tstLocator-targetLocator);if(closest===undefined||tstLocator!==""&&distance<closest||bestMatch&&!opts.greedy&&bestMatch.match.optionality&&bestMatch.match.newBlockMarker==="master"&&(!tst.match.optionality||!tst.match.newBlockMarker)||bestMatch&&bestMatch.match.optionalQuantifier&&!tst.match.optionalQuantifier){closest=distance;bestMatch=tst}}return bestMatch}function getTestTemplate(pos,ndxIntlzr,tstPs){return getMaskSet().validPositions[pos]||determineTestTemplate(pos,getTests(pos,ndxIntlzr?ndxIntlzr.slice():ndxIntlzr,tstPs))}function getTest(pos,tests){if(getMaskSet().validPositions[pos]){return getMaskSet().validPositions[pos]}return(tests||getTests(pos))[0]}function positionCanMatchDefinition(pos,def){var valid=false,tests=getTests(pos);for(var tndx=0;tndx<tests.length;tndx++){if(tests[tndx].match&&tests[tndx].match.def===def){valid=true;break}}return valid}function getTests(pos,ndxIntlzr,tstPs){var maskTokens=getMaskSet().maskToken,testPos=ndxIntlzr?tstPs:0,ndxInitializer=ndxIntlzr?ndxIntlzr.slice():[0],matches=[],insertStop=false,latestMatch,cacheDependency=ndxIntlzr?ndxIntlzr.join(""):"";function resolveTestFromToken(maskToken,ndxInitializer,loopNdx,quantifierRecurse){function handleMatch(match,loopNdx,quantifierRecurse){function isFirstMatch(latestMatch,tokenGroup){var firstMatch=$.inArray(latestMatch,tokenGroup.matches)===0;if(!firstMatch){$.each(tokenGroup.matches,function(ndx,match){if(match.isQuantifier===true)firstMatch=isFirstMatch(latestMatch,tokenGroup.matches[ndx-1]);else if(match.hasOwnProperty("matches"))firstMatch=isFirstMatch(latestMatch,match);if(firstMatch)return false})}return firstMatch}function resolveNdxInitializer(pos,alternateNdx,targetAlternation){var bestMatch,indexPos;if(getMaskSet().tests[pos]||getMaskSet().validPositions[pos]){$.each(getMaskSet().tests[pos]||[getMaskSet().validPositions[pos]],function(ndx,lmnt){if(lmnt.mloc[alternateNdx]){bestMatch=lmnt;return false}var alternation=targetAlternation!==undefined?targetAlternation:lmnt.alternation,ndxPos=lmnt.locator[alternation]!==undefined?lmnt.locator[alternation].toString().indexOf(alternateNdx):-1;if((indexPos===undefined||ndxPos<indexPos)&&ndxPos!==-1){bestMatch=lmnt;indexPos=ndxPos}})}if(bestMatch){var bestMatchAltIndex=bestMatch.locator[bestMatch.alternation];var locator=bestMatch.mloc[alternateNdx]||bestMatch.mloc[bestMatchAltIndex]||bestMatch.locator;return locator.slice((targetAlternation!==undefined?targetAlternation:bestMatch.alternation)+1)}else{return targetAlternation!==undefined?resolveNdxInitializer(pos,alternateNdx):undefined}}function isSubsetOf(source,target){function expand(pattern){var expanded=[],start,end;for(var i=0,l=pattern.length;i<l;i++){if(pattern.charAt(i)==="-"){end=pattern.charCodeAt(i+1);while(++start<end)expanded.push(String.fromCharCode(start))}else{start=pattern.charCodeAt(i);expanded.push(pattern.charAt(i))}}return expanded.join("")}if(opts.regex&&source.match.fn!==null&&target.match.fn!==null){return expand(target.match.def.replace(/[\[\]]/g,"")).indexOf(expand(source.match.def.replace(/[\[\]]/g,"")))!==-1}return source.match.def===target.match.nativeDef}function staticCanMatchDefinition(source,target){var sloc=source.locator.slice(source.alternation).join(""),tloc=target.locator.slice(target.alternation).join(""),canMatch=sloc==tloc;canMatch=canMatch&&source.match.fn===null&&target.match.fn!==null?target.match.fn.test(source.match.def,getMaskSet(),pos,false,opts,false):false;return canMatch}function setMergeLocators(targetMatch,altMatch){if(altMatch===undefined||targetMatch.alternation===altMatch.alternation&&targetMatch.locator[targetMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation])===-1){targetMatch.mloc=targetMatch.mloc||{};var locNdx=targetMatch.locator[targetMatch.alternation];if(locNdx===undefined)targetMatch.alternation=undefined;else{if(typeof locNdx==="string")locNdx=locNdx.split(",")[0];if(targetMatch.mloc[locNdx]===undefined)targetMatch.mloc[locNdx]=targetMatch.locator.slice();if(altMatch!==undefined){for(var ndx in altMatch.mloc){if(typeof ndx==="string")ndx=ndx.split(",")[0];if(targetMatch.mloc[ndx]===undefined)targetMatch.mloc[ndx]=altMatch.mloc[ndx]}targetMatch.locator[targetMatch.alternation]=Object.keys(targetMatch.mloc).join(",")}return true}}return false}if(testPos>500&&quantifierRecurse!==undefined){throw"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+getMaskSet().mask}if(testPos===pos&&match.matches===undefined){matches.push({match:match,locator:loopNdx.reverse(),cd:cacheDependency,mloc:{}});return true}else if(match.matches!==undefined){if(match.isGroup&&quantifierRecurse!==match){match=handleMatch(maskToken.matches[$.inArray(match,maskToken.matches)+1],loopNdx,quantifierRecurse);if(match)return true}else if(match.isOptional){var optionalToken=match;match=resolveTestFromToken(match,ndxInitializer,loopNdx,quantifierRecurse);if(match){$.each(matches,function(ndx,mtch){mtch.match.optionality=true});latestMatch=matches[matches.length-1].match;if(quantifierRecurse===undefined&&isFirstMatch(latestMatch,optionalToken)){insertStop=true;testPos=pos}else return true}}else if(match.isAlternator){var alternateToken=match,malternateMatches=[],maltMatches,currentMatches=matches.slice(),loopNdxCnt=loopNdx.length;var altIndex=ndxInitializer.length>0?ndxInitializer.shift():-1;if(altIndex===-1||typeof altIndex==="string"){var currentPos=testPos,ndxInitializerClone=ndxInitializer.slice(),altIndexArr=[],amndx;if(typeof altIndex=="string"){altIndexArr=altIndex.split(",")}else{for(amndx=0;amndx<alternateToken.matches.length;amndx++){altIndexArr.push(amndx.toString())}}if(getMaskSet().excludes[pos]){var altIndexArrClone=altIndexArr.slice();for(var i=0,el=getMaskSet().excludes[pos].length;i<el;i++){altIndexArr.splice(altIndexArr.indexOf(getMaskSet().excludes[pos][i].toString()),1)}if(altIndexArr.length===0){getMaskSet().excludes[pos]=undefined;altIndexArr=altIndexArrClone}}if(opts.keepStatic===true||isFinite(parseInt(opts.keepStatic))&&currentPos>=opts.keepStatic)altIndexArr=altIndexArr.slice(0,1);var unMatchedAlternation=false;for(var ndx=0;ndx<altIndexArr.length;ndx++){amndx=parseInt(altIndexArr[ndx]);matches=[];ndxInitializer=typeof altIndex==="string"?resolveNdxInitializer(testPos,amndx,loopNdxCnt)||ndxInitializerClone.slice():ndxInitializerClone.slice();if(alternateToken.matches[amndx]&&handleMatch(alternateToken.matches[amndx],[amndx].concat(loopNdx),quantifierRecurse))match=true;else if(ndx===0){unMatchedAlternation=true}maltMatches=matches.slice();testPos=currentPos;matches=[];for(var ndx1=0;ndx1<maltMatches.length;ndx1++){var altMatch=maltMatches[ndx1],dropMatch=false;altMatch.match.jit=altMatch.match.jit||unMatchedAlternation;altMatch.alternation=altMatch.alternation||loopNdxCnt;setMergeLocators(altMatch);for(var ndx2=0;ndx2<malternateMatches.length;ndx2++){var altMatch2=malternateMatches[ndx2];if(typeof altIndex!=="string"||altMatch.alternation!==undefined&&$.inArray(altMatch.locator[altMatch.alternation].toString(),altIndexArr)!==-1){if(altMatch.match.nativeDef===altMatch2.match.nativeDef){dropMatch=true;setMergeLocators(altMatch2,altMatch);break}else if(isSubsetOf(altMatch,altMatch2)){if(setMergeLocators(altMatch,altMatch2)){dropMatch=true;malternateMatches.splice(malternateMatches.indexOf(altMatch2),0,altMatch)}break}else if(isSubsetOf(altMatch2,altMatch)){setMergeLocators(altMatch2,altMatch);break}else if(staticCanMatchDefinition(altMatch,altMatch2)){if(setMergeLocators(altMatch,altMatch2)){dropMatch=true;malternateMatches.splice(malternateMatches.indexOf(altMatch2),0,altMatch)}break}}}if(!dropMatch){malternateMatches.push(altMatch)}}}matches=currentMatches.concat(malternateMatches);testPos=pos;insertStop=matches.length>0;match=malternateMatches.length>0;ndxInitializer=ndxInitializerClone.slice()}else match=handleMatch(alternateToken.matches[altIndex]||maskToken.matches[altIndex],[altIndex].concat(loopNdx),quantifierRecurse);if(match)return true}else if(match.isQuantifier&&quantifierRecurse!==maskToken.matches[$.inArray(match,maskToken.matches)-1]){var qt=match;for(var qndx=ndxInitializer.length>0?ndxInitializer.shift():0;qndx<(isNaN(qt.quantifier.max)?qndx+1:qt.quantifier.max)&&testPos<=pos;qndx++){var tokenGroup=maskToken.matches[$.inArray(qt,maskToken.matches)-1];match=handleMatch(tokenGroup,[qndx].concat(loopNdx),tokenGroup);if(match){latestMatch=matches[matches.length-1].match;latestMatch.optionalQuantifier=qndx>=qt.quantifier.min;latestMatch.jit=(qndx||1)*tokenGroup.matches.indexOf(latestMatch)>=qt.quantifier.jit;if(latestMatch.optionalQuantifier&&isFirstMatch(latestMatch,tokenGroup)){insertStop=true;testPos=pos;break}if(latestMatch.jit){getMaskSet().jitOffset[pos]=tokenGroup.matches.indexOf(latestMatch)}return true}}}else{match=resolveTestFromToken(match,ndxInitializer,loopNdx,quantifierRecurse);if(match)return true}}else{testPos++}}for(var tndx=ndxInitializer.length>0?ndxInitializer.shift():0;tndx<maskToken.matches.length;tndx++){if(maskToken.matches[tndx].isQuantifier!==true){var match=handleMatch(maskToken.matches[tndx],[tndx].concat(loopNdx),quantifierRecurse);if(match&&testPos===pos){return match}else if(testPos>pos){break}}}}function mergeLocators(pos,tests){var locator=[];if(!$.isArray(tests))tests=[tests];if(tests.length>0){if(tests[0].alternation===undefined){locator=determineTestTemplate(pos,tests.slice()).locator.slice();if(locator.length===0)locator=tests[0].locator.slice()}else{$.each(tests,function(ndx,tst){if(tst.def!==""){if(locator.length===0)locator=tst.locator.slice();else{for(var i=0;i<locator.length;i++){if(tst.locator[i]&&locator[i].toString().indexOf(tst.locator[i])===-1){locator[i]+=","+tst.locator[i]}}}}})}}return locator}if(pos>-1){if(ndxIntlzr===undefined){var previousPos=pos-1,test;while((test=getMaskSet().validPositions[previousPos]||getMaskSet().tests[previousPos])===undefined&&previousPos>-1){previousPos--}if(test!==undefined&&previousPos>-1){ndxInitializer=mergeLocators(previousPos,test);cacheDependency=ndxInitializer.join("");testPos=previousPos}}if(getMaskSet().tests[pos]&&getMaskSet().tests[pos][0].cd===cacheDependency){return getMaskSet().tests[pos]}for(var mtndx=ndxInitializer.shift();mtndx<maskTokens.length;mtndx++){var match=resolveTestFromToken(maskTokens[mtndx],ndxInitializer,[mtndx]);if(match&&testPos===pos||testPos>pos){break}}}if(matches.length===0||insertStop){matches.push({match:{fn:null,optionality:false,casing:null,def:"",placeholder:""},locator:[],mloc:{},cd:cacheDependency})}if(ndxIntlzr!==undefined&&getMaskSet().tests[pos]){return $.extend(true,[],matches)}getMaskSet().tests[pos]=$.extend(true,[],matches);return getMaskSet().tests[pos]}function getBufferTemplate(){if(getMaskSet()._buffer===undefined){getMaskSet()._buffer=getMaskTemplate(false,1);if(getMaskSet().buffer===undefined)getMaskSet().buffer=getMaskSet()._buffer.slice()}return getMaskSet()._buffer}function getBuffer(noCache){if(getMaskSet().buffer===undefined||noCache===true){getMaskSet().buffer=getMaskTemplate(true,getLastValidPosition(),true);if(getMaskSet()._buffer===undefined)getMaskSet()._buffer=getMaskSet().buffer.slice()}return getMaskSet().buffer}function refreshFromBuffer(start,end,buffer){var i,p;if(start===true){resetMaskSet();start=0;end=buffer.length}else{for(i=start;i<end;i++){delete getMaskSet().validPositions[i]}}p=start;for(i=start;i<end;i++){resetMaskSet(true);if(buffer[i]!==opts.skipOptionalPartCharacter){var valResult=isValid(p,buffer[i],true,true);if(valResult!==false){resetMaskSet(true);p=valResult.caret!==undefined?valResult.caret:valResult.pos+1}}}}function casing(elem,test,pos){switch(opts.casing||test.casing){case"upper":elem=elem.toUpperCase();break;case"lower":elem=elem.toLowerCase();break;case"title":var posBefore=getMaskSet().validPositions[pos-1];if(pos===0||posBefore&&posBefore.input===String.fromCharCode(Inputmask.keyCode.SPACE)){elem=elem.toUpperCase()}else{elem=elem.toLowerCase()}break;default:if($.isFunction(opts.casing)){var args=Array.prototype.slice.call(arguments);args.push(getMaskSet().validPositions);elem=opts.casing.apply(this,args)}}return elem}function checkAlternationMatch(altArr1,altArr2,na){var altArrC=opts.greedy?altArr2:altArr2.slice(0,1),isMatch=false,naArr=na!==undefined?na.split(","):[],naNdx;for(var i=0;i<naArr.length;i++){if((naNdx=altArr1.indexOf(naArr[i]))!==-1){altArr1.splice(naNdx,1)}}for(var alndx=0;alndx<altArr1.length;alndx++){if($.inArray(altArr1[alndx],altArrC)!==-1){isMatch=true;break}}return isMatch}function alternate(pos,c,strict,fromSetValid,rAltPos){var validPsClone=$.extend(true,{},getMaskSet().validPositions),lastAlt,alternation,isValidRslt=false,altPos,prevAltPos,i,validPos,decisionPos,lAltPos=rAltPos!==undefined?rAltPos:getLastValidPosition();if(lAltPos===-1&&rAltPos===undefined){lastAlt=0;prevAltPos=getTest(lastAlt);alternation=prevAltPos.alternation}else{for(;lAltPos>=0;lAltPos--){altPos=getMaskSet().validPositions[lAltPos];if(altPos&&altPos.alternation!==undefined){if(prevAltPos&&prevAltPos.locator[altPos.alternation]!==altPos.locator[altPos.alternation]){break}lastAlt=lAltPos;alternation=getMaskSet().validPositions[lastAlt].alternation;prevAltPos=altPos}}}if(alternation!==undefined){decisionPos=parseInt(lastAlt);getMaskSet().excludes[decisionPos]=getMaskSet().excludes[decisionPos]||[];if(pos!==true){getMaskSet().excludes[decisionPos].push(getDecisionTaker(prevAltPos))}var validInputsClone=[],staticInputsBeforePos=0;for(i=decisionPos;i<getLastValidPosition(undefined,true)+1;i++){validPos=getMaskSet().validPositions[i];if(validPos&&validPos.generatedInput!==true){validInputsClone.push(validPos.input)}else if(i<pos)staticInputsBeforePos++;delete getMaskSet().validPositions[i]}while(getMaskSet().excludes[decisionPos]&&getMaskSet().excludes[decisionPos].length<10){var posOffset=staticInputsBeforePos*-1,validInputs=validInputsClone.slice();getMaskSet().tests[decisionPos]=undefined;resetMaskSet(true);isValidRslt=true;while(validInputs.length>0){var input=validInputs.shift();if(!(isValidRslt=isValid(getLastValidPosition(undefined,true)+1,input,false,fromSetValid,true))){break}}if(isValidRslt&&c!==undefined){var targetLvp=getLastValidPosition(pos)+1;for(i=decisionPos;i<getLastValidPosition()+1;i++){validPos=getMaskSet().validPositions[i];if((validPos===undefined||validPos.match.fn==null)&&i<pos+posOffset){posOffset++}}pos=pos+posOffset;isValidRslt=isValid(pos>targetLvp?targetLvp:pos,c,strict,fromSetValid,true)}if(!isValidRslt){resetMaskSet();prevAltPos=getTest(decisionPos);getMaskSet().validPositions=$.extend(true,{},validPsClone);if(getMaskSet().excludes[decisionPos]){var decisionTaker=getDecisionTaker(prevAltPos);if(getMaskSet().excludes[decisionPos].indexOf(decisionTaker)!==-1){isValidRslt=alternate(pos,c,strict,fromSetValid,decisionPos-1);break}getMaskSet().excludes[decisionPos].push(decisionTaker);for(i=decisionPos;i<getLastValidPosition(undefined,true)+1;i++)delete getMaskSet().validPositions[i]}else{isValidRslt=alternate(pos,c,strict,fromSetValid,decisionPos-1);break}}else break}}getMaskSet().excludes[decisionPos]=undefined;return isValidRslt}function isValid(pos,c,strict,fromSetValid,fromAlternate,validateOnly){function isSelection(posObj){return isRTL?posObj.begin-posObj.end>1||posObj.begin-posObj.end===1:posObj.end-posObj.begin>1||posObj.end-posObj.begin===1}strict=strict===true;var maskPos=pos;if(pos.begin!==undefined){maskPos=isRTL?pos.end:pos.begin}function _isValid(position,c,strict){var rslt=false;$.each(getTests(position),function(ndx,tst){var test=tst.match;getBuffer(true);rslt=test.fn!=null?test.fn.test(c,getMaskSet(),position,strict,opts,isSelection(pos)):(c===test.def||c===opts.skipOptionalPartCharacter)&&test.def!==""?{c:getPlaceholder(position,test,true)||test.def,pos:position}:false;if(rslt!==false){var elem=rslt.c!==undefined?rslt.c:c,validatedPos=position;elem=elem===opts.skipOptionalPartCharacter&&test.fn===null?getPlaceholder(position,test,true)||test.def:elem;if(rslt.remove!==undefined){if(!$.isArray(rslt.remove))rslt.remove=[rslt.remove];$.each(rslt.remove.sort(function(a,b){return b-a}),function(ndx,lmnt){revalidateMask({begin:lmnt,end:lmnt+1})})}if(rslt.insert!==undefined){if(!$.isArray(rslt.insert))rslt.insert=[rslt.insert];$.each(rslt.insert.sort(function(a,b){return a-b}),function(ndx,lmnt){isValid(lmnt.pos,lmnt.c,true,fromSetValid)})}if(rslt!==true&&rslt.pos!==undefined&&rslt.pos!==position){validatedPos=rslt.pos}if(rslt!==true&&rslt.pos===undefined&&rslt.c===undefined){return false}if(!revalidateMask(pos,$.extend({},tst,{input:casing(elem,test,validatedPos)}),fromSetValid,validatedPos)){rslt=false}return false}});return rslt}var result=true,positionsClone=$.extend(true,{},getMaskSet().validPositions);if($.isFunction(opts.preValidation)&&!strict&&fromSetValid!==true&&validateOnly!==true){result=opts.preValidation(getBuffer(),maskPos,c,isSelection(pos),opts,getMaskSet())}if(result===true){trackbackPositions(undefined,maskPos,true);if(maxLength===undefined||maskPos<maxLength){result=_isValid(maskPos,c,strict);if((!strict||fromSetValid===true)&&result===false&&validateOnly!==true){var currentPosValid=getMaskSet().validPositions[maskPos];if(currentPosValid&&currentPosValid.match.fn===null&&(currentPosValid.match.def===c||c===opts.skipOptionalPartCharacter)){result={caret:seekNext(maskPos)}}else{if((opts.insertMode||getMaskSet().validPositions[seekNext(maskPos)]===undefined)&&(!isMask(maskPos,true)||getMaskSet().jitOffset[maskPos])){if(getMaskSet().jitOffset[maskPos]&&getMaskSet().validPositions[seekNext(maskPos)]===undefined){result=isValid(maskPos+getMaskSet().jitOffset[maskPos],c,strict);if(result!==false)result.caret=maskPos}else for(var nPos=maskPos+1,snPos=seekNext(maskPos);nPos<=snPos;nPos++){result=_isValid(nPos,c,strict);if(result!==false){result=trackbackPositions(maskPos,result.pos!==undefined?result.pos:nPos)||result;maskPos=nPos;break}}}}}}if(result===false&&opts.keepStatic!==false&&(opts.regex==null||isComplete(getBuffer()))&&!strict&&fromAlternate!==true){result=alternate(maskPos,c,strict,fromSetValid)}if(result===true){result={pos:maskPos}}}if($.isFunction(opts.postValidation)&&result!==false&&!strict&&fromSetValid!==true&&validateOnly!==true){var postResult=opts.postValidation(getBuffer(true),pos.begin!==undefined?isRTL?pos.end:pos.begin:pos,result,opts);if(postResult!==undefined){if(postResult.refreshFromBuffer&&postResult.buffer){var refresh=postResult.refreshFromBuffer;refreshFromBuffer(refresh===true?refresh:refresh.start,refresh.end,postResult.buffer)}result=postResult===true?result:postResult}}if(result&&result.pos===undefined){result.pos=maskPos}if(result===false||validateOnly===true){resetMaskSet(true);getMaskSet().validPositions=$.extend(true,{},positionsClone)}return result}function trackbackPositions(originalPos,newPos,fillOnly){var result;if(originalPos===undefined){for(originalPos=newPos-1;originalPos>0;originalPos--){if(getMaskSet().validPositions[originalPos])break}}for(var ps=originalPos;ps<newPos;ps++){if(getMaskSet().validPositions[ps]===undefined&&!isMask(ps,true)){var vp=ps==0?getTest(ps):getMaskSet().validPositions[ps-1];if(vp){var tests=getTests(ps).slice();if(tests[tests.length-1].match.def==="")tests.pop();var bestMatch=determineTestTemplate(ps,tests);bestMatch=$.extend({},bestMatch,{input:getPlaceholder(ps,bestMatch.match,true)||bestMatch.match.def});bestMatch.generatedInput=true;revalidateMask(ps,bestMatch,true);if(fillOnly!==true){var cvpInput=getMaskSet().validPositions[newPos].input;getMaskSet().validPositions[newPos]=undefined;result=isValid(newPos,cvpInput,true,true)}}}}return result}function revalidateMask(pos,validTest,fromSetValid,validatedPos){function IsEnclosedStatic(pos,valids,selection){var posMatch=valids[pos];if(posMatch!==undefined&&(posMatch.match.fn===null&&posMatch.match.optionality!==true||posMatch.input===opts.radixPoint)){var prevMatch=selection.begin<=pos-1?valids[pos-1]&&valids[pos-1].match.fn===null&&valids[pos-1]:valids[pos-1],nextMatch=selection.end>pos+1?valids[pos+1]&&valids[pos+1].match.fn===null&&valids[pos+1]:valids[pos+1];return prevMatch&&nextMatch}return false}var begin=pos.begin!==undefined?pos.begin:pos,end=pos.end!==undefined?pos.end:pos;if(pos.begin>pos.end){begin=pos.end;end=pos.begin}validatedPos=validatedPos!==undefined?validatedPos:begin;if(begin!==end||opts.insertMode&&getMaskSet().validPositions[validatedPos]!==undefined&&fromSetValid===undefined){var positionsClone=$.extend(true,{},getMaskSet().validPositions),lvp=getLastValidPosition(undefined,true),i;getMaskSet().p=begin;for(i=lvp;i>=begin;i--){if(getMaskSet().validPositions[i]&&getMaskSet().validPositions[i].match.nativeDef==="+"){opts.isNegative=false}delete getMaskSet().validPositions[i]}var valid=true,j=validatedPos,vps=getMaskSet().validPositions,needsValidation=false,posMatch=j,i=j;if(validTest){getMaskSet().validPositions[validatedPos]=$.extend(true,{},validTest);posMatch++;j++;if(begin<end)i++}for(;i<=lvp;i++){var t=positionsClone[i];if(t!==undefined&&(i>=end||i>=begin&&t.generatedInput!==true&&IsEnclosedStatic(i,positionsClone,{begin:begin,end:end}))){while(getTest(posMatch).match.def!==""){if(needsValidation===false&&positionsClone[posMatch]&&positionsClone[posMatch].match.nativeDef===t.match.nativeDef){getMaskSet().validPositions[posMatch]=$.extend(true,{},positionsClone[posMatch]);getMaskSet().validPositions[posMatch].input=t.input;trackbackPositions(undefined,posMatch,true);j=posMatch+1;valid=true}else if(opts.shiftPositions&&positionCanMatchDefinition(posMatch,t.match.def)){var result=isValid(posMatch,t.input,true,true);valid=result!==false;j=result.caret||result.insert?getLastValidPosition():posMatch+1;needsValidation=true}else{valid=t.generatedInput===true||t.input===opts.radixPoint&&opts.numericInput===true}if(valid)break;if(!valid&&posMatch>end&&isMask(posMatch,true)&&(t.match.fn!==null||posMatch>getMaskSet().maskLength)){break}posMatch++}if(getTest(posMatch).match.def=="")valid=false;posMatch=j}if(!valid)break}if(!valid){getMaskSet().validPositions=$.extend(true,{},positionsClone);resetMaskSet(true);return false}}else if(validTest){getMaskSet().validPositions[validatedPos]=$.extend(true,{},validTest)}resetMaskSet(true);return true}function isMask(pos,strict){var test=getTestTemplate(pos).match;if(test.def==="")test=getTest(pos).match;if(test.fn!=null){return test.fn}if(strict!==true&&pos>-1){var tests=getTests(pos);return tests.length>1+(tests[tests.length-1].match.def===""?1:0)}return false}function seekNext(pos,newBlock){var position=pos+1;while(getTest(position).match.def!==""&&(newBlock===true&&(getTest(position).match.newBlockMarker!==true||!isMask(position))||newBlock!==true&&!isMask(position))){position++}return position}function seekPrevious(pos,newBlock){var position=pos,tests;if(position<=0)return 0;while(--position>0&&(newBlock===true&&getTest(position).match.newBlockMarker!==true||newBlock!==true&&!isMask(position)&&(tests=getTests(position),tests.length<2||tests.length===2&&tests[1].match.def===""))){}return position}function writeBuffer(input,buffer,caretPos,event,triggerEvents){if(event&&$.isFunction(opts.onBeforeWrite)){var result=opts.onBeforeWrite.call(inputmask,event,buffer,caretPos,opts);if(result){if(result.refreshFromBuffer){var refresh=result.refreshFromBuffer;refreshFromBuffer(refresh===true?refresh:refresh.start,refresh.end,result.buffer||buffer);buffer=getBuffer(true)}if(caretPos!==undefined)caretPos=result.caret!==undefined?result.caret:caretPos}}if(input!==undefined){input.inputmask._valueSet(buffer.join(""));if(caretPos!==undefined&&(event===undefined||event.type!=="blur")){caret(input,caretPos)}else renderColorMask(input,caretPos,buffer.length===0);if(triggerEvents===true){var $input=$(input),nptVal=input.inputmask._valueGet();skipInputEvent=true;$input.trigger("input");setTimeout(function(){if(nptVal===getBufferTemplate().join("")){$input.trigger("cleared")}else if(isComplete(buffer)===true){$input.trigger("complete")}},0)}}}function getPlaceholder(pos,test,returnPL){test=test||getTest(pos).match;if(test.placeholder!==undefined||returnPL===true){return $.isFunction(test.placeholder)?test.placeholder(opts):test.placeholder}else if(test.fn===null){if(pos>-1&&getMaskSet().validPositions[pos]===undefined){var tests=getTests(pos),staticAlternations=[],prevTest;if(tests.length>1+(tests[tests.length-1].match.def===""?1:0)){for(var i=0;i<tests.length;i++){if(tests[i].match.optionality!==true&&tests[i].match.optionalQuantifier!==true&&(tests[i].match.fn===null||(prevTest===undefined||tests[i].match.fn.test(prevTest.match.def,getMaskSet(),pos,true,opts)!==false))){staticAlternations.push(tests[i]);if(tests[i].match.fn===null)prevTest=tests[i];if(staticAlternations.length>1){if(/[0-9a-bA-Z]/.test(staticAlternations[0].match.def)){return opts.placeholder.charAt(pos%opts.placeholder.length)}}}}}}return test.def}return opts.placeholder.charAt(pos%opts.placeholder.length)}function HandleNativePlaceholder(npt,value){if(ie){if(npt.inputmask._valueGet()!==value&&(npt.placeholder!==value||npt.placeholder==="")){var buffer=getBuffer().slice(),nptValue=npt.inputmask._valueGet();if(nptValue!==value){var lvp=getLastValidPosition();if(lvp===-1&&nptValue===getBufferTemplate().join("")){buffer=[]}else if(lvp!==-1){clearOptionalTail(buffer)}writeBuffer(npt,buffer)}}}else if(npt.placeholder!==value){npt.placeholder=value;if(npt.placeholder==="")npt.removeAttribute("placeholder")}}var EventRuler={on:function(input,eventName,eventHandler){var ev=function(e){var that=this;if(that.inputmask===undefined&&this.nodeName!=="FORM"){var imOpts=$.data(that,"_inputmask_opts");if(imOpts)new Inputmask(imOpts).mask(that);else EventRuler.off(that)}else if(e.type!=="setvalue"&&this.nodeName!=="FORM"&&(that.disabled||that.readOnly&&!(e.type==="keydown"&&(e.ctrlKey&&e.keyCode===67)||opts.tabThrough===false&&e.keyCode===Inputmask.keyCode.TAB))){e.preventDefault()}else{switch(e.type){case"input":if(skipInputEvent===true){skipInputEvent=false;return e.preventDefault()}if(mobile){var args=arguments;setTimeout(function(){eventHandler.apply(that,args);caret(that,that.inputmask.caretPos,undefined,true)},0);return false}break;case"keydown":skipKeyPressEvent=false;skipInputEvent=false;break;case"keypress":if(skipKeyPressEvent===true){return e.preventDefault()}skipKeyPressEvent=true;break;case"click":if(iemobile||iphone){var args=arguments;setTimeout(function(){eventHandler.apply(that,args)},0);return false}break}var returnVal=eventHandler.apply(that,arguments);if(returnVal===false){e.preventDefault();e.stopPropagation()}return returnVal}};input.inputmask.events[eventName]=input.inputmask.events[eventName]||[];input.inputmask.events[eventName].push(ev);if($.inArray(eventName,["submit","reset"])!==-1){if(input.form!==null)$(input.form).on(eventName,ev)}else{$(input).on(eventName,ev)}},off:function(input,event){if(input.inputmask&&input.inputmask.events){var events;if(event){events=[];events[event]=input.inputmask.events[event]}else{events=input.inputmask.events}$.each(events,function(eventName,evArr){while(evArr.length>0){var ev=evArr.pop();if($.inArray(eventName,["submit","reset"])!==-1){if(input.form!==null)$(input.form).off(eventName,ev)}else{$(input).off(eventName,ev)}}delete input.inputmask.events[eventName]})}}};var EventHandlers={keydownEvent:function(e){var input=this,$input=$(input),k=e.keyCode,pos=caret(input);if(k===Inputmask.keyCode.BACKSPACE||k===Inputmask.keyCode.DELETE||iphone&&k===Inputmask.keyCode.BACKSPACE_SAFARI||e.ctrlKey&&k===Inputmask.keyCode.X&&!isInputEventSupported("cut")){e.preventDefault();handleRemove(input,k,pos);writeBuffer(input,getBuffer(true),getMaskSet().p,e,input.inputmask._valueGet()!==getBuffer().join(""))}else if(k===Inputmask.keyCode.END||k===Inputmask.keyCode.PAGE_DOWN){e.preventDefault();var caretPos=seekNext(getLastValidPosition());caret(input,e.shiftKey?pos.begin:caretPos,caretPos,true)}else if(k===Inputmask.keyCode.HOME&&!e.shiftKey||k===Inputmask.keyCode.PAGE_UP){e.preventDefault();caret(input,0,e.shiftKey?pos.begin:0,true)}else if((opts.undoOnEscape&&k===Inputmask.keyCode.ESCAPE||k===90&&e.ctrlKey)&&e.altKey!==true){checkVal(input,true,false,undoValue.split(""));$input.trigger("click")}else if(k===Inputmask.keyCode.INSERT&&!(e.shiftKey||e.ctrlKey)){opts.insertMode=!opts.insertMode;input.setAttribute("im-insert",opts.insertMode)}else if(opts.tabThrough===true&&k===Inputmask.keyCode.TAB){if(e.shiftKey===true){if(getTest(pos.begin).match.fn===null){pos.begin=seekNext(pos.begin)}pos.end=seekPrevious(pos.begin,true);pos.begin=seekPrevious(pos.end,true)}else{pos.begin=seekNext(pos.begin,true);pos.end=seekNext(pos.begin,true);if(pos.end<getMaskSet().maskLength)pos.end--}if(pos.begin<getMaskSet().maskLength){e.preventDefault();caret(input,pos.begin,pos.end)}}opts.onKeyDown.call(this,e,getBuffer(),caret(input).begin,opts);ignorable=$.inArray(k,opts.ignorables)!==-1},keypressEvent:function(e,checkval,writeOut,strict,ndx){var input=this,$input=$(input),k=e.which||e.charCode||e.keyCode;if(checkval!==true&&(!(e.ctrlKey&&e.altKey)&&(e.ctrlKey||e.metaKey||ignorable))){if(k===Inputmask.keyCode.ENTER&&undoValue!==getBuffer().join("")){undoValue=getBuffer().join("");setTimeout(function(){$input.trigger("change")},0)}return true}else{if(k){if(k===46&&e.shiftKey===false&&opts.radixPoint!=="")k=opts.radixPoint.charCodeAt(0);var pos=checkval?{begin:ndx,end:ndx}:caret(input),forwardPosition,c=String.fromCharCode(k),offset=0;if(opts._radixDance&&opts.numericInput){var caretPos=getBuffer().indexOf(opts.radixPoint.charAt(0))+1;if(pos.begin<=caretPos){if(k===opts.radixPoint.charCodeAt(0))offset=1;pos.begin-=1;pos.end-=1}}getMaskSet().writeOutBuffer=true;var valResult=isValid(pos,c,strict);if(valResult!==false){resetMaskSet(true);forwardPosition=valResult.caret!==undefined?valResult.caret:seekNext(valResult.pos.begin?valResult.pos.begin:valResult.pos);getMaskSet().p=forwardPosition}forwardPosition=(opts.numericInput&&valResult.caret===undefined?seekPrevious(forwardPosition):forwardPosition)+offset;if(writeOut!==false){setTimeout(function(){opts.onKeyValidation.call(input,k,valResult,opts)},0);if(getMaskSet().writeOutBuffer&&valResult!==false){var buffer=getBuffer();writeBuffer(input,buffer,forwardPosition,e,checkval!==true)}}e.preventDefault();if(checkval){if(valResult!==false)valResult.forwardPosition=forwardPosition;return valResult}}}},pasteEvent:function(e){var input=this,ev=e.originalEvent||e,$input=$(input),inputValue=input.inputmask._valueGet(true),caretPos=caret(input),tempValue;if(isRTL){tempValue=caretPos.end;caretPos.end=caretPos.begin;caretPos.begin=tempValue}var valueBeforeCaret=inputValue.substr(0,caretPos.begin),valueAfterCaret=inputValue.substr(caretPos.end,inputValue.length);if(valueBeforeCaret===(isRTL?getBufferTemplate().reverse():getBufferTemplate()).slice(0,caretPos.begin).join(""))valueBeforeCaret="";if(valueAfterCaret===(isRTL?getBufferTemplate().reverse():getBufferTemplate()).slice(caretPos.end).join(""))valueAfterCaret="";if(window.clipboardData&&window.clipboardData.getData){inputValue=valueBeforeCaret+window.clipboardData.getData("Text")+valueAfterCaret}else if(ev.clipboardData&&ev.clipboardData.getData){inputValue=valueBeforeCaret+ev.clipboardData.getData("text/plain")+valueAfterCaret}else return true;var pasteValue=inputValue;if($.isFunction(opts.onBeforePaste)){pasteValue=opts.onBeforePaste.call(inputmask,inputValue,opts);if(pasteValue===false){return e.preventDefault()}if(!pasteValue){pasteValue=inputValue}}checkVal(input,false,false,pasteValue.toString().split(""));writeBuffer(input,getBuffer(),seekNext(getLastValidPosition()),e,undoValue!==getBuffer().join(""));return e.preventDefault()},inputFallBackEvent:function(e){function radixPointHandler(input,inputValue,caretPos){if(inputValue.charAt(caretPos.begin-1)==="."&&opts.radixPoint!==""){inputValue=inputValue.split("");inputValue[caretPos.begin-1]=opts.radixPoint.charAt(0);inputValue=inputValue.join("")}return inputValue}function ieMobileHandler(input,inputValue,caretPos){if(iemobile){var inputChar=inputValue.replace(getBuffer().join(""),"");if(inputChar.length===1){var iv=inputValue.split("");iv.splice(caretPos.begin,0,inputChar);inputValue=iv.join("")}}return inputValue}var input=this,inputValue=input.inputmask._valueGet();if(getBuffer().join("")!==inputValue){var caretPos=caret(input);inputValue=radixPointHandler(input,inputValue,caretPos);inputValue=ieMobileHandler(input,inputValue,caretPos);if(getBuffer().join("")!==inputValue){var buffer=getBuffer().join(""),offset=!opts.numericInput&&inputValue.length>buffer.length?-1:0,frontPart=inputValue.substr(0,caretPos.begin),backPart=inputValue.substr(caretPos.begin),frontBufferPart=buffer.substr(0,caretPos.begin+offset),backBufferPart=buffer.substr(caretPos.begin+offset);var selection=caretPos,entries="",isEntry=false;if(frontPart!==frontBufferPart){var fpl=(isEntry=frontPart.length>=frontBufferPart.length)?frontPart.length:frontBufferPart.length,i;for(i=0;frontPart.charAt(i)===frontBufferPart.charAt(i)&&i<fpl;i++);if(isEntry){selection.begin=i-offset;entries+=frontPart.slice(i,selection.end)}}if(backPart!==backBufferPart){if(backPart.length>backBufferPart.length){entries+=backPart.slice(0,1)}else{if(backPart.length<backBufferPart.length){selection.end+=backBufferPart.length-backPart.length;if(!isEntry&&opts.radixPoint!==""&&backPart===""&&frontPart.charAt(selection.begin+offset-1)===opts.radixPoint){selection.begin--;entries=opts.radixPoint}}}}writeBuffer(input,getBuffer(),{begin:selection.begin+offset,end:selection.end+offset});if(entries.length>0){$.each(entries.split(""),function(ndx,entry){var keypress=new $.Event("keypress");keypress.which=entry.charCodeAt(0);ignorable=false;EventHandlers.keypressEvent.call(input,keypress)})}else{if(selection.begin===selection.end-1){selection.begin=seekPrevious(selection.begin+1);if(selection.begin===selection.end-1){caret(input,selection.begin)}else{caret(input,selection.begin,selection.end)}}var keydown=new $.Event("keydown");keydown.keyCode=opts.numericInput?Inputmask.keyCode.BACKSPACE:Inputmask.keyCode.DELETE;EventHandlers.keydownEvent.call(input,keydown)}e.preventDefault()}}},beforeInputEvent:function(e){if(e.cancelable){var input=this;switch(e.inputType){case"insertText":$.each(e.data.split(""),function(ndx,entry){var keypress=new $.Event("keypress");keypress.which=entry.charCodeAt(0);ignorable=false;EventHandlers.keypressEvent.call(input,keypress)});return e.preventDefault();case"deleteContentBackward":var keydown=new $.Event("keydown");keydown.keyCode=Inputmask.keyCode.BACKSPACE;EventHandlers.keydownEvent.call(input,keydown);return e.preventDefault();case"deleteContentForward":var keydown=new $.Event("keydown");keydown.keyCode=Inputmask.keyCode.DELETE;EventHandlers.keydownEvent.call(input,keydown);return e.preventDefault()}}},setValueEvent:function(e){this.inputmask.refreshValue=false;var input=this,value=e&&e.detail?e.detail[0]:arguments[1],value=value||input.inputmask._valueGet(true);if($.isFunction(opts.onBeforeMask))value=opts.onBeforeMask.call(inputmask,value,opts)||value;value=value.toString().split("");checkVal(input,true,false,value);undoValue=getBuffer().join("");if((opts.clearMaskOnLostFocus||opts.clearIncomplete)&&input.inputmask._valueGet()===getBufferTemplate().join("")){input.inputmask._valueSet("")}},focusEvent:function(e){var input=this,nptValue=input.inputmask._valueGet();if(opts.showMaskOnFocus){if(nptValue!==getBuffer().join("")){writeBuffer(input,getBuffer(),seekNext(getLastValidPosition()))}else if(mouseEnter===false){caret(input,seekNext(getLastValidPosition()))}}if(opts.positionCaretOnTab===true&&mouseEnter===false){EventHandlers.clickEvent.apply(input,[e,true])}undoValue=getBuffer().join("")},mouseleaveEvent:function(e){var input=this;mouseEnter=false;if(opts.clearMaskOnLostFocus&&document.activeElement!==input){HandleNativePlaceholder(input,originalPlaceholder)}},clickEvent:function(e,tabbed){function doRadixFocus(clickPos){if(opts.radixPoint!==""){var vps=getMaskSet().validPositions;if(vps[clickPos]===undefined||vps[clickPos].input===getPlaceholder(clickPos)){if(clickPos<seekNext(-1))return true;var radixPos=$.inArray(opts.radixPoint,getBuffer());if(radixPos!==-1){for(var vp in vps){if(radixPos<vp&&vps[vp].input!==getPlaceholder(vp)){return false}}return true}}}return false}var input=this;setTimeout(function(){if(document.activeElement===input){var selectedCaret=caret(input);if(tabbed){if(isRTL){selectedCaret.end=selectedCaret.begin}else{selectedCaret.begin=selectedCaret.end}}if(selectedCaret.begin===selectedCaret.end){switch(opts.positionCaretOnClick){case"none":break;case"select":caret(input,0,getBuffer().length);break;case"ignore":caret(input,seekNext(getLastValidPosition()));break;case"radixFocus":if(doRadixFocus(selectedCaret.begin)){var radixPos=getBuffer().join("").indexOf(opts.radixPoint);caret(input,opts.numericInput?seekNext(radixPos):radixPos);break}default:var clickPosition=selectedCaret.begin,lvclickPosition=getLastValidPosition(clickPosition,true),lastPosition=seekNext(lvclickPosition);if(clickPosition<lastPosition){caret(input,!isMask(clickPosition,true)&&!isMask(clickPosition-1,true)?seekNext(clickPosition):clickPosition)}else{var lvp=getMaskSet().validPositions[lvclickPosition],tt=getTestTemplate(lastPosition,lvp?lvp.match.locator:undefined,lvp),placeholder=getPlaceholder(lastPosition,tt.match);if(placeholder!==""&&getBuffer()[lastPosition]!==placeholder&&tt.match.optionalQuantifier!==true&&tt.match.newBlockMarker!==true||!isMask(lastPosition,opts.keepStatic)&&tt.match.def===placeholder){var newPos=seekNext(lastPosition);if(clickPosition>=newPos||clickPosition===lastPosition){lastPosition=newPos}}caret(input,lastPosition)}break}}}},0)},cutEvent:function(e){var input=this,$input=$(input),pos=caret(input),ev=e.originalEvent||e;var clipboardData=window.clipboardData||ev.clipboardData,clipData=isRTL?getBuffer().slice(pos.end,pos.begin):getBuffer().slice(pos.begin,pos.end);clipboardData.setData("text",isRTL?clipData.reverse().join(""):clipData.join(""));if(document.execCommand)document.execCommand("copy");handleRemove(input,Inputmask.keyCode.DELETE,pos);writeBuffer(input,getBuffer(),getMaskSet().p,e,undoValue!==getBuffer().join(""))},blurEvent:function(e){var $input=$(this),input=this;if(input.inputmask){HandleNativePlaceholder(input,originalPlaceholder);var nptValue=input.inputmask._valueGet(),buffer=getBuffer().slice();if(nptValue!==""||colorMask!==undefined){if(opts.clearMaskOnLostFocus){if(getLastValidPosition()===-1&&nptValue===getBufferTemplate().join("")){buffer=[]}else{clearOptionalTail(buffer)}}if(isComplete(buffer)===false){setTimeout(function(){$input.trigger("incomplete")},0);if(opts.clearIncomplete){resetMaskSet();if(opts.clearMaskOnLostFocus){buffer=[]}else{buffer=getBufferTemplate().slice()}}}writeBuffer(input,buffer,undefined,e)}if(undoValue!==getBuffer().join("")){undoValue=buffer.join("");$input.trigger("change")}}},mouseenterEvent:function(e){var input=this;mouseEnter=true;if(document.activeElement!==input&&opts.showMaskOnHover){HandleNativePlaceholder(input,(isRTL?getBuffer().slice().reverse():getBuffer()).join(""))}},submitEvent:function(e){if(undoValue!==getBuffer().join("")){$el.trigger("change")}if(opts.clearMaskOnLostFocus&&getLastValidPosition()===-1&&el.inputmask._valueGet&&el.inputmask._valueGet()===getBufferTemplate().join("")){el.inputmask._valueSet("")}if(opts.clearIncomplete&&isComplete(getBuffer())===false){el.inputmask._valueSet("")}if(opts.removeMaskOnSubmit){el.inputmask._valueSet(el.inputmask.unmaskedvalue(),true);setTimeout(function(){writeBuffer(el,getBuffer())},0)}},resetEvent:function(e){el.inputmask.refreshValue=true;setTimeout(function(){$el.trigger("setvalue")},0)}};function checkVal(input,writeOut,strict,nptvl,initiatingEvent){var inputmask=this||input.inputmask,inputValue=nptvl.slice(),charCodes="",initialNdx=-1,result=undefined;function isTemplateMatch(ndx,charCodes){var charCodeNdx=getMaskTemplate(true,0,false).slice(ndx,seekNext(ndx)).join("").replace(/'/g,"").indexOf(charCodes);return charCodeNdx!==-1&&!isMask(ndx)&&(getTest(ndx).match.nativeDef===charCodes.charAt(0)||getTest(ndx).match.fn===null&&getTest(ndx).match.nativeDef==="'"+charCodes.charAt(0)||getTest(ndx).match.nativeDef===" "&&(getTest(ndx+1).match.nativeDef===charCodes.charAt(0)||getTest(ndx+1).match.fn===null&&getTest(ndx+1).match.nativeDef==="'"+charCodes.charAt(0)))}resetMaskSet();if(!strict&&opts.autoUnmask!==true){var staticInput=getBufferTemplate().slice(0,seekNext(-1)).join(""),matches=inputValue.join("").match(new RegExp("^"+Inputmask.escapeRegex(staticInput),"g"));if(matches&&matches.length>0){inputValue.splice(0,matches.length*staticInput.length);initialNdx=seekNext(initialNdx)}}else{initialNdx=seekNext(initialNdx)}if(initialNdx===-1){getMaskSet().p=seekNext(initialNdx);initialNdx=0}else getMaskSet().p=initialNdx;inputmask.caretPos={begin:initialNdx};$.each(inputValue,function(ndx,charCode){if(charCode!==undefined){if(getMaskSet().validPositions[ndx]===undefined&&inputValue[ndx]===getPlaceholder(ndx)&&isMask(ndx,true)&&isValid(ndx,inputValue[ndx],true,undefined,undefined,true)===false){getMaskSet().p++}else{var keypress=new $.Event("_checkval");keypress.which=charCode.charCodeAt(0);charCodes+=charCode;var lvp=getLastValidPosition(undefined,true);if(!isTemplateMatch(initialNdx,charCodes)){result=EventHandlers.keypressEvent.call(input,keypress,true,false,strict,inputmask.caretPos.begin);if(result){initialNdx=inputmask.caretPos.begin+1;charCodes=""}}else{result=EventHandlers.keypressEvent.call(input,keypress,true,false,strict,lvp+1)}if(result){writeBuffer(undefined,getBuffer(),result.forwardPosition,keypress,false);inputmask.caretPos={begin:result.forwardPosition,end:result.forwardPosition}}}}});if(writeOut)writeBuffer(input,getBuffer(),result?result.forwardPosition:undefined,initiatingEvent||new $.Event("checkval"),initiatingEvent&&initiatingEvent.type==="input")}function unmaskedvalue(input){if(input){if(input.inputmask===undefined){return input.value}if(input.inputmask&&input.inputmask.refreshValue){EventHandlers.setValueEvent.call(input)}}var umValue=[],vps=getMaskSet().validPositions;for(var pndx in vps){if(vps[pndx].match&&vps[pndx].match.fn!=null){umValue.push(vps[pndx].input)}}var unmaskedValue=umValue.length===0?"":(isRTL?umValue.reverse():umValue).join("");if($.isFunction(opts.onUnMask)){var bufferValue=(isRTL?getBuffer().slice().reverse():getBuffer()).join("");unmaskedValue=opts.onUnMask.call(inputmask,bufferValue,unmaskedValue,opts)}return unmaskedValue}function caret(input,begin,end,notranslate){function translatePosition(pos){if(isRTL&&typeof pos==="number"&&(!opts.greedy||opts.placeholder!=="")&&el){pos=el.inputmask._valueGet().length-pos}return pos}var range;if(begin!==undefined){if($.isArray(begin)){end=isRTL?begin[0]:begin[1];begin=isRTL?begin[1]:begin[0]}if(begin.begin!==undefined){end=isRTL?begin.begin:begin.end;begin=isRTL?begin.end:begin.begin}if(typeof begin==="number"){begin=notranslate?begin:translatePosition(begin);end=notranslate?end:translatePosition(end);end=typeof end=="number"?end:begin;var scrollCalc=parseInt(((input.ownerDocument.defaultView||window).getComputedStyle?(input.ownerDocument.defaultView||window).getComputedStyle(input,null):input.currentStyle).fontSize)*end;input.scrollLeft=scrollCalc>input.scrollWidth?scrollCalc:0;input.inputmask.caretPos={begin:begin,end:end};if(input===document.activeElement){if("selectionStart"in input){input.selectionStart=begin;input.selectionEnd=end}else if(window.getSelection){range=document.createRange();if(input.firstChild===undefined||input.firstChild===null){var textNode=document.createTextNode("");input.appendChild(textNode)}range.setStart(input.firstChild,begin<input.inputmask._valueGet().length?begin:input.inputmask._valueGet().length);range.setEnd(input.firstChild,end<input.inputmask._valueGet().length?end:input.inputmask._valueGet().length);range.collapse(true);var sel=window.getSelection();sel.removeAllRanges();sel.addRange(range)}else if(input.createTextRange){range=input.createTextRange();range.collapse(true);range.moveEnd("character",end);range.moveStart("character",begin);range.select()}renderColorMask(input,{begin:begin,end:end})}}}else{if("selectionStart"in input){begin=input.selectionStart;end=input.selectionEnd}else if(window.getSelection){range=window.getSelection().getRangeAt(0);if(range.commonAncestorContainer.parentNode===input||range.commonAncestorContainer===input){begin=range.startOffset;end=range.endOffset}}else if(document.selection&&document.selection.createRange){range=document.selection.createRange();begin=0-range.duplicate().moveStart("character",-input.inputmask._valueGet().length);end=begin+range.text.length}return{begin:notranslate?begin:translatePosition(begin),end:notranslate?end:translatePosition(end)}}}function determineLastRequiredPosition(returnDefinition){var buffer=getMaskTemplate(true,getLastValidPosition(),true,true),bl=buffer.length,pos,lvp=getLastValidPosition(),positions={},lvTest=getMaskSet().validPositions[lvp],ndxIntlzr=lvTest!==undefined?lvTest.locator.slice():undefined,testPos;for(pos=lvp+1;pos<buffer.length;pos++){testPos=getTestTemplate(pos,ndxIntlzr,pos-1);ndxIntlzr=testPos.locator.slice();positions[pos]=$.extend(true,{},testPos)}var lvTestAlt=lvTest&&lvTest.alternation!==undefined?lvTest.locator[lvTest.alternation]:undefined;for(pos=bl-1;pos>lvp;pos--){testPos=positions[pos];if((testPos.match.optionality||testPos.match.optionalQuantifier&&testPos.match.newBlockMarker||lvTestAlt&&(lvTestAlt!==positions[pos].locator[lvTest.alternation]&&testPos.match.fn!=null||testPos.match.fn===null&&testPos.locator[lvTest.alternation]&&checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","),lvTestAlt.toString().split(","))&&getTests(pos)[0].def!==""))&&buffer[pos]===getPlaceholder(pos,testPos.match)){bl--}else break}return returnDefinition?{l:bl,def:positions[bl]?positions[bl].match:undefined}:bl}function clearOptionalTail(buffer){buffer.length=0;var template=getMaskTemplate(true,0,true,undefined,true),lmnt,validPos;while(lmnt=template.shift(),lmnt!==undefined)buffer.push(lmnt);return buffer}function isComplete(buffer){if($.isFunction(opts.isComplete))return opts.isComplete(buffer,opts);if(opts.repeat==="*")return undefined;var complete=false,lrp=determineLastRequiredPosition(true),aml=seekPrevious(lrp.l);if(lrp.def===undefined||lrp.def.newBlockMarker||lrp.def.optionality||lrp.def.optionalQuantifier){complete=true;for(var i=0;i<=aml;i++){var test=getTestTemplate(i).match;if(test.fn!==null&&getMaskSet().validPositions[i]===undefined&&test.optionality!==true&&test.optionalQuantifier!==true||test.fn===null&&buffer[i]!==getPlaceholder(i,test)){complete=false;break}}}return complete}function handleRemove(input,k,pos,strict,fromIsValid){if(opts.numericInput||isRTL){if(k===Inputmask.keyCode.BACKSPACE){k=Inputmask.keyCode.DELETE}else if(k===Inputmask.keyCode.DELETE){k=Inputmask.keyCode.BACKSPACE}if(isRTL){var pend=pos.end;pos.end=pos.begin;pos.begin=pend}}if(k===Inputmask.keyCode.BACKSPACE&&pos.end-pos.begin<1){pos.begin=seekPrevious(pos.begin);if(getMaskSet().validPositions[pos.begin]!==undefined&&getMaskSet().validPositions[pos.begin].input===opts.groupSeparator){pos.begin--}}else if(k===Inputmask.keyCode.DELETE&&pos.begin===pos.end){pos.end=isMask(pos.end,true)&&(getMaskSet().validPositions[pos.end]&&getMaskSet().validPositions[pos.end].input!==opts.radixPoint)?pos.end+1:seekNext(pos.end)+1;if(getMaskSet().validPositions[pos.begin]!==undefined&&getMaskSet().validPositions[pos.begin].input===opts.groupSeparator){pos.end++}}revalidateMask(pos);if(strict!==true&&opts.keepStatic!==false||opts.regex!==null){var result=alternate(true);if(result){var newPos=result.caret!==undefined?result.caret:result.pos?seekNext(result.pos.begin?result.pos.begin:result.pos):getLastValidPosition(-1,true);if(k!==Inputmask.keyCode.DELETE||pos.begin>newPos){pos.begin==newPos}}}var lvp=getLastValidPosition(pos.begin,true);if(lvp<pos.begin||pos.begin===-1){getMaskSet().p=seekNext(lvp)}else if(strict!==true){getMaskSet().p=pos.begin;if(fromIsValid!==true){while(getMaskSet().p<lvp&&getMaskSet().validPositions[getMaskSet().p]===undefined){getMaskSet().p++}}}}function initializeColorMask(input){var computedStyle=(input.ownerDocument.defaultView||window).getComputedStyle(input,null);function findCaretPos(clientx){var e=document.createElement("span"),caretPos;for(var style in computedStyle){if(isNaN(style)&&style.indexOf("font")!==-1){e.style[style]=computedStyle[style]}}e.style.textTransform=computedStyle.textTransform;e.style.letterSpacing=computedStyle.letterSpacing;e.style.position="absolute";e.style.height="auto";e.style.width="auto";e.style.visibility="hidden";e.style.whiteSpace="nowrap";document.body.appendChild(e);var inputText=input.inputmask._valueGet(),previousWidth=0,itl;for(caretPos=0,itl=inputText.length;caretPos<=itl;caretPos++){e.innerHTML+=inputText.charAt(caretPos)||"_";if(e.offsetWidth>=clientx){var offset1=clientx-previousWidth;var offset2=e.offsetWidth-clientx;e.innerHTML=inputText.charAt(caretPos);offset1-=e.offsetWidth/3;caretPos=offset1<offset2?caretPos-1:caretPos;break}previousWidth=e.offsetWidth}document.body.removeChild(e);return caretPos}var template=document.createElement("div");template.style.width=computedStyle.width;template.style.textAlign=computedStyle.textAlign;colorMask=document.createElement("div");input.inputmask.colorMask=colorMask;colorMask.className="im-colormask";input.parentNode.insertBefore(colorMask,input);input.parentNode.removeChild(input);colorMask.appendChild(input);colorMask.appendChild(template);input.style.left=template.offsetLeft+"px";$(colorMask).on("mouseleave",function(e){return EventHandlers.mouseleaveEvent.call(input,[e])});$(colorMask).on("mouseenter",function(e){return EventHandlers.mouseenterEvent.call(input,[e])});$(colorMask).on("click",function(e){caret(input,findCaretPos(e.clientX));return EventHandlers.clickEvent.call(input,[e])})}function renderColorMask(input,caretPos,clear){var maskTemplate=[],isStatic=false,test,testPos,ndxIntlzr,pos=0;function setEntry(entry){if(entry===undefined)entry="";if(!isStatic&&(test.fn===null||testPos.input===undefined)){isStatic=true;maskTemplate.push("<span class='im-static'>"+entry)}else if(isStatic&&(test.fn!==null&&testPos.input!==undefined||test.def==="")){isStatic=false;var mtl=maskTemplate.length;maskTemplate[mtl-1]=maskTemplate[mtl-1]+"</span>";maskTemplate.push(entry)}else maskTemplate.push(entry)}function setCaret(){if(document.activeElement===input){maskTemplate.splice(caretPos.begin,0,caretPos.begin===caretPos.end||caretPos.end>getMaskSet().maskLength?'<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">':'<mark class="im-caret-select">');maskTemplate.splice(caretPos.end+1,0,"</mark>")}}if(colorMask!==undefined){var buffer=getBuffer();if(caretPos===undefined){caretPos=caret(input)}else if(caretPos.begin===undefined){caretPos={begin:caretPos,end:caretPos}}if(clear!==true){var lvp=getLastValidPosition();do{if(getMaskSet().validPositions[pos]){testPos=getMaskSet().validPositions[pos];test=testPos.match;ndxIntlzr=testPos.locator.slice();setEntry(buffer[pos])}else{testPos=getTestTemplate(pos,ndxIntlzr,pos-1);test=testPos.match;ndxIntlzr=testPos.locator.slice();if(opts.jitMasking===false||pos<lvp||typeof opts.jitMasking==="number"&&isFinite(opts.jitMasking)&&opts.jitMasking>pos){setEntry(getPlaceholder(pos,test))}else isStatic=false}pos++}while((maxLength===undefined||pos<maxLength)&&(test.fn!==null||test.def!=="")||lvp>pos||isStatic);if(isStatic)setEntry();setCaret()}var template=colorMask.getElementsByTagName("div")[0];template.innerHTML=maskTemplate.join("");input.inputmask.positionColorMask(input,template)}}function mask(elem){function isElementTypeSupported(input,opts){function patchValueProperty(npt){var valueGet;var valueSet;function patchValhook(type){if($.valHooks&&($.valHooks[type]===undefined||$.valHooks[type].inputmaskpatch!==true)){var valhookGet=$.valHooks[type]&&$.valHooks[type].get?$.valHooks[type].get:function(elem){return elem.value};var valhookSet=$.valHooks[type]&&$.valHooks[type].set?$.valHooks[type].set:function(elem,value){elem.value=value;return elem};$.valHooks[type]={get:function(elem){if(elem.inputmask){if(elem.inputmask.opts.autoUnmask){return elem.inputmask.unmaskedvalue()}else{var result=valhookGet(elem);return getLastValidPosition(undefined,undefined,elem.inputmask.maskset.validPositions)!==-1||opts.nullable!==true?result:""}}else return valhookGet(elem)},set:function(elem,value){var $elem=$(elem),result;result=valhookSet(elem,value);if(elem.inputmask){$elem.trigger("setvalue",[value])}return result},inputmaskpatch:true}}}function getter(){if(this.inputmask){return this.inputmask.opts.autoUnmask?this.inputmask.unmaskedvalue():getLastValidPosition()!==-1||opts.nullable!==true?document.activeElement===this&&opts.clearMaskOnLostFocus?(isRTL?clearOptionalTail(getBuffer().slice()).reverse():clearOptionalTail(getBuffer().slice())).join(""):valueGet.call(this):""}else return valueGet.call(this)}function setter(value){valueSet.call(this,value);if(this.inputmask){$(this).trigger("setvalue",[value])}}function installNativeValueSetFallback(npt){EventRuler.on(npt,"mouseenter",function(event){var $input=$(this),input=this,value=input.inputmask._valueGet();if(value!==getBuffer().join("")){$input.trigger("setvalue")}})}if(!npt.inputmask.__valueGet){if(opts.noValuePatching!==true){if(Object.getOwnPropertyDescriptor){if(typeof Object.getPrototypeOf!=="function"){Object.getPrototypeOf=typeof"test".__proto__==="object"?function(object){return object.__proto__}:function(object){return object.constructor.prototype}}var valueProperty=Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt),"value"):undefined;if(valueProperty&&valueProperty.get&&valueProperty.set){valueGet=valueProperty.get;valueSet=valueProperty.set;Object.defineProperty(npt,"value",{get:getter,set:setter,configurable:true})}else if(npt.tagName!=="INPUT"){valueGet=function(){return this.textContent};valueSet=function(value){this.textContent=value};Object.defineProperty(npt,"value",{get:getter,set:setter,configurable:true})}}else if(document.__lookupGetter__&&npt.__lookupGetter__("value")){valueGet=npt.__lookupGetter__("value");valueSet=npt.__lookupSetter__("value");npt.__defineGetter__("value",getter);npt.__defineSetter__("value",setter)}npt.inputmask.__valueGet=valueGet;npt.inputmask.__valueSet=valueSet}npt.inputmask._valueGet=function(overruleRTL){return isRTL&&overruleRTL!==true?valueGet.call(this.el).split("").reverse().join(""):valueGet.call(this.el)};npt.inputmask._valueSet=function(value,overruleRTL){valueSet.call(this.el,value===null||value===undefined?"":overruleRTL!==true&&isRTL?value.split("").reverse().join(""):value)};if(valueGet===undefined){valueGet=function(){return this.value};valueSet=function(value){this.value=value};patchValhook(npt.type);installNativeValueSetFallback(npt)}}}var elementType=input.getAttribute("type");var isSupported=input.tagName==="INPUT"&&$.inArray(elementType,opts.supportsInputType)!==-1||input.isContentEditable||input.tagName==="TEXTAREA";if(!isSupported){if(input.tagName==="INPUT"){var el=document.createElement("input");el.setAttribute("type",elementType);isSupported=el.type==="text";el=null}else isSupported="partial"}if(isSupported!==false){patchValueProperty(input)}else input.inputmask=undefined;return isSupported}EventRuler.off(elem);var isSupported=isElementTypeSupported(elem,opts);if(isSupported!==false){el=elem;$el=$(el);originalPlaceholder=el.placeholder;maxLength=el!==undefined?el.maxLength:undefined;if(maxLength===-1)maxLength=undefined;if(opts.colorMask===true){initializeColorMask(el)}if(mobile){if("inputMode"in el){el.inputmode=opts.inputmode;el.setAttribute("inputmode",opts.inputmode)}if(opts.disablePredictiveText===true){if("autocorrect"in el){el.autocorrect=false}else{if(opts.colorMask!==true){initializeColorMask(el)}el.type="password"}}}if(isSupported===true){el.setAttribute("im-insert",opts.insertMode);EventRuler.on(el,"submit",EventHandlers.submitEvent);EventRuler.on(el,"reset",EventHandlers.resetEvent);EventRuler.on(el,"blur",EventHandlers.blurEvent);EventRuler.on(el,"focus",EventHandlers.focusEvent);if(opts.colorMask!==true){EventRuler.on(el,"click",EventHandlers.clickEvent);EventRuler.on(el,"mouseleave",EventHandlers.mouseleaveEvent);EventRuler.on(el,"mouseenter",EventHandlers.mouseenterEvent)}EventRuler.on(el,"paste",EventHandlers.pasteEvent);EventRuler.on(el,"cut",EventHandlers.cutEvent);EventRuler.on(el,"complete",opts.oncomplete);EventRuler.on(el,"incomplete",opts.onincomplete);EventRuler.on(el,"cleared",opts.oncleared);if(!mobile&&opts.inputEventOnly!==true){EventRuler.on(el,"keydown",EventHandlers.keydownEvent);EventRuler.on(el,"keypress",EventHandlers.keypressEvent)}else{el.removeAttribute("maxLength")}EventRuler.on(el,"input",EventHandlers.inputFallBackEvent);EventRuler.on(el,"beforeinput",EventHandlers.beforeInputEvent)}EventRuler.on(el,"setvalue",EventHandlers.setValueEvent);undoValue=getBufferTemplate().join("");if(el.inputmask._valueGet(true)!==""||opts.clearMaskOnLostFocus===false||document.activeElement===el){var initialValue=$.isFunction(opts.onBeforeMask)?opts.onBeforeMask.call(inputmask,el.inputmask._valueGet(true),opts)||el.inputmask._valueGet(true):el.inputmask._valueGet(true);if(initialValue!=="")checkVal(el,true,false,initialValue.split(""));var buffer=getBuffer().slice();undoValue=buffer.join("");if(isComplete(buffer)===false){if(opts.clearIncomplete){resetMaskSet()}}if(opts.clearMaskOnLostFocus&&document.activeElement!==el){if(getLastValidPosition()===-1){buffer=[]}else{clearOptionalTail(buffer)}}if(opts.clearMaskOnLostFocus===false||opts.showMaskOnFocus&&document.activeElement===el||el.inputmask._valueGet(true)!=="")writeBuffer(el,buffer);if(document.activeElement===el){caret(el,seekNext(getLastValidPosition()))}}}}var valueBuffer;if(actionObj!==undefined){switch(actionObj.action){case"isComplete":el=actionObj.el;return isComplete(getBuffer());case"unmaskedvalue":if(el===undefined||actionObj.value!==undefined){valueBuffer=actionObj.value;valueBuffer=($.isFunction(opts.onBeforeMask)?opts.onBeforeMask.call(inputmask,valueBuffer,opts)||valueBuffer:valueBuffer).split("");checkVal.call(this,undefined,false,false,valueBuffer);if($.isFunction(opts.onBeforeWrite))opts.onBeforeWrite.call(inputmask,undefined,getBuffer(),0,opts)}return unmaskedvalue(el);case"mask":mask(el);break;case"format":valueBuffer=($.isFunction(opts.onBeforeMask)?opts.onBeforeMask.call(inputmask,actionObj.value,opts)||actionObj.value:actionObj.value).split("");checkVal.call(this,undefined,true,false,valueBuffer);if(actionObj.metadata){return{value:isRTL?getBuffer().slice().reverse().join(""):getBuffer().join(""),metadata:maskScope.call(this,{action:"getmetadata"},maskset,opts)}}return isRTL?getBuffer().slice().reverse().join(""):getBuffer().join("");case"isValid":if(actionObj.value){valueBuffer=actionObj.value.split("");checkVal.call(this,undefined,true,true,valueBuffer)}else{actionObj.value=getBuffer().join("")}var buffer=getBuffer();var rl=determineLastRequiredPosition(),lmib=buffer.length-1;for(;lmib>rl;lmib--){if(isMask(lmib))break}buffer.splice(rl,lmib+1-rl);return isComplete(buffer)&&actionObj.value===getBuffer().join("");case"getemptymask":return getBufferTemplate().join("");case"remove":if(el&&el.inputmask){$.data(el,"_inputmask_opts",null);$el=$(el);el.inputmask._valueSet(opts.autoUnmask?unmaskedvalue(el):el.inputmask._valueGet(true));EventRuler.off(el);if(el.inputmask.colorMask){colorMask=el.inputmask.colorMask;colorMask.removeChild(el);colorMask.parentNode.insertBefore(el,colorMask);colorMask.parentNode.removeChild(colorMask)}var valueProperty;if(Object.getOwnPropertyDescriptor&&Object.getPrototypeOf){valueProperty=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el),"value");if(valueProperty){if(el.inputmask.__valueGet){Object.defineProperty(el,"value",{get:el.inputmask.__valueGet,set:el.inputmask.__valueSet,configurable:true})}}}else if(document.__lookupGetter__&&el.__lookupGetter__("value")){if(el.inputmask.__valueGet){el.__defineGetter__("value",el.inputmask.__valueGet);el.__defineSetter__("value",el.inputmask.__valueSet)}}el.inputmask=undefined}return el;break;case"getmetadata":if($.isArray(maskset.metadata)){var maskTarget=getMaskTemplate(true,0,false).join("");$.each(maskset.metadata,function(ndx,mtdt){if(mtdt.mask===maskTarget){maskTarget=mtdt;return false}});return maskTarget}return maskset.metadata}}}return Inputmask});
!function (e) { "use strict"; "function" == typeof define && define.amd ? define(["jquery"], e) : "undefined" != typeof module && module.exports ? module.exports = e(require("jquery")) : e(jQuery) }(function (e, t) { "use strict"; if (!e.jstree) { var r = 0, i = !1, s = !1, a = !1, n = [], o = e("script:last").attr("src"), d = window.document; e.jstree = { version: "3.3.8", defaults: { plugins: [] }, plugins: {}, path: o && -1 !== o.indexOf("/") ? o.replace(/\/[^\/]+$/, "") : "", idregex: /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g, root: "#" }, e.jstree.create = function (t, i) { var s = new e.jstree.core(++r), a = i; return i = e.extend(!0, {}, e.jstree.defaults, i), a && a.plugins && (i.plugins = a.plugins), e.each(i.plugins, function (e, t) { "core" !== e && (s = s.plugin(t, i[t])) }), e(t).data("jstree", s), s.init(t, i), s }, e.jstree.destroy = function () { e(".jstree:jstree").jstree("destroy"), e(d).off(".jstree") }, e.jstree.core = function (e) { this._id = e, this._cnt = 0, this._wrk = null, this._data = { core: { themes: { name: !1, dots: !1, icons: !1, ellipsis: !1 }, selected: [], last_error: {}, working: !1, worker_queue: [], focused: null } } }, e.jstree.reference = function (t) { var r = null, i = null; if (!t || !t.id || t.tagName && t.nodeType || (t = t.id), !i || !i.length) try { i = e(t) } catch (e) { } if (!i || !i.length) try { i = e("#" + t.replace(e.jstree.idregex, "\\$&")) } catch (e) { } return i && i.length && (i = i.closest(".jstree")).length && (i = i.data("jstree")) ? r = i : e(".jstree").each(function () { var i = e(this).data("jstree"); if (i && i._model.data[t]) return r = i, !1 }), r }, e.fn.jstree = function (r) { var i = "string" == typeof r, s = Array.prototype.slice.call(arguments, 1), a = null; return !(!0 === r && !this.length) && (this.each(function () { var n = e.jstree.reference(this), o = i && n ? n[r] : null; if (a = i && o ? o.apply(n, s) : null, n || i || r !== t && !e.isPlainObject(r) || e.jstree.create(this, r), (n && !i || !0 === r) && (a = n || !1), null !== a && a !== t) return !1 }), null !== a && a !== t ? a : this) }, e.expr.pseudos.jstree = e.expr.createPseudo(function (r) { return function (r) { return e(r).hasClass("jstree") && e(r).data("jstree") !== t } }), e.jstree.defaults.core = { data: !1, strings: !1, check_callback: !1, error: e.noop, animation: 200, multiple: !0, themes: { name: !1, url: !1, dir: !1, dots: !0, icons: !0, ellipsis: !1, stripes: !1, variant: !1, responsive: !1 }, expand_selected_onload: !0, worker: !0, force_text: !1, dblclick_toggle: !0, loaded_state: !1, restore_focus: !0, keyboard: { "ctrl-space": function (t) { t.type = "click", e(t.currentTarget).trigger(t) }, enter: function (t) { t.type = "click", e(t.currentTarget).trigger(t) }, left: function (t) { if (t.preventDefault(), this.is_open(t.currentTarget)) this.close_node(t.currentTarget); else { var r = this.get_parent(t.currentTarget); r && r.id !== e.jstree.root && this.get_node(r, !0).children(".jstree-anchor").focus() } }, up: function (e) { e.preventDefault(); var t = this.get_prev_dom(e.currentTarget); t && t.length && t.children(".jstree-anchor").focus() }, right: function (t) { if (t.preventDefault(), this.is_closed(t.currentTarget)) this.open_node(t.currentTarget, function (e) { this.get_node(e, !0).children(".jstree-anchor").focus() }); else if (this.is_open(t.currentTarget)) { var r = this.get_node(t.currentTarget, !0).children(".jstree-children")[0]; r && e(this._firstChild(r)).children(".jstree-anchor").focus() } }, down: function (e) { e.preventDefault(); var t = this.get_next_dom(e.currentTarget); t && t.length && t.children(".jstree-anchor").focus() }, "*": function (e) { this.open_all() }, home: function (t) { t.preventDefault(); var r = this._firstChild(this.get_container_ul()[0]); r && e(r).children(".jstree-anchor").filter(":visible").focus() }, end: function (e) { e.preventDefault(), this.element.find(".jstree-anchor").filter(":visible").last().focus() }, f2: function (e) { e.preventDefault(), this.edit(e.currentTarget) } } }, e.jstree.core.prototype = { plugin: function (t, r) { var i = e.jstree.plugins[t]; return i ? (this._data[t] = {}, i.prototype = this, new i(r, this)) : this }, init: function (t, r) { this._model = { data: {}, changed: [], force_full_redraw: !1, redraw_timeout: !1, default_state: { loaded: !0, opened: !1, selected: !1, disabled: !1 } }, this._model.data[e.jstree.root] = { id: e.jstree.root, parent: null, parents: [], children: [], children_d: [], state: { loaded: !1 } }, this.element = e(t).addClass("jstree jstree-" + this._id), this.settings = r, this._data.core.ready = !1, this._data.core.loaded = !1, this._data.core.rtl = "rtl" === this.element.css("direction"), this.element[this._data.core.rtl ? "addClass" : "removeClass"]("jstree-rtl"), this.element.attr("role", "tree"), this.settings.core.multiple && this.element.attr("aria-multiselectable", !0), this.element.attr("tabindex") || this.element.attr("tabindex", "0"), this.bind(), this.trigger("init"), this._data.core.original_container_html = this.element.find(" > ul > li").clone(!0), this._data.core.original_container_html.find("li").addBack().contents().filter(function () { return 3 === this.nodeType && (!this.nodeValue || /^\s+$/.test(this.nodeValue)) }).remove(), this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j" + this._id + "_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this.get_string("Loading ...") + "</a></li></ul>"), this.element.attr("aria-activedescendant", "j" + this._id + "_loading"), this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24, this._data.core.node = this._create_prototype_node(), this.trigger("loading"), this.load_node(e.jstree.root) }, destroy: function (e) { if (this.trigger("destroy"), this._wrk) try { window.URL.revokeObjectURL(this._wrk), this._wrk = null } catch (e) { } e || this.element.empty(), this.teardown() }, _create_prototype_node: function () { var e, t, r = d.createElement("LI"); return r.setAttribute("role", "treeitem"), (e = d.createElement("I")).className = "jstree-icon jstree-ocl", e.setAttribute("role", "presentation"), r.appendChild(e), (e = d.createElement("A")).className = "jstree-anchor", e.setAttribute("href", "#"), e.setAttribute("tabindex", "-1"), (t = d.createElement("I")).className = "jstree-icon jstree-themeicon", t.setAttribute("role", "presentation"), e.appendChild(t), r.appendChild(e), e = t = null, r }, _kbevent_to_func: function (e) { var t = []; e.ctrlKey && t.push("ctrl"), e.altKey && t.push("alt"), e.shiftKey && t.push("shift"), t.push({ 8: "Backspace", 9: "Tab", 13: "Enter", 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", 16: "Shift", 17: "Ctrl", 18: "Alt", 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: ".", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'", 111: "/", 106: "*", 173: "-" }[e.which] || e.which), t = t.sort().join("-").toLowerCase(); var r, i, s = this.settings.core.keyboard; for (r in s) if (s.hasOwnProperty(r) && ("-" !== (i = r) && "+" !== i && (i = (i = i.replace("--", "-MINUS").replace("+-", "-MINUS").replace("++", "-PLUS").replace("-+", "-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS", "-").replace("PLUS", "+").toLowerCase()), i === t)) return s[r]; return null }, teardown: function () { this.unbind(), this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class", function () { return this.className.replace(/jstree[^ ]*|$/gi, "") }), this.element = null }, bind: function () { var t = "", r = null, i = 0; this.element.on("dblclick.jstree", function (e) { if (e.target.tagName && "input" === e.target.tagName.toLowerCase()) return !0; if (d.selection && d.selection.empty) d.selection.empty(); else if (window.getSelection) { var t = window.getSelection(); try { t.removeAllRanges(), t.collapse() } catch (e) { } } }).on("mousedown.jstree", e.proxy(function (e) { e.target === this.element[0] && (e.preventDefault(), i = +new Date) }, this)).on("mousedown.jstree", ".jstree-ocl", function (e) { e.preventDefault() }).on("click.jstree", ".jstree-ocl", e.proxy(function (e) { this.toggle_node(e.target) }, this)).on("dblclick.jstree", ".jstree-anchor", e.proxy(function (e) { if (e.target.tagName && "input" === e.target.tagName.toLowerCase()) return !0; this.settings.core.dblclick_toggle && this.toggle_node(e.target) }, this)).on("click.jstree", ".jstree-anchor", e.proxy(function (t) { t.preventDefault(), t.currentTarget !== d.activeElement && e(t.currentTarget).focus(), this.activate_node(t.currentTarget, t) }, this)).on("keydown.jstree", ".jstree-anchor", e.proxy(function (e) { if (e.target.tagName && "input" === e.target.tagName.toLowerCase()) return !0; this._data.core.rtl && (37 === e.which ? e.which = 39 : 39 === e.which && (e.which = 37)); var t = this._kbevent_to_func(e); if (t) { var r = t.call(this, e); if (!1 === r || !0 === r) return r } }, this)).on("load_node.jstree", e.proxy(function (t, r) { r.status && (r.node.id !== e.jstree.root || this._data.core.loaded || (this._data.core.loaded = !0, this._firstChild(this.get_container_ul()[0]) && this.element.attr("aria-activedescendant", this._firstChild(this.get_container_ul()[0]).id), this.trigger("loaded")), this._data.core.ready || setTimeout(e.proxy(function () { if (this.element && !this.get_container_ul().find(".jstree-loading").length) { if (this._data.core.ready = !0, this._data.core.selected.length) { if (this.settings.core.expand_selected_onload) { var t, r, i = []; for (t = 0, r = this._data.core.selected.length; t < r; t++)i = i.concat(this._model.data[this._data.core.selected[t]].parents); for (t = 0, r = (i = e.vakata.array_unique(i)).length; t < r; t++)this.open_node(i[t], !1, 0) } this.trigger("changed", { action: "ready", selected: this._data.core.selected }) } this.trigger("ready") } }, this), 0)) }, this)).on("keypress.jstree", e.proxy(function (i) { if (i.target.tagName && "input" === i.target.tagName.toLowerCase()) return !0; r && clearTimeout(r), r = setTimeout(function () { t = "" }, 500); var s = String.fromCharCode(i.which).toLowerCase(), a = this.element.find(".jstree-anchor").filter(":visible"), n = a.index(d.activeElement) || 0, o = !1; if ((t += s).length > 1) { if (a.slice(n).each(e.proxy(function (r, i) { if (0 === e(i).text().toLowerCase().indexOf(t)) return e(i).focus(), o = !0, !1 }, this)), o) return; if (a.slice(0, n).each(e.proxy(function (r, i) { if (0 === e(i).text().toLowerCase().indexOf(t)) return e(i).focus(), o = !0, !1 }, this)), o) return } if (new RegExp("^" + s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") + "+$").test(t)) { if (a.slice(n + 1).each(e.proxy(function (t, r) { if (e(r).text().toLowerCase().charAt(0) === s) return e(r).focus(), o = !0, !1 }, this)), o) return; if (a.slice(0, n + 1).each(e.proxy(function (t, r) { if (e(r).text().toLowerCase().charAt(0) === s) return e(r).focus(), o = !0, !1 }, this)), o) return } }, this)).on("init.jstree", e.proxy(function () { var e = this.settings.core.themes; this._data.core.themes.dots = e.dots, this._data.core.themes.stripes = e.stripes, this._data.core.themes.icons = e.icons, this._data.core.themes.ellipsis = e.ellipsis, this.set_theme(e.name || "default", e.url), this.set_theme_variant(e.variant) }, this)).on("loading.jstree", e.proxy(function () { this[this._data.core.themes.dots ? "show_dots" : "hide_dots"](), this[this._data.core.themes.icons ? "show_icons" : "hide_icons"](), this[this._data.core.themes.stripes ? "show_stripes" : "hide_stripes"](), this[this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis"]() }, this)).on("blur.jstree", ".jstree-anchor", e.proxy(function (t) { this._data.core.focused = null, e(t.currentTarget).filter(".jstree-hovered").trigger("mouseleave"), this.element.attr("tabindex", "0") }, this)).on("focus.jstree", ".jstree-anchor", e.proxy(function (t) { var r = this.get_node(t.currentTarget); r && r.id && (this._data.core.focused = r.id), this.element.find(".jstree-hovered").not(t.currentTarget).trigger("mouseleave"), e(t.currentTarget).trigger("mouseenter"), this.element.attr("tabindex", "-1") }, this)).on("focus.jstree", e.proxy(function () { if (+new Date - i > 500 && !this._data.core.focused && this.settings.core.restore_focus) { i = 0; var e = this.get_node(this.element.attr("aria-activedescendant"), !0); e && e.find("> .jstree-anchor").focus() } }, this)).on("mouseenter.jstree", ".jstree-anchor", e.proxy(function (e) { this.hover_node(e.currentTarget) }, this)).on("mouseleave.jstree", ".jstree-anchor", e.proxy(function (e) { this.dehover_node(e.currentTarget) }, this)) }, unbind: function () { this.element.off(".jstree"), e(d).off(".jstree-" + this._id) }, trigger: function (e, t) { t || (t = {}), t.instance = this, this.element.triggerHandler(e.replace(".jstree", "") + ".jstree", t) }, get_container: function () { return this.element }, get_container_ul: function () { return this.element.children(".jstree-children").first() }, get_string: function (t) { var r = this.settings.core.strings; return e.isFunction(r) ? r.call(this, t) : r && r[t] ? r[t] : t }, _firstChild: function (e) { for (e = e ? e.firstChild : null; null !== e && 1 !== e.nodeType;)e = e.nextSibling; return e }, _nextSibling: function (e) { for (e = e ? e.nextSibling : null; null !== e && 1 !== e.nodeType;)e = e.nextSibling; return e }, _previousSibling: function (e) { for (e = e ? e.previousSibling : null; null !== e && 1 !== e.nodeType;)e = e.previousSibling; return e }, get_node: function (t, r) { var i; t && t.id && (t = t.id), t instanceof e && t.length && t[0].id && (t = t[0].id); try { if (this._model.data[t]) t = this._model.data[t]; else if ("string" == typeof t && this._model.data[t.replace(/^#/, "")]) t = this._model.data[t.replace(/^#/, "")]; else if ("string" == typeof t && (i = e("#" + t.replace(e.jstree.idregex, "\\$&"), this.element)).length && this._model.data[i.closest(".jstree-node").attr("id")]) t = this._model.data[i.closest(".jstree-node").attr("id")]; else if ((i = this.element.find(t)).length && this._model.data[i.closest(".jstree-node").attr("id")]) t = this._model.data[i.closest(".jstree-node").attr("id")]; else { if (!(i = this.element.find(t)).length || !i.hasClass("jstree")) return !1; t = this._model.data[e.jstree.root] } return r && (t = t.id === e.jstree.root ? this.element : e("#" + t.id.replace(e.jstree.idregex, "\\$&"), this.element)), t } catch (e) { return !1 } }, get_path: function (t, r, i) { if (!(t = t.parents ? t : this.get_node(t)) || t.id === e.jstree.root || !t.parents) return !1; var s, a, n = []; for (n.push(i ? t.id : t.text), s = 0, a = t.parents.length; s < a; s++)n.push(i ? t.parents[s] : this.get_text(t.parents[s])); return n = n.reverse().slice(1), r ? n.join(r) : n }, get_next_dom: function (t, r) { var i; if ((t = this.get_node(t, !0))[0] === this.element[0]) { for (i = this._firstChild(this.get_container_ul()[0]); i && 0 === i.offsetHeight;)i = this._nextSibling(i); return !!i && e(i) } if (!t || !t.length) return !1; if (r) { i = t[0]; do { i = this._nextSibling(i) } while (i && 0 === i.offsetHeight); return !!i && e(i) } if (t.hasClass("jstree-open")) { for (i = this._firstChild(t.children(".jstree-children")[0]); i && 0 === i.offsetHeight;)i = this._nextSibling(i); if (null !== i) return e(i) } i = t[0]; do { i = this._nextSibling(i) } while (i && 0 === i.offsetHeight); return null !== i ? e(i) : t.parentsUntil(".jstree", ".jstree-node").nextAll(".jstree-node:visible").first() }, get_prev_dom: function (t, r) { var i; if ((t = this.get_node(t, !0))[0] === this.element[0]) { for (i = this.get_container_ul()[0].lastChild; i && 0 === i.offsetHeight;)i = this._previousSibling(i); return !!i && e(i) } if (!t || !t.length) return !1; if (r) { i = t[0]; do { i = this._previousSibling(i) } while (i && 0 === i.offsetHeight); return !!i && e(i) } i = t[0]; do { i = this._previousSibling(i) } while (i && 0 === i.offsetHeight); if (null !== i) { for (t = e(i); t.hasClass("jstree-open");)t = t.children(".jstree-children").first().children(".jstree-node:visible:last"); return t } return !(!(i = t[0].parentNode.parentNode) || !i.className || -1 === i.className.indexOf("jstree-node")) && e(i) }, get_parent: function (t) { return !(!(t = this.get_node(t)) || t.id === e.jstree.root) && t.parent }, get_children_dom: function (e) { return (e = this.get_node(e, !0))[0] === this.element[0] ? this.get_container_ul().children(".jstree-node") : !(!e || !e.length) && e.children(".jstree-children").children(".jstree-node") }, is_parent: function (e) { return (e = this.get_node(e)) && (!1 === e.state.loaded || e.children.length > 0) }, is_loaded: function (e) { return (e = this.get_node(e)) && e.state.loaded }, is_loading: function (e) { return (e = this.get_node(e)) && e.state && e.state.loading }, is_open: function (e) { return (e = this.get_node(e)) && e.state.opened }, is_closed: function (e) { return (e = this.get_node(e)) && this.is_parent(e) && !e.state.opened }, is_leaf: function (e) { return !this.is_parent(e) }, load_node: function (t, r) { var i, s, a, n, o; if (e.isArray(t)) return this._load_nodes(t.slice(), r), !0; if (!(t = this.get_node(t))) return r && r.call(this, t, !1), !1; if (t.state.loaded) { for (t.state.loaded = !1, a = 0, n = t.parents.length; a < n; a++)this._model.data[t.parents[a]].children_d = e.vakata.array_filter(this._model.data[t.parents[a]].children_d, function (r) { return -1 === e.inArray(r, t.children_d) }); for (i = 0, s = t.children_d.length; i < s; i++)this._model.data[t.children_d[i]].state.selected && (o = !0), delete this._model.data[t.children_d[i]]; o && (this._data.core.selected = e.vakata.array_filter(this._data.core.selected, function (r) { return -1 === e.inArray(r, t.children_d) })), t.children = [], t.children_d = [], o && this.trigger("changed", { action: "load_node", node: t, selected: this._data.core.selected }) } return t.state.failed = !1, t.state.loading = !0, this.get_node(t, !0).addClass("jstree-loading").attr("aria-busy", !0), this._load_node(t, e.proxy(function (e) { (t = this._model.data[t.id]).state.loading = !1, t.state.loaded = e, t.state.failed = !t.state.loaded; var i, s = this.get_node(t, !0), a = 0, n = this._model.data, o = !1; for (a = 0, i = t.children.length; a < i; a++)if (n[t.children[a]] && !n[t.children[a]].state.hidden) { o = !0; break } t.state.loaded && s && s.length && (s.removeClass("jstree-closed jstree-open jstree-leaf"), o ? "#" !== t.id && s.addClass(t.state.opened ? "jstree-open" : "jstree-closed") : s.addClass("jstree-leaf")), s.removeClass("jstree-loading").attr("aria-busy", !1), this.trigger("load_node", { node: t, status: e }), r && r.call(this, t, e) }, this)), !0 }, _load_nodes: function (e, t, r, i) { var s, a, n = !0, o = function () { this._load_nodes(e, t, !0) }, d = this._model.data, c = []; for (s = 0, a = e.length; s < a; s++)d[e[s]] && (!d[e[s]].state.loaded && !d[e[s]].state.failed || !r && i) && (this.is_loading(e[s]) || this.load_node(e[s], o), n = !1); if (n) { for (s = 0, a = e.length; s < a; s++)d[e[s]] && d[e[s]].state.loaded && c.push(e[s]); t && !t.done && (t.call(this, c), t.done = !0) } }, load_all: function (t, r) { if (t || (t = e.jstree.root), !(t = this.get_node(t))) return !1; var i, s, a = [], n = this._model.data, o = n[t.id].children_d; for (t.state && !t.state.loaded && a.push(t.id), i = 0, s = o.length; i < s; i++)n[o[i]] && n[o[i]].state && !n[o[i]].state.loaded && a.push(o[i]); a.length ? this._load_nodes(a, function () { this.load_all(t, r) }) : (r && r.call(this, t), this.trigger("load_all", { node: t })) }, _load_node: function (t, r) { var i, s = this.settings.core.data, a = function () { return 3 !== this.nodeType && 8 !== this.nodeType }; return s ? e.isFunction(s) ? s.call(this, t, e.proxy(function (i) { !1 === i ? r.call(this, !1) : this["string" == typeof i ? "_append_html_data" : "_append_json_data"](t, "string" == typeof i ? e(e.parseHTML(i)).filter(a) : i, function (e) { r.call(this, e) }) }, this)) : "object" == typeof s ? s.url ? (s = e.extend(!0, {}, s), e.isFunction(s.url) && (s.url = s.url.call(this, t)), e.isFunction(s.data) && (s.data = s.data.call(this, t)), e.ajax(s).done(e.proxy(function (i, s, n) { var o = n.getResponseHeader("Content-Type"); return o && -1 !== o.indexOf("json") || "object" == typeof i ? this._append_json_data(t, i, function (e) { r.call(this, e) }) : o && -1 !== o.indexOf("html") || "string" == typeof i ? this._append_html_data(t, e(e.parseHTML(i)).filter(a), function (e) { r.call(this, e) }) : (this._data.core.last_error = { error: "ajax", plugin: "core", id: "core_04", reason: "Could not load node", data: JSON.stringify({ id: t.id, xhr: n }) }, this.settings.core.error.call(this, this._data.core.last_error), r.call(this, !1)) }, this)).fail(e.proxy(function (e) { this._data.core.last_error = { error: "ajax", plugin: "core", id: "core_04", reason: "Could not load node", data: JSON.stringify({ id: t.id, xhr: e }) }, r.call(this, !1), this.settings.core.error.call(this, this._data.core.last_error) }, this))) : (i = e.isArray(s) ? e.extend(!0, [], s) : e.isPlainObject(s) ? e.extend(!0, {}, s) : s, t.id === e.jstree.root ? this._append_json_data(t, i, function (e) { r.call(this, e) }) : (this._data.core.last_error = { error: "nodata", plugin: "core", id: "core_05", reason: "Could not load node", data: JSON.stringify({ id: t.id }) }, this.settings.core.error.call(this, this._data.core.last_error), r.call(this, !1))) : "string" == typeof s ? t.id === e.jstree.root ? this._append_html_data(t, e(e.parseHTML(s)).filter(a), function (e) { r.call(this, e) }) : (this._data.core.last_error = { error: "nodata", plugin: "core", id: "core_06", reason: "Could not load node", data: JSON.stringify({ id: t.id }) }, this.settings.core.error.call(this, this._data.core.last_error), r.call(this, !1)) : r.call(this, !1) : t.id === e.jstree.root ? this._append_html_data(t, this._data.core.original_container_html.clone(!0), function (e) { r.call(this, e) }) : r.call(this, !1) }, _node_changed: function (t) { (t = this.get_node(t)) && -1 === e.inArray(t.id, this._model.changed) && this._model.changed.push(t.id) }, _append_html_data: function (t, r, i) { (t = this.get_node(t)).children = [], t.children_d = []; var s, a, n, o = r.is("ul") ? r.children() : r, d = t.id, c = [], l = [], h = this._model.data, _ = h[d], u = this._data.core.selected.length; for (o.each(e.proxy(function (t, r) { (s = this._parse_model_from_html(e(r), d, _.parents.concat())) && (c.push(s), l.push(s), h[s].children_d.length && (l = l.concat(h[s].children_d))) }, this)), _.children = c, _.children_d = l, a = 0, n = _.parents.length; a < n; a++)h[_.parents[a]].children_d = h[_.parents[a]].children_d.concat(l); this.trigger("model", { nodes: l, parent: d }), d !== e.jstree.root ? (this._node_changed(d), this.redraw()) : (this.get_container_ul().children(".jstree-initial-node").remove(), this.redraw(!0)), this._data.core.selected.length !== u && this.trigger("changed", { action: "model", selected: this._data.core.selected }), i.call(this, !0) }, _append_json_data: function (t, r, i, s) { if (null !== this.element) { (t = this.get_node(t)).children = [], t.children_d = [], r.d && "string" == typeof (r = r.d) && (r = JSON.parse(r)), e.isArray(r) || (r = [r]); var a = null, n = { df: this._model.default_state, dat: r, par: t.id, m: this._model.data, t_id: this._id, t_cnt: this._cnt, sel: this._data.core.selected }, o = this, d = function (e, t) { e.data && (e = e.data); var r, i, s, a, n = e.dat, d = e.par, c = [], l = [], h = [], _ = e.df, u = e.t_id, g = e.t_cnt, f = e.m, p = f[d], m = e.sel, v = function (e, r, i) { i = i ? i.concat() : [], r && i.unshift(r); var s, a, n, o, d = e.id.toString(), c = { id: d, text: e.text || "", icon: e.icon === t || e.icon, parent: r, parents: i, children: e.children || [], children_d: e.children_d || [], data: e.data, state: {}, li_attr: { id: !1 }, a_attr: { href: "#" }, original: !1 }; for (s in _) _.hasOwnProperty(s) && (c.state[s] = _[s]); if (e && e.data && e.data.jstree && e.data.jstree.icon && (c.icon = e.data.jstree.icon), c.icon !== t && null !== c.icon && "" !== c.icon || (c.icon = !0), e && e.data && (c.data = e.data, e.data.jstree)) for (s in e.data.jstree) e.data.jstree.hasOwnProperty(s) && (c.state[s] = e.data.jstree[s]); if (e && "object" == typeof e.state) for (s in e.state) e.state.hasOwnProperty(s) && (c.state[s] = e.state[s]); if (e && "object" == typeof e.li_attr) for (s in e.li_attr) e.li_attr.hasOwnProperty(s) && (c.li_attr[s] = e.li_attr[s]); if (c.li_attr.id || (c.li_attr.id = d), e && "object" == typeof e.a_attr) for (s in e.a_attr) e.a_attr.hasOwnProperty(s) && (c.a_attr[s] = e.a_attr[s]); for (e && e.children && !0 === e.children && (c.state.loaded = !1, c.children = [], c.children_d = []), f[c.id] = c, s = 0, a = c.children.length; s < a; s++)n = v(f[c.children[s]], c.id, i), o = f[n], c.children_d.push(n), o.children_d.length && (c.children_d = c.children_d.concat(o.children_d)); return delete e.data, delete e.children, f[c.id].original = e, c.state.selected && h.push(c.id), c.id }, j = function (e, r, i) { i = i ? i.concat() : [], r && i.unshift(r); var s, a, n, o, d, c = !1; do { c = "j" + u + "_" + ++g } while (f[c]); for (s in d = { id: !1, text: "string" == typeof e ? e : "", icon: "object" != typeof e || e.icon === t || e.icon, parent: r, parents: i, children: [], children_d: [], data: null, state: {}, li_attr: { id: !1 }, a_attr: { href: "#" }, original: !1 }, _) _.hasOwnProperty(s) && (d.state[s] = _[s]); if (e && e.id && (d.id = e.id.toString()), e && e.text && (d.text = e.text), e && e.data && e.data.jstree && e.data.jstree.icon && (d.icon = e.data.jstree.icon), d.icon !== t && null !== d.icon && "" !== d.icon || (d.icon = !0), e && e.data && (d.data = e.data, e.data.jstree)) for (s in e.data.jstree) e.data.jstree.hasOwnProperty(s) && (d.state[s] = e.data.jstree[s]); if (e && "object" == typeof e.state) for (s in e.state) e.state.hasOwnProperty(s) && (d.state[s] = e.state[s]); if (e && "object" == typeof e.li_attr) for (s in e.li_attr) e.li_attr.hasOwnProperty(s) && (d.li_attr[s] = e.li_attr[s]); if (d.li_attr.id && !d.id && (d.id = d.li_attr.id.toString()), d.id || (d.id = c), d.li_attr.id || (d.li_attr.id = d.id), e && "object" == typeof e.a_attr) for (s in e.a_attr) e.a_attr.hasOwnProperty(s) && (d.a_attr[s] = e.a_attr[s]); if (e && e.children && e.children.length) { for (s = 0, a = e.children.length; s < a; s++)n = j(e.children[s], d.id, i), o = f[n], d.children.push(n), o.children_d.length && (d.children_d = d.children_d.concat(o.children_d)); d.children_d = d.children_d.concat(d.children) } return e && e.children && !0 === e.children && (d.state.loaded = !1, d.children = [], d.children_d = []), delete e.data, delete e.children, d.original = e, f[d.id] = d, d.state.selected && h.push(d.id), d.id }; if (n.length && n[0].id !== t && n[0].parent !== t) { for (i = 0, s = n.length; i < s; i++)n[i].children || (n[i].children = []), n[i].state || (n[i].state = {}), f[n[i].id.toString()] = n[i]; for (i = 0, s = n.length; i < s; i++)f[n[i].parent.toString()] ? (f[n[i].parent.toString()].children.push(n[i].id.toString()), p.children_d.push(n[i].id.toString())) : void 0 !== o && (o._data.core.last_error = { error: "parse", plugin: "core", id: "core_07", reason: "Node with invalid parent", data: JSON.stringify({ id: n[i].id.toString(), parent: n[i].parent.toString() }) }, o.settings.core.error.call(o, o._data.core.last_error)); for (i = 0, s = p.children.length; i < s; i++)r = v(f[p.children[i]], d, p.parents.concat()), l.push(r), f[r].children_d.length && (l = l.concat(f[r].children_d)); for (i = 0, s = p.parents.length; i < s; i++)f[p.parents[i]].children_d = f[p.parents[i]].children_d.concat(l); a = { cnt: g, mod: f, sel: m, par: d, dpc: l, add: h } } else { for (i = 0, s = n.length; i < s; i++)(r = j(n[i], d, p.parents.concat())) && (c.push(r), l.push(r), f[r].children_d.length && (l = l.concat(f[r].children_d))); for (p.children = c, p.children_d = l, i = 0, s = p.parents.length; i < s; i++)f[p.parents[i]].children_d = f[p.parents[i]].children_d.concat(l); a = { cnt: g, mod: f, sel: m, par: d, dpc: l, add: h } } if ("undefined" != typeof window && void 0 !== window.document) return a; postMessage(a) }, c = function (t, r) { if (null !== this.element) { this._cnt = t.cnt; var s, a = this._model.data; for (s in a) a.hasOwnProperty(s) && a[s].state && a[s].state.loading && t.mod[s] && (t.mod[s].state.loading = !0); if (this._model.data = t.mod, r) { var n, o = t.add, d = t.sel, c = this._data.core.selected.slice(); if (a = this._model.data, d.length !== c.length || e.vakata.array_unique(d.concat(c)).length !== d.length) { for (s = 0, n = d.length; s < n; s++)-1 === e.inArray(d[s], o) && -1 === e.inArray(d[s], c) && (a[d[s]].state.selected = !1); for (s = 0, n = c.length; s < n; s++)-1 === e.inArray(c[s], d) && (a[c[s]].state.selected = !0) } } t.add.length && (this._data.core.selected = this._data.core.selected.concat(t.add)), this.trigger("model", { nodes: t.dpc, parent: t.par }), t.par !== e.jstree.root ? (this._node_changed(t.par), this.redraw()) : this.redraw(!0), t.add.length && this.trigger("changed", { action: "model", selected: this._data.core.selected }), i.call(this, !0) } }; if (this.settings.core.worker && window.Blob && window.URL && window.Worker) try { null === this._wrk && (this._wrk = window.URL.createObjectURL(new window.Blob(["self.onmessage = " + d.toString()], { type: "text/javascript" }))), !this._data.core.working || s ? (this._data.core.working = !0, (a = new window.Worker(this._wrk)).onmessage = e.proxy(function (e) { c.call(this, e.data, !0); try { a.terminate(), a = null } catch (e) { } this._data.core.worker_queue.length ? this._append_json_data.apply(this, this._data.core.worker_queue.shift()) : this._data.core.working = !1 }, this), n.par ? a.postMessage(n) : this._data.core.worker_queue.length ? this._append_json_data.apply(this, this._data.core.worker_queue.shift()) : this._data.core.working = !1) : this._data.core.worker_queue.push([t, r, i, !0]) } catch (e) { c.call(this, d(n), !1), this._data.core.worker_queue.length ? this._append_json_data.apply(this, this._data.core.worker_queue.shift()) : this._data.core.working = !1 } else c.call(this, d(n), !1) } }, _parse_model_from_html: function (r, i, s) { s = s ? [].concat(s) : [], i && s.unshift(i); var a, n, o, d, c, l = this._model.data, h = { id: !1, text: !1, icon: !0, parent: i, parents: s, children: [], children_d: [], data: null, state: {}, li_attr: { id: !1 }, a_attr: { href: "#" }, original: !1 }; for (o in this._model.default_state) this._model.default_state.hasOwnProperty(o) && (h.state[o] = this._model.default_state[o]); if (d = e.vakata.attributes(r, !0), e.each(d, function (t, r) { if (!(r = e.trim(r)).length) return !0; h.li_attr[t] = r, "id" === t && (h.id = r.toString()) }), (d = r.children("a").first()).length && (d = e.vakata.attributes(d, !0), e.each(d, function (t, r) { (r = e.trim(r)).length && (h.a_attr[t] = r) })), (d = r.children("a").first().length ? r.children("a").first().clone() : r.clone()).children("ins, i, ul").remove(), d = d.html(), d = e("<div />").html(d), h.text = this.settings.core.force_text ? d.text() : d.html(), d = r.data(), h.data = d ? e.extend(!0, {}, d) : null, h.state.opened = r.hasClass("jstree-open"), h.state.selected = r.children("a").hasClass("jstree-clicked"), h.state.disabled = r.children("a").hasClass("jstree-disabled"), h.data && h.data.jstree) for (o in h.data.jstree) h.data.jstree.hasOwnProperty(o) && (h.state[o] = h.data.jstree[o]); (d = r.children("a").children(".jstree-themeicon")).length && (h.icon = !d.hasClass("jstree-themeicon-hidden") && d.attr("rel")), h.state.icon !== t && (h.icon = h.state.icon), h.icon !== t && null !== h.icon && "" !== h.icon || (h.icon = !0), d = r.children("ul").children("li"); do { c = "j" + this._id + "_" + ++this._cnt } while (l[c]); return h.id = h.li_attr.id ? h.li_attr.id.toString() : c, d.length ? (d.each(e.proxy(function (t, r) { a = this._parse_model_from_html(e(r), h.id, s), n = this._model.data[a], h.children.push(a), n.children_d.length && (h.children_d = h.children_d.concat(n.children_d)) }, this)), h.children_d = h.children_d.concat(h.children)) : r.hasClass("jstree-closed") && (h.state.loaded = !1), h.li_attr.class && (h.li_attr.class = h.li_attr.class.replace("jstree-closed", "").replace("jstree-open", "")), h.a_attr.class && (h.a_attr.class = h.a_attr.class.replace("jstree-clicked", "").replace("jstree-disabled", "")), l[h.id] = h, h.state.selected && this._data.core.selected.push(h.id), h.id }, _parse_model_from_flat_json: function (e, r, i) { i = i ? i.concat() : [], r && i.unshift(r); var s, a, n, o, d = e.id.toString(), c = this._model.data, l = this._model.default_state, h = { id: d, text: e.text || "", icon: e.icon === t || e.icon, parent: r, parents: i, children: e.children || [], children_d: e.children_d || [], data: e.data, state: {}, li_attr: { id: !1 }, a_attr: { href: "#" }, original: !1 }; for (s in l) l.hasOwnProperty(s) && (h.state[s] = l[s]); if (e && e.data && e.data.jstree && e.data.jstree.icon && (h.icon = e.data.jstree.icon), h.icon !== t && null !== h.icon && "" !== h.icon || (h.icon = !0), e && e.data && (h.data = e.data, e.data.jstree)) for (s in e.data.jstree) e.data.jstree.hasOwnProperty(s) && (h.state[s] = e.data.jstree[s]); if (e && "object" == typeof e.state) for (s in e.state) e.state.hasOwnProperty(s) && (h.state[s] = e.state[s]); if (e && "object" == typeof e.li_attr) for (s in e.li_attr) e.li_attr.hasOwnProperty(s) && (h.li_attr[s] = e.li_attr[s]); if (h.li_attr.id || (h.li_attr.id = d), e && "object" == typeof e.a_attr) for (s in e.a_attr) e.a_attr.hasOwnProperty(s) && (h.a_attr[s] = e.a_attr[s]); for (e && e.children && !0 === e.children && (h.state.loaded = !1, h.children = [], h.children_d = []), c[h.id] = h, s = 0, a = h.children.length; s < a; s++)o = c[n = this._parse_model_from_flat_json(c[h.children[s]], h.id, i)], h.children_d.push(n), o.children_d.length && (h.children_d = h.children_d.concat(o.children_d)); return delete e.data, delete e.children, c[h.id].original = e, h.state.selected && this._data.core.selected.push(h.id), h.id }, _parse_model_from_json: function (e, r, i) { i = i ? i.concat() : [], r && i.unshift(r); var s, a, n, o, d, c = !1, l = this._model.data, h = this._model.default_state; do { c = "j" + this._id + "_" + ++this._cnt } while (l[c]); for (s in d = { id: !1, text: "string" == typeof e ? e : "", icon: "object" != typeof e || e.icon === t || e.icon, parent: r, parents: i, children: [], children_d: [], data: null, state: {}, li_attr: { id: !1 }, a_attr: { href: "#" }, original: !1 }, h) h.hasOwnProperty(s) && (d.state[s] = h[s]); if (e && e.id && (d.id = e.id.toString()), e && e.text && (d.text = e.text), e && e.data && e.data.jstree && e.data.jstree.icon && (d.icon = e.data.jstree.icon), d.icon !== t && null !== d.icon && "" !== d.icon || (d.icon = !0), e && e.data && (d.data = e.data, e.data.jstree)) for (s in e.data.jstree) e.data.jstree.hasOwnProperty(s) && (d.state[s] = e.data.jstree[s]); if (e && "object" == typeof e.state) for (s in e.state) e.state.hasOwnProperty(s) && (d.state[s] = e.state[s]); if (e && "object" == typeof e.li_attr) for (s in e.li_attr) e.li_attr.hasOwnProperty(s) && (d.li_attr[s] = e.li_attr[s]); if (d.li_attr.id && !d.id && (d.id = d.li_attr.id.toString()), d.id || (d.id = c), d.li_attr.id || (d.li_attr.id = d.id), e && "object" == typeof e.a_attr) for (s in e.a_attr) e.a_attr.hasOwnProperty(s) && (d.a_attr[s] = e.a_attr[s]); if (e && e.children && e.children.length) { for (s = 0, a = e.children.length; s < a; s++)o = l[n = this._parse_model_from_json(e.children[s], d.id, i)], d.children.push(n), o.children_d.length && (d.children_d = d.children_d.concat(o.children_d)); d.children_d = d.children.concat(d.children_d) } return e && e.children && !0 === e.children && (d.state.loaded = !1, d.children = [], d.children_d = []), delete e.data, delete e.children, d.original = e, l[d.id] = d, d.state.selected && this._data.core.selected.push(d.id), d.id }, _redraw: function () { var t, r, i, s = this._model.force_full_redraw ? this._model.data[e.jstree.root].children.concat([]) : this._model.changed.concat([]), a = d.createElement("UL"), n = this._data.core.focused; for (r = 0, i = s.length; r < i; r++)(t = this.redraw_node(s[r], !0, this._model.force_full_redraw)) && this._model.force_full_redraw && a.appendChild(t); this._model.force_full_redraw && (a.className = this.get_container_ul()[0].className, a.setAttribute("role", "group"), this.element.empty().append(a)), null !== n && this.settings.core.restore_focus && ((t = this.get_node(n, !0)) && t.length && t.children(".jstree-anchor")[0] !== d.activeElement ? t.children(".jstree-anchor").focus() : this._data.core.focused = null), this._model.force_full_redraw = !1, this._model.changed = [], this.trigger("redraw", { nodes: s }) }, redraw: function (e) { e && (this._model.force_full_redraw = !0), this._redraw() }, draw_children: function (t) { var r = this.get_node(t), i = !1, s = !1, a = !1, n = d; if (!r) return !1; if (r.id === e.jstree.root) return this.redraw(!0); if (!(t = this.get_node(t, !0)) || !t.length) return !1; if (t.children(".jstree-children").remove(), t = t[0], r.children.length && r.state.loaded) { for ((a = n.createElement("UL")).setAttribute("role", "group"), a.className = "jstree-children", i = 0, s = r.children.length; i < s; i++)a.appendChild(this.redraw_node(r.children[i], !0, !0)); t.appendChild(a) } }, redraw_node: function (t, r, i, s) { var a = this.get_node(t), n = !1, o = !1, c = !1, l = !1, h = !1, _ = !1, u = "", g = d, f = this._model.data, p = !1, m = null, v = 0, j = 0, y = !1, k = !1; if (!a) return !1; if (a.id === e.jstree.root) return this.redraw(!0); if (r = r || 0 === a.children.length, t = d.querySelector ? this.element[0].querySelector("#" + (-1 !== "0123456789".indexOf(a.id[0]) ? "\\3" + a.id[0] + " " + a.id.substr(1).replace(e.jstree.idregex, "\\$&") : a.id.replace(e.jstree.idregex, "\\$&"))) : d.getElementById(a.id)) t = e(t), i || ((n = t.parent().parent()[0]) === this.element[0] && (n = null), o = t.index()), r || !a.children.length || t.children(".jstree-children").length || (r = !0), r || (c = t.children(".jstree-children")[0]), p = t.children(".jstree-anchor")[0] === d.activeElement, t.remove(); else if (r = !0, !i) { if (!(null === (n = a.parent !== e.jstree.root ? e("#" + a.parent.replace(e.jstree.idregex, "\\$&"), this.element)[0] : null) || n && f[a.parent].state.opened)) return !1; o = e.inArray(a.id, null === n ? f[e.jstree.root].children : f[a.parent].children) } for (l in t = this._data.core.node.cloneNode(!0), u = "jstree-node ", a.li_attr) if (a.li_attr.hasOwnProperty(l)) { if ("id" === l) continue; "class" !== l ? t.setAttribute(l, a.li_attr[l]) : u += a.li_attr[l] } for (a.a_attr.id || (a.a_attr.id = a.id + "_anchor"), t.setAttribute("aria-selected", !!a.state.selected), t.setAttribute("aria-level", a.parents.length), t.setAttribute("aria-labelledby", a.a_attr.id), a.state.disabled && t.setAttribute("aria-disabled", !0), l = 0, h = a.children.length; l < h; l++)if (!f[a.children[l]].state.hidden) { y = !0; break } if (null !== a.parent && f[a.parent] && !a.state.hidden && (l = e.inArray(a.id, f[a.parent].children), k = a.id, -1 !== l)) for (l++, h = f[a.parent].children.length; l < h && (f[f[a.parent].children[l]].state.hidden || (k = f[a.parent].children[l]), k === a.id); l++); for (h in a.state.hidden && (u += " jstree-hidden"), a.state.loading && (u += " jstree-loading"), a.state.loaded && !y ? u += " jstree-leaf" : (u += a.state.opened && a.state.loaded ? " jstree-open" : " jstree-closed", t.setAttribute("aria-expanded", a.state.opened && a.state.loaded)), k === a.id && (u += " jstree-last"), t.id = a.id, t.className = u, u = (a.state.selected ? " jstree-clicked" : "") + (a.state.disabled ? " jstree-disabled" : ""), a.a_attr) if (a.a_attr.hasOwnProperty(h)) { if ("href" === h && "#" === a.a_attr[h]) continue; "class" !== h ? t.childNodes[1].setAttribute(h, a.a_attr[h]) : u += " " + a.a_attr[h] } if (u.length && (t.childNodes[1].className = "jstree-anchor " + u), (a.icon && !0 !== a.icon || !1 === a.icon) && (!1 === a.icon ? t.childNodes[1].childNodes[0].className += " jstree-themeicon-hidden" : -1 === a.icon.indexOf("/") && -1 === a.icon.indexOf(".") ? t.childNodes[1].childNodes[0].className += " " + a.icon + " jstree-themeicon-custom" : (t.childNodes[1].childNodes[0].style.backgroundImage = 'url("' + a.icon + '")', t.childNodes[1].childNodes[0].style.backgroundPosition = "center center", t.childNodes[1].childNodes[0].style.backgroundSize = "auto", t.childNodes[1].childNodes[0].className += " jstree-themeicon-custom")), this.settings.core.force_text ? t.childNodes[1].appendChild(g.createTextNode(a.text)) : t.childNodes[1].innerHTML += a.text, r && a.children.length && (a.state.opened || s) && a.state.loaded) { for ((_ = g.createElement("UL")).setAttribute("role", "group"), _.className = "jstree-children", l = 0, h = a.children.length; l < h; l++)_.appendChild(this.redraw_node(a.children[l], r, !0)); t.appendChild(_) } if (c && t.appendChild(c), !i) { for (n || (n = this.element[0]), l = 0, h = n.childNodes.length; l < h; l++)if (n.childNodes[l] && n.childNodes[l].className && -1 !== n.childNodes[l].className.indexOf("jstree-children")) { m = n.childNodes[l]; break } m || ((m = g.createElement("UL")).setAttribute("role", "group"), m.className = "jstree-children", n.appendChild(m)), o < (n = m).childNodes.length ? n.insertBefore(t, n.childNodes[o]) : n.appendChild(t), p && (v = this.element[0].scrollTop, j = this.element[0].scrollLeft, t.childNodes[1].focus(), this.element[0].scrollTop = v, this.element[0].scrollLeft = j) } return a.state.opened && !a.state.loaded && (a.state.opened = !1, setTimeout(e.proxy(function () { this.open_node(a.id, !1, 0) }, this), 0)), t }, open_node: function (r, i, s) { var a, n, o, d; if (e.isArray(r)) { for (a = 0, n = (r = r.slice()).length; a < n; a++)this.open_node(r[a], i, s); return !0 } return !(!(r = this.get_node(r)) || r.id === e.jstree.root) && (s = s === t ? this.settings.core.animation : s, this.is_closed(r) ? this.is_loaded(r) ? (o = this.get_node(r, !0), d = this, o.length && (s && o.children(".jstree-children").length && o.children(".jstree-children").stop(!0, !0), r.children.length && !this._firstChild(o.children(".jstree-children")[0]) && this.draw_children(r), s ? (this.trigger("before_open", { node: r }), o.children(".jstree-children").css("display", "none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", !0).children(".jstree-children").stop(!0, !0).slideDown(s, function () { this.style.display = "", d.element && d.trigger("after_open", { node: r }) })) : (this.trigger("before_open", { node: r }), o[0].className = o[0].className.replace("jstree-closed", "jstree-open"), o[0].setAttribute("aria-expanded", !0))), r.state.opened = !0, i && i.call(this, r, !0), o.length || this.trigger("before_open", { node: r }), this.trigger("open_node", { node: r }), s && o.length || this.trigger("after_open", { node: r }), !0) : this.is_loading(r) ? setTimeout(e.proxy(function () { this.open_node(r, i, s) }, this), 500) : void this.load_node(r, function (e, t) { return t ? this.open_node(e, i, s) : !!i && i.call(this, e, !1) }) : (i && i.call(this, r, !1), !1)) }, _open_to: function (t) { if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; var r, i, s = t.parents; for (r = 0, i = s.length; r < i; r += 1)r !== e.jstree.root && this.open_node(s[r], !1, 0); return e("#" + t.id.replace(e.jstree.idregex, "\\$&"), this.element) }, close_node: function (r, i) { var s, a, n, o; if (e.isArray(r)) { for (s = 0, a = (r = r.slice()).length; s < a; s++)this.close_node(r[s], i); return !0 } return !(!(r = this.get_node(r)) || r.id === e.jstree.root) && (!this.is_closed(r) && (i = i === t ? this.settings.core.animation : i, n = this, o = this.get_node(r, !0), r.state.opened = !1, this.trigger("close_node", { node: r }), void (o.length ? i ? o.children(".jstree-children").attr("style", "display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", !1).children(".jstree-children").stop(!0, !0).slideUp(i, function () { this.style.display = "", o.children(".jstree-children").remove(), n.element && n.trigger("after_close", { node: r }) }) : (o[0].className = o[0].className.replace("jstree-open", "jstree-closed"), o.attr("aria-expanded", !1).children(".jstree-children").remove(), this.trigger("after_close", { node: r })) : this.trigger("after_close", { node: r })))) }, toggle_node: function (t) { var r, i; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.toggle_node(t[r]); return !0 } return this.is_closed(t) ? this.open_node(t) : this.is_open(t) ? this.close_node(t) : void 0 }, open_all: function (t, r, i) { if (t || (t = e.jstree.root), !(t = this.get_node(t))) return !1; var s, a, n, o = t.id === e.jstree.root ? this.get_container_ul() : this.get_node(t, !0); if (!o.length) { for (s = 0, a = t.children_d.length; s < a; s++)this.is_closed(this._model.data[t.children_d[s]]) && (this._model.data[t.children_d[s]].state.opened = !0); return this.trigger("open_all", { node: t }) } i = i || o, n = this, (o = this.is_closed(t) ? o.find(".jstree-closed").addBack() : o.find(".jstree-closed")).each(function () { n.open_node(this, function (e, t) { t && this.is_parent(e) && this.open_all(e, r, i) }, r || 0) }), 0 === i.find(".jstree-closed").length && this.trigger("open_all", { node: this.get_node(i) }) }, close_all: function (t, r) { if (t || (t = e.jstree.root), !(t = this.get_node(t))) return !1; var i, s, a = t.id === e.jstree.root ? this.get_container_ul() : this.get_node(t, !0), n = this; for (a.length && (a = this.is_open(t) ? a.find(".jstree-open").addBack() : a.find(".jstree-open"), e(a.get().reverse()).each(function () { n.close_node(this, r || 0) })), i = 0, s = t.children_d.length; i < s; i++)this._model.data[t.children_d[i]].state.opened = !1; this.trigger("close_all", { node: t }) }, is_disabled: function (e) { return (e = this.get_node(e)) && e.state && e.state.disabled }, enable_node: function (t) { var r, i; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.enable_node(t[r]); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; t.state.disabled = !1, this.get_node(t, !0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled", !1), this.trigger("enable_node", { node: t }) }, disable_node: function (t) { var r, i; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.disable_node(t[r]); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; t.state.disabled = !0, this.get_node(t, !0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled", !0), this.trigger("disable_node", { node: t }) }, is_hidden: function (e) { return !0 === (e = this.get_node(e)).state.hidden }, hide_node: function (t, r) { var i, s; if (e.isArray(t)) { for (i = 0, s = (t = t.slice()).length; i < s; i++)this.hide_node(t[i], !0); return r || this.redraw(), !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; t.state.hidden || (t.state.hidden = !0, this._node_changed(t.parent), r || this.redraw(), this.trigger("hide_node", { node: t })) }, show_node: function (t, r) { var i, s; if (e.isArray(t)) { for (i = 0, s = (t = t.slice()).length; i < s; i++)this.show_node(t[i], !0); return r || this.redraw(), !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; t.state.hidden && (t.state.hidden = !1, this._node_changed(t.parent), r || this.redraw(), this.trigger("show_node", { node: t })) }, hide_all: function (t) { var r, i = this._model.data, s = []; for (r in i) i.hasOwnProperty(r) && r !== e.jstree.root && !i[r].state.hidden && (i[r].state.hidden = !0, s.push(r)); return this._model.force_full_redraw = !0, t || this.redraw(), this.trigger("hide_all", { nodes: s }), s }, show_all: function (t) { var r, i = this._model.data, s = []; for (r in i) i.hasOwnProperty(r) && r !== e.jstree.root && i[r].state.hidden && (i[r].state.hidden = !1, s.push(r)); return this._model.force_full_redraw = !0, t || this.redraw(), this.trigger("show_all", { nodes: s }), s }, activate_node: function (e, r) { if (this.is_disabled(e)) return !1; if (r && "object" == typeof r || (r = {}), this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== t ? this.get_node(this._data.core.last_clicked.id) : null, this._data.core.last_clicked && !this._data.core.last_clicked.state.selected && (this._data.core.last_clicked = null), !this._data.core.last_clicked && this._data.core.selected.length && (this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1])), this.settings.core.multiple && (r.metaKey || r.ctrlKey || r.shiftKey) && (!r.shiftKey || this._data.core.last_clicked && this.get_parent(e) && this.get_parent(e) === this._data.core.last_clicked.parent)) if (r.shiftKey) { var i, s, a = this.get_node(e).id, n = this._data.core.last_clicked.id, o = this.get_node(this._data.core.last_clicked.parent).children, d = !1; for (i = 0, s = o.length; i < s; i += 1)o[i] === a && (d = !d), o[i] === n && (d = !d), this.is_disabled(o[i]) || !d && o[i] !== a && o[i] !== n ? this.deselect_node(o[i], !0, r) : this.is_hidden(o[i]) || this.select_node(o[i], !0, !1, r); this.trigger("changed", { action: "select_node", node: this.get_node(e), selected: this._data.core.selected, event: r }) } else this.is_selected(e) ? this.deselect_node(e, !1, r) : this.select_node(e, !1, !1, r); else !this.settings.core.multiple && (r.metaKey || r.ctrlKey || r.shiftKey) && this.is_selected(e) ? this.deselect_node(e, !1, r) : (this.deselect_all(!0), this.select_node(e, !1, !1, r), this._data.core.last_clicked = this.get_node(e)); this.trigger("activate_node", { node: this.get_node(e), event: r }) }, hover_node: function (e) { if (!(e = this.get_node(e, !0)) || !e.length || e.children(".jstree-hovered").length) return !1; var t = this.element.find(".jstree-hovered"), r = this.element; t && t.length && this.dehover_node(t), e.children(".jstree-anchor").addClass("jstree-hovered"), this.trigger("hover_node", { node: this.get_node(e) }), setTimeout(function () { r.attr("aria-activedescendant", e[0].id) }, 0) }, dehover_node: function (e) { if (!(e = this.get_node(e, !0)) || !e.length || !e.children(".jstree-hovered").length) return !1; e.children(".jstree-anchor").removeClass("jstree-hovered"), this.trigger("dehover_node", { node: this.get_node(e) }) }, select_node: function (t, r, i, s) { var a, n, o; if (e.isArray(t)) { for (n = 0, o = (t = t.slice()).length; n < o; n++)this.select_node(t[n], r, i, s); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; a = this.get_node(t, !0), t.state.selected || (t.state.selected = !0, this._data.core.selected.push(t.id), i || (a = this._open_to(t)), a && a.length && a.attr("aria-selected", !0).children(".jstree-anchor").addClass("jstree-clicked"), this.trigger("select_node", { node: t, selected: this._data.core.selected, event: s }), r || this.trigger("changed", { action: "select_node", node: t, selected: this._data.core.selected, event: s })) }, deselect_node: function (t, r, i) { var s, a, n; if (e.isArray(t)) { for (s = 0, a = (t = t.slice()).length; s < a; s++)this.deselect_node(t[s], r, i); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; n = this.get_node(t, !0), t.state.selected && (t.state.selected = !1, this._data.core.selected = e.vakata.array_remove_item(this._data.core.selected, t.id), n.length && n.attr("aria-selected", !1).children(".jstree-anchor").removeClass("jstree-clicked"), this.trigger("deselect_node", { node: t, selected: this._data.core.selected, event: i }), r || this.trigger("changed", { action: "deselect_node", node: t, selected: this._data.core.selected, event: i })) }, select_all: function (t) { var r, i, s = this._data.core.selected.concat([]); for (this._data.core.selected = this._model.data[e.jstree.root].children_d.concat(), r = 0, i = this._data.core.selected.length; r < i; r++)this._model.data[this._data.core.selected[r]] && (this._model.data[this._data.core.selected[r]].state.selected = !0); this.redraw(!0), this.trigger("select_all", { selected: this._data.core.selected }), t || this.trigger("changed", { action: "select_all", selected: this._data.core.selected, old_selection: s }) }, deselect_all: function (e) { var t, r, i = this._data.core.selected.concat([]); for (t = 0, r = this._data.core.selected.length; t < r; t++)this._model.data[this._data.core.selected[t]] && (this._model.data[this._data.core.selected[t]].state.selected = !1); this._data.core.selected = [], this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected", !1), this.trigger("deselect_all", { selected: this._data.core.selected, node: i }), e || this.trigger("changed", { action: "deselect_all", selected: this._data.core.selected, old_selection: i }) }, is_selected: function (t) { return !(!(t = this.get_node(t)) || t.id === e.jstree.root) && t.state.selected }, get_selected: function (t) { return t ? e.map(this._data.core.selected, e.proxy(function (e) { return this.get_node(e) }, this)) : this._data.core.selected.slice() }, get_top_selected: function (t) { var r, i, s, a, n = this.get_selected(!0), o = {}; for (r = 0, i = n.length; r < i; r++)o[n[r].id] = n[r]; for (r = 0, i = n.length; r < i; r++)for (s = 0, a = n[r].children_d.length; s < a; s++)o[n[r].children_d[s]] && delete o[n[r].children_d[s]]; for (r in n = [], o) o.hasOwnProperty(r) && n.push(r); return t ? e.map(n, e.proxy(function (e) { return this.get_node(e) }, this)) : n }, get_bottom_selected: function (t) { var r, i, s = this.get_selected(!0), a = []; for (r = 0, i = s.length; r < i; r++)s[r].children.length || a.push(s[r].id); return t ? e.map(a, e.proxy(function (e) { return this.get_node(e) }, this)) : a }, get_state: function () { var t, r = { core: { open: [], loaded: [], scroll: { left: this.element.scrollLeft(), top: this.element.scrollTop() }, selected: [] } }; for (t in this._model.data) this._model.data.hasOwnProperty(t) && t !== e.jstree.root && (this._model.data[t].state.loaded && this.settings.core.loaded_state && r.core.loaded.push(t), this._model.data[t].state.opened && r.core.open.push(t), this._model.data[t].state.selected && r.core.selected.push(t)); return r }, set_state: function (r, i) { if (r) { if (r.core && r.core.selected && r.core.initial_selection === t && (r.core.initial_selection = this._data.core.selected.concat([]).sort().join(",")), r.core) { var s, a; if (r.core.loaded) return this.settings.core.loaded_state && e.isArray(r.core.loaded) && r.core.loaded.length ? this._load_nodes(r.core.loaded, function (e) { delete r.core.loaded, this.set_state(r, i) }) : (delete r.core.loaded, this.set_state(r, i)), !1; if (r.core.open) return e.isArray(r.core.open) && r.core.open.length ? this._load_nodes(r.core.open, function (e) { this.open_node(e, !1, 0), delete r.core.open, this.set_state(r, i) }) : (delete r.core.open, this.set_state(r, i)), !1; if (r.core.scroll) return r.core.scroll && r.core.scroll.left !== t && this.element.scrollLeft(r.core.scroll.left), r.core.scroll && r.core.scroll.top !== t && this.element.scrollTop(r.core.scroll.top), delete r.core.scroll, this.set_state(r, i), !1; if (r.core.selected) return s = this, r.core.initial_selection !== t && r.core.initial_selection !== this._data.core.selected.concat([]).sort().join(",") || (this.deselect_all(), e.each(r.core.selected, function (e, t) { s.select_node(t, !1, !0) })), delete r.core.initial_selection, delete r.core.selected, this.set_state(r, i), !1; for (a in r) r.hasOwnProperty(a) && "core" !== a && -1 === e.inArray(a, this.settings.plugins) && delete r[a]; if (e.isEmptyObject(r.core)) return delete r.core, this.set_state(r, i), !1 } return !e.isEmptyObject(r) || (r = null, i && i.call(this), this.trigger("set_state"), !1) } return !1 }, refresh: function (t, r) { this._data.core.state = !0 === r ? {} : this.get_state(), r && e.isFunction(r) && (this._data.core.state = r.call(this, this._data.core.state)), this._cnt = 0, this._model.data = {}, this._model.data[e.jstree.root] = { id: e.jstree.root, parent: null, parents: [], children: [], children_d: [], state: { loaded: !1 } }, this._data.core.selected = [], this._data.core.last_clicked = null, this._data.core.focused = null; var i = this.get_container_ul()[0].className; t || (this.element.html("<ul class='" + i + "' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j" + this._id + "_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>" + this.get_string("Loading ...") + "</a></li></ul>"), this.element.attr("aria-activedescendant", "j" + this._id + "_loading")), this.load_node(e.jstree.root, function (t, r) { r && (this.get_container_ul()[0].className = i, this._firstChild(this.get_container_ul()[0]) && this.element.attr("aria-activedescendant", this._firstChild(this.get_container_ul()[0]).id), this.set_state(e.extend(!0, {}, this._data.core.state), function () { this.trigger("refresh") })), this._data.core.state = null }) }, refresh_node: function (t) { if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; var r = [], i = [], s = this._data.core.selected.concat([]); i.push(t.id), !0 === t.state.opened && r.push(t.id), this.get_node(t, !0).find(".jstree-open").each(function () { i.push(this.id), r.push(this.id) }), this._load_nodes(i, e.proxy(function (e) { this.open_node(r, !1, 0), this.select_node(s), this.trigger("refresh_node", { node: t, nodes: e }) }, this), !1, !0) }, set_id: function (t, r) { if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; var i, s, a = this._model.data, n = t.id; for (r = r.toString(), a[t.parent].children[e.inArray(t.id, a[t.parent].children)] = r, i = 0, s = t.parents.length; i < s; i++)a[t.parents[i]].children_d[e.inArray(t.id, a[t.parents[i]].children_d)] = r; for (i = 0, s = t.children.length; i < s; i++)a[t.children[i]].parent = r; for (i = 0, s = t.children_d.length; i < s; i++)a[t.children_d[i]].parents[e.inArray(t.id, a[t.children_d[i]].parents)] = r; return -1 !== (i = e.inArray(t.id, this._data.core.selected)) && (this._data.core.selected[i] = r), (i = this.get_node(t.id, !0)) && (i.attr("id", r), this.element.attr("aria-activedescendant") === t.id && this.element.attr("aria-activedescendant", r)), delete a[t.id], t.id = r, t.li_attr.id = r, a[r] = t, this.trigger("set_id", { node: t, new: t.id, old: n }), !0 }, get_text: function (t) { return !(!(t = this.get_node(t)) || t.id === e.jstree.root) && t.text }, set_text: function (t, r) { var i, s; if (e.isArray(t)) { for (i = 0, s = (t = t.slice()).length; i < s; i++)this.set_text(t[i], r); return !0 } return !(!(t = this.get_node(t)) || t.id === e.jstree.root) && (t.text = r, this.get_node(t, !0).length && this.redraw_node(t.id), this.trigger("set_text", { obj: t, text: r }), !0) }, get_json: function (t, r, i) { if (!(t = this.get_node(t || e.jstree.root))) return !1; r && r.flat && !i && (i = []); var s, a, n = { id: t.id, text: t.text, icon: this.get_icon(t), li_attr: e.extend(!0, {}, t.li_attr), a_attr: e.extend(!0, {}, t.a_attr), state: {}, data: (!r || !r.no_data) && e.extend(!0, e.isArray(t.data) ? [] : {}, t.data) }; if (r && r.flat ? n.parent = t.parent : n.children = [], r && r.no_state) delete n.state; else for (s in t.state) t.state.hasOwnProperty(s) && (n.state[s] = t.state[s]); if (r && r.no_li_attr && delete n.li_attr, r && r.no_a_attr && delete n.a_attr, r && r.no_id && (delete n.id, n.li_attr && n.li_attr.id && delete n.li_attr.id, n.a_attr && n.a_attr.id && delete n.a_attr.id), r && r.flat && t.id !== e.jstree.root && i.push(n), !r || !r.no_children) for (s = 0, a = t.children.length; s < a; s++)r && r.flat ? this.get_json(t.children[s], r, i) : n.children.push(this.get_json(t.children[s], r)); return r && r.flat ? i : t.id === e.jstree.root ? n.children : n }, create_node: function (r, i, s, a, n) { if (null === r && (r = e.jstree.root), !(r = this.get_node(r))) return !1; if (!(s = s === t ? "last" : s).toString().match(/^(before|after)$/) && !n && !this.is_loaded(r)) return this.load_node(r, function () { this.create_node(r, i, s, a, !0) }); var o, d, c, l; switch (i || (i = { text: this.get_string("New node") }), (i = "string" == typeof i ? { text: i } : e.extend(!0, {}, i)).text === t && (i.text = this.get_string("New node")), r.id === e.jstree.root && ("before" === s && (s = "first"), "after" === s && (s = "last")), s) { case "before": o = this.get_node(r.parent), s = e.inArray(r.id, o.children), r = o; break; case "after": o = this.get_node(r.parent), s = e.inArray(r.id, o.children) + 1, r = o; break; case "inside": case "first": s = 0; break; case "last": s = r.children.length; break; default: s || (s = 0) }if (s > r.children.length && (s = r.children.length), i.id || (i.id = !0), !this.check("create_node", i, r, s)) return this.settings.core.error.call(this, this._data.core.last_error), !1; if (!0 === i.id && delete i.id, !(i = this._parse_model_from_json(i, r.id, r.parents.concat()))) return !1; for (o = this.get_node(i), (d = []).push(i), d = d.concat(o.children_d), this.trigger("model", { nodes: d, parent: r.id }), r.children_d = r.children_d.concat(d), c = 0, l = r.parents.length; c < l; c++)this._model.data[r.parents[c]].children_d = this._model.data[r.parents[c]].children_d.concat(d); for (i = o, o = [], c = 0, l = r.children.length; c < l; c++)o[c >= s ? c + 1 : c] = r.children[c]; return o[s] = i.id, r.children = o, this.redraw_node(r, !0), this.trigger("create_node", { node: this.get_node(i), parent: r.id, position: s }), a && a.call(this, this.get_node(i)), i.id }, rename_node: function (t, r) { var i, s, a; if (e.isArray(t)) { for (i = 0, s = (t = t.slice()).length; i < s; i++)this.rename_node(t[i], r); return !0 } return !(!(t = this.get_node(t)) || t.id === e.jstree.root) && (a = t.text, this.check("rename_node", t, this.get_parent(t), r) ? (this.set_text(t, r), this.trigger("rename_node", { node: t, text: r, old: a }), !0) : (this.settings.core.error.call(this, this._data.core.last_error), !1)) }, delete_node: function (t) { var r, i, s, a, n, o, d, c, l, h, _, u; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.delete_node(t[r]); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; if (s = this.get_node(t.parent), a = e.inArray(t.id, s.children), h = !1, !this.check("delete_node", t, s, a)) return this.settings.core.error.call(this, this._data.core.last_error), !1; for (-1 !== a && (s.children = e.vakata.array_remove(s.children, a)), (n = t.children_d.concat([])).push(t.id), o = 0, d = t.parents.length; o < d; o++)this._model.data[t.parents[o]].children_d = e.vakata.array_filter(this._model.data[t.parents[o]].children_d, function (t) { return -1 === e.inArray(t, n) }); for (c = 0, l = n.length; c < l; c++)if (this._model.data[n[c]].state.selected) { h = !0; break } for (h && (this._data.core.selected = e.vakata.array_filter(this._data.core.selected, function (t) { return -1 === e.inArray(t, n) })), this.trigger("delete_node", { node: t, parent: s.id }), h && this.trigger("changed", { action: "delete_node", node: t, selected: this._data.core.selected, parent: s.id }), c = 0, l = n.length; c < l; c++)delete this._model.data[n[c]]; return -1 !== e.inArray(this._data.core.focused, n) && (this._data.core.focused = null, _ = this.element[0].scrollTop, u = this.element[0].scrollLeft, s.id === e.jstree.root ? this._model.data[e.jstree.root].children[0] && this.get_node(this._model.data[e.jstree.root].children[0], !0).children(".jstree-anchor").focus() : this.get_node(s, !0).children(".jstree-anchor").focus(), this.element[0].scrollTop = _, this.element[0].scrollLeft = u), this.redraw_node(s, !0), !0 }, check: function (t, r, i, s, a) { r = r && r.id ? r : this.get_node(r), i = i && i.id ? i : this.get_node(i); var n = t.match(/^move_node|copy_node|create_node$/i) ? i : r, o = this.settings.core.check_callback; if ("move_node" === t || "copy_node" === t) { if (!(a && a.is_multi || "move_node" !== t || e.inArray(r.id, i.children) !== s)) return this._data.core.last_error = { error: "check", plugin: "core", id: "core_08", reason: "Moving node to its current position", data: JSON.stringify({ chk: t, pos: s, obj: !(!r || !r.id) && r.id, par: !(!i || !i.id) && i.id }) }, !1; if (!(a && a.is_multi || r.id !== i.id && ("move_node" !== t || e.inArray(r.id, i.children) !== s) && -1 === e.inArray(i.id, r.children_d))) return this._data.core.last_error = { error: "check", plugin: "core", id: "core_01", reason: "Moving parent inside child", data: JSON.stringify({ chk: t, pos: s, obj: !(!r || !r.id) && r.id, par: !(!i || !i.id) && i.id }) }, !1 } return n && n.data && (n = n.data), n && n.functions && (!1 === n.functions[t] || !0 === n.functions[t]) ? (!1 === n.functions[t] && (this._data.core.last_error = { error: "check", plugin: "core", id: "core_02", reason: "Node data prevents function: " + t, data: JSON.stringify({ chk: t, pos: s, obj: !(!r || !r.id) && r.id, par: !(!i || !i.id) && i.id }) }), n.functions[t]) : !(!1 === o || e.isFunction(o) && !1 === o.call(this, t, r, i, s, a) || o && !1 === o[t]) || (this._data.core.last_error = { error: "check", plugin: "core", id: "core_03", reason: "User config for core.check_callback prevents function: " + t, data: JSON.stringify({ chk: t, pos: s, obj: !(!r || !r.id) && r.id, par: !(!i || !i.id) && i.id }) }, !1) }, last_error: function () { return this._data.core.last_error }, move_node: function (r, i, s, a, n, o, d) { var c, l, h, _, u, g, f, p, m, v, j, y, k, x; if (i = this.get_node(i), s = s === t ? 0 : s, !i) return !1; if (!s.toString().match(/^(before|after)$/) && !n && !this.is_loaded(i)) return this.load_node(i, function () { this.move_node(r, i, s, a, !0, !1, d) }); if (e.isArray(r)) { if (1 !== r.length) { for (c = 0, l = r.length; c < l; c++)(m = this.move_node(r[c], i, s, a, n, !1, d)) && (i = m, s = "after"); return this.redraw(), !0 } r = r[0] } if (!(r = r && r.id ? r : this.get_node(r)) || r.id === e.jstree.root) return !1; if (h = (r.parent || e.jstree.root).toString(), u = s.toString().match(/^(before|after)$/) && i.id !== e.jstree.root ? this.get_node(i.parent) : i, f = !(g = d || (this._model.data[r.id] ? this : e.jstree.reference(r.id))) || !g._id || this._id !== g._id, _ = g && g._id && h && g._model.data[h] && g._model.data[h].children ? e.inArray(r.id, g._model.data[h].children) : -1, g && g._id && (r = g._model.data[r.id]), f) return !!(m = this.copy_node(r, i, s, a, n, !1, d)) && (g && g.delete_node(r), m); switch (i.id === e.jstree.root && ("before" === s && (s = "first"), "after" === s && (s = "last")), s) { case "before": s = e.inArray(i.id, u.children); break; case "after": s = e.inArray(i.id, u.children) + 1; break; case "inside": case "first": s = 0; break; case "last": s = u.children.length; break; default: s || (s = 0) }if (s > u.children.length && (s = u.children.length), !this.check("move_node", r, u, s, { core: !0, origin: d, is_multi: g && g._id && g._id !== this._id, is_foreign: !g || !g._id })) return this.settings.core.error.call(this, this._data.core.last_error), !1; if (r.parent === u.id) { for (p = u.children.concat(), -1 !== (m = e.inArray(r.id, p)) && (p = e.vakata.array_remove(p, m), s > m && s--), m = [], v = 0, j = p.length; v < j; v++)m[v >= s ? v + 1 : v] = p[v]; m[s] = r.id, u.children = m, this._node_changed(u.id), this.redraw(u.id === e.jstree.root) } else { for ((m = r.children_d.concat()).push(r.id), v = 0, j = r.parents.length; v < j; v++) { for (p = [], y = 0, k = (x = g._model.data[r.parents[v]].children_d).length; y < k; y++)-1 === e.inArray(x[y], m) && p.push(x[y]); g._model.data[r.parents[v]].children_d = p } for (g._model.data[h].children = e.vakata.array_remove_item(g._model.data[h].children, r.id), v = 0, j = u.parents.length; v < j; v++)this._model.data[u.parents[v]].children_d = this._model.data[u.parents[v]].children_d.concat(m); for (p = [], v = 0, j = u.children.length; v < j; v++)p[v >= s ? v + 1 : v] = u.children[v]; for (p[s] = r.id, u.children = p, u.children_d.push(r.id), u.children_d = u.children_d.concat(r.children_d), r.parent = u.id, (m = u.parents.concat()).unshift(u.id), x = r.parents.length, r.parents = m, m = m.concat(), v = 0, j = r.children_d.length; v < j; v++)this._model.data[r.children_d[v]].parents = this._model.data[r.children_d[v]].parents.slice(0, -1 * x), Array.prototype.push.apply(this._model.data[r.children_d[v]].parents, m); h !== e.jstree.root && u.id !== e.jstree.root || (this._model.force_full_redraw = !0), this._model.force_full_redraw || (this._node_changed(h), this._node_changed(u.id)), o || this.redraw() } return a && a.call(this, r, u, s), this.trigger("move_node", { node: r, parent: u.id, position: s, old_parent: h, old_position: _, is_multi: g && g._id && g._id !== this._id, is_foreign: !g || !g._id, old_instance: g, new_instance: this }), r.id }, copy_node: function (r, i, s, a, n, o, d) { var c, l, h, _, u, g, f, p, m, v; if (i = this.get_node(i), s = s === t ? 0 : s, !i) return !1; if (!s.toString().match(/^(before|after)$/) && !n && !this.is_loaded(i)) return this.load_node(i, function () { this.copy_node(r, i, s, a, !0, !1, d) }); if (e.isArray(r)) { if (1 !== r.length) { for (c = 0, l = r.length; c < l; c++)(_ = this.copy_node(r[c], i, s, a, n, !0, d)) && (i = _, s = "after"); return this.redraw(), !0 } r = r[0] } if (!(r = r && r.id ? r : this.get_node(r)) || r.id === e.jstree.root) return !1; switch (p = (r.parent || e.jstree.root).toString(), m = s.toString().match(/^(before|after)$/) && i.id !== e.jstree.root ? this.get_node(i.parent) : i, !(v = d || (this._model.data[r.id] ? this : e.jstree.reference(r.id))) || !v._id || this._id !== v._id, v && v._id && (r = v._model.data[r.id]), i.id === e.jstree.root && ("before" === s && (s = "first"), "after" === s && (s = "last")), s) { case "before": s = e.inArray(i.id, m.children); break; case "after": s = e.inArray(i.id, m.children) + 1; break; case "inside": case "first": s = 0; break; case "last": s = m.children.length; break; default: s || (s = 0) }if (s > m.children.length && (s = m.children.length), !this.check("copy_node", r, m, s, { core: !0, origin: d, is_multi: v && v._id && v._id !== this._id, is_foreign: !v || !v._id })) return this.settings.core.error.call(this, this._data.core.last_error), !1; if (!(f = v ? v.get_json(r, { no_id: !0, no_data: !0, no_state: !0 }) : r)) return !1; if (!0 === f.id && delete f.id, !(f = this._parse_model_from_json(f, m.id, m.parents.concat()))) return !1; for (_ = this.get_node(f), r && r.state && !1 === r.state.loaded && (_.state.loaded = !1), (h = []).push(f), h = h.concat(_.children_d), this.trigger("model", { nodes: h, parent: m.id }), u = 0, g = m.parents.length; u < g; u++)this._model.data[m.parents[u]].children_d = this._model.data[m.parents[u]].children_d.concat(h); for (h = [], u = 0, g = m.children.length; u < g; u++)h[u >= s ? u + 1 : u] = m.children[u]; return h[s] = _.id, m.children = h, m.children_d.push(_.id), m.children_d = m.children_d.concat(_.children_d), m.id === e.jstree.root && (this._model.force_full_redraw = !0), this._model.force_full_redraw || this._node_changed(m.id), o || this.redraw(m.id === e.jstree.root), a && a.call(this, _, m, s), this.trigger("copy_node", { node: _, original: r, parent: m.id, position: s, old_parent: p, old_position: v && v._id && p && v._model.data[p] && v._model.data[p].children ? e.inArray(r.id, v._model.data[p].children) : -1, is_multi: v && v._id && v._id !== this._id, is_foreign: !v || !v._id, old_instance: v, new_instance: this }), _.id }, cut: function (t) { if (t || (t = this._data.core.selected.concat()), e.isArray(t) || (t = [t]), !t.length) return !1; var r, n, o, d = []; for (n = 0, o = t.length; n < o; n++)(r = this.get_node(t[n])) && r.id && r.id !== e.jstree.root && d.push(r); if (!d.length) return !1; i = d, a = this, s = "move_node", this.trigger("cut", { node: t }) }, copy: function (t) { if (t || (t = this._data.core.selected.concat()), e.isArray(t) || (t = [t]), !t.length) return !1; var r, n, o, d = []; for (n = 0, o = t.length; n < o; n++)(r = this.get_node(t[n])) && r.id && r.id !== e.jstree.root && d.push(r); if (!d.length) return !1; i = d, a = this, s = "copy_node", this.trigger("copy", { node: t }) }, get_buffer: function () { return { mode: s, node: i, inst: a } }, can_paste: function () { return !1 !== s && !1 !== i }, paste: function (e, t) { if (!((e = this.get_node(e)) && s && s.match(/^(copy_node|move_node)$/) && i)) return !1; this[s](i, e, t, !1, !1, !1, a) && this.trigger("paste", { parent: e.id, node: i, mode: s }), i = !1, s = !1, a = !1 }, clear_buffer: function () { i = !1, s = !1, a = !1, this.trigger("clear_buffer") }, edit: function (t, r, i) { var s, a, n, o, c, l, h, _, u, g = !1; return !!(t = this.get_node(t)) && (this.check("edit", t, this.get_parent(t)) ? (u = t, r = "string" == typeof r ? r : t.text, this.set_text(t, ""), t = this._open_to(t), u.text = r, s = this._data.core.rtl, a = this.element.width(), this._data.core.focused = u.id, n = t.children(".jstree-anchor").focus(), o = e("<span>"), c = r, l = e("<div />", { css: { position: "absolute", top: "-200px", left: s ? "0px" : "-1000px", visibility: "hidden" } }).appendTo(d.body), h = e("<input />", { value: c, class: "jstree-rename-input", css: { padding: "0", border: "1px solid silver", "box-sizing": "border-box", display: "inline-block", height: this._data.core.li_height + "px", lineHeight: this._data.core.li_height + "px", width: "150px" }, blur: e.proxy(function (r) { r.stopImmediatePropagation(), r.preventDefault(); var s, a = o.children(".jstree-rename-input").val(), d = this.settings.core.force_text; "" === a && (a = c), l.remove(), o.replaceWith(n), o.remove(), c = d ? c : e("<div></div>").append(e.parseHTML(c)).html(), t = this.get_node(t), this.set_text(t, c), (s = !!this.rename_node(t, d ? e("<div></div>").text(a).text() : e("<div></div>").append(e.parseHTML(a)).html())) || this.set_text(t, c), this._data.core.focused = u.id, setTimeout(e.proxy(function () { var e = this.get_node(u.id, !0); e.length && (this._data.core.focused = u.id, e.children(".jstree-anchor").focus()) }, this), 0), i && i.call(this, u, s, g), h = null }, this), keydown: function (e) { var t = e.which; 27 === t && (g = !0, this.value = c), 27 !== t && 13 !== t && 37 !== t && 38 !== t && 39 !== t && 40 !== t && 32 !== t || e.stopImmediatePropagation(), 27 !== t && 13 !== t || (e.preventDefault(), this.blur()) }, click: function (e) { e.stopImmediatePropagation() }, mousedown: function (e) { e.stopImmediatePropagation() }, keyup: function (e) { h.width(Math.min(l.text("pW" + this.value).width(), a)) }, keypress: function (e) { if (13 === e.which) return !1 } }), _ = { fontFamily: n.css("fontFamily") || "", fontSize: n.css("fontSize") || "", fontWeight: n.css("fontWeight") || "", fontStyle: n.css("fontStyle") || "", fontStretch: n.css("fontStretch") || "", fontVariant: n.css("fontVariant") || "", letterSpacing: n.css("letterSpacing") || "", wordSpacing: n.css("wordSpacing") || "" }, o.attr("class", n.attr("class")).append(n.contents().clone()).append(h), n.replaceWith(o), l.css(_), h.css(_).width(Math.min(l.text("pW" + h[0].value).width(), a))[0].select(), void e(d).one("mousedown.jstree touchstart.jstree dnd_start.vakata", function (t) { h && t.target !== h && e(h).blur() })) : (this.settings.core.error.call(this, this._data.core.last_error), !1)) }, set_theme: function (t, r) { if (!t) return !1; if (!0 === r) { var i = this.settings.core.themes.dir; i || (i = e.jstree.path + "/themes"), r = i + "/" + t + "/style.css" } r && -1 === e.inArray(r, n) && (e("head").append('<link rel="stylesheet" href="' + r + '" type="text/css" />'), n.push(r)), this._data.core.themes.name && this.element.removeClass("jstree-" + this._data.core.themes.name), this._data.core.themes.name = t, this.element.addClass("jstree-" + t), this.element[this.settings.core.themes.responsive ? "addClass" : "removeClass"]("jstree-" + t + "-responsive"), this.trigger("set_theme", { theme: t }) }, get_theme: function () { return this._data.core.themes.name }, set_theme_variant: function (e) { this._data.core.themes.variant && this.element.removeClass("jstree-" + this._data.core.themes.name + "-" + this._data.core.themes.variant), this._data.core.themes.variant = e, e && this.element.addClass("jstree-" + this._data.core.themes.name + "-" + this._data.core.themes.variant) }, get_theme_variant: function () { return this._data.core.themes.variant }, show_stripes: function () { this._data.core.themes.stripes = !0, this.get_container_ul().addClass("jstree-striped"), this.trigger("show_stripes") }, hide_stripes: function () { this._data.core.themes.stripes = !1, this.get_container_ul().removeClass("jstree-striped"), this.trigger("hide_stripes") }, toggle_stripes: function () { this._data.core.themes.stripes ? this.hide_stripes() : this.show_stripes() }, show_dots: function () { this._data.core.themes.dots = !0, this.get_container_ul().removeClass("jstree-no-dots"), this.trigger("show_dots") }, hide_dots: function () { this._data.core.themes.dots = !1, this.get_container_ul().addClass("jstree-no-dots"), this.trigger("hide_dots") }, toggle_dots: function () { this._data.core.themes.dots ? this.hide_dots() : this.show_dots() }, show_icons: function () { this._data.core.themes.icons = !0, this.get_container_ul().removeClass("jstree-no-icons"), this.trigger("show_icons") }, hide_icons: function () { this._data.core.themes.icons = !1, this.get_container_ul().addClass("jstree-no-icons"), this.trigger("hide_icons") }, toggle_icons: function () { this._data.core.themes.icons ? this.hide_icons() : this.show_icons() }, show_ellipsis: function () { this._data.core.themes.ellipsis = !0, this.get_container_ul().addClass("jstree-ellipsis"), this.trigger("show_ellipsis") }, hide_ellipsis: function () { this._data.core.themes.ellipsis = !1, this.get_container_ul().removeClass("jstree-ellipsis"), this.trigger("hide_ellipsis") }, toggle_ellipsis: function () { this._data.core.themes.ellipsis ? this.hide_ellipsis() : this.show_ellipsis() }, set_icon: function (r, i) { var s, a, n, o; if (e.isArray(r)) { for (s = 0, a = (r = r.slice()).length; s < a; s++)this.set_icon(r[s], i); return !0 } return !(!(r = this.get_node(r)) || r.id === e.jstree.root) && (o = r.icon, r.icon = !0 === i || null === i || i === t || "" === i || i, n = this.get_node(r, !0).children(".jstree-anchor").children(".jstree-themeicon"), !1 === i ? (n.removeClass("jstree-themeicon-custom " + o).css("background", "").removeAttr("rel"), this.hide_icon(r)) : !0 === i || null === i || i === t || "" === i ? (n.removeClass("jstree-themeicon-custom " + o).css("background", "").removeAttr("rel"), !1 === o && this.show_icon(r)) : -1 === i.indexOf("/") && -1 === i.indexOf(".") ? (n.removeClass(o).css("background", ""), n.addClass(i + " jstree-themeicon-custom").attr("rel", i), !1 === o && this.show_icon(r)) : (n.removeClass(o).css("background", ""), n.addClass("jstree-themeicon-custom").css("background", "url('" + i + "') center center no-repeat").attr("rel", i), !1 === o && this.show_icon(r)), !0) }, get_icon: function (t) { return !(!(t = this.get_node(t)) || t.id === e.jstree.root) && t.icon }, hide_icon: function (t) { var r, i; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.hide_icon(t[r]); return !0 } return !(!(t = this.get_node(t)) || t === e.jstree.root) && (t.icon = !1, this.get_node(t, !0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"), !0) }, show_icon: function (t) { var r, i, s; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.show_icon(t[r]); return !0 } return !(!(t = this.get_node(t)) || t === e.jstree.root) && (s = this.get_node(t, !0), t.icon = !s.length || s.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"), t.icon || (t.icon = !0), s.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"), !0) } }, e.vakata = {}, e.vakata.attributes = function (t, r) { t = e(t)[0]; var i = r ? {} : []; return t && t.attributes && e.each(t.attributes, function (t, s) { -1 === e.inArray(s.name.toLowerCase(), ["style", "contenteditable", "hasfocus", "tabindex"]) && null !== s.value && "" !== e.trim(s.value) && (r ? i[s.name] = s.value : i.push(s.name)) }), i }, e.vakata.array_unique = function (e) { var r, i, s = [], a = {}; for (r = 0, i = e.length; r < i; r++)a[e[r]] === t && (s.push(e[r]), a[e[r]] = !0); return s }, e.vakata.array_remove = function (e, t) { return e.splice(t, 1), e }, e.vakata.array_remove_item = function (t, r) { var i = e.inArray(r, t); return -1 !== i ? e.vakata.array_remove(t, i) : t }, e.vakata.array_filter = function (e, t, r, i, s) { if (e.filter) return e.filter(t, r); for (s in i = [], e) ~~s + "" == s + "" && s >= 0 && t.call(r, e[s], +s, e) && i.push(e[s]); return i }, e.jstree.plugins.changed = function (e, t) { var r = []; this.trigger = function (e, i) { var s, a; if (i || (i = {}), "changed" === e.replace(".jstree", "")) { i.changed = { selected: [], deselected: [] }; var n = {}; for (s = 0, a = r.length; s < a; s++)n[r[s]] = 1; for (s = 0, a = i.selected.length; s < a; s++)n[i.selected[s]] ? n[i.selected[s]] = 2 : i.changed.selected.push(i.selected[s]); for (s = 0, a = r.length; s < a; s++)1 === n[r[s]] && i.changed.deselected.push(r[s]); r = i.selected.slice() } t.trigger.call(this, e, i) }, this.refresh = function (e, i) { return r = [], t.refresh.apply(this, arguments) } }; var c, l, h = d.createElement("I"); h.className = "jstree-icon jstree-checkbox", h.setAttribute("role", "presentation"), e.jstree.defaults.checkbox = { visible: !0, three_state: !0, whole_node: !0, keep_selected_style: !0, cascade: "", tie_selection: !0, cascade_to_disabled: !0, cascade_to_hidden: !0 }, e.jstree.plugins.checkbox = function (r, i) { this.bind = function () { i.bind.call(this), this._data.checkbox.uto = !1, this._data.checkbox.selected = [], this.settings.checkbox.three_state && (this.settings.checkbox.cascade = "up+down+undetermined"), this.element.on("init.jstree", e.proxy(function () { this._data.checkbox.visible = this.settings.checkbox.visible, this.settings.checkbox.keep_selected_style || this.element.addClass("jstree-checkbox-no-clicked"), this.settings.checkbox.tie_selection && this.element.addClass("jstree-checkbox-selection") }, this)).on("loading.jstree", e.proxy(function () { this[this._data.checkbox.visible ? "show_checkboxes" : "hide_checkboxes"]() }, this)), -1 !== this.settings.checkbox.cascade.indexOf("undetermined") && this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree", e.proxy(function () { this._data.checkbox.uto && clearTimeout(this._data.checkbox.uto), this._data.checkbox.uto = setTimeout(e.proxy(this._undetermined, this), 50) }, this)), this.settings.checkbox.tie_selection || this.element.on("model.jstree", e.proxy(function (e, t) { var r, i, s = this._model.data, a = (s[t.parent], t.nodes); for (r = 0, i = a.length; r < i; r++)s[a[r]].state.checked = s[a[r]].state.checked || s[a[r]].original && s[a[r]].original.state && s[a[r]].original.state.checked, s[a[r]].state.checked && this._data.checkbox.selected.push(a[r]) }, this)), -1 === this.settings.checkbox.cascade.indexOf("up") && -1 === this.settings.checkbox.cascade.indexOf("down") || this.element.on("model.jstree", e.proxy(function (t, r) { var i, s, a, n, o, d, c = this._model.data, l = c[r.parent], h = r.nodes, _ = [], u = this.settings.checkbox.cascade, g = this.settings.checkbox.tie_selection; if (-1 !== u.indexOf("down")) if (l.state[g ? "selected" : "checked"]) { for (s = 0, a = h.length; s < a; s++)c[h[s]].state[g ? "selected" : "checked"] = !0; this._data[g ? "core" : "checkbox"].selected = this._data[g ? "core" : "checkbox"].selected.concat(h) } else for (s = 0, a = h.length; s < a; s++)if (c[h[s]].state[g ? "selected" : "checked"]) { for (n = 0, o = c[h[s]].children_d.length; n < o; n++)c[c[h[s]].children_d[n]].state[g ? "selected" : "checked"] = !0; this._data[g ? "core" : "checkbox"].selected = this._data[g ? "core" : "checkbox"].selected.concat(c[h[s]].children_d) } if (-1 !== u.indexOf("up")) { for (s = 0, a = l.children_d.length; s < a; s++)c[l.children_d[s]].children.length || _.push(c[l.children_d[s]].parent); for (n = 0, o = (_ = e.vakata.array_unique(_)).length; n < o; n++)for (l = c[_[n]]; l && l.id !== e.jstree.root;) { for (i = 0, s = 0, a = l.children.length; s < a; s++)i += c[l.children[s]].state[g ? "selected" : "checked"]; if (i !== a) break; l.state[g ? "selected" : "checked"] = !0, this._data[g ? "core" : "checkbox"].selected.push(l.id), (d = this.get_node(l, !0)) && d.length && d.attr("aria-selected", !0).children(".jstree-anchor").addClass(g ? "jstree-clicked" : "jstree-checked"), l = this.get_node(l.parent) } } this._data[g ? "core" : "checkbox"].selected = e.vakata.array_unique(this._data[g ? "core" : "checkbox"].selected) }, this)).on(this.settings.checkbox.tie_selection ? "select_node.jstree" : "check_node.jstree", e.proxy(function (t, r) { var i, s, a, n, o = r.node, d = this._model.data, c = this.get_node(o.parent), l = this.settings.checkbox.cascade, h = this.settings.checkbox.tie_selection, _ = {}, u = this._data[h ? "core" : "checkbox"].selected; for (i = 0, s = u.length; i < s; i++)_[u[i]] = !0; if (-1 !== l.indexOf("down")) { var g = this._cascade_new_checked_state(o.id, !0), f = o.children_d.concat(o.id); for (i = 0, s = f.length; i < s; i++)g.indexOf(f[i]) > -1 ? _[f[i]] = !0 : delete _[f[i]] } if (-1 !== l.indexOf("up")) for (; c && c.id !== e.jstree.root;) { for (a = 0, i = 0, s = c.children.length; i < s; i++)a += d[c.children[i]].state[h ? "selected" : "checked"]; if (a !== s) break; c.state[h ? "selected" : "checked"] = !0, _[c.id] = !0, (n = this.get_node(c, !0)) && n.length && n.attr("aria-selected", !0).children(".jstree-anchor").addClass(h ? "jstree-clicked" : "jstree-checked"), c = this.get_node(c.parent) } for (i in u = [], _) _.hasOwnProperty(i) && u.push(i); this._data[h ? "core" : "checkbox"].selected = u }, this)).on(this.settings.checkbox.tie_selection ? "deselect_all.jstree" : "uncheck_all.jstree", e.proxy(function (t, r) { var i, s, a, n = this.get_node(e.jstree.root), o = this._model.data; for (i = 0, s = n.children_d.length; i < s; i++)(a = o[n.children_d[i]]) && a.original && a.original.state && a.original.state.undetermined && (a.original.state.undetermined = !1) }, this)).on(this.settings.checkbox.tie_selection ? "deselect_node.jstree" : "uncheck_node.jstree", e.proxy(function (t, r) { var i, s, a, n = r.node, o = (this.get_node(n, !0), this.settings.checkbox.cascade), d = this.settings.checkbox.tie_selection, c = this._data[d ? "core" : "checkbox"].selected, l = n.children_d.concat(n.id); if (-1 !== o.indexOf("down")) { var h = this._cascade_new_checked_state(n.id, !1); c = e.vakata.array_filter(c, function (e) { return -1 === l.indexOf(e) || h.indexOf(e) > -1 }) } if (-1 !== o.indexOf("up") && -1 === c.indexOf(n.id)) { for (i = 0, s = n.parents.length; i < s; i++)(a = this._model.data[n.parents[i]]).state[d ? "selected" : "checked"] = !1, a && a.original && a.original.state && a.original.state.undetermined && (a.original.state.undetermined = !1), (a = this.get_node(n.parents[i], !0)) && a.length && a.attr("aria-selected", !1).children(".jstree-anchor").removeClass(d ? "jstree-clicked" : "jstree-checked"); c = e.vakata.array_filter(c, function (e) { return -1 === n.parents.indexOf(e) }) } this._data[d ? "core" : "checkbox"].selected = c }, this)), -1 !== this.settings.checkbox.cascade.indexOf("up") && this.element.on("delete_node.jstree", e.proxy(function (t, r) { for (var i, s, a, n, o = this.get_node(r.parent), d = this._model.data, c = this.settings.checkbox.tie_selection; o && o.id !== e.jstree.root && !o.state[c ? "selected" : "checked"];) { for (a = 0, i = 0, s = o.children.length; i < s; i++)a += d[o.children[i]].state[c ? "selected" : "checked"]; if (!(s > 0 && a === s)) break; o.state[c ? "selected" : "checked"] = !0, this._data[c ? "core" : "checkbox"].selected.push(o.id), (n = this.get_node(o, !0)) && n.length && n.attr("aria-selected", !0).children(".jstree-anchor").addClass(c ? "jstree-clicked" : "jstree-checked"), o = this.get_node(o.parent) } }, this)).on("move_node.jstree", e.proxy(function (t, r) { var i, s, a, n, o, d = r.is_multi, c = r.old_parent, l = this.get_node(r.parent), h = this._model.data, _ = this.settings.checkbox.tie_selection; if (!d) for (i = this.get_node(c); i && i.id !== e.jstree.root && !i.state[_ ? "selected" : "checked"];) { for (s = 0, a = 0, n = i.children.length; a < n; a++)s += h[i.children[a]].state[_ ? "selected" : "checked"]; if (!(n > 0 && s === n)) break; i.state[_ ? "selected" : "checked"] = !0, this._data[_ ? "core" : "checkbox"].selected.push(i.id), (o = this.get_node(i, !0)) && o.length && o.attr("aria-selected", !0).children(".jstree-anchor").addClass(_ ? "jstree-clicked" : "jstree-checked"), i = this.get_node(i.parent) } for (i = l; i && i.id !== e.jstree.root;) { for (s = 0, a = 0, n = i.children.length; a < n; a++)s += h[i.children[a]].state[_ ? "selected" : "checked"]; if (s === n) i.state[_ ? "selected" : "checked"] || (i.state[_ ? "selected" : "checked"] = !0, this._data[_ ? "core" : "checkbox"].selected.push(i.id), (o = this.get_node(i, !0)) && o.length && o.attr("aria-selected", !0).children(".jstree-anchor").addClass(_ ? "jstree-clicked" : "jstree-checked")); else { if (!i.state[_ ? "selected" : "checked"]) break; i.state[_ ? "selected" : "checked"] = !1, this._data[_ ? "core" : "checkbox"].selected = e.vakata.array_remove_item(this._data[_ ? "core" : "checkbox"].selected, i.id), (o = this.get_node(i, !0)) && o.length && o.attr("aria-selected", !1).children(".jstree-anchor").removeClass(_ ? "jstree-clicked" : "jstree-checked") } i = this.get_node(i.parent) } }, this)) }, this.get_undetermined = function (r) { if (-1 === this.settings.checkbox.cascade.indexOf("undetermined")) return []; var i, s, a, n, o = {}, d = this._model.data, c = this.settings.checkbox.tie_selection, l = this._data[c ? "core" : "checkbox"].selected, h = [], _ = this, u = []; for (i = 0, s = l.length; i < s; i++)if (d[l[i]] && d[l[i]].parents) for (a = 0, n = d[l[i]].parents.length; a < n && o[d[l[i]].parents[a]] === t; a++)d[l[i]].parents[a] !== e.jstree.root && (o[d[l[i]].parents[a]] = !0, h.push(d[l[i]].parents[a])); for (this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function () { var r, c = _.get_node(this); if (c) if (c.state.loaded) { for (i = 0, s = c.children_d.length; i < s; i++)if (!(r = d[c.children_d[i]]).state.loaded && r.original && r.original.state && r.original.state.undetermined && !0 === r.original.state.undetermined) for (o[r.id] === t && r.id !== e.jstree.root && (o[r.id] = !0, h.push(r.id)), a = 0, n = r.parents.length; a < n; a++)o[r.parents[a]] === t && r.parents[a] !== e.jstree.root && (o[r.parents[a]] = !0, h.push(r.parents[a])) } else if (c.original && c.original.state && c.original.state.undetermined && !0 === c.original.state.undetermined) for (o[c.id] === t && c.id !== e.jstree.root && (o[c.id] = !0, h.push(c.id)), a = 0, n = c.parents.length; a < n; a++)o[c.parents[a]] === t && c.parents[a] !== e.jstree.root && (o[c.parents[a]] = !0, h.push(c.parents[a])) }), i = 0, s = h.length; i < s; i++)d[h[i]].state[c ? "selected" : "checked"] || u.push(r ? d[h[i]] : h[i]); return u }, this._undetermined = function () { if (null !== this.element) { var e, t, r, i = this.get_undetermined(!1); for (this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"), e = 0, t = i.length; e < t; e++)(r = this.get_node(i[e], !0)) && r.length && r.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined") } }, this.redraw_node = function (t, r, s, a) { if (t = i.redraw_node.apply(this, arguments)) { var n, o, d = null, c = null; for (n = 0, o = t.childNodes.length; n < o; n++)if (t.childNodes[n] && t.childNodes[n].className && -1 !== t.childNodes[n].className.indexOf("jstree-anchor")) { d = t.childNodes[n]; break } d && (!this.settings.checkbox.tie_selection && this._model.data[t.id].state.checked && (d.className += " jstree-checked"), c = h.cloneNode(!1), this._model.data[t.id].state.checkbox_disabled && (c.className += " jstree-checkbox-disabled"), d.insertBefore(c, d.childNodes[0])) } return s || -1 === this.settings.checkbox.cascade.indexOf("undetermined") || (this._data.checkbox.uto && clearTimeout(this._data.checkbox.uto), this._data.checkbox.uto = setTimeout(e.proxy(this._undetermined, this), 50)), t }, this.show_checkboxes = function () { this._data.core.themes.checkboxes = !0, this.get_container_ul().removeClass("jstree-no-checkboxes") }, this.hide_checkboxes = function () { this._data.core.themes.checkboxes = !1, this.get_container_ul().addClass("jstree-no-checkboxes") }, this.toggle_checkboxes = function () { this._data.core.themes.checkboxes ? this.hide_checkboxes() : this.show_checkboxes() }, this.is_undetermined = function (t) { t = this.get_node(t); var r, i, s = this.settings.checkbox.cascade, a = this.settings.checkbox.tie_selection, n = this._data[a ? "core" : "checkbox"].selected, o = this._model.data; if (!t || !0 === t.state[a ? "selected" : "checked"] || -1 === s.indexOf("undetermined") || -1 === s.indexOf("down") && -1 === s.indexOf("up")) return !1; if (!t.state.loaded && !0 === t.original.state.undetermined) return !0; for (r = 0, i = t.children_d.length; r < i; r++)if (-1 !== e.inArray(t.children_d[r], n) || !o[t.children_d[r]].state.loaded && o[t.children_d[r]].original.state.undetermined) return !0; return !1 }, this.disable_checkbox = function (t) { var r, i, s; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.disable_checkbox(t[r]); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; s = this.get_node(t, !0), t.state.checkbox_disabled || (t.state.checkbox_disabled = !0, s && s.length && s.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"), this.trigger("disable_checkbox", { node: t })) }, this.enable_checkbox = function (t) { var r, i, s; if (e.isArray(t)) { for (r = 0, i = (t = t.slice()).length; r < i; r++)this.enable_checkbox(t[r]); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; s = this.get_node(t, !0), t.state.checkbox_disabled && (t.state.checkbox_disabled = !1, s && s.length && s.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"), this.trigger("enable_checkbox", { node: t })) }, this.activate_node = function (t, r) { return !e(r.target).hasClass("jstree-checkbox-disabled") && (this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || e(r.target).hasClass("jstree-checkbox")) && (r.ctrlKey = !0), this.settings.checkbox.tie_selection || !this.settings.checkbox.whole_node && !e(r.target).hasClass("jstree-checkbox") ? i.activate_node.call(this, t, r) : !this.is_disabled(t) && (this.is_checked(t) ? this.uncheck_node(t, r) : this.check_node(t, r), void this.trigger("activate_node", { node: this.get_node(t) }))) }, this._cascade_new_checked_state = function (e, t) { var r, i, s, a = this.settings.checkbox.tie_selection, n = this._model.data[e], o = [], d = []; if (!this.settings.checkbox.cascade_to_disabled && n.state.disabled || !this.settings.checkbox.cascade_to_hidden && n.state.hidden) s = this.get_checked_descendants(e), n.state[a ? "selected" : "checked"] && s.push(n.id), o = o.concat(s); else { if (n.children) for (r = 0, i = n.children.length; r < i; r++) { var c = n.children[r]; s = this._cascade_new_checked_state(c, t), o = o.concat(s), s.indexOf(c) > -1 && d.push(c) } var l = this.get_node(n, !0), h = d.length > 0 && d.length < n.children.length; n.original && n.original.state && n.original.state.undetermined && (n.original.state.undetermined = h), h ? (n.state[a ? "selected" : "checked"] = !1, l.attr("aria-selected", !1).children(".jstree-anchor").removeClass(a ? "jstree-clicked" : "jstree-checked")) : t && d.length === n.children.length ? (n.state[a ? "selected" : "checked"] = t, o.push(n.id), l.attr("aria-selected", !0).children(".jstree-anchor").addClass(a ? "jstree-clicked" : "jstree-checked")) : (n.state[a ? "selected" : "checked"] = !1, l.attr("aria-selected", !1).children(".jstree-anchor").removeClass(a ? "jstree-clicked" : "jstree-checked")) } return o }, this.get_checked_descendants = function (t) { var r = this, i = r.settings.checkbox.tie_selection, s = r._model.data[t]; return e.vakata.array_filter(s.children_d, function (e) { return r._model.data[e].state[i ? "selected" : "checked"] }) }, this.check_node = function (t, r) { if (this.settings.checkbox.tie_selection) return this.select_node(t, !1, !0, r); var i, s, a; if (e.isArray(t)) { for (s = 0, a = (t = t.slice()).length; s < a; s++)this.check_node(t[s], r); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; i = this.get_node(t, !0), t.state.checked || (t.state.checked = !0, this._data.checkbox.selected.push(t.id), i && i.length && i.children(".jstree-anchor").addClass("jstree-checked"), this.trigger("check_node", { node: t, selected: this._data.checkbox.selected, event: r })) }, this.uncheck_node = function (t, r) { if (this.settings.checkbox.tie_selection) return this.deselect_node(t, !1, r); var i, s, a; if (e.isArray(t)) { for (i = 0, s = (t = t.slice()).length; i < s; i++)this.uncheck_node(t[i], r); return !0 } if (!(t = this.get_node(t)) || t.id === e.jstree.root) return !1; a = this.get_node(t, !0), t.state.checked && (t.state.checked = !1, this._data.checkbox.selected = e.vakata.array_remove_item(this._data.checkbox.selected, t.id), a.length && a.children(".jstree-anchor").removeClass("jstree-checked"), this.trigger("uncheck_node", { node: t, selected: this._data.checkbox.selected, event: r })) }, this.check_all = function () { if (this.settings.checkbox.tie_selection) return this.select_all(); var t, r; this._data.checkbox.selected.concat([]); for (this._data.checkbox.selected = this._model.data[e.jstree.root].children_d.concat(), t = 0, r = this._data.checkbox.selected.length; t < r; t++)this._model.data[this._data.checkbox.selected[t]] && (this._model.data[this._data.checkbox.selected[t]].state.checked = !0); this.redraw(!0), this.trigger("check_all", { selected: this._data.checkbox.selected }) }, this.uncheck_all = function () { if (this.settings.checkbox.tie_selection) return this.deselect_all(); var e, t, r = this._data.checkbox.selected.concat([]); for (e = 0, t = this._data.checkbox.selected.length; e < t; e++)this._model.data[this._data.checkbox.selected[e]] && (this._model.data[this._data.checkbox.selected[e]].state.checked = !1); this._data.checkbox.selected = [], this.element.find(".jstree-checked").removeClass("jstree-checked"), this.trigger("uncheck_all", { selected: this._data.checkbox.selected, node: r }) }, this.is_checked = function (t) { return this.settings.checkbox.tie_selection ? this.is_selected(t) : !(!(t = this.get_node(t)) || t.id === e.jstree.root) && t.state.checked }, this.get_checked = function (t) { return this.settings.checkbox.tie_selection ? this.get_selected(t) : t ? e.map(this._data.checkbox.selected, e.proxy(function (e) { return this.get_node(e) }, this)) : this._data.checkbox.selected.slice() }, this.get_top_checked = function (t) { if (this.settings.checkbox.tie_selection) return this.get_top_selected(t); var r, i, s, a, n = this.get_checked(!0), o = {}; for (r = 0, i = n.length; r < i; r++)o[n[r].id] = n[r]; for (r = 0, i = n.length; r < i; r++)for (s = 0, a = n[r].children_d.length; s < a; s++)o[n[r].children_d[s]] && delete o[n[r].children_d[s]]; for (r in n = [], o) o.hasOwnProperty(r) && n.push(r); return t ? e.map(n, e.proxy(function (e) { return this.get_node(e) }, this)) : n }, this.get_bottom_checked = function (t) { if (this.settings.checkbox.tie_selection) return this.get_bottom_selected(t); var r, i, s = this.get_checked(!0), a = []; for (r = 0, i = s.length; r < i; r++)s[r].children.length || a.push(s[r].id); return t ? e.map(a, e.proxy(function (e) { return this.get_node(e) }, this)) : a }, this.load_node = function (t, r) { var s, a, n; if (!e.isArray(t) && !this.settings.checkbox.tie_selection && (n = this.get_node(t)) && n.state.loaded) for (s = 0, a = n.children_d.length; s < a; s++)this._model.data[n.children_d[s]].state.checked && (!0, this._data.checkbox.selected = e.vakata.array_remove_item(this._data.checkbox.selected, n.children_d[s])); return i.load_node.apply(this, arguments) }, this.get_state = function () { var e = i.get_state.apply(this, arguments); return this.settings.checkbox.tie_selection ? e : (e.checkbox = this._data.checkbox.selected.slice(), e) }, this.set_state = function (t, r) { var s = i.set_state.apply(this, arguments); if (s && t.checkbox) { if (!this.settings.checkbox.tie_selection) { this.uncheck_all(); var a = this; e.each(t.checkbox, function (e, t) { a.check_node(t) }) } return delete t.checkbox, this.set_state(t, r), !1 } return s }, this.refresh = function (e, t) { return this.settings.checkbox.tie_selection && (this._data.checkbox.selected = []), i.refresh.apply(this, arguments) } }, e.jstree.defaults.conditionalselect = function () { return !0 }, e.jstree.plugins.conditionalselect = function (e, t) { this.activate_node = function (e, r) { if (this.settings.conditionalselect.call(this, this.get_node(e), r)) return t.activate_node.call(this, e, r) } }, e.jstree.defaults.contextmenu = { select_node: !0, show_at_node: !0, items: function (t, r) { return { create: { separator_before: !1, separator_after: !0, _disabled: !1, label: "Create", action: function (t) { var r = e.jstree.reference(t.reference), i = r.get_node(t.reference); r.create_node(i, {}, "last", function (e) { try { r.edit(e) } catch (t) { setTimeout(function () { r.edit(e) }, 0) } }) } }, rename: { separator_before: !1, separator_after: !1, _disabled: !1, label: "Rename", action: function (t) { var r = e.jstree.reference(t.reference), i = r.get_node(t.reference); r.edit(i) } }, remove: { separator_before: !1, icon: !1, separator_after: !1, _disabled: !1, label: "Delete", action: function (t) { var r = e.jstree.reference(t.reference), i = r.get_node(t.reference); r.is_selected(i) ? r.delete_node(r.get_selected()) : r.delete_node(i) } }, ccp: { separator_before: !0, icon: !1, separator_after: !1, label: "Edit", action: !1, submenu: { cut: { separator_before: !1, separator_after: !1, label: "Cut", action: function (t) { var r = e.jstree.reference(t.reference), i = r.get_node(t.reference); r.is_selected(i) ? r.cut(r.get_top_selected()) : r.cut(i) } }, copy: { separator_before: !1, icon: !1, separator_after: !1, label: "Copy", action: function (t) { var r = e.jstree.reference(t.reference), i = r.get_node(t.reference); r.is_selected(i) ? r.copy(r.get_top_selected()) : r.copy(i) } }, paste: { separator_before: !1, icon: !1, _disabled: function (t) { return !e.jstree.reference(t.reference).can_paste() }, separator_after: !1, label: "Paste", action: function (t) { var r = e.jstree.reference(t.reference), i = r.get_node(t.reference); r.paste(i) } } } } } } }, e.jstree.plugins.contextmenu = function (r, i) { this.bind = function () { i.bind.call(this); var t, r, s = 0, a = null; this.element.on("init.jstree loading.jstree ready.jstree", e.proxy(function () { this.get_container_ul().addClass("jstree-contextmenu") }, this)).on("contextmenu.jstree", ".jstree-anchor", e.proxy(function (e, t) { "input" !== e.target.tagName.toLowerCase() && (e.preventDefault(), s = e.ctrlKey ? +new Date : 0, (t || a) && (s = +new Date + 1e4), a && clearTimeout(a), this.is_loading(e.currentTarget) || this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e)) }, this)).on("click.jstree", ".jstree-anchor", e.proxy(function (t) { this._data.contextmenu.visible && (!s || +new Date - s > 250) && e.vakata.context.hide(), s = 0 }, this)).on("touchstart.jstree", ".jstree-anchor", function (i) { i.originalEvent && i.originalEvent.changedTouches && i.originalEvent.changedTouches[0] && (t = i.originalEvent.changedTouches[0].clientX, r = i.originalEvent.changedTouches[0].clientY, a = setTimeout(function () { e(i.currentTarget).trigger("contextmenu", !0) }, 750)) }).on("touchmove.vakata.jstree", function (i) { a && i.originalEvent && i.originalEvent.changedTouches && i.originalEvent.changedTouches[0] && (Math.abs(t - i.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(r - i.originalEvent.changedTouches[0].clientY) > 10) && (clearTimeout(a), e.vakata.context.hide()) }).on("touchend.vakata.jstree", function (e) { a && clearTimeout(a) }), e(d).on("context_hide.vakata.jstree", e.proxy(function (t, r) { this._data.contextmenu.visible = !1, e(r.reference).removeClass("jstree-context") }, this)) }, this.teardown = function () { this._data.contextmenu.visible && e.vakata.context.hide(), i.teardown.call(this) }, this.show_contextmenu = function (r, i, s, a) { if (!(r = this.get_node(r)) || r.id === e.jstree.root) return !1; var n = this.settings.contextmenu, o = this.get_node(r, !0).children(".jstree-anchor"), d = !1, c = !1; (n.show_at_node || i === t || s === t) && (d = o.offset(), i = d.left, s = d.top + this._data.core.li_height), this.settings.contextmenu.select_node && !this.is_selected(r) && this.activate_node(r, a), c = n.items, e.isFunction(c) && (c = c.call(this, r, e.proxy(function (e) { this._show_contextmenu(r, i, s, e) }, this))), e.isPlainObject(c) && this._show_contextmenu(r, i, s, c) }, this._show_contextmenu = function (t, r, i, s) { var a = this.get_node(t, !0).children(".jstree-anchor"); e(d).one("context_show.vakata.jstree", e.proxy(function (t, r) { var i = "jstree-contextmenu jstree-" + this.get_theme() + "-contextmenu"; e(r.element).addClass(i), a.addClass("jstree-context") }, this)), this._data.contextmenu.visible = !0, e.vakata.context.show(a, { x: r, y: i }, s), this.trigger("show_contextmenu", { node: t, x: r, y: i }) } }, function (e) { var t = !1, r = { element: !1, reference: !1, position_x: 0, position_y: 0, items: [], html: "", is_visible: !1 }; e.vakata.context = { settings: { hide_onmouseleave: 0, icons: !0 }, _trigger: function (t) { e(d).triggerHandler("context_" + t + ".vakata", { reference: r.reference, element: r.element, position: { x: r.position_x, y: r.position_y } }) }, _execute: function (t) { return !(!(t = r.items[t]) || t._disabled && (!e.isFunction(t._disabled) || t._disabled({ item: t, reference: r.reference, element: r.element })) || !t.action) && t.action.call(null, { item: t, reference: r.reference, element: r.element, position: { x: r.position_x, y: r.position_y } }) }, _parse: function (t, i) { if (!t) return !1; i || (r.html = "", r.items = []); var s, a = "", n = !1; return i && (a += "<ul>"), e.each(t, function (t, i) { if (!i) return !0; r.items.push(i), !n && i.separator_before && (a += "<li class='vakata-context-separator'><a href='#' " + (e.vakata.context.settings.icons ? "" : 'style="margin-left:0px;"') + ">&#160;</a></li>"), n = !1, a += "<li class='" + (i._class || "") + (!0 === i._disabled || e.isFunction(i._disabled) && i._disabled({ item: i, reference: r.reference, element: r.element }) ? " vakata-contextmenu-disabled " : "") + "' " + (i.shortcut ? " data-shortcut='" + i.shortcut + "' " : "") + ">", a += "<a href='#' rel='" + (r.items.length - 1) + "' " + (i.title ? "title='" + i.title + "'" : "") + ">", e.vakata.context.settings.icons && (a += "<i ", i.icon && (-1 !== i.icon.indexOf("/") || -1 !== i.icon.indexOf(".") ? a += " style='background:url(\"" + i.icon + "\") center center no-repeat' " : a += " class='" + i.icon + "' "), a += "></i><span class='vakata-contextmenu-sep'>&#160;</span>"), a += (e.isFunction(i.label) ? i.label({ item: t, reference: r.reference, element: r.element }) : i.label) + (i.shortcut ? ' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-' + i.shortcut + '">' + (i.shortcut_label || "") + "</span>" : "") + "</a>", i.submenu && (s = e.vakata.context._parse(i.submenu, !0)) && (a += s), a += "</li>", i.separator_after && (a += "<li class='vakata-context-separator'><a href='#' " + (e.vakata.context.settings.icons ? "" : 'style="margin-left:0px;"') + ">&#160;</a></li>", n = !0) }), a = a.replace(/<li class\='vakata-context-separator'\><\/li\>$/, ""), i && (a += "</ul>"), i || (r.html = a, e.vakata.context._trigger("parse")), a.length > 10 && a }, _show_submenu: function (r) { if ((r = e(r)).length && r.children("ul").length) { var i = r.children("ul"), s = r.offset().left, a = s + r.outerWidth(), n = r.offset().top, o = i.width(), d = i.height(), c = e(window).width() + e(window).scrollLeft(), l = e(window).height() + e(window).scrollTop(); t ? r[a - (o + 10 + r.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left") : r[a + o > c && s > c - a ? "addClass" : "removeClass"]("vakata-context-right"), n + d + 10 > l && i.css("bottom", "-1px"), r.hasClass("vakata-context-right") ? s < o && i.css("margin-right", s - o) : c - a < o && i.css("margin-left", c - a - o), i.show() } }, show: function (i, s, a) { var n, o, c, l, h, _, u, g; switch (r.element && r.element.length && r.element.width(""), !0) { case !s && !i: return !1; case !!s && !!i: r.reference = i, r.position_x = s.x, r.position_y = s.y; break; case !s && !!i: r.reference = i, n = i.offset(), r.position_x = n.left + i.outerHeight(), r.position_y = n.top; break; case !!s && !i: r.position_x = s.x, r.position_y = s.y }i && !a && e(i).data("vakata_contextmenu") && (a = e(i).data("vakata_contextmenu")), e.vakata.context._parse(a) && r.element.html(r.html), r.items.length && (r.element.appendTo(d.body), o = r.element, c = r.position_x, l = r.position_y, h = o.width(), _ = o.height(), u = e(window).width() + e(window).scrollLeft(), g = e(window).height() + e(window).scrollTop(), t && (c -= o.outerWidth() - e(i).outerWidth()) < e(window).scrollLeft() + 20 && (c = e(window).scrollLeft() + 20), c + h + 20 > u && (c = u - (h + 20)), l + _ + 20 > g && (l = g - (_ + 20)), r.element.css({ left: c, top: l }).show().find("a").first().focus().parent().addClass("vakata-context-hover"), r.is_visible = !0, e.vakata.context._trigger("show")) }, hide: function () { r.is_visible && (r.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(), r.is_visible = !1, e.vakata.context._trigger("hide")) } }, e(function () { t = "rtl" === e(d.body).css("direction"); var i = !1; r.element = e("<ul class='vakata-context'></ul>"), r.element.on("mouseenter", "li", function (t) { t.stopImmediatePropagation(), e.contains(this, t.relatedTarget) || (i && clearTimeout(i), r.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(), e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover"), e.vakata.context._show_submenu(this)) }).on("mouseleave", "li", function (t) { e.contains(this, t.relatedTarget) || e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover") }).on("mouseleave", function (t) { e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"), e.vakata.context.settings.hide_onmouseleave && (i = setTimeout(function () { e.vakata.context.hide() }, e.vakata.context.settings.hide_onmouseleave)) }).on("click", "a", function (t) { t.preventDefault(), e(this).blur().parent().hasClass("vakata-context-disabled") || !1 === e.vakata.context._execute(e(this).attr("rel")) || e.vakata.context.hide() }).on("keydown", "a", function (t) { var i = null; switch (t.which) { case 13: case 32: t.type = "click", t.preventDefault(), e(t.currentTarget).trigger(t); break; case 37: r.is_visible && (r.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(), t.stopImmediatePropagation(), t.preventDefault()); break; case 38: r.is_visible && ((i = r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length || (i = r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()), i.addClass("vakata-context-hover").children("a").focus(), t.stopImmediatePropagation(), t.preventDefault()); break; case 39: r.is_visible && (r.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(), t.stopImmediatePropagation(), t.preventDefault()); break; case 40: r.is_visible && ((i = r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length || (i = r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()), i.addClass("vakata-context-hover").children("a").focus(), t.stopImmediatePropagation(), t.preventDefault()); break; case 27: e.vakata.context.hide(), t.preventDefault() } }).on("keydown", function (e) { e.preventDefault(); var t = r.element.find(".vakata-contextmenu-shortcut-" + e.which).parent(); t.parent().not(".vakata-context-disabled") && t.click() }), e(d).on("mousedown.vakata.jstree", function (t) { r.is_visible && r.element[0] !== t.target && !e.contains(r.element[0], t.target) && e.vakata.context.hide() }).on("context_show.vakata.jstree", function (e, i) { r.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"), t && r.element.addClass("vakata-context-rtl").css("direction", "rtl"), r.element.find("ul").hide().end() }) }) }(e), e.jstree.defaults.dnd = { copy: !0, open_timeout: 500, is_draggable: !0, check_while_dragging: !0, always_copy: !1, inside_pos: 0, drag_selection: !0, touch: !0, large_drop_target: !1, large_drag_target: !1, use_html5: !1 }, e.jstree.plugins.dnd = function (t, r) { this.init = function (e, t) { r.init.call(this, e, t), this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && "draggable" in d.createElement("span") }, this.bind = function () { r.bind.call(this), this.element.on(this.settings.dnd.use_html5 ? "dragstart.jstree" : "mousedown.jstree touchstart.jstree", this.settings.dnd.large_drag_target ? ".jstree-node" : ".jstree-anchor", e.proxy(function (t) { if (this.settings.dnd.large_drag_target && e(t.target).closest(".jstree-node")[0] !== t.currentTarget) return !0; if ("touchstart" === t.type && (!this.settings.dnd.touch || "selected" === this.settings.dnd.touch && !e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked"))) return !0; var r = this.get_node(t.target), i = this.is_selected(r) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1, s = i > 1 ? i + " " + this.get_string("nodes") : this.get_text(t.currentTarget); if (this.settings.core.force_text && (s = e.vakata.html.escape(s)), r && r.id && r.id !== e.jstree.root && (1 === t.which || "touchstart" === t.type || "dragstart" === t.type) && (!0 === this.settings.dnd.is_draggable || e.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, i > 1 ? this.get_top_selected(!0) : [r], t))) { if (c = { jstree: !0, origin: this, obj: this.get_node(r, !0), nodes: i > 1 ? this.get_top_selected() : [r.id] }, l = t.currentTarget, !this.settings.dnd.use_html5) return this.element.trigger("mousedown.jstree"), e.vakata.dnd.start(t, c, '<div id="jstree-dnd" class="jstree-' + this.get_theme() + " jstree-" + this.get_theme() + "-" + this.get_theme_variant() + " " + (this.settings.core.themes.responsive ? " jstree-dnd-responsive" : "") + '"><i class="jstree-icon jstree-er"></i>' + s + '<ins class="jstree-copy" style="display:none;">+</ins></div>'); e.vakata.dnd._trigger("start", t, { helper: e(), element: l, data: c }) } }, this)), this.settings.dnd.use_html5 && this.element.on("dragover.jstree", function (t) { return t.preventDefault(), e.vakata.dnd._trigger("move", t, { helper: e(), element: l, data: c }), !1 }).on("drop.jstree", e.proxy(function (t) { return t.preventDefault(), e.vakata.dnd._trigger("stop", t, { helper: e(), element: l, data: c }), !1 }, this)) }, this.redraw_node = function (e, t, i, s) { if ((e = r.redraw_node.apply(this, arguments)) && this.settings.dnd.use_html5) if (this.settings.dnd.large_drag_target) e.setAttribute("draggable", !0); else { var a, n, o = null; for (a = 0, n = e.childNodes.length; a < n; a++)if (e.childNodes[a] && e.childNodes[a].className && -1 !== e.childNodes[a].className.indexOf("jstree-anchor")) { o = e.childNodes[a]; break } o && o.setAttribute("draggable", !0) } return e } }, e(function () { var r = !1, i = !1, s = !1, a = !1, n = e('<div id="jstree-marker">&#160;</div>').hide(); e(d).on("dragover.vakata.jstree", function (t) { l && e.vakata.dnd._trigger("move", t, { helper: e(), element: l, data: c }) }).on("drop.vakata.jstree", function (t) { l && (e.vakata.dnd._trigger("stop", t, { helper: e(), element: l, data: c }), l = null, c = null) }).on("dnd_start.vakata.jstree", function (e, t) { r = !1, s = !1, t && t.data && t.data.jstree && n.appendTo(d.body) }).on("dnd_move.vakata.jstree", function (o, d) { var c = d.event.target !== s.target; if (a && (d.event && "dragover" === d.event.type && !c || clearTimeout(a)), d && d.data && d.data.jstree && (!d.event.target.id || "jstree-marker" !== d.event.target.id)) { s = d.event; var l, h, _, u, g, f, p, m, v, j, y, k, x, b, w, C, A = e.jstree.reference(d.event.target), T = !1, N = !1, O = !1; if (A && A._data && A._data.dnd) if (n.attr("class", "jstree-" + A.get_theme() + (A.settings.core.themes.responsive ? " jstree-dnd-responsive" : "")), w = d.data.origin && (d.data.origin.settings.dnd.always_copy || d.data.origin.settings.dnd.copy && (d.event.metaKey || d.event.ctrlKey)), d.helper.children().attr("class", "jstree-" + A.get_theme() + " jstree-" + A.get_theme() + "-" + A.get_theme_variant() + " " + (A.settings.core.themes.responsive ? " jstree-dnd-responsive" : "")).find(".jstree-copy").first()[w ? "show" : "hide"](), d.event.target !== A.element[0] && d.event.target !== A.get_container_ul()[0] || 0 !== A.get_container_ul().children().length) { if ((T = A.settings.dnd.large_drop_target ? e(d.event.target).closest(".jstree-node").children(".jstree-anchor") : e(d.event.target).closest(".jstree-anchor")) && T.length && T.parent().is(".jstree-closed, .jstree-open, .jstree-leaf") && (N = T.offset(), O = (d.event.pageY !== t ? d.event.pageY : d.event.originalEvent.pageY) - N.top, _ = T.outerHeight(), f = O < _ / 3 ? ["b", "i", "a"] : O > _ - _ / 3 ? ["a", "i", "b"] : O > _ / 2 ? ["i", "a", "b"] : ["i", "b", "a"], e.each(f, function (t, s) { switch (s) { case "b": l = N.left - 6, h = N.top, u = A.get_parent(T), g = T.parent().index(); break; case "i": x = A.settings.dnd.inside_pos, b = A.get_node(T.parent()), l = N.left - 2, h = N.top + _ / 2 + 1, u = b.id, g = "first" === x ? 0 : "last" === x ? b.children.length : Math.min(x, b.children.length); break; case "a": l = N.left - 6, h = N.top + _, u = A.get_parent(T), g = T.parent().index() + 1 }for (p = !0, m = 0, v = d.data.nodes.length; m < v; m++)if (j = d.data.origin && (d.data.origin.settings.dnd.always_copy || d.data.origin.settings.dnd.copy && (d.event.metaKey || d.event.ctrlKey)) ? "copy_node" : "move_node", y = g, "move_node" === j && "a" === s && d.data.origin && d.data.origin === A && u === A.get_parent(d.data.nodes[m]) && (k = A.get_node(u), y > e.inArray(d.data.nodes[m], k.children) && (y -= 1)), !(p = p && (A && A.settings && A.settings.dnd && !1 === A.settings.dnd.check_while_dragging || A.check(j, d.data.origin && d.data.origin !== A ? d.data.origin.get_node(d.data.nodes[m]) : d.data.nodes[m], u, y, { dnd: !0, ref: A.get_node(T.parent()), pos: s, origin: d.data.origin, is_multi: d.data.origin && d.data.origin !== A, is_foreign: !d.data.origin })))) { A && A.last_error && (i = A.last_error()); break } var o, O; if ("i" === s && T.parent().is(".jstree-closed") && A.settings.dnd.open_timeout && (d.event && "dragover" === d.event.type && !c || (a && clearTimeout(a), a = setTimeout((o = A, O = T, function () { o.open_node(O) }), A.settings.dnd.open_timeout))), p) return (C = A.get_node(u, !0)).hasClass(".jstree-dnd-parent") || (e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"), C.addClass("jstree-dnd-parent")), r = { ins: A, par: u, pos: "i" !== s || "last" !== x || 0 !== g || A.is_loaded(b) ? g : "last" }, n.css({ left: l + "px", top: h + "px" }).show(), d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"), d.event.originalEvent && d.event.originalEvent.dataTransfer && (d.event.originalEvent.dataTransfer.dropEffect = w ? "copy" : "move"), i = {}, f = !0, !1 }), !0 === f)) return } else { for (p = !0, m = 0, v = d.data.nodes.length; m < v && (p = p && A.check(d.data.origin && (d.data.origin.settings.dnd.always_copy || d.data.origin.settings.dnd.copy && (d.event.metaKey || d.event.ctrlKey)) ? "copy_node" : "move_node", d.data.origin && d.data.origin !== A ? d.data.origin.get_node(d.data.nodes[m]) : d.data.nodes[m], e.jstree.root, "last", { dnd: !0, ref: A.get_node(e.jstree.root), pos: "i", origin: d.data.origin, is_multi: d.data.origin && d.data.origin !== A, is_foreign: !d.data.origin })); m++); if (p) return r = { ins: A, par: e.jstree.root, pos: "last" }, n.hide(), d.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"), void (d.event.originalEvent && d.event.originalEvent.dataTransfer && (d.event.originalEvent.dataTransfer.dropEffect = w ? "copy" : "move")) } e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"), r = !1, d.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"), d.event.originalEvent && d.event.originalEvent.dataTransfer, n.hide() } }).on("dnd_scroll.vakata.jstree", function (e, t) { t && t.data && t.data.jstree && (n.hide(), r = !1, s = !1, t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er")) }).on("dnd_stop.vakata.jstree", function (t, o) { if (e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"), a && clearTimeout(a), o && o.data && o.data.jstree) { n.hide().detach(); var d, c, l = []; if (r) { for (d = 0, c = o.data.nodes.length; d < c; d++)l[d] = o.data.origin ? o.data.origin.get_node(o.data.nodes[d]) : o.data.nodes[d]; r.ins[o.data.origin && (o.data.origin.settings.dnd.always_copy || o.data.origin.settings.dnd.copy && (o.event.metaKey || o.event.ctrlKey)) ? "copy_node" : "move_node"](l, r.par, r.pos, !1, !1, !1, o.data.origin) } else (d = e(o.event.target).closest(".jstree")).length && i && i.error && "check" === i.error && (d = d.jstree(!0)) && d.settings.core.error.call(this, i); s = !1, r = !1 } }).on("keyup.jstree keydown.jstree", function (t, o) { (o = e.vakata.dnd._get()) && o.data && o.data.jstree && ("keyup" === t.type && 27 === t.which ? (a && clearTimeout(a), r = !1, i = !1, s = !1, a = !1, n.hide().detach(), e.vakata.dnd._clean()) : (o.helper.find(".jstree-copy").first()[o.data.origin && (o.data.origin.settings.dnd.always_copy || o.data.origin.settings.dnd.copy && (t.metaKey || t.ctrlKey)) ? "show" : "hide"](), s && (s.metaKey = t.metaKey, s.ctrlKey = t.ctrlKey, e.vakata.dnd._trigger("move", s)))) }) }), function (e) { e.vakata.html = { div: e("<div />"), escape: function (t) { return e.vakata.html.div.text(t).html() }, strip: function (t) { return e.vakata.html.div.empty().append(e.parseHTML(t)).text() } }; var r = { element: !1, target: !1, is_down: !1, is_drag: !1, helper: !1, helper_w: 0, data: !1, init_x: 0, init_y: 0, scroll_l: 0, scroll_t: 0, scroll_e: !1, scroll_i: !1, is_touch: !1 }; e.vakata.dnd = { settings: { scroll_speed: 10, scroll_proximity: 20, helper_left: 5, helper_top: 10, threshold: 5, threshold_touch: 10 }, _trigger: function (r, i, s) { s === t && (s = e.vakata.dnd._get()), s.event = i, e(d).triggerHandler("dnd_" + r + ".vakata", s) }, _get: function () { return { data: r.data, element: r.element, helper: r.helper } }, _clean: function () { r.helper && r.helper.remove(), r.scroll_i && (clearInterval(r.scroll_i), r.scroll_i = !1), r = { element: !1, target: !1, is_down: !1, is_drag: !1, helper: !1, helper_w: 0, data: !1, init_x: 0, init_y: 0, scroll_l: 0, scroll_t: 0, scroll_e: !1, scroll_i: !1, is_touch: !1 }, e(d).off("mousemove.vakata.jstree touchmove.vakata.jstree", e.vakata.dnd.drag), e(d).off("mouseup.vakata.jstree touchend.vakata.jstree", e.vakata.dnd.stop) }, _scroll: function (t) { if (!r.scroll_e || !r.scroll_l && !r.scroll_t) return r.scroll_i && (clearInterval(r.scroll_i), r.scroll_i = !1), !1; if (!r.scroll_i) return r.scroll_i = setInterval(e.vakata.dnd._scroll, 100), !1; if (!0 === t) return !1; var i = r.scroll_e.scrollTop(), s = r.scroll_e.scrollLeft(); r.scroll_e.scrollTop(i + r.scroll_t * e.vakata.dnd.settings.scroll_speed), r.scroll_e.scrollLeft(s + r.scroll_l * e.vakata.dnd.settings.scroll_speed), i === r.scroll_e.scrollTop() && s === r.scroll_e.scrollLeft() || e.vakata.dnd._trigger("scroll", r.scroll_e) }, start: function (t, i, s) { "touchstart" === t.type && t.originalEvent && t.originalEvent.changedTouches && t.originalEvent.changedTouches[0] && (t.pageX = t.originalEvent.changedTouches[0].pageX, t.pageY = t.originalEvent.changedTouches[0].pageY, t.target = d.elementFromPoint(t.originalEvent.changedTouches[0].pageX - window.pageXOffset, t.originalEvent.changedTouches[0].pageY - window.pageYOffset)), r.is_drag && e.vakata.dnd.stop({}); try { t.currentTarget.unselectable = "on", t.currentTarget.onselectstart = function () { return !1 }, t.currentTarget.style && (t.currentTarget.style.touchAction = "none", t.currentTarget.style.msTouchAction = "none", t.currentTarget.style.MozUserSelect = "none") } catch (e) { } return r.init_x = t.pageX, r.init_y = t.pageY, r.data = i, r.is_down = !0, r.element = t.currentTarget, r.target = t.target, r.is_touch = "touchstart" === t.type, !1 !== s && (r.helper = e("<div id='vakata-dnd'></div>").html(s).css({ display: "block", margin: "0", padding: "0", position: "absolute", top: "-2000px", lineHeight: "16px", zIndex: "10000" })), e(d).on("mousemove.vakata.jstree touchmove.vakata.jstree", e.vakata.dnd.drag), e(d).on("mouseup.vakata.jstree touchend.vakata.jstree", e.vakata.dnd.stop), !1 }, drag: function (t) { if ("touchmove" === t.type && t.originalEvent && t.originalEvent.changedTouches && t.originalEvent.changedTouches[0] && (t.pageX = t.originalEvent.changedTouches[0].pageX, t.pageY = t.originalEvent.changedTouches[0].pageY, t.target = d.elementFromPoint(t.originalEvent.changedTouches[0].pageX - window.pageXOffset, t.originalEvent.changedTouches[0].pageY - window.pageYOffset)), r.is_down) { if (!r.is_drag) { if (!(Math.abs(t.pageX - r.init_x) > (r.is_touch ? e.vakata.dnd.settings.threshold_touch : e.vakata.dnd.settings.threshold) || Math.abs(t.pageY - r.init_y) > (r.is_touch ? e.vakata.dnd.settings.threshold_touch : e.vakata.dnd.settings.threshold))) return; r.helper && (r.helper.appendTo(d.body), r.helper_w = r.helper.outerWidth()), r.is_drag = !0, e(r.target).one("click.vakata", !1), e.vakata.dnd._trigger("start", t) } var i = !1, s = !1, a = !1, n = !1, o = !1, c = !1, l = !1, h = !1, _ = !1, u = !1; return r.scroll_t = 0, r.scroll_l = 0, r.scroll_e = !1, e(e(t.target).parentsUntil("body").addBack().get().reverse()).filter(function () { return /^auto|scroll$/.test(e(this).css("overflow")) && (this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth) }).each(function () { var i = e(this), s = i.offset(); if (this.scrollHeight > this.offsetHeight && (s.top + i.height() - t.pageY < e.vakata.dnd.settings.scroll_proximity && (r.scroll_t = 1), t.pageY - s.top < e.vakata.dnd.settings.scroll_proximity && (r.scroll_t = -1)), this.scrollWidth > this.offsetWidth && (s.left + i.width() - t.pageX < e.vakata.dnd.settings.scroll_proximity && (r.scroll_l = 1), t.pageX - s.left < e.vakata.dnd.settings.scroll_proximity && (r.scroll_l = -1)), r.scroll_t || r.scroll_l) return r.scroll_e = e(this), !1 }), r.scroll_e || (i = e(d), s = e(window), a = i.height(), n = s.height(), o = i.width(), c = s.width(), l = i.scrollTop(), h = i.scrollLeft(), a > n && t.pageY - l < e.vakata.dnd.settings.scroll_proximity && (r.scroll_t = -1), a > n && n - (t.pageY - l) < e.vakata.dnd.settings.scroll_proximity && (r.scroll_t = 1), o > c && t.pageX - h < e.vakata.dnd.settings.scroll_proximity && (r.scroll_l = -1), o > c && c - (t.pageX - h) < e.vakata.dnd.settings.scroll_proximity && (r.scroll_l = 1), (r.scroll_t || r.scroll_l) && (r.scroll_e = i)), r.scroll_e && e.vakata.dnd._scroll(!0), r.helper && (_ = parseInt(t.pageY + e.vakata.dnd.settings.helper_top, 10), u = parseInt(t.pageX + e.vakata.dnd.settings.helper_left, 10), a && _ + 25 > a && (_ = a - 50), o && u + r.helper_w > o && (u = o - (r.helper_w + 2)), r.helper.css({ left: u + "px", top: _ + "px" })), e.vakata.dnd._trigger("move", t), !1 } }, stop: function (t) { if ("touchend" === t.type && t.originalEvent && t.originalEvent.changedTouches && t.originalEvent.changedTouches[0] && (t.pageX = t.originalEvent.changedTouches[0].pageX, t.pageY = t.originalEvent.changedTouches[0].pageY, t.target = d.elementFromPoint(t.originalEvent.changedTouches[0].pageX - window.pageXOffset, t.originalEvent.changedTouches[0].pageY - window.pageYOffset)), r.is_drag) t.target !== r.target && e(r.target).off("click.vakata"), e.vakata.dnd._trigger("stop", t); else if ("touchend" === t.type && t.target === r.target) { var i = setTimeout(function () { e(t.target).click() }, 100); e(t.target).one("click", function () { i && clearTimeout(i) }) } return e.vakata.dnd._clean(), !1 } } }(e), e.jstree.defaults.massload = null, e.jstree.plugins.massload = function (t, r) { this.init = function (e, t) { this._data.massload = {}, r.init.call(this, e, t) }, this._load_nodes = function (t, i, s, a) { var n, o, d, c = this.settings.massload, l = (JSON.stringify(t), []), h = this._model.data; if (!s) { for (n = 0, o = t.length; n < o; n++)h[t[n]] && (h[t[n]].state.loaded || h[t[n]].state.failed) && !a || (l.push(t[n]), (d = this.get_node(t[n], !0)) && d.length && d.addClass("jstree-loading").attr("aria-busy", !0)); if (this._data.massload = {}, l.length) { if (e.isFunction(c)) return c.call(this, l, e.proxy(function (e) { var n, o; if (e) for (n in e) e.hasOwnProperty(n) && (this._data.massload[n] = e[n]); for (n = 0, o = t.length; n < o; n++)(d = this.get_node(t[n], !0)) && d.length && d.removeClass("jstree-loading").attr("aria-busy", !1); r._load_nodes.call(this, t, i, s, a) }, this)); if ("object" == typeof c && c && c.url) return c = e.extend(!0, {}, c), e.isFunction(c.url) && (c.url = c.url.call(this, l)), e.isFunction(c.data) && (c.data = c.data.call(this, l)), e.ajax(c).done(e.proxy(function (e, n, o) { var c, l; if (e) for (c in e) e.hasOwnProperty(c) && (this._data.massload[c] = e[c]); for (c = 0, l = t.length; c < l; c++)(d = this.get_node(t[c], !0)) && d.length && d.removeClass("jstree-loading").attr("aria-busy", !1); r._load_nodes.call(this, t, i, s, a) }, this)).fail(e.proxy(function (e) { r._load_nodes.call(this, t, i, s, a) }, this)) } } return r._load_nodes.call(this, t, i, s, a) }, this._load_node = function (t, i) { var s, a = this._data.massload[t.id], n = null; return a ? (n = this["string" == typeof a ? "_append_html_data" : "_append_json_data"](t, "string" == typeof a ? e(e.parseHTML(a)).filter(function () { return 3 !== this.nodeType }) : a, function (e) { i.call(this, e) }), (s = this.get_node(t.id, !0)) && s.length && s.removeClass("jstree-loading").attr("aria-busy", !1), delete this._data.massload[t.id], n) : r._load_node.call(this, t, i) } }, e.jstree.defaults.search = { ajax: !1, fuzzy: !1, case_sensitive: !1, show_only_matches: !1, show_only_matches_children: !1, close_opened_onclear: !0, search_leaves_only: !1, search_callback: !1 }, e.jstree.plugins.search = function (r, i) { this.bind = function () { i.bind.call(this), this._data.search.str = "", this._data.search.dom = e(), this._data.search.res = [], this._data.search.opn = [], this._data.search.som = !1, this._data.search.smc = !1, this._data.search.hdn = [], this.element.on("search.jstree", e.proxy(function (t, r) { if (this._data.search.som && r.res.length) { var i, s, a, n, o = this._model.data, d = []; for (i = 0, s = r.res.length; i < s; i++)if (o[r.res[i]] && !o[r.res[i]].state.hidden && (d.push(r.res[i]), d = d.concat(o[r.res[i]].parents), this._data.search.smc)) for (a = 0, n = o[r.res[i]].children_d.length; a < n; a++)o[o[r.res[i]].children_d[a]] && !o[o[r.res[i]].children_d[a]].state.hidden && d.push(o[r.res[i]].children_d[a]); d = e.vakata.array_remove_item(e.vakata.array_unique(d), e.jstree.root), this._data.search.hdn = this.hide_all(!0), this.show_node(d, !0), this.redraw(!0) } }, this)).on("clear_search.jstree", e.proxy(function (e, t) { this._data.search.som && t.res.length && (this.show_node(this._data.search.hdn, !0), this.redraw(!0)) }, this)) }, this.search = function (r, i, s, a, n, o) { if (!1 === r || "" === e.trim(r.toString())) return this.clear_search(); a = (a = this.get_node(a)) && a.id ? a.id : null, r = r.toString(); var d, c, l = this.settings.search, h = !!l.ajax && l.ajax, _ = this._model.data, u = null, g = [], f = []; if (this._data.search.res.length && !n && this.clear_search(), s === t && (s = l.show_only_matches), o === t && (o = l.show_only_matches_children), !i && !1 !== h) return e.isFunction(h) ? h.call(this, r, e.proxy(function (t) { t && t.d && (t = t.d), this._load_nodes(e.isArray(t) ? e.vakata.array_unique(t) : [], function () { this.search(r, !0, s, a, n, o) }) }, this), a) : ((h = e.extend({}, h)).data || (h.data = {}), h.data.str = r, a && (h.data.inside = a), this._data.search.lastRequest && this._data.search.lastRequest.abort(), this._data.search.lastRequest = e.ajax(h).fail(e.proxy(function () { this._data.core.last_error = { error: "ajax", plugin: "search", id: "search_01", reason: "Could not load search parents", data: JSON.stringify(h) }, this.settings.core.error.call(this, this._data.core.last_error) }, this)).done(e.proxy(function (t) { t && t.d && (t = t.d), this._load_nodes(e.isArray(t) ? e.vakata.array_unique(t) : [], function () { this.search(r, !0, s, a, n, o) }) }, this)), this._data.search.lastRequest); if (n || (this._data.search.str = r, this._data.search.dom = e(), this._data.search.res = [], this._data.search.opn = [], this._data.search.som = s, this._data.search.smc = o), u = new e.vakata.search(r, !0, { caseSensitive: l.case_sensitive, fuzzy: l.fuzzy }), e.each(_[a || e.jstree.root].children_d, function (e, t) { var i = _[t]; i.text && !i.state.hidden && (!l.search_leaves_only || i.state.loaded && 0 === i.children.length) && (l.search_callback && l.search_callback.call(this, r, i) || !l.search_callback && u.search(i.text).isMatch) && (g.push(t), f = f.concat(i.parents)) }), g.length) { for (d = 0, c = (f = e.vakata.array_unique(f)).length; d < c; d++)f[d] !== e.jstree.root && _[f[d]] && !0 === this.open_node(f[d], null, 0) && this._data.search.opn.push(f[d]); n ? (this._data.search.dom = this._data.search.dom.add(e(this.element[0].querySelectorAll("#" + e.map(g, function (t) { return -1 !== "0123456789".indexOf(t[0]) ? "\\3" + t[0] + " " + t.substr(1).replace(e.jstree.idregex, "\\$&") : t.replace(e.jstree.idregex, "\\$&") }).join(", #")))), this._data.search.res = e.vakata.array_unique(this._data.search.res.concat(g))) : (this._data.search.dom = e(this.element[0].querySelectorAll("#" + e.map(g, function (t) { return -1 !== "0123456789".indexOf(t[0]) ? "\\3" + t[0] + " " + t.substr(1).replace(e.jstree.idregex, "\\$&") : t.replace(e.jstree.idregex, "\\$&") }).join(", #"))), this._data.search.res = g), this._data.search.dom.children(".jstree-anchor").addClass("jstree-search") } this.trigger("search", { nodes: this._data.search.dom, str: r, res: this._data.search.res, show_only_matches: s }) }, this.clear_search = function () { this.settings.search.close_opened_onclear && this.close_node(this._data.search.opn, 0), this.trigger("clear_search", { nodes: this._data.search.dom, str: this._data.search.str, res: this._data.search.res }), this._data.search.res.length && (this._data.search.dom = e(this.element[0].querySelectorAll("#" + e.map(this._data.search.res, function (t) { return -1 !== "0123456789".indexOf(t[0]) ? "\\3" + t[0] + " " + t.substr(1).replace(e.jstree.idregex, "\\$&") : t.replace(e.jstree.idregex, "\\$&") }).join(", #"))), this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")), this._data.search.str = "", this._data.search.res = [], this._data.search.opn = [], this._data.search.dom = e() }, this.redraw_node = function (t, r, s, a) { if ((t = i.redraw_node.apply(this, arguments)) && -1 !== e.inArray(t.id, this._data.search.res)) { var n, o, d = null; for (n = 0, o = t.childNodes.length; n < o; n++)if (t.childNodes[n] && t.childNodes[n].className && -1 !== t.childNodes[n].className.indexOf("jstree-anchor")) { d = t.childNodes[n]; break } d && (d.className += " jstree-search") } return t } }, function (e) { e.vakata.search = function (t, r, i) { i = i || {}, !1 !== (i = e.extend({}, e.vakata.search.defaults, i)).fuzzy && (i.fuzzy = !0), t = i.caseSensitive ? t : t.toLowerCase(); var s, a, n, o, d = i.location, c = i.distance, l = i.threshold, h = t.length; return h > 32 && (i.fuzzy = !1), i.fuzzy && (s = 1 << h - 1, a = function () { var e = {}, r = 0; for (r = 0; r < h; r++)e[t.charAt(r)] = 0; for (r = 0; r < h; r++)e[t.charAt(r)] |= 1 << h - r - 1; return e }(), n = function (e, t) { var r = e / h, i = Math.abs(d - t); return c ? r + i / c : i ? 1 : r }), o = function (e) { if (e = i.caseSensitive ? e : e.toLowerCase(), t === e || -1 !== e.indexOf(t)) return { isMatch: !0, score: 0 }; if (!i.fuzzy) return { isMatch: !1, score: 1 }; var r, o, c, _, u, g, f, p, m, v = e.length, j = l, y = e.indexOf(t, d), k = h + v, x = 1, b = []; for (-1 !== y && (j = Math.min(n(0, y), j), -1 !== (y = e.lastIndexOf(t, d + h)) && (j = Math.min(n(0, y), j))), y = -1, r = 0; r < h; r++) { for (c = 0, _ = k; c < _;)n(r, d + _) <= j ? c = _ : k = _, _ = Math.floor((k - c) / 2 + c); for (k = _, g = Math.max(1, d - _ + 1), f = Math.min(d + _, v) + h, (p = new Array(f + 2))[f + 1] = (1 << r) - 1, o = f; o >= g; o--)if (m = a[e.charAt(o - 1)], p[o] = 0 === r ? (p[o + 1] << 1 | 1) & m : (p[o + 1] << 1 | 1) & m | (u[o + 1] | u[o]) << 1 | 1 | u[o + 1], p[o] & s && (x = n(r, o - 1)) <= j) { if (j = x, y = o - 1, b.push(y), !(y > d)) break; g = Math.max(1, 2 * d - y) } if (n(r + 1, d) > j) break; u = p } return { isMatch: y >= 0, score: x } }, !0 === r ? { search: o } : o(r) }, e.vakata.search.defaults = { location: 0, distance: 100, threshold: .6, fuzzy: !1, caseSensitive: !1 } }(e), e.jstree.defaults.sort = function (e, t) { return this.get_text(e) > this.get_text(t) ? 1 : -1 }, e.jstree.plugins.sort = function (t, r) { this.bind = function () { r.bind.call(this), this.element.on("model.jstree", e.proxy(function (e, t) { this.sort(t.parent, !0) }, this)).on("rename_node.jstree create_node.jstree", e.proxy(function (e, t) { this.sort(t.parent || t.node.parent, !1), this.redraw_node(t.parent || t.node.parent, !0) }, this)).on("move_node.jstree copy_node.jstree", e.proxy(function (e, t) { this.sort(t.parent, !1), this.redraw_node(t.parent, !0) }, this)) }, this.sort = function (t, r) { var i, s; if ((t = this.get_node(t)) && t.children && t.children.length && (t.children.sort(e.proxy(this.settings.sort, this)), r)) for (i = 0, s = t.children_d.length; i < s; i++)this.sort(t.children_d[i], !1) } }; var _ = !1; e.jstree.defaults.state = { key: "jstree", events: "changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree", ttl: !1, filter: !1, preserve_loaded: !1 }, e.jstree.plugins.state = function (t, r) { this.bind = function () { r.bind.call(this); var t = e.proxy(function () { this.element.on(this.settings.state.events, e.proxy(function () { _ && clearTimeout(_), _ = setTimeout(e.proxy(function () { this.save_state() }, this), 100) }, this)), this.trigger("state_ready") }, this); this.element.on("ready.jstree", e.proxy(function (e, r) { this.element.one("restore_state.jstree", t), this.restore_state() || t() }, this)) }, this.save_state = function () { var t = this.get_state(); this.settings.state.preserve_loaded || delete t.core.loaded; var r = { state: t, ttl: this.settings.state.ttl, sec: +new Date }; e.vakata.storage.set(this.settings.state.key, JSON.stringify(r)) }, this.restore_state = function () { var t = e.vakata.storage.get(this.settings.state.key); if (t) try { t = JSON.parse(t) } catch (e) { return !1 } return !(t && t.ttl && t.sec && +new Date - t.sec > t.ttl) && (t && t.state && (t = t.state), t && e.isFunction(this.settings.state.filter) && (t = this.settings.state.filter.call(this, t)), !!t && (this.settings.state.preserve_loaded || delete t.core.loaded, this.element.one("set_state.jstree", function (r, i) { i.instance.trigger("restore_state", { state: e.extend(!0, {}, t) }) }), this.set_state(t), !0)) }, this.clear_state = function () { return e.vakata.storage.del(this.settings.state.key) } }, function (e, t) { e.vakata.storage = { set: function (e, t) { return window.localStorage.setItem(e, t) }, get: function (e) { return window.localStorage.getItem(e) }, del: function (e) { return window.localStorage.removeItem(e) } } }(e), e.jstree.defaults.types = { default: {} }, e.jstree.defaults.types[e.jstree.root] = {}, e.jstree.plugins.types = function (r, i) { this.init = function (r, s) { var a, n; if (s && s.types && s.types.default) for (a in s.types) if ("default" !== a && a !== e.jstree.root && s.types.hasOwnProperty(a)) for (n in s.types.default) s.types.default.hasOwnProperty(n) && s.types[a][n] === t && (s.types[a][n] = s.types.default[n]); i.init.call(this, r, s), this._model.data[e.jstree.root].type = e.jstree.root }, this.refresh = function (t, r) { i.refresh.call(this, t, r), this._model.data[e.jstree.root].type = e.jstree.root }, this.bind = function () { this.element.on("model.jstree", e.proxy(function (r, i) { var s, a, n, o = this._model.data, d = i.nodes, c = this.settings.types, l = "default"; for (s = 0, a = d.length; s < a; s++) { if (l = "default", o[d[s]].original && o[d[s]].original.type && c[o[d[s]].original.type] && (l = o[d[s]].original.type), o[d[s]].data && o[d[s]].data.jstree && o[d[s]].data.jstree.type && c[o[d[s]].data.jstree.type] && (l = o[d[s]].data.jstree.type), o[d[s]].type = l, !0 === o[d[s]].icon && c[l].icon !== t && (o[d[s]].icon = c[l].icon), c[l].li_attr !== t && "object" == typeof c[l].li_attr) for (n in c[l].li_attr) if (c[l].li_attr.hasOwnProperty(n)) { if ("id" === n) continue; o[d[s]].li_attr[n] === t ? o[d[s]].li_attr[n] = c[l].li_attr[n] : "class" === n && (o[d[s]].li_attr.class = c[l].li_attr.class + " " + o[d[s]].li_attr.class) } if (c[l].a_attr !== t && "object" == typeof c[l].a_attr) for (n in c[l].a_attr) if (c[l].a_attr.hasOwnProperty(n)) { if ("id" === n) continue; o[d[s]].a_attr[n] === t ? o[d[s]].a_attr[n] = c[l].a_attr[n] : "href" === n && "#" === o[d[s]].a_attr[n] ? o[d[s]].a_attr.href = c[l].a_attr.href : "class" === n && (o[d[s]].a_attr.class = c[l].a_attr.class + " " + o[d[s]].a_attr.class) } } o[e.jstree.root].type = e.jstree.root }, this)), i.bind.call(this) }, this.get_json = function (t, r, s) { var a, n, o = this._model.data, d = r ? e.extend(!0, {}, r, { no_id: !1 }) : {}, c = i.get_json.call(this, t, d, s); if (!1 === c) return !1; if (e.isArray(c)) for (a = 0, n = c.length; a < n; a++)c[a].type = c[a].id && o[c[a].id] && o[c[a].id].type ? o[c[a].id].type : "default", r && r.no_id && (delete c[a].id, c[a].li_attr && c[a].li_attr.id && delete c[a].li_attr.id, c[a].a_attr && c[a].a_attr.id && delete c[a].a_attr.id); else c.type = c.id && o[c.id] && o[c.id].type ? o[c.id].type : "default", r && r.no_id && (c = this._delete_ids(c)); return c }, this._delete_ids = function (t) { if (e.isArray(t)) { for (var r = 0, i = t.length; r < i; r++)t[r] = this._delete_ids(t[r]); return t } return delete t.id, t.li_attr && t.li_attr.id && delete t.li_attr.id, t.a_attr && t.a_attr.id && delete t.a_attr.id, t.children && e.isArray(t.children) && (t.children = this._delete_ids(t.children)), t }, this.check = function (r, s, a, n, o) { if (!1 === i.check.call(this, r, s, a, n, o)) return !1; s = s && s.id ? s : this.get_node(s), a = a && a.id ? a : this.get_node(a); var d, c, l, h, _ = s && s.id ? o && o.origin ? o.origin : e.jstree.reference(s.id) : null; switch (_ = _ && _._model && _._model.data ? _._model.data : null, r) { case "create_node": case "move_node": case "copy_node": if ("move_node" !== r || -1 === e.inArray(s.id, a.children)) { if ((d = this.get_rules(a)).max_children !== t && -1 !== d.max_children && d.max_children === a.children.length) return this._data.core.last_error = { error: "check", plugin: "types", id: "types_01", reason: "max_children prevents function: " + r, data: JSON.stringify({ chk: r, pos: n, obj: !(!s || !s.id) && s.id, par: !(!a || !a.id) && a.id }) }, !1; if (d.valid_children !== t && -1 !== d.valid_children && -1 === e.inArray(s.type || "default", d.valid_children)) return this._data.core.last_error = { error: "check", plugin: "types", id: "types_02", reason: "valid_children prevents function: " + r, data: JSON.stringify({ chk: r, pos: n, obj: !(!s || !s.id) && s.id, par: !(!a || !a.id) && a.id }) }, !1; if (_ && s.children_d && s.parents) { for (c = 0, l = 0, h = s.children_d.length; l < h; l++)c = Math.max(c, _[s.children_d[l]].parents.length); c = c - s.parents.length + 1 } (c <= 0 || c === t) && (c = 1); do { if (d.max_depth !== t && -1 !== d.max_depth && d.max_depth < c) return this._data.core.last_error = { error: "check", plugin: "types", id: "types_03", reason: "max_depth prevents function: " + r, data: JSON.stringify({ chk: r, pos: n, obj: !(!s || !s.id) && s.id, par: !(!a || !a.id) && a.id }) }, !1; a = this.get_node(a.parent), d = this.get_rules(a), c++ } while (a) } }return !0 }, this.get_rules = function (e) { if (!(e = this.get_node(e))) return !1; var r = this.get_type(e, !0); return r.max_depth === t && (r.max_depth = -1), r.max_children === t && (r.max_children = -1), r.valid_children === t && (r.valid_children = -1), r }, this.get_type = function (t, r) { return !!(t = this.get_node(t)) && (r ? e.extend({ type: t.type }, this.settings.types[t.type]) : t.type) }, this.set_type = function (r, i) { var s, a, n, o, d, c, l, h, _ = this._model.data; if (e.isArray(r)) { for (a = 0, n = (r = r.slice()).length; a < n; a++)this.set_type(r[a], i); return !0 } if (s = this.settings.types, r = this.get_node(r), !s[i] || !r) return !1; if ((l = this.get_node(r, !0)) && l.length && (h = l.children(".jstree-anchor")), o = r.type, d = this.get_icon(r), r.type = i, (!0 === d || !s[o] || s[o].icon !== t && d === s[o].icon) && this.set_icon(r, s[i].icon === t || s[i].icon), s[o] && s[o].li_attr !== t && "object" == typeof s[o].li_attr) for (c in s[o].li_attr) if (s[o].li_attr.hasOwnProperty(c)) { if ("id" === c) continue; "class" === c ? (_[r.id].li_attr.class = (_[r.id].li_attr.class || "").replace(s[o].li_attr[c], ""), l && l.removeClass(s[o].li_attr[c])) : _[r.id].li_attr[c] === s[o].li_attr[c] && (_[r.id].li_attr[c] = null, l && l.removeAttr(c)) } if (s[o] && s[o].a_attr !== t && "object" == typeof s[o].a_attr) for (c in s[o].a_attr) if (s[o].a_attr.hasOwnProperty(c)) { if ("id" === c) continue; "class" === c ? (_[r.id].a_attr.class = (_[r.id].a_attr.class || "").replace(s[o].a_attr[c], ""), h && h.removeClass(s[o].a_attr[c])) : _[r.id].a_attr[c] === s[o].a_attr[c] && ("href" === c ? (_[r.id].a_attr[c] = "#", h && h.attr("href", "#")) : (delete _[r.id].a_attr[c], h && h.removeAttr(c))) } if (s[i].li_attr !== t && "object" == typeof s[i].li_attr) for (c in s[i].li_attr) if (s[i].li_attr.hasOwnProperty(c)) { if ("id" === c) continue; _[r.id].li_attr[c] === t ? (_[r.id].li_attr[c] = s[i].li_attr[c], l && ("class" === c ? l.addClass(s[i].li_attr[c]) : l.attr(c, s[i].li_attr[c]))) : "class" === c && (_[r.id].li_attr.class = s[i].li_attr[c] + " " + _[r.id].li_attr.class, l && l.addClass(s[i].li_attr[c])) } if (s[i].a_attr !== t && "object" == typeof s[i].a_attr) for (c in s[i].a_attr) if (s[i].a_attr.hasOwnProperty(c)) { if ("id" === c) continue; _[r.id].a_attr[c] === t ? (_[r.id].a_attr[c] = s[i].a_attr[c], h && ("class" === c ? h.addClass(s[i].a_attr[c]) : h.attr(c, s[i].a_attr[c]))) : "href" === c && "#" === _[r.id].a_attr[c] ? (_[r.id].a_attr.href = s[i].a_attr.href, h && h.attr("href", s[i].a_attr.href)) : "class" === c && (_[r.id].a_attr.class = s[i].a_attr.class + " " + _[r.id].a_attr.class, h && h.addClass(s[i].a_attr[c])) } return !0 } }, e.jstree.defaults.unique = { case_sensitive: !1, trim_whitespace: !1, duplicate: function (e, t) { return e + " (" + t + ")" } }, e.jstree.plugins.unique = function (r, i) { this.check = function (t, r, s, a, n) { if (!1 === i.check.call(this, t, r, s, a, n)) return !1; if (r = r && r.id ? r : this.get_node(r), !(s = s && s.id ? s : this.get_node(s)) || !s.children) return !0; var o, d, c, l = "rename_node" === t ? a : r.text, h = [], _ = this.settings.unique.case_sensitive, u = this.settings.unique.trim_whitespace, g = this._model.data; for (o = 0, d = s.children.length; o < d; o++)c = g[s.children[o]].text, _ || (c = c.toLowerCase()), u && (c = c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")), h.push(c); switch (_ || (l = l.toLowerCase()), u && (l = l.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")), t) { case "delete_node": return !0; case "rename_node": return c = r.text || "", _ || (c = c.toLowerCase()), u && (c = c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")), (o = -1 === e.inArray(l, h) || r.text && c === l) || (this._data.core.last_error = { error: "check", plugin: "unique", id: "unique_01", reason: "Child with name " + l + " already exists. Preventing: " + t, data: JSON.stringify({ chk: t, pos: a, obj: !(!r || !r.id) && r.id, par: !(!s || !s.id) && s.id }) }), o; case "create_node": return (o = -1 === e.inArray(l, h)) || (this._data.core.last_error = { error: "check", plugin: "unique", id: "unique_04", reason: "Child with name " + l + " already exists. Preventing: " + t, data: JSON.stringify({ chk: t, pos: a, obj: !(!r || !r.id) && r.id, par: !(!s || !s.id) && s.id }) }), o; case "copy_node": return (o = -1 === e.inArray(l, h)) || (this._data.core.last_error = { error: "check", plugin: "unique", id: "unique_02", reason: "Child with name " + l + " already exists. Preventing: " + t, data: JSON.stringify({ chk: t, pos: a, obj: !(!r || !r.id) && r.id, par: !(!s || !s.id) && s.id }) }), o; case "move_node": return (o = r.parent === s.id && (!n || !n.is_multi) || -1 === e.inArray(l, h)) || (this._data.core.last_error = { error: "check", plugin: "unique", id: "unique_03", reason: "Child with name " + l + " already exists. Preventing: " + t, data: JSON.stringify({ chk: t, pos: a, obj: !(!r || !r.id) && r.id, par: !(!s || !s.id) && s.id }) }), o }return !0 }, this.create_node = function (r, s, a, n, o) { if (!s || s.text === t) { if (null === r && (r = e.jstree.root), !(r = this.get_node(r))) return i.create_node.call(this, r, s, a, n, o); if (!(a = a === t ? "last" : a).toString().match(/^(before|after)$/) && !o && !this.is_loaded(r)) return i.create_node.call(this, r, s, a, n, o); s || (s = {}); var d, c, l, h, _, u, g = this._model.data, f = this.settings.unique.case_sensitive, p = this.settings.unique.trim_whitespace, m = this.settings.unique.duplicate; for (c = d = this.get_string("New node"), l = [], h = 0, _ = r.children.length; h < _; h++)u = g[r.children[h]].text, f || (u = u.toLowerCase()), p && (u = u.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")), l.push(u); for (h = 1, u = c, f || (u = u.toLowerCase()), p && (u = u.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")); -1 !== e.inArray(u, l);)u = c = m.call(this, d, ++h).toString(), f || (u = u.toLowerCase()), p && (u = u.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "")); s.text = c } return i.create_node.call(this, r, s, a, n, o) } }; var u = d.createElement("DIV"); if (u.setAttribute("unselectable", "on"), u.setAttribute("role", "presentation"), u.className = "jstree-wholerow", u.innerHTML = "&#160;", e.jstree.plugins.wholerow = function (t, r) { this.bind = function () { r.bind.call(this), this.element.on("ready.jstree set_state.jstree", e.proxy(function () { this.hide_dots() }, this)).on("init.jstree loading.jstree ready.jstree", e.proxy(function () { this.get_container_ul().addClass("jstree-wholerow-ul") }, this)).on("deselect_all.jstree", e.proxy(function (e, t) { this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked") }, this)).on("changed.jstree", e.proxy(function (e, t) { this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked"); var r, i, s = !1; for (r = 0, i = t.selected.length; r < i; r++)(s = this.get_node(t.selected[r], !0)) && s.length && s.children(".jstree-wholerow").addClass("jstree-wholerow-clicked") }, this)).on("open_node.jstree", e.proxy(function (e, t) { this.get_node(t.node, !0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked") }, this)).on("hover_node.jstree dehover_node.jstree", e.proxy(function (e, t) { "hover_node" === e.type && this.is_disabled(t.node) || this.get_node(t.node, !0).children(".jstree-wholerow")["hover_node" === e.type ? "addClass" : "removeClass"]("jstree-wholerow-hovered") }, this)).on("contextmenu.jstree", ".jstree-wholerow", e.proxy(function (t) { if (this._data.contextmenu) { t.preventDefault(); var r = e.Event("contextmenu", { metaKey: t.metaKey, ctrlKey: t.ctrlKey, altKey: t.altKey, shiftKey: t.shiftKey, pageX: t.pageX, pageY: t.pageY }); e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r) } }, this)).on("click.jstree", ".jstree-wholerow", function (t) { t.stopImmediatePropagation(); var r = e.Event("click", { metaKey: t.metaKey, ctrlKey: t.ctrlKey, altKey: t.altKey, shiftKey: t.shiftKey }); e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus() }).on("dblclick.jstree", ".jstree-wholerow", function (t) { t.stopImmediatePropagation(); var r = e.Event("dblclick", { metaKey: t.metaKey, ctrlKey: t.ctrlKey, altKey: t.altKey, shiftKey: t.shiftKey }); e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus() }).on("click.jstree", ".jstree-leaf > .jstree-ocl", e.proxy(function (t) { t.stopImmediatePropagation(); var r = e.Event("click", { metaKey: t.metaKey, ctrlKey: t.ctrlKey, altKey: t.altKey, shiftKey: t.shiftKey }); e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(r).focus() }, this)).on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", e.proxy(function (e) { return e.stopImmediatePropagation(), this.is_disabled(e.currentTarget) || this.hover_node(e.currentTarget), !1 }, this)).on("mouseleave.jstree", ".jstree-node", e.proxy(function (e) { this.dehover_node(e.currentTarget) }, this)) }, this.teardown = function () { this.settings.wholerow && this.element.find(".jstree-wholerow").remove(), r.teardown.call(this) }, this.redraw_node = function (t, i, s, a) { if (t = r.redraw_node.apply(this, arguments)) { var n = u.cloneNode(!0); -1 !== e.inArray(t.id, this._data.core.selected) && (n.className += " jstree-wholerow-clicked"), this._data.core.focused && this._data.core.focused === t.id && (n.className += " jstree-wholerow-hovered"), t.insertBefore(n, t.childNodes[0]) } return t } }, window.customElements && Object && Object.create) { var g = Object.create(HTMLElement.prototype); g.createdCallback = function () { var t, r = { core: {}, plugins: [] }; for (t in e.jstree.plugins) e.jstree.plugins.hasOwnProperty(t) && this.attributes[t] && (r.plugins.push(t), this.getAttribute(t) && JSON.parse(this.getAttribute(t)) && (r[t] = JSON.parse(this.getAttribute(t)))); for (t in e.jstree.defaults.core) e.jstree.defaults.core.hasOwnProperty(t) && this.attributes[t] && (r.core[t] = JSON.parse(this.getAttribute(t)) || this.getAttribute(t)); e(this).jstree(r) }; try { window.customElements.define("vakata-jstree", function () { }, { prototype: g }) } catch (e) { } } } });
/**
 * Super simple wysiwyg editor v0.8.12
 * https://summernote.org
 *
 * Copyright 2013- Alan Hong. and other contributors
 * summernote may be freely distributed under the MIT license.
 *
 * Date: 2019-05-16T08:16Z
 */
(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
  typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  (global = global || self, factory(global.jQuery));
}(this, function ($$1) { 'use strict';

  $$1 = $$1 && $$1.hasOwnProperty('default') ? $$1['default'] : $$1;

  var Renderer = /** @class */ (function () {
      function Renderer(markup, children, options, callback) {
          this.markup = markup;
          this.children = children;
          this.options = options;
          this.callback = callback;
      }
      Renderer.prototype.render = function ($parent) {
          var $node = $$1(this.markup);
          if (this.options && this.options.contents) {
              $node.html(this.options.contents);
          }
          if (this.options && this.options.className) {
              $node.addClass(this.options.className);
          }
          if (this.options && this.options.data) {
              $$1.each(this.options.data, function (k, v) {
                  $node.attr('data-' + k, v);
              });
          }
          if (this.options && this.options.click) {
              $node.on('click', this.options.click);
          }
          if (this.children) {
              var $container_1 = $node.find('.note-children-container');
              this.children.forEach(function (child) {
                  child.render($container_1.length ? $container_1 : $node);
              });
          }
          if (this.callback) {
              this.callback($node, this.options);
          }
          if (this.options && this.options.callback) {
              this.options.callback($node);
          }
          if ($parent) {
              $parent.append($node);
          }
          return $node;
      };
      return Renderer;
  }());
  var renderer = {
      create: function (markup, callback) {
          return function () {
              var options = typeof arguments[1] === 'object' ? arguments[1] : arguments[0];
              var children = Array.isArray(arguments[0]) ? arguments[0] : [];
              if (options && options.children) {
                  children = options.children;
              }
              return new Renderer(markup, children, options, callback);
          };
      }
  };

  var TooltipUI = /** @class */ (function () {
      function TooltipUI($node, options) {
          this.$node = $node;
          this.options = $.extend({}, {
              title: '',
              target: options.container,
              trigger: 'hover focus',
              placement: 'bottom'
          }, options);
          // create tooltip node
          this.$tooltip = $([
              '<div class="note-tooltip in">',
              '  <div class="note-tooltip-arrow"/>',
              '  <div class="note-tooltip-content"/>',
              '</div>',
          ].join(''));
          // define event
          if (this.options.trigger !== 'manual') {
              var showCallback_1 = this.show.bind(this);
              var hideCallback_1 = this.hide.bind(this);
              var toggleCallback_1 = this.toggle.bind(this);
              this.options.trigger.split(' ').forEach(function (eventName) {
                  if (eventName === 'hover') {
                      $node.off('mouseenter mouseleave');
                      $node.on('mouseenter', showCallback_1).on('mouseleave', hideCallback_1);
                  }
                  else if (eventName === 'click') {
                      $node.on('click', toggleCallback_1);
                  }
                  else if (eventName === 'focus') {
                      $node.on('focus', showCallback_1).on('blur', hideCallback_1);
                  }
              });
          }
      }
      TooltipUI.prototype.show = function () {
          var $node = this.$node;
          var offset = $node.offset();
          var $tooltip = this.$tooltip;
          var title = this.options.title || $node.attr('title') || $node.data('title');
          var placement = this.options.placement || $node.data('placement');
          $tooltip.addClass(placement);
          $tooltip.addClass('in');
          $tooltip.find('.note-tooltip-content').text(title);
          $tooltip.appendTo(this.options.target);
          var nodeWidth = $node.outerWidth();
          var nodeHeight = $node.outerHeight();
          var tooltipWidth = $tooltip.outerWidth();
          var tooltipHeight = $tooltip.outerHeight();
          if (placement === 'bottom') {
              $tooltip.css({
                  top: offset.top + nodeHeight,
                  left: offset.left + (nodeWidth / 2 - tooltipWidth / 2)
              });
          }
          else if (placement === 'top') {
              $tooltip.css({
                  top: offset.top - tooltipHeight,
                  left: offset.left + (nodeWidth / 2 - tooltipWidth / 2)
              });
          }
          else if (placement === 'left') {
              $tooltip.css({
                  top: offset.top + (nodeHeight / 2 - tooltipHeight / 2),
                  left: offset.left - tooltipWidth
              });
          }
          else if (placement === 'right') {
              $tooltip.css({
                  top: offset.top + (nodeHeight / 2 - tooltipHeight / 2),
                  left: offset.left + nodeWidth
              });
          }
      };
      TooltipUI.prototype.hide = function () {
          this.$tooltip.removeClass('in');
          this.$tooltip.remove();
      };
      TooltipUI.prototype.toggle = function () {
          if (this.$tooltip.hasClass('in')) {
              this.hide();
          }
          else {
              this.show();
          }
      };
      return TooltipUI;
  }());

  var DropdownUI = /** @class */ (function () {
      function DropdownUI($node, options) {
          this.$button = $node;
          this.options = $.extend({}, {
              target: options.container
          }, options);
          this.setEvent();
      }
      DropdownUI.prototype.setEvent = function () {
          var _this = this;
          this.$button.on('click', function (e) {
              _this.toggle();
              e.stopImmediatePropagation();
          });
      };
      DropdownUI.prototype.clear = function () {
          var $parent = $('.note-btn-group.open');
          $parent.find('.note-btn.active').removeClass('active');
          $parent.removeClass('open');
      };
      DropdownUI.prototype.show = function () {
          this.$button.addClass('active');
          this.$button.parent().addClass('open');
          var $dropdown = this.$button.next();
          var offset = $dropdown.offset();
          var width = $dropdown.outerWidth();
          var windowWidth = $(window).width();
          var targetMarginRight = parseFloat($(this.options.target).css('margin-right'));
          if (offset.left + width > windowWidth - targetMarginRight) {
              $dropdown.css('margin-left', windowWidth - targetMarginRight - (offset.left + width));
          }
          else {
              $dropdown.css('margin-left', '');
          }
      };
      DropdownUI.prototype.hide = function () {
          this.$button.removeClass('active');
          this.$button.parent().removeClass('open');
      };
      DropdownUI.prototype.toggle = function () {
          var isOpened = this.$button.parent().hasClass('open');
          this.clear();
          if (isOpened) {
              this.hide();
          }
          else {
              this.show();
          }
      };
      return DropdownUI;
  }());
  $(document).on('click', function (e) {
      if (!$(e.target).closest('.note-btn-group').length) {
          $('.note-btn-group.open').removeClass('open');
      }
  });
  $(document).on('click.note-dropdown-menu', function (e) {
      $(e.target).closest('.note-dropdown-menu').parent().removeClass('open');
  });

  var ModalUI = /** @class */ (function () {
      function ModalUI($node, options) {
          this.options = $.extend({}, {
              target: options.container || 'body'
          }, options);
          this.$modal = $node;
          this.$backdrop = $('<div class="note-modal-backdrop" />');
      }
      ModalUI.prototype.show = function () {
          if (this.options.target === 'body') {
              this.$backdrop.css('position', 'fixed');
              this.$modal.css('position', 'fixed');
          }
          else {
              this.$backdrop.css('position', 'absolute');
              this.$modal.css('position', 'absolute');
          }
          this.$backdrop.appendTo(this.options.target).show();
          this.$modal.appendTo(this.options.target).addClass('open').show();
          this.$modal.trigger('note.modal.show');
          this.$modal.off('click', '.close').on('click', '.close', this.hide.bind(this));
      };
      ModalUI.prototype.hide = function () {
          this.$modal.removeClass('open').hide();
          this.$backdrop.hide();
          this.$modal.trigger('note.modal.hide');
      };
      return ModalUI;
  }());

  var editor = renderer.create('<div class="note-editor note-frame"/>');
  var toolbar = renderer.create('<div class="note-toolbar" role="toolbar"/>');
  var editingArea = renderer.create('<div class="note-editing-area"/>');
  var codable = renderer.create('<textarea class="note-codable" role="textbox" aria-multiline="true"/>');
  var editable = renderer.create('<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>');
  var statusbar = renderer.create([
      '<output class="note-status-output" role="status" aria-live="polite"/>',
      '<div class="note-statusbar" role="resize">',
      '  <div class="note-resizebar" role="seperator" aria-orientation="horizontal" aria-label="resize">',
      '    <div class="note-icon-bar"/>',
      '    <div class="note-icon-bar"/>',
      '    <div class="note-icon-bar"/>',
      '  </div>',
      '</div>',
  ].join(''));
  var airEditor = renderer.create('<div class="note-editor"/>');
  var airEditable = renderer.create([
      '<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>',
      '<output class="note-status-output" role="status" aria-live="polite"/>',
  ].join(''));
  var buttonGroup = renderer.create('<div class="note-btn-group">');
  var button = renderer.create('<button type="button" class="note-btn" role="button" tabindex="-1">', function ($node, options) {
      // set button type
      if (options && options.tooltip) {
          $node.attr({
              'aria-label': options.tooltip
          });
          $node.data('_lite_tooltip', new TooltipUI($node, {
              title: options.tooltip,
              container: options.container
          })).on('click', function (e) {
              $(e.currentTarget).data('_lite_tooltip').hide();
          });
      }
      if (options.contents) {
          $node.html(options.contents);
      }
      if (options && options.data && options.data.toggle === 'dropdown') {
          $node.data('_lite_dropdown', new DropdownUI($node, {
              container: options.container
          }));
      }
  });
  var dropdown = renderer.create('<div class="note-dropdown-menu" role="list">', function ($node, options) {
      var markup = Array.isArray(options.items) ? options.items.map(function (item) {
          var value = (typeof item === 'string') ? item : (item.value || '');
          var content = options.template ? options.template(item) : item;
          var $temp = $('<a class="note-dropdown-item" href="#" data-value="' + value + '" role="listitem" aria-label="' + value + '"></a>');
          $temp.html(content).data('item', item);
          return $temp;
      }) : options.items;
      $node.html(markup).attr({ 'aria-label': options.title });
      $node.on('click', '> .note-dropdown-item', function (e) {
          var $a = $(this);
          var item = $a.data('item');
          var value = $a.data('value');
          if (item.click) {
              item.click($a);
          }
          else if (options.itemClick) {
              options.itemClick(e, item, value);
          }
      });
  });
  var dropdownCheck = renderer.create('<div class="note-dropdown-menu note-check" role="list">', function ($node, options) {
      var markup = Array.isArray(options.items) ? options.items.map(function (item) {
          var value = (typeof item === 'string') ? item : (item.value || '');
          var content = options.template ? options.template(item) : item;
          var $temp = $('<a class="note-dropdown-item" href="#" data-value="' + value + '" role="listitem" aria-label="' + item + '"></a>');
          $temp.html([icon(options.checkClassName), ' ', content]).data('item', item);
          return $temp;
      }) : options.items;
      $node.html(markup).attr({ 'aria-label': options.title });
      $node.on('click', '> .note-dropdown-item', function (e) {
          var $a = $(this);
          var item = $a.data('item');
          var value = $a.data('value');
          if (item.click) {
              item.click($a);
          }
          else if (options.itemClick) {
              options.itemClick(e, item, value);
          }
      });
  });
  var dropdownButtonContents = function (contents, options) {
      return contents + ' ' + icon(options.icons.caret, 'span');
  };
  var dropdownButton = function (opt, callback) {
      return buttonGroup([
          button({
              className: 'dropdown-toggle',
              contents: opt.title + ' ' + icon('note-icon-caret'),
              tooltip: opt.tooltip,
              data: {
                  toggle: 'dropdown'
              }
          }),
          dropdown({
              className: opt.className,
              items: opt.items,
              template: opt.template,
              itemClick: opt.itemClick
          }),
      ], { callback: callback }).render();
  };
  var dropdownCheckButton = function (opt, callback) {
      return buttonGroup([
          button({
              className: 'dropdown-toggle',
              contents: opt.title + ' ' + icon('note-icon-caret'),
              tooltip: opt.tooltip,
              data: {
                  toggle: 'dropdown'
              }
          }),
          dropdownCheck({
              className: opt.className,
              checkClassName: opt.checkClassName,
              items: opt.items,
              template: opt.template,
              itemClick: opt.itemClick
          }),
      ], { callback: callback }).render();
  };
  var paragraphDropdownButton = function (opt) {
      return buttonGroup([
          button({
              className: 'dropdown-toggle',
              contents: opt.title + ' ' + icon('note-icon-caret'),
              tooltip: opt.tooltip,
              data: {
                  toggle: 'dropdown'
              }
          }),
          dropdown([
              buttonGroup({
                  className: 'note-align',
                  children: opt.items[0]
              }),
              buttonGroup({
                  className: 'note-list',
                  children: opt.items[1]
              }),
          ]),
      ]).render();
  };
  var tableMoveHandler = function (event, col, row) {
      var PX_PER_EM = 18;
      var $picker = $(event.target.parentNode); // target is mousecatcher
      var $dimensionDisplay = $picker.next();
      var $catcher = $picker.find('.note-dimension-picker-mousecatcher');
      var $highlighted = $picker.find('.note-dimension-picker-highlighted');
      var $unhighlighted = $picker.find('.note-dimension-picker-unhighlighted');
      var posOffset;
      // HTML5 with jQuery - e.offsetX is undefined in Firefox
      if (event.offsetX === undefined) {
          var posCatcher = $(event.target).offset();
          posOffset = {
              x: event.pageX - posCatcher.left,
              y: event.pageY - posCatcher.top
          };
      }
      else {
          posOffset = {
              x: event.offsetX,
              y: event.offsetY
          };
      }
      var dim = {
          c: Math.ceil(posOffset.x / PX_PER_EM) || 1,
          r: Math.ceil(posOffset.y / PX_PER_EM) || 1
      };
      $highlighted.css({ width: dim.c + 'em', height: dim.r + 'em' });
      $catcher.data('value', dim.c + 'x' + dim.r);
      if (dim.c > 3 && dim.c < col) {
          $unhighlighted.css({ width: dim.c + 1 + 'em' });
      }
      if (dim.r > 3 && dim.r < row) {
          $unhighlighted.css({ height: dim.r + 1 + 'em' });
      }
      $dimensionDisplay.html(dim.c + ' x ' + dim.r);
  };
  var tableDropdownButton = function (opt) {
      return buttonGroup([
          button({
              className: 'dropdown-toggle',
              contents: opt.title + ' ' + icon('note-icon-caret'),
              tooltip: opt.tooltip,
              data: {
                  toggle: 'dropdown'
              }
          }),
          dropdown({
              className: 'note-table',
              items: [
                  '<div class="note-dimension-picker">',
                  '  <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',
                  '  <div class="note-dimension-picker-highlighted"/>',
                  '  <div class="note-dimension-picker-unhighlighted"/>',
                  '</div>',
                  '<div class="note-dimension-display">1 x 1</div>',
              ].join('')
          }),
      ], {
          callback: function ($node) {
              var $catcher = $node.find('.note-dimension-picker-mousecatcher');
              $catcher.css({
                  width: opt.col + 'em',
                  height: opt.row + 'em'
              })
                  .mousedown(opt.itemClick)
                  .mousemove(function (e) {
                  tableMoveHandler(e, opt.col, opt.row);
              });
          }
      }).render();
  };
  var palette = renderer.create('<div class="note-color-palette"/>', function ($node, options) {
      var contents = [];
      for (var row = 0, rowSize = options.colors.length; row < rowSize; row++) {
          var eventName = options.eventName;
          var colors = options.colors[row];
          var colorsName = options.colorsName[row];
          var buttons = [];
          for (var col = 0, colSize = colors.length; col < colSize; col++) {
              var color = colors[col];
              var colorName = colorsName[col];
              buttons.push([
                  '<button type="button" class="note-btn note-color-btn"',
                  'style="background-color:', color, '" ',
                  'data-event="', eventName, '" ',
                  'data-value="', color, '" ',
                  'title="', colorName, '" ',
                  'aria-label="', colorName, '" ',
                  'data-toggle="button" tabindex="-1"></button>',
              ].join(''));
          }
          contents.push('<div class="note-color-row">' + buttons.join('') + '</div>');
      }
      $node.html(contents.join(''));
      $node.find('.note-color-btn').each(function () {
          $(this).data('_lite_tooltip', new TooltipUI($(this), {
              container: options.container
          }));
      });
  });
  var colorDropdownButton = function (opt, type) {
      return buttonGroup({
          className: 'note-color',
          children: [
              button({
                  className: 'note-current-color-button',
                  contents: opt.title,
                  tooltip: opt.lang.color.recent,
                  click: opt.currentClick,
                  callback: function ($button) {
                      var $recentColor = $button.find('.note-recent-color');
                      if (type !== 'foreColor') {
                          $recentColor.css('background-color', '#FFFF00');
                          $button.attr('data-backColor', '#FFFF00');
                      }
                  }
              }),
              button({
                  className: 'dropdown-toggle',
                  contents: icon('note-icon-caret'),
                  tooltip: opt.lang.color.more,
                  data: {
                      toggle: 'dropdown'
                  }
              }),
              dropdown({
                  items: [
                      '<div>',
                      '<div class="note-btn-group btn-background-color">',
                      '  <div class="note-palette-title">' + opt.lang.color.background + '</div>',
                      '  <div>',
                      '<button type="button" class="note-color-reset note-btn note-btn-block" ' +
                          ' data-event="backColor" data-value="inherit">',
                      opt.lang.color.transparent,
                      '    </button>',
                      '  </div>',
                      '  <div class="note-holder" data-event="backColor"/>',
                      '  <div class="btn-sm">',
                      '    <input type="color" id="html5bcp" class="note-btn btn-default" value="#21104A" style="width:100%;" data-value="cp">',
                      '    <button type="button" class="note-color-reset btn" data-event="backColor" data-value="cpbackColor">',
                      opt.lang.color.cpSelect,
                      '    </button>',
                      '  </div>',
                      '</div>',
                      '<div class="note-btn-group btn-foreground-color">',
                      '  <div class="note-palette-title">' + opt.lang.color.foreground + '</div>',
                      '  <div>',
                      '<button type="button" class="note-color-reset note-btn note-btn-block" ' +
                          ' data-event="removeFormat" data-value="foreColor">',
                      opt.lang.color.resetToDefault,
                      '    </button>',
                      '  </div>',
                      '  <div class="note-holder" data-event="foreColor"/>',
                      '  <div class="btn-sm">',
                      '    <input type="color" id="html5fcp" class="note-btn btn-default" value="#21104A" style="width:100%;" data-value="cp">',
                      '    <button type="button" class="note-color-reset btn" data-event="foreColor" data-value="cpforeColor">',
                      opt.lang.color.cpSelect,
                      '    </button>',
                      '  </div>',
                      '</div>',
                      '</div>',
                  ].join(''),
                  callback: function ($dropdown) {
                      $dropdown.find('.note-holder').each(function () {
                          var $holder = $(this);
                          $holder.append(palette({
                              colors: opt.colors,
                              eventName: $holder.data('event')
                          }).render());
                      });
                      if (type === 'fore') {
                          $dropdown.find('.btn-background-color').hide();
                          $dropdown.css({ 'min-width': '210px' });
                      }
                      else if (type === 'back') {
                          $dropdown.find('.btn-foreground-color').hide();
                          $dropdown.css({ 'min-width': '210px' });
                      }
                  },
                  click: function (event) {
                      var $button = $(event.target);
                      var eventName = $button.data('event');
                      var value = $button.data('value');
                      var foreinput = document.getElementById('html5fcp').value;
                      var backinput = document.getElementById('html5bcp').value;
                      if (value === 'cp') {
                          event.stopPropagation();
                      }
                      else if (value === 'cpbackColor') {
                          value = backinput;
                      }
                      else if (value === 'cpforeColor') {
                          value = foreinput;
                      }
                      if (eventName && value) {
                          var key = eventName === 'backColor' ? 'background-color' : 'color';
                          var $color = $button.closest('.note-color').find('.note-recent-color');
                          var $currentButton = $button.closest('.note-color').find('.note-current-color-button');
                          $color.css(key, value);
                          $currentButton.attr('data-' + eventName, value);
                          if (type === 'fore') {
                              opt.itemClick('foreColor', value);
                          }
                          else if (type === 'back') {
                              opt.itemClick('backColor', value);
                          }
                          else {
                              opt.itemClick(eventName, value);
                          }
                      }
                  }
              }),
          ]
      }).render();
  };
  var dialog = renderer.create('<div class="note-modal" aria-hidden="false" tabindex="-1" role="dialog"/>', function ($node, options) {
      if (options.fade) {
          $node.addClass('fade');
      }
      $node.attr({
          'aria-label': options.title
      });
      $node.html([
          '  <div class="note-modal-content">',
          (options.title
              ? '    <div class="note-modal-header">' +
                  '      <button type="button" class="close" aria-label="Close" aria-hidden="true"><i class="note-icon-close"></i></button>' +
                  '      <h4 class="note-modal-title">' + options.title + '</h4>' +
                  '    </div>' : ''),
          '    <div class="note-modal-body">' + options.body + '</div>',
          (options.footer
              ? '    <div class="note-modal-footer">' + options.footer + '</div>' : ''),
          '  </div>',
      ].join(''));
      $node.data('modal', new ModalUI($node, options));
  });
  var videoDialog = function (opt) {
      var body = '<div class="note-form-group">' +
          '<label class="note-form-label">' +
          opt.lang.video.url + ' <small class="text-muted">' +
          opt.lang.video.providers + '</small>' +
          '</label>' +
          '<input class="note-video-url note-input" type="text" />' +
          '</div>';
      var footer = [
          '<button type="button" href="#" class="note-btn note-btn-primary note-video-btn disabled" disabled>',
          opt.lang.video.insert,
          '</button>',
      ].join('');
      return dialog({
          title: opt.lang.video.insert,
          fade: opt.fade,
          body: body,
          footer: footer
      }).render();
  };
  var imageDialog = function (opt) {
      var body = '<div class="note-form-group note-group-select-from-files">' +
          '<label class="note-form-label">' + opt.lang.image.selectFromFiles + '</label>' +
          '<input class="note-note-image-input note-input" type="file" name="files" accept="image/*" multiple="multiple" />' +
          opt.imageLimitation +
          '</div>' +
          '<div class="note-form-group" style="overflow:auto;">' +
          '<label class="note-form-label">' + opt.lang.image.url + '</label>' +
          '<input class="note-image-url note-input" type="text" />' +
          '</div>';
      var footer = [
          '<button href="#" type="button" class="note-btn note-btn-primary note-btn-large note-image-btn disabled" disabled>',
          opt.lang.image.insert,
          '</button>',
      ].join('');
      return dialog({
          title: opt.lang.image.insert,
          fade: opt.fade,
          body: body,
          footer: footer
      }).render();
  };
  var linkDialog = function (opt) {
      var body = '<div class="note-form-group">' +
          '<label class="note-form-label">' + opt.lang.link.textToDisplay + '</label>' +
          '<input class="note-link-text note-input" type="text" />' +
          '</div>' +
          '<div class="note-form-group">' +
          '<label class="note-form-label">' + opt.lang.link.url + '</label>' +
          '<input class="note-link-url note-input" type="text" value="http://" />' +
          '</div>' +
          (!opt.disableLinkTarget
              ? '<div class="checkbox">' +
                  '<label>' + '<input type="checkbox" checked> ' + opt.lang.link.openInNewWindow + '</label>' +
                  '</div>' : '');
      var footer = [
          '<button href="#" type="button" class="note-btn note-btn-primary note-link-btn disabled" disabled>',
          opt.lang.link.insert,
          '</button>',
      ].join('');
      return dialog({
          className: 'link-dialog',
          title: opt.lang.link.insert,
          fade: opt.fade,
          body: body,
          footer: footer
      }).render();
  };
  var popover = renderer.create([
      '<div class="note-popover bottom">',
      '  <div class="note-popover-arrow"/>',
      '  <div class="popover-content note-children-container"/>',
      '</div>',
  ].join(''), function ($node, options) {
      var direction = typeof options.direction !== 'undefined' ? options.direction : 'bottom';
      $node.addClass(direction).hide();
      if (options.hideArrow) {
          $node.find('.note-popover-arrow').hide();
      }
  });
  var checkbox = renderer.create('<div class="checkbox"></div>', function ($node, options) {
      $node.html([
          '<label' + (options.id ? ' for="' + options.id + '"' : '') + '>',
          ' <input role="checkbox" type="checkbox"' + (options.id ? ' id="' + options.id + '"' : ''),
          (options.checked ? ' checked' : ''),
          ' aria-checked="' + (options.checked ? 'true' : 'false') + '"/>',
          (options.text ? options.text : ''),
          '</label>',
      ].join(''));
  });
  var icon = function (iconClassName, tagName) {
      tagName = tagName || 'i';
      return '<' + tagName + ' class="' + iconClassName + '"/>';
  };
  var ui = {
      editor: editor,
      toolbar: toolbar,
      editingArea: editingArea,
      codable: codable,
      editable: editable,
      statusbar: statusbar,
      airEditor: airEditor,
      airEditable: airEditable,
      buttonGroup: buttonGroup,
      button: button,
      dropdown: dropdown,
      dropdownCheck: dropdownCheck,
      dropdownButton: dropdownButton,
      dropdownButtonContents: dropdownButtonContents,
      dropdownCheckButton: dropdownCheckButton,
      paragraphDropdownButton: paragraphDropdownButton,
      tableDropdownButton: tableDropdownButton,
      colorDropdownButton: colorDropdownButton,
      palette: palette,
      dialog: dialog,
      videoDialog: videoDialog,
      imageDialog: imageDialog,
      linkDialog: linkDialog,
      popover: popover,
      checkbox: checkbox,
      icon: icon,
      toggleBtn: function ($btn, isEnable) {
          $btn.toggleClass('disabled', !isEnable);
          $btn.attr('disabled', !isEnable);
      },
      toggleBtnActive: function ($btn, isActive) {
          $btn.toggleClass('active', isActive);
      },
      check: function ($dom, value) {
          $dom.find('.checked').removeClass('checked');
          $dom.find('[data-value="' + value + '"]').addClass('checked');
      },
      onDialogShown: function ($dialog, handler) {
          $dialog.one('note.modal.show', handler);
      },
      onDialogHidden: function ($dialog, handler) {
          $dialog.one('note.modal.hide', handler);
      },
      showDialog: function ($dialog) {
          $dialog.data('modal').show();
      },
      hideDialog: function ($dialog) {
          $dialog.data('modal').hide();
      },
      /**
       * get popover content area
       *
       * @param $popover
       * @returns {*}
       */
      getPopoverContent: function ($popover) {
          return $popover.find('.note-popover-content');
      },
      /**
       * get dialog's body area
       *
       * @param $dialog
       * @returns {*}
       */
      getDialogBody: function ($dialog) {
          return $dialog.find('.note-modal-body');
      },
      createLayout: function ($note, options) {
          var $editor = (options.airMode ? ui.airEditor([
              ui.editingArea([
                  ui.airEditable(),
              ]),
          ]) : ui.editor([
              ui.toolbar(),
              ui.editingArea([
                  ui.codable(),
                  ui.editable(),
              ]),
              ui.statusbar(),
          ])).render();
          $editor.insertAfter($note);
          return {
              note: $note,
              editor: $editor,
              toolbar: $editor.find('.note-toolbar'),
              editingArea: $editor.find('.note-editing-area'),
              editable: $editor.find('.note-editable'),
              codable: $editor.find('.note-codable'),
              statusbar: $editor.find('.note-statusbar')
          };
      },
      removeLayout: function ($note, layoutInfo) {
          $note.html(layoutInfo.editable.html());
          layoutInfo.editor.remove();
          $note.off('summernote'); // remove summernote custom event
          $note.show();
      }
  };

  $$1.summernote = $$1.summernote || {
      lang: {}
  };
  $$1.extend($$1.summernote.lang, {
      'en-US': {
          font: {
              bold: 'Bold',
              italic: 'Italic',
              underline: 'Underline',
              clear: 'Remove Font Style',
              height: 'Line Height',
              name: 'Font Family',
              strikethrough: 'Strikethrough',
              subscript: 'Subscript',
              superscript: 'Superscript',
              size: 'Font Size'
          },
          image: {
              image: 'Picture',
              insert: 'Insert Image',
              resizeFull: 'Resize full',
              resizeHalf: 'Resize half',
              resizeQuarter: 'Resize quarter',
              resizeNone: 'Original size',
              floatLeft: 'Float Left',
              floatRight: 'Float Right',
              floatNone: 'Remove float',
              shapeRounded: 'Shape: Rounded',
              shapeCircle: 'Shape: Circle',
              shapeThumbnail: 'Shape: Thumbnail',
              shapeNone: 'Shape: None',
              dragImageHere: 'Drag image or text here',
              dropImage: 'Drop image or Text',
              selectFromFiles: 'Select from files',
              maximumFileSize: 'Maximum file size',
              maximumFileSizeError: 'Maximum file size exceeded.',
              url: 'Image URL',
              remove: 'Remove Image',
              original: 'Original'
          },
          video: {
              video: 'Video',
              videoLink: 'Video Link',
              insert: 'Insert Video',
              url: 'Video URL',
              providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)'
          },
          link: {
              link: 'Link',
              insert: 'Insert Link',
              unlink: 'Unlink',
              edit: 'Edit',
              textToDisplay: 'Text to display',
              url: 'To what URL should this link go?',
              openInNewWindow: 'Open in new window'
          },
          table: {
              table: 'Table',
              addRowAbove: 'Add row above',
              addRowBelow: 'Add row below',
              addColLeft: 'Add column left',
              addColRight: 'Add column right',
              delRow: 'Delete row',
              delCol: 'Delete column',
              delTable: 'Delete table'
          },
          hr: {
              insert: 'Insert Horizontal Rule'
          },
          style: {
              style: 'Style',
              p: 'Normal',
              blockquote: 'Quote',
              pre: 'Code',
              h1: 'Header 1',
              h2: 'Header 2',
              h3: 'Header 3',
              h4: 'Header 4',
              h5: 'Header 5',
              h6: 'Header 6'
          },
          lists: {
              unordered: 'Unordered list',
              ordered: 'Ordered list'
          },
          options: {
              help: 'Help',
              fullscreen: 'Full Screen',
              codeview: 'Code View'
          },
          paragraph: {
              paragraph: 'Paragraph',
              outdent: 'Outdent',
              indent: 'Indent',
              left: 'Align left',
              center: 'Align center',
              right: 'Align right',
              justify: 'Justify full'
          },
          color: {
              recent: 'Recent Color',
              more: 'More Color',
              background: 'Background Color',
              foreground: 'Foreground Color',
              transparent: 'Transparent',
              setTransparent: 'Set transparent',
              reset: 'Reset',
              resetToDefault: 'Reset to default',
              cpSelect: 'Select'
          },
          shortcut: {
              shortcuts: 'Keyboard shortcuts',
              close: 'Close',
              textFormatting: 'Text formatting',
              action: 'Action',
              paragraphFormatting: 'Paragraph formatting',
              documentStyle: 'Document Style',
              extraKeys: 'Extra keys'
          },
          help: {
              'insertParagraph': 'Insert Paragraph',
              'undo': 'Undoes the last command',
              'redo': 'Redoes the last command',
              'tab': 'Tab',
              'untab': 'Untab',
              'bold': 'Set a bold style',
              'italic': 'Set a italic style',
              'underline': 'Set a underline style',
              'strikethrough': 'Set a strikethrough style',
              'removeFormat': 'Clean a style',
              'justifyLeft': 'Set left align',
              'justifyCenter': 'Set center align',
              'justifyRight': 'Set right align',
              'justifyFull': 'Set full align',
              'insertUnorderedList': 'Toggle unordered list',
              'insertOrderedList': 'Toggle ordered list',
              'outdent': 'Outdent on current paragraph',
              'indent': 'Indent on current paragraph',
              'formatPara': 'Change current block\'s format as a paragraph(P tag)',
              'formatH1': 'Change current block\'s format as H1',
              'formatH2': 'Change current block\'s format as H2',
              'formatH3': 'Change current block\'s format as H3',
              'formatH4': 'Change current block\'s format as H4',
              'formatH5': 'Change current block\'s format as H5',
              'formatH6': 'Change current block\'s format as H6',
              'insertHorizontalRule': 'Insert horizontal rule',
              'linkDialog.show': 'Show Link Dialog'
          },
          history: {
              undo: 'Undo',
              redo: 'Redo'
          },
          specialChar: {
              specialChar: 'SPECIAL CHARACTERS',
              select: 'Select Special characters'
          }
      }
  });

  var isSupportAmd = typeof define === 'function' && define.amd; // eslint-disable-line
  /**
   * returns whether font is installed or not.
   *
   * @param {String} fontName
   * @return {Boolean}
   */
  function isFontInstalled(fontName) {
      var testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';
      var testText = 'mmmmmmmmmmwwwww';
      var testSize = '200px';
      var canvas = document.createElement('canvas');
      var context = canvas.getContext('2d');
      context.font = testSize + " '" + testFontName + "'";
      var originalWidth = context.measureText(testText).width;
      context.font = testSize + " '" + fontName + "', '" + testFontName + "'";
      var width = context.measureText(testText).width;
      return originalWidth !== width;
  }
  var userAgent = navigator.userAgent;
  var isMSIE = /MSIE|Trident/i.test(userAgent);
  var browserVersion;
  if (isMSIE) {
      var matches = /MSIE (\d+[.]\d+)/.exec(userAgent);
      if (matches) {
          browserVersion = parseFloat(matches[1]);
      }
      matches = /Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(userAgent);
      if (matches) {
          browserVersion = parseFloat(matches[1]);
      }
  }
  var isEdge = /Edge\/\d+/.test(userAgent);
  var hasCodeMirror = !!window.CodeMirror;
  var isSupportTouch = (('ontouchstart' in window) ||
      (navigator.MaxTouchPoints > 0) ||
      (navigator.msMaxTouchPoints > 0));
  // [workaround] IE doesn't have input events for contentEditable
  // - see: https://goo.gl/4bfIvA
  var inputEventName = (isMSIE || isEdge) ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input';
  /**
   * @class core.env
   *
   * Object which check platform and agent
   *
   * @singleton
   * @alternateClassName env
   */
  var env = {
      isMac: navigator.appVersion.indexOf('Mac') > -1,
      isMSIE: isMSIE,
      isEdge: isEdge,
      isFF: !isEdge && /firefox/i.test(userAgent),
      isPhantom: /PhantomJS/i.test(userAgent),
      isWebkit: !isEdge && /webkit/i.test(userAgent),
      isChrome: !isEdge && /chrome/i.test(userAgent),
      isSafari: !isEdge && /safari/i.test(userAgent),
      browserVersion: browserVersion,
      jqueryVersion: parseFloat($$1.fn.jquery),
      isSupportAmd: isSupportAmd,
      isSupportTouch: isSupportTouch,
      hasCodeMirror: hasCodeMirror,
      isFontInstalled: isFontInstalled,
      isW3CRangeSupport: !!document.createRange,
      inputEventName: inputEventName
  };

  /**
   * @class core.func
   *
   * func utils (for high-order func's arg)
   *
   * @singleton
   * @alternateClassName func
   */
  function eq(itemA) {
      return function (itemB) {
          return itemA === itemB;
      };
  }
  function eq2(itemA, itemB) {
      return itemA === itemB;
  }
  function peq2(propName) {
      return function (itemA, itemB) {
          return itemA[propName] === itemB[propName];
      };
  }
  function ok() {
      return true;
  }
  function fail() {
      return false;
  }
  function not(f) {
      return function () {
          return !f.apply(f, arguments);
      };
  }
  function and(fA, fB) {
      return function (item) {
          return fA(item) && fB(item);
      };
  }
  function self(a) {
      return a;
  }
  function invoke(obj, method) {
      return function () {
          return obj[method].apply(obj, arguments);
      };
  }
  var idCounter = 0;
  /**
   * generate a globally-unique id
   *
   * @param {String} [prefix]
   */
  function uniqueId(prefix) {
      var id = ++idCounter + '';
      return prefix ? prefix + id : id;
  }
  /**
   * returns bnd (bounds) from rect
   *
   * - IE Compatibility Issue: http://goo.gl/sRLOAo
   * - Scroll Issue: http://goo.gl/sNjUc
   *
   * @param {Rect} rect
   * @return {Object} bounds
   * @return {Number} bounds.top
   * @return {Number} bounds.left
   * @return {Number} bounds.width
   * @return {Number} bounds.height
   */
  function rect2bnd(rect) {
      var $document = $(document);
      return {
          top: rect.top + $document.scrollTop(),
          left: rect.left + $document.scrollLeft(),
          width: rect.right - rect.left,
          height: rect.bottom - rect.top
      };
  }
  /**
   * returns a copy of the object where the keys have become the values and the values the keys.
   * @param {Object} obj
   * @return {Object}
   */
  function invertObject(obj) {
      var inverted = {};
      for (var key in obj) {
          if (obj.hasOwnProperty(key)) {
              inverted[obj[key]] = key;
          }
      }
      return inverted;
  }
  /**
   * @param {String} namespace
   * @param {String} [prefix]
   * @return {String}
   */
  function namespaceToCamel(namespace, prefix) {
      prefix = prefix || '';
      return prefix + namespace.split('.').map(function (name) {
          return name.substring(0, 1).toUpperCase() + name.substring(1);
      }).join('');
  }
  /**
   * Returns a function, that, as long as it continues to be invoked, will not
   * be triggered. The function will be called after it stops being called for
   * N milliseconds. If `immediate` is passed, trigger the function on the
   * leading edge, instead of the trailing.
   * @param {Function} func
   * @param {Number} wait
   * @param {Boolean} immediate
   * @return {Function}
   */
  function debounce(func, wait, immediate) {
      var timeout;
      return function () {
          var context = this;
          var args = arguments;
          var later = function () {
              timeout = null;
              if (!immediate) {
                  func.apply(context, args);
              }
          };
          var callNow = immediate && !timeout;
          clearTimeout(timeout);
          timeout = setTimeout(later, wait);
          if (callNow) {
              func.apply(context, args);
          }
      };
  }
  /**
   *
   * @param {String} url
   * @return {Boolean}
   */
  function isValidUrl(url) {
      var expression = /[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi;
      return expression.test(url);
  }
  var func = {
      eq: eq,
      eq2: eq2,
      peq2: peq2,
      ok: ok,
      fail: fail,
      self: self,
      not: not,
      and: and,
      invoke: invoke,
      uniqueId: uniqueId,
      rect2bnd: rect2bnd,
      invertObject: invertObject,
      namespaceToCamel: namespaceToCamel,
      debounce: debounce,
      isValidUrl: isValidUrl
  };

  /**
   * returns the first item of an array.
   *
   * @param {Array} array
   */
  function head(array) {
      return array[0];
  }
  /**
   * returns the last item of an array.
   *
   * @param {Array} array
   */
  function last(array) {
      return array[array.length - 1];
  }
  /**
   * returns everything but the last entry of the array.
   *
   * @param {Array} array
   */
  function initial(array) {
      return array.slice(0, array.length - 1);
  }
  /**
   * returns the rest of the items in an array.
   *
   * @param {Array} array
   */
  function tail(array) {
      return array.slice(1);
  }
  /**
   * returns item of array
   */
  function find(array, pred) {
      for (var idx = 0, len = array.length; idx < len; idx++) {
          var item = array[idx];
          if (pred(item)) {
              return item;
          }
      }
  }
  /**
   * returns true if all of the values in the array pass the predicate truth test.
   */
  function all(array, pred) {
      for (var idx = 0, len = array.length; idx < len; idx++) {
          if (!pred(array[idx])) {
              return false;
          }
      }
      return true;
  }
  /**
   * returns true if the value is present in the list.
   */
  function contains(array, item) {
      if (array && array.length && item) {
          return array.indexOf(item) !== -1;
      }
      return false;
  }
  /**
   * get sum from a list
   *
   * @param {Array} array - array
   * @param {Function} fn - iterator
   */
  function sum(array, fn) {
      fn = fn || func.self;
      return array.reduce(function (memo, v) {
          return memo + fn(v);
      }, 0);
  }
  /**
   * returns a copy of the collection with array type.
   * @param {Collection} collection - collection eg) node.childNodes, ...
   */
  function from(collection) {
      var result = [];
      var length = collection.length;
      var idx = -1;
      while (++idx < length) {
          result[idx] = collection[idx];
      }
      return result;
  }
  /**
   * returns whether list is empty or not
   */
  function isEmpty(array) {
      return !array || !array.length;
  }
  /**
   * cluster elements by predicate function.
   *
   * @param {Array} array - array
   * @param {Function} fn - predicate function for cluster rule
   * @param {Array[]}
   */
  function clusterBy(array, fn) {
      if (!array.length) {
          return [];
      }
      var aTail = tail(array);
      return aTail.reduce(function (memo, v) {
          var aLast = last(memo);
          if (fn(last(aLast), v)) {
              aLast[aLast.length] = v;
          }
          else {
              memo[memo.length] = [v];
          }
          return memo;
      }, [[head(array)]]);
  }
  /**
   * returns a copy of the array with all false values removed
   *
   * @param {Array} array - array
   * @param {Function} fn - predicate function for cluster rule
   */
  function compact(array) {
      var aResult = [];
      for (var idx = 0, len = array.length; idx < len; idx++) {
          if (array[idx]) {
              aResult.push(array[idx]);
          }
      }
      return aResult;
  }
  /**
   * produces a duplicate-free version of the array
   *
   * @param {Array} array
   */
  function unique(array) {
      var results = [];
      for (var idx = 0, len = array.length; idx < len; idx++) {
          if (!contains(results, array[idx])) {
              results.push(array[idx]);
          }
      }
      return results;
  }
  /**
   * returns next item.
   * @param {Array} array
   */
  function next(array, item) {
      if (array && array.length && item) {
          var idx = array.indexOf(item);
          return idx === -1 ? null : array[idx + 1];
      }
      return null;
  }
  /**
   * returns prev item.
   * @param {Array} array
   */
  function prev(array, item) {
      if (array && array.length && item) {
          var idx = array.indexOf(item);
          return idx === -1 ? null : array[idx - 1];
      }
      return null;
  }
  /**
   * @class core.list
   *
   * list utils
   *
   * @singleton
   * @alternateClassName list
   */
  var lists = {
      head: head,
      last: last,
      initial: initial,
      tail: tail,
      prev: prev,
      next: next,
      find: find,
      contains: contains,
      all: all,
      sum: sum,
      from: from,
      isEmpty: isEmpty,
      clusterBy: clusterBy,
      compact: compact,
      unique: unique
  };

  var NBSP_CHAR = String.fromCharCode(160);
  var ZERO_WIDTH_NBSP_CHAR = '\ufeff';
  /**
   * @method isEditable
   *
   * returns whether node is `note-editable` or not.
   *
   * @param {Node} node
   * @return {Boolean}
   */
  function isEditable(node) {
      return node && $$1(node).hasClass('note-editable');
  }
  /**
   * @method isControlSizing
   *
   * returns whether node is `note-control-sizing` or not.
   *
   * @param {Node} node
   * @return {Boolean}
   */
  function isControlSizing(node) {
      return node && $$1(node).hasClass('note-control-sizing');
  }
  /**
   * @method makePredByNodeName
   *
   * returns predicate which judge whether nodeName is same
   *
   * @param {String} nodeName
   * @return {Function}
   */
  function makePredByNodeName(nodeName) {
      nodeName = nodeName.toUpperCase();
      return function (node) {
          return node && node.nodeName.toUpperCase() === nodeName;
      };
  }
  /**
   * @method isText
   *
   *
   *
   * @param {Node} node
   * @return {Boolean} true if node's type is text(3)
   */
  function isText(node) {
      return node && node.nodeType === 3;
  }
  /**
   * @method isElement
   *
   *
   *
   * @param {Node} node
   * @return {Boolean} true if node's type is element(1)
   */
  function isElement(node) {
      return node && node.nodeType === 1;
  }
  /**
   * ex) br, col, embed, hr, img, input, ...
   * @see http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
   */
  function isVoid(node) {
      return node && /^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(node.nodeName.toUpperCase());
  }
  function isPara(node) {
      if (isEditable(node)) {
          return false;
      }
      // Chrome(v31.0), FF(v25.0.1) use DIV for paragraph
      return node && /^DIV|^P|^LI|^H[1-7]/.test(node.nodeName.toUpperCase());
  }
  function isHeading(node) {
      return node && /^H[1-7]/.test(node.nodeName.toUpperCase());
  }
  var isPre = makePredByNodeName('PRE');
  var isLi = makePredByNodeName('LI');
  function isPurePara(node) {
      return isPara(node) && !isLi(node);
  }
  var isTable = makePredByNodeName('TABLE');
  var isData = makePredByNodeName('DATA');
  function isInline(node) {
      return !isBodyContainer(node) &&
          !isList(node) &&
          !isHr(node) &&
          !isPara(node) &&
          !isTable(node) &&
          !isBlockquote(node) &&
          !isData(node);
  }
  function isList(node) {
      return node && /^UL|^OL/.test(node.nodeName.toUpperCase());
  }
  var isHr = makePredByNodeName('HR');
  function isCell(node) {
      return node && /^TD|^TH/.test(node.nodeName.toUpperCase());
  }
  var isBlockquote = makePredByNodeName('BLOCKQUOTE');
  function isBodyContainer(node) {
      return isCell(node) || isBlockquote(node) || isEditable(node);
  }
  var isAnchor = makePredByNodeName('A');
  function isParaInline(node) {
      return isInline(node) && !!ancestor(node, isPara);
  }
  function isBodyInline(node) {
      return isInline(node) && !ancestor(node, isPara);
  }
  var isBody = makePredByNodeName('BODY');
  /**
   * returns whether nodeB is closest sibling of nodeA
   *
   * @param {Node} nodeA
   * @param {Node} nodeB
   * @return {Boolean}
   */
  function isClosestSibling(nodeA, nodeB) {
      return nodeA.nextSibling === nodeB ||
          nodeA.previousSibling === nodeB;
  }
  /**
   * returns array of closest siblings with node
   *
   * @param {Node} node
   * @param {function} [pred] - predicate function
   * @return {Node[]}
   */
  function withClosestSiblings(node, pred) {
      pred = pred || func.ok;
      var siblings = [];
      if (node.previousSibling && pred(node.previousSibling)) {
          siblings.push(node.previousSibling);
      }
      siblings.push(node);
      if (node.nextSibling && pred(node.nextSibling)) {
          siblings.push(node.nextSibling);
      }
      return siblings;
  }
  /**
   * blank HTML for cursor position
   * - [workaround] old IE only works with &nbsp;
   * - [workaround] IE11 and other browser works with bogus br
   */
  var blankHTML = env.isMSIE && env.browserVersion < 11 ? '&nbsp;' : '<br>';
  /**
   * @method nodeLength
   *
   * returns #text's text size or element's childNodes size
   *
   * @param {Node} node
   */
  function nodeLength(node) {
      if (isText(node)) {
          return node.nodeValue.length;
      }
      if (node) {
          return node.childNodes.length;
      }
      return 0;
  }
  /**
   * returns whether node is empty or not.
   *
   * @param {Node} node
   * @return {Boolean}
   */
  function isEmpty$1(node) {
      var len = nodeLength(node);
      if (len === 0) {
          return true;
      }
      else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) {
          // ex) <p><br></p>, <span><br></span>
          return true;
      }
      else if (lists.all(node.childNodes, isText) && node.innerHTML === '') {
          // ex) <p></p>, <span></span>
          return true;
      }
      return false;
  }
  /**
   * padding blankHTML if node is empty (for cursor position)
   */
  function paddingBlankHTML(node) {
      if (!isVoid(node) && !nodeLength(node)) {
          node.innerHTML = blankHTML;
      }
  }
  /**
   * find nearest ancestor predicate hit
   *
   * @param {Node} node
   * @param {Function} pred - predicate function
   */
  function ancestor(node, pred) {
      while (node) {
          if (pred(node)) {
              return node;
          }
          if (isEditable(node)) {
              break;
          }
          node = node.parentNode;
      }
      return null;
  }
  /**
   * find nearest ancestor only single child blood line and predicate hit
   *
   * @param {Node} node
   * @param {Function} pred - predicate function
   */
  function singleChildAncestor(node, pred) {
      node = node.parentNode;
      while (node) {
          if (nodeLength(node) !== 1) {
              break;
          }
          if (pred(node)) {
              return node;
          }
          if (isEditable(node)) {
              break;
          }
          node = node.parentNode;
      }
      return null;
  }
  /**
   * returns new array of ancestor nodes (until predicate hit).
   *
   * @param {Node} node
   * @param {Function} [optional] pred - predicate function
   */
  function listAncestor(node, pred) {
      pred = pred || func.fail;
      var ancestors = [];
      ancestor(node, function (el) {
          if (!isEditable(el)) {
              ancestors.push(el);
          }
          return pred(el);
      });
      return ancestors;
  }
  /**
   * find farthest ancestor predicate hit
   */
  function lastAncestor(node, pred) {
      var ancestors = listAncestor(node);
      return lists.last(ancestors.filter(pred));
  }
  /**
   * returns common ancestor node between two nodes.
   *
   * @param {Node} nodeA
   * @param {Node} nodeB
   */
  function commonAncestor(nodeA, nodeB) {
      var ancestors = listAncestor(nodeA);
      for (var n = nodeB; n; n = n.parentNode) {
          if (ancestors.indexOf(n) > -1)
              return n;
      }
      return null; // difference document area
  }
  /**
   * listing all previous siblings (until predicate hit).
   *
   * @param {Node} node
   * @param {Function} [optional] pred - predicate function
   */
  function listPrev(node, pred) {
      pred = pred || func.fail;
      var nodes = [];
      while (node) {
          if (pred(node)) {
              break;
          }
          nodes.push(node);
          node = node.previousSibling;
      }
      return nodes;
  }
  /**
   * listing next siblings (until predicate hit).
   *
   * @param {Node} node
   * @param {Function} [pred] - predicate function
   */
  function listNext(node, pred) {
      pred = pred || func.fail;
      var nodes = [];
      while (node) {
          if (pred(node)) {
              break;
          }
          nodes.push(node);
          node = node.nextSibling;
      }
      return nodes;
  }
  /**
   * listing descendant nodes
   *
   * @param {Node} node
   * @param {Function} [pred] - predicate function
   */
  function listDescendant(node, pred) {
      var descendants = [];
      pred = pred || func.ok;
      // start DFS(depth first search) with node
      (function fnWalk(current) {
          if (node !== current && pred(current)) {
              descendants.push(current);
          }
          for (var idx = 0, len = current.childNodes.length; idx < len; idx++) {
              fnWalk(current.childNodes[idx]);
          }
      })(node);
      return descendants;
  }
  /**
   * wrap node with new tag.
   *
   * @param {Node} node
   * @param {Node} tagName of wrapper
   * @return {Node} - wrapper
   */
  function wrap(node, wrapperName) {
      var parent = node.parentNode;
      var wrapper = $$1('<' + wrapperName + '>')[0];
      parent.insertBefore(wrapper, node);
      wrapper.appendChild(node);
      return wrapper;
  }
  /**
   * insert node after preceding
   *
   * @param {Node} node
   * @param {Node} preceding - predicate function
   */
  function insertAfter(node, preceding) {
      var next = preceding.nextSibling;
      var parent = preceding.parentNode;
      if (next) {
          parent.insertBefore(node, next);
      }
      else {
          parent.appendChild(node);
      }
      return node;
  }
  /**
   * append elements.
   *
   * @param {Node} node
   * @param {Collection} aChild
   */
  function appendChildNodes(node, aChild) {
      $$1.each(aChild, function (idx, child) {
          node.appendChild(child);
      });
      return node;
  }
  /**
   * returns whether boundaryPoint is left edge or not.
   *
   * @param {BoundaryPoint} point
   * @return {Boolean}
   */
  function isLeftEdgePoint(point) {
      return point.offset === 0;
  }
  /**
   * returns whether boundaryPoint is right edge or not.
   *
   * @param {BoundaryPoint} point
   * @return {Boolean}
   */
  function isRightEdgePoint(point) {
      return point.offset === nodeLength(point.node);
  }
  /**
   * returns whether boundaryPoint is edge or not.
   *
   * @param {BoundaryPoint} point
   * @return {Boolean}
   */
  function isEdgePoint(point) {
      return isLeftEdgePoint(point) || isRightEdgePoint(point);
  }
  /**
   * returns whether node is left edge of ancestor or not.
   *
   * @param {Node} node
   * @param {Node} ancestor
   * @return {Boolean}
   */
  function isLeftEdgeOf(node, ancestor) {
      while (node && node !== ancestor) {
          if (position(node) !== 0) {
              return false;
          }
          node = node.parentNode;
      }
      return true;
  }
  /**
   * returns whether node is right edge of ancestor or not.
   *
   * @param {Node} node
   * @param {Node} ancestor
   * @return {Boolean}
   */
  function isRightEdgeOf(node, ancestor) {
      if (!ancestor) {
          return false;
      }
      while (node && node !== ancestor) {
          if (position(node) !== nodeLength(node.parentNode) - 1) {
              return false;
          }
          node = node.parentNode;
      }
      return true;
  }
  /**
   * returns whether point is left edge of ancestor or not.
   * @param {BoundaryPoint} point
   * @param {Node} ancestor
   * @return {Boolean}
   */
  function isLeftEdgePointOf(point, ancestor) {
      return isLeftEdgePoint(point) && isLeftEdgeOf(point.node, ancestor);
  }
  /**
   * returns whether point is right edge of ancestor or not.
   * @param {BoundaryPoint} point
   * @param {Node} ancestor
   * @return {Boolean}
   */
  function isRightEdgePointOf(point, ancestor) {
      return isRightEdgePoint(point) && isRightEdgeOf(point.node, ancestor);
  }
  /**
   * returns offset from parent.
   *
   * @param {Node} node
   */
  function position(node) {
      var offset = 0;
      while ((node = node.previousSibling)) {
          offset += 1;
      }
      return offset;
  }
  function hasChildren(node) {
      return !!(node && node.childNodes && node.childNodes.length);
  }
  /**
   * returns previous boundaryPoint
   *
   * @param {BoundaryPoint} point
   * @param {Boolean} isSkipInnerOffset
   * @return {BoundaryPoint}
   */
  function prevPoint(point, isSkipInnerOffset) {
      var node;
      var offset;
      if (point.offset === 0) {
          if (isEditable(point.node)) {
              return null;
          }
          node = point.node.parentNode;
          offset = position(point.node);
      }
      else if (hasChildren(point.node)) {
          node = point.node.childNodes[point.offset - 1];
          offset = nodeLength(node);
      }
      else {
          node = point.node;
          offset = isSkipInnerOffset ? 0 : point.offset - 1;
      }
      return {
          node: node,
          offset: offset
      };
  }
  /**
   * returns next boundaryPoint
   *
   * @param {BoundaryPoint} point
   * @param {Boolean} isSkipInnerOffset
   * @return {BoundaryPoint}
   */
  function nextPoint(point, isSkipInnerOffset) {
      var node, offset;
      if (nodeLength(point.node) === point.offset) {
          if (isEditable(point.node)) {
              return null;
          }
          node = point.node.parentNode;
          offset = position(point.node) + 1;
      }
      else if (hasChildren(point.node)) {
          node = point.node.childNodes[point.offset];
          offset = 0;
      }
      else {
          node = point.node;
          offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;
      }
      return {
          node: node,
          offset: offset
      };
  }
  /**
   * returns whether pointA and pointB is same or not.
   *
   * @param {BoundaryPoint} pointA
   * @param {BoundaryPoint} pointB
   * @return {Boolean}
   */
  function isSamePoint(pointA, pointB) {
      return pointA.node === pointB.node && pointA.offset === pointB.offset;
  }
  /**
   * returns whether point is visible (can set cursor) or not.
   *
   * @param {BoundaryPoint} point
   * @return {Boolean}
   */
  function isVisiblePoint(point) {
      if (isText(point.node) || !hasChildren(point.node) || isEmpty$1(point.node)) {
          return true;
      }
      var leftNode = point.node.childNodes[point.offset - 1];
      var rightNode = point.node.childNodes[point.offset];
      if ((!leftNode || isVoid(leftNode)) && (!rightNode || isVoid(rightNode))) {
          return true;
      }
      return false;
  }
  /**
   * @method prevPointUtil
   *
   * @param {BoundaryPoint} point
   * @param {Function} pred
   * @return {BoundaryPoint}
   */
  function prevPointUntil(point, pred) {
      while (point) {
          if (pred(point)) {
              return point;
          }
          point = prevPoint(point);
      }
      return null;
  }
  /**
   * @method nextPointUntil
   *
   * @param {BoundaryPoint} point
   * @param {Function} pred
   * @return {BoundaryPoint}
   */
  function nextPointUntil(point, pred) {
      while (point) {
          if (pred(point)) {
              return point;
          }
          point = nextPoint(point);
      }
      return null;
  }
  /**
   * returns whether point has character or not.
   *
   * @param {Point} point
   * @return {Boolean}
   */
  function isCharPoint(point) {
      if (!isText(point.node)) {
          return false;
      }
      var ch = point.node.nodeValue.charAt(point.offset - 1);
      return ch && (ch !== ' ' && ch !== NBSP_CHAR);
  }
  /**
   * @method walkPoint
   *
   * @param {BoundaryPoint} startPoint
   * @param {BoundaryPoint} endPoint
   * @param {Function} handler
   * @param {Boolean} isSkipInnerOffset
   */
  function walkPoint(startPoint, endPoint, handler, isSkipInnerOffset) {
      var point = startPoint;
      while (point) {
          handler(point);
          if (isSamePoint(point, endPoint)) {
              break;
          }
          var isSkipOffset = isSkipInnerOffset &&
              startPoint.node !== point.node &&
              endPoint.node !== point.node;
          point = nextPoint(point, isSkipOffset);
      }
  }
  /**
   * @method makeOffsetPath
   *
   * return offsetPath(array of offset) from ancestor
   *
   * @param {Node} ancestor - ancestor node
   * @param {Node} node
   */
  function makeOffsetPath(ancestor, node) {
      var ancestors = listAncestor(node, func.eq(ancestor));
      return ancestors.map(position).reverse();
  }
  /**
   * @method fromOffsetPath
   *
   * return element from offsetPath(array of offset)
   *
   * @param {Node} ancestor - ancestor node
   * @param {array} offsets - offsetPath
   */
  function fromOffsetPath(ancestor, offsets) {
      var current = ancestor;
      for (var i = 0, len = offsets.length; i < len; i++) {
          if (current.childNodes.length <= offsets[i]) {
              current = current.childNodes[current.childNodes.length - 1];
          }
          else {
              current = current.childNodes[offsets[i]];
          }
      }
      return current;
  }
  /**
   * @method splitNode
   *
   * split element or #text
   *
   * @param {BoundaryPoint} point
   * @param {Object} [options]
   * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false
   * @param {Boolean} [options.isNotSplitEdgePoint] - default: false
   * @param {Boolean} [options.isDiscardEmptySplits] - default: false
   * @return {Node} right node of boundaryPoint
   */
  function splitNode(point, options) {
      var isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML;
      var isNotSplitEdgePoint = options && options.isNotSplitEdgePoint;
      var isDiscardEmptySplits = options && options.isDiscardEmptySplits;
      if (isDiscardEmptySplits) {
          isSkipPaddingBlankHTML = true;
      }
      // edge case
      if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) {
          if (isLeftEdgePoint(point)) {
              return point.node;
          }
          else if (isRightEdgePoint(point)) {
              return point.node.nextSibling;
          }
      }
      // split #text
      if (isText(point.node)) {
          return point.node.splitText(point.offset);
      }
      else {
          var childNode = point.node.childNodes[point.offset];
          var clone = insertAfter(point.node.cloneNode(false), point.node);
          appendChildNodes(clone, listNext(childNode));
          if (!isSkipPaddingBlankHTML) {
              paddingBlankHTML(point.node);
              paddingBlankHTML(clone);
          }
          if (isDiscardEmptySplits) {
              if (isEmpty$1(point.node)) {
                  remove(point.node);
              }
              if (isEmpty$1(clone)) {
                  remove(clone);
                  return point.node.nextSibling;
              }
          }
          return clone;
      }
  }
  /**
   * @method splitTree
   *
   * split tree by point
   *
   * @param {Node} root - split root
   * @param {BoundaryPoint} point
   * @param {Object} [options]
   * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false
   * @param {Boolean} [options.isNotSplitEdgePoint] - default: false
   * @return {Node} right node of boundaryPoint
   */
  function splitTree(root, point, options) {
      // ex) [#text, <span>, <p>]
      var ancestors = listAncestor(point.node, func.eq(root));
      if (!ancestors.length) {
          return null;
      }
      else if (ancestors.length === 1) {
          return splitNode(point, options);
      }
      return ancestors.reduce(function (node, parent) {
          if (node === point.node) {
              node = splitNode(point, options);
          }
          return splitNode({
              node: parent,
              offset: node ? position(node) : nodeLength(parent)
          }, options);
      });
  }
  /**
   * split point
   *
   * @param {Point} point
   * @param {Boolean} isInline
   * @return {Object}
   */
  function splitPoint(point, isInline) {
      // find splitRoot, container
      //  - inline: splitRoot is a child of paragraph
      //  - block: splitRoot is a child of bodyContainer
      var pred = isInline ? isPara : isBodyContainer;
      var ancestors = listAncestor(point.node, pred);
      var topAncestor = lists.last(ancestors) || point.node;
      var splitRoot, container;
      if (pred(topAncestor)) {
          splitRoot = ancestors[ancestors.length - 2];
          container = topAncestor;
      }
      else {
          splitRoot = topAncestor;
          container = splitRoot.parentNode;
      }
      // if splitRoot is exists, split with splitTree
      var pivot = splitRoot && splitTree(splitRoot, point, {
          isSkipPaddingBlankHTML: isInline,
          isNotSplitEdgePoint: isInline
      });
      // if container is point.node, find pivot with point.offset
      if (!pivot && container === point.node) {
          pivot = point.node.childNodes[point.offset];
      }
      return {
          rightNode: pivot,
          container: container
      };
  }
  function create(nodeName) {
      return document.createElement(nodeName);
  }
  function createText(text) {
      return document.createTextNode(text);
  }
  /**
   * @method remove
   *
   * remove node, (isRemoveChild: remove child or not)
   *
   * @param {Node} node
   * @param {Boolean} isRemoveChild
   */
  function remove(node, isRemoveChild) {
      if (!node || !node.parentNode) {
          return;
      }
      if (node.removeNode) {
          return node.removeNode(isRemoveChild);
      }
      var parent = node.parentNode;
      if (!isRemoveChild) {
          var nodes = [];
          for (var i = 0, len = node.childNodes.length; i < len; i++) {
              nodes.push(node.childNodes[i]);
          }
          for (var i = 0, len = nodes.length; i < len; i++) {
              parent.insertBefore(nodes[i], node);
          }
      }
      parent.removeChild(node);
  }
  /**
   * @method removeWhile
   *
   * @param {Node} node
   * @param {Function} pred
   */
  function removeWhile(node, pred) {
      while (node) {
          if (isEditable(node) || !pred(node)) {
              break;
          }
          var parent = node.parentNode;
          remove(node);
          node = parent;
      }
  }
  /**
   * @method replace
   *
   * replace node with provided nodeName
   *
   * @param {Node} node
   * @param {String} nodeName
   * @return {Node} - new node
   */
  function replace(node, nodeName) {
      if (node.nodeName.toUpperCase() === nodeName.toUpperCase()) {
          return node;
      }
      var newNode = create(nodeName);
      if (node.style.cssText) {
          newNode.style.cssText = node.style.cssText;
      }
      appendChildNodes(newNode, lists.from(node.childNodes));
      insertAfter(newNode, node);
      remove(node);
      return newNode;
  }
  var isTextarea = makePredByNodeName('TEXTAREA');
  /**
   * @param {jQuery} $node
   * @param {Boolean} [stripLinebreaks] - default: false
   */
  function value($node, stripLinebreaks) {
      var val = isTextarea($node[0]) ? $node.val() : $node.html();
      if (stripLinebreaks) {
          return val.replace(/[\n\r]/g, '');
      }
      return val;
  }
  /**
   * @method html
   *
   * get the HTML contents of node
   *
   * @param {jQuery} $node
   * @param {Boolean} [isNewlineOnBlock]
   */
  function html($node, isNewlineOnBlock) {
      var markup = value($node);
      if (isNewlineOnBlock) {
          var regexTag = /<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g;
          markup = markup.replace(regexTag, function (match, endSlash, name) {
              name = name.toUpperCase();
              var isEndOfInlineContainer = /^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(name) &&
                  !!endSlash;
              var isBlockNode = /^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name);
              return match + ((isEndOfInlineContainer || isBlockNode) ? '\n' : '');
          });
          markup = markup.trim();
      }
      return markup;
  }
  function posFromPlaceholder(placeholder) {
      var $placeholder = $$1(placeholder);
      var pos = $placeholder.offset();
      var height = $placeholder.outerHeight(true); // include margin
      return {
          left: pos.left,
          top: pos.top + height
      };
  }
  function attachEvents($node, events) {
      Object.keys(events).forEach(function (key) {
          $node.on(key, events[key]);
      });
  }
  function detachEvents($node, events) {
      Object.keys(events).forEach(function (key) {
          $node.off(key, events[key]);
      });
  }
  /**
   * @method isCustomStyleTag
   *
   * assert if a node contains a "note-styletag" class,
   * which implies that's a custom-made style tag node
   *
   * @param {Node} an HTML DOM node
   */
  function isCustomStyleTag(node) {
      return node && !isText(node) && lists.contains(node.classList, 'note-styletag');
  }
  var dom = {
      /** @property {String} NBSP_CHAR */
      NBSP_CHAR: NBSP_CHAR,
      /** @property {String} ZERO_WIDTH_NBSP_CHAR */
      ZERO_WIDTH_NBSP_CHAR: ZERO_WIDTH_NBSP_CHAR,
      /** @property {String} blank */
      blank: blankHTML,
      /** @property {String} emptyPara */
      emptyPara: "<p>" + blankHTML + "</p>",
      makePredByNodeName: makePredByNodeName,
      isEditable: isEditable,
      isControlSizing: isControlSizing,
      isText: isText,
      isElement: isElement,
      isVoid: isVoid,
      isPara: isPara,
      isPurePara: isPurePara,
      isHeading: isHeading,
      isInline: isInline,
      isBlock: func.not(isInline),
      isBodyInline: isBodyInline,
      isBody: isBody,
      isParaInline: isParaInline,
      isPre: isPre,
      isList: isList,
      isTable: isTable,
      isData: isData,
      isCell: isCell,
      isBlockquote: isBlockquote,
      isBodyContainer: isBodyContainer,
      isAnchor: isAnchor,
      isDiv: makePredByNodeName('DIV'),
      isLi: isLi,
      isBR: makePredByNodeName('BR'),
      isSpan: makePredByNodeName('SPAN'),
      isB: makePredByNodeName('B'),
      isU: makePredByNodeName('U'),
      isS: makePredByNodeName('S'),
      isI: makePredByNodeName('I'),
      isImg: makePredByNodeName('IMG'),
      isTextarea: isTextarea,
      isEmpty: isEmpty$1,
      isEmptyAnchor: func.and(isAnchor, isEmpty$1),
      isClosestSibling: isClosestSibling,
      withClosestSiblings: withClosestSiblings,
      nodeLength: nodeLength,
      isLeftEdgePoint: isLeftEdgePoint,
      isRightEdgePoint: isRightEdgePoint,
      isEdgePoint: isEdgePoint,
      isLeftEdgeOf: isLeftEdgeOf,
      isRightEdgeOf: isRightEdgeOf,
      isLeftEdgePointOf: isLeftEdgePointOf,
      isRightEdgePointOf: isRightEdgePointOf,
      prevPoint: prevPoint,
      nextPoint: nextPoint,
      isSamePoint: isSamePoint,
      isVisiblePoint: isVisiblePoint,
      prevPointUntil: prevPointUntil,
      nextPointUntil: nextPointUntil,
      isCharPoint: isCharPoint,
      walkPoint: walkPoint,
      ancestor: ancestor,
      singleChildAncestor: singleChildAncestor,
      listAncestor: listAncestor,
      lastAncestor: lastAncestor,
      listNext: listNext,
      listPrev: listPrev,
      listDescendant: listDescendant,
      commonAncestor: commonAncestor,
      wrap: wrap,
      insertAfter: insertAfter,
      appendChildNodes: appendChildNodes,
      position: position,
      hasChildren: hasChildren,
      makeOffsetPath: makeOffsetPath,
      fromOffsetPath: fromOffsetPath,
      splitTree: splitTree,
      splitPoint: splitPoint,
      create: create,
      createText: createText,
      remove: remove,
      removeWhile: removeWhile,
      replace: replace,
      html: html,
      value: value,
      posFromPlaceholder: posFromPlaceholder,
      attachEvents: attachEvents,
      detachEvents: detachEvents,
      isCustomStyleTag: isCustomStyleTag
  };

  var Context = /** @class */ (function () {
      /**
       * @param {jQuery} $note
       * @param {Object} options
       */
      function Context($note, options) {
          this.ui = $$1.summernote.ui;
          this.$note = $note;
          this.memos = {};
          this.modules = {};
          this.layoutInfo = {};
          this.options = options;
          this.initialize();
      }
      /**
       * create layout and initialize modules and other resources
       */
      Context.prototype.initialize = function () {
          this.layoutInfo = this.ui.createLayout(this.$note, this.options);
          this._initialize();
          this.$note.hide();
          return this;
      };
      /**
       * destroy modules and other resources and remove layout
       */
      Context.prototype.destroy = function () {
          this._destroy();
          this.$note.removeData('summernote');
          this.ui.removeLayout(this.$note, this.layoutInfo);
      };
      /**
       * destory modules and other resources and initialize it again
       */
      Context.prototype.reset = function () {
          var disabled = this.isDisabled();
          this.code(dom.emptyPara);
          this._destroy();
          this._initialize();
          if (disabled) {
              this.disable();
          }
      };
      Context.prototype._initialize = function () {
          var _this = this;
          // add optional buttons
          var buttons = $$1.extend({}, this.options.buttons);
          Object.keys(buttons).forEach(function (key) {
              _this.memo('button.' + key, buttons[key]);
          });
          var modules = $$1.extend({}, this.options.modules, $$1.summernote.plugins || {});
          // add and initialize modules
          Object.keys(modules).forEach(function (key) {
              _this.module(key, modules[key], true);
          });
          Object.keys(this.modules).forEach(function (key) {
              _this.initializeModule(key);
          });
      };
      Context.prototype._destroy = function () {
          var _this = this;
          // destroy modules with reversed order
          Object.keys(this.modules).reverse().forEach(function (key) {
              _this.removeModule(key);
          });
          Object.keys(this.memos).forEach(function (key) {
              _this.removeMemo(key);
          });
          // trigger custom onDestroy callback
          this.triggerEvent('destroy', this);
      };
      Context.prototype.code = function (html) {
          var isActivated = this.invoke('codeview.isActivated');
          if (html === undefined) {
              this.invoke('codeview.sync');
              return isActivated ? this.layoutInfo.codable.val() : this.layoutInfo.editable.html();
          }
          else {
              if (isActivated) {
                  this.layoutInfo.codable.val(html);
              }
              else {
                  this.layoutInfo.editable.html(html);
              }
              this.$note.val(html);
              this.triggerEvent('change', html, this.layoutInfo.editable);
          }
      };
      Context.prototype.isDisabled = function () {
          return this.layoutInfo.editable.attr('contenteditable') === 'false';
      };
      Context.prototype.enable = function () {
          this.layoutInfo.editable.attr('contenteditable', true);
          this.invoke('toolbar.activate', true);
          this.triggerEvent('disable', false);
      };
      Context.prototype.disable = function () {
          // close codeview if codeview is opend
          if (this.invoke('codeview.isActivated')) {
              this.invoke('codeview.deactivate');
          }
          this.layoutInfo.editable.attr('contenteditable', false);
          this.invoke('toolbar.deactivate', true);
          this.triggerEvent('disable', true);
      };
      Context.prototype.triggerEvent = function () {
          var namespace = lists.head(arguments);
          var args = lists.tail(lists.from(arguments));
          var callback = this.options.callbacks[func.namespaceToCamel(namespace, 'on')];
          if (callback) {
              callback.apply(this.$note[0], args);
          }
          this.$note.trigger('summernote.' + namespace, args);
      };
      Context.prototype.initializeModule = function (key) {
          var module = this.modules[key];
          module.shouldInitialize = module.shouldInitialize || func.ok;
          if (!module.shouldInitialize()) {
              return;
          }
          // initialize module
          if (module.initialize) {
              module.initialize();
          }
          // attach events
          if (module.events) {
              dom.attachEvents(this.$note, module.events);
          }
      };
      Context.prototype.module = function (key, ModuleClass, withoutIntialize) {
          if (arguments.length === 1) {
              return this.modules[key];
          }
          this.modules[key] = new ModuleClass(this);
          if (!withoutIntialize) {
              this.initializeModule(key);
          }
      };
      Context.prototype.removeModule = function (key) {
          var module = this.modules[key];
          if (module.shouldInitialize()) {
              if (module.events) {
                  dom.detachEvents(this.$note, module.events);
              }
              if (module.destroy) {
                  module.destroy();
              }
          }
          delete this.modules[key];
      };
      Context.prototype.memo = function (key, obj) {
          if (arguments.length === 1) {
              return this.memos[key];
          }
          this.memos[key] = obj;
      };
      Context.prototype.removeMemo = function (key) {
          if (this.memos[key] && this.memos[key].destroy) {
              this.memos[key].destroy();
          }
          delete this.memos[key];
      };
      /**
       * Some buttons need to change their visual style immediately once they get pressed
       */
      Context.prototype.createInvokeHandlerAndUpdateState = function (namespace, value) {
          var _this = this;
          return function (event) {
              _this.createInvokeHandler(namespace, value)(event);
              _this.invoke('buttons.updateCurrentStyle');
          };
      };
      Context.prototype.createInvokeHandler = function (namespace, value) {
          var _this = this;
          return function (event) {
              event.preventDefault();
              var $target = $$1(event.target);
              _this.invoke(namespace, value || $target.closest('[data-value]').data('value'), $target);
          };
      };
      Context.prototype.invoke = function () {
          var namespace = lists.head(arguments);
          var args = lists.tail(lists.from(arguments));
          var splits = namespace.split('.');
          var hasSeparator = splits.length > 1;
          var moduleName = hasSeparator && lists.head(splits);
          var methodName = hasSeparator ? lists.last(splits) : lists.head(splits);
          var module = this.modules[moduleName || 'editor'];
          if (!moduleName && this[methodName]) {
              return this[methodName].apply(this, args);
          }
          else if (module && module[methodName] && module.shouldInitialize()) {
              return module[methodName].apply(module, args);
          }
      };
      return Context;
  }());

  $$1.fn.extend({
      /**
       * Summernote API
       *
       * @param {Object|String}
       * @return {this}
       */
      summernote: function () {
          var type = $$1.type(lists.head(arguments));
          var isExternalAPICalled = type === 'string';
          var hasInitOptions = type === 'object';
          var options = $$1.extend({}, $$1.summernote.options, hasInitOptions ? lists.head(arguments) : {});
          // Update options
          options.langInfo = $$1.extend(true, {}, $$1.summernote.lang['en-US'], $$1.summernote.lang[options.lang]);
          options.icons = $$1.extend(true, {}, $$1.summernote.options.icons, options.icons);
          options.tooltip = options.tooltip === 'auto' ? !env.isSupportTouch : options.tooltip;
          this.each(function (idx, note) {
              var $note = $$1(note);
              if (!$note.data('summernote')) {
                  var context = new Context($note, options);
                  $note.data('summernote', context);
                  $note.data('summernote').triggerEvent('init', context.layoutInfo);
              }
          });
          var $note = this.first();
          if ($note.length) {
              var context = $note.data('summernote');
              if (isExternalAPICalled) {
                  return context.invoke.apply(context, lists.from(arguments));
              }
              else if (options.focus) {
                  context.invoke('editor.focus');
              }
          }
          return this;
      }
  });

  /**
   * return boundaryPoint from TextRange, inspired by Andy Na's HuskyRange.js
   *
   * @param {TextRange} textRange
   * @param {Boolean} isStart
   * @return {BoundaryPoint}
   *
   * @see http://msdn.microsoft.com/en-us/library/ie/ms535872(v=vs.85).aspx
   */
  function textRangeToPoint(textRange, isStart) {
      var container = textRange.parentElement();
      var offset;
      var tester = document.body.createTextRange();
      var prevContainer;
      var childNodes = lists.from(container.childNodes);
      for (offset = 0; offset < childNodes.length; offset++) {
          if (dom.isText(childNodes[offset])) {
              continue;
          }
          tester.moveToElementText(childNodes[offset]);
          if (tester.compareEndPoints('StartToStart', textRange) >= 0) {
              break;
          }
          prevContainer = childNodes[offset];
      }
      if (offset !== 0 && dom.isText(childNodes[offset - 1])) {
          var textRangeStart = document.body.createTextRange();
          var curTextNode = null;
          textRangeStart.moveToElementText(prevContainer || container);
          textRangeStart.collapse(!prevContainer);
          curTextNode = prevContainer ? prevContainer.nextSibling : container.firstChild;
          var pointTester = textRange.duplicate();
          pointTester.setEndPoint('StartToStart', textRangeStart);
          var textCount = pointTester.text.replace(/[\r\n]/g, '').length;
          while (textCount > curTextNode.nodeValue.length && curTextNode.nextSibling) {
              textCount -= curTextNode.nodeValue.length;
              curTextNode = curTextNode.nextSibling;
          }
          // [workaround] enforce IE to re-reference curTextNode, hack
          var dummy = curTextNode.nodeValue; // eslint-disable-line
          if (isStart && curTextNode.nextSibling && dom.isText(curTextNode.nextSibling) &&
              textCount === curTextNode.nodeValue.length) {
              textCount -= curTextNode.nodeValue.length;
              curTextNode = curTextNode.nextSibling;
          }
          container = curTextNode;
          offset = textCount;
      }
      return {
          cont: container,
          offset: offset
      };
  }
  /**
   * return TextRange from boundary point (inspired by google closure-library)
   * @param {BoundaryPoint} point
   * @return {TextRange}
   */
  function pointToTextRange(point) {
      var textRangeInfo = function (container, offset) {
          var node, isCollapseToStart;
          if (dom.isText(container)) {
              var prevTextNodes = dom.listPrev(container, func.not(dom.isText));
              var prevContainer = lists.last(prevTextNodes).previousSibling;
              node = prevContainer || container.parentNode;
              offset += lists.sum(lists.tail(prevTextNodes), dom.nodeLength);
              isCollapseToStart = !prevContainer;
          }
          else {
              node = container.childNodes[offset] || container;
              if (dom.isText(node)) {
                  return textRangeInfo(node, 0);
              }
              offset = 0;
              isCollapseToStart = false;
          }
          return {
              node: node,
              collapseToStart: isCollapseToStart,
              offset: offset
          };
      };
      var textRange = document.body.createTextRange();
      var info = textRangeInfo(point.node, point.offset);
      textRange.moveToElementText(info.node);
      textRange.collapse(info.collapseToStart);
      textRange.moveStart('character', info.offset);
      return textRange;
  }
  /**
     * Wrapped Range
     *
     * @constructor
     * @param {Node} sc - start container
     * @param {Number} so - start offset
     * @param {Node} ec - end container
     * @param {Number} eo - end offset
     */
  var WrappedRange = /** @class */ (function () {
      function WrappedRange(sc, so, ec, eo) {
          this.sc = sc;
          this.so = so;
          this.ec = ec;
          this.eo = eo;
          // isOnEditable: judge whether range is on editable or not
          this.isOnEditable = this.makeIsOn(dom.isEditable);
          // isOnList: judge whether range is on list node or not
          this.isOnList = this.makeIsOn(dom.isList);
          // isOnAnchor: judge whether range is on anchor node or not
          this.isOnAnchor = this.makeIsOn(dom.isAnchor);
          // isOnCell: judge whether range is on cell node or not
          this.isOnCell = this.makeIsOn(dom.isCell);
          // isOnData: judge whether range is on data node or not
          this.isOnData = this.makeIsOn(dom.isData);
      }
      // nativeRange: get nativeRange from sc, so, ec, eo
      WrappedRange.prototype.nativeRange = function () {
          if (env.isW3CRangeSupport) {
              var w3cRange = document.createRange();
              w3cRange.setStart(this.sc, this.sc.data && this.so > this.sc.data.length ? 0 : this.so);
              w3cRange.setEnd(this.ec, this.sc.data ? Math.min(this.eo, this.sc.data.length) : this.eo);
              return w3cRange;
          }
          else {
              var textRange = pointToTextRange({
                  node: this.sc,
                  offset: this.so
              });
              textRange.setEndPoint('EndToEnd', pointToTextRange({
                  node: this.ec,
                  offset: this.eo
              }));
              return textRange;
          }
      };
      WrappedRange.prototype.getPoints = function () {
          return {
              sc: this.sc,
              so: this.so,
              ec: this.ec,
              eo: this.eo
          };
      };
      WrappedRange.prototype.getStartPoint = function () {
          return {
              node: this.sc,
              offset: this.so
          };
      };
      WrappedRange.prototype.getEndPoint = function () {
          return {
              node: this.ec,
              offset: this.eo
          };
      };
      /**
       * select update visible range
       */
      WrappedRange.prototype.select = function () {
          var nativeRng = this.nativeRange();
          if (env.isW3CRangeSupport) {
              var selection = document.getSelection();
              if (selection.rangeCount > 0) {
                  selection.removeAllRanges();
              }
              selection.addRange(nativeRng);
          }
          else {
              nativeRng.select();
          }
          return this;
      };
      /**
       * Moves the scrollbar to start container(sc) of current range
       *
       * @return {WrappedRange}
       */
      WrappedRange.prototype.scrollIntoView = function (container) {
          var height = $$1(container).height();
          if (container.scrollTop + height < this.sc.offsetTop) {
              container.scrollTop += Math.abs(container.scrollTop + height - this.sc.offsetTop);
          }
          return this;
      };
      /**
       * @return {WrappedRange}
       */
      WrappedRange.prototype.normalize = function () {
          /**
           * @param {BoundaryPoint} point
           * @param {Boolean} isLeftToRight - true: prefer to choose right node
           *                                - false: prefer to choose left node
           * @return {BoundaryPoint}
           */
          var getVisiblePoint = function (point, isLeftToRight) {
              // Just use the given point [XXX:Adhoc]
              //  - case 01. if the point is on the middle of the node
              //  - case 02. if the point is on the right edge and prefer to choose left node
              //  - case 03. if the point is on the left edge and prefer to choose right node
              //  - case 04. if the point is on the right edge and prefer to choose right node but the node is void
              //  - case 05. if the point is on the left edge and prefer to choose left node but the node is void
              //  - case 06. if the point is on the block node and there is no children
              if (dom.isVisiblePoint(point)) {
                  if (!dom.isEdgePoint(point) ||
                      (dom.isRightEdgePoint(point) && !isLeftToRight) ||
                      (dom.isLeftEdgePoint(point) && isLeftToRight) ||
                      (dom.isRightEdgePoint(point) && isLeftToRight && dom.isVoid(point.node.nextSibling)) ||
                      (dom.isLeftEdgePoint(point) && !isLeftToRight && dom.isVoid(point.node.previousSibling)) ||
                      (dom.isBlock(point.node) && dom.isEmpty(point.node))) {
                      return point;
                  }
              }
              // point on block's edge
              var block = dom.ancestor(point.node, dom.isBlock);
              if (((dom.isLeftEdgePointOf(point, block) || dom.isVoid(dom.prevPoint(point).node)) && !isLeftToRight) ||
                  ((dom.isRightEdgePointOf(point, block) || dom.isVoid(dom.nextPoint(point).node)) && isLeftToRight)) {
                  // returns point already on visible point
                  if (dom.isVisiblePoint(point)) {
                      return point;
                  }
                  // reverse direction
                  isLeftToRight = !isLeftToRight;
              }
              var nextPoint = isLeftToRight ? dom.nextPointUntil(dom.nextPoint(point), dom.isVisiblePoint)
                  : dom.prevPointUntil(dom.prevPoint(point), dom.isVisiblePoint);
              return nextPoint || point;
          };
          var endPoint = getVisiblePoint(this.getEndPoint(), false);
          var startPoint = this.isCollapsed() ? endPoint : getVisiblePoint(this.getStartPoint(), true);
          return new WrappedRange(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset);
      };
      /**
       * returns matched nodes on range
       *
       * @param {Function} [pred] - predicate function
       * @param {Object} [options]
       * @param {Boolean} [options.includeAncestor]
       * @param {Boolean} [options.fullyContains]
       * @return {Node[]}
       */
      WrappedRange.prototype.nodes = function (pred, options) {
          pred = pred || func.ok;
          var includeAncestor = options && options.includeAncestor;
          var fullyContains = options && options.fullyContains;
          // TODO compare points and sort
          var startPoint = this.getStartPoint();
          var endPoint = this.getEndPoint();
          var nodes = [];
          var leftEdgeNodes = [];
          dom.walkPoint(startPoint, endPoint, function (point) {
              if (dom.isEditable(point.node)) {
                  return;
              }
              var node;
              if (fullyContains) {
                  if (dom.isLeftEdgePoint(point)) {
                      leftEdgeNodes.push(point.node);
                  }
                  if (dom.isRightEdgePoint(point) && lists.contains(leftEdgeNodes, point.node)) {
                      node = point.node;
                  }
              }
              else if (includeAncestor) {
                  node = dom.ancestor(point.node, pred);
              }
              else {
                  node = point.node;
              }
              if (node && pred(node)) {
                  nodes.push(node);
              }
          }, true);
          return lists.unique(nodes);
      };
      /**
       * returns commonAncestor of range
       * @return {Element} - commonAncestor
       */
      WrappedRange.prototype.commonAncestor = function () {
          return dom.commonAncestor(this.sc, this.ec);
      };
      /**
       * returns expanded range by pred
       *
       * @param {Function} pred - predicate function
       * @return {WrappedRange}
       */
      WrappedRange.prototype.expand = function (pred) {
          var startAncestor = dom.ancestor(this.sc, pred);
          var endAncestor = dom.ancestor(this.ec, pred);
          if (!startAncestor && !endAncestor) {
              return new WrappedRange(this.sc, this.so, this.ec, this.eo);
          }
          var boundaryPoints = this.getPoints();
          if (startAncestor) {
              boundaryPoints.sc = startAncestor;
              boundaryPoints.so = 0;
          }
          if (endAncestor) {
              boundaryPoints.ec = endAncestor;
              boundaryPoints.eo = dom.nodeLength(endAncestor);
          }
          return new WrappedRange(boundaryPoints.sc, boundaryPoints.so, boundaryPoints.ec, boundaryPoints.eo);
      };
      /**
       * @param {Boolean} isCollapseToStart
       * @return {WrappedRange}
       */
      WrappedRange.prototype.collapse = function (isCollapseToStart) {
          if (isCollapseToStart) {
              return new WrappedRange(this.sc, this.so, this.sc, this.so);
          }
          else {
              return new WrappedRange(this.ec, this.eo, this.ec, this.eo);
          }
      };
      /**
       * splitText on range
       */
      WrappedRange.prototype.splitText = function () {
          var isSameContainer = this.sc === this.ec;
          var boundaryPoints = this.getPoints();
          if (dom.isText(this.ec) && !dom.isEdgePoint(this.getEndPoint())) {
              this.ec.splitText(this.eo);
          }
          if (dom.isText(this.sc) && !dom.isEdgePoint(this.getStartPoint())) {
              boundaryPoints.sc = this.sc.splitText(this.so);
              boundaryPoints.so = 0;
              if (isSameContainer) {
                  boundaryPoints.ec = boundaryPoints.sc;
                  boundaryPoints.eo = this.eo - this.so;
              }
          }
          return new WrappedRange(boundaryPoints.sc, boundaryPoints.so, boundaryPoints.ec, boundaryPoints.eo);
      };
      /**
       * delete contents on range
       * @return {WrappedRange}
       */
      WrappedRange.prototype.deleteContents = function () {
          if (this.isCollapsed()) {
              return this;
          }
          var rng = this.splitText();
          var nodes = rng.nodes(null, {
              fullyContains: true
          });
          // find new cursor point
          var point = dom.prevPointUntil(rng.getStartPoint(), function (point) {
              return !lists.contains(nodes, point.node);
          });
          var emptyParents = [];
          $$1.each(nodes, function (idx, node) {
              // find empty parents
              var parent = node.parentNode;
              if (point.node !== parent && dom.nodeLength(parent) === 1) {
                  emptyParents.push(parent);
              }
              dom.remove(node, false);
          });
          // remove empty parents
          $$1.each(emptyParents, function (idx, node) {
              dom.remove(node, false);
          });
          return new WrappedRange(point.node, point.offset, point.node, point.offset).normalize();
      };
      /**
       * makeIsOn: return isOn(pred) function
       */
      WrappedRange.prototype.makeIsOn = function (pred) {
          return function () {
              var ancestor = dom.ancestor(this.sc, pred);
              return !!ancestor && (ancestor === dom.ancestor(this.ec, pred));
          };
      };
      /**
       * @param {Function} pred
       * @return {Boolean}
       */
      WrappedRange.prototype.isLeftEdgeOf = function (pred) {
          if (!dom.isLeftEdgePoint(this.getStartPoint())) {
              return false;
          }
          var node = dom.ancestor(this.sc, pred);
          return node && dom.isLeftEdgeOf(this.sc, node);
      };
      /**
       * returns whether range was collapsed or not
       */
      WrappedRange.prototype.isCollapsed = function () {
          return this.sc === this.ec && this.so === this.eo;
      };
      /**
       * wrap inline nodes which children of body with paragraph
       *
       * @return {WrappedRange}
       */
      WrappedRange.prototype.wrapBodyInlineWithPara = function () {
          if (dom.isBodyContainer(this.sc) && dom.isEmpty(this.sc)) {
              this.sc.innerHTML = dom.emptyPara;
              return new WrappedRange(this.sc.firstChild, 0, this.sc.firstChild, 0);
          }
          /**
           * [workaround] firefox often create range on not visible point. so normalize here.
           *  - firefox: |<p>text</p>|
           *  - chrome: <p>|text|</p>
           */
          var rng = this.normalize();
          if (dom.isParaInline(this.sc) || dom.isPara(this.sc)) {
              return rng;
          }
          // find inline top ancestor
          var topAncestor;
          if (dom.isInline(rng.sc)) {
              var ancestors = dom.listAncestor(rng.sc, func.not(dom.isInline));
              topAncestor = lists.last(ancestors);
              if (!dom.isInline(topAncestor)) {
                  topAncestor = ancestors[ancestors.length - 2] || rng.sc.childNodes[rng.so];
              }
          }
          else {
              topAncestor = rng.sc.childNodes[rng.so > 0 ? rng.so - 1 : 0];
          }
          // siblings not in paragraph
          var inlineSiblings = dom.listPrev(topAncestor, dom.isParaInline).reverse();
          inlineSiblings = inlineSiblings.concat(dom.listNext(topAncestor.nextSibling, dom.isParaInline));
          // wrap with paragraph
          if (inlineSiblings.length) {
              var para = dom.wrap(lists.head(inlineSiblings), 'p');
              dom.appendChildNodes(para, lists.tail(inlineSiblings));
          }
          return this.normalize();
      };
      /**
       * insert node at current cursor
       *
       * @param {Node} node
       * @return {Node}
       */
      WrappedRange.prototype.insertNode = function (node) {
          var rng = this.wrapBodyInlineWithPara().deleteContents();
          var info = dom.splitPoint(rng.getStartPoint(), dom.isInline(node));
          if (info.rightNode) {
              info.rightNode.parentNode.insertBefore(node, info.rightNode);
          }
          else {
              info.container.appendChild(node);
          }
          return node;
      };
      /**
       * insert html at current cursor
       */
      WrappedRange.prototype.pasteHTML = function (markup) {
          var contentsContainer = $$1('<div></div>').html(markup)[0];
          var childNodes = lists.from(contentsContainer.childNodes);
          var rng = this.wrapBodyInlineWithPara().deleteContents();
          if (rng.so > 0) {
              childNodes = childNodes.reverse();
          }
          childNodes = childNodes.map(function (childNode) {
              return rng.insertNode(childNode);
          });
          if (rng.so > 0) {
              childNodes = childNodes.reverse();
          }
          return childNodes;
      };
      /**
       * returns text in range
       *
       * @return {String}
       */
      WrappedRange.prototype.toString = function () {
          var nativeRng = this.nativeRange();
          return env.isW3CRangeSupport ? nativeRng.toString() : nativeRng.text;
      };
      /**
       * returns range for word before cursor
       *
       * @param {Boolean} [findAfter] - find after cursor, default: false
       * @return {WrappedRange}
       */
      WrappedRange.prototype.getWordRange = function (findAfter) {
          var endPoint = this.getEndPoint();
          if (!dom.isCharPoint(endPoint)) {
              return this;
          }
          var startPoint = dom.prevPointUntil(endPoint, function (point) {
              return !dom.isCharPoint(point);
          });
          if (findAfter) {
              endPoint = dom.nextPointUntil(endPoint, function (point) {
                  return !dom.isCharPoint(point);
              });
          }
          return new WrappedRange(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset);
      };
      /**
       * create offsetPath bookmark
       *
       * @param {Node} editable
       */
      WrappedRange.prototype.bookmark = function (editable) {
          return {
              s: {
                  path: dom.makeOffsetPath(editable, this.sc),
                  offset: this.so
              },
              e: {
                  path: dom.makeOffsetPath(editable, this.ec),
                  offset: this.eo
              }
          };
      };
      /**
       * create offsetPath bookmark base on paragraph
       *
       * @param {Node[]} paras
       */
      WrappedRange.prototype.paraBookmark = function (paras) {
          return {
              s: {
                  path: lists.tail(dom.makeOffsetPath(lists.head(paras), this.sc)),
                  offset: this.so
              },
              e: {
                  path: lists.tail(dom.makeOffsetPath(lists.last(paras), this.ec)),
                  offset: this.eo
              }
          };
      };
      /**
       * getClientRects
       * @return {Rect[]}
       */
      WrappedRange.prototype.getClientRects = function () {
          var nativeRng = this.nativeRange();
          return nativeRng.getClientRects();
      };
      return WrappedRange;
  }());
  /**
   * Data structure
   *  * BoundaryPoint: a point of dom tree
   *  * BoundaryPoints: two boundaryPoints corresponding to the start and the end of the Range
   *
   * See to http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Position
   */
  var range = {
      /**
       * create Range Object From arguments or Browser Selection
       *
       * @param {Node} sc - start container
       * @param {Number} so - start offset
       * @param {Node} ec - end container
       * @param {Number} eo - end offset
       * @return {WrappedRange}
       */
      create: function (sc, so, ec, eo) {
          if (arguments.length === 4) {
              return new WrappedRange(sc, so, ec, eo);
          }
          else if (arguments.length === 2) { // collapsed
              ec = sc;
              eo = so;
              return new WrappedRange(sc, so, ec, eo);
          }
          else {
              var wrappedRange = this.createFromSelection();
              if (!wrappedRange && arguments.length === 1) {
                  wrappedRange = this.createFromNode(arguments[0]);
                  return wrappedRange.collapse(dom.emptyPara === arguments[0].innerHTML);
              }
              return wrappedRange;
          }
      },
      createFromSelection: function () {
          var sc, so, ec, eo;
          if (env.isW3CRangeSupport) {
              var selection = document.getSelection();
              if (!selection || selection.rangeCount === 0) {
                  return null;
              }
              else if (dom.isBody(selection.anchorNode)) {
                  // Firefox: returns entire body as range on initialization.
                  // We won't never need it.
                  return null;
              }
              var nativeRng = selection.getRangeAt(0);
              sc = nativeRng.startContainer;
              so = nativeRng.startOffset;
              ec = nativeRng.endContainer;
              eo = nativeRng.endOffset;
          }
          else { // IE8: TextRange
              var textRange = document.selection.createRange();
              var textRangeEnd = textRange.duplicate();
              textRangeEnd.collapse(false);
              var textRangeStart = textRange;
              textRangeStart.collapse(true);
              var startPoint = textRangeToPoint(textRangeStart, true);
              var endPoint = textRangeToPoint(textRangeEnd, false);
              // same visible point case: range was collapsed.
              if (dom.isText(startPoint.node) && dom.isLeftEdgePoint(startPoint) &&
                  dom.isTextNode(endPoint.node) && dom.isRightEdgePoint(endPoint) &&
                  endPoint.node.nextSibling === startPoint.node) {
                  startPoint = endPoint;
              }
              sc = startPoint.cont;
              so = startPoint.offset;
              ec = endPoint.cont;
              eo = endPoint.offset;
          }
          return new WrappedRange(sc, so, ec, eo);
      },
      /**
       * @method
       *
       * create WrappedRange from node
       *
       * @param {Node} node
       * @return {WrappedRange}
       */
      createFromNode: function (node) {
          var sc = node;
          var so = 0;
          var ec = node;
          var eo = dom.nodeLength(ec);
          // browsers can't target a picture or void node
          if (dom.isVoid(sc)) {
              so = dom.listPrev(sc).length - 1;
              sc = sc.parentNode;
          }
          if (dom.isBR(ec)) {
              eo = dom.listPrev(ec).length - 1;
              ec = ec.parentNode;
          }
          else if (dom.isVoid(ec)) {
              eo = dom.listPrev(ec).length;
              ec = ec.parentNode;
          }
          return this.create(sc, so, ec, eo);
      },
      /**
       * create WrappedRange from node after position
       *
       * @param {Node} node
       * @return {WrappedRange}
       */
      createFromNodeBefore: function (node) {
          return this.createFromNode(node).collapse(true);
      },
      /**
       * create WrappedRange from node after position
       *
       * @param {Node} node
       * @return {WrappedRange}
       */
      createFromNodeAfter: function (node) {
          return this.createFromNode(node).collapse();
      },
      /**
       * @method
       *
       * create WrappedRange from bookmark
       *
       * @param {Node} editable
       * @param {Object} bookmark
       * @return {WrappedRange}
       */
      createFromBookmark: function (editable, bookmark) {
          var sc = dom.fromOffsetPath(editable, bookmark.s.path);
          var so = bookmark.s.offset;
          var ec = dom.fromOffsetPath(editable, bookmark.e.path);
          var eo = bookmark.e.offset;
          return new WrappedRange(sc, so, ec, eo);
      },
      /**
       * @method
       *
       * create WrappedRange from paraBookmark
       *
       * @param {Object} bookmark
       * @param {Node[]} paras
       * @return {WrappedRange}
       */
      createFromParaBookmark: function (bookmark, paras) {
          var so = bookmark.s.offset;
          var eo = bookmark.e.offset;
          var sc = dom.fromOffsetPath(lists.head(paras), bookmark.s.path);
          var ec = dom.fromOffsetPath(lists.last(paras), bookmark.e.path);
          return new WrappedRange(sc, so, ec, eo);
      }
  };

  var KEY_MAP = {
      'BACKSPACE': 8,
      'TAB': 9,
      'ENTER': 13,
      'SPACE': 32,
      'DELETE': 46,
      // Arrow
      'LEFT': 37,
      'UP': 38,
      'RIGHT': 39,
      'DOWN': 40,
      // Number: 0-9
      'NUM0': 48,
      'NUM1': 49,
      'NUM2': 50,
      'NUM3': 51,
      'NUM4': 52,
      'NUM5': 53,
      'NUM6': 54,
      'NUM7': 55,
      'NUM8': 56,
      // Alphabet: a-z
      'B': 66,
      'E': 69,
      'I': 73,
      'J': 74,
      'K': 75,
      'L': 76,
      'R': 82,
      'S': 83,
      'U': 85,
      'V': 86,
      'Y': 89,
      'Z': 90,
      'SLASH': 191,
      'LEFTBRACKET': 219,
      'BACKSLASH': 220,
      'RIGHTBRACKET': 221
  };
  /**
   * @class core.key
   *
   * Object for keycodes.
   *
   * @singleton
   * @alternateClassName key
   */
  var key = {
      /**
       * @method isEdit
       *
       * @param {Number} keyCode
       * @return {Boolean}
       */
      isEdit: function (keyCode) {
          return lists.contains([
              KEY_MAP.BACKSPACE,
              KEY_MAP.TAB,
              KEY_MAP.ENTER,
              KEY_MAP.SPACE,
              KEY_MAP.DELETE,
          ], keyCode);
      },
      /**
       * @method isMove
       *
       * @param {Number} keyCode
       * @return {Boolean}
       */
      isMove: function (keyCode) {
          return lists.contains([
              KEY_MAP.LEFT,
              KEY_MAP.UP,
              KEY_MAP.RIGHT,
              KEY_MAP.DOWN,
          ], keyCode);
      },
      /**
       * @property {Object} nameFromCode
       * @property {String} nameFromCode.8 "BACKSPACE"
       */
      nameFromCode: func.invertObject(KEY_MAP),
      code: KEY_MAP
  };

  /**
   * @method readFileAsDataURL
   *
   * read contents of file as representing URL
   *
   * @param {File} file
   * @return {Promise} - then: dataUrl
   */
  function readFileAsDataURL(file) {
      return $$1.Deferred(function (deferred) {
          $$1.extend(new FileReader(), {
              onload: function (e) {
                  var dataURL = e.target.result;
                  deferred.resolve(dataURL);
              },
              onerror: function (err) {
                  deferred.reject(err);
              }
          }).readAsDataURL(file);
      }).promise();
  }
  /**
   * @method createImage
   *
   * create `<image>` from url string
   *
   * @param {String} url
   * @return {Promise} - then: $image
   */
  function createImage(url) {
      return $$1.Deferred(function (deferred) {
          var $img = $$1('<img>');
          $img.one('load', function () {
              $img.off('error abort');
              deferred.resolve($img);
          }).one('error abort', function () {
              $img.off('load').detach();
              deferred.reject($img);
          }).css({
              display: 'none'
          }).appendTo(document.body).attr('src', url);
      }).promise();
  }

  var History = /** @class */ (function () {
      function History($editable) {
          this.stack = [];
          this.stackOffset = -1;
          this.$editable = $editable;
          this.editable = $editable[0];
      }
      History.prototype.makeSnapshot = function () {
          var rng = range.create(this.editable);
          var emptyBookmark = { s: { path: [], offset: 0 }, e: { path: [], offset: 0 } };
          return {
              contents: this.$editable.html(),
              bookmark: ((rng && rng.isOnEditable()) ? rng.bookmark(this.editable) : emptyBookmark)
          };
      };
      History.prototype.applySnapshot = function (snapshot) {
          if (snapshot.contents !== null) {
              this.$editable.html(snapshot.contents);
          }
          if (snapshot.bookmark !== null) {
              range.createFromBookmark(this.editable, snapshot.bookmark).select();
          }
      };
      /**
      * @method rewind
      * Rewinds the history stack back to the first snapshot taken.
      * Leaves the stack intact, so that "Redo" can still be used.
      */
      History.prototype.rewind = function () {
          // Create snap shot if not yet recorded
          if (this.$editable.html() !== this.stack[this.stackOffset].contents) {
              this.recordUndo();
          }
          // Return to the first available snapshot.
          this.stackOffset = 0;
          // Apply that snapshot.
          this.applySnapshot(this.stack[this.stackOffset]);
      };
      /**
      *  @method commit
      *  Resets history stack, but keeps current editor's content.
      */
      History.prototype.commit = function () {
          // Clear the stack.
          this.stack = [];
          // Restore stackOffset to its original value.
          this.stackOffset = -1;
          // Record our first snapshot (of nothing).
          this.recordUndo();
      };
      /**
      * @method reset
      * Resets the history stack completely; reverting to an empty editor.
      */
      History.prototype.reset = function () {
          // Clear the stack.
          this.stack = [];
          // Restore stackOffset to its original value.
          this.stackOffset = -1;
          // Clear the editable area.
          this.$editable.html('');
          // Record our first snapshot (of nothing).
          this.recordUndo();
      };
      /**
       * undo
       */
      History.prototype.undo = function () {
          // Create snap shot if not yet recorded
          if (this.$editable.html() !== this.stack[this.stackOffset].contents) {
              this.recordUndo();
          }
          if (this.stackOffset > 0) {
              this.stackOffset--;
              this.applySnapshot(this.stack[this.stackOffset]);
          }
      };
      /**
       * redo
       */
      History.prototype.redo = function () {
          if (this.stack.length - 1 > this.stackOffset) {
              this.stackOffset++;
              this.applySnapshot(this.stack[this.stackOffset]);
          }
      };
      /**
       * recorded undo
       */
      History.prototype.recordUndo = function () {
          this.stackOffset++;
          // Wash out stack after stackOffset
          if (this.stack.length > this.stackOffset) {
              this.stack = this.stack.slice(0, this.stackOffset);
          }
          // Create new snapshot and push it to the end
          this.stack.push(this.makeSnapshot());
      };
      return History;
  }());

  var Style = /** @class */ (function () {
      function Style() {
      }
      /**
       * @method jQueryCSS
       *
       * [workaround] for old jQuery
       * passing an array of style properties to .css()
       * will result in an object of property-value pairs.
       * (compability with version < 1.9)
       *
       * @private
       * @param  {jQuery} $obj
       * @param  {Array} propertyNames - An array of one or more CSS properties.
       * @return {Object}
       */
      Style.prototype.jQueryCSS = function ($obj, propertyNames) {
          if (env.jqueryVersion < 1.9) {
              var result_1 = {};
              $$1.each(propertyNames, function (idx, propertyName) {
                  result_1[propertyName] = $obj.css(propertyName);
              });
              return result_1;
          }
          return $obj.css(propertyNames);
      };
      /**
       * returns style object from node
       *
       * @param {jQuery} $node
       * @return {Object}
       */
      Style.prototype.fromNode = function ($node) {
          var properties = ['font-family', 'font-size', 'text-align', 'list-style-type', 'line-height'];
          var styleInfo = this.jQueryCSS($node, properties) || {};
          styleInfo['font-size'] = parseInt(styleInfo['font-size'], 10);
          return styleInfo;
      };
      /**
       * paragraph level style
       *
       * @param {WrappedRange} rng
       * @param {Object} styleInfo
       */
      Style.prototype.stylePara = function (rng, styleInfo) {
          $$1.each(rng.nodes(dom.isPara, {
              includeAncestor: true
          }), function (idx, para) {
              $$1(para).css(styleInfo);
          });
      };
      /**
       * insert and returns styleNodes on range.
       *
       * @param {WrappedRange} rng
       * @param {Object} [options] - options for styleNodes
       * @param {String} [options.nodeName] - default: `SPAN`
       * @param {Boolean} [options.expandClosestSibling] - default: `false`
       * @param {Boolean} [options.onlyPartialContains] - default: `false`
       * @return {Node[]}
       */
      Style.prototype.styleNodes = function (rng, options) {
          rng = rng.splitText();
          var nodeName = (options && options.nodeName) || 'SPAN';
          var expandClosestSibling = !!(options && options.expandClosestSibling);
          var onlyPartialContains = !!(options && options.onlyPartialContains);
          if (rng.isCollapsed()) {
              return [rng.insertNode(dom.create(nodeName))];
          }
          var pred = dom.makePredByNodeName(nodeName);
          var nodes = rng.nodes(dom.isText, {
              fullyContains: true
          }).map(function (text) {
              return dom.singleChildAncestor(text, pred) || dom.wrap(text, nodeName);
          });
          if (expandClosestSibling) {
              if (onlyPartialContains) {
                  var nodesInRange_1 = rng.nodes();
                  // compose with partial contains predication
                  pred = func.and(pred, function (node) {
                      return lists.contains(nodesInRange_1, node);
                  });
              }
              return nodes.map(function (node) {
                  var siblings = dom.withClosestSiblings(node, pred);
                  var head = lists.head(siblings);
                  var tails = lists.tail(siblings);
                  $$1.each(tails, function (idx, elem) {
                      dom.appendChildNodes(head, elem.childNodes);
                      dom.remove(elem);
                  });
                  return lists.head(siblings);
              });
          }
          else {
              return nodes;
          }
      };
      /**
       * get current style on cursor
       *
       * @param {WrappedRange} rng
       * @return {Object} - object contains style properties.
       */
      Style.prototype.current = function (rng) {
          var $cont = $$1(!dom.isElement(rng.sc) ? rng.sc.parentNode : rng.sc);
          var styleInfo = this.fromNode($cont);
          // document.queryCommandState for toggle state
          // [workaround] prevent Firefox nsresult: "0x80004005 (NS_ERROR_FAILURE)"
          try {
              styleInfo = $$1.extend(styleInfo, {
                  'font-bold': document.queryCommandState('bold') ? 'bold' : 'normal',
                  'font-italic': document.queryCommandState('italic') ? 'italic' : 'normal',
                  'font-underline': document.queryCommandState('underline') ? 'underline' : 'normal',
                  'font-subscript': document.queryCommandState('subscript') ? 'subscript' : 'normal',
                  'font-superscript': document.queryCommandState('superscript') ? 'superscript' : 'normal',
                  'font-strikethrough': document.queryCommandState('strikethrough') ? 'strikethrough' : 'normal',
                  'font-family': document.queryCommandValue('fontname') || styleInfo['font-family']
              });
          }
          catch (e) { }
          // list-style-type to list-style(unordered, ordered)
          if (!rng.isOnList()) {
              styleInfo['list-style'] = 'none';
          }
          else {
              var orderedTypes = ['circle', 'disc', 'disc-leading-zero', 'square'];
              var isUnordered = orderedTypes.indexOf(styleInfo['list-style-type']) > -1;
              styleInfo['list-style'] = isUnordered ? 'unordered' : 'ordered';
          }
          var para = dom.ancestor(rng.sc, dom.isPara);
          if (para && para.style['line-height']) {
              styleInfo['line-height'] = para.style.lineHeight;
          }
          else {
              var lineHeight = parseInt(styleInfo['line-height'], 10) / parseInt(styleInfo['font-size'], 10);
              styleInfo['line-height'] = lineHeight.toFixed(1);
          }
          styleInfo.anchor = rng.isOnAnchor() && dom.ancestor(rng.sc, dom.isAnchor);
          styleInfo.ancestors = dom.listAncestor(rng.sc, dom.isEditable);
          styleInfo.range = rng;
          return styleInfo;
      };
      return Style;
  }());

  var Bullet = /** @class */ (function () {
      function Bullet() {
      }
      /**
       * toggle ordered list
       */
      Bullet.prototype.insertOrderedList = function (editable) {
          this.toggleList('OL', editable);
      };
      /**
       * toggle unordered list
       */
      Bullet.prototype.insertUnorderedList = function (editable) {
          this.toggleList('UL', editable);
      };
      /**
       * indent
       */
      Bullet.prototype.indent = function (editable) {
          var _this = this;
          var rng = range.create(editable).wrapBodyInlineWithPara();
          var paras = rng.nodes(dom.isPara, { includeAncestor: true });
          var clustereds = lists.clusterBy(paras, func.peq2('parentNode'));
          $$1.each(clustereds, function (idx, paras) {
              var head = lists.head(paras);
              if (dom.isLi(head)) {
                  var previousList_1 = _this.findList(head.previousSibling);
                  if (previousList_1) {
                      paras
                          .map(function (para) { return previousList_1.appendChild(para); });
                  }
                  else {
                      _this.wrapList(paras, head.parentNode.nodeName);
                      paras
                          .map(function (para) { return para.parentNode; })
                          .map(function (para) { return _this.appendToPrevious(para); });
                  }
              }
              else {
                  $$1.each(paras, function (idx, para) {
                      $$1(para).css('marginLeft', function (idx, val) {
                          return (parseInt(val, 10) || 0) + 25;
                      });
                  });
              }
          });
          rng.select();
      };
      /**
       * outdent
       */
      Bullet.prototype.outdent = function (editable) {
          var _this = this;
          var rng = range.create(editable).wrapBodyInlineWithPara();
          var paras = rng.nodes(dom.isPara, { includeAncestor: true });
          var clustereds = lists.clusterBy(paras, func.peq2('parentNode'));
          $$1.each(clustereds, function (idx, paras) {
              var head = lists.head(paras);
              if (dom.isLi(head)) {
                  _this.releaseList([paras]);
              }
              else {
                  $$1.each(paras, function (idx, para) {
                      $$1(para).css('marginLeft', function (idx, val) {
                          val = (parseInt(val, 10) || 0);
                          return val > 25 ? val - 25 : '';
                      });
                  });
              }
          });
          rng.select();
      };
      /**
       * toggle list
       *
       * @param {String} listName - OL or UL
       */
      Bullet.prototype.toggleList = function (listName, editable) {
          var _this = this;
          var rng = range.create(editable).wrapBodyInlineWithPara();
          var paras = rng.nodes(dom.isPara, { includeAncestor: true });
          var bookmark = rng.paraBookmark(paras);
          var clustereds = lists.clusterBy(paras, func.peq2('parentNode'));
          // paragraph to list
          if (lists.find(paras, dom.isPurePara)) {
              var wrappedParas_1 = [];
              $$1.each(clustereds, function (idx, paras) {
                  wrappedParas_1 = wrappedParas_1.concat(_this.wrapList(paras, listName));
              });
              paras = wrappedParas_1;
              // list to paragraph or change list style
          }
          else {
              var diffLists = rng.nodes(dom.isList, {
                  includeAncestor: true
              }).filter(function (listNode) {
                  return !$$1.nodeName(listNode, listName);
              });
              if (diffLists.length) {
                  $$1.each(diffLists, function (idx, listNode) {
                      dom.replace(listNode, listName);
                  });
              }
              else {
                  paras = this.releaseList(clustereds, true);
              }
          }
          range.createFromParaBookmark(bookmark, paras).select();
      };
      /**
       * @param {Node[]} paras
       * @param {String} listName
       * @return {Node[]}
       */
      Bullet.prototype.wrapList = function (paras, listName) {
          var head = lists.head(paras);
          var last = lists.last(paras);
          var prevList = dom.isList(head.previousSibling) && head.previousSibling;
          var nextList = dom.isList(last.nextSibling) && last.nextSibling;
          var listNode = prevList || dom.insertAfter(dom.create(listName || 'UL'), last);
          // P to LI
          paras = paras.map(function (para) {
              return dom.isPurePara(para) ? dom.replace(para, 'LI') : para;
          });
          // append to list(<ul>, <ol>)
          dom.appendChildNodes(listNode, paras);
          if (nextList) {
              dom.appendChildNodes(listNode, lists.from(nextList.childNodes));
              dom.remove(nextList);
          }
          return paras;
      };
      /**
       * @method releaseList
       *
       * @param {Array[]} clustereds
       * @param {Boolean} isEscapseToBody
       * @return {Node[]}
       */
      Bullet.prototype.releaseList = function (clustereds, isEscapseToBody) {
          var _this = this;
          var releasedParas = [];
          $$1.each(clustereds, function (idx, paras) {
              var head = lists.head(paras);
              var last = lists.last(paras);
              var headList = isEscapseToBody ? dom.lastAncestor(head, dom.isList) : head.parentNode;
              var parentItem = headList.parentNode;
              if (headList.parentNode.nodeName === 'LI') {
                  paras.map(function (para) {
                      var newList = _this.findNextSiblings(para);
                      if (parentItem.nextSibling) {
                          parentItem.parentNode.insertBefore(para, parentItem.nextSibling);
                      }
                      else {
                          parentItem.parentNode.appendChild(para);
                      }
                      if (newList.length) {
                          _this.wrapList(newList, headList.nodeName);
                          para.appendChild(newList[0].parentNode);
                      }
                  });
                  if (headList.children.length === 0) {
                      parentItem.removeChild(headList);
                  }
                  if (parentItem.childNodes.length === 0) {
                      parentItem.parentNode.removeChild(parentItem);
                  }
              }
              else {
                  var lastList = headList.childNodes.length > 1 ? dom.splitTree(headList, {
                      node: last.parentNode,
                      offset: dom.position(last) + 1
                  }, {
                      isSkipPaddingBlankHTML: true
                  }) : null;
                  var middleList = dom.splitTree(headList, {
                      node: head.parentNode,
                      offset: dom.position(head)
                  }, {
                      isSkipPaddingBlankHTML: true
                  });
                  paras = isEscapseToBody ? dom.listDescendant(middleList, dom.isLi)
                      : lists.from(middleList.childNodes).filter(dom.isLi);
                  // LI to P
                  if (isEscapseToBody || !dom.isList(headList.parentNode)) {
                      paras = paras.map(function (para) {
                          return dom.replace(para, 'P');
                      });
                  }
                  $$1.each(lists.from(paras).reverse(), function (idx, para) {
                      dom.insertAfter(para, headList);
                  });
                  // remove empty lists
                  var rootLists = lists.compact([headList, middleList, lastList]);
                  $$1.each(rootLists, function (idx, rootList) {
                      var listNodes = [rootList].concat(dom.listDescendant(rootList, dom.isList));
                      $$1.each(listNodes.reverse(), function (idx, listNode) {
                          if (!dom.nodeLength(listNode)) {
                              dom.remove(listNode, true);
                          }
                      });
                  });
              }
              releasedParas = releasedParas.concat(paras);
          });
          return releasedParas;
      };
      /**
       * @method appendToPrevious
       *
       * Appends list to previous list item, if
       * none exist it wraps the list in a new list item.
       *
       * @param {HTMLNode} ListItem
       * @return {HTMLNode}
       */
      Bullet.prototype.appendToPrevious = function (node) {
          return node.previousSibling
              ? dom.appendChildNodes(node.previousSibling, [node])
              : this.wrapList([node], 'LI');
      };
      /**
       * @method findList
       *
       * Finds an existing list in list item
       *
       * @param {HTMLNode} ListItem
       * @return {Array[]}
       */
      Bullet.prototype.findList = function (node) {
          return node
              ? lists.find(node.children, function (child) { return ['OL', 'UL'].indexOf(child.nodeName) > -1; })
              : null;
      };
      /**
       * @method findNextSiblings
       *
       * Finds all list item siblings that follow it
       *
       * @param {HTMLNode} ListItem
       * @return {HTMLNode}
       */
      Bullet.prototype.findNextSiblings = function (node) {
          var siblings = [];
          while (node.nextSibling) {
              siblings.push(node.nextSibling);
              node = node.nextSibling;
          }
          return siblings;
      };
      return Bullet;
  }());

  /**
   * @class editing.Typing
   *
   * Typing
   *
   */
  var Typing = /** @class */ (function () {
      function Typing(context) {
          // a Bullet instance to toggle lists off
          this.bullet = new Bullet();
          this.options = context.options;
      }
      /**
       * insert tab
       *
       * @param {WrappedRange} rng
       * @param {Number} tabsize
       */
      Typing.prototype.insertTab = function (rng, tabsize) {
          var tab = dom.createText(new Array(tabsize + 1).join(dom.NBSP_CHAR));
          rng = rng.deleteContents();
          rng.insertNode(tab, true);
          rng = range.create(tab, tabsize);
          rng.select();
      };
      /**
       * insert paragraph
       *
       * @param {jQuery} $editable
       * @param {WrappedRange} rng Can be used in unit tests to "mock" the range
       *
       * blockquoteBreakingLevel
       *   0 - No break, the new paragraph remains inside the quote
       *   1 - Break the first blockquote in the ancestors list
       *   2 - Break all blockquotes, so that the new paragraph is not quoted (this is the default)
       */
      Typing.prototype.insertParagraph = function (editable, rng) {
          rng = rng || range.create(editable);
          // deleteContents on range.
          rng = rng.deleteContents();
          // Wrap range if it needs to be wrapped by paragraph
          rng = rng.wrapBodyInlineWithPara();
          // finding paragraph
          var splitRoot = dom.ancestor(rng.sc, dom.isPara);
          var nextPara;
          // on paragraph: split paragraph
          if (splitRoot) {
              // if it is an empty line with li
              if (dom.isEmpty(splitRoot) && dom.isLi(splitRoot)) {
                  // toogle UL/OL and escape
                  this.bullet.toggleList(splitRoot.parentNode.nodeName);
                  return;
              }
              else {
                  var blockquote = null;
                  if (this.options.blockquoteBreakingLevel === 1) {
                      blockquote = dom.ancestor(splitRoot, dom.isBlockquote);
                  }
                  else if (this.options.blockquoteBreakingLevel === 2) {
                      blockquote = dom.lastAncestor(splitRoot, dom.isBlockquote);
                  }
                  if (blockquote) {
                      // We're inside a blockquote and options ask us to break it
                      nextPara = $$1(dom.emptyPara)[0];
                      // If the split is right before a <br>, remove it so that there's no "empty line"
                      // after the split in the new blockquote created
                      if (dom.isRightEdgePoint(rng.getStartPoint()) && dom.isBR(rng.sc.nextSibling)) {
                          $$1(rng.sc.nextSibling).remove();
                      }
                      var split = dom.splitTree(blockquote, rng.getStartPoint(), { isDiscardEmptySplits: true });
                      if (split) {
                          split.parentNode.insertBefore(nextPara, split);
                      }
                      else {
                          dom.insertAfter(nextPara, blockquote); // There's no split if we were at the end of the blockquote
                      }
                  }
                  else {
                      nextPara = dom.splitTree(splitRoot, rng.getStartPoint());
                      // not a blockquote, just insert the paragraph
                      var emptyAnchors = dom.listDescendant(splitRoot, dom.isEmptyAnchor);
                      emptyAnchors = emptyAnchors.concat(dom.listDescendant(nextPara, dom.isEmptyAnchor));
                      $$1.each(emptyAnchors, function (idx, anchor) {
                          dom.remove(anchor);
                      });
                      // replace empty heading, pre or custom-made styleTag with P tag
                      if ((dom.isHeading(nextPara) || dom.isPre(nextPara) || dom.isCustomStyleTag(nextPara)) && dom.isEmpty(nextPara)) {
                          nextPara = dom.replace(nextPara, 'p');
                      }
                  }
              }
              // no paragraph: insert empty paragraph
          }
          else {
              var next = rng.sc.childNodes[rng.so];
              nextPara = $$1(dom.emptyPara)[0];
              if (next) {
                  rng.sc.insertBefore(nextPara, next);
              }
              else {
                  rng.sc.appendChild(nextPara);
              }
          }
          range.create(nextPara, 0).normalize().select().scrollIntoView(editable);
      };
      return Typing;
  }());

  /**
   * @class Create a virtual table to create what actions to do in change.
   * @param {object} startPoint Cell selected to apply change.
   * @param {enum} where  Where change will be applied Row or Col. Use enum: TableResultAction.where
   * @param {enum} action Action to be applied. Use enum: TableResultAction.requestAction
   * @param {object} domTable Dom element of table to make changes.
   */
  var TableResultAction = function (startPoint, where, action, domTable) {
      var _startPoint = { 'colPos': 0, 'rowPos': 0 };
      var _virtualTable = [];
      var _actionCellList = [];
      /// ///////////////////////////////////////////
      // Private functions
      /// ///////////////////////////////////////////
      /**
       * Set the startPoint of action.
       */
      function setStartPoint() {
          if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {
              console.error('Impossible to identify start Cell point.', startPoint);
              return;
          }
          _startPoint.colPos = startPoint.cellIndex;
          if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {
              console.error('Impossible to identify start Row point.', startPoint);
              return;
          }
          _startPoint.rowPos = startPoint.parentElement.rowIndex;
      }
      /**
       * Define virtual table position info object.
       *
       * @param {int} rowIndex Index position in line of virtual table.
       * @param {int} cellIndex Index position in column of virtual table.
       * @param {object} baseRow Row affected by this position.
       * @param {object} baseCell Cell affected by this position.
       * @param {bool} isSpan Inform if it is an span cell/row.
       */
      function setVirtualTablePosition(rowIndex, cellIndex, baseRow, baseCell, isRowSpan, isColSpan, isVirtualCell) {
          var objPosition = {
              'baseRow': baseRow,
              'baseCell': baseCell,
              'isRowSpan': isRowSpan,
              'isColSpan': isColSpan,
              'isVirtual': isVirtualCell
          };
          if (!_virtualTable[rowIndex]) {
              _virtualTable[rowIndex] = [];
          }
          _virtualTable[rowIndex][cellIndex] = objPosition;
      }
      /**
       * Create action cell object.
       *
       * @param {object} virtualTableCellObj Object of specific position on virtual table.
       * @param {enum} resultAction Action to be applied in that item.
       */
      function getActionCell(virtualTableCellObj, resultAction, virtualRowPosition, virtualColPosition) {
          return {
              'baseCell': virtualTableCellObj.baseCell,
              'action': resultAction,
              'virtualTable': {
                  'rowIndex': virtualRowPosition,
                  'cellIndex': virtualColPosition
              }
          };
      }
      /**
       * Recover free index of row to append Cell.
       *
       * @param {int} rowIndex Index of row to find free space.
       * @param {int} cellIndex Index of cell to find free space in table.
       */
      function recoverCellIndex(rowIndex, cellIndex) {
          if (!_virtualTable[rowIndex]) {
              return cellIndex;
          }
          if (!_virtualTable[rowIndex][cellIndex]) {
              return cellIndex;
          }
          var newCellIndex = cellIndex;
          while (_virtualTable[rowIndex][newCellIndex]) {
              newCellIndex++;
              if (!_virtualTable[rowIndex][newCellIndex]) {
                  return newCellIndex;
              }
          }
      }
      /**
       * Recover info about row and cell and add information to virtual table.
       *
       * @param {object} row Row to recover information.
       * @param {object} cell Cell to recover information.
       */
      function addCellInfoToVirtual(row, cell) {
          var cellIndex = recoverCellIndex(row.rowIndex, cell.cellIndex);
          var cellHasColspan = (cell.colSpan > 1);
          var cellHasRowspan = (cell.rowSpan > 1);
          var isThisSelectedCell = (row.rowIndex === _startPoint.rowPos && cell.cellIndex === _startPoint.colPos);
          setVirtualTablePosition(row.rowIndex, cellIndex, row, cell, cellHasRowspan, cellHasColspan, false);
          // Add span rows to virtual Table.
          var rowspanNumber = cell.attributes.rowSpan ? parseInt(cell.attributes.rowSpan.value, 10) : 0;
          if (rowspanNumber > 1) {
              for (var rp = 1; rp < rowspanNumber; rp++) {
                  var rowspanIndex = row.rowIndex + rp;
                  adjustStartPoint(rowspanIndex, cellIndex, cell, isThisSelectedCell);
                  setVirtualTablePosition(rowspanIndex, cellIndex, row, cell, true, cellHasColspan, true);
              }
          }
          // Add span cols to virtual table.
          var colspanNumber = cell.attributes.colSpan ? parseInt(cell.attributes.colSpan.value, 10) : 0;
          if (colspanNumber > 1) {
              for (var cp = 1; cp < colspanNumber; cp++) {
                  var cellspanIndex = recoverCellIndex(row.rowIndex, (cellIndex + cp));
                  adjustStartPoint(row.rowIndex, cellspanIndex, cell, isThisSelectedCell);
                  setVirtualTablePosition(row.rowIndex, cellspanIndex, row, cell, cellHasRowspan, true, true);
              }
          }
      }
      /**
       * Process validation and adjust of start point if needed
       *
       * @param {int} rowIndex
       * @param {int} cellIndex
       * @param {object} cell
       * @param {bool} isSelectedCell
       */
      function adjustStartPoint(rowIndex, cellIndex, cell, isSelectedCell) {
          if (rowIndex === _startPoint.rowPos && _startPoint.colPos >= cell.cellIndex && cell.cellIndex <= cellIndex && !isSelectedCell) {
              _startPoint.colPos++;
          }
      }
      /**
       * Create virtual table of cells with all cells, including span cells.
       */
      function createVirtualTable() {
          var rows = domTable.rows;
          for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {
              var cells = rows[rowIndex].cells;
              for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {
                  addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);
              }
          }
      }
      /**
       * Get action to be applied on the cell.
       *
       * @param {object} cell virtual table cell to apply action
       */
      function getDeleteResultActionToCell(cell) {
          switch (where) {
              case TableResultAction.where.Column:
                  if (cell.isColSpan) {
                      return TableResultAction.resultAction.SubtractSpanCount;
                  }
                  break;
              case TableResultAction.where.Row:
                  if (!cell.isVirtual && cell.isRowSpan) {
                      return TableResultAction.resultAction.AddCell;
                  }
                  else if (cell.isRowSpan) {
                      return TableResultAction.resultAction.SubtractSpanCount;
                  }
                  break;
          }
          return TableResultAction.resultAction.RemoveCell;
      }
      /**
       * Get action to be applied on the cell.
       *
       * @param {object} cell virtual table cell to apply action
       */
      function getAddResultActionToCell(cell) {
          switch (where) {
              case TableResultAction.where.Column:
                  if (cell.isColSpan) {
                      return TableResultAction.resultAction.SumSpanCount;
                  }
                  else if (cell.isRowSpan && cell.isVirtual) {
                      return TableResultAction.resultAction.Ignore;
                  }
                  break;
              case TableResultAction.where.Row:
                  if (cell.isRowSpan) {
                      return TableResultAction.resultAction.SumSpanCount;
                  }
                  else if (cell.isColSpan && cell.isVirtual) {
                      return TableResultAction.resultAction.Ignore;
                  }
                  break;
          }
          return TableResultAction.resultAction.AddCell;
      }
      function init() {
          setStartPoint();
          createVirtualTable();
      }
      /// ///////////////////////////////////////////
      // Public functions
      /// ///////////////////////////////////////////
      /**
       * Recover array os what to do in table.
       */
      this.getActionList = function () {
          var fixedRow = (where === TableResultAction.where.Row) ? _startPoint.rowPos : -1;
          var fixedCol = (where === TableResultAction.where.Column) ? _startPoint.colPos : -1;
          var actualPosition = 0;
          var canContinue = true;
          while (canContinue) {
              var rowPosition = (fixedRow >= 0) ? fixedRow : actualPosition;
              var colPosition = (fixedCol >= 0) ? fixedCol : actualPosition;
              var row = _virtualTable[rowPosition];
              if (!row) {
                  canContinue = false;
                  return _actionCellList;
              }
              var cell = row[colPosition];
              if (!cell) {
                  canContinue = false;
                  return _actionCellList;
              }
              // Define action to be applied in this cell
              var resultAction = TableResultAction.resultAction.Ignore;
              switch (action) {
                  case TableResultAction.requestAction.Add:
                      resultAction = getAddResultActionToCell(cell);
                      break;
                  case TableResultAction.requestAction.Delete:
                      resultAction = getDeleteResultActionToCell(cell);
                      break;
              }
              _actionCellList.push(getActionCell(cell, resultAction, rowPosition, colPosition));
              actualPosition++;
          }
          return _actionCellList;
      };
      init();
  };
  /**
  *
  * Where action occours enum.
  */
  TableResultAction.where = { 'Row': 0, 'Column': 1 };
  /**
  *
  * Requested action to apply enum.
  */
  TableResultAction.requestAction = { 'Add': 0, 'Delete': 1 };
  /**
  *
  * Result action to be executed enum.
  */
  TableResultAction.resultAction = { 'Ignore': 0, 'SubtractSpanCount': 1, 'RemoveCell': 2, 'AddCell': 3, 'SumSpanCount': 4 };
  /**
   *
   * @class editing.Table
   *
   * Table
   *
   */
  var Table = /** @class */ (function () {
      function Table() {
      }
      /**
       * handle tab key
       *
       * @param {WrappedRange} rng
       * @param {Boolean} isShift
       */
      Table.prototype.tab = function (rng, isShift) {
          var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
          var table = dom.ancestor(cell, dom.isTable);
          var cells = dom.listDescendant(table, dom.isCell);
          var nextCell = lists[isShift ? 'prev' : 'next'](cells, cell);
          if (nextCell) {
              range.create(nextCell, 0).select();
          }
      };
      /**
       * Add a new row
       *
       * @param {WrappedRange} rng
       * @param {String} position (top/bottom)
       * @return {Node}
       */
      Table.prototype.addRow = function (rng, position) {
          var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
          var currentTr = $$1(cell).closest('tr');
          var trAttributes = this.recoverAttributes(currentTr);
          var html = $$1('<tr' + trAttributes + '></tr>');
          var vTable = new TableResultAction(cell, TableResultAction.where.Row, TableResultAction.requestAction.Add, $$1(currentTr).closest('table')[0]);
          var actions = vTable.getActionList();
          for (var idCell = 0; idCell < actions.length; idCell++) {
              var currentCell = actions[idCell];
              var tdAttributes = this.recoverAttributes(currentCell.baseCell);
              switch (currentCell.action) {
                  case TableResultAction.resultAction.AddCell:
                      html.append('<td' + tdAttributes + '>' + dom.blank + '</td>');
                      break;
                  case TableResultAction.resultAction.SumSpanCount:
                      if (position === 'top') {
                          var baseCellTr = currentCell.baseCell.parent;
                          var isTopFromRowSpan = (!baseCellTr ? 0 : currentCell.baseCell.closest('tr').rowIndex) <= currentTr[0].rowIndex;
                          if (isTopFromRowSpan) {
                              var newTd = $$1('<div></div>').append($$1('<td' + tdAttributes + '>' + dom.blank + '</td>').removeAttr('rowspan')).html();
                              html.append(newTd);
                              break;
                          }
                      }
                      var rowspanNumber = parseInt(currentCell.baseCell.rowSpan, 10);
                      rowspanNumber++;
                      currentCell.baseCell.setAttribute('rowSpan', rowspanNumber);
                      break;
              }
          }
          if (position === 'top') {
              currentTr.before(html);
          }
          else {
              var cellHasRowspan = (cell.rowSpan > 1);
              if (cellHasRowspan) {
                  var lastTrIndex = currentTr[0].rowIndex + (cell.rowSpan - 2);
                  $$1($$1(currentTr).parent().find('tr')[lastTrIndex]).after($$1(html));
                  return;
              }
              currentTr.after(html);
          }
      };
      /**
       * Add a new col
       *
       * @param {WrappedRange} rng
       * @param {String} position (left/right)
       * @return {Node}
       */
      Table.prototype.addCol = function (rng, position) {
          var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
          var row = $$1(cell).closest('tr');
          var rowsGroup = $$1(row).siblings();
          rowsGroup.push(row);
          var vTable = new TableResultAction(cell, TableResultAction.where.Column, TableResultAction.requestAction.Add, $$1(row).closest('table')[0]);
          var actions = vTable.getActionList();
          for (var actionIndex = 0; actionIndex < actions.length; actionIndex++) {
              var currentCell = actions[actionIndex];
              var tdAttributes = this.recoverAttributes(currentCell.baseCell);
              switch (currentCell.action) {
                  case TableResultAction.resultAction.AddCell:
                      if (position === 'right') {
                          $$1(currentCell.baseCell).after('<td' + tdAttributes + '>' + dom.blank + '</td>');
                      }
                      else {
                          $$1(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');
                      }
                      break;
                  case TableResultAction.resultAction.SumSpanCount:
                      if (position === 'right') {
                          var colspanNumber = parseInt(currentCell.baseCell.colSpan, 10);
                          colspanNumber++;
                          currentCell.baseCell.setAttribute('colSpan', colspanNumber);
                      }
                      else {
                          $$1(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');
                      }
                      break;
              }
          }
      };
      /*
      * Copy attributes from element.
      *
      * @param {object} Element to recover attributes.
      * @return {string} Copied string elements.
      */
      Table.prototype.recoverAttributes = function (el) {
          var resultStr = '';
          if (!el) {
              return resultStr;
          }
          var attrList = el.attributes || [];
          for (var i = 0; i < attrList.length; i++) {
              if (attrList[i].name.toLowerCase() === 'id') {
                  continue;
              }
              if (attrList[i].specified) {
                  resultStr += ' ' + attrList[i].name + '=\'' + attrList[i].value + '\'';
              }
          }
          return resultStr;
      };
      /**
       * Delete current row
       *
       * @param {WrappedRange} rng
       * @return {Node}
       */
      Table.prototype.deleteRow = function (rng) {
          var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
          var row = $$1(cell).closest('tr');
          var cellPos = row.children('td, th').index($$1(cell));
          var rowPos = row[0].rowIndex;
          var vTable = new TableResultAction(cell, TableResultAction.where.Row, TableResultAction.requestAction.Delete, $$1(row).closest('table')[0]);
          var actions = vTable.getActionList();
          for (var actionIndex = 0; actionIndex < actions.length; actionIndex++) {
              if (!actions[actionIndex]) {
                  continue;
              }
              var baseCell = actions[actionIndex].baseCell;
              var virtualPosition = actions[actionIndex].virtualTable;
              var hasRowspan = (baseCell.rowSpan && baseCell.rowSpan > 1);
              var rowspanNumber = (hasRowspan) ? parseInt(baseCell.rowSpan, 10) : 0;
              switch (actions[actionIndex].action) {
                  case TableResultAction.resultAction.Ignore:
                      continue;
                  case TableResultAction.resultAction.AddCell:
                      var nextRow = row.next('tr')[0];
                      if (!nextRow) {
                          continue;
                      }
                      var cloneRow = row[0].cells[cellPos];
                      if (hasRowspan) {
                          if (rowspanNumber > 2) {
                              rowspanNumber--;
                              nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);
                              nextRow.cells[cellPos].setAttribute('rowSpan', rowspanNumber);
                              nextRow.cells[cellPos].innerHTML = '';
                          }
                          else if (rowspanNumber === 2) {
                              nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);
                              nextRow.cells[cellPos].removeAttribute('rowSpan');
                              nextRow.cells[cellPos].innerHTML = '';
                          }
                      }
                      continue;
                  case TableResultAction.resultAction.SubtractSpanCount:
                      if (hasRowspan) {
                          if (rowspanNumber > 2) {
                              rowspanNumber--;
                              baseCell.setAttribute('rowSpan', rowspanNumber);
                              if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) {
                                  baseCell.innerHTML = '';
                              }
                          }
                          else if (rowspanNumber === 2) {
                              baseCell.removeAttribute('rowSpan');
                              if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) {
                                  baseCell.innerHTML = '';
                              }
                          }
                      }
                      continue;
                  case TableResultAction.resultAction.RemoveCell:
                      // Do not need remove cell because row will be deleted.
                      continue;
              }
          }
          row.remove();
      };
      /**
       * Delete current col
       *
       * @param {WrappedRange} rng
       * @return {Node}
       */
      Table.prototype.deleteCol = function (rng) {
          var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
          var row = $$1(cell).closest('tr');
          var cellPos = row.children('td, th').index($$1(cell));
          var vTable = new TableResultAction(cell, TableResultAction.where.Column, TableResultAction.requestAction.Delete, $$1(row).closest('table')[0]);
          var actions = vTable.getActionList();
          for (var actionIndex = 0; actionIndex < actions.length; actionIndex++) {
              if (!actions[actionIndex]) {
                  continue;
              }
              switch (actions[actionIndex].action) {
                  case TableResultAction.resultAction.Ignore:
                      continue;
                  case TableResultAction.resultAction.SubtractSpanCount:
                      var baseCell = actions[actionIndex].baseCell;
                      var hasColspan = (baseCell.colSpan && baseCell.colSpan > 1);
                      if (hasColspan) {
                          var colspanNumber = (baseCell.colSpan) ? parseInt(baseCell.colSpan, 10) : 0;
                          if (colspanNumber > 2) {
                              colspanNumber--;
                              baseCell.setAttribute('colSpan', colspanNumber);
                              if (baseCell.cellIndex === cellPos) {
                                  baseCell.innerHTML = '';
                              }
                          }
                          else if (colspanNumber === 2) {
                              baseCell.removeAttribute('colSpan');
                              if (baseCell.cellIndex === cellPos) {
                                  baseCell.innerHTML = '';
                              }
                          }
                      }
                      continue;
                  case TableResultAction.resultAction.RemoveCell:
                      dom.remove(actions[actionIndex].baseCell, true);
                      continue;
              }
          }
      };
      /**
       * create empty table element
       *
       * @param {Number} rowCount
       * @param {Number} colCount
       * @return {Node}
       */
      Table.prototype.createTable = function (colCount, rowCount, options) {
          var tds = [];
          var tdHTML;
          for (var idxCol = 0; idxCol < colCount; idxCol++) {
              tds.push('<td>' + dom.blank + '</td>');
          }
          tdHTML = tds.join('');
          var trs = [];
          var trHTML;
          for (var idxRow = 0; idxRow < rowCount; idxRow++) {
              trs.push('<tr>' + tdHTML + '</tr>');
          }
          trHTML = trs.join('');
          var $table = $$1('<table>' + trHTML + '</table>');
          if (options && options.tableClassName) {
              $table.addClass(options.tableClassName);
          }
          return $table[0];
      };
      /**
       * Delete current table
       *
       * @param {WrappedRange} rng
       * @return {Node}
       */
      Table.prototype.deleteTable = function (rng) {
          var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
          $$1(cell).closest('table').remove();
      };
      return Table;
  }());

  var KEY_BOGUS = 'bogus';
  /**
   * @class Editor
   */
  var Editor = /** @class */ (function () {
      function Editor(context) {
          var _this = this;
          this.context = context;
          this.$note = context.layoutInfo.note;
          this.$editor = context.layoutInfo.editor;
          this.$editable = context.layoutInfo.editable;
          this.options = context.options;
          this.lang = this.options.langInfo;
          this.editable = this.$editable[0];
          this.lastRange = null;
          this.style = new Style();
          this.table = new Table();
          this.typing = new Typing(context);
          this.bullet = new Bullet();
          this.history = new History(this.$editable);
          this.context.memo('help.undo', this.lang.help.undo);
          this.context.memo('help.redo', this.lang.help.redo);
          this.context.memo('help.tab', this.lang.help.tab);
          this.context.memo('help.untab', this.lang.help.untab);
          this.context.memo('help.insertParagraph', this.lang.help.insertParagraph);
          this.context.memo('help.insertOrderedList', this.lang.help.insertOrderedList);
          this.context.memo('help.insertUnorderedList', this.lang.help.insertUnorderedList);
          this.context.memo('help.indent', this.lang.help.indent);
          this.context.memo('help.outdent', this.lang.help.outdent);
          this.context.memo('help.formatPara', this.lang.help.formatPara);
          this.context.memo('help.insertHorizontalRule', this.lang.help.insertHorizontalRule);
          this.context.memo('help.fontName', this.lang.help.fontName);
          // native commands(with execCommand), generate function for execCommand
          var commands = [
              'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',
              'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull',
              'formatBlock', 'removeFormat', 'backColor',
          ];
          for (var idx = 0, len = commands.length; idx < len; idx++) {
              this[commands[idx]] = (function (sCmd) {
                  return function (value) {
                      _this.beforeCommand();
                      document.execCommand(sCmd, false, value);
                      _this.afterCommand(true);
                  };
              })(commands[idx]);
              this.context.memo('help.' + commands[idx], this.lang.help[commands[idx]]);
          }
          this.fontName = this.wrapCommand(function (value) {
              return _this.fontStyling('font-family', "\'" + value + "\'");
          });
          this.fontSize = this.wrapCommand(function (value) {
              return _this.fontStyling('font-size', value + 'px');
          });
          for (var idx = 1; idx <= 6; idx++) {
              this['formatH' + idx] = (function (idx) {
                  return function () {
                      _this.formatBlock('H' + idx);
                  };
              })(idx);
              this.context.memo('help.formatH' + idx, this.lang.help['formatH' + idx]);
          }
          this.insertParagraph = this.wrapCommand(function () {
              _this.typing.insertParagraph(_this.editable);
          });
          this.insertOrderedList = this.wrapCommand(function () {
              _this.bullet.insertOrderedList(_this.editable);
          });
          this.insertUnorderedList = this.wrapCommand(function () {
              _this.bullet.insertUnorderedList(_this.editable);
          });
          this.indent = this.wrapCommand(function () {
              _this.bullet.indent(_this.editable);
          });
          this.outdent = this.wrapCommand(function () {
              _this.bullet.outdent(_this.editable);
          });
          /**
           * insertNode
           * insert node
           * @param {Node} node
           */
          this.insertNode = this.wrapCommand(function (node) {
              if (_this.isLimited($$1(node).text().length)) {
                  return;
              }
              var rng = _this.getLastRange();
              rng.insertNode(node);
              range.createFromNodeAfter(node).select();
              _this.setLastRange();
          });
          /**
           * insert text
           * @param {String} text
           */
          this.insertText = this.wrapCommand(function (text) {
              if (_this.isLimited(text.length)) {
                  return;
              }
              var rng = _this.getLastRange();
              var textNode = rng.insertNode(dom.createText(text));
              range.create(textNode, dom.nodeLength(textNode)).select();
              _this.setLastRange();
          });
          /**
           * paste HTML
           * @param {String} markup
           */
          this.pasteHTML = this.wrapCommand(function (markup) {
              if (_this.isLimited(markup.length)) {
                  return;
              }
              markup = _this.context.invoke('codeview.purify', markup);
              var contents = _this.getLastRange().pasteHTML(markup);
              range.createFromNodeAfter(lists.last(contents)).select();
              _this.setLastRange();
          });
          /**
           * formatBlock
           *
           * @param {String} tagName
           */
          this.formatBlock = this.wrapCommand(function (tagName, $target) {
              var onApplyCustomStyle = _this.options.callbacks.onApplyCustomStyle;
              if (onApplyCustomStyle) {
                  onApplyCustomStyle.call(_this, $target, _this.context, _this.onFormatBlock);
              }
              else {
                  _this.onFormatBlock(tagName, $target);
              }
          });
          /**
           * insert horizontal rule
           */
          this.insertHorizontalRule = this.wrapCommand(function () {
              var hrNode = _this.getLastRange().insertNode(dom.create('HR'));
              if (hrNode.nextSibling) {
                  range.create(hrNode.nextSibling, 0).normalize().select();
                  _this.setLastRange();
              }
          });
          /**
           * lineHeight
           * @param {String} value
           */
          this.lineHeight = this.wrapCommand(function (value) {
              _this.style.stylePara(_this.getLastRange(), {
                  lineHeight: value
              });
          });
          /**
           * create link (command)
           *
           * @param {Object} linkInfo
           */
          this.createLink = this.wrapCommand(function (linkInfo) {
              var linkUrl = linkInfo.url;
              var linkText = linkInfo.text;
              var isNewWindow = linkInfo.isNewWindow;
              var rng = linkInfo.range || _this.getLastRange();
              var additionalTextLength = linkText.length - rng.toString().length;
              if (additionalTextLength > 0 && _this.isLimited(additionalTextLength)) {
                  return;
              }
              var isTextChanged = rng.toString() !== linkText;
              // handle spaced urls from input
              if (typeof linkUrl === 'string') {
                  linkUrl = linkUrl.trim();
              }
              if (_this.options.onCreateLink) {
                  linkUrl = _this.options.onCreateLink(linkUrl);
              }
              else {
                  // if url doesn't have any protocol and not even a relative or a label, use http:// as default
                  linkUrl = /^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/.test(linkUrl)
                      ? linkUrl : 'http://' + linkUrl;
              }
              var anchors = [];
              if (isTextChanged) {
                  rng = rng.deleteContents();
                  var anchor = rng.insertNode($$1('<A>' + linkText + '</A>')[0]);
                  anchors.push(anchor);
              }
              else {
                  anchors = _this.style.styleNodes(rng, {
                      nodeName: 'A',
                      expandClosestSibling: true,
                      onlyPartialContains: true
                  });
              }
              $$1.each(anchors, function (idx, anchor) {
                  $$1(anchor).attr('href', linkUrl);
                  if (isNewWindow) {
                      $$1(anchor).attr('target', '_blank');
                  }
                  else {
                      $$1(anchor).removeAttr('target');
                  }
              });
              var startRange = range.createFromNodeBefore(lists.head(anchors));
              var startPoint = startRange.getStartPoint();
              var endRange = range.createFromNodeAfter(lists.last(anchors));
              var endPoint = endRange.getEndPoint();
              range.create(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset).select();
              _this.setLastRange();
          });
          /**
           * setting color
           *
           * @param {Object} sObjColor  color code
           * @param {String} sObjColor.foreColor foreground color
           * @param {String} sObjColor.backColor background color
           */
          this.color = this.wrapCommand(function (colorInfo) {
              var foreColor = colorInfo.foreColor;
              var backColor = colorInfo.backColor;
              if (foreColor) {
                  document.execCommand('foreColor', false, foreColor);
              }
              if (backColor) {
                  document.execCommand('backColor', false, backColor);
              }
          });
          /**
           * Set foreground color
           *
           * @param {String} colorCode foreground color code
           */
          this.foreColor = this.wrapCommand(function (colorInfo) {
              document.execCommand('styleWithCSS', false, true);
              document.execCommand('foreColor', false, colorInfo);
          });
          /**
           * insert Table
           *
           * @param {String} dimension of table (ex : "5x5")
           */
          this.insertTable = this.wrapCommand(function (dim) {
              var dimension = dim.split('x');
              var rng = _this.getLastRange().deleteContents();
              rng.insertNode(_this.table.createTable(dimension[0], dimension[1], _this.options));
          });
          /**
           * remove media object and Figure Elements if media object is img with Figure.
           */
          this.removeMedia = this.wrapCommand(function () {
              var $target = $$1(_this.restoreTarget()).parent();
              if ($target.parent('figure').length) {
                  $target.parent('figure').remove();
              }
              else {
                  $target = $$1(_this.restoreTarget()).detach();
              }
              _this.context.triggerEvent('media.delete', $target, _this.$editable);
          });
          /**
           * float me
           *
           * @param {String} value
           */
          this.floatMe = this.wrapCommand(function (value) {
              var $target = $$1(_this.restoreTarget());
              $target.toggleClass('note-float-left', value === 'left');
              $target.toggleClass('note-float-right', value === 'right');
              $target.css('float', (value === 'none' ? '' : value));
          });
          /**
           * resize overlay element
           * @param {String} value
           */
          this.resize = this.wrapCommand(function (value) {
              var $target = $$1(_this.restoreTarget());
              value = parseFloat(value);
              if (value === 0) {
                  $target.css('width', '');
              }
              else {
                  $target.css({
                      width: value * 100 + '%',
                      height: ''
                  });
              }
          });
      }
      Editor.prototype.initialize = function () {
          var _this = this;
          // bind custom events
          this.$editable.on('keydown', function (event) {
              if (event.keyCode === key.code.ENTER) {
                  _this.context.triggerEvent('enter', event);
              }
              _this.context.triggerEvent('keydown', event);
              if (!event.isDefaultPrevented()) {
                  if (_this.options.shortcuts) {
                      _this.handleKeyMap(event);
                  }
                  else {
                      _this.preventDefaultEditableShortCuts(event);
                  }
              }
              if (_this.isLimited(1, event)) {
                  return false;
              }
          }).on('keyup', function (event) {
              _this.setLastRange();
              _this.context.triggerEvent('keyup', event);
          }).on('focus', function (event) {
              _this.setLastRange();
              _this.context.triggerEvent('focus', event);
          }).on('blur', function (event) {
              _this.context.triggerEvent('blur', event);
          }).on('mousedown', function (event) {
              _this.context.triggerEvent('mousedown', event);
          }).on('mouseup', function (event) {
              _this.setLastRange();
              _this.context.triggerEvent('mouseup', event);
          }).on('scroll', function (event) {
              _this.context.triggerEvent('scroll', event);
          }).on('paste', function (event) {
              _this.setLastRange();
              _this.context.triggerEvent('paste', event);
          });
          this.$editable.attr('spellcheck', this.options.spellCheck);
          // init content before set event
          this.$editable.html(dom.html(this.$note) || dom.emptyPara);
          this.$editable.on(env.inputEventName, func.debounce(function () {
              _this.context.triggerEvent('change', _this.$editable.html(), _this.$editable);
          }, 10));
          this.$editor.on('focusin', function (event) {
              _this.context.triggerEvent('focusin', event);
          }).on('focusout', function (event) {
              _this.context.triggerEvent('focusout', event);
          });
          if (!this.options.airMode) {
              if (this.options.width) {
                  this.$editor.outerWidth(this.options.width);
              }
              if (this.options.height) {
                  this.$editable.outerHeight(this.options.height);
              }
              if (this.options.maxHeight) {
                  this.$editable.css('max-height', this.options.maxHeight);
              }
              if (this.options.minHeight) {
                  this.$editable.css('min-height', this.options.minHeight);
              }
          }
          this.history.recordUndo();
          this.setLastRange();
      };
      Editor.prototype.destroy = function () {
          this.$editable.off();
      };
      Editor.prototype.handleKeyMap = function (event) {
          var keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];
          var keys = [];
          if (event.metaKey) {
              keys.push('CMD');
          }
          if (event.ctrlKey && !event.altKey) {
              keys.push('CTRL');
          }
          if (event.shiftKey) {
              keys.push('SHIFT');
          }
          var keyName = key.nameFromCode[event.keyCode];
          if (keyName) {
              keys.push(keyName);
          }
          var eventName = keyMap[keys.join('+')];
          if (eventName) {
              if (this.context.invoke(eventName) !== false) {
                  event.preventDefault();
              }
          }
          else if (key.isEdit(event.keyCode)) {
              this.afterCommand();
          }
      };
      Editor.prototype.preventDefaultEditableShortCuts = function (event) {
          // B(Bold, 66) / I(Italic, 73) / U(Underline, 85)
          if ((event.ctrlKey || event.metaKey) &&
              lists.contains([66, 73, 85], event.keyCode)) {
              event.preventDefault();
          }
      };
      Editor.prototype.isLimited = function (pad, event) {
          pad = pad || 0;
          if (typeof event !== 'undefined') {
              if (key.isMove(event.keyCode) ||
                  (event.ctrlKey || event.metaKey) ||
                  lists.contains([key.code.BACKSPACE, key.code.DELETE], event.keyCode)) {
                  return false;
              }
          }
          if (this.options.maxTextLength > 0) {
              if ((this.$editable.text().length + pad) >= this.options.maxTextLength) {
                  return true;
              }
          }
          return false;
      };
      /**
       * create range
       * @return {WrappedRange}
       */
      Editor.prototype.createRange = function () {
          this.focus();
          this.setLastRange();
          return this.getLastRange();
      };
      Editor.prototype.setLastRange = function () {
          this.lastRange = range.create(this.editable);
      };
      Editor.prototype.getLastRange = function () {
          if (!this.lastRange) {
              this.setLastRange();
          }
          return this.lastRange;
      };
      /**
       * saveRange
       *
       * save current range
       *
       * @param {Boolean} [thenCollapse=false]
       */
      Editor.prototype.saveRange = function (thenCollapse) {
          if (thenCollapse) {
              this.getLastRange().collapse().select();
          }
      };
      /**
       * restoreRange
       *
       * restore lately range
       */
      Editor.prototype.restoreRange = function () {
          if (this.lastRange) {
              this.lastRange.select();
              this.focus();
          }
      };
      Editor.prototype.saveTarget = function (node) {
          this.$editable.data('target', node);
      };
      Editor.prototype.clearTarget = function () {
          this.$editable.removeData('target');
      };
      Editor.prototype.restoreTarget = function () {
          return this.$editable.data('target');
      };
      /**
       * currentStyle
       *
       * current style
       * @return {Object|Boolean} unfocus
       */
      Editor.prototype.currentStyle = function () {
          var rng = range.create();
          if (rng) {
              rng = rng.normalize();
          }
          return rng ? this.style.current(rng) : this.style.fromNode(this.$editable);
      };
      /**
       * style from node
       *
       * @param {jQuery} $node
       * @return {Object}
       */
      Editor.prototype.styleFromNode = function ($node) {
          return this.style.fromNode($node);
      };
      /**
       * undo
       */
      Editor.prototype.undo = function () {
          this.context.triggerEvent('before.command', this.$editable.html());
          this.history.undo();
          this.context.triggerEvent('change', this.$editable.html(), this.$editable);
      };
      /*
      * commit
      */
      Editor.prototype.commit = function () {
          this.context.triggerEvent('before.command', this.$editable.html());
          this.history.commit();
          this.context.triggerEvent('change', this.$editable.html(), this.$editable);
      };
      /**
       * redo
       */
      Editor.prototype.redo = function () {
          this.context.triggerEvent('before.command', this.$editable.html());
          this.history.redo();
          this.context.triggerEvent('change', this.$editable.html(), this.$editable);
      };
      /**
       * before command
       */
      Editor.prototype.beforeCommand = function () {
          this.context.triggerEvent('before.command', this.$editable.html());
          // keep focus on editable before command execution
          this.focus();
      };
      /**
       * after command
       * @param {Boolean} isPreventTrigger
       */
      Editor.prototype.afterCommand = function (isPreventTrigger) {
          this.normalizeContent();
          this.history.recordUndo();
          if (!isPreventTrigger) {
              this.context.triggerEvent('change', this.$editable.html(), this.$editable);
          }
      };
      /**
       * handle tab key
       */
      Editor.prototype.tab = function () {
          var rng = this.getLastRange();
          if (rng.isCollapsed() && rng.isOnCell()) {
              this.table.tab(rng);
          }
          else {
              if (this.options.tabSize === 0) {
                  return false;
              }
              if (!this.isLimited(this.options.tabSize)) {
                  this.beforeCommand();
                  this.typing.insertTab(rng, this.options.tabSize);
                  this.afterCommand();
              }
          }
      };
      /**
       * handle shift+tab key
       */
      Editor.prototype.untab = function () {
          var rng = this.getLastRange();
          if (rng.isCollapsed() && rng.isOnCell()) {
              this.table.tab(rng, true);
          }
          else {
              if (this.options.tabSize === 0) {
                  return false;
              }
          }
      };
      /**
       * run given function between beforeCommand and afterCommand
       */
      Editor.prototype.wrapCommand = function (fn) {
          return function () {
              this.beforeCommand();
              fn.apply(this, arguments);
              this.afterCommand();
          };
      };
      /**
       * insert image
       *
       * @param {String} src
       * @param {String|Function} param
       * @return {Promise}
       */
      Editor.prototype.insertImage = function (src, param) {
          var _this = this;
          return createImage(src, param).then(function ($image) {
              _this.beforeCommand();
              if (typeof param === 'function') {
                  param($image);
              }
              else {
                  if (typeof param === 'string') {
                      $image.attr('data-filename', param);
                  }
                  $image.css('width', Math.min(_this.$editable.width(), $image.width()));
              }
              $image.show();
              range.create(_this.editable).insertNode($image[0]);
              range.createFromNodeAfter($image[0]).select();
              _this.setLastRange();
              _this.afterCommand();
          }).fail(function (e) {
              _this.context.triggerEvent('image.upload.error', e);
          });
      };
      /**
       * insertImages
       * @param {File[]} files
       */
      Editor.prototype.insertImagesAsDataURL = function (files) {
          var _this = this;
          $$1.each(files, function (idx, file) {
              var filename = file.name;
              if (_this.options.maximumImageFileSize && _this.options.maximumImageFileSize < file.size) {
                  _this.context.triggerEvent('image.upload.error', _this.lang.image.maximumFileSizeError);
              }
              else {
                  readFileAsDataURL(file).then(function (dataURL) {
                      return _this.insertImage(dataURL, filename);
                  }).fail(function () {
                      _this.context.triggerEvent('image.upload.error');
                  });
              }
          });
      };
      /**
       * insertImagesOrCallback
       * @param {File[]} files
       */
      Editor.prototype.insertImagesOrCallback = function (files) {
          var callbacks = this.options.callbacks;
          // If onImageUpload set,
          if (callbacks.onImageUpload) {
              this.context.triggerEvent('image.upload', files);
              // else insert Image as dataURL
          }
          else {
              this.insertImagesAsDataURL(files);
          }
      };
      /**
       * return selected plain text
       * @return {String} text
       */
      Editor.prototype.getSelectedText = function () {
          var rng = this.getLastRange();
          // if range on anchor, expand range with anchor
          if (rng.isOnAnchor()) {
              rng = range.createFromNode(dom.ancestor(rng.sc, dom.isAnchor));
          }
          return rng.toString();
      };
      Editor.prototype.onFormatBlock = function (tagName, $target) {
          // [workaround] for MSIE, IE need `<`
          document.execCommand('FormatBlock', false, env.isMSIE ? '<' + tagName + '>' : tagName);
          // support custom class
          if ($target && $target.length) {
              // find the exact element has given tagName
              if ($target[0].tagName.toUpperCase() !== tagName.toUpperCase()) {
                  $target = $target.find(tagName);
              }
              if ($target && $target.length) {
                  var className = $target[0].className || '';
                  if (className) {
                      var currentRange = this.createRange();
                      var $parent = $$1([currentRange.sc, currentRange.ec]).closest(tagName);
                      $parent.addClass(className);
                  }
              }
          }
      };
      Editor.prototype.formatPara = function () {
          this.formatBlock('P');
      };
      Editor.prototype.fontStyling = function (target, value) {
          var rng = this.getLastRange();
          if (rng) {
              var spans = this.style.styleNodes(rng);
              $$1(spans).css(target, value);
              // [workaround] added styled bogus span for style
              //  - also bogus character needed for cursor position
              if (rng.isCollapsed()) {
                  var firstSpan = lists.head(spans);
                  if (firstSpan && !dom.nodeLength(firstSpan)) {
                      firstSpan.innerHTML = dom.ZERO_WIDTH_NBSP_CHAR;
                      range.createFromNodeAfter(firstSpan.firstChild).select();
                      this.setLastRange();
                      this.$editable.data(KEY_BOGUS, firstSpan);
                  }
              }
          }
      };
      /**
       * unlink
       *
       * @type command
       */
      Editor.prototype.unlink = function () {
          var rng = this.getLastRange();
          if (rng.isOnAnchor()) {
              var anchor = dom.ancestor(rng.sc, dom.isAnchor);
              rng = range.createFromNode(anchor);
              rng.select();
              this.setLastRange();
              this.beforeCommand();
              document.execCommand('unlink');
              this.afterCommand();
          }
      };
      /**
       * returns link info
       *
       * @return {Object}
       * @return {WrappedRange} return.range
       * @return {String} return.text
       * @return {Boolean} [return.isNewWindow=true]
       * @return {String} [return.url=""]
       */
      Editor.prototype.getLinkInfo = function () {
          var rng = this.getLastRange().expand(dom.isAnchor);
          // Get the first anchor on range(for edit).
          var $anchor = $$1(lists.head(rng.nodes(dom.isAnchor)));
          var linkInfo = {
              range: rng,
              text: rng.toString(),
              url: $anchor.length ? $anchor.attr('href') : ''
          };
          // When anchor exists,
          if ($anchor.length) {
              // Set isNewWindow by checking its target.
              linkInfo.isNewWindow = $anchor.attr('target') === '_blank';
          }
          return linkInfo;
      };
      Editor.prototype.addRow = function (position) {
          var rng = this.getLastRange(this.$editable);
          if (rng.isCollapsed() && rng.isOnCell()) {
              this.beforeCommand();
              this.table.addRow(rng, position);
              this.afterCommand();
          }
      };
      Editor.prototype.addCol = function (position) {
          var rng = this.getLastRange(this.$editable);
          if (rng.isCollapsed() && rng.isOnCell()) {
              this.beforeCommand();
              this.table.addCol(rng, position);
              this.afterCommand();
          }
      };
      Editor.prototype.deleteRow = function () {
          var rng = this.getLastRange(this.$editable);
          if (rng.isCollapsed() && rng.isOnCell()) {
              this.beforeCommand();
              this.table.deleteRow(rng);
              this.afterCommand();
          }
      };
      Editor.prototype.deleteCol = function () {
          var rng = this.getLastRange(this.$editable);
          if (rng.isCollapsed() && rng.isOnCell()) {
              this.beforeCommand();
              this.table.deleteCol(rng);
              this.afterCommand();
          }
      };
      Editor.prototype.deleteTable = function () {
          var rng = this.getLastRange(this.$editable);
          if (rng.isCollapsed() && rng.isOnCell()) {
              this.beforeCommand();
              this.table.deleteTable(rng);
              this.afterCommand();
          }
      };
      /**
       * @param {Position} pos
       * @param {jQuery} $target - target element
       * @param {Boolean} [bKeepRatio] - keep ratio
       */
      Editor.prototype.resizeTo = function (pos, $target, bKeepRatio) {
          var imageSize;
          if (bKeepRatio) {
              var newRatio = pos.y / pos.x;
              var ratio = $target.data('ratio');
              imageSize = {
                  width: ratio > newRatio ? pos.x : pos.y / ratio,
                  height: ratio > newRatio ? pos.x * ratio : pos.y
              };
          }
          else {
              imageSize = {
                  width: pos.x,
                  height: pos.y
              };
          }
          $target.css(imageSize);
      };
      /**
       * returns whether editable area has focus or not.
       */
      Editor.prototype.hasFocus = function () {
          return this.$editable.is(':focus');
      };
      /**
       * set focus
       */
      Editor.prototype.focus = function () {
          // [workaround] Screen will move when page is scolled in IE.
          //  - do focus when not focused
          if (!this.hasFocus()) {
              this.$editable.focus();
          }
      };
      /**
       * returns whether contents is empty or not.
       * @return {Boolean}
       */
      Editor.prototype.isEmpty = function () {
          return dom.isEmpty(this.$editable[0]) || dom.emptyPara === this.$editable.html();
      };
      /**
       * Removes all contents and restores the editable instance to an _emptyPara_.
       */
      Editor.prototype.empty = function () {
          this.context.invoke('code', dom.emptyPara);
      };
      /**
       * normalize content
       */
      Editor.prototype.normalizeContent = function () {
          this.$editable[0].normalize();
      };
      return Editor;
  }());

  var Clipboard = /** @class */ (function () {
      function Clipboard(context) {
          this.context = context;
          this.$editable = context.layoutInfo.editable;
      }
      Clipboard.prototype.initialize = function () {
          this.$editable.on('paste', this.pasteByEvent.bind(this));
      };
      /**
       * paste by clipboard event
       *
       * @param {Event} event
       */
      Clipboard.prototype.pasteByEvent = function (event) {
          var clipboardData = event.originalEvent.clipboardData;
          if (clipboardData && clipboardData.items && clipboardData.items.length) {
              // paste img file
              var item = clipboardData.items.length > 1 ? clipboardData.items[1] : lists.head(clipboardData.items);
              if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {
                  this.context.invoke('editor.insertImagesOrCallback', [item.getAsFile()]);
              }
              this.context.invoke('editor.afterCommand');
          }
      };
      return Clipboard;
  }());

  var Dropzone = /** @class */ (function () {
      function Dropzone(context) {
          this.context = context;
          this.$eventListener = $$1(document);
          this.$editor = context.layoutInfo.editor;
          this.$editable = context.layoutInfo.editable;
          this.options = context.options;
          this.lang = this.options.langInfo;
          this.documentEventHandlers = {};
          this.$dropzone = $$1([
              '<div class="note-dropzone">',
              '  <div class="note-dropzone-message"/>',
              '</div>',
          ].join('')).prependTo(this.$editor);
      }
      /**
       * attach Drag and Drop Events
       */
      Dropzone.prototype.initialize = function () {
          if (this.options.disableDragAndDrop) {
              // prevent default drop event
              this.documentEventHandlers.onDrop = function (e) {
                  e.preventDefault();
              };
              // do not consider outside of dropzone
              this.$eventListener = this.$dropzone;
              this.$eventListener.on('drop', this.documentEventHandlers.onDrop);
          }
          else {
              this.attachDragAndDropEvent();
          }
      };
      /**
       * attach Drag and Drop Events
       */
      Dropzone.prototype.attachDragAndDropEvent = function () {
          var _this = this;
          var collection = $$1();
          var $dropzoneMessage = this.$dropzone.find('.note-dropzone-message');
          this.documentEventHandlers.onDragenter = function (e) {
              var isCodeview = _this.context.invoke('codeview.isActivated');
              var hasEditorSize = _this.$editor.width() > 0 && _this.$editor.height() > 0;
              if (!isCodeview && !collection.length && hasEditorSize) {
                  _this.$editor.addClass('dragover');
                  _this.$dropzone.width(_this.$editor.width());
                  _this.$dropzone.height(_this.$editor.height());
                  $dropzoneMessage.text(_this.lang.image.dragImageHere);
              }
              collection = collection.add(e.target);
          };
          this.documentEventHandlers.onDragleave = function (e) {
              collection = collection.not(e.target);
              if (!collection.length) {
                  _this.$editor.removeClass('dragover');
              }
          };
          this.documentEventHandlers.onDrop = function () {
              collection = $$1();
              _this.$editor.removeClass('dragover');
          };
          // show dropzone on dragenter when dragging a object to document
          // -but only if the editor is visible, i.e. has a positive width and height
          this.$eventListener.on('dragenter', this.documentEventHandlers.onDragenter)
              .on('dragleave', this.documentEventHandlers.onDragleave)
              .on('drop', this.documentEventHandlers.onDrop);
          // change dropzone's message on hover.
          this.$dropzone.on('dragenter', function () {
              _this.$dropzone.addClass('hover');
              $dropzoneMessage.text(_this.lang.image.dropImage);
          }).on('dragleave', function () {
              _this.$dropzone.removeClass('hover');
              $dropzoneMessage.text(_this.lang.image.dragImageHere);
          });
          // attach dropImage
          this.$dropzone.on('drop', function (event) {
              var dataTransfer = event.originalEvent.dataTransfer;
              // stop the browser from opening the dropped content
              event.preventDefault();
              if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
                  _this.$editable.focus();
                  _this.context.invoke('editor.insertImagesOrCallback', dataTransfer.files);
              }
              else {
                  $$1.each(dataTransfer.types, function (idx, type) {
                      var content = dataTransfer.getData(type);
                      if (type.toLowerCase().indexOf('text') > -1) {
                          _this.context.invoke('editor.pasteHTML', content);
                      }
                      else {
                          $$1(content).each(function (idx, item) {
                              _this.context.invoke('editor.insertNode', item);
                          });
                      }
                  });
              }
          }).on('dragover', false); // prevent default dragover event
      };
      Dropzone.prototype.destroy = function () {
          var _this = this;
          Object.keys(this.documentEventHandlers).forEach(function (key) {
              _this.$eventListener.off(key.substr(2).toLowerCase(), _this.documentEventHandlers[key]);
          });
          this.documentEventHandlers = {};
      };
      return Dropzone;
  }());

  var CodeMirror;
  if (env.hasCodeMirror) {
      CodeMirror = window.CodeMirror;
  }
  /**
   * @class Codeview
   */
  var CodeView = /** @class */ (function () {
      function CodeView(context) {
          this.context = context;
          this.$editor = context.layoutInfo.editor;
          this.$editable = context.layoutInfo.editable;
          this.$codable = context.layoutInfo.codable;
          this.options = context.options;
      }
      CodeView.prototype.sync = function () {
          var isCodeview = this.isActivated();
          if (isCodeview && env.hasCodeMirror) {
              this.$codable.data('cmEditor').save();
          }
      };
      /**
       * @return {Boolean}
       */
      CodeView.prototype.isActivated = function () {
          return this.$editor.hasClass('codeview');
      };
      /**
       * toggle codeview
       */
      CodeView.prototype.toggle = function () {
          if (this.isActivated()) {
              this.deactivate();
          }
          else {
              this.activate();
          }
          this.context.triggerEvent('codeview.toggled');
      };
      /**
       * purify input value
       * @param value
       * @returns {*}
       */
      CodeView.prototype.purify = function (value) {
          if (this.options.codeviewFilter) {
              // filter code view regex
              value = value.replace(this.options.codeviewFilterRegex, '');
              // allow specific iframe tag
              if (this.options.codeviewIframeFilter) {
                  var whitelist_1 = this.options.codeviewIframeWhitelistSrc.concat(this.options.codeviewIframeWhitelistSrcBase);
                  value = value.replace(/(<iframe.*?>.*?(?:<\/iframe>)?)/gi, function (tag) {
                      // remove if src attribute is duplicated
                      if (/<.+src(?==?('|"|\s)?)[\s\S]+src(?=('|"|\s)?)[^>]*?>/i.test(tag)) {
                          return '';
                      }
                      for (var _i = 0, whitelist_2 = whitelist_1; _i < whitelist_2.length; _i++) {
                          var src = whitelist_2[_i];
                          // pass if src is trusted
                          if ((new RegExp('src="(https?:)?\/\/' + src.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\/(.+)"')).test(tag)) {
                              return tag;
                          }
                      }
                      return '';
                  });
              }
          }
          return value;
      };
      /**
       * activate code view
       */
      CodeView.prototype.activate = function () {
          var _this = this;
          this.$codable.val(dom.html(this.$editable, this.options.prettifyHtml));
          this.$codable.height(this.$editable.height());
          this.context.invoke('toolbar.updateCodeview', true);
          this.$editor.addClass('codeview');
          this.$codable.focus();
          // activate CodeMirror as codable
          if (env.hasCodeMirror) {
              var cmEditor_1 = CodeMirror.fromTextArea(this.$codable[0], this.options.codemirror);
              // CodeMirror TernServer
              if (this.options.codemirror.tern) {
                  var server_1 = new CodeMirror.TernServer(this.options.codemirror.tern);
                  cmEditor_1.ternServer = server_1;
                  cmEditor_1.on('cursorActivity', function (cm) {
                      server_1.updateArgHints(cm);
                  });
              }
              cmEditor_1.on('blur', function (event) {
                  _this.context.triggerEvent('blur.codeview', cmEditor_1.getValue(), event);
              });
              cmEditor_1.on('change', function (event) {
                  _this.context.triggerEvent('change.codeview', cmEditor_1.getValue(), cmEditor_1);
              });
              // CodeMirror hasn't Padding.
              cmEditor_1.setSize(null, this.$editable.outerHeight());
              this.$codable.data('cmEditor', cmEditor_1);
          }
          else {
              this.$codable.on('blur', function (event) {
                  _this.context.triggerEvent('blur.codeview', _this.$codable.val(), event);
              });
              this.$codable.on('input', function (event) {
                  _this.context.triggerEvent('change.codeview', _this.$codable.val(), _this.$codable);
              });
          }
      };
      /**
       * deactivate code view
       */
      CodeView.prototype.deactivate = function () {
          // deactivate CodeMirror as codable
          if (env.hasCodeMirror) {
              var cmEditor = this.$codable.data('cmEditor');
              this.$codable.val(cmEditor.getValue());
              cmEditor.toTextArea();
          }
          var value = this.purify(dom.value(this.$codable, this.options.prettifyHtml) || dom.emptyPara);
          var isChange = this.$editable.html() !== value;
          this.$editable.html(value);
          this.$editable.height(this.options.height ? this.$codable.height() : 'auto');
          this.$editor.removeClass('codeview');
          if (isChange) {
              this.context.triggerEvent('change', this.$editable.html(), this.$editable);
          }
          this.$editable.focus();
          this.context.invoke('toolbar.updateCodeview', false);
      };
      CodeView.prototype.destroy = function () {
          if (this.isActivated()) {
              this.deactivate();
          }
      };
      return CodeView;
  }());

  var EDITABLE_PADDING = 24;
  var Statusbar = /** @class */ (function () {
      function Statusbar(context) {
          this.$document = $$1(document);
          this.$statusbar = context.layoutInfo.statusbar;
          this.$editable = context.layoutInfo.editable;
          this.options = context.options;
      }
      Statusbar.prototype.initialize = function () {
          var _this = this;
          if (this.options.airMode || this.options.disableResizeEditor) {
              this.destroy();
              return;
          }
          this.$statusbar.on('mousedown', function (event) {
              event.preventDefault();
              event.stopPropagation();
              var editableTop = _this.$editable.offset().top - _this.$document.scrollTop();
              var onMouseMove = function (event) {
                  var height = event.clientY - (editableTop + EDITABLE_PADDING);
                  height = (_this.options.minheight > 0) ? Math.max(height, _this.options.minheight) : height;
                  height = (_this.options.maxHeight > 0) ? Math.min(height, _this.options.maxHeight) : height;
                  _this.$editable.height(height);
              };
              _this.$document.on('mousemove', onMouseMove).one('mouseup', function () {
                  _this.$document.off('mousemove', onMouseMove);
              });
          });
      };
      Statusbar.prototype.destroy = function () {
          this.$statusbar.off();
          this.$statusbar.addClass('locked');
      };
      return Statusbar;
  }());

  var Fullscreen = /** @class */ (function () {
      function Fullscreen(context) {
          var _this = this;
          this.context = context;
          this.$editor = context.layoutInfo.editor;
          this.$toolbar = context.layoutInfo.toolbar;
          this.$editable = context.layoutInfo.editable;
          this.$codable = context.layoutInfo.codable;
          this.$window = $$1(window);
          this.$scrollbar = $$1('html, body');
          this.onResize = function () {
              _this.resizeTo({
                  h: _this.$window.height() - _this.$toolbar.outerHeight()
              });
          };
      }
      Fullscreen.prototype.resizeTo = function (size) {
          this.$editable.css('height', size.h);
          this.$codable.css('height', size.h);
          if (this.$codable.data('cmeditor')) {
              this.$codable.data('cmeditor').setsize(null, size.h);
          }
      };
      /**
       * toggle fullscreen
       */
      Fullscreen.prototype.toggle = function () {
          this.$editor.toggleClass('fullscreen');
          if (this.isFullscreen()) {
              this.$editable.data('orgHeight', this.$editable.css('height'));
              this.$editable.data('orgMaxHeight', this.$editable.css('maxHeight'));
              this.$editable.css('maxHeight', '');
              this.$window.on('resize', this.onResize).trigger('resize');
              this.$scrollbar.css('overflow', 'hidden');
          }
          else {
              this.$window.off('resize', this.onResize);
              this.resizeTo({ h: this.$editable.data('orgHeight') });
              this.$editable.css('maxHeight', this.$editable.css('orgMaxHeight'));
              this.$scrollbar.css('overflow', 'visible');
          }
          this.context.invoke('toolbar.updateFullscreen', this.isFullscreen());
      };
      Fullscreen.prototype.isFullscreen = function () {
          return this.$editor.hasClass('fullscreen');
      };
      return Fullscreen;
  }());

  var Handle = /** @class */ (function () {
      function Handle(context) {
          var _this = this;
          this.context = context;
          this.$document = $$1(document);
          this.$editingArea = context.layoutInfo.editingArea;
          this.options = context.options;
          this.lang = this.options.langInfo;
          this.events = {
              'summernote.mousedown': function (we, e) {
                  if (_this.update(e.target, e)) {
                      e.preventDefault();
                  }
              },
              'summernote.keyup summernote.scroll summernote.change summernote.dialog.shown': function () {
                  _this.update();
              },
              'summernote.disable': function () {
                  _this.hide();
              },
              'summernote.codeview.toggled': function () {
                  _this.update();
              }
          };
      }
      Handle.prototype.initialize = function () {
          var _this = this;
          this.$handle = $$1([
              '<div class="note-handle">',
              '<div class="note-control-selection">',
              '<div class="note-control-selection-bg"></div>',
              '<div class="note-control-holder note-control-nw"></div>',
              '<div class="note-control-holder note-control-ne"></div>',
              '<div class="note-control-holder note-control-sw"></div>',
              '<div class="',
              (this.options.disableResizeImage ? 'note-control-holder' : 'note-control-sizing'),
              ' note-control-se"></div>',
              (this.options.disableResizeImage ? '' : '<div class="note-control-selection-info"></div>'),
              '</div>',
              '</div>',
          ].join('')).prependTo(this.$editingArea);
          this.$handle.on('mousedown', function (event) {
              if (dom.isControlSizing(event.target)) {
                  event.preventDefault();
                  event.stopPropagation();
                  var $target_1 = _this.$handle.find('.note-control-selection').data('target');
                  var posStart_1 = $target_1.offset();
                  var scrollTop_1 = _this.$document.scrollTop();
                  var onMouseMove_1 = function (event) {
                      _this.context.invoke('editor.resizeTo', {
                          x: event.clientX - posStart_1.left,
                          y: event.clientY - (posStart_1.top - scrollTop_1)
                      }, $target_1, !event.shiftKey);
                      _this.update($target_1[0]);
                  };
                  _this.$document
                      .on('mousemove', onMouseMove_1)
                      .one('mouseup', function (e) {
                      e.preventDefault();
                      _this.$document.off('mousemove', onMouseMove_1);
                      _this.context.invoke('editor.afterCommand');
                  });
                  if (!$target_1.data('ratio')) { // original ratio.
                      $target_1.data('ratio', $target_1.height() / $target_1.width());
                  }
              }
          });
          // Listen for scrolling on the handle overlay.
          this.$handle.on('wheel', function (e) {
              e.preventDefault();
              _this.update();
          });
      };
      Handle.prototype.destroy = function () {
          this.$handle.remove();
      };
      Handle.prototype.update = function (target, event) {
          if (this.context.isDisabled()) {
              return false;
          }
          var isImage = dom.isImg(target);
          var $selection = this.$handle.find('.note-control-selection');
          this.context.invoke('imagePopover.update', target, event);
          if (isImage) {
              var $image = $$1(target);
              var position = $image.position();
              var pos = {
                  left: position.left + parseInt($image.css('marginLeft'), 10),
                  top: position.top + parseInt($image.css('marginTop'), 10)
              };
              // exclude margin
              var imageSize = {
                  w: $image.outerWidth(false),
                  h: $image.outerHeight(false)
              };
              $selection.css({
                  display: 'block',
                  left: pos.left,
                  top: pos.top,
                  width: imageSize.w,
                  height: imageSize.h
              }).data('target', $image); // save current image element.
              var origImageObj = new Image();
              origImageObj.src = $image.attr('src');
              var sizingText = imageSize.w + 'x' + imageSize.h + ' (' + this.lang.image.original + ': ' + origImageObj.width + 'x' + origImageObj.height + ')';
              $selection.find('.note-control-selection-info').text(sizingText);
              this.context.invoke('editor.saveTarget', target);
          }
          else {
              this.hide();
          }
          return isImage;
      };
      /**
       * hide
       *
       * @param {jQuery} $handle
       */
      Handle.prototype.hide = function () {
          this.context.invoke('editor.clearTarget');
          this.$handle.children().hide();
      };
      return Handle;
  }());

  var defaultScheme = 'http://';
  var linkPattern = /^([A-Za-z][A-Za-z0-9+-.]*\:[\/]{2}|mailto:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i;
  var AutoLink = /** @class */ (function () {
      function AutoLink(context) {
          var _this = this;
          this.context = context;
          this.events = {
              'summernote.keyup': function (we, e) {
                  if (!e.isDefaultPrevented()) {
                      _this.handleKeyup(e);
                  }
              },
              'summernote.keydown': function (we, e) {
                  _this.handleKeydown(e);
              }
          };
      }
      AutoLink.prototype.initialize = function () {
          this.lastWordRange = null;
      };
      AutoLink.prototype.destroy = function () {
          this.lastWordRange = null;
      };
      AutoLink.prototype.replace = function () {
          if (!this.lastWordRange) {
              return;
          }
          var keyword = this.lastWordRange.toString();
          var match = keyword.match(linkPattern);
          if (match && (match[1] || match[2])) {
              var link = match[1] ? keyword : defaultScheme + keyword;
              var node = $$1('<a />').html(keyword).attr('href', link)[0];
              if (this.context.options.linkTargetBlank) {
                  $$1(node).attr('target', '_blank');
              }
              this.lastWordRange.insertNode(node);
              this.lastWordRange = null;
              this.context.invoke('editor.focus');
          }
      };
      AutoLink.prototype.handleKeydown = function (e) {
          if (lists.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) {
              var wordRange = this.context.invoke('editor.createRange').getWordRange();
              this.lastWordRange = wordRange;
          }
      };
      AutoLink.prototype.handleKeyup = function (e) {
          if (lists.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) {
              this.replace();
          }
      };
      return AutoLink;
  }());

  /**
   * textarea auto sync.
   */
  var AutoSync = /** @class */ (function () {
      function AutoSync(context) {
          var _this = this;
          this.$note = context.layoutInfo.note;
          this.events = {
              'summernote.change': function () {
                  _this.$note.val(context.invoke('code'));
              }
          };
      }
      AutoSync.prototype.shouldInitialize = function () {
          return dom.isTextarea(this.$note[0]);
      };
      return AutoSync;
  }());

  var AutoReplace = /** @class */ (function () {
      function AutoReplace(context) {
          var _this = this;
          this.context = context;
          this.options = context.options.replace || {};
          this.keys = [key.code.ENTER, key.code.SPACE, key.code.PERIOD, key.code.COMMA, key.code.SEMICOLON, key.code.SLASH];
          this.previousKeydownCode = null;
          this.events = {
              'summernote.keyup': function (we, e) {
                  if (!e.isDefaultPrevented()) {
                      _this.handleKeyup(e);
                  }
              },
              'summernote.keydown': function (we, e) {
                  _this.handleKeydown(e);
              }
          };
      }
      AutoReplace.prototype.shouldInitialize = function () {
          return !!this.options.match;
      };
      AutoReplace.prototype.initialize = function () {
          this.lastWord = null;
      };
      AutoReplace.prototype.destroy = function () {
          this.lastWord = null;
      };
      AutoReplace.prototype.replace = function () {
          if (!this.lastWord) {
              return;
          }
          var self = this;
          var keyword = this.lastWord.toString();
          this.options.match(keyword, function (match) {
              if (match) {
                  var node = '';
                  if (typeof match === 'string') {
                      node = dom.createText(match);
                  }
                  else if (match instanceof jQuery) {
                      node = match[0];
                  }
                  else if (match instanceof Node) {
                      node = match;
                  }
                  if (!node)
                      return;
                  self.lastWord.insertNode(node);
                  self.lastWord = null;
                  self.context.invoke('editor.focus');
              }
          });
      };
      AutoReplace.prototype.handleKeydown = function (e) {
          // this forces it to remember the last whole word, even if multiple termination keys are pressed
          // before the previous key is let go.
          if (this.previousKeydownCode && lists.contains(this.keys, this.previousKeydownCode)) {
              this.previousKeydownCode = e.keyCode;
              return;
          }
          if (lists.contains(this.keys, e.keyCode)) {
              var wordRange = this.context.invoke('editor.createRange').getWordRange();
              this.lastWord = wordRange;
          }
          this.previousKeydownCode = e.keyCode;
      };
      AutoReplace.prototype.handleKeyup = function (e) {
          if (lists.contains(this.keys, e.keyCode)) {
              this.replace();
          }
      };
      return AutoReplace;
  }());

  var Placeholder = /** @class */ (function () {
      function Placeholder(context) {
          var _this = this;
          this.context = context;
          this.$editingArea = context.layoutInfo.editingArea;
          this.options = context.options;
          this.events = {
              'summernote.init summernote.change': function () {
                  _this.update();
              },
              'summernote.codeview.toggled': function () {
                  _this.update();
              }
          };
      }
      Placeholder.prototype.shouldInitialize = function () {
          return !!this.options.placeholder;
      };
      Placeholder.prototype.initialize = function () {
          var _this = this;
          this.$placeholder = $$1('<div class="note-placeholder">');
          this.$placeholder.on('click', function () {
              _this.context.invoke('focus');
          }).html(this.options.placeholder).prependTo(this.$editingArea);
          this.update();
      };
      Placeholder.prototype.destroy = function () {
          this.$placeholder.remove();
      };
      Placeholder.prototype.update = function () {
          var isShow = !this.context.invoke('codeview.isActivated') && this.context.invoke('editor.isEmpty');
          this.$placeholder.toggle(isShow);
      };
      return Placeholder;
  }());

  var Buttons = /** @class */ (function () {
      function Buttons(context) {
          this.ui = $$1.summernote.ui;
          this.context = context;
          this.$toolbar = context.layoutInfo.toolbar;
          this.options = context.options;
          this.lang = this.options.langInfo;
          this.invertedKeyMap = func.invertObject(this.options.keyMap[env.isMac ? 'mac' : 'pc']);
      }
      Buttons.prototype.representShortcut = function (editorMethod) {
          var shortcut = this.invertedKeyMap[editorMethod];
          if (!this.options.shortcuts || !shortcut) {
              return '';
          }
          if (env.isMac) {
              shortcut = shortcut.replace('CMD', '⌘').replace('SHIFT', '⇧');
          }
          shortcut = shortcut.replace('BACKSLASH', '\\')
              .replace('SLASH', '/')
              .replace('LEFTBRACKET', '[')
              .replace('RIGHTBRACKET', ']');
          return ' (' + shortcut + ')';
      };
      Buttons.prototype.button = function (o) {
          if (!this.options.tooltip && o.tooltip) {
              delete o.tooltip;
          }
          o.container = this.options.container;
          return this.ui.button(o);
      };
      Buttons.prototype.initialize = function () {
          this.addToolbarButtons();
          this.addImagePopoverButtons();
          this.addLinkPopoverButtons();
          this.addTablePopoverButtons();
          this.fontInstalledMap = {};
      };
      Buttons.prototype.destroy = function () {
          delete this.fontInstalledMap;
      };
      Buttons.prototype.isFontInstalled = function (name) {
          if (!this.fontInstalledMap.hasOwnProperty(name)) {
              this.fontInstalledMap[name] = env.isFontInstalled(name) ||
                  lists.contains(this.options.fontNamesIgnoreCheck, name);
          }
          return this.fontInstalledMap[name];
      };
      Buttons.prototype.isFontDeservedToAdd = function (name) {
          var genericFamilies = ['sans-serif', 'serif', 'monospace', 'cursive', 'fantasy'];
          name = name.toLowerCase();
          return (name !== '' && this.isFontInstalled(name) && genericFamilies.indexOf(name) === -1);
      };
      Buttons.prototype.colorPalette = function (className, tooltip, backColor, foreColor) {
          var _this = this;
          return this.ui.buttonGroup({
              className: 'note-color ' + className,
              children: [
                  this.button({
                      className: 'note-current-color-button',
                      contents: this.ui.icon(this.options.icons.font + ' note-recent-color'),
                      tooltip: tooltip,
                      click: function (e) {
                          var $button = $$1(e.currentTarget);
                          if (backColor && foreColor) {
                              _this.context.invoke('editor.color', {
                                  backColor: $button.attr('data-backColor'),
                                  foreColor: $button.attr('data-foreColor')
                              });
                          }
                          else if (backColor) {
                              _this.context.invoke('editor.color', {
                                  backColor: $button.attr('data-backColor')
                              });
                          }
                          else if (foreColor) {
                              _this.context.invoke('editor.color', {
                                  foreColor: $button.attr('data-foreColor')
                              });
                          }
                      },
                      callback: function ($button) {
                          var $recentColor = $button.find('.note-recent-color');
                          if (backColor) {
                              $recentColor.css('background-color', _this.options.colorButton.backColor);
                              $button.attr('data-backColor', _this.options.colorButton.backColor);
                          }
                          if (foreColor) {
                              $recentColor.css('color', _this.options.colorButton.foreColor);
                              $button.attr('data-foreColor', _this.options.colorButton.foreColor);
                          }
                          else {
                              $recentColor.css('color', 'transparent');
                          }
                      }
                  }),
                  this.button({
                      className: 'dropdown-toggle',
                      contents: this.ui.dropdownButtonContents('', this.options),
                      tooltip: this.lang.color.more,
                      data: {
                          toggle: 'dropdown'
                      }
                  }),
                  this.ui.dropdown({
                      items: (backColor ? [
                          '<div class="note-palette">',
                          '  <div class="note-palette-title">' + this.lang.color.background + '</div>',
                          '  <div>',
                          '    <button type="button" class="note-color-reset btn btn-light" data-event="backColor" data-value="inherit">',
                          this.lang.color.transparent,
                          '    </button>',
                          '  </div>',
                          '  <div class="note-holder" data-event="backColor"/>',
                          '  <div>',
                          '    <button type="button" class="note-color-select btn" data-event="openPalette" data-value="backColorPicker">',
                          this.lang.color.cpSelect,
                          '    </button>',
                          '    <input type="color" id="backColorPicker" class="note-btn note-color-select-btn" value="' + this.options.colorButton.backColor + '" data-event="backColorPalette">',
                          '  </div>',
                          '  <div class="note-holder-custom" id="backColorPalette" data-event="backColor"/>',
                          '</div>',
                      ].join('') : '') +
                          (foreColor ? [
                              '<div class="note-palette">',
                              '  <div class="note-palette-title">' + this.lang.color.foreground + '</div>',
                              '  <div>',
                              '    <button type="button" class="note-color-reset btn btn-light" data-event="removeFormat" data-value="foreColor">',
                              this.lang.color.resetToDefault,
                              '    </button>',
                              '  </div>',
                              '  <div class="note-holder" data-event="foreColor"/>',
                              '  <div>',
                              '    <button type="button" class="note-color-select btn" data-event="openPalette" data-value="foreColorPicker">',
                              this.lang.color.cpSelect,
                              '    </button>',
                              '    <input type="color" id="foreColorPicker" class="note-btn note-color-select-btn" value="' + this.options.colorButton.foreColor + '" data-event="foreColorPalette">',
                              '  <div class="note-holder-custom" id="foreColorPalette" data-event="foreColor"/>',
                              '</div>',
                          ].join('') : ''),
                      callback: function ($dropdown) {
                          $dropdown.find('.note-holder').each(function (idx, item) {
                              var $holder = $$1(item);
                              $holder.append(_this.ui.palette({
                                  colors: _this.options.colors,
                                  colorsName: _this.options.colorsName,
                                  eventName: $holder.data('event'),
                                  container: _this.options.container,
                                  tooltip: _this.options.tooltip
                              }).render());
                          });
                          /* TODO: do we have to record recent custom colors within cookies? */
                          var customColors = [
                              ['#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF'],
                          ];
                          $dropdown.find('.note-holder-custom').each(function (idx, item) {
                              var $holder = $$1(item);
                              $holder.append(_this.ui.palette({
                                  colors: customColors,
                                  colorsName: customColors,
                                  eventName: $holder.data('event'),
                                  container: _this.options.container,
                                  tooltip: _this.options.tooltip
                              }).render());
                          });
                          $dropdown.find('input[type=color]').each(function (idx, item) {
                              $$1(item).change(function () {
                                  var $chip = $dropdown.find('#' + $$1(this).data('event')).find('.note-color-btn').first();
                                  var color = this.value.toUpperCase();
                                  $chip.css('background-color', color)
                                      .attr('aria-label', color)
                                      .attr('data-value', color)
                                      .attr('data-original-title', color);
                                  $chip.click();
                              });
                          });
                      },
                      click: function (event) {
                          event.stopPropagation();
                          var $parent = $$1('.' + className);
                          var $button = $$1(event.target);
                          var eventName = $button.data('event');
                          var value = $button.attr('data-value');
                          if (eventName === 'openPalette') {
                              var $picker = $parent.find('#' + value);
                              var $palette = $$1($parent.find('#' + $picker.data('event')).find('.note-color-row')[0]);
                              // Shift palette chips
                              var $chip = $palette.find('.note-color-btn').last().detach();
                              // Set chip attributes
                              var color = $picker.val();
                              $chip.css('background-color', color)
                                  .attr('aria-label', color)
                                  .attr('data-value', color)
                                  .attr('data-original-title', color);
                              $palette.prepend($chip);
                              $picker.click();
                          }
                          else if (lists.contains(['backColor', 'foreColor'], eventName)) {
                              var key = eventName === 'backColor' ? 'background-color' : 'color';
                              var $color = $button.closest('.note-color').find('.note-recent-color');
                              var $currentButton = $button.closest('.note-color').find('.note-current-color-button');
                              $color.css(key, value);
                              $currentButton.attr('data-' + eventName, value);
                              _this.context.invoke('editor.' + eventName, value);
                          }
                      }
                  }),
              ]
          }).render();
      };
      Buttons.prototype.addToolbarButtons = function () {
          var _this = this;
          this.context.memo('button.style', function () {
              return _this.ui.buttonGroup([
                  _this.button({
                      className: 'dropdown-toggle',
                      contents: _this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.magic), _this.options),
                      tooltip: _this.lang.style.style,
                      data: {
                          toggle: 'dropdown'
                      }
                  }),
                  _this.ui.dropdown({
                      className: 'dropdown-style',
                      items: _this.options.styleTags,
                      title: _this.lang.style.style,
                      template: function (item) {
                          if (typeof item === 'string') {
                              item = { tag: item, title: (_this.lang.style.hasOwnProperty(item) ? _this.lang.style[item] : item) };
                          }
                          var tag = item.tag;
                          var title = item.title;
                          var style = item.style ? ' style="' + item.style + '" ' : '';
                          var className = item.className ? ' class="' + item.className + '"' : '';
                          return '<' + tag + style + className + '>' + title + '</' + tag + '>';
                      },
                      click: _this.context.createInvokeHandler('editor.formatBlock')
                  }),
              ]).render();
          });
          var _loop_1 = function (styleIdx, styleLen) {
              var item = this_1.options.styleTags[styleIdx];
              this_1.context.memo('button.style.' + item, function () {
                  return _this.button({
                      className: 'note-btn-style-' + item,
                      contents: '<div data-value="' + item + '">' + item.toUpperCase() + '</div>',
                      tooltip: _this.lang.style[item],
                      click: _this.context.createInvokeHandler('editor.formatBlock')
                  }).render();
              });
          };
          var this_1 = this;
          for (var styleIdx = 0, styleLen = this.options.styleTags.length; styleIdx < styleLen; styleIdx++) {
              _loop_1(styleIdx, styleLen);
          }
          this.context.memo('button.bold', function () {
              return _this.button({
                  className: 'note-btn-bold',
                  contents: _this.ui.icon(_this.options.icons.bold),
                  tooltip: _this.lang.font.bold + _this.representShortcut('bold'),
                  click: _this.context.createInvokeHandlerAndUpdateState('editor.bold')
              }).render();
          });
          this.context.memo('button.italic', function () {
              return _this.button({
                  className: 'note-btn-italic',
                  contents: _this.ui.icon(_this.options.icons.italic),
                  tooltip: _this.lang.font.italic + _this.representShortcut('italic'),
                  click: _this.context.createInvokeHandlerAndUpdateState('editor.italic')
              }).render();
          });
          this.context.memo('button.underline', function () {
              return _this.button({
                  className: 'note-btn-underline',
                  contents: _this.ui.icon(_this.options.icons.underline),
                  tooltip: _this.lang.font.underline + _this.representShortcut('underline'),
                  click: _this.context.createInvokeHandlerAndUpdateState('editor.underline')
              }).render();
          });
          this.context.memo('button.clear', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.eraser),
                  tooltip: _this.lang.font.clear + _this.representShortcut('removeFormat'),
                  click: _this.context.createInvokeHandler('editor.removeFormat')
              }).render();
          });
          this.context.memo('button.strikethrough', function () {
              return _this.button({
                  className: 'note-btn-strikethrough',
                  contents: _this.ui.icon(_this.options.icons.strikethrough),
                  tooltip: _this.lang.font.strikethrough + _this.representShortcut('strikethrough'),
                  click: _this.context.createInvokeHandlerAndUpdateState('editor.strikethrough')
              }).render();
          });
          this.context.memo('button.superscript', function () {
              return _this.button({
                  className: 'note-btn-superscript',
                  contents: _this.ui.icon(_this.options.icons.superscript),
                  tooltip: _this.lang.font.superscript,
                  click: _this.context.createInvokeHandlerAndUpdateState('editor.superscript')
              }).render();
          });
          this.context.memo('button.subscript', function () {
              return _this.button({
                  className: 'note-btn-subscript',
                  contents: _this.ui.icon(_this.options.icons.subscript),
                  tooltip: _this.lang.font.subscript,
                  click: _this.context.createInvokeHandlerAndUpdateState('editor.subscript')
              }).render();
          });
          this.context.memo('button.fontname', function () {
              var styleInfo = _this.context.invoke('editor.currentStyle');
              // Add 'default' fonts into the fontnames array if not exist
              $$1.each(styleInfo['font-family'].split(','), function (idx, fontname) {
                  fontname = fontname.trim().replace(/['"]+/g, '');
                  if (_this.isFontDeservedToAdd(fontname)) {
                      if (_this.options.fontNames.indexOf(fontname) === -1) {
                          _this.options.fontNames.push(fontname);
                      }
                  }
              });
              return _this.ui.buttonGroup([
                  _this.button({
                      className: 'dropdown-toggle',
                      contents: _this.ui.dropdownButtonContents('<span class="note-current-fontname"/>', _this.options),
                      tooltip: _this.lang.font.name,
                      data: {
                          toggle: 'dropdown'
                      }
                  }),
                  _this.ui.dropdownCheck({
                      className: 'dropdown-fontname',
                      checkClassName: _this.options.icons.menuCheck,
                      items: _this.options.fontNames.filter(_this.isFontInstalled.bind(_this)),
                      title: _this.lang.font.name,
                      template: function (item) {
                          return '<span style="font-family: \'' + item + '\'">' + item + '</span>';
                      },
                      click: _this.context.createInvokeHandlerAndUpdateState('editor.fontName')
                  }),
              ]).render();
          });
          this.context.memo('button.fontsize', function () {
              return _this.ui.buttonGroup([
                  _this.button({
                      className: 'dropdown-toggle',
                      contents: _this.ui.dropdownButtonContents('<span class="note-current-fontsize"/>', _this.options),
                      tooltip: _this.lang.font.size,
                      data: {
                          toggle: 'dropdown'
                      }
                  }),
                  _this.ui.dropdownCheck({
                      className: 'dropdown-fontsize',
                      checkClassName: _this.options.icons.menuCheck,
                      items: _this.options.fontSizes,
                      title: _this.lang.font.size,
                      click: _this.context.createInvokeHandlerAndUpdateState('editor.fontSize')
                  }),
              ]).render();
          });
          this.context.memo('button.color', function () {
              return _this.colorPalette('note-color-all', _this.lang.color.recent, true, true);
          });
          this.context.memo('button.forecolor', function () {
              return _this.colorPalette('note-color-fore', _this.lang.color.foreground, false, true);
          });
          this.context.memo('button.backcolor', function () {
              return _this.colorPalette('note-color-back', _this.lang.color.background, true, false);
          });
          this.context.memo('button.ul', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.unorderedlist),
                  tooltip: _this.lang.lists.unordered + _this.representShortcut('insertUnorderedList'),
                  click: _this.context.createInvokeHandler('editor.insertUnorderedList')
              }).render();
          });
          this.context.memo('button.ol', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.orderedlist),
                  tooltip: _this.lang.lists.ordered + _this.representShortcut('insertOrderedList'),
                  click: _this.context.createInvokeHandler('editor.insertOrderedList')
              }).render();
          });
          var justifyLeft = this.button({
              contents: this.ui.icon(this.options.icons.alignLeft),
              tooltip: this.lang.paragraph.left + this.representShortcut('justifyLeft'),
              click: this.context.createInvokeHandler('editor.justifyLeft')
          });
          var justifyCenter = this.button({
              contents: this.ui.icon(this.options.icons.alignCenter),
              tooltip: this.lang.paragraph.center + this.representShortcut('justifyCenter'),
              click: this.context.createInvokeHandler('editor.justifyCenter')
          });
          var justifyRight = this.button({
              contents: this.ui.icon(this.options.icons.alignRight),
              tooltip: this.lang.paragraph.right + this.representShortcut('justifyRight'),
              click: this.context.createInvokeHandler('editor.justifyRight')
          });
          var justifyFull = this.button({
              contents: this.ui.icon(this.options.icons.alignJustify),
              tooltip: this.lang.paragraph.justify + this.representShortcut('justifyFull'),
              click: this.context.createInvokeHandler('editor.justifyFull')
          });
          var outdent = this.button({
              contents: this.ui.icon(this.options.icons.outdent),
              tooltip: this.lang.paragraph.outdent + this.representShortcut('outdent'),
              click: this.context.createInvokeHandler('editor.outdent')
          });
          var indent = this.button({
              contents: this.ui.icon(this.options.icons.indent),
              tooltip: this.lang.paragraph.indent + this.representShortcut('indent'),
              click: this.context.createInvokeHandler('editor.indent')
          });
          this.context.memo('button.justifyLeft', func.invoke(justifyLeft, 'render'));
          this.context.memo('button.justifyCenter', func.invoke(justifyCenter, 'render'));
          this.context.memo('button.justifyRight', func.invoke(justifyRight, 'render'));
          this.context.memo('button.justifyFull', func.invoke(justifyFull, 'render'));
          this.context.memo('button.outdent', func.invoke(outdent, 'render'));
          this.context.memo('button.indent', func.invoke(indent, 'render'));
          this.context.memo('button.paragraph', function () {
              return _this.ui.buttonGroup([
                  _this.button({
                      className: 'dropdown-toggle',
                      contents: _this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.alignLeft), _this.options),
                      tooltip: _this.lang.paragraph.paragraph,
                      data: {
                          toggle: 'dropdown'
                      }
                  }),
                  _this.ui.dropdown([
                      _this.ui.buttonGroup({
                          className: 'note-align',
                          children: [justifyLeft, justifyCenter, justifyRight, justifyFull]
                      }),
                      _this.ui.buttonGroup({
                          className: 'note-list',
                          children: [outdent, indent]
                      }),
                  ]),
              ]).render();
          });
          this.context.memo('button.height', function () {
              return _this.ui.buttonGroup([
                  _this.button({
                      className: 'dropdown-toggle',
                      contents: _this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.textHeight), _this.options),
                      tooltip: _this.lang.font.height,
                      data: {
                          toggle: 'dropdown'
                      }
                  }),
                  _this.ui.dropdownCheck({
                      items: _this.options.lineHeights,
                      checkClassName: _this.options.icons.menuCheck,
                      className: 'dropdown-line-height',
                      title: _this.lang.font.height,
                      click: _this.context.createInvokeHandler('editor.lineHeight')
                  }),
              ]).render();
          });
          this.context.memo('button.table', function () {
              return _this.ui.buttonGroup([
                  _this.button({
                      className: 'dropdown-toggle',
                      contents: _this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.table), _this.options),
                      tooltip: _this.lang.table.table,
                      data: {
                          toggle: 'dropdown'
                      }
                  }),
                  _this.ui.dropdown({
                      title: _this.lang.table.table,
                      className: 'note-table',
                      items: [
                          '<div class="note-dimension-picker">',
                          '  <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',
                          '  <div class="note-dimension-picker-highlighted"/>',
                          '  <div class="note-dimension-picker-unhighlighted"/>',
                          '</div>',
                          '<div class="note-dimension-display">1 x 1</div>',
                      ].join('')
                  }),
              ], {
                  callback: function ($node) {
                      var $catcher = $node.find('.note-dimension-picker-mousecatcher');
                      $catcher.css({
                          width: _this.options.insertTableMaxSize.col + 'em',
                          height: _this.options.insertTableMaxSize.row + 'em'
                      }).mousedown(_this.context.createInvokeHandler('editor.insertTable'))
                          .on('mousemove', _this.tableMoveHandler.bind(_this));
                  }
              }).render();
          });
          this.context.memo('button.link', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.link),
                  tooltip: _this.lang.link.link + _this.representShortcut('linkDialog.show'),
                  click: _this.context.createInvokeHandler('linkDialog.show')
              }).render();
          });
          this.context.memo('button.picture', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.picture),
                  tooltip: _this.lang.image.image,
                  click: _this.context.createInvokeHandler('imageDialog.show')
              }).render();
          });
          this.context.memo('button.video', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.video),
                  tooltip: _this.lang.video.video,
                  click: _this.context.createInvokeHandler('videoDialog.show')
              }).render();
          });
          this.context.memo('button.hr', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.minus),
                  tooltip: _this.lang.hr.insert + _this.representShortcut('insertHorizontalRule'),
                  click: _this.context.createInvokeHandler('editor.insertHorizontalRule')
              }).render();
          });
          this.context.memo('button.fullscreen', function () {
              return _this.button({
                  className: 'btn-fullscreen',
                  contents: _this.ui.icon(_this.options.icons.arrowsAlt),
                  tooltip: _this.lang.options.fullscreen,
                  click: _this.context.createInvokeHandler('fullscreen.toggle')
              }).render();
          });
          this.context.memo('button.codeview', function () {
              return _this.button({
                  className: 'btn-codeview',
                  contents: _this.ui.icon(_this.options.icons.code),
                  tooltip: _this.lang.options.codeview,
                  click: _this.context.createInvokeHandler('codeview.toggle')
              }).render();
          });
          this.context.memo('button.redo', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.redo),
                  tooltip: _this.lang.history.redo + _this.representShortcut('redo'),
                  click: _this.context.createInvokeHandler('editor.redo')
              }).render();
          });
          this.context.memo('button.undo', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.undo),
                  tooltip: _this.lang.history.undo + _this.representShortcut('undo'),
                  click: _this.context.createInvokeHandler('editor.undo')
              }).render();
          });
          this.context.memo('button.help', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.question),
                  tooltip: _this.lang.options.help,
                  click: _this.context.createInvokeHandler('helpDialog.show')
              }).render();
          });
      };
      /**
       * image: [
       *   ['imageResize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']],
       *   ['float', ['floatLeft', 'floatRight', 'floatNone']],
       *   ['remove', ['removeMedia']],
       * ],
       */
      Buttons.prototype.addImagePopoverButtons = function () {
          var _this = this;
          // Image Size Buttons
          this.context.memo('button.resizeFull', function () {
              return _this.button({
                  contents: '<span class="note-fontsize-10">100%</span>',
                  tooltip: _this.lang.image.resizeFull,
                  click: _this.context.createInvokeHandler('editor.resize', '1')
              }).render();
          });
          this.context.memo('button.resizeHalf', function () {
              return _this.button({
                  contents: '<span class="note-fontsize-10">50%</span>',
                  tooltip: _this.lang.image.resizeHalf,
                  click: _this.context.createInvokeHandler('editor.resize', '0.5')
              }).render();
          });
          this.context.memo('button.resizeQuarter', function () {
              return _this.button({
                  contents: '<span class="note-fontsize-10">25%</span>',
                  tooltip: _this.lang.image.resizeQuarter,
                  click: _this.context.createInvokeHandler('editor.resize', '0.25')
              }).render();
          });
          this.context.memo('button.resizeNone', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.rollback),
                  tooltip: _this.lang.image.resizeNone,
                  click: _this.context.createInvokeHandler('editor.resize', '0')
              }).render();
          });
          // Float Buttons
          this.context.memo('button.floatLeft', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.floatLeft),
                  tooltip: _this.lang.image.floatLeft,
                  click: _this.context.createInvokeHandler('editor.floatMe', 'left')
              }).render();
          });
          this.context.memo('button.floatRight', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.floatRight),
                  tooltip: _this.lang.image.floatRight,
                  click: _this.context.createInvokeHandler('editor.floatMe', 'right')
              }).render();
          });
          this.context.memo('button.floatNone', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.rollback),
                  tooltip: _this.lang.image.floatNone,
                  click: _this.context.createInvokeHandler('editor.floatMe', 'none')
              }).render();
          });
          // Remove Buttons
          this.context.memo('button.removeMedia', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.trash),
                  tooltip: _this.lang.image.remove,
                  click: _this.context.createInvokeHandler('editor.removeMedia')
              }).render();
          });
      };
      Buttons.prototype.addLinkPopoverButtons = function () {
          var _this = this;
          this.context.memo('button.linkDialogShow', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.link),
                  tooltip: _this.lang.link.edit,
                  click: _this.context.createInvokeHandler('linkDialog.show')
              }).render();
          });
          this.context.memo('button.unlink', function () {
              return _this.button({
                  contents: _this.ui.icon(_this.options.icons.unlink),
                  tooltip: _this.lang.link.unlink,
                  click: _this.context.createInvokeHandler('editor.unlink')
              }).render();
          });
      };
      /**
       * table : [
       *  ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']],
       *  ['delete', ['deleteRow', 'deleteCol', 'deleteTable']]
       * ],
       */
      Buttons.prototype.addTablePopoverButtons = function () {
          var _this = this;
          this.context.memo('button.addRowUp', function () {
              return _this.button({
                  className: 'btn-md',
                  contents: _this.ui.icon(_this.options.icons.rowAbove),
                  tooltip: _this.lang.table.addRowAbove,
                  click: _this.context.createInvokeHandler('editor.addRow', 'top')
              }).render();
          });
          this.context.memo('button.addRowDown', function () {
              return _this.button({
                  className: 'btn-md',
                  contents: _this.ui.icon(_this.options.icons.rowBelow),
                  tooltip: _this.lang.table.addRowBelow,
                  click: _this.context.createInvokeHandler('editor.addRow', 'bottom')
              }).render();
          });
          this.context.memo('button.addColLeft', function () {
              return _this.button({
                  className: 'btn-md',
                  contents: _this.ui.icon(_this.options.icons.colBefore),
                  tooltip: _this.lang.table.addColLeft,
                  click: _this.context.createInvokeHandler('editor.addCol', 'left')
              }).render();
          });
          this.context.memo('button.addColRight', function () {
              return _this.button({
                  className: 'btn-md',
                  contents: _this.ui.icon(_this.options.icons.colAfter),
                  tooltip: _this.lang.table.addColRight,
                  click: _this.context.createInvokeHandler('editor.addCol', 'right')
              }).render();
          });
          this.context.memo('button.deleteRow', function () {
              return _this.button({
                  className: 'btn-md',
                  contents: _this.ui.icon(_this.options.icons.rowRemove),
                  tooltip: _this.lang.table.delRow,
                  click: _this.context.createInvokeHandler('editor.deleteRow')
              }).render();
          });
          this.context.memo('button.deleteCol', function () {
              return _this.button({
                  className: 'btn-md',
                  contents: _this.ui.icon(_this.options.icons.colRemove),
                  tooltip: _this.lang.table.delCol,
                  click: _this.context.createInvokeHandler('editor.deleteCol')
              }).render();
          });
          this.context.memo('button.deleteTable', function () {
              return _this.button({
                  className: 'btn-md',
                  contents: _this.ui.icon(_this.options.icons.trash),
                  tooltip: _this.lang.table.delTable,
                  click: _this.context.createInvokeHandler('editor.deleteTable')
              }).render();
          });
      };
      Buttons.prototype.build = function ($container, groups) {
          for (var groupIdx = 0, groupLen = groups.length; groupIdx < groupLen; groupIdx++) {
              var group = groups[groupIdx];
              var groupName = Array.isArray(group) ? group[0] : group;
              var buttons = Array.isArray(group) ? ((group.length === 1) ? [group[0]] : group[1]) : [group];
              var $group = this.ui.buttonGroup({
                  className: 'note-' + groupName
              }).render();
              for (var idx = 0, len = buttons.length; idx < len; idx++) {
                  var btn = this.context.memo('button.' + buttons[idx]);
                  if (btn) {
                      $group.append(typeof btn === 'function' ? btn() : btn);
                  }
              }
              $group.appendTo($container);
          }
      };
      /**
       * @param {jQuery} [$container]
       */
      Buttons.prototype.updateCurrentStyle = function ($container) {
          var _this = this;
          var $cont = $container || this.$toolbar;
          var styleInfo = this.context.invoke('editor.currentStyle');
          this.updateBtnStates($cont, {
              '.note-btn-bold': function () {
                  return styleInfo['font-bold'] === 'bold';
              },
              '.note-btn-italic': function () {
                  return styleInfo['font-italic'] === 'italic';
              },
              '.note-btn-underline': function () {
                  return styleInfo['font-underline'] === 'underline';
              },
              '.note-btn-subscript': function () {
                  return styleInfo['font-subscript'] === 'subscript';
              },
              '.note-btn-superscript': function () {
                  return styleInfo['font-superscript'] === 'superscript';
              },
              '.note-btn-strikethrough': function () {
                  return styleInfo['font-strikethrough'] === 'strikethrough';
              }
          });
          if (styleInfo['font-family']) {
              var fontNames = styleInfo['font-family'].split(',').map(function (name) {
                  return name.replace(/[\'\"]/g, '')
                      .replace(/\s+$/, '')
                      .replace(/^\s+/, '');
              });
              var fontName_1 = lists.find(fontNames, this.isFontInstalled.bind(this));
              $cont.find('.dropdown-fontname a').each(function (idx, item) {
                  var $item = $$1(item);
                  // always compare string to avoid creating another func.
                  var isChecked = ($item.data('value') + '') === (fontName_1 + '');
                  $item.toggleClass('checked', isChecked);
              });
              $cont.find('.note-current-fontname').text(fontName_1).css('font-family', fontName_1);
          }
          if (styleInfo['font-size']) {
              var fontSize_1 = styleInfo['font-size'];
              $cont.find('.dropdown-fontsize a').each(function (idx, item) {
                  var $item = $$1(item);
                  // always compare with string to avoid creating another func.
                  var isChecked = ($item.data('value') + '') === (fontSize_1 + '');
                  $item.toggleClass('checked', isChecked);
              });
              $cont.find('.note-current-fontsize').text(fontSize_1);
          }
          if (styleInfo['line-height']) {
              var lineHeight_1 = styleInfo['line-height'];
              $cont.find('.dropdown-line-height li a').each(function (idx, item) {
                  // always compare with string to avoid creating another func.
                  var isChecked = ($$1(item).data('value') + '') === (lineHeight_1 + '');
                  _this.className = isChecked ? 'checked' : '';
              });
          }
      };
      Buttons.prototype.updateBtnStates = function ($container, infos) {
          var _this = this;
          $$1.each(infos, function (selector, pred) {
              _this.ui.toggleBtnActive($container.find(selector), pred());
          });
      };
      Buttons.prototype.tableMoveHandler = function (event) {
          var PX_PER_EM = 18;
          var $picker = $$1(event.target.parentNode); // target is mousecatcher
          var $dimensionDisplay = $picker.next();
          var $catcher = $picker.find('.note-dimension-picker-mousecatcher');
          var $highlighted = $picker.find('.note-dimension-picker-highlighted');
          var $unhighlighted = $picker.find('.note-dimension-picker-unhighlighted');
          var posOffset;
          // HTML5 with jQuery - e.offsetX is undefined in Firefox
          if (event.offsetX === undefined) {
              var posCatcher = $$1(event.target).offset();
              posOffset = {
                  x: event.pageX - posCatcher.left,
                  y: event.pageY - posCatcher.top
              };
          }
          else {
              posOffset = {
                  x: event.offsetX,
                  y: event.offsetY
              };
          }
          var dim = {
              c: Math.ceil(posOffset.x / PX_PER_EM) || 1,
              r: Math.ceil(posOffset.y / PX_PER_EM) || 1
          };
          $highlighted.css({ width: dim.c + 'em', height: dim.r + 'em' });
          $catcher.data('value', dim.c + 'x' + dim.r);
          if (dim.c > 3 && dim.c < this.options.insertTableMaxSize.col) {
              $unhighlighted.css({ width: dim.c + 1 + 'em' });
          }
          if (dim.r > 3 && dim.r < this.options.insertTableMaxSize.row) {
              $unhighlighted.css({ height: dim.r + 1 + 'em' });
          }
          $dimensionDisplay.html(dim.c + ' x ' + dim.r);
      };
      return Buttons;
  }());

  var Toolbar = /** @class */ (function () {
      function Toolbar(context) {
          this.context = context;
          this.$window = $$1(window);
          this.$document = $$1(document);
          this.ui = $$1.summernote.ui;
          this.$note = context.layoutInfo.note;
          this.$editor = context.layoutInfo.editor;
          this.$toolbar = context.layoutInfo.toolbar;
          this.$editable = context.layoutInfo.editable;
          this.$statusbar = context.layoutInfo.statusbar;
          this.options = context.options;
          this.isFollowing = false;
          this.followScroll = this.followScroll.bind(this);
      }
      Toolbar.prototype.shouldInitialize = function () {
          return !this.options.airMode;
      };
      Toolbar.prototype.initialize = function () {
          var _this = this;
          this.options.toolbar = this.options.toolbar || [];
          if (!this.options.toolbar.length) {
              this.$toolbar.hide();
          }
          else {
              this.context.invoke('buttons.build', this.$toolbar, this.options.toolbar);
          }
          if (this.options.toolbarContainer) {
              this.$toolbar.appendTo(this.options.toolbarContainer);
          }
          this.changeContainer(false);
          this.$note.on('summernote.keyup summernote.mouseup summernote.change', function () {
              _this.context.invoke('buttons.updateCurrentStyle');
          });
          this.context.invoke('buttons.updateCurrentStyle');
          if (this.options.followingToolbar) {
              this.$window.on('scroll resize', this.followScroll);
          }
      };
      Toolbar.prototype.destroy = function () {
          this.$toolbar.children().remove();
          if (this.options.followingToolbar) {
              this.$window.off('scroll resize', this.followScroll);
          }
      };
      Toolbar.prototype.followScroll = function () {
          if (this.$editor.hasClass('fullscreen')) {
              return false;
          }
          var editorHeight = this.$editor.outerHeight();
          var editorWidth = this.$editor.width();
          var toolbarHeight = this.$toolbar.height();
          var statusbarHeight = this.$statusbar.height();
          // check if the web app is currently using another static bar
          var otherBarHeight = 0;
          if (this.options.otherStaticBar) {
              otherBarHeight = $$1(this.options.otherStaticBar).outerHeight();
          }
          var currentOffset = this.$document.scrollTop();
          var editorOffsetTop = this.$editor.offset().top;
          var editorOffsetBottom = editorOffsetTop + editorHeight;
          var activateOffset = editorOffsetTop - otherBarHeight;
          var deactivateOffsetBottom = editorOffsetBottom - otherBarHeight - toolbarHeight - statusbarHeight;
          if (!this.isFollowing &&
              (currentOffset > activateOffset) && (currentOffset < deactivateOffsetBottom - toolbarHeight)) {
              this.isFollowing = true;
              this.$toolbar.css({
                  position: 'fixed',
                  top: otherBarHeight,
                  width: editorWidth
              });
              this.$editable.css({
                  marginTop: this.$toolbar.height() + 5
              });
          }
          else if (this.isFollowing &&
              ((currentOffset < activateOffset) || (currentOffset > deactivateOffsetBottom))) {
              this.isFollowing = false;
              this.$toolbar.css({
                  position: 'relative',
                  top: 0,
                  width: '100%'
              });
              this.$editable.css({
                  marginTop: ''
              });
          }
      };
      Toolbar.prototype.changeContainer = function (isFullscreen) {
          if (isFullscreen) {
              this.$toolbar.prependTo(this.$editor);
          }
          else {
              if (this.options.toolbarContainer) {
                  this.$toolbar.appendTo(this.options.toolbarContainer);
              }
          }
          this.followScroll();
      };
      Toolbar.prototype.updateFullscreen = function (isFullscreen) {
          this.ui.toggleBtnActive(this.$toolbar.find('.btn-fullscreen'), isFullscreen);
          this.changeContainer(isFullscreen);
      };
      Toolbar.prototype.updateCodeview = function (isCodeview) {
          this.ui.toggleBtnActive(this.$toolbar.find('.btn-codeview'), isCodeview);
          if (isCodeview) {
              this.deactivate();
          }
          else {
              this.activate();
          }
      };
      Toolbar.prototype.activate = function (isIncludeCodeview) {
          var $btn = this.$toolbar.find('button');
          if (!isIncludeCodeview) {
              $btn = $btn.not('.btn-codeview');
          }
          this.ui.toggleBtn($btn, true);
      };
      Toolbar.prototype.deactivate = function (isIncludeCodeview) {
          var $btn = this.$toolbar.find('button');
          if (!isIncludeCodeview) {
              $btn = $btn.not('.btn-codeview');
          }
          this.ui.toggleBtn($btn, false);
      };
      return Toolbar;
  }());

  var LinkDialog = /** @class */ (function () {
      function LinkDialog(context) {
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.$body = $$1(document.body);
          this.$editor = context.layoutInfo.editor;
          this.options = context.options;
          this.lang = this.options.langInfo;
          context.memo('help.linkDialog.show', this.options.langInfo.help['linkDialog.show']);
      }
      LinkDialog.prototype.initialize = function () {
          var $container = this.options.dialogsInBody ? this.$body : this.$editor;
          var body = [
              '<div class="form-group note-form-group">',
              "<label class=\"note-form-label\">" + this.lang.link.textToDisplay + "</label>",
              '<input class="note-link-text form-control note-form-control note-input" type="text" />',
              '</div>',
              '<div class="form-group note-form-group">',
              "<label class=\"note-form-label\">" + this.lang.link.url + "</label>",
              '<input class="note-link-url form-control note-form-control note-input" type="text" value="http://" />',
              '</div>',
              !this.options.disableLinkTarget
                  ? $$1('<div/>').append(this.ui.checkbox({
                      className: 'sn-checkbox-open-in-new-window',
                      text: this.lang.link.openInNewWindow,
                      checked: true
                  }).render()).html()
                  : '',
          ].join('');
          var buttonClass = 'btn btn-primary note-btn note-btn-primary note-link-btn';
          var footer = "<input type=\"button\" href=\"#\" class=\"" + buttonClass + "\" value=\"" + this.lang.link.insert + "\" disabled>";
          this.$dialog = this.ui.dialog({
              className: 'link-dialog',
              title: this.lang.link.insert,
              fade: this.options.dialogsFade,
              body: body,
              footer: footer
          }).render().appendTo($container);
      };
      LinkDialog.prototype.destroy = function () {
          this.ui.hideDialog(this.$dialog);
          this.$dialog.remove();
      };
      LinkDialog.prototype.bindEnterKey = function ($input, $btn) {
          $input.on('keypress', function (event) {
              if (event.keyCode === key.code.ENTER) {
                  event.preventDefault();
                  $btn.trigger('click');
              }
          });
      };
      /**
       * toggle update button
       */
      LinkDialog.prototype.toggleLinkBtn = function ($linkBtn, $linkText, $linkUrl) {
          this.ui.toggleBtn($linkBtn, $linkText.val() && $linkUrl.val());
      };
      /**
       * Show link dialog and set event handlers on dialog controls.
       *
       * @param {Object} linkInfo
       * @return {Promise}
       */
      LinkDialog.prototype.showLinkDialog = function (linkInfo) {
          var _this = this;
          return $$1.Deferred(function (deferred) {
              var $linkText = _this.$dialog.find('.note-link-text');
              var $linkUrl = _this.$dialog.find('.note-link-url');
              var $linkBtn = _this.$dialog.find('.note-link-btn');
              var $openInNewWindow = _this.$dialog
                  .find('.sn-checkbox-open-in-new-window input[type=checkbox]');
              _this.ui.onDialogShown(_this.$dialog, function () {
                  _this.context.triggerEvent('dialog.shown');
                  // If no url was given and given text is valid URL then copy that into URL Field
                  if (!linkInfo.url && func.isValidUrl(linkInfo.text)) {
                      linkInfo.url = linkInfo.text;
                  }
                  $linkText.on('input paste propertychange', function () {
                      // If linktext was modified by input events,
                      // cloning text from linkUrl will be stopped.
                      linkInfo.text = $linkText.val();
                      _this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
                  }).val(linkInfo.text);
                  $linkUrl.on('input paste propertychange', function () {
                      // Display same text on `Text to display` as default
                      // when linktext has no text
                      if (!linkInfo.text) {
                          $linkText.val($linkUrl.val());
                      }
                      _this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
                  }).val(linkInfo.url);
                  if (!env.isSupportTouch) {
                      $linkUrl.trigger('focus');
                  }
                  _this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
                  _this.bindEnterKey($linkUrl, $linkBtn);
                  _this.bindEnterKey($linkText, $linkBtn);
                  var isNewWindowChecked = linkInfo.isNewWindow !== undefined
                      ? linkInfo.isNewWindow : _this.context.options.linkTargetBlank;
                  $openInNewWindow.prop('checked', isNewWindowChecked);
                  $linkBtn.one('click', function (event) {
                      event.preventDefault();
                      deferred.resolve({
                          range: linkInfo.range,
                          url: $linkUrl.val(),
                          text: $linkText.val(),
                          isNewWindow: $openInNewWindow.is(':checked')
                      });
                      _this.ui.hideDialog(_this.$dialog);
                  });
              });
              _this.ui.onDialogHidden(_this.$dialog, function () {
                  // detach events
                  $linkText.off();
                  $linkUrl.off();
                  $linkBtn.off();
                  if (deferred.state() === 'pending') {
                      deferred.reject();
                  }
              });
              _this.ui.showDialog(_this.$dialog);
          }).promise();
      };
      /**
       * @param {Object} layoutInfo
       */
      LinkDialog.prototype.show = function () {
          var _this = this;
          var linkInfo = this.context.invoke('editor.getLinkInfo');
          this.context.invoke('editor.saveRange');
          this.showLinkDialog(linkInfo).then(function (linkInfo) {
              _this.context.invoke('editor.restoreRange');
              _this.context.invoke('editor.createLink', linkInfo);
          }).fail(function () {
              _this.context.invoke('editor.restoreRange');
          });
      };
      return LinkDialog;
  }());

  var LinkPopover = /** @class */ (function () {
      function LinkPopover(context) {
          var _this = this;
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.options = context.options;
          this.events = {
              'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function () {
                  _this.update();
              },
              'summernote.disable summernote.dialog.shown': function () {
                  _this.hide();
              }
          };
      }
      LinkPopover.prototype.shouldInitialize = function () {
          return !lists.isEmpty(this.options.popover.link);
      };
      LinkPopover.prototype.initialize = function () {
          this.$popover = this.ui.popover({
              className: 'note-link-popover',
              callback: function ($node) {
                  var $content = $node.find('.popover-content,.note-popover-content');
                  $content.prepend('<span><a target="_blank"></a>&nbsp;</span>');
              }
          }).render().appendTo(this.options.container);
          var $content = this.$popover.find('.popover-content,.note-popover-content');
          this.context.invoke('buttons.build', $content, this.options.popover.link);
      };
      LinkPopover.prototype.destroy = function () {
          this.$popover.remove();
      };
      LinkPopover.prototype.update = function () {
          // Prevent focusing on editable when invoke('code') is executed
          if (!this.context.invoke('editor.hasFocus')) {
              this.hide();
              return;
          }
          var rng = this.context.invoke('editor.getLastRange');
          if (rng.isCollapsed() && rng.isOnAnchor()) {
              var anchor = dom.ancestor(rng.sc, dom.isAnchor);
              var href = $$1(anchor).attr('href');
              this.$popover.find('a').attr('href', href).html(href);
              var pos = dom.posFromPlaceholder(anchor);
              this.$popover.css({
                  display: 'block',
                  left: pos.left,
                  top: pos.top
              });
          }
          else {
              this.hide();
          }
      };
      LinkPopover.prototype.hide = function () {
          this.$popover.hide();
      };
      return LinkPopover;
  }());

  var ImageDialog = /** @class */ (function () {
      function ImageDialog(context) {
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.$body = $$1(document.body);
          this.$editor = context.layoutInfo.editor;
          this.options = context.options;
          this.lang = this.options.langInfo;
      }
      ImageDialog.prototype.initialize = function () {
          var $container = this.options.dialogsInBody ? this.$body : this.$editor;
          var imageLimitation = '';
          if (this.options.maximumImageFileSize) {
              var unit = Math.floor(Math.log(this.options.maximumImageFileSize) / Math.log(1024));
              var readableSize = (this.options.maximumImageFileSize / Math.pow(1024, unit)).toFixed(2) * 1 +
                  ' ' + ' KMGTP'[unit] + 'B';
              imageLimitation = "<small>" + (this.lang.image.maximumFileSize + ' : ' + readableSize) + "</small>";
          }
          var body = [
              '<div class="form-group note-form-group note-group-select-from-files">',
              '<label class="note-form-label">' + this.lang.image.selectFromFiles + '</label>',
              '<input class="note-image-input form-control-file note-form-control note-input" ',
              ' type="file" name="files" accept="image/*" multiple="multiple" />',
              imageLimitation,
              '</div>',
              '<div class="form-group note-group-image-url" style="overflow:auto;">',
              '<label class="note-form-label">' + this.lang.image.url + '</label>',
              '<input class="note-image-url form-control note-form-control note-input ',
              ' col-md-12" type="text" />',
              '</div>',
          ].join('');
          var buttonClass = 'btn btn-primary note-btn note-btn-primary note-image-btn';
          var footer = "<input type=\"button\" href=\"#\" class=\"" + buttonClass + "\" value=\"" + this.lang.image.insert + "\" disabled>";
          this.$dialog = this.ui.dialog({
              title: this.lang.image.insert,
              fade: this.options.dialogsFade,
              body: body,
              footer: footer
          }).render().appendTo($container);
      };
      ImageDialog.prototype.destroy = function () {
          this.ui.hideDialog(this.$dialog);
          this.$dialog.remove();
      };
      ImageDialog.prototype.bindEnterKey = function ($input, $btn) {
          $input.on('keypress', function (event) {
              if (event.keyCode === key.code.ENTER) {
                  event.preventDefault();
                  $btn.trigger('click');
              }
          });
      };
      ImageDialog.prototype.show = function () {
          var _this = this;
          this.context.invoke('editor.saveRange');
          this.showImageDialog().then(function (data) {
              // [workaround] hide dialog before restore range for IE range focus
              _this.ui.hideDialog(_this.$dialog);
              _this.context.invoke('editor.restoreRange');
              if (typeof data === 'string') { // image url
                  // If onImageLinkInsert set,
                  if (_this.options.callbacks.onImageLinkInsert) {
                      _this.context.triggerEvent('image.link.insert', data);
                  }
                  else {
                      _this.context.invoke('editor.insertImage', data);
                  }
              }
              else { // array of files
                  _this.context.invoke('editor.insertImagesOrCallback', data);
              }
          }).fail(function () {
              _this.context.invoke('editor.restoreRange');
          });
      };
      /**
       * show image dialog
       *
       * @param {jQuery} $dialog
       * @return {Promise}
       */
      ImageDialog.prototype.showImageDialog = function () {
          var _this = this;
          return $$1.Deferred(function (deferred) {
              var $imageInput = _this.$dialog.find('.note-image-input');
              var $imageUrl = _this.$dialog.find('.note-image-url');
              var $imageBtn = _this.$dialog.find('.note-image-btn');
              _this.ui.onDialogShown(_this.$dialog, function () {
                  _this.context.triggerEvent('dialog.shown');
                  // Cloning imageInput to clear element.
                  $imageInput.replaceWith($imageInput.clone().on('change', function (event) {
                      deferred.resolve(event.target.files || event.target.value);
                  }).val(''));
                  $imageUrl.on('input paste propertychange', function () {
                      _this.ui.toggleBtn($imageBtn, $imageUrl.val());
                  }).val('');
                  if (!env.isSupportTouch) {
                      $imageUrl.trigger('focus');
                  }
                  $imageBtn.click(function (event) {
                      event.preventDefault();
                      deferred.resolve($imageUrl.val());
                  });
                  _this.bindEnterKey($imageUrl, $imageBtn);
              });
              _this.ui.onDialogHidden(_this.$dialog, function () {
                  $imageInput.off();
                  $imageUrl.off();
                  $imageBtn.off();
                  if (deferred.state() === 'pending') {
                      deferred.reject();
                  }
              });
              _this.ui.showDialog(_this.$dialog);
          });
      };
      return ImageDialog;
  }());

  /**
   * Image popover module
   *  mouse events that show/hide popover will be handled by Handle.js.
   *  Handle.js will receive the events and invoke 'imagePopover.update'.
   */
  var ImagePopover = /** @class */ (function () {
      function ImagePopover(context) {
          var _this = this;
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.editable = context.layoutInfo.editable[0];
          this.options = context.options;
          this.events = {
              'summernote.disable': function () {
                  _this.hide();
              }
          };
      }
      ImagePopover.prototype.shouldInitialize = function () {
          return !lists.isEmpty(this.options.popover.image);
      };
      ImagePopover.prototype.initialize = function () {
          this.$popover = this.ui.popover({
              className: 'note-image-popover'
          }).render().appendTo(this.options.container);
          var $content = this.$popover.find('.popover-content,.note-popover-content');
          this.context.invoke('buttons.build', $content, this.options.popover.image);
      };
      ImagePopover.prototype.destroy = function () {
          this.$popover.remove();
      };
      ImagePopover.prototype.update = function (target, event) {
          if (dom.isImg(target)) {
              var pos = dom.posFromPlaceholder(target);
              var posEditor = dom.posFromPlaceholder(this.editable);
              this.$popover.css({
                  display: 'block',
                  left: this.options.popatmouse ? event.pageX - 20 : pos.left,
                  top: this.options.popatmouse ? event.pageY : Math.min(pos.top, posEditor.top)
              });
          }
          else {
              this.hide();
          }
      };
      ImagePopover.prototype.hide = function () {
          this.$popover.hide();
      };
      return ImagePopover;
  }());

  var TablePopover = /** @class */ (function () {
      function TablePopover(context) {
          var _this = this;
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.options = context.options;
          this.events = {
              'summernote.mousedown': function (we, e) {
                  _this.update(e.target);
              },
              'summernote.keyup summernote.scroll summernote.change': function () {
                  _this.update();
              },
              'summernote.disable': function () {
                  _this.hide();
              }
          };
      }
      TablePopover.prototype.shouldInitialize = function () {
          return !lists.isEmpty(this.options.popover.table);
      };
      TablePopover.prototype.initialize = function () {
          this.$popover = this.ui.popover({
              className: 'note-table-popover'
          }).render().appendTo(this.options.container);
          var $content = this.$popover.find('.popover-content,.note-popover-content');
          this.context.invoke('buttons.build', $content, this.options.popover.table);
          // [workaround] Disable Firefox's default table editor
          if (env.isFF) {
              document.execCommand('enableInlineTableEditing', false, false);
          }
      };
      TablePopover.prototype.destroy = function () {
          this.$popover.remove();
      };
      TablePopover.prototype.update = function (target) {
          if (this.context.isDisabled()) {
              return false;
          }
          var isCell = dom.isCell(target);
          if (isCell) {
              var pos = dom.posFromPlaceholder(target);
              this.$popover.css({
                  display: 'block',
                  left: pos.left,
                  top: pos.top
              });
          }
          else {
              this.hide();
          }
          return isCell;
      };
      TablePopover.prototype.hide = function () {
          this.$popover.hide();
      };
      return TablePopover;
  }());

  var VideoDialog = /** @class */ (function () {
      function VideoDialog(context) {
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.$body = $$1(document.body);
          this.$editor = context.layoutInfo.editor;
          this.options = context.options;
          this.lang = this.options.langInfo;
      }
      VideoDialog.prototype.initialize = function () {
          var $container = this.options.dialogsInBody ? this.$body : this.$editor;
          var body = [
              '<div class="form-group note-form-group row-fluid">',
              "<label class=\"note-form-label\">" + this.lang.video.url + " <small class=\"text-muted\">" + this.lang.video.providers + "</small></label>",
              '<input class="note-video-url form-control note-form-control note-input" type="text" />',
              '</div>',
          ].join('');
          var buttonClass = 'btn btn-primary note-btn note-btn-primary note-video-btn';
          var footer = "<input type=\"button\" href=\"#\" class=\"" + buttonClass + "\" value=\"" + this.lang.video.insert + "\" disabled>";
          this.$dialog = this.ui.dialog({
              title: this.lang.video.insert,
              fade: this.options.dialogsFade,
              body: body,
              footer: footer
          }).render().appendTo($container);
      };
      VideoDialog.prototype.destroy = function () {
          this.ui.hideDialog(this.$dialog);
          this.$dialog.remove();
      };
      VideoDialog.prototype.bindEnterKey = function ($input, $btn) {
          $input.on('keypress', function (event) {
              if (event.keyCode === key.code.ENTER) {
                  event.preventDefault();
                  $btn.trigger('click');
              }
          });
      };
      VideoDialog.prototype.createVideoNode = function (url) {
          // video url patterns(youtube, instagram, vimeo, dailymotion, youku, mp4, ogg, webm)
          var ytRegExp = /\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?$/;
          var ytRegExpForStart = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/;
          var ytMatch = url.match(ytRegExp);
          var igRegExp = /(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/;
          var igMatch = url.match(igRegExp);
          var vRegExp = /\/\/vine\.co\/v\/([a-zA-Z0-9]+)/;
          var vMatch = url.match(vRegExp);
          var vimRegExp = /\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/;
          var vimMatch = url.match(vimRegExp);
          var dmRegExp = /.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/;
          var dmMatch = url.match(dmRegExp);
          var youkuRegExp = /\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/;
          var youkuMatch = url.match(youkuRegExp);
          var qqRegExp = /\/\/v\.qq\.com.*?vid=(.+)/;
          var qqMatch = url.match(qqRegExp);
          var qqRegExp2 = /\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/;
          var qqMatch2 = url.match(qqRegExp2);
          var mp4RegExp = /^.+.(mp4|m4v)$/;
          var mp4Match = url.match(mp4RegExp);
          var oggRegExp = /^.+.(ogg|ogv)$/;
          var oggMatch = url.match(oggRegExp);
          var webmRegExp = /^.+.(webm)$/;
          var webmMatch = url.match(webmRegExp);
          var fbRegExp = /(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/;
          var fbMatch = url.match(fbRegExp);
          var $video;
          if (ytMatch && ytMatch[1].length === 11) {
              var youtubeId = ytMatch[1];
              var start = 0;
              if (typeof ytMatch[2] !== 'undefined') {
                  var ytMatchForStart = ytMatch[2].match(ytRegExpForStart);
                  if (ytMatchForStart) {
                      for (var n = [3600, 60, 1], i = 0, r = n.length; i < r; i++) {
                          start += (typeof ytMatchForStart[i + 1] !== 'undefined' ? n[i] * parseInt(ytMatchForStart[i + 1], 10) : 0);
                      }
                  }
              }
              $video = $$1('<iframe>')
                  .attr('frameborder', 0)
                  .attr('src', '//www.youtube.com/embed/' + youtubeId + (start > 0 ? '?start=' + start : ''))
                  .attr('width', '640').attr('height', '360');
          }
          else if (igMatch && igMatch[0].length) {
              $video = $$1('<iframe>')
                  .attr('frameborder', 0)
                  .attr('src', 'https://instagram.com/p/' + igMatch[1] + '/embed/')
                  .attr('width', '612').attr('height', '710')
                  .attr('scrolling', 'no')
                  .attr('allowtransparency', 'true');
          }
          else if (vMatch && vMatch[0].length) {
              $video = $$1('<iframe>')
                  .attr('frameborder', 0)
                  .attr('src', vMatch[0] + '/embed/simple')
                  .attr('width', '600').attr('height', '600')
                  .attr('class', 'vine-embed');
          }
          else if (vimMatch && vimMatch[3].length) {
              $video = $$1('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')
                  .attr('frameborder', 0)
                  .attr('src', '//player.vimeo.com/video/' + vimMatch[3])
                  .attr('width', '640').attr('height', '360');
          }
          else if (dmMatch && dmMatch[2].length) {
              $video = $$1('<iframe>')
                  .attr('frameborder', 0)
                  .attr('src', '//www.dailymotion.com/embed/video/' + dmMatch[2])
                  .attr('width', '640').attr('height', '360');
          }
          else if (youkuMatch && youkuMatch[1].length) {
              $video = $$1('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')
                  .attr('frameborder', 0)
                  .attr('height', '498')
                  .attr('width', '510')
                  .attr('src', '//player.youku.com/embed/' + youkuMatch[1]);
          }
          else if ((qqMatch && qqMatch[1].length) || (qqMatch2 && qqMatch2[2].length)) {
              var vid = ((qqMatch && qqMatch[1].length) ? qqMatch[1] : qqMatch2[2]);
              $video = $$1('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')
                  .attr('frameborder', 0)
                  .attr('height', '310')
                  .attr('width', '500')
                  .attr('src', 'http://v.qq.com/iframe/player.html?vid=' + vid + '&amp;auto=0');
          }
          else if (mp4Match || oggMatch || webmMatch) {
              $video = $$1('<video controls>')
                  .attr('src', url)
                  .attr('width', '640').attr('height', '360');
          }
          else if (fbMatch && fbMatch[0].length) {
              $video = $$1('<iframe>')
                  .attr('frameborder', 0)
                  .attr('src', 'https://www.facebook.com/plugins/video.php?href=' + encodeURIComponent(fbMatch[0]) + '&show_text=0&width=560')
                  .attr('width', '560').attr('height', '301')
                  .attr('scrolling', 'no')
                  .attr('allowtransparency', 'true');
          }
          else {
              // this is not a known video link. Now what, Cat? Now what?
              return false;
          }
          $video.addClass('note-video-clip');
          return $video[0];
      };
      VideoDialog.prototype.show = function () {
          var _this = this;
          var text = this.context.invoke('editor.getSelectedText');
          this.context.invoke('editor.saveRange');
          this.showVideoDialog(text).then(function (url) {
              // [workaround] hide dialog before restore range for IE range focus
              _this.ui.hideDialog(_this.$dialog);
              _this.context.invoke('editor.restoreRange');
              // build node
              var $node = _this.createVideoNode(url);
              if ($node) {
                  // insert video node
                  _this.context.invoke('editor.insertNode', $node);
              }
          }).fail(function () {
              _this.context.invoke('editor.restoreRange');
          });
      };
      /**
       * show image dialog
       *
       * @param {jQuery} $dialog
       * @return {Promise}
       */
      VideoDialog.prototype.showVideoDialog = function (text) {
          var _this = this;
          return $$1.Deferred(function (deferred) {
              var $videoUrl = _this.$dialog.find('.note-video-url');
              var $videoBtn = _this.$dialog.find('.note-video-btn');
              _this.ui.onDialogShown(_this.$dialog, function () {
                  _this.context.triggerEvent('dialog.shown');
                  $videoUrl.on('input paste propertychange', function () {
                      _this.ui.toggleBtn($videoBtn, $videoUrl.val());
                  });
                  if (!env.isSupportTouch) {
                      $videoUrl.trigger('focus');
                  }
                  $videoBtn.click(function (event) {
                      event.preventDefault();
                      deferred.resolve($videoUrl.val());
                  });
                  _this.bindEnterKey($videoUrl, $videoBtn);
              });
              _this.ui.onDialogHidden(_this.$dialog, function () {
                  $videoUrl.off();
                  $videoBtn.off();
                  if (deferred.state() === 'pending') {
                      deferred.reject();
                  }
              });
              _this.ui.showDialog(_this.$dialog);
          });
      };
      return VideoDialog;
  }());

  var HelpDialog = /** @class */ (function () {
      function HelpDialog(context) {
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.$body = $$1(document.body);
          this.$editor = context.layoutInfo.editor;
          this.options = context.options;
          this.lang = this.options.langInfo;
      }
      HelpDialog.prototype.initialize = function () {
          var $container = this.options.dialogsInBody ? this.$body : this.$editor;
          var body = [
              '<p class="text-center">',
              '<a href="http://summernote.org/" target="_blank">Summernote 0.8.12</a> · ',
              '<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ',
              '<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>',
              '</p>',
          ].join('');
          this.$dialog = this.ui.dialog({
              title: this.lang.options.help,
              fade: this.options.dialogsFade,
              body: this.createShortcutList(),
              footer: body,
              callback: function ($node) {
                  $node.find('.modal-body,.note-modal-body').css({
                      'max-height': 300,
                      'overflow': 'scroll'
                  });
              }
          }).render().appendTo($container);
      };
      HelpDialog.prototype.destroy = function () {
          this.ui.hideDialog(this.$dialog);
          this.$dialog.remove();
      };
      HelpDialog.prototype.createShortcutList = function () {
          var _this = this;
          var keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];
          return Object.keys(keyMap).map(function (key) {
              var command = keyMap[key];
              var $row = $$1('<div><div class="help-list-item"/></div>');
              $row.append($$1('<label><kbd>' + key + '</kdb></label>').css({
                  'width': 180,
                  'margin-right': 10
              })).append($$1('<span/>').html(_this.context.memo('help.' + command) || command));
              return $row.html();
          }).join('');
      };
      /**
       * show help dialog
       *
       * @return {Promise}
       */
      HelpDialog.prototype.showHelpDialog = function () {
          var _this = this;
          return $$1.Deferred(function (deferred) {
              _this.ui.onDialogShown(_this.$dialog, function () {
                  _this.context.triggerEvent('dialog.shown');
                  deferred.resolve();
              });
              _this.ui.showDialog(_this.$dialog);
          }).promise();
      };
      HelpDialog.prototype.show = function () {
          var _this = this;
          this.context.invoke('editor.saveRange');
          this.showHelpDialog().then(function () {
              _this.context.invoke('editor.restoreRange');
          });
      };
      return HelpDialog;
  }());

  var AIR_MODE_POPOVER_X_OFFSET = 20;
  var AirPopover = /** @class */ (function () {
      function AirPopover(context) {
          var _this = this;
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.options = context.options;
          this.events = {
              'summernote.keyup summernote.mouseup summernote.scroll': function () {
                  _this.update();
              },
              'summernote.disable summernote.change summernote.dialog.shown': function () {
                  _this.hide();
              },
              'summernote.focusout': function (we, e) {
                  // [workaround] Firefox doesn't support relatedTarget on focusout
                  //  - Ignore hide action on focus out in FF.
                  if (env.isFF) {
                      return;
                  }
                  if (!e.relatedTarget || !dom.ancestor(e.relatedTarget, func.eq(_this.$popover[0]))) {
                      _this.hide();
                  }
              }
          };
      }
      AirPopover.prototype.shouldInitialize = function () {
          return this.options.airMode && !lists.isEmpty(this.options.popover.air);
      };
      AirPopover.prototype.initialize = function () {
          this.$popover = this.ui.popover({
              className: 'note-air-popover'
          }).render().appendTo(this.options.container);
          var $content = this.$popover.find('.popover-content');
          this.context.invoke('buttons.build', $content, this.options.popover.air);
      };
      AirPopover.prototype.destroy = function () {
          this.$popover.remove();
      };
      AirPopover.prototype.update = function () {
          var styleInfo = this.context.invoke('editor.currentStyle');
          if (styleInfo.range && !styleInfo.range.isCollapsed()) {
              var rect = lists.last(styleInfo.range.getClientRects());
              if (rect) {
                  var bnd = func.rect2bnd(rect);
                  this.$popover.css({
                      display: 'block',
                      left: Math.max(bnd.left + bnd.width / 2, 0) - AIR_MODE_POPOVER_X_OFFSET,
                      top: bnd.top + bnd.height
                  });
                  this.context.invoke('buttons.updateCurrentStyle', this.$popover);
              }
          }
          else {
              this.hide();
          }
      };
      AirPopover.prototype.hide = function () {
          this.$popover.hide();
      };
      return AirPopover;
  }());

  var POPOVER_DIST = 5;
  var HintPopover = /** @class */ (function () {
      function HintPopover(context) {
          var _this = this;
          this.context = context;
          this.ui = $$1.summernote.ui;
          this.$editable = context.layoutInfo.editable;
          this.options = context.options;
          this.hint = this.options.hint || [];
          this.direction = this.options.hintDirection || 'bottom';
          this.hints = Array.isArray(this.hint) ? this.hint : [this.hint];
          this.events = {
              'summernote.keyup': function (we, e) {
                  if (!e.isDefaultPrevented()) {
                      _this.handleKeyup(e);
                  }
              },
              'summernote.keydown': function (we, e) {
                  _this.handleKeydown(e);
              },
              'summernote.disable summernote.dialog.shown': function () {
                  _this.hide();
              }
          };
      }
      HintPopover.prototype.shouldInitialize = function () {
          return this.hints.length > 0;
      };
      HintPopover.prototype.initialize = function () {
          var _this = this;
          this.lastWordRange = null;
          this.$popover = this.ui.popover({
              className: 'note-hint-popover',
              hideArrow: true,
              direction: ''
          }).render().appendTo(this.options.container);
          this.$popover.hide();
          this.$content = this.$popover.find('.popover-content,.note-popover-content');
          this.$content.on('click', '.note-hint-item', function (e) {
              _this.$content.find('.active').removeClass('active');
              $$1(e.currentTarget).addClass('active');
              _this.replace();
          });
      };
      HintPopover.prototype.destroy = function () {
          this.$popover.remove();
      };
      HintPopover.prototype.selectItem = function ($item) {
          this.$content.find('.active').removeClass('active');
          $item.addClass('active');
          this.$content[0].scrollTop = $item[0].offsetTop - (this.$content.innerHeight() / 2);
      };
      HintPopover.prototype.moveDown = function () {
          var $current = this.$content.find('.note-hint-item.active');
          var $next = $current.next();
          if ($next.length) {
              this.selectItem($next);
          }
          else {
              var $nextGroup = $current.parent().next();
              if (!$nextGroup.length) {
                  $nextGroup = this.$content.find('.note-hint-group').first();
              }
              this.selectItem($nextGroup.find('.note-hint-item').first());
          }
      };
      HintPopover.prototype.moveUp = function () {
          var $current = this.$content.find('.note-hint-item.active');
          var $prev = $current.prev();
          if ($prev.length) {
              this.selectItem($prev);
          }
          else {
              var $prevGroup = $current.parent().prev();
              if (!$prevGroup.length) {
                  $prevGroup = this.$content.find('.note-hint-group').last();
              }
              this.selectItem($prevGroup.find('.note-hint-item').last());
          }
      };
      HintPopover.prototype.replace = function () {
          var $item = this.$content.find('.note-hint-item.active');
          if ($item.length) {
              var node = this.nodeFromItem($item);
              // XXX: consider to move codes to editor for recording redo/undo.
              this.lastWordRange.insertNode(node);
              range.createFromNode(node).collapse().select();
              this.lastWordRange = null;
              this.hide();
              this.context.triggerEvent('change', this.$editable.html(), this.$editable[0]);
              this.context.invoke('editor.focus');
          }
      };
      HintPopover.prototype.nodeFromItem = function ($item) {
          var hint = this.hints[$item.data('index')];
          var item = $item.data('item');
          var node = hint.content ? hint.content(item) : item;
          if (typeof node === 'string') {
              node = dom.createText(node);
          }
          return node;
      };
      HintPopover.prototype.createItemTemplates = function (hintIdx, items) {
          var hint = this.hints[hintIdx];
          return items.map(function (item, idx) {
              var $item = $$1('<div class="note-hint-item"/>');
              $item.append(hint.template ? hint.template(item) : item + '');
              $item.data({
                  'index': hintIdx,
                  'item': item
              });
              return $item;
          });
      };
      HintPopover.prototype.handleKeydown = function (e) {
          if (!this.$popover.is(':visible')) {
              return;
          }
          if (e.keyCode === key.code.ENTER) {
              e.preventDefault();
              this.replace();
          }
          else if (e.keyCode === key.code.UP) {
              e.preventDefault();
              this.moveUp();
          }
          else if (e.keyCode === key.code.DOWN) {
              e.preventDefault();
              this.moveDown();
          }
      };
      HintPopover.prototype.searchKeyword = function (index, keyword, callback) {
          var hint = this.hints[index];
          if (hint && hint.match.test(keyword) && hint.search) {
              var matches = hint.match.exec(keyword);
              hint.search(matches[1], callback);
          }
          else {
              callback();
          }
      };
      HintPopover.prototype.createGroup = function (idx, keyword) {
          var _this = this;
          var $group = $$1('<div class="note-hint-group note-hint-group-' + idx + '"/>');
          this.searchKeyword(idx, keyword, function (items) {
              items = items || [];
              if (items.length) {
                  $group.html(_this.createItemTemplates(idx, items));
                  _this.show();
              }
          });
          return $group;
      };
      HintPopover.prototype.handleKeyup = function (e) {
          var _this = this;
          if (!lists.contains([key.code.ENTER, key.code.UP, key.code.DOWN], e.keyCode)) {
              var wordRange = this.context.invoke('editor.getLastRange').getWordRange();
              var keyword_1 = wordRange.toString();
              if (this.hints.length && keyword_1) {
                  this.$content.empty();
                  var bnd = func.rect2bnd(lists.last(wordRange.getClientRects()));
                  if (bnd) {
                      this.$popover.hide();
                      this.lastWordRange = wordRange;
                      this.hints.forEach(function (hint, idx) {
                          if (hint.match.test(keyword_1)) {
                              _this.createGroup(idx, keyword_1).appendTo(_this.$content);
                          }
                      });
                      // select first .note-hint-item
                      this.$content.find('.note-hint-item:first').addClass('active');
                      // set position for popover after group is created
                      if (this.direction === 'top') {
                          this.$popover.css({
                              left: bnd.left,
                              top: bnd.top - this.$popover.outerHeight() - POPOVER_DIST
                          });
                      }
                      else {
                          this.$popover.css({
                              left: bnd.left,
                              top: bnd.top + bnd.height + POPOVER_DIST
                          });
                      }
                  }
              }
              else {
                  this.hide();
              }
          }
      };
      HintPopover.prototype.show = function () {
          this.$popover.show();
      };
      HintPopover.prototype.hide = function () {
          this.$popover.hide();
      };
      return HintPopover;
  }());

  $$1.summernote = $$1.extend($$1.summernote, {
      version: '0.8.12',
      plugins: {},
      dom: dom,
      range: range,
      options: {
          langInfo: $$1.summernote.lang['en-US'],
          modules: {
              'editor': Editor,
              'clipboard': Clipboard,
              'dropzone': Dropzone,
              'codeview': CodeView,
              'statusbar': Statusbar,
              'fullscreen': Fullscreen,
              'handle': Handle,
              // FIXME: HintPopover must be front of autolink
              //  - Script error about range when Enter key is pressed on hint popover
              'hintPopover': HintPopover,
              'autoLink': AutoLink,
              'autoSync': AutoSync,
              'autoReplace': AutoReplace,
              'placeholder': Placeholder,
              'buttons': Buttons,
              'toolbar': Toolbar,
              'linkDialog': LinkDialog,
              'linkPopover': LinkPopover,
              'imageDialog': ImageDialog,
              'imagePopover': ImagePopover,
              'tablePopover': TablePopover,
              'videoDialog': VideoDialog,
              'helpDialog': HelpDialog,
              'airPopover': AirPopover
          },
          buttons: {},
          lang: 'en-US',
          followingToolbar: false,
          otherStaticBar: '',
          // toolbar
          toolbar: [
              ['style', ['style']],
              ['font', ['bold', 'underline', 'clear']],
              ['fontname', ['fontname']],
              ['color', ['color']],
              ['para', ['ul', 'ol', 'paragraph']],
              ['table', ['table']],
              ['insert', ['link', 'picture', 'video']],
              ['view', ['fullscreen', 'codeview', 'help']],
          ],
          // popover
          popatmouse: true,
          popover: {
              image: [
                  ['resize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']],
                  ['float', ['floatLeft', 'floatRight', 'floatNone']],
                  ['remove', ['removeMedia']],
              ],
              link: [
                  ['link', ['linkDialogShow', 'unlink']],
              ],
              table: [
                  ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']],
                  ['delete', ['deleteRow', 'deleteCol', 'deleteTable']],
              ],
              air: [
                  ['color', ['color']],
                  ['font', ['bold', 'underline', 'clear']],
                  ['para', ['ul', 'paragraph']],
                  ['table', ['table']],
                  ['insert', ['link', 'picture']],
              ]
          },
          // air mode: inline editor
          airMode: false,
          width: null,
          height: null,
          linkTargetBlank: true,
          focus: false,
          tabSize: 4,
          styleWithSpan: true,
          shortcuts: true,
          textareaAutoSync: true,
          hintDirection: 'bottom',
          tooltip: 'auto',
          container: 'body',
          maxTextLength: 0,
          blockquoteBreakingLevel: 2,
          spellCheck: true,
          styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
          fontNames: [
              'Arial', 'Arial Black', 'Comic Sans MS', 'Courier New',
              'Helvetica Neue', 'Helvetica', 'Impact', 'Lucida Grande',
              'Tahoma', 'Times New Roman', 'Verdana',
          ],
          fontNamesIgnoreCheck: [],
          fontSizes: ['8', '9', '10', '11', '12', '14', '18', '24', '36'],
          // pallete colors(n x n)
          colors: [
              ['#000000', '#424242', '#636363', '#9C9C94', '#CEC6CE', '#EFEFEF', '#F7F7F7', '#FFFFFF'],
              ['#FF0000', '#FF9C00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#9C00FF', '#FF00FF'],
              ['#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE'],
              ['#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD'],
              ['#E76363', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5'],
              ['#CE0000', '#E79439', '#EFC631', '#6BA54A', '#4A7B8C', '#3984C6', '#634AA5', '#A54A7B'],
              ['#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842'],
              ['#630000', '#7B3900', '#846300', '#295218', '#083139', '#003163', '#21104A', '#4A1031'],
          ],
          // http://chir.ag/projects/name-that-color/
          colorsName: [
              ['Black', 'Tundora', 'Dove Gray', 'Star Dust', 'Pale Slate', 'Gallery', 'Alabaster', 'White'],
              ['Red', 'Orange Peel', 'Yellow', 'Green', 'Cyan', 'Blue', 'Electric Violet', 'Magenta'],
              ['Azalea', 'Karry', 'Egg White', 'Zanah', 'Botticelli', 'Tropical Blue', 'Mischka', 'Twilight'],
              ['Tonys Pink', 'Peach Orange', 'Cream Brulee', 'Sprout', 'Casper', 'Perano', 'Cold Purple', 'Careys Pink'],
              ['Mandy', 'Rajah', 'Dandelion', 'Olivine', 'Gulf Stream', 'Viking', 'Blue Marguerite', 'Puce'],
              ['Guardsman Red', 'Fire Bush', 'Golden Dream', 'Chelsea Cucumber', 'Smalt Blue', 'Boston Blue', 'Butterfly Bush', 'Cadillac'],
              ['Sangria', 'Mai Tai', 'Buddha Gold', 'Forest Green', 'Eden', 'Venice Blue', 'Meteorite', 'Claret'],
              ['Rosewood', 'Cinnamon', 'Olive', 'Parsley', 'Tiber', 'Midnight Blue', 'Valentino', 'Loulou'],
          ],
          colorButton: {
              foreColor: '#000000',
              backColor: '#FFFF00'
          },
          lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'],
          tableClassName: 'table table-bordered',
          insertTableMaxSize: {
              col: 10,
              row: 10
          },
          dialogsInBody: false,
          dialogsFade: false,
          maximumImageFileSize: null,
          callbacks: {
              onBeforeCommand: null,
              onBlur: null,
              onBlurCodeview: null,
              onChange: null,
              onChangeCodeview: null,
              onDialogShown: null,
              onEnter: null,
              onFocus: null,
              onImageLinkInsert: null,
              onImageUpload: null,
              onImageUploadError: null,
              onInit: null,
              onKeydown: null,
              onKeyup: null,
              onMousedown: null,
              onMouseup: null,
              onPaste: null,
              onScroll: null
          },
          codemirror: {
              mode: 'text/html',
              htmlMode: true,
              lineNumbers: true
          },
          codeviewFilter: false,
          codeviewFilterRegex: /<\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|ilayer|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|t(?:itle|extarea)|xml)[^>]*?>/gi,
          codeviewIframeFilter: true,
          codeviewIframeWhitelistSrc: [],
          codeviewIframeWhitelistSrcBase: [
              'www.youtube.com',
              'www.youtube-nocookie.com',
              'www.facebook.com',
              'vine.co',
              'instagram.com',
              'player.vimeo.com',
              'www.dailymotion.com',
              'player.youku.com',
              'v.qq.com',
          ],
          keyMap: {
              pc: {
                  'ENTER': 'insertParagraph',
                  'CTRL+Z': 'undo',
                  'CTRL+Y': 'redo',
                  'TAB': 'tab',
                  'SHIFT+TAB': 'untab',
                  'CTRL+B': 'bold',
                  'CTRL+I': 'italic',
                  'CTRL+U': 'underline',
                  'CTRL+SHIFT+S': 'strikethrough',
                  'CTRL+BACKSLASH': 'removeFormat',
                  'CTRL+SHIFT+L': 'justifyLeft',
                  'CTRL+SHIFT+E': 'justifyCenter',
                  'CTRL+SHIFT+R': 'justifyRight',
                  'CTRL+SHIFT+J': 'justifyFull',
                  'CTRL+SHIFT+NUM7': 'insertUnorderedList',
                  'CTRL+SHIFT+NUM8': 'insertOrderedList',
                  'CTRL+LEFTBRACKET': 'outdent',
                  'CTRL+RIGHTBRACKET': 'indent',
                  'CTRL+NUM0': 'formatPara',
                  'CTRL+NUM1': 'formatH1',
                  'CTRL+NUM2': 'formatH2',
                  'CTRL+NUM3': 'formatH3',
                  'CTRL+NUM4': 'formatH4',
                  'CTRL+NUM5': 'formatH5',
                  'CTRL+NUM6': 'formatH6',
                  'CTRL+ENTER': 'insertHorizontalRule',
                  'CTRL+K': 'linkDialog.show'
              },
              mac: {
                  'ENTER': 'insertParagraph',
                  'CMD+Z': 'undo',
                  'CMD+SHIFT+Z': 'redo',
                  'TAB': 'tab',
                  'SHIFT+TAB': 'untab',
                  'CMD+B': 'bold',
                  'CMD+I': 'italic',
                  'CMD+U': 'underline',
                  'CMD+SHIFT+S': 'strikethrough',
                  'CMD+BACKSLASH': 'removeFormat',
                  'CMD+SHIFT+L': 'justifyLeft',
                  'CMD+SHIFT+E': 'justifyCenter',
                  'CMD+SHIFT+R': 'justifyRight',
                  'CMD+SHIFT+J': 'justifyFull',
                  'CMD+SHIFT+NUM7': 'insertUnorderedList',
                  'CMD+SHIFT+NUM8': 'insertOrderedList',
                  'CMD+LEFTBRACKET': 'outdent',
                  'CMD+RIGHTBRACKET': 'indent',
                  'CMD+NUM0': 'formatPara',
                  'CMD+NUM1': 'formatH1',
                  'CMD+NUM2': 'formatH2',
                  'CMD+NUM3': 'formatH3',
                  'CMD+NUM4': 'formatH4',
                  'CMD+NUM5': 'formatH5',
                  'CMD+NUM6': 'formatH6',
                  'CMD+ENTER': 'insertHorizontalRule',
                  'CMD+K': 'linkDialog.show'
              }
          },
          icons: {
              'align': 'note-icon-align',
              'alignCenter': 'note-icon-align-center',
              'alignJustify': 'note-icon-align-justify',
              'alignLeft': 'note-icon-align-left',
              'alignRight': 'note-icon-align-right',
              'rowBelow': 'note-icon-row-below',
              'colBefore': 'note-icon-col-before',
              'colAfter': 'note-icon-col-after',
              'rowAbove': 'note-icon-row-above',
              'rowRemove': 'note-icon-row-remove',
              'colRemove': 'note-icon-col-remove',
              'indent': 'note-icon-align-indent',
              'outdent': 'note-icon-align-outdent',
              'arrowsAlt': 'note-icon-arrows-alt',
              'bold': 'note-icon-bold',
              'caret': 'note-icon-caret',
              'circle': 'note-icon-circle',
              'close': 'note-icon-close',
              'code': 'note-icon-code',
              'eraser': 'note-icon-eraser',
              'floatLeft': 'note-icon-float-left',
              'floatRight': 'note-icon-float-right',
              'font': 'note-icon-font',
              'frame': 'note-icon-frame',
              'italic': 'note-icon-italic',
              'link': 'note-icon-link',
              'unlink': 'note-icon-chain-broken',
              'magic': 'note-icon-magic',
              'menuCheck': 'note-icon-menu-check',
              'minus': 'note-icon-minus',
              'orderedlist': 'note-icon-orderedlist',
              'pencil': 'note-icon-pencil',
              'picture': 'note-icon-picture',
              'question': 'note-icon-question',
              'redo': 'note-icon-redo',
              'rollback': 'note-icon-rollback',
              'square': 'note-icon-square',
              'strikethrough': 'note-icon-strikethrough',
              'subscript': 'note-icon-subscript',
              'superscript': 'note-icon-superscript',
              'table': 'note-icon-table',
              'textHeight': 'note-icon-text-height',
              'trash': 'note-icon-trash',
              'underline': 'note-icon-underline',
              'undo': 'note-icon-undo',
              'unorderedlist': 'note-icon-unorderedlist',
              'video': 'note-icon-video'
          }
      }
  });

  $$1.summernote = $$1.extend($$1.summernote, {
      ui: ui
  });

}));
//# sourceMappingURL=summernote-lite.js.map

!function(e){e.extend(e.summernote.lang,{"ar-AR":{font:{bold:"عريض",italic:"مائل",underline:"تحته خط",clear:"مسح التنسيق",height:"إرتفاع السطر",name:"الخط",strikethrough:"فى وسطه خط",subscript:"مخطوطة",superscript:"حرف فوقي",size:"الحجم"},image:{image:"صورة",insert:"إضافة صورة",resizeFull:"الحجم بالكامل",resizeHalf:"تصغير للنصف",resizeQuarter:"تصغير للربع",floatLeft:"تطيير لليسار",floatRight:"تطيير لليمين",floatNone:"ثابته",shapeRounded:"الشكل: تقريب",shapeCircle:"الشكل: دائرة",shapeThumbnail:"الشكل: صورة مصغرة",shapeNone:"الشكل: لا شيء",dragImageHere:"إدرج الصورة هنا",dropImage:"إسقاط صورة أو نص",selectFromFiles:"حدد ملف",maximumFileSize:"الحد الأقصى لحجم الملف",maximumFileSizeError:"تم تجاوز الحد الأقصى لحجم الملف",url:"رابط الصورة",remove:"حذف الصورة",original:"Original"},video:{video:"فيديو",videoLink:"رابط الفيديو",insert:"إدراج الفيديو",url:"رابط الفيديو",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)"},link:{link:"رابط رابط",insert:"إدراج",unlink:"حذف الرابط",edit:"تعديل",textToDisplay:"النص",url:"مسار الرابط",openInNewWindow:"فتح في نافذة جديدة"},table:{table:"جدول",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"إدراج خط أفقي"},style:{style:"تنسيق",p:"عادي",blockquote:"إقتباس",pre:"شفيرة",h1:"عنوان رئيسي 1",h2:"عنوان رئيسي 2",h3:"عنوان رئيسي 3",h4:"عنوان رئيسي 4",h5:"عنوان رئيسي 5",h6:"عنوان رئيسي 6"},lists:{unordered:"قائمة مُنقطة",ordered:"قائمة مُرقمة"},options:{help:"مساعدة",fullscreen:"حجم الشاشة بالكامل",codeview:"شفيرة المصدر"},paragraph:{paragraph:"فقرة",outdent:"محاذاة للخارج",indent:"محاذاة للداخل",left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين",justify:"ملئ السطر"},color:{recent:"تم إستخدامه",more:"المزيد",background:"لون الخلفية",foreground:"لون النص",transparent:"شفاف",setTransparent:"بدون خلفية",reset:"إعادة الضبط",resetToDefault:"إعادة الضبط",cpSelect:"اختار"},shortcut:{shortcuts:"إختصارات",close:"غلق",textFormatting:"تنسيق النص",action:"Action",paragraphFormatting:"تنسيق الفقرة",documentStyle:"تنسيق المستند",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"تراجع",redo:"إعادة"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"bg-BG":{font:{bold:"Удебелен",italic:"Наклонен",underline:"Подчертан",clear:"Изчисти стиловете",height:"Височина",name:"Шрифт",strikethrough:"Задраскано",subscript:"Долен индекс",superscript:"Горен индекс",size:"Размер на шрифта"},image:{image:"Изображение",insert:"Постави картинка",resizeFull:"Цял размер",resizeHalf:"Размер на 50%",resizeQuarter:"Размер на 25%",floatLeft:"Подравни в ляво",floatRight:"Подравни в дясно",floatNone:"Без подравняване",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Пуснете изображението тук",dropImage:"Drop image or Text",selectFromFiles:"Изберете файл",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL адрес на изображение",remove:"Премахни изображение",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"Връзка",insert:"Добави връзка",unlink:"Премахни връзка",edit:"Промени",textToDisplay:"Текст за показване",url:"URL адрес",openInNewWindow:"Отвори в нов прозорец"},table:{table:"Таблица",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Добави хоризонтална линия"},style:{style:"Стил",p:"Нормален",blockquote:"Цитат",pre:"Код",h1:"Заглавие 1",h2:"Заглавие 2",h3:"Заглавие 3",h4:"Заглавие 4",h5:"Заглавие 5",h6:"Заглавие 6"},lists:{unordered:"Символен списък",ordered:"Цифров списък"},options:{help:"Помощ",fullscreen:"На цял екран",codeview:"Преглед на код"},paragraph:{paragraph:"Параграф",outdent:"Намаляване на отстъпа",indent:"Абзац",left:"Подравняване в ляво",center:"Център",right:"Подравняване в дясно",justify:"Разтягане по ширина"},color:{recent:"Последния избран цвят",more:"Още цветове",background:"Цвят на фона",foreground:"Цвят на шрифта",transparent:"Прозрачен",setTransparent:"Направете прозрачен",reset:"Възстанови",resetToDefault:"Възстанови оригиналните",cpSelect:"Изберете"},shortcut:{shortcuts:"Клавишни комбинации",close:"Затвори",textFormatting:"Форматиране на текста",action:"Действие",paragraphFormatting:"Форматиране на параграф",documentStyle:"Стил на документа",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Назад",redo:"Напред"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"ca-ES":{font:{bold:"Negreta",italic:"Cursiva",underline:"Subratllat",clear:"Treure estil de lletra",height:"Alçada de línia",name:"Font",strikethrough:"Ratllat",subscript:"Subíndex",superscript:"Superíndex",size:"Mida de lletra"},image:{image:"Imatge",insert:"Inserir imatge",resizeFull:"Redimensionar a mida completa",resizeHalf:"Redimensionar a la meitat",resizeQuarter:"Redimensionar a un quart",floatLeft:"Alinear a l'esquerra",floatRight:"Alinear a la dreta",floatNone:"No alinear",shapeRounded:"Forma: Arrodonit",shapeCircle:"Forma: Cercle",shapeThumbnail:"Forma: Marc",shapeNone:"Forma: Cap",dragImageHere:"Arrossegueu una imatge o text aquí",dropImage:"Deixa anar aquí una imatge o un text",selectFromFiles:"Seleccioneu des dels arxius",maximumFileSize:"Mida màxima de l'arxiu",maximumFileSizeError:"La mida màxima de l'arxiu s'ha superat.",url:"URL de la imatge",remove:"Eliminar imatge",original:"Original"},video:{video:"Vídeo",videoLink:"Enllaç del vídeo",insert:"Inserir vídeo",url:"URL del vídeo?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)"},link:{link:"Enllaç",insert:"Inserir enllaç",unlink:"Treure enllaç",edit:"Editar",textToDisplay:"Text per mostrar",url:"Cap a quina URL porta l'enllaç?",openInNewWindow:"Obrir en una finestra nova"},table:{table:"Taula",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Inserir línia horitzontal"},style:{style:"Estil",p:"p",blockquote:"Cita",pre:"Codi",h1:"Títol 1",h2:"Títol 2",h3:"Títol 3",h4:"Títol 4",h5:"Títol 5",h6:"Títol 6"},lists:{unordered:"Llista desendreçada",ordered:"Llista endreçada"},options:{help:"Ajut",fullscreen:"Pantalla sencera",codeview:"Veure codi font"},paragraph:{paragraph:"Paràgraf",outdent:"Menys tabulació",indent:"Més tabulació",left:"Alinear a l'esquerra",center:"Alinear al mig",right:"Alinear a la dreta",justify:"Justificar"},color:{recent:"Últim color",more:"Més colors",background:"Color de fons",foreground:"Color de lletra",transparent:"Transparent",setTransparent:"Establir transparent",reset:"Restablir",resetToDefault:"Restablir per defecte"},shortcut:{shortcuts:"Dreceres de teclat",close:"Tancar",textFormatting:"Format de text",action:"Acció",paragraphFormatting:"Format de paràgraf",documentStyle:"Estil del document",extraKeys:"Tecles adicionals"},help:{insertParagraph:"Inserir paràgraf",undo:"Desfer l'última acció",redo:"Refer l'última acció",tab:"Tabular",untab:"Eliminar tabulació",bold:"Establir estil negreta",italic:"Establir estil cursiva",underline:"Establir estil subratllat",strikethrough:"Establir estil ratllat",removeFormat:"Netejar estil",justifyLeft:"Alinear a l'esquerra",justifyCenter:"Alinear al centre",justifyRight:"Alinear a la dreta",justifyFull:"Justificar",insertUnorderedList:"Inserir llista desendreçada",insertOrderedList:"Inserir llista endreçada",outdent:"Reduïr tabulació del paràgraf",indent:"Augmentar tabulació del paràgraf",formatPara:"Canviar l'estil del bloc com a un paràgraf (etiqueta P)",formatH1:"Canviar l'estil del bloc com a un H1",formatH2:"Canviar l'estil del bloc com a un H2",formatH3:"Canviar l'estil del bloc com a un H3",formatH4:"Canviar l'estil del bloc com a un H4",formatH5:"Canviar l'estil del bloc com a un H5",formatH6:"Canviar l'estil del bloc com a un H6",insertHorizontalRule:"Inserir una línia horitzontal","linkDialog.show":"Mostrar panel d'enllaços"},history:{undo:"Desfer",redo:"Refer"},specialChar:{specialChar:"CARÀCTERS ESPECIALS",select:"Selecciona caràcters especials"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"cs-CZ":{font:{bold:"Tučné",italic:"Kurzíva",underline:"Podtržené",clear:"Odstranit styl písma",height:"Výška řádku",strikethrough:"Přeškrtnuté",size:"Velikost písma"},image:{image:"Obrázek",insert:"Vložit obrázek",resizeFull:"Původní velikost",resizeHalf:"Poloviční velikost",resizeQuarter:"Čtvrteční velikost",floatLeft:"Umístit doleva",floatRight:"Umístit doprava",floatNone:"Neobtékat textem",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Přetáhnout sem obrázek",dropImage:"Drop image or Text",selectFromFiles:"Vybrat soubor",url:"URL obrázku",remove:"Remove Image",original:"Original"},video:{video:"Video",videoLink:"Odkaz videa",insert:"Vložit video",url:"URL videa?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion nebo Youku)"},link:{link:"Odkaz",insert:"Vytvořit odkaz",unlink:"Zrušit odkaz",edit:"Upravit",textToDisplay:"Zobrazovaný text",url:"Na jaké URL má tento odkaz vést?",openInNewWindow:"Otevřít v novém okně"},table:{table:"Tabulka",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Vložit vodorovnou čáru"},style:{style:"Styl",p:"Normální",blockquote:"Citace",pre:"Kód",h1:"Nadpis 1",h2:"Nadpis 2",h3:"Nadpis 3",h4:"Nadpis 4",h5:"Nadpis 5",h6:"Nadpis 6"},lists:{unordered:"Odrážkový seznam",ordered:"Číselný seznam"},options:{help:"Nápověda",fullscreen:"Celá obrazovka",codeview:"HTML kód"},paragraph:{paragraph:"Odstavec",outdent:"Zvětšit odsazení",indent:"Zmenšit odsazení",left:"Zarovnat doleva",center:"Zarovnat na střed",right:"Zarovnat doprava",justify:"Zarovnat oboustranně"},color:{recent:"Aktuální barva",more:"Další barvy",background:"Barva pozadí",foreground:"Barva písma",transparent:"Průhlednost",setTransparent:"Nastavit průhlednost",reset:"Obnovit",resetToDefault:"Obnovit výchozí",cpSelect:"Vybrat"},shortcut:{shortcuts:"Klávesové zkratky",close:"Zavřít",textFormatting:"Formátování textu",action:"Akce",paragraphFormatting:"Formátování odstavce",documentStyle:"Styl dokumentu"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Krok vzad",redo:"Krok vpřed"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"da-DK":{font:{bold:"Fed",italic:"Kursiv",underline:"Understreget",clear:"Fjern formatering",height:"Højde",name:"Skrifttype",strikethrough:"Gennemstreget",subscript:"Sænket skrift",superscript:"Hævet skrift",size:"Skriftstørrelse"},image:{image:"Billede",insert:"Indsæt billede",resizeFull:"Original størrelse",resizeHalf:"Halv størrelse",resizeQuarter:"Kvart størrelse",floatLeft:"Venstrestillet",floatRight:"Højrestillet",floatNone:"Fjern formatering",shapeRounded:"Form: Runde kanter",shapeCircle:"Form: Cirkel",shapeThumbnail:"Form: Miniature",shapeNone:"Form: Ingen",dragImageHere:"Træk billede hertil",dropImage:"Slip billede",selectFromFiles:"Vælg billed-fil",maximumFileSize:"Maks fil størrelse",maximumFileSizeError:"Filen er større end maks tilladte fil størrelse!",url:"Billede URL",remove:"Fjern billede",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Indsæt Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)"},link:{link:"Link",insert:"Indsæt link",unlink:"Fjern link",edit:"Rediger",textToDisplay:"Visningstekst",url:"Hvor skal linket pege hen?",openInNewWindow:"Åbn i nyt vindue"},table:{table:"Tabel",addRowAbove:"Tilføj række over",addRowBelow:"Tilføj række under",addColLeft:"Tilføj venstre kolonne",addColRight:"Tilføj højre kolonne",delRow:"Slet række",delCol:"Slet kolonne",delTable:"Slet tabel"},hr:{insert:"Indsæt horisontal linje"},style:{style:"Stil",p:"p",blockquote:"Citat",pre:"Kode",h1:"Overskrift 1",h2:"Overskrift 2",h3:"Overskrift 3",h4:"Overskrift 4",h5:"Overskrift 5",h6:"Overskrift 6"},lists:{unordered:"Punktopstillet liste",ordered:"Nummereret liste"},options:{help:"Hjælp",fullscreen:"Fuld skærm",codeview:"HTML-Visning"},paragraph:{paragraph:"Afsnit",outdent:"Formindsk indryk",indent:"Forøg indryk",left:"Venstrestillet",center:"Centreret",right:"Højrestillet",justify:"Blokjuster"},color:{recent:"Nyligt valgt farve",more:"Flere farver",background:"Baggrund",foreground:"Forgrund",transparent:"Transparent",setTransparent:"Sæt transparent",reset:"Nulstil",resetToDefault:"Gendan standardindstillinger"},shortcut:{shortcuts:"Genveje",close:"Luk",textFormatting:"Tekstformatering",action:"Handling",paragraphFormatting:"Afsnitsformatering",documentStyle:"Dokumentstil",extraKeys:"Extra keys"},help:{insertParagraph:"Indsæt paragraf",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Vis Link Dialog"},history:{undo:"Fortryd",redo:"Annuller fortryd"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Vælg special karakterer"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"de-DE":{font:{bold:"Fett",italic:"Kursiv",underline:"Unterstreichen",clear:"Zurücksetzen",height:"Zeilenhöhe",name:"Schriftart",strikethrough:"Durchgestrichen",subscript:"Tiefgestellt",superscript:"Hochgestellt",size:"Schriftgröße"},image:{image:"Bild",insert:"Bild einfügen",resizeFull:"Originalgröße",resizeHalf:"1/2 Größe",resizeQuarter:"1/4 Größe",floatLeft:"Linksbündig",floatRight:"Rechtsbündig",floatNone:"Kein Textfluss",shapeRounded:"Abgerundeter Rahmen",shapeCircle:"Kreisförmiger Rahmen",shapeThumbnail:"Rahmenvorschau",shapeNone:"Kein Rahmen",dragImageHere:"Bild hierher ziehen",dropImage:"Bild oder Text nehmen",selectFromFiles:"Datei auswählen",maximumFileSize:"Maximale Dateigröße",maximumFileSizeError:"Maximale Dateigröße überschritten",url:"Bild URL",remove:"Bild entfernen",original:"Original"},video:{video:"Video",videoLink:"Videolink",insert:"Video einfügen",url:"Video URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion oder Youku)"},link:{link:"Link",insert:"Link einfügen",unlink:"Link entfernen",edit:"Bearbeiten",textToDisplay:"Anzeigetext",url:"Link URL",openInNewWindow:"In neuem Fenster öffnen"},table:{table:"Tabelle",addRowAbove:"+ Zeile oberhalb",addRowBelow:"+ Zeile unterhalb",addColLeft:"+ Spalte links",addColRight:"+ Spalte rechts",delRow:"Reihe löschen",delCol:"Spalte löschen",delTable:"Tabelle löschen"},hr:{insert:"Horizontale Linie einfügen"},style:{style:"Stil",normal:"Normal",p:"Normal",blockquote:"Zitat",pre:"Quellcode",h1:"Überschrift 1",h2:"Überschrift 2",h3:"Überschrift 3",h4:"Überschrift 4",h5:"Überschrift 5",h6:"Überschrift 6"},lists:{unordered:"Unnummerierte Liste",ordered:"Nummerierte Liste"},options:{help:"Hilfe",fullscreen:"Vollbild",codeview:"Quellcode anzeigen"},paragraph:{paragraph:"Absatz",outdent:"Einzug verkleinern",indent:"Einzug vergrößern",left:"Links ausrichten",center:"Zentriert ausrichten",right:"Rechts ausrichten",justify:"Blocksatz"},color:{recent:"Letzte Farbe",more:"Weitere Farben",background:"Hintergrundfarbe",foreground:"Schriftfarbe",transparent:"Transparenz",setTransparent:"Transparenz setzen",reset:"Zurücksetzen",resetToDefault:"Auf Standard zurücksetzen"},shortcut:{shortcuts:"Tastenkürzel",close:"Schließen",textFormatting:"Textformatierung",action:"Aktion",paragraphFormatting:"Absatzformatierung",documentStyle:"Dokumentenstil",extraKeys:"Weitere Tasten"},help:{insertParagraph:"Absatz einfügen",undo:"Letzte Anweisung rückgängig",redo:"Letzte Anweisung wiederholen",tab:"Einzug hinzufügen",untab:"Einzug entfernen",bold:"Schrift Fett",italic:"Schrift Kursiv",underline:"Unterstreichen",strikethrough:"Durchstreichen",removeFormat:"Entfernt Format",justifyLeft:"Linksbündig",justifyCenter:"Mittig",justifyRight:"Rechtsbündig",justifyFull:"Blocksatz",insertUnorderedList:"Unnummerierte Liste",insertOrderedList:"Nummerierte Liste",outdent:"Aktuellen Absatz ausrücken",indent:"Aktuellen Absatz einrücken",formatPara:"Formatiert aktuellen Block als Absatz (P-Tag)",formatH1:"Formatiert aktuellen Block als H1",formatH2:"Formatiert aktuellen Block als H2",formatH3:"Formatiert aktuellen Block als H3",formatH4:"Formatiert aktuellen Block als H4",formatH5:"Formatiert aktuellen Block als H5",formatH6:"Formatiert aktuellen Block als H6",insertHorizontalRule:"Fügt eine horizontale Linie ein","linkDialog.show":"Zeigt Linkdialog"},history:{undo:"Rückgängig",redo:"Wiederholen"},specialChar:{specialChar:"Sonderzeichen",select:"Zeichen auswählen"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"el-GR":{font:{bold:"Έντονα",italic:"Πλάγια",underline:"Υπογραμμισμένα",clear:"Καθαρισμός",height:"Ύψος",name:"Γραμματοσειρά",strikethrough:"Διεγραμμένα",subscript:"Δείκτης",superscript:"Εκθέτης",size:"Μέγεθος"},image:{image:"εικόνα",insert:"Εισαγωγή",resizeFull:"Πλήρες μέγεθος",resizeHalf:"Μισό μέγεθος",resizeQuarter:"1/4 μέγεθος",floatLeft:"Μετατόπιση αριστερά",floatRight:"Μετατόπιση δεξιά",floatNone:"Χωρίς μετατόπιση",shapeRounded:"Σχήμα: Στρογγυλεμένο",shapeCircle:"Σχήμα: Κύκλος",shapeThumbnail:"Σχήμα: Thumbnail",shapeNone:"Σχήμα: Κανένα",dragImageHere:"Σύρτε την εικόνα εδώ",dropImage:"Αφήστε την εικόνα",selectFromFiles:"Επιλογή από αρχεία",maximumFileSize:"Μέγιστο μέγεθος αρχείου",maximumFileSizeError:"Το μέγεθος είναι μεγαλύτερο από το μέγιστο επιτρεπτό.",url:"URL",remove:"Αφαίρεση",original:"Original"},link:{link:"Σύνδεσμος",insert:"Εισαγωγή συνδέσμου",unlink:"Αφαίρεση συνδέσμου",edit:"Επεξεργασία συνδέσμου",textToDisplay:"Κείμενο συνδέσμου",url:"URL",openInNewWindow:"Άνοιγμα σε νέο παράθυρο"},video:{video:"Βίντεο",videoLink:"Σύνδεσμος Βίντεο",insert:"Εισαγωγή",url:"URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},table:{table:"Πίνακας",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Εισαγωγή οριζόντιας γραμμής"},style:{style:"Στυλ",normal:"Κανονικό",blockquote:"Παράθεση",pre:"Ως έχει",h1:"Κεφαλίδα 1",h2:"συνδέσμου 2",h3:"συνδέσμου 3",h4:"συνδέσμου 4",h5:"συνδέσμου 5",h6:"συνδέσμου 6"},lists:{unordered:"Αταξινόμητη λίστα",ordered:"Ταξινομημένη λίστα"},options:{help:"Βοήθεια",fullscreen:"Πλήρης οθόνη",codeview:"Προβολή HTML"},paragraph:{paragraph:"Παράγραφος",outdent:"Μείωση εσοχής",indent:"Άυξηση εσοχής",left:"Αριστερή στοίχιση",center:"Στοίχιση στο κέντρο",right:"Δεξιά στοίχιση",justify:"Πλήρης στοίχιση"},color:{recent:"Πρόσφατη επιλογή",more:"Περισσότερα",background:"Υπόβαθρο",foreground:"Μπροστά",transparent:"Διαφανές",setTransparent:"Επιλογή διαφάνειας",reset:"Επαναφορά",resetToDefault:"Επαναφορά στις προκαθορισμένες τιμές"},shortcut:{shortcuts:"Συντομεύσεις",close:"Κλείσιμο",textFormatting:"Διαμόρφωση κειμένου",action:"Ενέργεια",paragraphFormatting:"Διαμόρφωση παραγράφου",documentStyle:"Στυλ κειμένου",extraKeys:"Επιπλέον συντομεύσεις"},help:{insertParagraph:"Εισαγωγή παραγράφου",undo:"Αναιρεί την προηγούμενη εντολή",redo:"Επαναλαμβάνει την προηγούμενη εντολή",tab:"Εσοχή",untab:"Αναίρεση εσοχής",bold:"Ορισμός έντονου στυλ",italic:"Ορισμός πλάγιου στυλ",underline:"Ορισμός υπογεγραμμένου στυλ",strikethrough:"Ορισμός διεγραμμένου στυλ",removeFormat:"Αφαίρεση στυλ",justifyLeft:"Ορισμός αριστερής στοίχισης",justifyCenter:"Ορισμός κεντρικής στοίχισης",justifyRight:"Ορισμός δεξιάς στοίχισης",justifyFull:"Ορισμός πλήρους στοίχισης",insertUnorderedList:"Ορισμός μη-ταξινομημένης λίστας",insertOrderedList:"Ορισμός ταξινομημένης λίστας",outdent:"Προεξοχή παραγράφου",indent:"Εσοχή παραγράφου",formatPara:"Αλλαγή της μορφής του τρέχοντος μπλοκ σε παράγραφο (P tag)",formatH1:"Αλλαγή της μορφής του τρέχοντος μπλοκ σε H1",formatH2:"Αλλαγή της μορφής του τρέχοντος μπλοκ σε H2",formatH3:"Αλλαγή της μορφής του τρέχοντος μπλοκ σε H3",formatH4:"Αλλαγή της μορφής του τρέχοντος μπλοκ σε H4",formatH5:"Αλλαγή της μορφής του τρέχοντος μπλοκ σε H5",formatH6:"Αλλαγή της μορφής του τρέχοντος μπλοκ σε H6",insertHorizontalRule:"Εισαγωγή οριζόντιας γραμμής","linkDialog.show":"Εμφάνιση διαλόγου συνδέσμου"},history:{undo:"Αναίρεση",redo:"Επαναληψη"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Επιλέξτε ειδικούς χαρακτήρες"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"es-ES":{font:{bold:"Negrita",italic:"Cursiva",underline:"Subrayado",clear:"Quitar estilo de fuente",height:"Altura de línea",name:"Fuente",strikethrough:"Tachado",superscript:"Superíndice",subscript:"Subíndice",size:"Tamaño de la fuente"},image:{image:"Imagen",insert:"Insertar imagen",resizeFull:"Redimensionar a tamaño completo",resizeHalf:"Redimensionar a la mitad",resizeQuarter:"Redimensionar a un cuarto",floatLeft:"Flotar a la izquierda",floatRight:"Flotar a la derecha",floatNone:"No flotar",shapeRounded:"Forma: Redondeado",shapeCircle:"Forma: Círculo",shapeThumbnail:"Forma: Marco",shapeNone:"Forma: Ninguna",dragImageHere:"Arrastrar una imagen o texto aquí",dropImage:"Suelta la imagen o texto",selectFromFiles:"Seleccionar desde los archivos",maximumFileSize:"Tamaño máximo del archivo",maximumFileSizeError:"Has superado el tamaño máximo del archivo.",url:"URL de la imagen",remove:"Eliminar imagen",original:"Original"},video:{video:"Vídeo",videoLink:"Link del vídeo",insert:"Insertar vídeo",url:"¿URL del vídeo?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)"},link:{link:"Link",insert:"Insertar link",unlink:"Quitar link",edit:"Editar",textToDisplay:"Texto para mostrar",url:"¿Hacia que URL lleva el link?",openInNewWindow:"Abrir en una nueva ventana"},table:{table:"Tabla",addRowAbove:"Añadir fila encima",addRowBelow:"Añadir fila debajo",addColLeft:"Añadir columna izquierda",addColRight:"Añadir columna derecha",delRow:"Borrar fila",delCol:"Eliminar columna",delTable:"Eliminar tabla"},hr:{insert:"Insertar línea horizontal"},style:{style:"Estilo",p:"p",blockquote:"Cita",pre:"Código",h1:"Título 1",h2:"Título 2",h3:"Título 3",h4:"Título 4",h5:"Título 5",h6:"Título 6"},lists:{unordered:"Lista desordenada",ordered:"Lista ordenada"},options:{help:"Ayuda",fullscreen:"Pantalla completa",codeview:"Ver código fuente"},paragraph:{paragraph:"Párrafo",outdent:"Menos tabulación",indent:"Más tabulación",left:"Alinear a la izquierda",center:"Alinear al centro",right:"Alinear a la derecha",justify:"Justificar"},color:{recent:"Último color",more:"Más colores",background:"Color de fondo",foreground:"Color de fuente",transparent:"Transparente",setTransparent:"Establecer transparente",reset:"Restaurar",resetToDefault:"Restaurar por defecto"},shortcut:{shortcuts:"Atajos de teclado",close:"Cerrar",textFormatting:"Formato de texto",action:"Acción",paragraphFormatting:"Formato de párrafo",documentStyle:"Estilo de documento",extraKeys:"Teclas adicionales"},help:{insertParagraph:"Insertar párrafo",undo:"Deshacer última acción",redo:"Rehacer última acción",tab:"Tabular",untab:"Eliminar tabulación",bold:"Establecer estilo negrita",italic:"Establecer estilo cursiva",underline:"Establecer estilo subrayado",strikethrough:"Establecer estilo tachado",removeFormat:"Limpiar estilo",justifyLeft:"Alinear a la izquierda",justifyCenter:"Alinear al centro",justifyRight:"Alinear a la derecha",justifyFull:"Justificar",insertUnorderedList:"Insertar lista desordenada",insertOrderedList:"Insertar lista ordenada",outdent:"Reducir tabulación del párrafo",indent:"Aumentar tabulación del párrafo",formatPara:"Cambiar estilo del bloque a párrafo (etiqueta P)",formatH1:"Cambiar estilo del bloque a H1",formatH2:"Cambiar estilo del bloque a H2",formatH3:"Cambiar estilo del bloque a H3",formatH4:"Cambiar estilo del bloque a H4",formatH5:"Cambiar estilo del bloque a H5",formatH6:"Cambiar estilo del bloque a H6",insertHorizontalRule:"Insertar línea horizontal","linkDialog.show":"Mostrar panel enlaces"},history:{undo:"Deshacer",redo:"Rehacer"},specialChar:{specialChar:"CARACTERES ESPECIALES",select:"Selecciona Caracteres especiales"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"es-EU":{font:{bold:"Lodia",italic:"Etzana",underline:"Azpimarratua",clear:"Estiloa kendu",height:"Lerro altuera",name:"Tipografia",strikethrough:"Marratua",subscript:"Subscript",superscript:"Superscript",size:"Letren neurria"},image:{image:"Irudia",insert:"Irudi bat txertatu",resizeFull:"Jatorrizko neurrira aldatu",resizeHalf:"Neurria erdira aldatu",resizeQuarter:"Neurria laurdenera aldatu",floatLeft:"Ezkerrean kokatu",floatRight:"Eskuinean kokatu",floatNone:"Kokapenik ez ezarri",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Irudi bat ezarri hemen",dropImage:"Drop image or Text",selectFromFiles:"Zure fitxategi bat aukeratu",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Irudiaren URL helbidea",remove:"Remove Image",original:"Original"},video:{video:"Bideoa",videoLink:"Bideorako esteka",insert:"Bideo berri bat txertatu",url:"Bideoaren URL helbidea",providers:"(YouTube, Vimeo, Vine, Instagram edo DailyMotion)"},link:{link:"Esteka",insert:"Esteka bat txertatu",unlink:"Esteka ezabatu",edit:"Editatu",textToDisplay:"Estekaren testua",url:"Estekaren URL helbidea",openInNewWindow:"Leiho berri batean ireki"},table:{table:"Taula",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Marra horizontala txertatu"},style:{style:"Estiloa",p:"p",blockquote:"Aipamena",pre:"Kodea",h1:"1. izenburua",h2:"2. izenburua",h3:"3. izenburua",h4:"4. izenburua",h5:"5. izenburua",h6:"6. izenburua"},lists:{unordered:"Ordenatu gabeko zerrenda",ordered:"Zerrenda ordenatua"},options:{help:"Laguntza",fullscreen:"Pantaila osoa",codeview:"Kodea ikusi"},paragraph:{paragraph:"Paragrafoa",outdent:"Koska txikiagoa",indent:"Koska handiagoa",left:"Ezkerrean kokatu",center:"Erdian kokatu",right:"Eskuinean kokatu",justify:"Justifikatu"},color:{recent:"Azken kolorea",more:"Kolore gehiago",background:"Atzeko planoa",foreground:"Aurreko planoa",transparent:"Gardena",setTransparent:"Gardendu",reset:"Lehengoratu",resetToDefault:"Berrezarri lehenetsia"},shortcut:{shortcuts:"Lasterbideak",close:"Itxi",textFormatting:"Testuaren formatua",action:"Ekintza",paragraphFormatting:"Paragrafoaren formatua",documentStyle:"Dokumentuaren estiloa"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Desegin",redo:"Berregin"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"fa-IR":{font:{bold:"درشت",italic:"خمیده",underline:"میان خط",clear:"پاک کردن فرمت فونت",height:"فاصله ی خطی",name:"اسم فونت",strikethrough:"Strike",subscript:"Subscript",superscript:"Superscript",size:"اندازه ی فونت"},image:{image:"تصویر",insert:"وارد کردن تصویر",resizeFull:"تغییر به اندازه ی کامل",resizeHalf:"تغییر به اندازه نصف",resizeQuarter:"تغییر به اندازه یک چهارم",floatLeft:"چسباندن به چپ",floatRight:"چسباندن به راست",floatNone:"بدون چسبندگی",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"یک تصویر را اینجا بکشید",dropImage:"Drop image or Text",selectFromFiles:"فایل ها را انتخاب کنید",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"آدرس تصویر",remove:"حذف تصویر",original:"Original"},video:{video:"ویدیو",videoLink:"لینک ویدیو",insert:"افزودن ویدیو",url:"آدرس ویدیو ؟",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion یا Youku)"},link:{link:"لینک",insert:"اضافه کردن لینک",unlink:"حذف لینک",edit:"ویرایش",textToDisplay:"متن جهت نمایش",url:"این لینک به چه آدرسی باید برود ؟",openInNewWindow:"در یک پنجره ی جدید باز شود"},table:{table:"جدول",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"افزودن خط افقی"},style:{style:"استیل",p:"نرمال",blockquote:"نقل قول",pre:"کد",h1:"سرتیتر 1",h2:"سرتیتر 2",h3:"سرتیتر 3",h4:"سرتیتر 4",h5:"سرتیتر 5",h6:"سرتیتر 6"},lists:{unordered:"لیست غیر ترتیبی",ordered:"لیست ترتیبی"},options:{help:"راهنما",fullscreen:"نمایش تمام صفحه",codeview:"مشاهده ی کد"},paragraph:{paragraph:"پاراگراف",outdent:"کاهش تو رفتگی",indent:"افزایش تو رفتگی",left:"چپ چین",center:"میان چین",right:"راست چین",justify:"بلوک چین"},color:{recent:"رنگ اخیرا استفاده شده",more:"رنگ بیشتر",background:"رنگ پس زمینه",foreground:"رنگ متن",transparent:"بی رنگ",setTransparent:"تنظیم حالت بی رنگ",reset:"بازنشاندن",resetToDefault:"حالت پیش فرض"},shortcut:{shortcuts:"دکمه های میان بر",close:"بستن",textFormatting:"فرمت متن",action:"عملیات",paragraphFormatting:"فرمت پاراگراف",documentStyle:"استیل سند",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"واچیدن",redo:"بازچیدن"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(i){i.extend(i.summernote.lang,{"fi-FI":{font:{bold:"Lihavointi",italic:"Kursivointi",underline:"Alleviivaus",clear:"Tyhjennä muotoilu",height:"Riviväli",name:"Kirjasintyyppi",strikethrough:"Yliviivaus",subscript:"Alaindeksi",superscript:"Yläindeksi",size:"Kirjasinkoko"},image:{image:"Kuva",insert:"Lisää kuva",resizeFull:"Koko leveys",resizeHalf:"Puolikas leveys",resizeQuarter:"Neljäsosa leveys",floatLeft:"Sijoita vasemmalle",floatRight:"Sijoita oikealle",floatNone:"Ei sijoitusta",shapeRounded:"Muoto: Pyöristetty",shapeCircle:"Muoto: Ympyrä",shapeThumbnail:"Muoto: Esikatselukuva",shapeNone:"Muoto: Ei muotoilua",dragImageHere:"Vedä kuva tähän",selectFromFiles:"Valitse tiedostoista",maximumFileSize:"Maksimi tiedosto koko",maximumFileSizeError:"Maksimi tiedosto koko ylitetty.",url:"URL-osoitteen mukaan",remove:"Poista kuva",original:"Alkuperäinen"},video:{video:"Video",videoLink:"Linkki videoon",insert:"Lisää video",url:"Videon URL-osoite",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion tai Youku)"},link:{link:"Linkki",insert:"Lisää linkki",unlink:"Poista linkki",edit:"Muokkaa",textToDisplay:"Näytettävä teksti",url:"Linkin URL-osoite",openInNewWindow:"Avaa uudessa ikkunassa"},table:{table:"Taulukko",addRowAbove:"Lisää rivi yläpuolelle",addRowBelow:"Lisää rivi alapuolelle",addColLeft:"Lisää sarake vasemmalle puolelle",addColRight:"Lisää sarake oikealle puolelle",delRow:"Poista rivi",delCol:"Poista sarake",delTable:"Poista taulukko"},hr:{insert:"Lisää vaakaviiva"},style:{style:"Tyyli",p:"Normaali",blockquote:"Lainaus",pre:"Koodi",h1:"Otsikko 1",h2:"Otsikko 2",h3:"Otsikko 3",h4:"Otsikko 4",h5:"Otsikko 5",h6:"Otsikko 6"},lists:{unordered:"Luettelomerkitty luettelo",ordered:"Numeroitu luettelo"},options:{help:"Ohje",fullscreen:"Koko näyttö",codeview:"HTML-näkymä"},paragraph:{paragraph:"Kappale",outdent:"Pienennä sisennystä",indent:"Suurenna sisennystä",left:"Tasaa vasemmalle",center:"Keskitä",right:"Tasaa oikealle",justify:"Tasaa"},color:{recent:"Viimeisin väri",more:"Lisää värejä",background:"Korostusväri",foreground:"Tekstin väri",transparent:"Läpinäkyvä",setTransparent:"Aseta läpinäkyväksi",reset:"Palauta",resetToDefault:"Palauta oletusarvoksi"},shortcut:{shortcuts:"Pikanäppäimet",close:"Sulje",textFormatting:"Tekstin muotoilu",action:"Toiminto",paragraphFormatting:"Kappaleen muotoilu",documentStyle:"Asiakirjan tyyli"},help:{insertParagraph:"Lisää kappale",undo:"Kumoa viimeisin komento",redo:"Tee uudelleen kumottu komento",tab:"Sarkain",untab:"Sarkainmerkin poisto",bold:"Lihavointi",italic:"Kursiivi",underline:"Alleviivaus",strikethrough:"Yliviivaus",removeFormat:"Poista asetetut tyylit",justifyLeft:"Tasaa vasemmalle",justifyCenter:"Keskitä",justifyRight:"Tasaa oikealle",justifyFull:"Tasaa",insertUnorderedList:"Luettelomerkillä varustettu lista",insertOrderedList:"Numeroitu lista",outdent:"Pienennä sisennystä",indent:"Suurenna sisennystä",formatPara:"Muuta kappaleen formaatti p",formatH1:"Muuta kappaleen formaatti H1",formatH2:"Muuta kappaleen formaatti H2",formatH3:"Muuta kappaleen formaatti H3",formatH4:"Muuta kappaleen formaatti H4",formatH5:"Muuta kappaleen formaatti H5",formatH6:"Muuta kappaleen formaatti H6",insertHorizontalRule:"Lisää vaakaviiva","linkDialog.show":"Lisää linkki"},history:{undo:"Kumoa",redo:"Toista"},specialChar:{specialChar:"ERIKOISMERKIT",select:"Valitse erikoismerkit"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"fr-FR":{font:{bold:"Gras",italic:"Italique",underline:"Souligné",clear:"Effacer la mise en forme",height:"Interligne",name:"Famille de police",strikethrough:"Barré",superscript:"Exposant",subscript:"Indice",size:"Taille de police"},image:{image:"Image",insert:"Insérer une image",resizeFull:"Taille originale",resizeHalf:"Redimensionner à 50 %",resizeQuarter:"Redimensionner à 25 %",floatLeft:"Aligné à gauche",floatRight:"Aligné à droite",floatNone:"Pas d'alignement",shapeRounded:"Forme: Rectangle arrondi",shapeCircle:"Forme: Cercle",shapeThumbnail:"Forme: Vignette",shapeNone:"Forme: Aucune",dragImageHere:"Faites glisser une image ou un texte dans ce cadre",dropImage:"Lachez l'image ou le texte",selectFromFiles:"Choisir un fichier",maximumFileSize:"Taille de fichier maximale",maximumFileSizeError:"Taille maximale du fichier dépassée",url:"URL de l'image",remove:"Supprimer l'image",original:"Original"},video:{video:"Vidéo",videoLink:"Lien vidéo",insert:"Insérer une vidéo",url:"URL de la vidéo",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)"},link:{link:"Lien",insert:"Insérer un lien",unlink:"Supprimer un lien",edit:"Modifier",textToDisplay:"Texte à afficher",url:"URL du lien",openInNewWindow:"Ouvrir dans une nouvelle fenêtre"},table:{table:"Tableau",addRowAbove:"Ajouter une ligne au-dessus",addRowBelow:"Ajouter une ligne en dessous",addColLeft:"Ajouter une colonne à gauche",addColRight:"Ajouter une colonne à droite",delRow:"Supprimer la ligne",delCol:"Supprimer la colonne",delTable:"Supprimer le tableau"},hr:{insert:"Insérer une ligne horizontale"},style:{style:"Style",p:"Normal",blockquote:"Citation",pre:"Code source",h1:"Titre 1",h2:"Titre 2",h3:"Titre 3",h4:"Titre 4",h5:"Titre 5",h6:"Titre 6"},lists:{unordered:"Liste à puces",ordered:"Liste numérotée"},options:{help:"Aide",fullscreen:"Plein écran",codeview:"Afficher le code HTML"},paragraph:{paragraph:"Paragraphe",outdent:"Diminuer le retrait",indent:"Augmenter le retrait",left:"Aligner à gauche",center:"Centrer",right:"Aligner à droite",justify:"Justifier"},color:{recent:"Dernière couleur sélectionnée",more:"Plus de couleurs",background:"Couleur de fond",foreground:"Couleur de police",transparent:"Transparent",setTransparent:"Définir la transparence",reset:"Restaurer",resetToDefault:"Restaurer la couleur par défaut"},shortcut:{shortcuts:"Raccourcis",close:"Fermer",textFormatting:"Mise en forme du texte",action:"Action",paragraphFormatting:"Mise en forme des paragraphes",documentStyle:"Style du document",extraKeys:"Touches supplémentaires"},help:{insertParagraph:"Insérer paragraphe",undo:"Défaire la dernière commande",redo:"Refaire la dernière commande",tab:"Tabulation",untab:"Tabulation arrière",bold:"Mettre en caractère gras",italic:"Mettre en italique",underline:"Mettre en souligné",strikethrough:"Mettre en texte barré",removeFormat:"Nettoyer les styles",justifyLeft:"Aligner à gauche",justifyCenter:"Centrer",justifyRight:"Aligner à droite",justifyFull:"Justifier à gauche et à droite",insertUnorderedList:"Basculer liste à puces",insertOrderedList:"Basculer liste ordonnée",outdent:"Diminuer le retrait du paragraphe",indent:"Augmenter le retrait du paragraphe",formatPara:"Changer le paragraphe en cours en normal (P)",formatH1:"Changer le paragraphe en cours en entête H1",formatH2:"Changer le paragraphe en cours en entête H2",formatH3:"Changer le paragraphe en cours en entête H3",formatH4:"Changer le paragraphe en cours en entête H4",formatH5:"Changer le paragraphe en cours en entête H5",formatH6:"Changer le paragraphe en cours en entête H6",insertHorizontalRule:"Insérer séparation horizontale","linkDialog.show":"Afficher fenêtre d'hyperlien"},history:{undo:"Annuler la dernière action",redo:"Restaurer la dernière action annulée"},specialChar:{specialChar:"Caractères spéciaux",select:"Choisir des caractères spéciaux"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"gl-ES":{font:{bold:"Negrita",italic:"Cursiva",underline:"Subliñado",clear:"Quitar estilo de fonte",height:"Altura de liña",name:"Fonte",strikethrough:"Riscado",superscript:"Superíndice",subscript:"Subíndice",size:"Tamaño da fonte"},image:{image:"Imaxe",insert:"Inserir imaxe",resizeFull:"Redimensionar a tamaño completo",resizeHalf:"Redimensionar á metade",resizeQuarter:"Redimensionar a un cuarto",floatLeft:"Flotar á esquerda",floatRight:"Flotar á dereita",floatNone:"Non flotar",shapeRounded:"Forma: Redondeado",shapeCircle:"Forma: Círculo",shapeThumbnail:"Forma: Marco",shapeNone:"Forma: Ningunha",dragImageHere:"Arrastrar unha imaxe ou texto aquí",dropImage:"Solta a imaxe ou texto",selectFromFiles:"Seleccionar desde os arquivos",maximumFileSize:"Tamaño máximo do arquivo",maximumFileSizeError:"Superaches o tamaño máximo do arquivo.",url:"URL da imaxe",remove:"Eliminar imaxe",original:"Original"},video:{video:"Vídeo",videoLink:"Ligazón do vídeo",insert:"Insertar vídeo",url:"URL do vídeo?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion, o Youku)"},link:{link:"Ligazón",insert:"Inserir Ligazón",unlink:"Quitar Ligazón",edit:"Editar",textToDisplay:"Texto para amosar",url:"Cara a que URL leva a ligazón?",openInNewWindow:"Abrir nunha nova xanela"},table:{table:"Táboa",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Inserir liña horizontal"},style:{style:"Estilo",p:"Normal",blockquote:"Cita",pre:"Código",h1:"Título 1",h2:"Título 2",h3:"Título 3",h4:"Título 4",h5:"Título 5",h6:"Título 6"},lists:{unordered:"Lista desordenada",ordered:"Lista ordenada"},options:{help:"Axuda",fullscreen:"Pantalla completa",codeview:"Ver código fonte"},paragraph:{paragraph:"Parágrafo",outdent:"Menos tabulación",indent:"Máis tabulación",left:"Aliñar á esquerda",center:"Aliñar ao centro",right:"Aliñar á dereita",justify:"Xustificar"},color:{recent:"Última cor",more:"Máis cores",background:"Cor de fondo",foreground:"Cor de fuente",transparent:"Transparente",setTransparent:"Establecer transparente",reset:"Restaurar",resetToDefault:"Restaurar por defecto"},shortcut:{shortcuts:"Atallos de teclado",close:"Pechar",textFormatting:"Formato de texto",action:"Acción",paragraphFormatting:"Formato de parágrafo",documentStyle:"Estilo de documento",extraKeys:"Teclas adicionais"},help:{insertParagraph:"Inserir parágrafo",undo:"Desfacer última acción",redo:"Refacer última acción",tab:"Tabular",untab:"Eliminar tabulación",bold:"Establecer estilo negrita",italic:"Establecer estilo cursiva",underline:"Establecer estilo subliñado",strikethrough:"Establecer estilo riscado",removeFormat:"Limpar estilo",justifyLeft:"Aliñar á esquerda",justifyCenter:"Aliñar ao centro",justifyRight:"Aliñar á dereita",justifyFull:"Xustificar",insertUnorderedList:"Inserir lista desordenada",insertOrderedList:"Inserir lista ordenada",outdent:"Reducir tabulación do parágrafo",indent:"Aumentar tabulación do parágrafo",formatPara:"Mudar estilo do bloque a parágrafo (etiqueta P)",formatH1:"Mudar estilo do bloque a H1",formatH2:"Mudar estilo do bloque a H2",formatH3:"Mudar estilo do bloque a H3",formatH4:"Mudar estilo do bloque a H4",formatH5:"Mudar estilo do bloque a H5",formatH6:"Mudar estilo do bloque a H6",insertHorizontalRule:"Inserir liña horizontal","linkDialog.show":"Amosar panel ligazóns"},history:{undo:"Desfacer",redo:"Refacer"},specialChar:{specialChar:"CARACTERES ESPECIAIS",select:"Selecciona Caracteres especiais"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"he-IL":{font:{bold:"מודגש",italic:"נטוי",underline:"קו תחתון",clear:"נקה עיצוב",height:"גובה",name:"גופן",strikethrough:"קו חוצה",subscript:"כתב תחתי",superscript:"כתב עילי",size:"גודל גופן"},image:{image:"תמונה",insert:"הוסף תמונה",resizeFull:"גודל מלא",resizeHalf:"להקטין לחצי",resizeQuarter:"להקטין לרבע",floatLeft:"יישור לשמאל",floatRight:"יישור לימין",floatNone:"ישר",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"גרור תמונה לכאן",dropImage:"Drop image or Text",selectFromFiles:"בחר מתוך קבצים",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"נתיב לתמונה",remove:"הסר תמונה",original:"Original"},video:{video:"סרטון",videoLink:"קישור לסרטון",insert:"הוסף סרטון",url:"קישור לסרטון",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion או Youku)"},link:{link:"קישור",insert:"הוסף קישור",unlink:"הסר קישור",edit:"ערוך",textToDisplay:"טקסט להציג",url:"קישור",openInNewWindow:"פתח בחלון חדש"},table:{table:"טבלה",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"הוסף קו"},style:{style:"עיצוב",p:"טקסט רגיל",blockquote:"ציטוט",pre:"קוד",h1:"כותרת 1",h2:"כותרת 2",h3:"כותרת 3",h4:"כותרת 4",h5:"כותרת 5",h6:"כותרת 6"},lists:{unordered:"רשימת תבליטים",ordered:"רשימה ממוספרת"},options:{help:"עזרה",fullscreen:"מסך מלא",codeview:"תצוגת קוד"},paragraph:{paragraph:"פסקה",outdent:"הקטן כניסה",indent:"הגדל כניסה",left:"יישור לשמאל",center:"יישור למרכז",right:"יישור לימין",justify:"מיושר"},color:{recent:"צבע טקסט אחרון",more:"עוד צבעים",background:"צבע רקע",foreground:"צבע טקסט",transparent:"שקוף",setTransparent:"קבע כשקוף",reset:"איפוס",resetToDefault:"אפס לברירת מחדל"},shortcut:{shortcuts:"קיצורי מקלדת",close:"סגור",textFormatting:"עיצוב הטקסט",action:"פעולה",paragraphFormatting:"סגנונות פסקה",documentStyle:"עיצוב המסמך",extraKeys:"קיצורים נוספים"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"בטל פעולה",redo:"בצע שוב"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"hr-HR":{font:{bold:"Podebljano",italic:"Kurziv",underline:"Podvučeno",clear:"Ukloni stilove fonta",height:"Visina linije",name:"Font Family",strikethrough:"Precrtano",subscript:"Subscript",superscript:"Superscript",size:"Veličina fonta"},image:{image:"Slika",insert:"Ubaci sliku",resizeFull:"Puna veličina",resizeHalf:"Umanji na 50%",resizeQuarter:"Umanji na 25%",floatLeft:"Poravnaj lijevo",floatRight:"Poravnaj desno",floatNone:"Bez poravnanja",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Povuci sliku ovdje",dropImage:"Drop image or Text",selectFromFiles:"Izaberi iz datoteke",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Adresa slike",remove:"Ukloni sliku",original:"Original"},video:{video:"Video",videoLink:"Veza na video",insert:"Ubaci video",url:"URL video",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ili Youku)"},link:{link:"Veza",insert:"Ubaci vezu",unlink:"Ukloni vezu",edit:"Uredi",textToDisplay:"Tekst za prikaz",url:"Internet adresa",openInNewWindow:"Otvori u novom prozoru"},table:{table:"Tablica",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Ubaci horizontalnu liniju"},style:{style:"Stil",p:"pni",blockquote:"Citat",pre:"Kôd",h1:"Naslov 1",h2:"Naslov 2",h3:"Naslov 3",h4:"Naslov 4",h5:"Naslov 5",h6:"Naslov 6"},lists:{unordered:"Obična lista",ordered:"Numerirana lista"},options:{help:"Pomoć",fullscreen:"Preko cijelog ekrana",codeview:"Izvorni kôd"},paragraph:{paragraph:"Paragraf",outdent:"Smanji uvlačenje",indent:"Povećaj uvlačenje",left:"Poravnaj lijevo",center:"Centrirano",right:"Poravnaj desno",justify:"Poravnaj obostrano"},color:{recent:"Posljednja boja",more:"Više boja",background:"Boja pozadine",foreground:"Boja teksta",transparent:"Prozirna",setTransparent:"Prozirna",reset:"Poništi",resetToDefault:"Podrazumijevana"},shortcut:{shortcuts:"Prečice s tipkovnice",close:"Zatvori",textFormatting:"Formatiranje teksta",action:"Akcija",paragraphFormatting:"Formatiranje paragrafa",documentStyle:"Stil dokumenta",extraKeys:"Dodatne kombinacije"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Poništi",redo:"Ponovi"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"hu-HU":{font:{bold:"Félkövér",italic:"Dőlt",underline:"Aláhúzott",clear:"Formázás törlése",height:"Sorköz",name:"Betűtípus",strikethrough:"Áthúzott",subscript:"Subscript",superscript:"Superscript",size:"Betűméret"},image:{image:"Kép",insert:"Kép beszúrása",resizeFull:"Átméretezés teljes méretre",resizeHalf:"Átméretezés felére",resizeQuarter:"Átméretezés negyedére",floatLeft:"Igazítás balra",floatRight:"Igazítás jobbra",floatNone:"Igazítás törlése",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Ide húzhat képet vagy szöveget",dropImage:"Engedje el a képet vagy szöveget",selectFromFiles:"Fájlok kiválasztása",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Kép URL címe",remove:"Kép törlése",original:"Original"},video:{video:"Videó",videoLink:"Videó hivatkozás",insert:"Videó beszúrása",url:"Videó URL címe",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion vagy Youku)"},link:{link:"Hivatkozás",insert:"Hivatkozás beszúrása",unlink:"Hivatkozás megszüntetése",edit:"Szerkesztés",textToDisplay:"Megjelenítendő szöveg",url:"Milyen URL címre hivatkozzon?",openInNewWindow:"Megnyitás új ablakban"},table:{table:"Táblázat",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Elválasztó vonal beszúrása"},style:{style:"Stílus",p:"Normál",blockquote:"Idézet",pre:"Kód",h1:"Fejléc 1",h2:"Fejléc 2",h3:"Fejléc 3",h4:"Fejléc 4",h5:"Fejléc 5",h6:"Fejléc 6"},lists:{unordered:"Listajeles lista",ordered:"Számozott lista"},options:{help:"Súgó",fullscreen:"Teljes képernyő",codeview:"Kód nézet"},paragraph:{paragraph:"Bekezdés",outdent:"Behúzás csökkentése",indent:"Behúzás növelése",left:"Igazítás balra",center:"Igazítás középre",right:"Igazítás jobbra",justify:"Sorkizárt"},color:{recent:"Jelenlegi szín",more:"További színek",background:"Háttérszín",foreground:"Betűszín",transparent:"Átlátszó",setTransparent:"Átlászóság beállítása",reset:"Visszaállítás",resetToDefault:"Alaphelyzetbe állítás"},shortcut:{shortcuts:"Gyorsbillentyű",close:"Bezárás",textFormatting:"Szöveg formázása",action:"Művelet",paragraphFormatting:"Bekezdés formázása",documentStyle:"Dokumentumstílus",extraKeys:"Extra keys"},help:{insertParagraph:"Új bekezdés",undo:"Visszavonás",redo:"Újra",tab:"Behúzás növelése",untab:"Behúzás csökkentése",bold:"Félkövérre állítás",italic:"Dőltre állítás",underline:"Aláhúzás",strikethrough:"Áthúzás",removeFormat:"Formázás törlése",justifyLeft:"Balra igazítás",justifyCenter:"Középre igazítás",justifyRight:"Jobbra igazítás",justifyFull:"Sorkizárt",insertUnorderedList:"Számozatlan lista be/ki",insertOrderedList:"Számozott lista be/ki",outdent:"Jelenlegi bekezdés behúzásának megszüntetése",indent:"Jelenlegi bekezdés behúzása",formatPara:"Blokk formázása bekezdésként (P tag)",formatH1:"Blokk formázása, mint Fejléc 1",formatH2:"Blokk formázása, mint Fejléc 2",formatH3:"Blokk formázása, mint Fejléc 3",formatH4:"Blokk formázása, mint Fejléc 4",formatH5:"Blokk formázása, mint Fejléc 5",formatH6:"Blokk formázása, mint Fejléc 6",insertHorizontalRule:"Vízszintes vonal beszúrása","linkDialog.show":"Link párbeszédablak megjelenítése"},history:{undo:"Visszavonás",redo:"Újra"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(a){a.extend(a.summernote.lang,{"id-ID":{font:{bold:"Tebal",italic:"Miring",underline:"Garis bawah",clear:"Bersihkan gaya",height:"Jarak baris",name:"Jenis Tulisan",strikethrough:"Coret",subscript:"Subscript",superscript:"Superscript",size:"Ukuran font"},image:{image:"Gambar",insert:"Sisipkan gambar",resizeFull:"Ukuran penuh",resizeHalf:"Ukuran 50%",resizeQuarter:"Ukuran 25%",floatLeft:"Rata kiri",floatRight:"Rata kanan",floatNone:"Tanpa perataan",shapeRounded:"Bentuk: Membundar",shapeCircle:"Bentuk: Bundar",shapeThumbnail:"Bentuk: Thumbnail",shapeNone:"Bentuk: Tidak ada",dragImageHere:"Tarik gambar ke area ini",dropImage:"Letakkan gambar atau teks",selectFromFiles:"Pilih gambar dari berkas",maximumFileSize:"Ukuran maksimal berkas",maximumFileSizeError:"Ukuran maksimal berkas terlampaui.",url:"URL gambar",remove:"Hapus Gambar",original:"Original"},video:{video:"Video",videoLink:"Link video",insert:"Sisipkan video",url:"Tautan video",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion atau Youku)"},link:{link:"Tautan",insert:"Tambah tautan",unlink:"Hapus tautan",edit:"Edit",textToDisplay:"Tampilan teks",url:"Tautan tujuan",openInNewWindow:"Buka di jendela baru"},table:{table:"Tabel",addRowAbove:"Tambahkan baris ke atas",addRowBelow:"Tambahkan baris ke bawah",addColLeft:"Tambahkan kolom ke kiri",addColRight:"Tambahkan kolom ke kanan",delRow:"Hapus baris",delCol:"Hapus kolom",delTable:"Hapus tabel"},hr:{insert:"Masukkan garis horizontal"},style:{style:"Gaya",p:"p",blockquote:"Kutipan",pre:"Kode",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6"},lists:{unordered:"Pencacahan",ordered:"Penomoran"},options:{help:"Bantuan",fullscreen:"Layar penuh",codeview:"Kode HTML"},paragraph:{paragraph:"Paragraf",outdent:"Outdent",indent:"Indent",left:"Rata kiri",center:"Rata tengah",right:"Rata kanan",justify:"Rata kanan kiri"},color:{recent:"Warna sekarang",more:"Selengkapnya",background:"Warna latar",foreground:"Warna font",transparent:"Transparan",setTransparent:"Atur transparansi",reset:"Atur ulang",resetToDefault:"Kembalikan kesemula"},shortcut:{shortcuts:"Jalan pintas",close:"Tutup",textFormatting:"Format teks",action:"Aksi",paragraphFormatting:"Format paragraf",documentStyle:"Gaya dokumen",extraKeys:"Shortcut tambahan"},help:{insertParagraph:"Tambahkan paragraf",undo:"Urungkan perintah terakhir",redo:"Kembalikan perintah terakhir",tab:"Tab",untab:"Untab",bold:"Mengaktifkan gaya tebal",italic:"Mengaktifkan gaya italic",underline:"Mengaktifkan gaya underline",strikethrough:"Mengaktifkan gaya strikethrough",removeFormat:"Hapus semua gaya",justifyLeft:"Atur rata kiri",justifyCenter:"Atur rata tengah",justifyRight:"Atur rata kanan",justifyFull:"Atur rata kiri-kanan",insertUnorderedList:"Nyalakan urutan tanpa nomor",insertOrderedList:"Nyalakan urutan bernomor",outdent:"Outdent di paragraf terpilih",indent:"Indent di paragraf terpilih",formatPara:"Ubah format gaya tulisan terpilih menjadi paragraf",formatH1:"Ubah format gaya tulisan terpilih menjadi Heading 1",formatH2:"Ubah format gaya tulisan terpilih menjadi Heading 2",formatH3:"Ubah format gaya tulisan terpilih menjadi Heading 3",formatH4:"Ubah format gaya tulisan terpilih menjadi Heading 4",formatH5:"Ubah format gaya tulisan terpilih menjadi Heading 5",formatH6:"Ubah format gaya tulisan terpilih menjadi Heading 6",insertHorizontalRule:"Masukkan garis horizontal","linkDialog.show":"Tampilkan Link Dialog"},history:{undo:"Kembali",redo:"Ulang"},specialChar:{specialChar:"KARAKTER KHUSUS",select:"Pilih karakter khusus"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"it-IT":{font:{bold:"Testo in grassetto",italic:"Testo in corsivo",underline:"Testo sottolineato",clear:"Elimina la formattazione del testo",height:"Altezza della linea di testo",name:"Famiglia Font",strikethrough:"Testo barrato",subscript:"Subscript",superscript:"Superscript",size:"Dimensione del carattere"},image:{image:"Immagine",insert:"Inserisci Immagine",resizeFull:"Dimensioni originali",resizeHalf:"Ridimensiona al 50%",resizeQuarter:"Ridimensiona al 25%",floatLeft:"Posiziona a sinistra",floatRight:"Posiziona a destra",floatNone:"Nessun posizionamento",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Trascina qui un'immagine",dropImage:"Drop image or Text",selectFromFiles:"Scegli dai Documenti",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL dell'immagine",remove:"Rimuovi immagine",original:"Original"},video:{video:"Video",videoLink:"Collegamento ad un Video",insert:"Inserisci Video",url:"URL del Video",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)"},link:{link:"Collegamento",insert:"Inserisci Collegamento",unlink:"Elimina collegamento",edit:"Modifica collegamento",textToDisplay:"Testo del collegamento",url:"URL del collegamento",openInNewWindow:"Apri in una nuova finestra"},table:{table:"Tabella",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Inserisce una linea di separazione"},style:{style:"Stili",p:"pe",blockquote:"Citazione",pre:"Codice",h1:"Titolo 1",h2:"Titolo 2",h3:"Titolo 3",h4:"Titolo 4",h5:"Titolo 5",h6:"Titolo 6"},lists:{unordered:"Elenco non ordinato",ordered:"Elenco ordinato"},options:{help:"Aiuto",fullscreen:"Modalità a tutto schermo",codeview:"Visualizza codice"},paragraph:{paragraph:"Paragrafo",outdent:"Diminuisce il livello di rientro",indent:"Aumenta il livello di rientro",left:"Allinea a sinistra",center:"Centra",right:"Allinea a destra",justify:"Giustifica (allinea a destra e sinistra)"},color:{recent:"Ultimo colore utilizzato",more:"Altri colori",background:"Colore di sfondo",foreground:"Colore",transparent:"Trasparente",setTransparent:"Trasparente",reset:"Reimposta",resetToDefault:"Reimposta i colori"},shortcut:{shortcuts:"Scorciatoie da tastiera",close:"Chiudi",textFormatting:"Formattazione testo",action:"Azioni",paragraphFormatting:"Formattazione paragrafo",documentStyle:"Stili",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Annulla",redo:"Ripristina"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"ja-JP":{font:{bold:"太字",italic:"斜体",underline:"下線",clear:"クリア",height:"文字高",name:"フォント",strikethrough:"取り消し線",subscript:"Subscript",superscript:"Superscript",size:"大きさ"},image:{image:"画像",insert:"画像挿入",resizeFull:"最大化",resizeHalf:"1/2",resizeQuarter:"1/4",floatLeft:"左寄せ",floatRight:"右寄せ",floatNone:"寄せ解除",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"ここに画像をドラッグしてください",dropImage:"Drop image or Text",selectFromFiles:"画像ファイルを選ぶ",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URLから画像を挿入する",remove:"画像を削除する",original:"Original"},video:{video:"動画",videoLink:"動画リンク",insert:"動画挿入",url:"動画のURL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion, Youku)"},link:{link:"リンク",insert:"リンク挿入",unlink:"リンク解除",edit:"編集",textToDisplay:"リンク文字列",url:"URLを入力してください",openInNewWindow:"新しいウィンドウで開く"},table:{table:"テーブル",addRowAbove:"行を上に追加",addRowBelow:"行を下に追加",addColLeft:"列を左に追加",addColRight:"列を右に追加",delRow:"行を削除",delCol:"列を削除",delTable:"テーブルを削除"},hr:{insert:"水平線の挿入"},style:{style:"スタイル",p:"標準",blockquote:"引用",pre:"コード",h1:"見出し1",h2:"見出し2",h3:"見出し3",h4:"見出し4",h5:"見出し5",h6:"見出し6"},lists:{unordered:"通常リスト",ordered:"番号リスト"},options:{help:"ヘルプ",fullscreen:"フルスクリーン",codeview:"コード表示"},paragraph:{paragraph:"文章",outdent:"字上げ",indent:"字下げ",left:"左寄せ",center:"中央寄せ",right:"右寄せ",justify:"均等割付"},color:{recent:"現在の色",more:"もっと見る",background:"背景色",foreground:"文字色",transparent:"透明",setTransparent:"透明にする",reset:"標準",resetToDefault:"標準に戻す"},shortcut:{shortcuts:"ショートカット",close:"閉じる",textFormatting:"文字フォーマット",action:"アクション",paragraphFormatting:"文章フォーマット",documentStyle:"ドキュメント形式",extraKeys:"Extra keys"},help:{insertParagraph:"改行挿入",undo:"一旦、行った操作を戻す",redo:"最後のコマンドをやり直す",tab:"Tab",untab:"タブ戻し",bold:"太文字",italic:"斜体",underline:"下線",strikethrough:"取り消し線",removeFormat:"装飾を戻す",justifyLeft:"左寄せ",justifyCenter:"真ん中寄せ",justifyRight:"右寄せ",justifyFull:"すべてを整列",insertUnorderedList:"行頭に●を挿入",insertOrderedList:"行頭に番号を挿入",outdent:"字下げを戻す（アウトデント）",indent:"字下げする（インデント）",formatPara:"段落(P tag)指定",formatH1:"H1指定",formatH2:"H2指定",formatH3:"H3指定",formatH4:"H4指定",formatH5:"H5指定",formatH6:"H6指定",insertHorizontalRule:"&lt;hr /&gt;を挿入","linkDialog.show":"リンク挿入"},history:{undo:"元に戻す",redo:"やり直す"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"ko-KR":{font:{bold:"굵게",italic:"기울임꼴",underline:"밑줄",clear:"서식 지우기",height:"줄 간격",name:"글꼴",superscript:"위 첨자",subscript:"아래 첨자",strikethrough:"취소선",size:"글자 크기"},image:{image:"그림",insert:"그림 삽입",resizeFull:"100% 크기로 변경",resizeHalf:"50% 크기로 변경",resizeQuarter:"25% 크기로 변경",resizeNone:"원본 크기",floatLeft:"왼쪽 정렬",floatRight:"오른쪽 정렬",floatNone:"정렬하지 않음",shapeRounded:"스타일: 둥근 모서리",shapeCircle:"스타일: 원형",shapeThumbnail:"스타일: 액자",shapeNone:"스타일: 없음",dragImageHere:"텍스트 혹은 사진을 이곳으로 끌어오세요",dropImage:"텍스트 혹은 사진을 내려놓으세요",selectFromFiles:"파일 선택",maximumFileSize:"최대 파일 크기",maximumFileSizeError:"최대 파일 크기를 초과했습니다.",url:"사진 URL",remove:"사진 삭제",original:"원본"},video:{video:"동영상",videoLink:"동영상 링크",insert:"동영상 삽입",url:"동영상 URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion, Youku 사용 가능)"},link:{link:"링크",insert:"링크 삽입",unlink:"링크 삭제",edit:"수정",textToDisplay:"링크에 표시할 내용",url:"이동할 URL",openInNewWindow:"새창으로 열기"},table:{table:"표",addRowAbove:"위에 행 삽입",addRowBelow:"아래에 행 삽입",addColLeft:"왼쪽에 열 삽입",addColRight:"오른쪽에 열 삽입",delRow:"행 지우기",delCol:"열 지우기",delTable:"표 삭제"},hr:{insert:"구분선 삽입"},style:{style:"스타일",p:"본문",blockquote:"인용구",pre:"코드",h1:"제목 1",h2:"제목 2",h3:"제목 3",h4:"제목 4",h5:"제목 5",h6:"제목 6"},lists:{unordered:"글머리 기호",ordered:"번호 매기기"},options:{help:"도움말",fullscreen:"전체 화면",codeview:"코드 보기"},paragraph:{paragraph:"문단 정렬",outdent:"내어쓰기",indent:"들여쓰기",left:"왼쪽 정렬",center:"가운데 정렬",right:"오른쪽 정렬",justify:"양쪽 정렬"},color:{recent:"마지막으로 사용한 색",more:"다른 색 선택",background:"배경색",foreground:"글자색",transparent:"투명",setTransparent:"투명으로 설정",reset:"취소",resetToDefault:"기본값으로 설정",cpSelect:"고르다"},shortcut:{shortcuts:"키보드 단축키",close:"닫기",textFormatting:"글자 스타일 적용",action:"기능",paragraphFormatting:"문단 스타일 적용",documentStyle:"문서 스타일 적용",extraKeys:"추가 키"},help:{insertParagraph:"문단 삽입",undo:"마지막 명령 취소",redo:"마지막 명령 재실행",tab:"탭",untab:"탭 제거",bold:"굵은 글자로 설정",italic:"기울임꼴 글자로 설정",underline:"밑줄 글자로 설정",strikethrough:"취소선 글자로 설정",removeFormat:"서식 삭제",justifyLeft:"왼쪽 정렬하기",justifyCenter:"가운데 정렬하기",justifyRight:"오른쪽 정렬하기",justifyFull:"좌우채움 정렬하기",insertUnorderedList:"글머리 기호 켜고 끄기",insertOrderedList:"번호 매기기 켜고 끄기",outdent:"현재 문단 내어쓰기",indent:"현재 문단 들여쓰기",formatPara:"현재 블록의 포맷을 문단(P)으로 변경",formatH1:"현재 블록의 포맷을 제목1(H1)로 변경",formatH2:"현재 블록의 포맷을 제목2(H2)로 변경",formatH3:"현재 블록의 포맷을 제목3(H3)로 변경",formatH4:"현재 블록의 포맷을 제목4(H4)로 변경",formatH5:"현재 블록의 포맷을 제목5(H5)로 변경",formatH6:"현재 블록의 포맷을 제목6(H6)로 변경",insertHorizontalRule:"구분선 삽입","linkDialog.show":"링크 대화상자 열기"},history:{undo:"실행 취소",redo:"재실행"},specialChar:{specialChar:"특수문자",select:"특수문자를 선택하세요"}}})}(jQuery);
!function(a){a.extend(a.summernote.lang,{"lt-LT":{font:{bold:"Paryškintas",italic:"Kursyvas",underline:"Pabrėžtas",clear:"Be formatavimo",height:"Eilutės aukštis",name:"Šrifto pavadinimas",strikethrough:"Perbrauktas",superscript:"Viršutinis",subscript:"Indeksas",size:"Šrifto dydis"},image:{image:"Paveikslėlis",insert:"Įterpti paveikslėlį",resizeFull:"Pilnas dydis",resizeHalf:"Sumažinti dydį 50%",resizeQuarter:"Sumažinti dydį 25%",floatLeft:"Kairinis lygiavimas",floatRight:"Dešininis lygiavimas",floatNone:"Jokio lygiavimo",shapeRounded:"Forma: apvalūs kraštai",shapeCircle:"Forma: apskritimas",shapeThumbnail:"Forma: miniatiūra",shapeNone:"Forma: jokia",dragImageHere:"Vilkite paveikslėlį čia",dropImage:"Drop image or Text",selectFromFiles:"Pasirinkite failą",maximumFileSize:"Maskimalus failo dydis",maximumFileSizeError:"Maskimalus failo dydis viršytas!",url:"Paveikslėlio URL adresas",remove:"Ištrinti paveikslėlį",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"Nuoroda",insert:"Įterpti nuorodą",unlink:"Pašalinti nuorodą",edit:"Redaguoti",textToDisplay:"Rodomas tekstas",url:"Koks URL adresas yra susietas?",openInNewWindow:"Atidaryti naujame lange"},table:{table:"Lentelė",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Įterpti horizontalią liniją"},style:{style:"Stilius",p:"pus",blockquote:"Citata",pre:"Kodas",h1:"Antraštė 1",h2:"Antraštė 2",h3:"Antraštė 3",h4:"Antraštė 4",h5:"Antraštė 5",h6:"Antraštė 6"},lists:{unordered:"Suženklintasis sąrašas",ordered:"Sunumeruotas sąrašas"},options:{help:"Pagalba",fullscreen:"Viso ekrano režimas",codeview:"HTML kodo peržiūra"},paragraph:{paragraph:"Pastraipa",outdent:"Sumažinti įtrauką",indent:"Padidinti įtrauką",left:"Kairinė lygiuotė",center:"Centrinė lygiuotė",right:"Dešininė lygiuotė",justify:"Abipusis išlyginimas"},color:{recent:"Paskutinė naudota spalva",more:"Daugiau spalvų",background:"Fono spalva",foreground:"Šrifto spalva",transparent:"Permatoma",setTransparent:"Nustatyti skaidrumo intensyvumą",reset:"Atkurti",resetToDefault:"Atstatyti numatytąją spalvą"},shortcut:{shortcuts:"Spartieji klavišai",close:"Uždaryti",textFormatting:"Teksto formatavimas",action:"Veiksmas",paragraphFormatting:"Pastraipos formatavimas",documentStyle:"Dokumento stilius",extraKeys:"Papildomi klavišų deriniai"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Anuliuoti veiksmą",redo:"Perdaryti veiksmą"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(t){t.extend(t.summernote.lang,{"lv-LV":{font:{bold:"Treknraksts",italic:"Kursīvs",underline:"Pasvītrots",clear:"Noņemt formatējumu",height:"Līnijas augstums",name:"Fonts",strikethrough:"Nosvītrots",superscript:"Augšraksts",subscript:"Apakšraksts",size:"Fonta lielums"},image:{image:"Attēls",insert:"Ievietot attēlu",resizeFull:"Pilns izmērts",resizeHalf:"Samazināt 50%",resizeQuarter:"Samazināt 25%",floatLeft:"Līdzināt pa kreisi",floatRight:"Līdzināt pa labi",floatNone:"Nelīdzināt",shapeRounded:"Forma: apaļām malām",shapeCircle:"Forma: aplis",shapeThumbnail:"Forma: rāmītis",shapeNone:"Forma: orģināla",dragImageHere:"Ievēlciet attēlu šeit",dropImage:"Drop image or Text",selectFromFiles:"Izvēlēties failu",maximumFileSize:"Maksimālais faila izmērs",maximumFileSizeError:"Faila izmērs pārāk liels!",url:"Attēla URL",remove:"Dzēst attēlu",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"Saite",insert:"Ievietot saiti",unlink:"Noņemt saiti",edit:"Rediģēt",textToDisplay:"Saites saturs",url:"Koks URL adresas yra susietas?",openInNewWindow:"Atvērt jaunā logā"},table:{table:"Tabula",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Ievietot līniju"},style:{style:"Stils",p:"Parasts",blockquote:"Citāts",pre:"Kods",h1:"Virsraksts h1",h2:"Virsraksts h2",h3:"Virsraksts h3",h4:"Virsraksts h4",h5:"Virsraksts h5",h6:"Virsraksts h6"},lists:{unordered:"Nenumurēts saraksts",ordered:"Numurēts saraksts"},options:{help:"Palīdzība",fullscreen:"Pa visu ekrānu",codeview:"HTML kods"},paragraph:{paragraph:"Paragrāfs",outdent:"Samazināt atkāpi",indent:"Palielināt atkāpi",left:"Līdzināt pa kreisi",center:"Centrēt",right:"Līdzināt pa labi",justify:"Līdzināt gar abām malām"},color:{recent:"Nesen izmantotās",more:"Citas krāsas",background:"Fona krāsa",foreground:"Fonta krāsa",transparent:"Caurspīdīgs",setTransparent:"Iestatīt caurspīdīgumu",reset:"Atjaunot",resetToDefault:"Atjaunot noklusējumu"},shortcut:{shortcuts:"Saīsnes",close:"Aizvērt",textFormatting:"Teksta formatēšana",action:"Darbība",paragraphFormatting:"Paragrāfa formatēšana",documentStyle:"Dokumenta stils",extraKeys:"Citas taustiņu kombinācijas"},help:{insertParagraph:"Ievietot Paragrāfu",undo:"Atcelt iepriekšējo darbību",redo:"Atkārtot atcelto darbību",tab:"Atkāpe",untab:"Samazināt atkāpi",bold:"Pārvērst tekstu treknrakstā",italic:"Pārvērst tekstu slīprakstā (kursīvā)",underline:"Pasvītrot tekstu",strikethrough:"Nosvītrot tekstu",removeFormat:"Notīrīt stilu no teksta",justifyLeft:"Līdzīnāt saturu pa kreisi",justifyCenter:"Centrēt saturu",justifyRight:"Līdzīnāt saturu pa labi",justifyFull:"Izlīdzināt saturu gar abām malām",insertUnorderedList:"Ievietot nenumurētu sarakstu",insertOrderedList:"Ievietot numurētu sarakstu",outdent:"Samazināt/noņemt atkāpi paragrāfam",indent:"Uzlikt atkāpi paragrāfam",formatPara:"Mainīt bloka tipu uz (p) Paragrāfu",formatH1:"Mainīt bloka tipu uz virsrakstu H1",formatH2:"Mainīt bloka tipu uz virsrakstu H2",formatH3:"Mainīt bloka tipu uz virsrakstu H3",formatH4:"Mainīt bloka tipu uz virsrakstu H4",formatH5:"Mainīt bloka tipu uz virsrakstu H5",formatH6:"Mainīt bloka tipu uz virsrakstu H6",insertHorizontalRule:"Ievietot horizontālu līniju","linkDialog.show":"Parādīt saites logu"},history:{undo:"Atsauks (undo)",redo:"Atkārtot (redo)"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"mn-MN":{font:{bold:"Тод",italic:"Налуу",underline:"Доогуур зураас",clear:"Цэвэрлэх",height:"Өндөр",name:"Фонт",superscript:"Дээд илтгэгч",subscript:"Доод илтгэгч",strikethrough:"Дарах",size:"Хэмжээ"},image:{image:"Зураг",insert:"Оруулах",resizeFull:"Хэмжээ бүтэн",resizeHalf:"Хэмжээ 1/2",resizeQuarter:"Хэмжээ 1/4",floatLeft:"Зүүн талд байрлуулах",floatRight:"Баруун талд байрлуулах",floatNone:"Анхдагч байрлалд аваачих",shapeRounded:"Хүрээ: Дугуй",shapeCircle:"Хүрээ: Тойрог",shapeThumbnail:"Хүрээ: Хураангуй",shapeNone:"Хүрээгүй",dragImageHere:"Зургийг энд чирч авчирна уу",dropImage:"Drop image or Text",selectFromFiles:"Файлуудаас сонгоно уу",maximumFileSize:"Файлын дээд хэмжээ",maximumFileSizeError:"Файлын дээд хэмжээ хэтэрсэн",url:"Зургийн URL",remove:"Зургийг устгах",original:"Original"},video:{video:"Видео",videoLink:"Видео холбоос",insert:"Видео оруулах",url:"Видео URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion болон Youku)"},link:{link:"Холбоос",insert:"Холбоос оруулах",unlink:"Холбоос арилгах",edit:"Засварлах",textToDisplay:"Харуулах бичвэр",url:"Энэ холбоос хаашаа очих вэ?",openInNewWindow:"Шинэ цонхонд нээх"},table:{table:"Хүснэгт",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Хэвтээ шугам оруулах"},style:{style:"Хэв маяг",p:"p",blockquote:"Иш татах",pre:"Эх сурвалж",h1:"Гарчиг 1",h2:"Гарчиг 2",h3:"Гарчиг 3",h4:"Гарчиг 4",h5:"Гарчиг 5",h6:"Гарчиг 6"},lists:{unordered:"Эрэмбэлэгдээгүй",ordered:"Эрэмбэлэгдсэн"},options:{help:"Тусламж",fullscreen:"Дэлгэцийг дүүргэх",codeview:"HTML-Code харуулах"},paragraph:{paragraph:"Хэсэг",outdent:"Догол мөр хасах",indent:"Догол мөр нэмэх",left:"Зүүн тийш эгнүүлэх",center:"Төвд эгнүүлэх",right:"Баруун тийш эгнүүлэх",justify:"Мөрийг тэгшлэх"},color:{recent:"Сүүлд хэрэглэсэн өнгө",more:"Өөр өнгөнүүд",background:"Дэвсгэр өнгө",foreground:"Үсгийн өнгө",transparent:"Тунгалаг",setTransparent:"Тунгалаг болгох",reset:"Анхдагч өнгөөр тохируулах",resetToDefault:"Хэвд нь оруулах"},shortcut:{shortcuts:"Богино холбоос",close:"Хаалт",textFormatting:"Бичвэрийг хэлбэржүүлэх",action:"Үйлдэл",paragraphFormatting:"Догол мөрийг хэлбэржүүлэх",documentStyle:"Бичиг баримтын хэв загвар",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Буцаах",redo:"Дахин хийх"},specialChar:{specialChar:"Тусгай тэмдэгт",select:"Тусгай тэмдэгт сонгох"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"nb-NO":{font:{bold:"Fet",italic:"Kursiv",underline:"Understrek",clear:"Fjern formatering",height:"Linjehøyde",name:"Skrifttype",strikethrough:"Gjennomstrek",subscript:"Subscript",superscript:"Superscript",size:"Skriftstørrelse"},image:{image:"Bilde",insert:"Sett inn bilde",resizeFull:"Sett full størrelse",resizeHalf:"Sett halv størrelse",resizeQuarter:"Sett kvart størrelse",floatLeft:"Flyt til venstre",floatRight:"Flyt til høyre",floatNone:"Fjern flyt",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Dra et bilde hit",dropImage:"Drop image or Text",selectFromFiles:"Velg fra filer",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Bilde-URL",remove:"Fjern bilde",original:"Original"},video:{video:"Video",videoLink:"Videolenke",insert:"Sett inn video",url:"Video-URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)"},link:{link:"Lenke",insert:"Sett inn lenke",unlink:"Fjern lenke",edit:"Rediger",textToDisplay:"Visningstekst",url:"Til hvilken URL skal denne lenken peke?",openInNewWindow:"Åpne i nytt vindu"},table:{table:"Tabell",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Sett inn horisontal linje"},style:{style:"Stil",p:"p",blockquote:"Sitat",pre:"Kode",h1:"Overskrift 1",h2:"Overskrift 2",h3:"Overskrift 3",h4:"Overskrift 4",h5:"Overskrift 5",h6:"Overskrift 6"},lists:{unordered:"Punktliste",ordered:"Nummerert liste"},options:{help:"Hjelp",fullscreen:"Fullskjerm",codeview:"HTML-visning"},paragraph:{paragraph:"Avsnitt",outdent:"Tilbakerykk",indent:"Innrykk",left:"Venstrejustert",center:"Midtstilt",right:"Høyrejustert",justify:"Blokkjustert"},color:{recent:"Nylig valgt farge",more:"Flere farger",background:"Bakgrunnsfarge",foreground:"Skriftfarge",transparent:"Gjennomsiktig",setTransparent:"Sett gjennomsiktig",reset:"Nullstill",resetToDefault:"Nullstill til standard"},shortcut:{shortcuts:"Hurtigtaster",close:"Lukk",textFormatting:"Tekstformatering",action:"Handling",paragraphFormatting:"Avsnittsformatering",documentStyle:"Dokumentstil"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Angre",redo:"Gjør om"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"nl-NL":{font:{bold:"Vet",italic:"Cursief",underline:"Onderstrepen",clear:"Stijl verwijderen",height:"Regelhoogte",name:"Lettertype",strikethrough:"Doorhalen",subscript:"Subscript",superscript:"Superscript",size:"Tekstgrootte"},image:{image:"Afbeelding",insert:"Afbeelding invoegen",resizeFull:"Volledige breedte",resizeHalf:"Halve breedte",resizeQuarter:"Kwart breedte",floatLeft:"Links uitlijnen",floatRight:"Rechts uitlijnen",floatNone:"Geen uitlijning",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Sleep hier een afbeelding naar toe",dropImage:"Drop image or Text",selectFromFiles:"Selecteer een bestand",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL van de afbeelding",remove:"Verwijder afbeelding",original:"Original"},video:{video:"Video",videoLink:"Video link",insert:"Video invoegen",url:"URL van de video",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion of Youku)"},link:{link:"Link",insert:"Link invoegen",unlink:"Link verwijderen",edit:"Wijzigen",textToDisplay:"Tekst van link",url:"Naar welke URL moet deze link verwijzen?",openInNewWindow:"Open in nieuw venster"},table:{table:"Tabel",addRowAbove:"Rij hierboven invoegen",addRowBelow:"Rij hieronder invoegen",addColLeft:"Kolom links toevoegen",addColRight:"Kolom rechts toevoegen",delRow:"Verwijder rij",delCol:"Verwijder kolom",delTable:"Verwijder tabel"},hr:{insert:"Horizontale lijn invoegen"},style:{style:"Stijl",p:"Normaal",blockquote:"Quote",pre:"Code",h1:"Kop 1",h2:"Kop 2",h3:"Kop 3",h4:"Kop 4",h5:"Kop 5",h6:"Kop 6"},lists:{unordered:"Ongeordende lijst",ordered:"Geordende lijst"},options:{help:"Help",fullscreen:"Volledig scherm",codeview:"Bekijk Code"},paragraph:{paragraph:"Paragraaf",outdent:"Inspringen verkleinen",indent:"Inspringen vergroten",left:"Links uitlijnen",center:"Centreren",right:"Rechts uitlijnen",justify:"Uitvullen"},color:{recent:"Recente kleur",more:"Meer kleuren",background:"Achtergrond kleur",foreground:"Tekst kleur",transparent:"Transparant",setTransparent:"Transparant",reset:"Standaard",resetToDefault:"Standaard kleur"},shortcut:{shortcuts:"Toetsencombinaties",close:"sluiten",textFormatting:"Tekststijlen",action:"Acties",paragraphFormatting:"Paragraafstijlen",documentStyle:"Documentstijlen",extraKeys:"Extra keys"},help:{insertParagraph:"Alinea invoegen",undo:"Laatste handeling ongedaan maken",redo:"Laatste handeling opnieuw uitvoeren",tab:"Tab",untab:"Herstel tab",bold:"Stel stijl in als vet",italic:"Stel stijl in als cursief",underline:"Stel stijl in als onderstreept",strikethrough:"Stel stijl in als doorgestreept",removeFormat:"Verwijder stijl",justifyLeft:"Lijn links uit",justifyCenter:"Set center align",justifyRight:"Lijn rechts uit",justifyFull:"Lijn uit op volledige breedte",insertUnorderedList:"Zet ongeordende lijstweergave aan",insertOrderedList:"Zet geordende lijstweergave aan",outdent:"Verwijder inspringing huidige alinea",indent:"Inspringen op huidige alinea",formatPara:"Wijzig formattering huidig blok in alinea(P tag)",formatH1:"Formatteer huidig blok als H1",formatH2:"Formatteer huidig blok als H2",formatH3:"Formatteer huidig blok als H3",formatH4:"Formatteer huidig blok als H4",formatH5:"Formatteer huidig blok als H5",formatH6:"Formatteer huidig blok als H6",insertHorizontalRule:"Invoegen horizontale lijn","linkDialog.show":"Toon Link Dialoogvenster"},history:{undo:"Ongedaan maken",redo:"Opnieuw doorvoeren"},specialChar:{specialChar:"SPECIALE TEKENS",select:"Selecteer Speciale Tekens"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"pl-PL":{font:{bold:"Pogrubienie",italic:"Pochylenie",underline:"Podkreślenie",clear:"Usuń formatowanie",height:"Interlinia",name:"Czcionka",strikethrough:"Przekreślenie",subscript:"Indeks dolny",superscript:"Indeks górny",size:"Rozmiar"},image:{image:"Grafika",insert:"Wstaw grafikę",resizeFull:"Zmień rozmiar na 100%",resizeHalf:"Zmień rozmiar na 50%",resizeQuarter:"Zmień rozmiar na 25%",floatLeft:"Po lewej",floatRight:"Po prawej",floatNone:"Równo z tekstem",shapeRounded:"Kształt: zaokrąglone",shapeCircle:"Kształt: okrąg",shapeThumbnail:"Kształt: miniatura",shapeNone:"Kształt: brak",dragImageHere:"Przeciągnij grafikę lub tekst tutaj",dropImage:"Przeciągnij grafikę lub tekst",selectFromFiles:"Wybierz z dysku",maximumFileSize:"Limit wielkości pliku",maximumFileSizeError:"Przekroczono limit wielkości pliku.",url:"Adres URL grafiki",remove:"Usuń grafikę",original:"Oryginał"},video:{video:"Wideo",videoLink:"Adres wideo",insert:"Wstaw wideo",url:"Adres wideo",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion lub Youku)"},link:{link:"Odnośnik",insert:"Wstaw odnośnik",unlink:"Usuń odnośnik",edit:"Edytuj",textToDisplay:"Tekst do wyświetlenia",url:"Na jaki adres URL powinien przenosić ten odnośnik?",openInNewWindow:"Otwórz w nowym oknie"},table:{table:"Tabela",addRowAbove:"Dodaj wiersz powyżej",addRowBelow:"Dodaj wiersz poniżej",addColLeft:"Dodaj kolumnę po lewej",addColRight:"Dodaj kolumnę po prawej",delRow:"Usuń wiersz",delCol:"Usuń kolumnę",delTable:"Usuń tabelę"},hr:{insert:"Wstaw poziomą linię"},style:{style:"Styl",p:"pny",blockquote:"Cytat",pre:"Kod",h1:"Nagłówek 1",h2:"Nagłówek 2",h3:"Nagłówek 3",h4:"Nagłówek 4",h5:"Nagłówek 5",h6:"Nagłówek 6"},lists:{unordered:"Lista wypunktowana",ordered:"Lista numerowana"},options:{help:"Pomoc",fullscreen:"Pełny ekran",codeview:"Źródło"},paragraph:{paragraph:"Akapit",outdent:"Zmniejsz wcięcie",indent:"Zwiększ wcięcie",left:"Wyrównaj do lewej",center:"Wyrównaj do środka",right:"Wyrównaj do prawej",justify:"Wyrównaj do lewej i prawej"},color:{recent:"Ostani kolor",more:"Więcej kolorów",background:"Tło",foreground:"Czcionka",transparent:"Przeźroczysty",setTransparent:"Przeźroczyste",reset:"Zresetuj",resetToDefault:"Domyślne"},shortcut:{shortcuts:"Skróty klawiaturowe",close:"Zamknij",textFormatting:"Formatowanie tekstu",action:"Akcja",paragraphFormatting:"Formatowanie akapitu",documentStyle:"Styl dokumentu",extraKeys:"Dodatkowe klawisze"},help:{insertParagraph:"Wstaw paragraf",undo:"Cofnij poprzednią operację",redo:"Przywróć poprzednią operację",tab:"Tabulacja",untab:"Usuń tabulację",bold:"Pogrubienie",italic:"Kursywa",underline:"Podkreślenie",strikethrough:"Przekreślenie",removeFormat:"Usuń formatowanie",justifyLeft:"Wyrównaj do lewej",justifyCenter:"Wyrównaj do środka",justifyRight:"Wyrównaj do prawej",justifyFull:"Justyfikacja",insertUnorderedList:"Nienumerowana lista",insertOrderedList:"Wypunktowana lista",outdent:"Zmniejsz wcięcie paragrafu",indent:"Zwiększ wcięcie paragrafu",formatPara:"Zamień format bloku na paragraf (tag P)",formatH1:"Zamień format bloku na H1",formatH2:"Zamień format bloku na H2",formatH3:"Zamień format bloku na H3",formatH4:"Zamień format bloku na H4",formatH5:"Zamień format bloku na H5",formatH6:"Zamień format bloku na H6",insertHorizontalRule:"Wstaw poziomą linię","linkDialog.show":"Pokaż dialog linkowania"},history:{undo:"Cofnij",redo:"Ponów"},specialChar:{specialChar:"ZNAKI SPECJALNE",select:"Wybierz Znak specjalny"}}})}(jQuery);
!function(a){a.extend(a.summernote.lang,{"pt-BR":{font:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",clear:"Remover estilo da fonte",height:"Altura da linha",name:"Fonte",strikethrough:"Riscado",subscript:"Subscrito",superscript:"Sobrescrito",size:"Tamanho da fonte"},image:{image:"Imagem",insert:"Inserir imagem",resizeFull:"Redimensionar Completamente",resizeHalf:"Redimensionar pela Metade",resizeQuarter:"Redimensionar a um Quarto",floatLeft:"Flutuar para Esquerda",floatRight:"Flutuar para Direita",floatNone:"Não Flutuar",shapeRounded:"Forma: Arredondado",shapeCircle:"Forma: Círculo",shapeThumbnail:"Forma: Miniatura",shapeNone:"Forma: Nenhum",dragImageHere:"Arraste Imagem ou Texto para cá",dropImage:"Solte Imagem ou Texto",selectFromFiles:"Selecione a partir dos arquivos",maximumFileSize:"Tamanho máximo do arquivo",maximumFileSizeError:"Tamanho máximo do arquivo excedido.",url:"URL da imagem",remove:"Remover Imagem",original:"Original"},video:{video:"Vídeo",videoLink:"Link para vídeo",insert:"Inserir vídeo",url:"URL do vídeo?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)"},link:{link:"Link",insert:"Inserir link",unlink:"Remover link",edit:"Editar",textToDisplay:"Texto para exibir",url:"Para qual URL este link leva?",openInNewWindow:"Abrir em uma nova janela"},table:{table:"Tabela",addRowAbove:"Adicionar linha acima",addRowBelow:"Adicionar linha abaixo",addColLeft:"Adicionar coluna à esquerda",addColRight:"Adicionar coluna à direita",delRow:"Excluir linha",delCol:"Excluir coluna",delTable:"Excluir tabela"},hr:{insert:"Linha horizontal"},style:{style:"Estilo",p:"Normal",blockquote:"Citação",pre:"Código",h1:"Título 1",h2:"Título 2",h3:"Título 3",h4:"Título 4",h5:"Título 5",h6:"Título 6"},lists:{unordered:"Lista com marcadores",ordered:"Lista numerada"},options:{help:"Ajuda",fullscreen:"Tela cheia",codeview:"Ver código-fonte"},paragraph:{paragraph:"Parágrafo",outdent:"Menor tabulação",indent:"Maior tabulação",left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinha à direita",justify:"Justificado"},color:{recent:"Cor recente",more:"Mais cores",background:"Fundo",foreground:"Fonte",transparent:"Transparente",setTransparent:"Fundo transparente",reset:"Restaurar",resetToDefault:"Restaurar padrão",cpSelect:"Selecionar"},shortcut:{shortcuts:"Atalhos do teclado",close:"Fechar",textFormatting:"Formatação de texto",action:"Ação",paragraphFormatting:"Formatação de parágrafo",documentStyle:"Estilo de documento",extraKeys:"Extra keys"},help:{insertParagraph:"Inserir Parágrafo",undo:"Desfazer o último comando",redo:"Refazer o último comando",tab:"Tab",untab:"Desfazer tab",bold:"Colocar em negrito",italic:"Colocar em itálico",underline:"Sublinhado",strikethrough:"Tachado",removeFormat:"Remover estilo",justifyLeft:"Alinhar à esquerda",justifyCenter:"Centralizar",justifyRight:"Alinhar à esquerda",justifyFull:"Justificar",insertUnorderedList:"Lista não ordenada",insertOrderedList:"Lista ordenada",outdent:"Recuar parágrafo atual",indent:"Avançar parágrafo atual",formatPara:"Alterar formato do bloco para parágrafo(tag P)",formatH1:"Alterar formato do bloco para H1",formatH2:"Alterar formato do bloco para H2",formatH3:"Alterar formato do bloco para H3",formatH4:"Alterar formato do bloco para H4",formatH5:"Alterar formato do bloco para H5",formatH6:"Alterar formato do bloco para H6",insertHorizontalRule:"Inserir Régua horizontal","linkDialog.show":"Inserir um Hiperlink"},history:{undo:"Desfazer",redo:"Refazer"},specialChar:{specialChar:"CARACTERES ESPECIAIS",select:"Selecionar Caracteres Especiais"}}})}(jQuery);
!function(a){a.extend(a.summernote.lang,{"pt-PT":{font:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",clear:"Remover estilo da fonte",height:"Altura da linha",name:"Fonte",strikethrough:"Riscado",subscript:"Subscript",superscript:"Superscript",size:"Tamanho da fonte"},image:{image:"Imagem",insert:"Inserir imagem",resizeFull:"Redimensionar Completo",resizeHalf:"Redimensionar Metade",resizeQuarter:"Redimensionar Um Quarto",floatLeft:"Float Esquerda",floatRight:"Float Direita",floatNone:"Sem Float",shapeRounded:"Forma: Arredondado",shapeCircle:"Forma: Círculo",shapeThumbnail:"Forma: Minhatura",shapeNone:"Forma: Nenhum",dragImageHere:"Arraste uma imagem para aqui",dropImage:"Arraste uma imagem ou texto",selectFromFiles:"Selecione a partir dos arquivos",maximumFileSize:"Tamanho máximo do fixeiro",maximumFileSizeError:"Tamanho máximo do fixeiro é maior que o permitido.",url:"Endereço da imagem",remove:"Remover Imagem",original:"Original"},video:{video:"Vídeo",videoLink:"Link para vídeo",insert:"Inserir vídeo",url:"URL do vídeo?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)"},link:{link:"Link",insert:"Inserir ligação",unlink:"Remover ligação",edit:"Editar",textToDisplay:"Texto para exibir",url:"Que endereço esta licação leva?",openInNewWindow:"Abrir numa nova janela"},table:{table:"Tabela",addRowAbove:"Adicionar linha acima",addRowBelow:"Adicionar linha abaixo",addColLeft:"Adicionar coluna à Esquerda",addColRight:"Adicionar coluna à Esquerda",delRow:"Excluir linha",delCol:"Excluir coluna",delTable:"Excluir tabela"},hr:{insert:"Inserir linha horizontal"},style:{style:"Estilo",p:"Parágrafo",blockquote:"Citação",pre:"Código",h1:"Título 1",h2:"Título 2",h3:"Título 3",h4:"Título 4",h5:"Título 5",h6:"Título 6"},lists:{unordered:"Lista com marcadores",ordered:"Lista numerada"},options:{help:"Ajuda",fullscreen:"Janela Completa",codeview:"Ver código-fonte"},paragraph:{paragraph:"Parágrafo",outdent:"Menor tabulação",indent:"Maior tabulação",left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinha à direita",justify:"Justificado"},color:{recent:"Cor recente",more:"Mais cores",background:"Fundo",foreground:"Fonte",transparent:"Transparente",setTransparent:"Fundo transparente",reset:"Restaurar",resetToDefault:"Restaurar padrão",cpSelect:"Selecionar"},shortcut:{shortcuts:"Atalhos do teclado",close:"Fechar",textFormatting:"Formatação de texto",action:"Ação",paragraphFormatting:"Formatação de parágrafo",documentStyle:"Estilo de documento"},help:{insertParagraph:"Inserir Parágrafo",undo:"Desfazer o último comando",redo:"Refazer o último comando",tab:"Maior tabulação",untab:"Menor tabulação",bold:"Colocar em negrito",italic:"Colocar em itálico",underline:"Colocar em sublinhado",strikethrough:"Colocar em riscado",removeFormat:"Limpar o estilo",justifyLeft:"Definir alinhado à esquerda",justifyCenter:"Definir alinhado ao centro",justifyRight:"Definir alinhado à direita",justifyFull:"Definir justificado",insertUnorderedList:"Alternar lista não ordenada",insertOrderedList:"Alternar lista ordenada",outdent:"Recuar parágrafo atual",indent:"Avançar parágrafo atual",formatPara:"Alterar formato do bloco para parágrafo",formatH1:"Alterar formato do bloco para Título 1",formatH2:"Alterar formato do bloco para Título 2",formatH3:"Alterar formato do bloco para Título 3",formatH4:"Alterar formato do bloco para Título 4",formatH5:"Alterar formato do bloco para Título 5",formatH6:"Alterar formato do bloco para Título 6",insertHorizontalRule:"Inserir linha horizontal","linkDialog.show":"Inserir uma ligração"},history:{undo:"Desfazer",redo:"Refazer"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"ro-RO":{font:{bold:"Îngroșat",italic:"Înclinat",underline:"Subliniat",clear:"Înlătură formatare font",height:"Înălțime rând",name:"Familie de fonturi",strikethrough:"Tăiat",subscript:"Indice",superscript:"Exponent",size:"Dimensiune font"},image:{image:"Imagine",insert:"Inserează imagine",resizeFull:"Redimensionează complet",resizeHalf:"Redimensionează 1/2",resizeQuarter:"Redimensionează 1/4",floatLeft:"Aliniere la stânga",floatRight:"Aliniere la dreapta",floatNone:"Fară aliniere",shapeRounded:"Formă: Rotund",shapeCircle:"Formă: Cerc",shapeThumbnail:"Formă: Pictogramă",shapeNone:"Formă: Nici una",dragImageHere:"Trage o imagine sau un text aici",dropImage:"Eliberează imaginea sau textul",selectFromFiles:"Alege din fişiere",maximumFileSize:"Dimensiune maximă fișier",maximumFileSizeError:"Dimensiune maximă fișier depășită.",url:"URL imagine",remove:"Șterge imagine",original:"Original"},video:{video:"Video",videoLink:"Link video",insert:"Inserează video",url:"URL video?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion sau Youku)"},link:{link:"Link",insert:"Inserează link",unlink:"Înlătură link",edit:"Editează",textToDisplay:"Text ce va fi afişat",url:"La ce adresă URL trebuie să conducă acest link?",openInNewWindow:"Deschidere în fereastră nouă"},table:{table:"Tabel",addRowAbove:"Adaugă rând deasupra",addRowBelow:"Adaugă rând dedesubt",addColLeft:"Adaugă coloană stânga",addColRight:"Adaugă coloană dreapta",delRow:"Șterge rând",delCol:"Șterge coloană",delTable:"Șterge tabel"},hr:{insert:"Inserează o linie orizontală"},style:{style:"Stil",p:"p",blockquote:"Citat",pre:"Preformatat",h1:"Titlu 1",h2:"Titlu 2",h3:"Titlu 3",h4:"Titlu 4",h5:"Titlu 5",h6:"Titlu 6"},lists:{unordered:"Listă neordonată",ordered:"Listă ordonată"},options:{help:"Ajutor",fullscreen:"Măreşte",codeview:"Sursă"},paragraph:{paragraph:"Paragraf",outdent:"Creşte identarea",indent:"Scade identarea",left:"Aliniere la stânga",center:"Aliniere centrală",right:"Aliniere la dreapta",justify:"Aliniere în bloc"},color:{recent:"Culoare recentă",more:"Mai multe  culori",background:"Culoarea fundalului",foreground:"Culoarea textului",transparent:"Transparent",setTransparent:"Setează transparent",reset:"Resetează",resetToDefault:"Revino la iniţial"},shortcut:{shortcuts:"Scurtături tastatură",close:"Închide",textFormatting:"Formatare text",action:"Acţiuni",paragraphFormatting:"Formatare paragraf",documentStyle:"Stil paragraf",extraKeys:"Taste extra"},help:{insertParagraph:"Inserează paragraf",undo:"Revine la starea anterioară",redo:"Revine la starea ulterioară",tab:"Tab",untab:"Untab",bold:"Setează stil îngroșat",italic:"Setează stil înclinat",underline:"Setează stil subliniat",strikethrough:"Setează stil tăiat",removeFormat:"Înlătură formatare",justifyLeft:"Setează aliniere stânga",justifyCenter:"Setează aliniere centru",justifyRight:"Setează aliniere dreapta",justifyFull:"Setează aliniere bloc",insertUnorderedList:"Comutare listă neordinată",insertOrderedList:"Comutare listă ordonată",outdent:"Înlătură indentare paragraf curent",indent:"Adaugă indentare paragraf curent",formatPara:"Schimbă formatarea selecției în paragraf",formatH1:"Schimbă formatarea selecției în H1",formatH2:"Schimbă formatarea selecției în H2",formatH3:"Schimbă formatarea selecției în H3",formatH4:"Schimbă formatarea selecției în H4",formatH5:"Schimbă formatarea selecției în H5",formatH6:"Schimbă formatarea selecției în H6",insertHorizontalRule:"Adaugă linie orizontală","linkDialog.show":"Inserează link"},history:{undo:"Starea anterioară",redo:"Starea ulterioară"},specialChar:{specialChar:"CARACTERE SPECIALE",select:"Alege caractere speciale"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"ru-RU":{font:{bold:"Полужирный",italic:"Курсив",underline:"Подчёркнутый",clear:"Убрать стили шрифта",height:"Высота линии",name:"Шрифт",strikethrough:"Зачёркнутый",subscript:"Нижний индекс",superscript:"Верхний индекс",size:"Размер шрифта"},image:{image:"Картинка",insert:"Вставить картинку",resizeFull:"Восстановить размер",resizeHalf:"Уменьшить до 50%",resizeQuarter:"Уменьшить до 25%",floatLeft:"Расположить слева",floatRight:"Расположить справа",floatNone:"Расположение по-умолчанию",shapeRounded:"Форма: Закругленная",shapeCircle:"Форма: Круг",shapeThumbnail:"Форма: Миниатюра",shapeNone:"Форма: Нет",dragImageHere:"Перетащите сюда картинку",dropImage:"Перетащите картинку",selectFromFiles:"Выбрать из файлов",maximumFileSize:"Максимальный размер файла",maximumFileSizeError:"Превышен максимальный размер файла",url:"URL картинки",remove:"Удалить картинку",original:"Оригинал"},video:{video:"Видео",videoLink:"Ссылка на видео",insert:"Вставить видео",url:"URL видео",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion или Youku)"},link:{link:"Ссылка",insert:"Вставить ссылку",unlink:"Убрать ссылку",edit:"Редактировать",textToDisplay:"Отображаемый текст",url:"URL для перехода",openInNewWindow:"Открывать в новом окне"},table:{table:"Таблица",addRowAbove:"Добавить строку выше",addRowBelow:"Добавить строку ниже",addColLeft:"Добавить столбец слева",addColRight:"Добавить столбец справа",delRow:"Удалить строку",delCol:"Удалить столбец",delTable:"Удалить таблицу"},hr:{insert:"Вставить горизонтальную линию"},style:{style:"Стиль",p:"Нормальный",blockquote:"Цитата",pre:"Код",h1:"Заголовок 1",h2:"Заголовок 2",h3:"Заголовок 3",h4:"Заголовок 4",h5:"Заголовок 5",h6:"Заголовок 6"},lists:{unordered:"Маркированный список",ordered:"Нумерованный список"},options:{help:"Помощь",fullscreen:"На весь экран",codeview:"Исходный код"},paragraph:{paragraph:"Параграф",outdent:"Уменьшить отступ",indent:"Увеличить отступ",left:"Выровнять по левому краю",center:"Выровнять по центру",right:"Выровнять по правому краю",justify:"Растянуть по ширине"},color:{recent:"Последний цвет",more:"Еще цвета",background:"Цвет фона",foreground:"Цвет шрифта",transparent:"Прозрачный",setTransparent:"Сделать прозрачным",reset:"Сброс",resetToDefault:"Восстановить умолчания"},shortcut:{shortcuts:"Сочетания клавиш",close:"Закрыть",textFormatting:"Форматирование текста",action:"Действие",paragraphFormatting:"Форматирование параграфа",documentStyle:"Стиль документа",extraKeys:"Дополнительные комбинации"},help:{insertParagraph:"Новый параграф",undo:"Отменить последнюю команду",redo:"Повторить последнюю команду",tab:"Tab",untab:"Untab",bold:'Установить стиль "Жирный"',italic:'Установить стиль "Наклонный"',underline:'Установить стиль "Подчеркнутый"',strikethrough:'Установить стиль "Зачеркнутый"',removeFormat:"Сборсить стили",justifyLeft:"Выровнять по левому краю",justifyCenter:"Выровнять по центру",justifyRight:"Выровнять по правому краю",justifyFull:"Растянуть на всю ширину",insertUnorderedList:"Включить/отключить маркированный список",insertOrderedList:"Включить/отключить нумерованный список",outdent:"Убрать отступ в текущем параграфе",indent:"Вставить отступ в текущем параграфе",formatPara:"Форматировать текущий блок как параграф (тег P)",formatH1:"Форматировать текущий блок как H1",formatH2:"Форматировать текущий блок как H2",formatH3:"Форматировать текущий блок как H3",formatH4:"Форматировать текущий блок как H4",formatH5:"Форматировать текущий блок как H5",formatH6:"Форматировать текущий блок как H6",insertHorizontalRule:"Вставить горизонтальную черту","linkDialog.show":'Показать диалог "Ссылка"'},history:{undo:"Отменить",redo:"Повтор"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"sk-SK":{font:{bold:"Tučné",italic:"Kurzíva",underline:"Podčiarknutie",clear:"Odstrániť štýl písma",height:"Výška riadku",strikethrough:"Prečiarknuté",subscript:"Subscript",superscript:"Superscript",size:"Veľkosť písma"},image:{image:"Obrázok",insert:"Vložiť obrázok",resizeFull:"Pôvodná veľkosť",resizeHalf:"Polovičná veľkosť",resizeQuarter:"Štvrtinová veľkosť",floatLeft:"Umiestniť doľava",floatRight:"Umiestniť doprava",floatNone:"Bez zarovnania",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Pretiahnuť sem obrázok",dropImage:"Drop image or Text",selectFromFiles:"Vybrať súbor",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL obrázku",remove:"Remove Image",original:"Original"},video:{video:"Video",videoLink:"Odkaz videa",insert:"Vložiť video",url:"URL videa?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion alebo Youku)"},link:{link:"Odkaz",insert:"Vytvoriť odkaz",unlink:"Zrušiť odkaz",edit:"Upraviť",textToDisplay:"Zobrazovaný text",url:"Na akú URL adresu má tento odkaz viesť?",openInNewWindow:"Otvoriť v novom okne"},table:{table:"Tabuľka",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Vložit vodorovnú čiaru"},style:{style:"Štýl",p:"Normálny",blockquote:"Citácia",pre:"Kód",h1:"Nadpis 1",h2:"Nadpis 2",h3:"Nadpis 3",h4:"Nadpis 4",h5:"Nadpis 5",h6:"Nadpis 6"},lists:{unordered:"Odrážkový zoznam",ordered:"Číselný zoznam"},options:{help:"Pomoc",fullscreen:"Celá obrazovka",codeview:"HTML kód"},paragraph:{paragraph:"Odsek",outdent:"Zväčšiť odsadenie",indent:"Zmenšiť odsadenie",left:"Zarovnať doľava",center:"Zarovnať na stred",right:"Zarovnať doprava",justify:"Zarovnať obojstranne"},color:{recent:"Aktuálna farba",more:"Dalšie farby",background:"Farba pozadia",foreground:"Farba písma",transparent:"Priehľadnosť",setTransparent:"Nastaviť priehľadnosť",reset:"Obnoviť",resetToDefault:"Obnoviť prednastavené"},shortcut:{shortcuts:"Klávesové skratky",close:"Zavrieť",textFormatting:"Formátovanie textu",action:"Akcia",paragraphFormatting:"Formátovanie odseku",documentStyle:"Štýl dokumentu"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Krok vzad",redo:"Krok dopredu"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"sl-SI":{font:{bold:"Krepko",italic:"Ležeče",underline:"Podčrtano",clear:"Počisti oblikovanje izbire",height:"Razmik med vrsticami",name:"Pisava",strikethrough:"Prečrtano",subscript:"Podpisano",superscript:"Nadpisano",size:"Velikost pisave"},image:{image:"Slika",insert:"Vstavi sliko",resizeFull:"Razširi na polno velikost",resizeHalf:"Razširi na polovico velikosti",resizeQuarter:"Razširi na četrtino velikosti",floatLeft:"Leva poravnava",floatRight:"Desna poravnava",floatNone:"Brez poravnave",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Sem povlecite sliko",dropImage:"Drop image or Text",selectFromFiles:"Izberi sliko za nalaganje",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL naslov slike",remove:"Odstrani sliko",original:"Original"},video:{video:"Video",videoLink:"Video povezava",insert:"Vstavi video",url:"Povezava do videa",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ali Youku)"},link:{link:"Povezava",insert:"Vstavi povezavo",unlink:"Odstrani povezavo",edit:"Uredi",textToDisplay:"Prikazano besedilo",url:"Povezava",openInNewWindow:"Odpri v novem oknu"},table:{table:"Tabela",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Vstavi horizontalno črto"},style:{style:"Slogi",p:"Navadno besedilo",blockquote:"Citat",pre:"Koda",h1:"Naslov 1",h2:"Naslov 2",h3:"Naslov 3",h4:"Naslov 4",h5:"Naslov 5",h6:"Naslov 6"},lists:{unordered:"Označen seznam",ordered:"Oštevilčen seznam"},options:{help:"Pomoč",fullscreen:"Celozaslonski način",codeview:"Pregled HTML kode"},paragraph:{paragraph:"Slogi odstavka",outdent:"Zmanjšaj odmik",indent:"Povečaj odmik",left:"Leva poravnava",center:"Desna poravnava",right:"Sredinska poravnava",justify:"Obojestranska poravnava"},color:{recent:"Uporabi zadnjo barvo",more:"Več barv",background:"Barva ozadja",foreground:"Barva besedila",transparent:"Brez barve",setTransparent:"Brez barve",reset:"Ponastavi",resetToDefault:"Ponastavi na privzeto"},shortcut:{shortcuts:"Bljižnice",close:"Zapri",textFormatting:"Oblikovanje besedila",action:"Dejanja",paragraphFormatting:"Oblikovanje odstavka",documentStyle:"Oblikovanje naslova",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Razveljavi",redo:"Uveljavi"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"sr-RS":{font:{bold:"Podebljano",italic:"Kurziv",underline:"Podvučeno",clear:"Ukloni stilove fonta",height:"Visina linije",name:"Font Family",strikethrough:"Precrtano",subscript:"Subscript",superscript:"Superscript",size:"Veličina fonta"},image:{image:"Slika",insert:"Umetni sliku",resizeFull:"Puna veličina",resizeHalf:"Umanji na 50%",resizeQuarter:"Umanji na 25%",floatLeft:"Uz levu ivicu",floatRight:"Uz desnu ivicu",floatNone:"Bez ravnanja",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Prevuci sliku ovde",dropImage:"Drop image or Text",selectFromFiles:"Izaberi iz datoteke",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Adresa slike",remove:"Ukloni sliku",original:"Original"},video:{video:"Video",videoLink:"Veza ka videu",insert:"Umetni video",url:"URL video",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ili Youku)"},link:{link:"Veza",insert:"Umetni vezu",unlink:"Ukloni vezu",edit:"Uredi",textToDisplay:"Tekst za prikaz",url:"Internet adresa",openInNewWindow:"Otvori u novom prozoru"},table:{table:"Tabela",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Umetni horizontalnu liniju"},style:{style:"Stil",p:"pni",blockquote:"Citat",pre:"Kod",h1:"Zaglavlje 1",h2:"Zaglavlje 2",h3:"Zaglavlje 3",h4:"Zaglavlje 4",h5:"Zaglavlje 5",h6:"Zaglavlje 6"},lists:{unordered:"Obična lista",ordered:"Numerisana lista"},options:{help:"Pomoć",fullscreen:"Preko celog ekrana",codeview:"Izvorni kod"},paragraph:{paragraph:"Paragraf",outdent:"Smanji uvlačenje",indent:"Povečaj uvlačenje",left:"Poravnaj u levo",center:"Centrirano",right:"Poravnaj u desno",justify:"Poravnaj obostrano"},color:{recent:"Poslednja boja",more:"Više boja",background:"Boja pozadine",foreground:"Boja teksta",transparent:"Providna",setTransparent:"Providna",reset:"Opoziv",resetToDefault:"Podrazumevana"},shortcut:{shortcuts:"Prečice sa tastature",close:"Zatvori",textFormatting:"Formatiranje teksta",action:"Akcija",paragraphFormatting:"Formatiranje paragrafa",documentStyle:"Stil dokumenta",extraKeys:"Dodatne kombinacije"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Poništi",redo:"Ponovi"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"sr-RS":{font:{bold:"Подебљано",italic:"Курзив",underline:"Подвучено",clear:"Уклони стилове фонта",height:"Висина линије",name:"Font Family",strikethrough:"Прецртано",subscript:"Subscript",superscript:"Superscript",size:"Величина фонта"},image:{image:"Слика",insert:"Уметни слику",resizeFull:"Пуна величина",resizeHalf:"Умањи на 50%",resizeQuarter:"Умањи на 25%",floatLeft:"Уз леву ивицу",floatRight:"Уз десну ивицу",floatNone:"Без равнања",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Превуци слику овде",dropImage:"Drop image or Text",selectFromFiles:"Изабери из датотеке",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Адреса слике",remove:"Уклони слику",original:"Original"},video:{video:"Видео",videoLink:"Веза ка видеу",insert:"Уметни видео",url:"URL видео",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion или Youku)"},link:{link:"Веза",insert:"Уметни везу",unlink:"Уклони везу",edit:"Уреди",textToDisplay:"Текст за приказ",url:"Интернет адреса",openInNewWindow:"Отвори у новом прозору"},table:{table:"Табела",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Уметни хоризонталну линију"},style:{style:"Стил",p:"Нормални",blockquote:"Цитат",pre:"Код",h1:"Заглавље 1",h2:"Заглавље 2",h3:"Заглавље 3",h4:"Заглавље 4",h5:"Заглавље 5",h6:"Заглавље 6"},lists:{unordered:"Обична листа",ordered:"Нумерисана листа"},options:{help:"Помоћ",fullscreen:"Преко целог екрана",codeview:"Изворни код"},paragraph:{paragraph:"Параграф",outdent:"Смањи увлачење",indent:"Повечај увлачење",left:"Поравнај у лево",center:"Центрирано",right:"Поравнај у десно",justify:"Поравнај обострано"},color:{recent:"Последња боја",more:"Више боја",background:"Боја позадине",foreground:"Боја текста",transparent:"Провидна",setTransparent:"Провидна",reset:"Опозив",resetToDefault:"Подразумевана"},shortcut:{shortcuts:"Пречице са тастатуре",close:"Затвори",textFormatting:"Форматирање текста",action:"Акција",paragraphFormatting:"Форматирање параграфа",documentStyle:"Стил документа",extraKeys:"Додатне комбинације"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Поништи",redo:"Понови"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"sv-SE":{font:{bold:"Fet",italic:"Kursiv",underline:"Understruken",clear:"Radera formatering",height:"Radavstånd",name:"Teckensnitt",strikethrough:"Genomstruken",subscript:"Subscript",superscript:"Superscript",size:"Teckenstorlek"},image:{image:"Bild",insert:"Infoga bild",resizeFull:"Full storlek",resizeHalf:"Halv storlek",resizeQuarter:"En fjärdedel i storlek",floatLeft:"Vänsterjusterad",floatRight:"Högerjusterad",floatNone:"Ingen justering",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Dra en bild hit",dropImage:"Drop image or Text",selectFromFiles:"Välj från filer",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Länk till bild",remove:"Ta bort bild",original:"Original"},video:{video:"Filmklipp",videoLink:"Länk till filmklipp",insert:"Infoga filmklipp",url:"Länk till filmklipp",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)"},link:{link:"Länk",insert:"Infoga länk",unlink:"Ta bort länk",edit:"Redigera",textToDisplay:"Visningstext",url:"Till vilken URL ska denna länk peka?",openInNewWindow:"Öppna i ett nytt fönster"},table:{table:"Tabell",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Infoga horisontell linje"},style:{style:"Stil",p:"p",blockquote:"Citat",pre:"Kod",h1:"Rubrik 1",h2:"Rubrik 2",h3:"Rubrik 3",h4:"Rubrik 4",h5:"Rubrik 5",h6:"Rubrik 6"},lists:{unordered:"Punktlista",ordered:"Numrerad lista"},options:{help:"Hjälp",fullscreen:"Fullskärm",codeview:"HTML-visning"},paragraph:{paragraph:"Justera text",outdent:"Minska indrag",indent:"Öka indrag",left:"Vänsterjusterad",center:"Centrerad",right:"Högerjusterad",justify:"Justera text"},color:{recent:"Senast använda färg",more:"Fler färger",background:"Bakgrundsfärg",foreground:"Teckenfärg",transparent:"Genomskinlig",setTransparent:"Gör genomskinlig",reset:"Nollställ",resetToDefault:"Återställ till standard"},shortcut:{shortcuts:"Kortkommandon",close:"Stäng",textFormatting:"Textformatering",action:"Funktion",paragraphFormatting:"Avsnittsformatering",documentStyle:"Dokumentstil",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Ångra",redo:"Gör om"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"ta-IN":{font:{bold:"தடித்த",italic:"சாய்வு",underline:"அடிக்கோடு",clear:"நீக்கு",height:"வரி  உயரம்",name:"எழுத்துரு பெயர்",strikethrough:"குறுக்குக் கோடு",size:"எழுத்துரு அளவு",superscript:"மேல் ஒட்டு",subscript:"கீழ் ஒட்டு"},image:{image:"படம்",insert:"படத்தை செருகு",resizeFull:"முழு அளவை",resizeHalf:"அரை அளவை",resizeQuarter:"கால் அளவை",floatLeft:"இடப்பக்கமாக வை",floatRight:"வலப்பக்கமாக வை",floatNone:"இயல்புநிலையில் வை",shapeRounded:"வட்டமான வடிவம்",shapeCircle:"வட்ட வடிவம்",shapeThumbnail:"சிறு வடிவம்",shapeNone:"வடிவத்தை நீக்கு",dragImageHere:"படத்தை இங்கே இழுத்துவை",dropImage:"படத்தை விடு",selectFromFiles:"கோப்புகளை தேர்வு செய்",maximumFileSize:"அதிகபட்ச கோப்பு அளவு",maximumFileSizeError:"கோப்பு அதிகபட்ச அளவை மீறிவிட்டது",url:"இணையதள முகவரி",remove:"படத்தை நீக்கு",original:"Original"},video:{video:"காணொளி",videoLink:"காணொளி இணைப்பு",insert:"காணொளியை செருகு",url:"இணையதள முகவரி",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"இணைப்பு",insert:"இணைப்பை செருகு",unlink:"இணைப்பை நீக்கு",edit:"இணைப்பை தொகு",textToDisplay:"காட்சி வாசகம்",url:"இணையதள முகவரி",openInNewWindow:"புதிய சாளரத்தில் திறக்க"},table:{table:"அட்டவணை",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"கிடைமட்ட கோடு"},style:{style:"தொகுப்பு",p:"பத்தி",blockquote:"மேற்கோள்",pre:"குறியீடு",h1:"தலைப்பு 1",h2:"தலைப்பு 2",h3:"தலைப்பு 3",h4:"தலைப்பு 4",h5:"தலைப்பு 5",h6:"தலைப்பு 6"},lists:{unordered:"வரிசையிடாத",ordered:"வரிசையிட்ட"},options:{help:"உதவி",fullscreen:"முழுத்திரை",codeview:"நிரலாக்க காட்சி"},paragraph:{paragraph:"பத்தி",outdent:"வெளித்தள்ளு",indent:"உள்ளே தள்ளு",left:"இடது சீரமைப்பு",center:"நடு சீரமைப்பு",right:"வலது சீரமைப்பு",justify:"இருபுற சீரமைப்பு"},color:{recent:"அண்மை நிறம்",more:"மேலும்",background:"பின்புல நிறம்",foreground:"முன்புற நிறம்",transparent:"தெளிமையான",setTransparent:"தெளிமையாக்கு",reset:"மீட்டமைக்க",resetToDefault:"இயல்புநிலைக்கு மீட்டமை"},shortcut:{shortcuts:"குறுக்குவழி",close:"மூடு",textFormatting:"எழுத்து வடிவமைப்பு",action:"செயல்படுத்து",paragraphFormatting:"பத்தி வடிவமைப்பு",documentStyle:"ஆவண பாணி",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"மீளமை",redo:"மீண்டும்"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"th-TH":{font:{bold:"ตัวหนา",italic:"ตัวเอียง",underline:"ขีดเส้นใต้",clear:"ล้างรูปแบบตัวอักษร",height:"ความสูงบรรทัด",name:"แบบตัวอักษร",strikethrough:"ขีดฆ่า",subscript:"ตัวห้อย",superscript:"ตัวยก",size:"ขนาดตัวอักษร"},image:{image:"รูปภาพ",insert:"แทรกรูปภาพ",resizeFull:"ปรับขนาดเท่าจริง",resizeHalf:"ปรับขนาดลง 50%",resizeQuarter:"ปรับขนาดลง 25%",floatLeft:"ชิดซ้าย",floatRight:"ชิดขวา",floatNone:"ไม่จัดตำแหน่ง",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"ลากรูปภาพที่ต้องการไว้ที่นี่",dropImage:"วางรูปภาพหรือข้อความ",selectFromFiles:"เลือกไฟล์รูปภาพ",maximumFileSize:"ขนาดไฟล์ใหญ่สุด",maximumFileSizeError:"ไฟล์เกินขนาดที่กำหนด",url:"ที่อยู่ URL ของรูปภาพ",remove:"ลบรูปภาพ",original:"Original"},video:{video:"วีดีโอ",videoLink:"ลิงก์ของวีดีโอ",insert:"แทรกวีดีโอ",url:"ที่อยู่ URL ของวีดีโอ",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion หรือ Youku)"},link:{link:"ตัวเชื่อมโยง",insert:"แทรกตัวเชื่อมโยง",unlink:"ยกเลิกตัวเชื่อมโยง",edit:"แก้ไข",textToDisplay:"ข้อความที่ให้แสดง",url:"ที่อยู่เว็บไซต์ที่ต้องการให้เชื่อมโยงไปถึง?",openInNewWindow:"เปิดในหน้าต่างใหม่"},table:{table:"ตาราง",addRowAbove:"เพิ่มแถวด้านบน",addRowBelow:"เพิ่มแถวด้านล่าง",addColLeft:"เพิ่มคอลัมน์ด้านซ้าย",addColRight:"เพิ่มคอลัมน์ด้านขวา",delRow:"ลบแถว",delCol:"ลบคอลัมน์",delTable:"ลบตาราง"},hr:{insert:"แทรกเส้นคั่น"},style:{style:"รูปแบบ",p:"ปกติ",blockquote:"ข้อความ",pre:"โค้ด",h1:"หัวข้อ 1",h2:"หัวข้อ 2",h3:"หัวข้อ 3",h4:"หัวข้อ 4",h5:"หัวข้อ 5",h6:"หัวข้อ 6"},lists:{unordered:"รายการแบบไม่มีลำดับ",ordered:"รายการแบบมีลำดับ"},options:{help:"ช่วยเหลือ",fullscreen:"ขยายเต็มหน้าจอ",codeview:"ซอร์สโค้ด"},paragraph:{paragraph:"ย่อหน้า",outdent:"เยื้องซ้าย",indent:"เยื้องขวา",left:"จัดหน้าชิดซ้าย",center:"จัดหน้ากึ่งกลาง",right:"จัดหน้าชิดขวา",justify:"จัดบรรทัดเสมอกัน"},color:{recent:"สีที่ใช้ล่าสุด",more:"สีอื่นๆ",background:"สีพื้นหลัง",foreground:"สีพื้นหน้า",transparent:"โปร่งแสง",setTransparent:"ตั้งค่าความโปร่งแสง",reset:"คืนค่า",resetToDefault:"คืนค่ามาตรฐาน"},shortcut:{shortcuts:"แป้นลัด",close:"ปิด",textFormatting:"การจัดรูปแบบข้อความ",action:"การกระทำ",paragraphFormatting:"การจัดรูปแบบย่อหน้า",documentStyle:"รูปแบบของเอกสาร",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"ทำตัวหนา",italic:"ทำตัวเอียง",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"เปลี่ยนรูปแบบบล็อคปัจจุบันเป็น H1",formatH2:"เปลี่ยนรูปแบบบล็อคปัจจุบันเป็น H2",formatH3:"เปลี่ยนรูปแบบบล็อคปัจจุบันเป็น H3",formatH4:"เปลี่ยนรูปแบบบล็อคปัจจุบันเป็น H4",formatH5:"เปลี่ยนรูปแบบบล็อคปัจจุบันเป็น H5",formatH6:"เปลี่ยนรูปแบบบล็อคปัจจุบันเป็น H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"เปิดหน้าแก้ไข Link"},history:{undo:"ยกเลิกการกระทำ",redo:"ทำซ้ำการกระทำ"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(a){a.extend(a.summernote.lang,{"tr-TR":{font:{bold:"Kalın",italic:"İtalik",underline:"Altı çizili",clear:"Temizle",height:"Satır yüksekliği",name:"Yazı Tipi",strikethrough:"Üstü çizili",subscript:"Alt Simge",superscript:"Üst Simge",size:"Yazı tipi boyutu"},image:{image:"Resim",insert:"Resim ekle",resizeFull:"Orjinal boyut",resizeHalf:"1/2 boyut",resizeQuarter:"1/4 boyut",floatLeft:"Sola hizala",floatRight:"Sağa hizala",floatNone:"Hizalamayı kaldır",shapeRounded:"Şekil: Yuvarlatılmış Köşe",shapeCircle:"Şekil: Daire",shapeThumbnail:"Şekil: K.Resim",shapeNone:"Şekil: Yok",dragImageHere:"Buraya sürükleyin",dropImage:"Resim veya metni bırakın",selectFromFiles:"Dosya seçin",maximumFileSize:"Maksimum dosya boyutu",maximumFileSizeError:"Maksimum dosya boyutu aşıldı.",url:"Resim bağlantısı",remove:"Resimi Kaldır",original:"Original"},video:{video:"Video",videoLink:"Video bağlantısı",insert:"Video ekle",url:"Video bağlantısı?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion veya Youku)"},link:{link:"Bağlantı",insert:"Bağlantı ekle",unlink:"Bağlantıyı kaldır",edit:"Bağlantıyı düzenle",textToDisplay:"Görüntülemek için",url:"Bağlantı adresi?",openInNewWindow:"Yeni pencerede aç"},table:{table:"Tablo",addRowAbove:"Yukarı satır ekle",addRowBelow:"Aşağı satır ekle",addColLeft:"Sola sütun ekle",addColRight:"Sağa sütun ekle",delRow:"Satırı sil",delCol:"Sütunu sil",delTable:"Tabloyu sil"},hr:{insert:"Yatay çizgi ekle"},style:{style:"Biçim",p:"p",blockquote:"Alıntı",pre:"Önbiçimli",h1:"Başlık 1",h2:"Başlık 2",h3:"Başlık 3",h4:"Başlık 4",h5:"Başlık 5",h6:"Başlık 6"},lists:{unordered:"Madde işaretli liste",ordered:"Numaralı liste"},options:{help:"Yardım",fullscreen:"Tam ekran",codeview:"HTML Kodu"},paragraph:{paragraph:"Paragraf",outdent:"Girintiyi artır",indent:"Girintiyi azalt",left:"Sola hizala",center:"Ortaya hizala",right:"Sağa hizala",justify:"Yasla"},color:{recent:"Son renk",more:"Daha fazla renk",background:"Arka plan rengi",foreground:"Yazı rengi",transparent:"Seffaflık",setTransparent:"Şeffaflığı ayarla",reset:"Sıfırla",resetToDefault:"Varsayılanlara sıfırla"},shortcut:{shortcuts:"Kısayollar",close:"Kapat",textFormatting:"Yazı biçimlendirme",action:"Eylem",paragraphFormatting:"Paragraf biçimlendirme",documentStyle:"Biçim",extraKeys:"İlave anahtarlar"},help:{insertParagraph:"Paragraf ekler",undo:"Son komudu geri alır",redo:"Son komudu yineler",tab:"Girintiyi artırır",untab:"Girintiyi azaltır",bold:"Kalın yazma stilini ayarlar",italic:"İtalik yazma stilini ayarlar",underline:"Altı çizgili yazma stilini ayarlar",strikethrough:"Üstü çizgili yazma stilini ayarlar",removeFormat:"Biçimlendirmeyi temizler",justifyLeft:"Yazıyı sola hizalar",justifyCenter:"Yazıyı ortalar",justifyRight:"Yazıyı sağa hizalar",justifyFull:"Yazıyı her iki tarafa yazlar",insertUnorderedList:"Madde işaretli liste ekler",insertOrderedList:"Numaralı liste ekler",outdent:"Aktif paragrafın girintisini azaltır",indent:"Aktif paragrafın girintisini artırır",formatPara:"Aktif bloğun biçimini paragraf (p) olarak değiştirir",formatH1:"Aktif bloğun biçimini başlık 1 (h1) olarak değiştirir",formatH2:"Aktif bloğun biçimini başlık 2 (h2) olarak değiştirir",formatH3:"Aktif bloğun biçimini başlık 3 (h3) olarak değiştirir",formatH4:"Aktif bloğun biçimini başlık 4 (h4) olarak değiştirir",formatH5:"Aktif bloğun biçimini başlık 5 (h5) olarak değiştirir",formatH6:"Aktif bloğun biçimini başlık 6 (h6) olarak değiştirir",insertHorizontalRule:"Yatay çizgi ekler","linkDialog.show":"Bağlantı ayar kutusunu gösterir"},history:{undo:"Geri al",redo:"Yinele"},specialChar:{specialChar:"ÖZEL KARAKTERLER",select:"Özel Karakterleri seçin"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"uk-UA":{font:{bold:"Напівжирний",italic:"Курсив",underline:"Підкреслений",clear:"Прибрати стилі шрифту",height:"Висота лінії",name:"Шрифт",strikethrough:"Закреслений",subscript:"Нижній індекс",superscript:"Верхній індекс",size:"Розмір шрифту"},image:{image:"Картинка",insert:"Вставити картинку",resizeFull:"Відновити розмір",resizeHalf:"Зменшити до 50%",resizeQuarter:"Зменшити до 25%",floatLeft:"Розташувати ліворуч",floatRight:"Розташувати праворуч",floatNone:"Початкове розташування",shapeRounded:"Форма: Заокруглена",shapeCircle:"Форма: Коло",shapeThumbnail:"Форма: Мініатюра",shapeNone:"Форма: Немає",dragImageHere:"Перетягніть сюди картинку",dropImage:"Перетягніть картинку",selectFromFiles:"Вибрати з файлів",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL картинки",remove:"Видалити картинку",original:"Original"},video:{video:"Відео",videoLink:"Посилання на відео",insert:"Вставити відео",url:"URL відео",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion чи Youku)"},link:{link:"Посилання",insert:"Вставити посилання",unlink:"Прибрати посилання",edit:"Редагувати",textToDisplay:"Текст, що відображається",url:"URL для переходу",openInNewWindow:"Відкривати у новому вікні"},table:{table:"Таблиця",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Вставити горизонтальну лінію"},style:{style:"Стиль",p:"Нормальний",blockquote:"Цитата",pre:"Код",h1:"Заголовок 1",h2:"Заголовок 2",h3:"Заголовок 3",h4:"Заголовок 4",h5:"Заголовок 5",h6:"Заголовок 6"},lists:{unordered:"Маркований список",ordered:"Нумерований список"},options:{help:"Допомога",fullscreen:"На весь екран",codeview:"Початковий код"},paragraph:{paragraph:"Параграф",outdent:"Зменшити відступ",indent:"Збільшити відступ",left:"Вирівняти по лівому краю",center:"Вирівняти по центру",right:"Вирівняти по правому краю",justify:"Розтягнути по ширині"},color:{recent:"Останній колір",more:"Ще кольори",background:"Колір фону",foreground:"Колір шрифту",transparent:"Прозорий",setTransparent:"Зробити прозорим",reset:"Відновити",resetToDefault:"Відновити початкові"},shortcut:{shortcuts:"Комбінації клавіш",close:"Закрити",textFormatting:"Форматування тексту",action:"Дія",paragraphFormatting:"Форматування параграфу",documentStyle:"Стиль документу",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Відмінити",redo:"Повторити"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"uz-UZ":{font:{bold:"қалин",italic:"Курсив",underline:"Белгиланган",clear:"Ҳарф турларини олиб ташлаш",height:"Чизиқ баландлиги",name:"Ҳарф",strikethrough:"Ўчирилган",subscript:"Пастки индекс",superscript:"Юқори индекс",size:"ҳарф ҳажми"},image:{image:"Расм",insert:"расмни қўйиш",resizeFull:"Ҳажмни тиклаш",resizeHalf:"50% гача кичрайтириш",resizeQuarter:"25% гача кичрайтириш",floatLeft:"Чапда жойлаштириш",floatRight:"Ўнгда жойлаштириш",floatNone:"Стандарт бўйича жойлашув",shapeRounded:"Шакли: Юмалоқ",shapeCircle:"Шакли: Доира",shapeThumbnail:"Шакли: Миниатюра",shapeNone:"Шакли: Йўқ",dragImageHere:"Суратни кўчириб ўтинг",dropImage:"Суратни кўчириб ўтинг",selectFromFiles:"Файллардан бирини танлаш",url:"суратлар URL и",remove:"Суратни ўчириш"},video:{video:"Видео",videoLink:"Видеога ҳавола",insert:"Видео",url:"URL видео",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion или Youku)"},link:{link:"Ҳавола",insert:"Ҳаволани қўйиш",unlink:"Ҳаволани олиб ташлаш",edit:"Таҳрир қилиш",textToDisplay:"Кўринадиган матн",url:"URL ўтиш учун",openInNewWindow:"Янги дарчада очиш"},table:{table:"Жадвал"},hr:{insert:"Горизонтал чизиқни қўйиш"},style:{style:"Услуб",p:"Яхши",blockquote:"Жумла",pre:"Код",h1:"Сарлавҳа 1",h2:"Сарлавҳа  2",h3:"Сарлавҳа  3",h4:"Сарлавҳа  4",h5:"Сарлавҳа  5",h6:"Сарлавҳа  6"},lists:{unordered:"Белгиланган рўйҳат",ordered:"Рақамланган рўйҳат"},options:{help:"Ёрдам",fullscreen:"Бутун экран бўйича",codeview:"Бошланғич код"},paragraph:{paragraph:"Параграф",outdent:"Орқага қайтишни камайтириш",indent:"Орқага қайтишни кўпайтириш",left:"Чап қирғоққа тўғрилаш",center:"Марказга тўғрилаш",right:"Ўнг қирғоққа тўғрилаш",justify:"Эни бўйлаб чўзиш"},color:{recent:"Охирги ранг",more:"Яна ранглар",background:"Фон  ранги",foreground:"Ҳарф ранги",transparent:"Шаффоф",setTransparent:"Шаффофдай қилиш",reset:"Бекор қилиш",resetToDefault:"Стандартга оид тиклаш"},shortcut:{shortcuts:"Клавишларнинг ҳамохҳанглиги",close:"Ёпиқ",textFormatting:"Матнни ",action:"Ҳаркат",paragraphFormatting:"Параграфни форматлаш",documentStyle:"Ҳужжатнинг тури",extraKeys:"Қўшимча имкониятлар"},history:{undo:"Бекор қилиш",redo:"Қайтариш"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"vi-VN":{font:{bold:"In Đậm",italic:"In Nghiêng",underline:"Gạch dưới",clear:"Bỏ định dạng",height:"Chiều cao dòng",name:"Phông chữ",strikethrough:"Gạch ngang",subscript:"Subscript",superscript:"Superscript",size:"Cỡ chữ"},image:{image:"Hình ảnh",insert:"Chèn",resizeFull:"100%",resizeHalf:"50%",resizeQuarter:"25%",floatLeft:"Trôi về trái",floatRight:"Trôi về phải",floatNone:"Không trôi",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Thả Ảnh ở vùng này",dropImage:"Drop image or Text",selectFromFiles:"Chọn từ File",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL",remove:"Xóa",original:"Original"},video:{video:"Video",videoLink:"Link đến Video",insert:"Chèn Video",url:"URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion và Youku)"},link:{link:"Link",insert:"Chèn Link",unlink:"Gỡ Link",edit:"Sửa",textToDisplay:"Văn bản hiển thị",url:"URL",openInNewWindow:"Mở ở Cửa sổ mới"},table:{table:"Bảng",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Chèn"},style:{style:"Kiểu chữ",p:"Chữ thường",blockquote:"Đoạn trích",pre:"Mã Code",h1:"H1",h2:"H2",h3:"H3",h4:"H4",h5:"H5",h6:"H6"},lists:{unordered:"Liệt kê danh sách",ordered:"Liệt kê theo thứ tự"},options:{help:"Trợ giúp",fullscreen:"Toàn Màn hình",codeview:"Xem Code"},paragraph:{paragraph:"Canh lề",outdent:"Dịch sang trái",indent:"Dịch sang phải",left:"Canh trái",center:"Canh giữa",right:"Canh phải",justify:"Canh đều"},color:{recent:"Màu chữ",more:"Mở rộng",background:"Màu nền",foreground:"Màu chữ",transparent:"trong suốt",setTransparent:"Nền trong suốt",reset:"Thiết lập lại",resetToDefault:"Trở lại ban đầu"},shortcut:{shortcuts:"Phím tắt",close:"Đóng",textFormatting:"Định dạng Văn bản",action:"Hành động",paragraphFormatting:"Định dạng",documentStyle:"Kiểu văn bản",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Lùi lại",redo:"Làm lại"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"zh-CN":{font:{bold:"粗体",italic:"斜体",underline:"下划线",clear:"清除格式",height:"行高",name:"字体",strikethrough:"删除线",subscript:"下标",superscript:"上标",size:"字号"},image:{image:"图片",insert:"插入图片",resizeFull:"缩放至 100%",resizeHalf:"缩放至 50%",resizeQuarter:"缩放至 25%",floatLeft:"靠左浮动",floatRight:"靠右浮动",floatNone:"取消浮动",shapeRounded:"形状: 圆角",shapeCircle:"形状: 圆",shapeThumbnail:"形状: 缩略图",shapeNone:"形状: 无",dragImageHere:"将图片拖拽至此处",dropImage:"拖拽图片或文本",selectFromFiles:"从本地上传",maximumFileSize:"文件大小最大值",maximumFileSizeError:"文件大小超出最大值。",url:"图片地址",remove:"移除图片",original:"原始图片"},video:{video:"视频",videoLink:"视频链接",insert:"插入视频",url:"视频地址",providers:"(优酷, 腾讯, Instagram, DailyMotion, Youtube等)"},link:{link:"链接",insert:"插入链接",unlink:"去除链接",edit:"编辑链接",textToDisplay:"显示文本",url:"链接地址",openInNewWindow:"在新窗口打开"},table:{table:"表格",addRowAbove:"在上方插入行",addRowBelow:"在下方插入行",addColLeft:"在左侧插入列",addColRight:"在右侧插入列",delRow:"删除行",delCol:"删除列",delTable:"删除表格"},hr:{insert:"水平线"},style:{style:"样式",p:"普通",blockquote:"引用",pre:"代码",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"},lists:{unordered:"无序列表",ordered:"有序列表"},options:{help:"帮助",fullscreen:"全屏",codeview:"源代码"},paragraph:{paragraph:"段落",outdent:"减少缩进",indent:"增加缩进",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐"},color:{recent:"最近使用",more:"更多",background:"背景",foreground:"前景",transparent:"透明",setTransparent:"透明",reset:"重置",resetToDefault:"默认"},shortcut:{shortcuts:"快捷键",close:"关闭",textFormatting:"文本格式",action:"动作",paragraphFormatting:"段落格式",documentStyle:"文档样式",extraKeys:"额外按键"},help:{insertParagraph:"插入段落",undo:"撤销",redo:"重做",tab:"增加缩进",untab:"减少缩进",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",removeFormat:"清除格式",justifyLeft:"左对齐",justifyCenter:"居中对齐",justifyRight:"右对齐",justifyFull:"两端对齐",insertUnorderedList:"无序列表",insertOrderedList:"有序列表",outdent:"减少缩进",indent:"增加缩进",formatPara:"设置选中内容样式为 普通",formatH1:"设置选中内容样式为 标题1",formatH2:"设置选中内容样式为 标题2",formatH3:"设置选中内容样式为 标题3",formatH4:"设置选中内容样式为 标题4",formatH5:"设置选中内容样式为 标题5",formatH6:"设置选中内容样式为 标题6",insertHorizontalRule:"插入水平线","linkDialog.show":"显示链接对话框"},history:{undo:"撤销",redo:"重做"},specialChar:{specialChar:"特殊字符",select:"选取特殊字符"}}})}(jQuery);
!function(e){e.extend(e.summernote.lang,{"zh-TW":{font:{bold:"粗體",italic:"斜體",underline:"底線",clear:"清除格式",height:"行高",name:"字體",strikethrough:"刪除線",subscript:"下標",superscript:"上標",size:"字號"},image:{image:"圖片",insert:"插入圖片",resizeFull:"縮放至100%",resizeHalf:"縮放至 50%",resizeQuarter:"縮放至 25%",floatLeft:"靠左浮動",floatRight:"靠右浮動",floatNone:"取消浮動",shapeRounded:"形狀: 圓角",shapeCircle:"形狀: 圓",shapeThumbnail:"形狀: 縮略圖",shapeNone:"形狀: 無",dragImageHere:"將圖片拖曳至此處",dropImage:"Drop image or Text",selectFromFiles:"從本機上傳",maximumFileSize:"文件大小最大值",maximumFileSizeError:"文件大小超出最大值。",url:"圖片網址",remove:"移除圖片",original:"Original"},video:{video:"影片",videoLink:"影片連結",insert:"插入影片",url:"影片網址",providers:"(優酷, Instagram, DailyMotion, Youtube等)"},link:{link:"連結",insert:"插入連結",unlink:"取消連結",edit:"編輯連結",textToDisplay:"顯示文字",url:"連結網址",openInNewWindow:"在新視窗開啟"},table:{table:"表格",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"水平線"},style:{style:"樣式",p:"一般",blockquote:"引用區塊",pre:"程式碼區塊",h1:"標題 1",h2:"標題 2",h3:"標題 3",h4:"標題 4",h5:"標題 5",h6:"標題 6"},lists:{unordered:"項目清單",ordered:"編號清單"},options:{help:"幫助",fullscreen:"全螢幕",codeview:"原始碼"},paragraph:{paragraph:"段落",outdent:"取消縮排",indent:"增加縮排",left:"靠右對齊",center:"靠中對齊",right:"靠右對齊",justify:"左右對齊"},color:{recent:"字型顏色",more:"更多",background:"背景",foreground:"前景",transparent:"透明",setTransparent:"透明",reset:"重設",resetToDefault:"默認"},shortcut:{shortcuts:"快捷鍵",close:"關閉",textFormatting:"文字格式",action:"動作",paragraphFormatting:"段落格式",documentStyle:"文件格式",extraKeys:"額外按鍵"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"復原",redo:"取消復原"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
(function (factory) {
    /* global define */
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define(['jquery'], factory);
    } else if (typeof module === 'object' && module.exports) {
        // Node/CommonJS
        module.exports = factory(require('jquery'));
    } else {
        // Browser globals
        factory(window.jQuery);
    }
}(function ($) {
    $.extend($.summernote.options, {
        cloudinary: {}
    });

    // Extend plugins for adding templates
    $.extend($.summernote.plugins, {
        /**
         * @param {Object} context - context object has status of editor.
         */
        'cloudinary': function (context) {
            var self = this;

            // Reference to editor object.
            var $note = context.$note;

            // Reference to ui helper.
            var ui = $.summernote.ui;
            
            // Reference to global options.
            var options = context.options;

            // Reference to current lang.
            var lang = $.summernote.lang[options.lang];
            
            // Reference to plugin options.
            var cloudinaryOptions = options.cloudinary;

            // Default options.
            var defaultOptions = {
                apiKey: '',
                cloudName: '',
                signature: undefined,
                timestamp: undefined,
                username: undefined
            };
            
            // Apply default options.
            for (var propertyName in defaultOptions) {
                if (cloudinaryOptions.hasOwnProperty(propertyName) === false) {
                    cloudinaryOptions[propertyName] = defaultOptions[propertyName];
                }
            }

            // Create "cloudinary" button for use in toolbars.
            context.memo('button.cloudinary', function () {
                var button = ui.button({
                    contents: ui.icon(options.icons.picture),
                    tooltip: lang.image.image,
                    click: context.createInvokeHandler('cloudinary.show')
                });

                return button.render();
            });

            // Invokable function to display cloudinary dialog.
            self.show = function () {
                // Ensure Cloudinary SDK has been loaded.
                if (!self.cloudinary) {
                    $.getScript('https://media-library.cloudinary.com/global/all.js', function success() {
                        self.cloudinary = window.cloudinary;
                        self.showCloudinaryMediaLibrary();
                    });
                } else {
                    self.showCloudinaryMediaLibrary();
                }
            };

            /** Show Cloudinary media library as a dialog window. */
            self.showCloudinaryMediaLibrary = function () {
                self.cloudinary.openMediaLibrary({
                    api_key: cloudinaryOptions.apiKey,
                    cloud_name: cloudinaryOptions.cloudName,
                    default_transformations: [[{ crop: 'lfill', fetchFormat: 'auto', gravity: 'auto', quality: 'auto', width: 1920 }]],
                    remove_header: false,
                    signature: cloudinaryOptions.signature,
                    timestamp: cloudinaryOptions.timestamp,
                    username: cloudinaryOptions.username
                }, {
                    insertHandler: function insertHandler(data) {
                        for (var i = 0; i < data.assets.length; i++) {
                            var asset = data.assets[i];
                            
                            // Get asset url.
                            var url = asset.derived && asset.derived.length 
                                ? asset.derived[0].url 
                                : asset.url;
                            
                            // Insert image element for each asset.
                            context.invoke('editor.insertImage', url, function ($image) {
                                if (asset.context && asset.context.custom) {
                                    $image.attr('alt', asset.context.custom.alt);
                                    $image.attr('title', asset.context.custom.caption);
                                }
                            });
                        } 
                    }
                });
            };
        }
    });
}));

(function(factory) {
  /* global define */
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['jquery'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // Node/CommonJS
    module.exports = factory(require('jquery'));
  } else {
    // Browser globals
    factory(window.jQuery);
  }
}(function($) {
  // pull in some summernote core functions
  var ui = $.summernote.ui;
  var dom = $.summernote.dom;

  // define the popover plugin
  var DataBasicPlugin = function(context) {
    var self = this;
    var options = context.options;
    var lang = options.langInfo;

    self.icon = '<i class="fa fa-object-group"/>';

    // add context menu button for dialog
    context.memo('button.databasic', function() {
      return ui.button({
        contents: self.icon,
        tooltip: lang.databasic.insert,
        click: context.createInvokeHandler('databasic.showDialog'),
      }).render();
    });

    // add popover edit button
    context.memo('button.databasicDialog', function() {
      return ui.button({
        contents: self.icon,
        tooltip: lang.databasic.edit,
        click: context.createInvokeHandler('databasic.showDialog'),
      }).render();
    });

    //  add popover size buttons
    context.memo('button.databasicSize100', function() {
      return ui.button({
        contents: '<span class="note-fontsize-10">100%</span>',
        tooltip: lang.image.resizeFull,
        click: context.createInvokeHandler('editor.resize', '1'),
      }).render();
    });
    context.memo('button.databasicSize50', function() {
      return ui.button({
        contents: '<span class="note-fontsize-10">50%</span>',
        tooltip: lang.image.resizeHalf,
        click: context.createInvokeHandler('editor.resize', '0.5'),
      }).render();
    });
    context.memo('button.databasicSize25', function() {
      return ui.button({
        contents: '<span class="note-fontsize-10">25%</span>',
        tooltip: lang.image.resizeQuarter,
        click: context.createInvokeHandler('editor.resize', '0.25'),
      }).render();
    });

    self.events = {
      'summernote.init': function(we, e) {
        // update existing containers
        $('data.ext-databasic', e.editable).each(function() { self.setContent($(this)); });
        // TODO: make this an undo snapshot...
      },
      'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function() {
        self.update();
      },
      'summernote.dialog.shown': function() {
        self.hidePopover();
      },
    };

    self.initialize = function() {
      // create dialog markup
      var $container = options.dialogsInBody ? $(document.body) : context.layoutInfo.editor;

      var body = '<div class="form-group row-fluid">' +
          '<label>' + lang.databasic.testLabel + '</label>' +
          '<input class="ext-databasic-test form-control" type="text" />' +
          '</div>';
      var footer = '<button href="#" class="btn btn-primary ext-databasic-save">' + lang.databasic.insert + '</button>';

      self.$dialog = ui.dialog({
        title: lang.databasic.name,
        fade: options.dialogsFade,
        body: body,
        footer: footer,
      }).render().appendTo($container);

      // create popover
      self.$popover = ui.popover({
        className: 'ext-databasic-popover',
      }).render().appendTo('body');
      var $content = self.$popover.find('.popover-content');

      context.invoke('buttons.build', $content, options.popover.databasic);
    };

    self.destroy = function() {
      self.$popover.remove();
      self.$popover = null;
      self.$dialog.remove();
      self.$dialog = null;
    };

    self.update = function() {
      // Prevent focusing on editable when invoke('code') is executed
      if (!context.invoke('editor.hasFocus')) {
        self.hidePopover();
        return;
      }

      var rng = context.invoke('editor.createRange');
      var visible = false;

      if (rng.isOnData()) {
        var $data = $(rng.sc).closest('data.ext-databasic');

        if ($data.length) {
          var pos = dom.posFromPlaceholder($data[0]);

          self.$popover.css({
            display: 'block',
            left: pos.left,
            top: pos.top,
          });

          // save editor target to let size buttons resize the container
          context.invoke('editor.saveTarget', $data[0]);

          visible = true;
        }
      }

      // hide if not visible
      if (!visible) {
        self.hidePopover();
      }
    };

    self.hidePopover = function() {
      self.$popover.hide();
    };

    // define plugin dialog
    self.getInfo = function() {
      var rng = context.invoke('editor.createRange');

      if (rng.isOnData()) {
        var $data = $(rng.sc).closest('data.ext-databasic');

        if ($data.length) {
          // Get the first node on range(for edit).
          return {
            node: $data,
            test: $data.attr('data-test'),
          };
        }
      }

      return {};
    };

    self.setContent = function($node) {
      $node.html('<p contenteditable="false">' + self.icon + ' ' + lang.databasic.name + ': ' +
        $node.attr('data-test') + '</p>');
    };

    self.updateNode = function(info) {
      self.setContent(info.node
        .attr('data-test', info.test));
    };

    self.createNode = function(info) {
      var $node = $('<data class="ext-databasic"></data>');

      if ($node) {
        // save node to info structure
        info.node = $node;
        // insert node into editor dom
        context.invoke('editor.insertNode', $node[0]);
      }

      return $node;
    };

    self.showDialog = function() {
      var info = self.getInfo();
      var newNode = !info.node;
      context.invoke('editor.saveRange');

      self
        .openDialog(info)
        .then(function(dialogInfo) {
          // [workaround] hide dialog before restore range for IE range focus
          ui.hideDialog(self.$dialog);
          context.invoke('editor.restoreRange');

          // insert a new node
          if (newNode) {
            self.createNode(info);
          }

          // update info with dialog info
          $.extend(info, dialogInfo);

          self.updateNode(info);
        })
        .fail(function() {
          context.invoke('editor.restoreRange');
        });
    };

    self.openDialog = function(info) {
      return $.Deferred(function(deferred) {
        var $inpTest = self.$dialog.find('.ext-databasic-test');
        var $saveBtn = self.$dialog.find('.ext-databasic-save');
        var onKeyup = function(event) {
          if (event.keyCode === 13) {
            $saveBtn.trigger('click');
          }
        };

        ui.onDialogShown(self.$dialog, function() {
          context.triggerEvent('dialog.shown');

          $inpTest.val(info.test).on('input', function() {
            ui.toggleBtn($saveBtn, $inpTest.val());
          }).trigger('focus').on('keyup', onKeyup);

          $saveBtn
            .text(info.node ? lang.databasic.edit : lang.databasic.insert)
            .click(function(event) {
              event.preventDefault();

              deferred.resolve({ test: $inpTest.val() });
            });

          // init save button
          ui.toggleBtn($saveBtn, $inpTest.val());
        });

        ui.onDialogHidden(self.$dialog, function() {
          $inpTest.off('input keyup');
          $saveBtn.off('click');

          if (deferred.state() === 'pending') {
            deferred.reject();
          }
        });

        ui.showDialog(self.$dialog);
      });
    };
  };

  // Extends summernote
  $.extend(true, $.summernote, {
    plugins: {
      databasic: DataBasicPlugin,
    },

    options: {
      popover: {
        databasic: [
          ['databasic', ['databasicDialog', 'databasicSize100', 'databasicSize50', 'databasicSize25']],
        ],
      },
    },

    // add localization texts
    lang: {
      'en-US': {
        databasic: {
          name: 'Basic Data Container',
          insert: 'insert basic data container',
          edit: 'edit basic data container',
          testLabel: 'test input',
        },
      },
    },

  });
}));

(function(factory) {
  /* global define */
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['jquery'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // Node/CommonJS
    module.exports = factory(require('jquery'));
  } else {
    // Browser globals
    factory(window.jQuery);
  }
}(function($) {
  // Extends plugins for adding hello.
  //  - plugin is external module for customizing.
  $.extend($.summernote.plugins, {
    /**
     * @param {Object} context - context object has status of editor.
     */
    'hello': function(context) {
      var self = this;

      // ui has renders to build ui elements.
      //  - you can create a button with `ui.button`
      var ui = $.summernote.ui;

      // add hello button
      context.memo('button.hello', function() {
        // create button
        var button = ui.button({
          contents: '<i class="fa fa-child"/> Hello',
          tooltip: 'hello',
          click: function() {
            self.$panel.show();
            self.$panel.hide(500);
            // invoke insertText method with 'hello' on editor module.
            context.invoke('editor.insertText', 'hello');
          },
        });

        // create jQuery object from button instance.
        var $hello = button.render();
        return $hello;
      });

      // This events will be attached when editor is initialized.
      this.events = {
        // This will be called after modules are initialized.
        'summernote.init': function(we, e) {
          console.log('summernote initialized', we, e);
        },
        // This will be called when user releases a key on editable.
        'summernote.keyup': function(we, e) {
          console.log('summernote keyup', we, e);
        },
      };

      // This method will be called when editor is initialized by $('..').summernote();
      // You can create elements for plugin
      this.initialize = function() {
        this.$panel = $('<div class="hello-panel"/>').css({
          position: 'absolute',
          width: 100,
          height: 100,
          left: '50%',
          top: '50%',
          background: 'red',
        }).hide();

        this.$panel.appendTo('body');
      };

      // This methods will be called when editor is destroyed by $('..').summernote('destroy');
      // You should remove elements on `initialize`.
      this.destroy = function() {
        this.$panel.remove();
        this.$panel = null;
      };
    },
  });
}));

(function(factory) {
  /* global define */
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['jquery'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // Node/CommonJS
    module.exports = factory(require('jquery'));
  } else {
    // Browser globals
    factory(window.jQuery);
  }
}(function($) {
  $.extend($.summernote.plugins, {
    'specialchars': function(context) {
      var self = this;
      var ui = $.summernote.ui;

      var $editor = context.layoutInfo.editor;
      var options = context.options;
      var lang = options.langInfo;

      var KEY = {
        UP: 38,
        DOWN: 40,
        LEFT: 37,
        RIGHT: 39,
        ENTER: 13,
      };
      var COLUMN_LENGTH = 15;
      var COLUMN_WIDTH = 35;

      var currentColumn = 0;
      var currentRow = 0;
      var totalColumn = 0;
      var totalRow = 0;

      // special characters data set
      var specialCharDataSet = [
        '&quot;', '&amp;', '&lt;', '&gt;', '&iexcl;', '&cent;',
        '&pound;', '&curren;', '&yen;', '&brvbar;', '&sect;',
        '&uml;', '&copy;', '&ordf;', '&laquo;', '&not;',
        '&reg;', '&macr;', '&deg;', '&plusmn;', '&sup2;',
        '&sup3;', '&acute;', '&micro;', '&para;', '&middot;',
        '&cedil;', '&sup1;', '&ordm;', '&raquo;', '&frac14;',
        '&frac12;', '&frac34;', '&iquest;', '&times;', '&divide;',
        '&fnof;', '&circ;', '&tilde;', '&ndash;', '&mdash;',
        '&lsquo;', '&rsquo;', '&sbquo;', '&ldquo;', '&rdquo;',
        '&bdquo;', '&dagger;', '&Dagger;', '&bull;', '&hellip;',
        '&permil;', '&prime;', '&Prime;', '&lsaquo;', '&rsaquo;',
        '&oline;', '&frasl;', '&euro;', '&image;', '&weierp;',
        '&real;', '&trade;', '&alefsym;', '&larr;', '&uarr;',
        '&rarr;', '&darr;', '&harr;', '&crarr;', '&lArr;',
        '&uArr;', '&rArr;', '&dArr;', '&hArr;', '&forall;',
        '&part;', '&exist;', '&empty;', '&nabla;', '&isin;',
        '&notin;', '&ni;', '&prod;', '&sum;', '&minus;',
        '&lowast;', '&radic;', '&prop;', '&infin;', '&ang;',
        '&and;', '&or;', '&cap;', '&cup;', '&int;',
        '&there4;', '&sim;', '&cong;', '&asymp;', '&ne;',
        '&equiv;', '&le;', '&ge;', '&sub;', '&sup;',
        '&nsub;', '&sube;', '&supe;', '&oplus;', '&otimes;',
        '&perp;', '&sdot;', '&lceil;', '&rceil;', '&lfloor;',
        '&rfloor;', '&loz;', '&spades;', '&clubs;', '&hearts;',
        '&diams;',
      ];

      context.memo('button.specialchars', function() {
        return ui.button({
          contents: '<i class="fa fa-font fa-flip-vertical">',
          tooltip: lang.specialChar.specialChar,
          click: function() {
            self.show();
          },
        }).render();
      });

      /**
       * Make Special Characters Table
       *
       * @member plugin.specialChar
       * @private
       * @return {jQuery}
       */
      this.makeSpecialCharSetTable = function() {
        var $table = $('<table/>');
        $.each(specialCharDataSet, function(idx, text) {
          var $td = $('<td/>').addClass('note-specialchar-node');
          var $tr = (idx % COLUMN_LENGTH === 0) ? $('<tr/>') : $table.find('tr').last();

          var $button = ui.button({
            callback: function($node) {
              $node.html(text);
              $node.attr('title', text);
              $node.attr('data-value', encodeURIComponent(text));
              $node.css({
                width: COLUMN_WIDTH,
                'margin-right': '2px',
                'margin-bottom': '2px',
              });
            },
          }).render();

          $td.append($button);

          $tr.append($td);
          if (idx % COLUMN_LENGTH === 0) {
            $table.append($tr);
          }
        });

        totalRow = $table.find('tr').length;
        totalColumn = COLUMN_LENGTH;

        return $table;
      };

      this.initialize = function() {
        var $container = options.dialogsInBody ? $(document.body) : $editor;

        var body = '<div class="form-group row-fluid">' + this.makeSpecialCharSetTable()[0].outerHTML + '</div>';

        this.$dialog = ui.dialog({
          title: lang.specialChar.select,
          body: body,
        }).render().appendTo($container);
      };

      this.show = function() {
        var text = context.invoke('editor.getSelectedText');
        context.invoke('editor.saveRange');
        this.showSpecialCharDialog(text).then(function(selectChar) {
          context.invoke('editor.restoreRange');

          // build node
          var $node = $('<span></span>').html(selectChar)[0];

          if ($node) {
            // insert video node
            context.invoke('editor.insertNode', $node);
          }
        }).fail(function() {
          context.invoke('editor.restoreRange');
        });
      };

      /**
       * show image dialog
       *
       * @param {jQuery} $dialog
       * @return {Promise}
       */
      this.showSpecialCharDialog = function(text) {
        return $.Deferred(function(deferred) {
          var $specialCharDialog = self.$dialog;
          var $specialCharNode = $specialCharDialog.find('.note-specialchar-node');
          var $selectedNode = null;
          var ARROW_KEYS = [KEY.UP, KEY.DOWN, KEY.LEFT, KEY.RIGHT];
          var ENTER_KEY = KEY.ENTER;

          function addActiveClass($target) {
            if (!$target) {
              return;
            }
            $target.find('button').addClass('active');
            $selectedNode = $target;
          }

          function removeActiveClass($target) {
            $target.find('button').removeClass('active');
            $selectedNode = null;
          }

          // find next node
          function findNextNode(row, column) {
            var findNode = null;
            $.each($specialCharNode, function(idx, $node) {
              var findRow = Math.ceil((idx + 1) / COLUMN_LENGTH);
              var findColumn = ((idx + 1) % COLUMN_LENGTH === 0) ? COLUMN_LENGTH : (idx + 1) % COLUMN_LENGTH;
              if (findRow === row && findColumn === column) {
                findNode = $node;
                return false;
              }
            });
            return $(findNode);
          }

          function arrowKeyHandler(keyCode) {
            // left, right, up, down key
            var $nextNode;
            var lastRowColumnLength = $specialCharNode.length % totalColumn;

            if (KEY.LEFT === keyCode) {
              if (currentColumn > 1) {
                currentColumn = currentColumn - 1;
              } else if (currentRow === 1 && currentColumn === 1) {
                currentColumn = lastRowColumnLength;
                currentRow = totalRow;
              } else {
                currentColumn = totalColumn;
                currentRow = currentRow - 1;
              }
            } else if (KEY.RIGHT === keyCode) {
              if (currentRow === totalRow && lastRowColumnLength === currentColumn) {
                currentColumn = 1;
                currentRow = 1;
              } else if (currentColumn < totalColumn) {
                currentColumn = currentColumn + 1;
              } else {
                currentColumn = 1;
                currentRow = currentRow + 1;
              }
            } else if (KEY.UP === keyCode) {
              if (currentRow === 1 && lastRowColumnLength < currentColumn) {
                currentRow = totalRow - 1;
              } else {
                currentRow = currentRow - 1;
              }
            } else if (KEY.DOWN === keyCode) {
              currentRow = currentRow + 1;
            }

            if (currentRow === totalRow && currentColumn > lastRowColumnLength) {
              currentRow = 1;
            } else if (currentRow > totalRow) {
              currentRow = 1;
            } else if (currentRow < 1) {
              currentRow = totalRow;
            }

            $nextNode = findNextNode(currentRow, currentColumn);

            if ($nextNode) {
              removeActiveClass($selectedNode);
              addActiveClass($nextNode);
            }
          }

          function enterKeyHandler() {
            if (!$selectedNode) {
              return;
            }

            deferred.resolve(decodeURIComponent($selectedNode.find('button').attr('data-value')));
            $specialCharDialog.modal('hide');
          }

          function keyDownEventHandler(event) {
            event.preventDefault();
            var keyCode = event.keyCode;
            if (keyCode === undefined || keyCode === null) {
              return;
            }
            // check arrowKeys match
            if (ARROW_KEYS.indexOf(keyCode) > -1) {
              if ($selectedNode === null) {
                addActiveClass($specialCharNode.eq(0));
                currentColumn = 1;
                currentRow = 1;
                return;
              }
              arrowKeyHandler(keyCode);
            } else if (keyCode === ENTER_KEY) {
              enterKeyHandler();
            }
            return false;
          }

          // remove class
          removeActiveClass($specialCharNode);

          // find selected node
          if (text) {
            for (var i = 0; i < $specialCharNode.length; i++) {
              var $checkNode = $($specialCharNode[i]);
              if ($checkNode.text() === text) {
                addActiveClass($checkNode);
                currentRow = Math.ceil((i + 1) / COLUMN_LENGTH);
                currentColumn = (i + 1) % COLUMN_LENGTH;
              }
            }
          }

          ui.onDialogShown(self.$dialog, function() {
            $(document).on('keydown', keyDownEventHandler);

            self.$dialog.find('button').tooltip();

            $specialCharNode.on('click', function(event) {
              event.preventDefault();
              deferred.resolve(decodeURIComponent($(event.currentTarget).find('button').attr('data-value')));
              ui.hideDialog(self.$dialog);
            });
          });

          ui.onDialogHidden(self.$dialog, function() {
            $specialCharNode.off('click');

            self.$dialog.find('button').tooltip('destroy');

            $(document).off('keydown', keyDownEventHandler);

            if (deferred.state() === 'pending') {
              deferred.reject();
            }
          });

          ui.showDialog(self.$dialog);
        });
      };
    },
  });
}));

window.kentico = window.kentico || {};

window.kentico.updatableFormHelper = (function () {

    // Duration for which user must not type anything in order for the form to be submitted.
    var KEY_UP_DEBOUNCE_DURATION = 800;

    /**
     * Registers event listeners and updates the form upon changes of the form data.
     * @param {object} config Configuration object.
     * @param {string} config.formId ID of the form element.
     * @param {string} config.targetAttributeName Data attribute of element that is used to be replaced by HTML received from the server.
     * @param {string} config.unobservedAttributeName Data attribute which marks an input as not being observed for changes.
     */
    function registerEventListeners(config) {
        if (!config || !config.formId || !config.targetAttributeName || !config.unobservedAttributeName) {
            throw new Error("Invalid configuration passed.");
        }

        var writeableTypes = ["email", "number", "password", "search", "tel", "text", "time"];

        var observedForm = document.getElementById(config.formId);
        if (!(observedForm && observedForm.getAttribute(config.targetAttributeName))) {
            return;
        }

        for (i = 0; i < observedForm.length; i++) {
            var observedFormElement = observedForm.elements[i];
            var handleElement = !observedFormElement.hasAttribute(config.unobservedAttributeName) &&
                observedFormElement.type !== "submit";

            if (handleElement) {
                var isWriteableElement = (observedFormElement.tagName === "INPUT" && writeableTypes.indexOf(observedFormElement.type) !== -1) || observedFormElement.tagName === "TEXTAREA";

                if (isWriteableElement) {
                    observedFormElement.previousValue = observedFormElement.value;

                    observedFormElement.addEventListener("keyup", debounce(function (e) {
                        setTimeout(function () {
                            if (!observedForm.updating && e.target.previousValue !== e.target.value) {
                                observedForm.keyupUpdate = true;
                                updateForm(observedForm, e.target);
                            }
                        }, 0);
                    }, KEY_UP_DEBOUNCE_DURATION));

                    observedFormElement.addEventListener("blur", function (e) {
                        setTimeout(function () {
                            if (!observedForm.updating && e.target.previousValue !== e.target.value) {
                                updateForm(observedForm, e.relatedTarget);
                            }
                        }, 0);
                    });
                }

                observedFormElement.addEventListener("change", function (e) {
                    setTimeout(function () {
                        if (!observedForm.updating) {
                            updateForm(observedForm);
                        }
                    }, 0);
                });
            }
        }
    }

    /**
     * Updates the form markup.
     * @param {HTMLElement} form Element of the form to update.
     * @param {Element} nextFocusElement Element which shout get focus after update.
     */
    function updateForm(form, nextFocusElement) {
        if (!form) {
            return;
        }

        // If form is not updatable then do nothing 
        var elementIdSelector = form.getAttribute("data-ktc-ajax-update");
        if (!elementIdSelector) {
            return;
        }

        $(form).find("input[type='submit']").attr("onclick", "return false;");
        form.updating = true;

        var formData = new FormData(form);
        formData.append("kentico_update_form", "true");

        var focus = nextFocusElement || document.activeElement;

        var onResponse = function (event) {
            if (!event.target.response.data) {
                var selectionStart = selectionEnd = null;
                if (focus && (focus.type === "text" || focus.type === "search" || focus.type === "password" || focus.type === "tel" || focus.type === "url")) {
                    selectionStart = focus.selectionStart;
                    selectionEnd = focus.selectionEnd;
                }

                var currentScrollPosition = $(window).scrollTop();
                $(elementIdSelector).replaceWith(event.target.responseText);
                $(window).scrollTop(currentScrollPosition);

                if (focus.id) {
                    var newInput = document.getElementById(focus.id);
                    if (newInput) {
                        newInput.focus();
                        setCaretPosition(newInput, selectionStart, selectionEnd);
                    }
                }
            }
        };

        createRequest(form, formData, onResponse);
    }

    function submitForm(event) {
        event.preventDefault();
        var form = event.target;
        var formData = new FormData(form);

        var onResponse = function(event) {
            var contentType = event.target.getResponseHeader("Content-Type");

            if (contentType.indexOf("application/json") === -1) {
                var currentScrollPosition = $(window).scrollTop();
                var replaceTarget = form.getAttribute("data-ktc-ajax-update");

                $(replaceTarget).replaceWith(event.target.response);
                $(window).scrollTop(currentScrollPosition);
            } else {
                var json = JSON.parse(event.target.response);

                location.href = json.redirectTo;
            }
        };

        createRequest(form, formData, onResponse);
    }

    function createRequest(form, formData, onResponse) {
        var xhr = new XMLHttpRequest();

        xhr.addEventListener("load", onResponse);

        xhr.open("POST", form.action);
        xhr.send(formData);
    }

    /**
     * Sets the caret position.
     * @param {HTMLInputElement} input Input element in which the caret position should be set.
     * @param {number} selectionStart Selection start position.
     * @param {number} selectionEnd Selection end position.
     */
    function setCaretPosition(input, selectionStart, selectionEnd) {
        if (selectionStart === null && selectionEnd === null) {
            return;
        }

        if (input.setSelectionRange) {
            input.setSelectionRange(selectionStart, selectionEnd);
        }
    }

    function debounce(func, wait, immediate) {
        var timeout;

        return function () {
            var context = this,
                args = arguments;

            var later = function () {
                timeout = null;

                if (!immediate) {
                    func.apply(context, args);
                }
            };

            var callNow = immediate && !timeout;
            clearTimeout(timeout);
            timeout = setTimeout(later, wait || 200);

            if (callNow) {
                func.apply(context, args);
            }
        };
    }

    return {
        registerEventListeners: registerEventListeners,
        updateForm: updateForm,
        submitForm: submitForm
    };
}());

