diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c82969..a83dfde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### v2.0.5 +- Added function to change YAML metadata +- YAML holds now date(created) and updated dates +- Updated tagify to v3.22.2 + ### v2.0.4 - Fix pasting markdown and html - Add pasting of images (with autoupload) diff --git a/composer.json b/composer.json index ef8e58f..05be9f0 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "https://github.com/Offerel/roundcube_primitivenotes", "type": "roundcube-plugin", "license": "AGPL-3.0", - "version": "2.0.4", + "version": "2.0.5", "authors": [ { "name": "Offerel", diff --git a/js/notes.js b/js/notes.js index 4dfaa68..815bfca 100644 --- a/js/notes.js +++ b/js/notes.js @@ -1,7 +1,7 @@ /** * Roundcube Notes Plugin * - * @version 2.0.4 + * @version 2.0.5 * @author Offerel * @copyright Copyright (c) 2021, Offerel * @license GNU General Public License, version 3 @@ -81,7 +81,12 @@ $(document).ready(function(){ title: 'Upload and insert local image', }, 'table', '|', - 'preview', 'side-by-side', 'fullscreen', 'guide', '|' ], + 'preview', 'side-by-side', 'fullscreen', 'guide', + { name: 'Meta', + action: togglemData, + className: 'fa fa-info-circle', + title: 'Display Metadata', + }, '|' ], }); document.querySelectorAll('#filelist li a').forEach(function(note){ @@ -94,7 +99,15 @@ $(document).ready(function(){ window.addEventListener('message', (e) => { let estate = document.getElementById('estate'); if('tstate' in e.data) tagify.setReadonly(e.data.tstate); - if('ttags' in e.data && e.data.ttags == '') tagify.removeAllTags(); + if('ttags' in e.data && e.data.ttags == '') tagify.removeAllTags({ + withoutChangeEvent: true + }); + + document.getElementById('author').removeAttribute('disabled'); + document.getElementById('source').removeAttribute('disabled'); + document.getElementById('ndata').style = "top: 21px;"; + if(document.getElementById('ibutton')) document.getElementById('ibutton').style = "display: none"; + if('editor' in e.data && e.data.editor == 'new') { if(estate.value == 's') { mde.togglePreview(); @@ -124,8 +137,6 @@ $(document).ready(function(){ let bSeperator = document.createElement('i'); bSeperator.classList.add("separator"); toolbar.appendChild(bSeperator); - - editor1.parentNode.insertBefore(toolbar, editor1); document.querySelector('.EasyMDEContainer').style = 'display: none'; editor1.style = 'display: block'; } @@ -159,7 +170,13 @@ $(document).ready(function(){ bSeperator.classList.add("separator"); toolbar.appendChild(bSeperator); - editor.parentNode.insertBefore(toolbar, editor); + if(document.getElementById('cdiv')) + document.getElementById('cdiv').appendChild(toolbar); + else { + toolbar.style = 'top: 88px;'; + document.getElementById('main_area').parentNode.insertBefore(toolbar, document.getElementById('main_area')); + } + document.querySelector('.EasyMDEContainer').style = 'display: none'; editor.style = 'display: block'; @@ -195,6 +212,11 @@ $(document).ready(function(){ new rcube_splitter({ id:'notessplitter', p1:'#sidebar', p2:'#main', orientation:'v', relative:true, start:400, min:250, size:12 }).init(); document.querySelector('.EasyMDEContainer').addEventListener('paste', pasteParse, true); + if(document.getElementById('ibutton')) document.getElementById('ibutton').addEventListener('click', function(event){ + console.log("test"); + event.preventDefault(); + document.getElementById('ndata').classList.toggle('mtoggle'); + }); function pasteParse(event) { event.preventDefault(); @@ -297,6 +319,10 @@ $(document).ready(function(){ function firstNote() { showNote(document.getElementById('filelist').firstElementChild.classList[0]); } + + function togglemData() { + document.getElementById('ndata').classList.toggle('mtoggle'); + } function sbfile() { let tags = tagify.value; @@ -329,7 +355,14 @@ $(document).ready(function(){ function showNote(id) { document.querySelector('#main_area .editor-toolbar').style.display = 'none'; if(document.getElementById('atoolbar')) document.getElementById('atoolbar').remove(); + if(document.getElementById('cdiv')) document.getElementById('cdiv').remove(); if(document.getElementById('tbutton')) document.getElementById('tbutton').remove(); + if(document.getElementById('ibutton')) document.getElementById('ibutton').remove(); + document.getElementById('ndata').classList.remove('mtoggle'); + document.getElementById('author').setAttribute('disabled', true); + document.getElementById('date').setAttribute('disabled', true); + document.getElementById('source').setAttribute('disabled', true); + document.getElementById('ndata').style = "top: -22px;"; let loader = document.createElement("div"); loader.classList.add("db-spinner"); @@ -372,11 +405,26 @@ $(document).ready(function(){ document.getElementById('author').value = note.author; document.getElementById('date').value = note.date; document.getElementById('source').value = note.source; + document.getElementById('updated').value = note.updated; - tagify.setReadonly(true); - tagify.removeAllTags(); + tagify.setReadonly(true); + tagify.removeAllTags({ + withoutChangeEvent: true + }); tagify.addTags(note.tags); + if(note.filename.endsWith('.md')) { + let ibutton = document.createElement('button'); + ibutton.id = 'ibutton'; + ibutton.classList.add('fa', 'fa-info-circle'); + ibutton.addEventListener('click', function(event) { + event.preventDefault(); + document.getElementById('ndata').classList.toggle('mtoggle'); + }); + document.getElementById('main_header').appendChild(ibutton); + document.getElementById('ibutton').style = "display: block"; + } + document.querySelector('.EasyMDEContainer').style = 'display: block;'; document.getElementById('editor1').style = 'display none;'; @@ -435,8 +483,12 @@ $(document).ready(function(){ bcontent.id = 'bcontent'; if(note.mime_type.includes('pdf')) bcontent.style = 'width: 100%; height: 100%;'; + let cdiv = document.createElement('div'); + cdiv.id = 'cdiv'; + cdiv.appendChild(bcontent); + document.querySelector('.EasyMDEContainer').classList.add('EasyMDEContainerH'); - document.getElementById('main_area').appendChild(bcontent); + document.getElementById('main_area').appendChild(cdiv); document.getElementById('editor1').style = 'display: none'; if(document.getElementById('atoolbar')) document.getElementById('atoolbar').remove(); } diff --git a/js/notes.min.js b/js/notes.min.js index 49b9fd7..dd904ef 100644 --- a/js/notes.min.js +++ b/js/notes.min.js @@ -1,9 +1,9 @@ /** * Roundcube Notes Plugin * - * @version 2.0.4 + * @version 2.0.5 * @author Offerel * @copyright Copyright (c) 2021, Offerel * @license GNU General Public License, version 3 */ -$(document).ready((function(){var tagify=new Tagify(document.querySelector("#ntags"),{whitelist:[],dropdown:{classname:"color-blue",enabled:0,maxItems:0,position:"text",closeOnSelect:!1,highlightFirst:!0},trim:!0,duplicates:!1,enforceWhitelist:!1,delimiters:",|;| ",placeholder:"Tags"}),editor1=document.getElementById("editor1");let cookiesArr;var media_folder;$.ajax({type:"POST",url:"notes.php",data:{action:"getTags"},success:function(data){tagify.settings.whitelist=JSON.parse(data)}}),document.cookie.split(";").forEach((function(element){let cookie=element.split("=");cookie[0].indexOf("pn_")>0&&(media_folder=JSON.parse(decodeURIComponent(cookie[1])))}));var mde=new EasyMDE({element:editor1,autoDownloadFontAwesome:!1,autofocus:!0,previewImagesInEditor:!1,spellChecker:!1,autofocus:!0,status:!1,promptURLs:!0,inputStyle:"contenteditable",nativeSpellcheck:!0,forceSync:!1,sideBySideFullscreen:!0,renderingConfig:{codeSyntaxHighlighting:!0,sanitizerFunction:function(renderedHTML){let output;return renderedHTML.replaceAll(media_folder,"notes.php?blink=")}},toolbar:[{name:"Save",action:saveFile,className:"fa fa-floppy-o",title:"Save"},"|","undo","redo","|","bold","italic","strikethrough","clean-block","|","heading","heading-smaller","heading-bigger","|","code","quote","unordered-list","ordered-list","|","link",{name:"Image",action:uplInsertImage,className:"fa fa-picture-o",title:"Add image from URL"},{name:"Image",action:uplLocalImage,className:"fa fa-file-image-o",title:"Upload and insert local image"},"table","|","preview","side-by-side","fullscreen","guide","|"]});function pasteParse(event){event.preventDefault(),event.stopPropagation();const pastedString=event.clipboardData.getData("text/html")||event.clipboardData.getData("text/plain");for(var i=0;i=0){let altS=imageT.indexOf('alt="')+5,altE=imageT.indexOf('"',altS);var alt=imageT.substr(altS,altE-altS)}else var alt="";if(imageT.indexOf('title="')>=0){let titleS=imageT.indexOf('title="')+7,titleE=imageT.indexOf('"',titleS);var title=imageT.substr(titleS,titleE-titleS)}else var title="";let loader=document.createElement("div");return loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader),uploadFile(item.getAsFile(),alt,title),!1}}function uploadFile(file,alt,title){var xhr=new XMLHttpRequest;xhr.onload=function(){200==xhr.status?(title&&(title=' "'+title+'"'),mde.codemirror.replaceSelection("!["+alt+"]("+xhr.responseText+title+")"),document.getElementById("db-spinner").remove()):console.log("Error! Upload failed")},xhr.onerror=function(){console.log("Error! Upload failed. Can not connect to server.")};var formData=new FormData;formData.append("localFile",file),xhr.open("POST","notes.php",!0),xhr.send(formData)}let options={headingStyle:"atx",hr:"-",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",collapseMultipleWhitespaces:!0,preformattedCode:!0},turndownService=new window.TurndownService(options);turndownService.addRule("kbd",{filter:["kbd"],replacement:function(content){return""+content+""}});let markdownString=pastedString.startsWith("")?turndownService.turndown(pastedString):pastedString;if(markdownString.startsWith("---")){let mdArr=markdownString.split("\n"),cstart=markdownString.indexOf("---",4)+3;for(let i=1;i<10&&"---"!=mdArr[i];i++){let yentry=mdArr[i].split(":");"title"==yentry[0]&&(document.getElementById("note_name").value=yentry[1].trim()),"tags"==yentry[0]&&tagify.addTags(yentry[1]),"author"==yentry[0]&&(document.getElementById("author").value=yentry[1].trim()),"date"==yentry[0]&&(document.getElementById("date").value=yentry.slice(1).join(":").trim()),"updated"==yentry[0]&&(document.getElementById("updated").value=yentry.slice(1).join(":").trim()),"source"==yentry[0]&&(document.getElementById("source").value=yentry.slice(1).join(":").trim())}markdownString=markdownString.substr(cstart).trim()}mde.codemirror.replaceSelection(markdownString)}function firstNote(){showNote(document.getElementById("filelist").firstElementChild.classList[0])}function sbfile(){let tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"sbfile",name:document.getElementById("note_name").value,fname:document.getElementById("fname").value,tags:tArr,content:document.getElementById("editor1").value},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response)}})}function showNote(id){document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),document.getElementById("tbutton")&&document.getElementById("tbutton").remove();let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader),document.getElementById("save_button").style.display="none";for(var elements=document.getElementsByClassName("selected");elements.length>0;)elements[0].classList.remove("selected");document.getElementById(id).classList.add("selected"),window.parent.document.getElementById("editnote").classList.remove("disabled"),window.parent.document.getElementById("deletenote").classList.remove("disabled"),window.parent.document.getElementById("sendnote").classList.remove("disabled");var fname=document.getElementById("entry"+id).value;$.ajax({type:"POST",url:"notes.php",data:{action:"showNote",filename:fname,id:id},success:function(data){var note=JSON.parse(data);document.getElementById("bcontent")&&document.getElementById("bcontent").remove(),document.querySelector(".EasyMDEContainer").classList.remove("EasyMDEContainerH"),document.getElementById("tocdiv")&&document.getElementById("tocdiv").remove();let headerTitle=document.createElement("span");if(headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),document.querySelector("#main_header #note_name")&&document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),document.getElementById("headerTitle").innerText=note.notename,document.getElementById("fname").value=note.filename,document.getElementById("author").value=note.author,document.getElementById("date").value=note.date,document.getElementById("source").value=note.source,tagify.setReadonly(!0),tagify.removeAllTags(),tagify.addTags(note.tags),document.querySelector(".EasyMDEContainer").style="display: block;",document.getElementById("editor1").style="display none;",document.getElementById("editor1").value=note.content,mde.value(note.content),"text"==note.mime_type.substr(0,4)){"e"==document.getElementById("estate").value&&(document.getElementById("estate").value="s",mde.togglePreview());var headings=document.querySelectorAll("h1, h2, h3, h4, h5, h6");if(headings.length>0){let tbutton=document.createElement("button");tbutton.id="tbutton",tbutton.innerText="ToC",document.getElementById("main_header").appendChild(tbutton);let tocdiv=document.createElement("div");tocdiv.id="tocdiv";let o=0,a=0,list="c%";headings.forEach((function(element){a=element.tagName.substr(1,1),list=o"):o>a?list.replace("c%",'
  • '+element.innerText+"
  • c%"):list.replace("c%",'
  • '+element.innerText+"
  • c%"),o=a})),list=list.replace("c%",""),tocdiv.innerHTML=list,tbutton.addEventListener("click",(function(e){e.preventDefault(),tocdiv.classList.toggle("tdhidden")})),document.querySelector(".EasyMDEContainer").appendChild(tocdiv),document.querySelectorAll("#tocdiv a").forEach((function(elem){elem.addEventListener("click",(function(){tocdiv.classList.toggle("tdhidden")}))}))}}else{let bcontent=document.createElement("object");bcontent.data="data:"+note.mime_type+";base64,"+note.content,bcontent.type=note.mime_type,bcontent.id="bcontent",note.mime_type.includes("pdf")&&(bcontent.style="width: 100%; height: 100%;"),document.querySelector(".EasyMDEContainer").classList.add("EasyMDEContainerH"),document.getElementById("main_area").appendChild(bcontent),document.getElementById("editor1").style="display: none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove()}document.getElementById("db-spinner").parentNode.removeChild(loader)}})}function simage(){for(var allowed_extensions=new Array("jpg","jpeg","png"),file_extension=document.getElementById("localimg").value.split(".").pop().toLowerCase(),i=0;i<=allowed_extensions.length;i++)if(allowed_extensions[i]==file_extension){var file_data=$("#localimg").prop("files")[0],formData=new FormData;return formData.append("localFile",file_data),$.ajax({type:"POST",url:"notes.php",dataType:"text",cache:!1,contentType:!1,processData:!1,data:formData,success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}}),!0}return alert("Unsupported file format"),!1}function saveFile(editor){let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader);let fname=document.getElementById("fname").value,extb=fname.lastIndexOf(".")+1,tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"editNote",note_name:document.getElementById("note_name").value,fname:fname,ntags:tArr,editor1:mde.value(),ftype:fname.substr(extb),author:document.getElementById("author").value,date:document.getElementById("date").value,source:document.getElementById("source").value},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response),loader.remove()}})}function uplLocalImage(){document.getElementById("localimg").click()}function uplInsertImage(){var imageURL=prompt("URL of the image","");if(!imageURL)return!1;$.ajax({type:"POST",url:"notes.php",data:{action:"uplImage",imageURL:imageURL},success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}})}function searchList(){var input,filter,ul,li,a,i;for(filter=(input=document.getElementById("notesearch")).value.toUpperCase(),li=(ul=document.getElementById("filelist")).getElementsByTagName("li"),i=0;i-1?li[i].style.display="":li[i].style.display="none"}document.querySelectorAll("#filelist li a").forEach((function(note){note.addEventListener("click",(function(){showNote(note.parentElement.id),tagify.setReadonly(!0)}))})),window.addEventListener("message",e=>{let estate=document.getElementById("estate");if("tstate"in e.data&&tagify.setReadonly(e.data.tstate),"ttags"in e.data&&""==e.data.ttags&&tagify.removeAllTags(),"editor"in e.data&&"new"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e"),mde.value(""),document.getElementById("fname").value="";let editor1=document.getElementById("editor1");if(editor1.value="","md"==e.data.format)document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector(".EasyMDEContainer").style="display: block",mde.value(""),editor1.style="display: none;",document.getElementById("author").value="",document.getElementById("date").value="",document.getElementById("source").value="";else{let toolbar=document.createElement("div");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),editor1.parentNode.insertBefore(toolbar,editor1),document.querySelector(".EasyMDEContainer").style="display: none",editor1.style="display: block"}}if("editor"in e.data&&"edit"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e");let file=document.getElementById("fname").value.split("."),format=file[file.length-1];switch(document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),format){case"md":document.querySelector(".EasyMDEContainer").style="display: block;",document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector("#editor1").style="display: none;";break;default:let toolbar=document.createElement("div"),editor=document.getElementById("editor1");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),editor.parentNode.insertBefore(toolbar,editor),document.querySelector(".EasyMDEContainer").style="display: none",editor.style="display: block",document.getElementById("bcontent")&&(document.getElementById("editor1").style="display: none")}}}),document.addEventListener("keyup",event=>{if("Escape"==event.key&&"e"==document.getElementById("estate").value){mde.togglePreview(),document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("estate").value="s";let headerTitle=document.createElement("span");headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),headerTitle.innerText=document.getElementById("note_name").value,document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),tagify.setReadonly(!0)}}),document.getElementById("notesearch").addEventListener("keyup",searchList,!1),document.getElementById("save_button").addEventListener("click",(function(){document.getElementById("metah").submit()})),document.getElementById("localimg").addEventListener("change",simage,!1),new rcube_splitter({id:"notessplitter",p1:"#sidebar",p2:"#main",orientation:"v",relative:!0,start:400,min:250,size:12}).init(),document.querySelector(".EasyMDEContainer").addEventListener("paste",pasteParse,!0),firstNote()})); \ No newline at end of file +$(document).ready((function(){var tagify=new Tagify(document.querySelector("#ntags"),{whitelist:[],dropdown:{classname:"color-blue",enabled:0,maxItems:0,position:"text",closeOnSelect:!1,highlightFirst:!0},trim:!0,duplicates:!1,enforceWhitelist:!1,delimiters:",|;| ",placeholder:"Tags"}),editor1=document.getElementById("editor1");let cookiesArr;var media_folder;$.ajax({type:"POST",url:"notes.php",data:{action:"getTags"},success:function(data){tagify.settings.whitelist=JSON.parse(data)}}),document.cookie.split(";").forEach((function(element){let cookie=element.split("=");cookie[0].indexOf("pn_")>0&&(media_folder=JSON.parse(decodeURIComponent(cookie[1])))}));var mde=new EasyMDE({element:editor1,autoDownloadFontAwesome:!1,autofocus:!0,previewImagesInEditor:!1,spellChecker:!1,autofocus:!0,status:!1,promptURLs:!0,inputStyle:"contenteditable",nativeSpellcheck:!0,forceSync:!1,sideBySideFullscreen:!0,renderingConfig:{codeSyntaxHighlighting:!0,sanitizerFunction:function(renderedHTML){let output;return renderedHTML.replaceAll(media_folder,"notes.php?blink=")}},toolbar:[{name:"Save",action:saveFile,className:"fa fa-floppy-o",title:"Save"},"|","undo","redo","|","bold","italic","strikethrough","clean-block","|","heading","heading-smaller","heading-bigger","|","code","quote","unordered-list","ordered-list","|","link",{name:"Image",action:uplInsertImage,className:"fa fa-picture-o",title:"Add image from URL"},{name:"Image",action:uplLocalImage,className:"fa fa-file-image-o",title:"Upload and insert local image"},"table","|","preview","side-by-side","fullscreen","guide",{name:"Meta",action:togglemData,className:"fa fa-info-circle",title:"Display Metadata"},"|"]});function pasteParse(event){event.preventDefault(),event.stopPropagation();const pastedString=event.clipboardData.getData("text/html")||event.clipboardData.getData("text/plain");for(var i=0;i=0){let altS=imageT.indexOf('alt="')+5,altE=imageT.indexOf('"',altS);var alt=imageT.substr(altS,altE-altS)}else var alt="";if(imageT.indexOf('title="')>=0){let titleS=imageT.indexOf('title="')+7,titleE=imageT.indexOf('"',titleS);var title=imageT.substr(titleS,titleE-titleS)}else var title="";let loader=document.createElement("div");return loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader),uploadFile(item.getAsFile(),alt,title),!1}}function uploadFile(file,alt,title){var xhr=new XMLHttpRequest;xhr.onload=function(){200==xhr.status?(title&&(title=' "'+title+'"'),mde.codemirror.replaceSelection("!["+alt+"]("+xhr.responseText+title+")"),document.getElementById("db-spinner").remove()):console.log("Error! Upload failed")},xhr.onerror=function(){console.log("Error! Upload failed. Can not connect to server.")};var formData=new FormData;formData.append("localFile",file),xhr.open("POST","notes.php",!0),xhr.send(formData)}let options={headingStyle:"atx",hr:"-",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",collapseMultipleWhitespaces:!0,preformattedCode:!0},turndownService=new window.TurndownService(options);turndownService.addRule("kbd",{filter:["kbd"],replacement:function(content){return""+content+""}});let markdownString=pastedString.startsWith("")?turndownService.turndown(pastedString):pastedString;if(markdownString.startsWith("---")){let mdArr=markdownString.split("\n"),cstart=markdownString.indexOf("---",4)+3;for(let i=1;i<10&&"---"!=mdArr[i];i++){let yentry=mdArr[i].split(":");"title"==yentry[0]&&(document.getElementById("note_name").value=yentry[1].trim()),"tags"==yentry[0]&&tagify.addTags(yentry[1]),"author"==yentry[0]&&(document.getElementById("author").value=yentry[1].trim()),"date"==yentry[0]&&(document.getElementById("date").value=yentry.slice(1).join(":").trim()),"updated"==yentry[0]&&(document.getElementById("updated").value=yentry.slice(1).join(":").trim()),"source"==yentry[0]&&(document.getElementById("source").value=yentry.slice(1).join(":").trim())}markdownString=markdownString.substr(cstart).trim()}mde.codemirror.replaceSelection(markdownString)}function firstNote(){showNote(document.getElementById("filelist").firstElementChild.classList[0])}function togglemData(){document.getElementById("ndata").classList.toggle("mtoggle")}function sbfile(){let tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"sbfile",name:document.getElementById("note_name").value,fname:document.getElementById("fname").value,tags:tArr,content:document.getElementById("editor1").value},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response)}})}function showNote(id){document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),document.getElementById("cdiv")&&document.getElementById("cdiv").remove(),document.getElementById("tbutton")&&document.getElementById("tbutton").remove(),document.getElementById("ibutton")&&document.getElementById("ibutton").remove(),document.getElementById("ndata").classList.remove("mtoggle"),document.getElementById("author").setAttribute("disabled",!0),document.getElementById("date").setAttribute("disabled",!0),document.getElementById("source").setAttribute("disabled",!0),document.getElementById("ndata").style="top: -22px;";let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader),document.getElementById("save_button").style.display="none";for(var elements=document.getElementsByClassName("selected");elements.length>0;)elements[0].classList.remove("selected");document.getElementById(id).classList.add("selected"),window.parent.document.getElementById("editnote").classList.remove("disabled"),window.parent.document.getElementById("deletenote").classList.remove("disabled"),window.parent.document.getElementById("sendnote").classList.remove("disabled");var fname=document.getElementById("entry"+id).value;$.ajax({type:"POST",url:"notes.php",data:{action:"showNote",filename:fname,id:id},success:function(data){var note=JSON.parse(data);document.getElementById("bcontent")&&document.getElementById("bcontent").remove(),document.querySelector(".EasyMDEContainer").classList.remove("EasyMDEContainerH"),document.getElementById("tocdiv")&&document.getElementById("tocdiv").remove();let headerTitle=document.createElement("span");if(headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),document.querySelector("#main_header #note_name")&&document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),document.getElementById("headerTitle").innerText=note.notename,document.getElementById("fname").value=note.filename,document.getElementById("author").value=note.author,document.getElementById("date").value=note.date,document.getElementById("source").value=note.source,document.getElementById("updated").value=note.updated,tagify.setReadonly(!0),tagify.removeAllTags({withoutChangeEvent:!0}),tagify.addTags(note.tags),note.filename.endsWith(".md")){let ibutton=document.createElement("button");ibutton.id="ibutton",ibutton.classList.add("fa","fa-info-circle"),ibutton.addEventListener("click",(function(event){event.preventDefault(),document.getElementById("ndata").classList.toggle("mtoggle")})),document.getElementById("main_header").appendChild(ibutton),document.getElementById("ibutton").style="display: block"}if(document.querySelector(".EasyMDEContainer").style="display: block;",document.getElementById("editor1").style="display none;",document.getElementById("editor1").value=note.content,mde.value(note.content),"text"==note.mime_type.substr(0,4)){"e"==document.getElementById("estate").value&&(document.getElementById("estate").value="s",mde.togglePreview());var headings=document.querySelectorAll("h1, h2, h3, h4, h5, h6");if(headings.length>0){let tbutton=document.createElement("button");tbutton.id="tbutton",tbutton.innerText="ToC",document.getElementById("main_header").appendChild(tbutton);let tocdiv=document.createElement("div");tocdiv.id="tocdiv";let o=0,a=0,list="c%";headings.forEach((function(element){a=element.tagName.substr(1,1),list=o"):o>a?list.replace("c%",'
  • '+element.innerText+"
  • c%"):list.replace("c%",'
  • '+element.innerText+"
  • c%"),o=a})),list=list.replace("c%",""),tocdiv.innerHTML=list,tbutton.addEventListener("click",(function(e){e.preventDefault(),tocdiv.classList.toggle("tdhidden")})),document.querySelector(".EasyMDEContainer").appendChild(tocdiv),document.querySelectorAll("#tocdiv a").forEach((function(elem){elem.addEventListener("click",(function(){tocdiv.classList.toggle("tdhidden")}))}))}}else{let bcontent=document.createElement("object");bcontent.data="data:"+note.mime_type+";base64,"+note.content,bcontent.type=note.mime_type,bcontent.id="bcontent",note.mime_type.includes("pdf")&&(bcontent.style="width: 100%; height: 100%;");let cdiv=document.createElement("div");cdiv.id="cdiv",cdiv.appendChild(bcontent),document.querySelector(".EasyMDEContainer").classList.add("EasyMDEContainerH"),document.getElementById("main_area").appendChild(cdiv),document.getElementById("editor1").style="display: none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove()}document.getElementById("db-spinner").parentNode.removeChild(loader)}})}function simage(){for(var allowed_extensions=new Array("jpg","jpeg","png"),file_extension=document.getElementById("localimg").value.split(".").pop().toLowerCase(),i=0;i<=allowed_extensions.length;i++)if(allowed_extensions[i]==file_extension){var file_data=$("#localimg").prop("files")[0],formData=new FormData;return formData.append("localFile",file_data),$.ajax({type:"POST",url:"notes.php",dataType:"text",cache:!1,contentType:!1,processData:!1,data:formData,success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}}),!0}return alert("Unsupported file format"),!1}function saveFile(editor){let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader);let fname=document.getElementById("fname").value,extb=fname.lastIndexOf(".")+1,tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"editNote",note_name:document.getElementById("note_name").value,fname:fname,ntags:tArr,editor1:mde.value(),ftype:fname.substr(extb),author:document.getElementById("author").value,date:document.getElementById("date").value,source:document.getElementById("source").value},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response),loader.remove()}})}function uplLocalImage(){document.getElementById("localimg").click()}function uplInsertImage(){var imageURL=prompt("URL of the image","");if(!imageURL)return!1;$.ajax({type:"POST",url:"notes.php",data:{action:"uplImage",imageURL:imageURL},success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}})}function searchList(){var input,filter,ul,li,a,i;for(filter=(input=document.getElementById("notesearch")).value.toUpperCase(),li=(ul=document.getElementById("filelist")).getElementsByTagName("li"),i=0;i-1?li[i].style.display="":li[i].style.display="none"}document.querySelectorAll("#filelist li a").forEach((function(note){note.addEventListener("click",(function(){showNote(note.parentElement.id),tagify.setReadonly(!0)}))})),window.addEventListener("message",e=>{let estate=document.getElementById("estate");if("tstate"in e.data&&tagify.setReadonly(e.data.tstate),"ttags"in e.data&&""==e.data.ttags&&tagify.removeAllTags({withoutChangeEvent:!0}),document.getElementById("author").removeAttribute("disabled"),document.getElementById("source").removeAttribute("disabled"),document.getElementById("ndata").style="top: 21px;",document.getElementById("ibutton")&&(document.getElementById("ibutton").style="display: none"),"editor"in e.data&&"new"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e"),mde.value(""),document.getElementById("fname").value="";let editor1=document.getElementById("editor1");if(editor1.value="","md"==e.data.format)document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector(".EasyMDEContainer").style="display: block",mde.value(""),editor1.style="display: none;",document.getElementById("author").value="",document.getElementById("date").value="",document.getElementById("source").value="";else{let toolbar=document.createElement("div");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),document.querySelector(".EasyMDEContainer").style="display: none",editor1.style="display: block"}}if("editor"in e.data&&"edit"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e");let file=document.getElementById("fname").value.split("."),format=file[file.length-1];switch(document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),format){case"md":document.querySelector(".EasyMDEContainer").style="display: block;",document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector("#editor1").style="display: none;";break;default:let toolbar=document.createElement("div"),editor=document.getElementById("editor1");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),document.getElementById("cdiv")?document.getElementById("cdiv").appendChild(toolbar):(toolbar.style="top: 88px;",document.getElementById("main_area").parentNode.insertBefore(toolbar,document.getElementById("main_area"))),document.querySelector(".EasyMDEContainer").style="display: none",editor.style="display: block",document.getElementById("bcontent")&&(document.getElementById("editor1").style="display: none")}}}),document.addEventListener("keyup",event=>{if("Escape"==event.key&&"e"==document.getElementById("estate").value){mde.togglePreview(),document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("estate").value="s";let headerTitle=document.createElement("span");headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),headerTitle.innerText=document.getElementById("note_name").value,document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),tagify.setReadonly(!0)}}),document.getElementById("notesearch").addEventListener("keyup",searchList,!1),document.getElementById("save_button").addEventListener("click",(function(){document.getElementById("metah").submit()})),document.getElementById("localimg").addEventListener("change",simage,!1),new rcube_splitter({id:"notessplitter",p1:"#sidebar",p2:"#main",orientation:"v",relative:!0,start:400,min:250,size:12}).init(),document.querySelector(".EasyMDEContainer").addEventListener("paste",pasteParse,!0),document.getElementById("ibutton")&&document.getElementById("ibutton").addEventListener("click",(function(event){console.log("test"),event.preventDefault(),document.getElementById("ndata").classList.toggle("mtoggle")})),firstNote()})); \ No newline at end of file diff --git a/js/primitivenotes.js b/js/primitivenotes.js index a01b252..5839691 100644 --- a/js/primitivenotes.js +++ b/js/primitivenotes.js @@ -1,7 +1,7 @@ /** * Roundcube Notes Plugin * - * @version 2.0.4 + * @version 2.0.5 * @author Offerel * @copyright Copyright (c) 2021, Offerel * @license GNU General Public License, version 3 @@ -72,6 +72,7 @@ function edit_note() { }; document.getElementById('notescontentframe').contentWindow.postMessage(tstate, location.href); $("#notescontentframe").contents().find("tags").addClass('edit'); + document.getElementById('editnote').classList.add('disabled'); } function delete_note() { diff --git a/js/primitivenotes.min.js b/js/primitivenotes.min.js index fff32fc..0ab1e16 100644 --- a/js/primitivenotes.min.js +++ b/js/primitivenotes.min.js @@ -1,9 +1,9 @@ /** * Roundcube Notes Plugin * - * @version 2.0.4 + * @version 2.0.5 * @author Offerel * @copyright Copyright (c) 2021, Offerel * @license GNU General Public License, version 3 */ -function pnoptions(){location.href=window.location.origin+window.location.pathname+"?_task=settings&_action=preferences#pnotes"}function add_note(){document.getElementById("upl").click()}function new_note(a){format=a||rcmail.env.dformat;let nname=document.createElement("input");nname.id="note_name",nname.name=nname.id,nname.type="text",nname.style="font-size: 2em",nname.required=!0,nname.value="",$("#notescontentframe").contents().find("#headerTitle").replaceWith(nname),$("#notescontentframe").contents().find("#note_name").replaceWith(nname),$("#notescontentframe").contents().find("tags").addClass("edit"),$("#notescontentframe").contents().find("#tbutton").remove();let tstate={tstate:!1,ttags:"",editor:"new",format:format};document.getElementById("notescontentframe").contentWindow.postMessage(tstate,location.href),$("#notescontentframe").contents().find("#note_name")[0].placeholder=rcmail.gettext("note_title","primitivenotes"),document.getElementById("editnote").classList.add("disabled"),document.getElementById("deletenote").classList.add("disabled"),document.getElementById("sendnote").classList.add("disabled")}function edit_note(){let nTitel=$("#notescontentframe").contents().find("#headerTitle");$("#notescontentframe").contents().find("#tbutton").remove();let nname=document.createElement("input");nname.id="note_name",nname.name=nname.id,nname.type="text",nname.style="font-size: 2em",nname.required=!0,nname.value=nTitel[0].innerText,nTitel.replaceWith(nname);let tstate={tstate:!1,editor:"edit"};document.getElementById("notescontentframe").contentWindow.postMessage(tstate,location.href),$("#notescontentframe").contents().find("tags").addClass("edit")}function delete_note(){var a=window.frames.notescontentframe.document.getElementById("fname").value,b=window.frames.notescontentframe.document.getElementById("headerTitle").innerText,c=rcmail.gettext("note_del_note","primitivenotes").replace("%note%",b);if(a&&b){if(!confirm(c))return!1;$.ajax({url:"plugins/primitivenotes/notes.php",type:"post",data:{action:"delNote",mode:"delete",fileid:a},success:function(a){if(""!=a){var result=JSON.parse(a);""!=result.data&&confirm(result.message)&&$.ajax({url:"plugins/primitivenotes/notes.php",type:"post",data:{action:"delMedia",files:JSON.stringify(result.data)}})}document.getElementById("notescontentframe").src="plugins/primitivenotes/notes.php"}})}}function send_note(){var a=window.frames.notescontentframe.document.getElementById("fname").value,b=a.substring(a.lastIndexOf(".")+1);-1<"html pdf jpg png md txt".split(" ").indexOf(b)?rcmail.goto_url("mail/compose",{_note_type:b,_note_filename:a},!0):alert(rcmail.gettext("note_inv_format","primitivenotes"))}function sform(){fileName=this.value;for(var allowed_extensions=new Array("html","pdf","jpg","png","md","txt"),file_extension=fileName.split(".").pop().toLowerCase(),i=0;i<=allowed_extensions.length;i++)if(allowed_extensions[i]==file_extension)return document.getElementById("upl_form").submit(),!0;return alert(''),!1}window.rcmail&&rcmail.addEventListener("init",(function(a){rcmail.register_command("newnote",new_note,!0),rcmail.register_command("editnote",edit_note,!0),rcmail.register_command("deletenote",delete_note,!0),rcmail.register_command("sendnote",send_note,!0),rcmail.register_command("addnote",add_note,!0),rcmail.register_command("mdnote",new_note,!0),rcmail.register_command("txtnote",new_note,!0),rcmail.register_command("pnoptions",pnoptions,!0),document.getElementById("upl")&&document.getElementById("upl").addEventListener("change",sform,!1),"#pnotes"==window.location.hash&&rcmail.sections_list.select_row("primitivenotes")})); \ No newline at end of file +function pnoptions(){location.href=window.location.origin+window.location.pathname+"?_task=settings&_action=preferences#pnotes"}function add_note(){document.getElementById("upl").click()}function new_note(a){format=a||rcmail.env.dformat;let nname=document.createElement("input");nname.id="note_name",nname.name=nname.id,nname.type="text",nname.style="font-size: 2em",nname.required=!0,nname.value="",$("#notescontentframe").contents().find("#headerTitle").replaceWith(nname),$("#notescontentframe").contents().find("#note_name").replaceWith(nname),$("#notescontentframe").contents().find("tags").addClass("edit"),$("#notescontentframe").contents().find("#tbutton").remove();let tstate={tstate:!1,ttags:"",editor:"new",format:format};document.getElementById("notescontentframe").contentWindow.postMessage(tstate,location.href),$("#notescontentframe").contents().find("#note_name")[0].placeholder=rcmail.gettext("note_title","primitivenotes"),document.getElementById("editnote").classList.add("disabled"),document.getElementById("deletenote").classList.add("disabled"),document.getElementById("sendnote").classList.add("disabled")}function edit_note(){let nTitel=$("#notescontentframe").contents().find("#headerTitle");$("#notescontentframe").contents().find("#tbutton").remove();let nname=document.createElement("input");nname.id="note_name",nname.name=nname.id,nname.type="text",nname.style="font-size: 2em",nname.required=!0,nname.value=nTitel[0].innerText,nTitel.replaceWith(nname);let tstate={tstate:!1,editor:"edit"};document.getElementById("notescontentframe").contentWindow.postMessage(tstate,location.href),$("#notescontentframe").contents().find("tags").addClass("edit"),document.getElementById("editnote").classList.add("disabled")}function delete_note(){var a=window.frames.notescontentframe.document.getElementById("fname").value,b=window.frames.notescontentframe.document.getElementById("headerTitle").innerText,c=rcmail.gettext("note_del_note","primitivenotes").replace("%note%",b);if(a&&b){if(!confirm(c))return!1;$.ajax({url:"plugins/primitivenotes/notes.php",type:"post",data:{action:"delNote",mode:"delete",fileid:a},success:function(a){if(""!=a){var result=JSON.parse(a);""!=result.data&&confirm(result.message)&&$.ajax({url:"plugins/primitivenotes/notes.php",type:"post",data:{action:"delMedia",files:JSON.stringify(result.data)}})}document.getElementById("notescontentframe").src="plugins/primitivenotes/notes.php"}})}}function send_note(){var a=window.frames.notescontentframe.document.getElementById("fname").value,b=a.substring(a.lastIndexOf(".")+1);-1<"html pdf jpg png md txt".split(" ").indexOf(b)?rcmail.goto_url("mail/compose",{_note_type:b,_note_filename:a},!0):alert(rcmail.gettext("note_inv_format","primitivenotes"))}function sform(){fileName=this.value;for(var allowed_extensions=new Array("html","pdf","jpg","png","md","txt"),file_extension=fileName.split(".").pop().toLowerCase(),i=0;i<=allowed_extensions.length;i++)if(allowed_extensions[i]==file_extension)return document.getElementById("upl_form").submit(),!0;return alert(''),!1}window.rcmail&&rcmail.addEventListener("init",(function(a){rcmail.register_command("newnote",new_note,!0),rcmail.register_command("editnote",edit_note,!0),rcmail.register_command("deletenote",delete_note,!0),rcmail.register_command("sendnote",send_note,!0),rcmail.register_command("addnote",add_note,!0),rcmail.register_command("mdnote",new_note,!0),rcmail.register_command("txtnote",new_note,!0),rcmail.register_command("pnoptions",pnoptions,!0),document.getElementById("upl")&&document.getElementById("upl").addEventListener("change",sform,!1),"#pnotes"==window.location.hash&&rcmail.sections_list.select_row("primitivenotes")})); \ No newline at end of file diff --git a/js/tagify/angular-tagify.component.ts b/js/tagify/angular-tagify.component.ts deleted file mode 100644 index f6c3b92..0000000 --- a/js/tagify/angular-tagify.component.ts +++ /dev/null @@ -1,105 +0,0 @@ -import {AfterViewInit, Component, EventEmitter, Input, Output, ViewChild} from '@angular/core'; -import * as Tagify from '@yaireo/tagify'; - -export interface SettingsModel { - placeholder?: string; - delimiters?: string; - pattern?: string | RegExp; - mode?: string; - mixTagsInterpolator?: string[]; - mixTagsAllowedAfter?: RegExp; - duplicates?: boolean; - enforceWhitelist?: boolean; - autoComplete?: { - enabled?: boolean; - rightKey?: boolean; - }; - whitelist?: string[] | Object[]; - blacklist?: string[] | Object[]; - addTagOnBlur?: boolean; - callbacks?: Object; - maxTags?: number; - editTags?: number; - templates?: { - wrapper?: Function; - tag?: Function; - dropdownItem?: Function; - dropdownItemNoMatch?: Function; - }; - transformTag?: Function; - keepInvalidTags?: boolean; - skipInvalid?: boolean; - backspace?: any; - originalInputValueFormat?: Function; - dropdown?: { - enabled?: number | false; - caseSensitive?: boolean; - maxItems?: number; - classname?: string; - fuzzySearch?: boolean; - accentedSearch?: boolean; - position?: string; - highlightFirst?: boolean; - closeOnSelect?: boolean; - mapValueTo?: string | Function; - searchKeys?: string[]; - appendTarget?: any; - }; -} - -@Component({ - selector: 'tagify', - template: `` -}) -export class TagifyComponent implements AfterViewInit { - @Output() add = new EventEmitter(); // returns the added tag + updated tags list - @Output() remove = new EventEmitter(); // returns the updated tags list - @Input() settings: SettingsModel; // get possible tagify settings - @Input() value: string | Array - - @ViewChild('tagifyInputRef') tagifyInputRef: any; - - private tagify; - - ngAfterViewInit() { - if (!this.settings) { - return; - } - this.settings.callbacks = { - add: () => this.add.emit({ - tags: this.tagify.value, - added: this.tagify.value[this.tagify.value.length - 1] - }), - remove: () => this.remove.emit(this.tagify.value) - }; - this.tagify = new Tagify(this.tagifyInputRef.nativeElement, this.settings); - } - - ngOnChanges({ value }) { - if(!this.tagify) return - if (!value.previousValue) { - this.tagify.loadOriginalValues(value.currentValue) - } - } - - /** - * @description removes all tags - */ - removeAll() { - this.tagify.removeAllTags(); - } - - /** - * @description add multiple tags - */ - addTags(tags) { - this.tagify.addTags(tags); - } - - /** - * @description destroy dom and everything - */ - destroy() { - this.tagify.destroy(); - } -} diff --git a/js/tagify/jQuery.tagify.min.js b/js/tagify/jQuery.tagify.min.js deleted file mode 100644 index ac64ea7..0000000 --- a/js/tagify/jQuery.tagify.min.js +++ /dev/null @@ -1,18 +0,0 @@ -;(function($){ - // just a jQuery wrapper for the vanilla version of this component - $.fn.tagify = function(settings = {}){ - return this.each(function() { - var $input = $(this), - tagify; - - if( $input.data("tagify") ) // don't continue if already "tagified" - return this; - - settings.isJQueryPlugin = true; - tagify = new Tagify($input[0], settings); - $input.data("tagify", tagify); - }); - } - -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Tagify=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function i(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e/g,">").replace(/"/g,""").replace(/`|'/g,"'")}function r(t){return t instanceof Array}function l(t){var e=Object.prototype.toString.call(t).split(" ")[1].slice(0,-1);return t===Object(t)&&"Array"!=e&&"Function"!=e&&"RegExp"!=e&&"HTMLUnknownElement"!=e}function d(t,e,i){function s(t,e){for(var i in e)if(e.hasOwnProperty(i)){if(l(e[i])){l(t[i])?s(t[i],e[i]):t[i]=Object.assign({},e[i]);continue}if(r(e[i])){t[i]=Object.assign([],e[i]);continue}t[i]=e[i]}}return t instanceof Object||(t={}),s(t,e),i&&s(t,i),t}function c(t){return String.prototype.normalize?"string"==typeof t?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):void 0:t}var h=/(?=.*chrome)(?=.*android)/i.test(navigator.userAgent),g={init:function(){this.DOM.dropdown=this.parseTemplate("dropdown",[this.settings]),this.DOM.dropdown.content=this.DOM.dropdown.querySelector("."+this.settings.classNames.dropdownWrapper)},show:function(t){var e,i,a,n=this,o=this.settings,r=window.getSelection(),d="mix"==o.mode&&!o.enforceWhitelist,c=!o.whitelist||!o.whitelist.length,h="manual"==o.dropdown.position;if(t=void 0===t?this.state.inputText:t,(!c||d||o.templates.dropdownItemNoMatch)&&!1!==o.dropdown.enable&&!this.state.isLoading){if(clearTimeout(this.dropdownHide__bindEventsTimeout),this.suggestedListItems=this.dropdown.filterListItems.call(this,t),t&&!this.suggestedListItems.length&&(this.trigger("dropdown:noMatch",t),o.templates.dropdownItemNoMatch&&(a=o.templates.dropdownItemNoMatch.call(this,{value:t}))),!a){if(this.suggestedListItems.length)t&&d&&!this.state.editing.scope&&!s(this.suggestedListItems[0].value,t)&&this.suggestedListItems.unshift({value:t});else{if(!t||!d||this.state.editing.scope)return this.input.autocomplete.suggest.call(this),void this.dropdown.hide.call(this);this.suggestedListItems=[{value:t}]}i=""+(l(e=this.suggestedListItems[0])?e.value:e),o.autoComplete&&i&&0==i.indexOf(t)&&this.input.autocomplete.suggest.call(this,e)}this.dropdown.fill.call(this,a),o.dropdown.highlightFirst&&this.dropdown.highlightOption.call(this,this.DOM.dropdown.content.children[0]),this.state.dropdown.visible||setTimeout(this.dropdown.events.binding.bind(this)),this.state.dropdown.visible=t||!0,this.state.dropdown.query=t,this.state.selection={anchorOffset:r.anchorOffset,anchorNode:r.anchorNode},h||setTimeout((function(){n.dropdown.position.call(n),n.dropdown.render.call(n)})),setTimeout((function(){n.trigger("dropdown:show",n.DOM.dropdown)}))}},hide:function(t){var e=this,i=this.DOM,s=i.scope,a=i.dropdown,n="manual"==this.settings.dropdown.position&&!t;if(a&&document.body.contains(a)&&!n)return window.removeEventListener("resize",this.dropdown.position),this.dropdown.events.binding.call(this,!1),s.setAttribute("aria-expanded",!1),a.parentNode.removeChild(a),setTimeout((function(){e.state.dropdown.visible=!1}),100),this.state.dropdown.query=this.state.ddItemData=this.state.ddItemElm=this.state.selection=null,this.state.tag&&this.state.tag.value.length&&(this.state.flaggedTags[this.state.tag.baseOffset]=this.state.tag),this.trigger("dropdown:hide",a),this},render:function(){var t,e,i,s=this,a=(t=this.DOM.dropdown,(i=t.cloneNode(!0)).style.cssText="position:fixed; top:-9999px; opacity:0",document.body.appendChild(i),e=i.clientHeight,i.parentNode.removeChild(i),e),n=this.settings;return this.DOM.scope.setAttribute("aria-expanded",!0),document.body.contains(this.DOM.dropdown)||(this.DOM.dropdown.classList.add(n.classNames.dropdownInital),this.dropdown.position.call(this,a),n.dropdown.appendTarget.appendChild(this.DOM.dropdown),setTimeout((function(){return s.DOM.dropdown.classList.remove(n.classNames.dropdownInital)}))),this},fill:function(t){var e;t="string"==typeof t?t:this.dropdown.createListHTML.call(this,t||this.suggestedListItems),this.DOM.dropdown.content.innerHTML=(e=t)?e.replace(/\>[\r\n ]+\<").replace(/(<.*?>)|\s+/g,(function(t,e){return e||" "})):""},refilter:function(t){t=t||this.state.dropdown.query||"",this.suggestedListItems=this.dropdown.filterListItems.call(this,t),this.suggestedListItems.length?this.dropdown.fill.call(this):this.dropdown.hide.call(this),this.trigger("dropdown:updated",this.DOM.dropdown)},position:function(t){if("manual"!=this.settings.dropdown.position){var e,i,s,a,n,o,r,l=this.DOM.dropdown,d=document.documentElement.clientHeight,c=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)>480?this.settings.dropdown.position:"all",h=this.DOM["input"==c?"input":"scope"];t=t||l.clientHeight,this.state.dropdown.visible&&("text"==c?(a=(i=this.getCaretGlobalPosition()).bottom,s=i.top,n=i.left,o="auto"):(r=function(t){for(var e=0,i=0;t;)e+=t.offsetLeft||0,i+=t.offsetTop||0,t=t.parentNode;return{left:e,top:i}}(this.settings.dropdown.appendTarget),s=(i=h.getBoundingClientRect()).top+2-r.top,a=i.bottom-1-r.top,n=i.left-r.left,o=i.width+"px"),s=Math.floor(s),a=Math.ceil(a),e=d-i.bottom0&&void 0!==arguments[0])||arguments[0],e=this.dropdown.events.callbacks,i=this.listeners.dropdown=this.listeners.dropdown||{position:this.dropdown.position.bind(this),onKeyDown:e.onKeyDown.bind(this),onMouseOver:e.onMouseOver.bind(this),onMouseLeave:e.onMouseLeave.bind(this),onClick:e.onClick.bind(this),onScroll:e.onScroll.bind(this)},s=t?"addEventListener":"removeEventListener";"manual"!=this.settings.dropdown.position&&(window[s]("resize",i.position),window[s]("keydown",i.onKeyDown)),this.DOM.dropdown[s]("mouseover",i.onMouseOver),this.DOM.dropdown[s]("mouseleave",i.onMouseLeave),this.DOM.dropdown[s]("mousedown",i.onClick),this.DOM.dropdown.content[s]("scroll",i.onScroll)},callbacks:{onKeyDown:function(t){var e=this.DOM.dropdown.querySelector("."+this.settings.classNames.dropdownItemActive),i=e;switch(t.key){case"ArrowDown":case"ArrowUp":case"Down":case"Up":var s;t.preventDefault(),i&&(i=i[("ArrowUp"==t.key||"Up"==t.key?"previous":"next")+"ElementSibling"]),i||(i=(s=this.DOM.dropdown.content.children)["ArrowUp"==t.key||"Up"==t.key?s.length-1:0]),this.dropdown.highlightOption.call(this,i,!0);break;case"Escape":case"Esc":this.dropdown.hide.call(this);break;case"ArrowRight":if(this.state.actions.ArrowLeft)return;case"Tab":if("mix"!=this.settings.mode&&i&&!this.settings.autoComplete.rightKey&&!this.state.editing){t.preventDefault();var a=i.getAttribute("tagifySuggestionIdx"),n=a?this.suggestedListItems[+a]:"";return this.input.autocomplete.set.call(this,n.value||n),!1}return!0;case"Enter":t.preventDefault(),this.dropdown.selectOption.call(this,e);break;case"Backspace":if("mix"==this.settings.mode||this.state.editing.scope)return;var o=this.state.inputText.trim();""!=o&&8203!=o.charCodeAt(0)||(!0===this.settings.backspace?this.removeTags():"edit"==this.settings.backspace&&setTimeout(this.editTag.bind(this),0))}},onMouseOver:function(t){var e=t.target.closest("."+this.settings.classNames.dropdownItem);e&&this.dropdown.highlightOption.call(this,e)},onMouseLeave:function(t){this.dropdown.highlightOption.call(this)},onClick:function(t){var e=this;if(0==t.button&&t.target!=this.DOM.dropdown){var i=t.target.closest("."+this.settings.classNames.dropdownItem);this.state.actions.selectOption=!0,setTimeout((function(){return e.state.actions.selectOption=!1}),50),this.settings.hooks.suggestionClick(t,{tagify:this,suggestionElm:i}).then((function(){i?e.dropdown.selectOption.call(e,i):e.dropdown.hide.call(e)})).catch((function(t){return t}))}},onScroll:function(t){var e=t.target,i=e.scrollTop/(e.scrollHeight-e.parentNode.clientHeight)*100;this.trigger("dropdown:scroll",{percentage:Math.round(i)})}}},highlightOption:function(t,e){var i,s=this.settings.classNames.dropdownItemActive;if(this.state.ddItemElm&&(this.state.ddItemElm.classList.remove(s),this.state.ddItemElm.removeAttribute("aria-selected")),!t)return this.state.ddItemData=null,this.state.ddItemElm=null,void this.input.autocomplete.suggest.call(this);i=this.suggestedListItems[this.getNodeIndex(t)],this.state.ddItemData=i,this.state.ddItemElm=t,t.classList.add(s),t.setAttribute("aria-selected",!0),e&&(t.parentNode.scrollTop=t.clientHeight+t.offsetTop-t.parentNode.clientHeight),this.settings.autoComplete&&(this.input.autocomplete.suggest.call(this,i),this.dropdown.position.call(this))},selectOption:function(t){var e=this,i=this.settings.dropdown,s=i.clearOnSelect,a=i.closeOnSelect;if(!t)return this.addTags(this.state.inputText,!0),void(a&&this.dropdown.hide.call(this));var n=t.getAttribute("tagifySuggestionIdx"),o=this.suggestedListItems[+n];if(this.trigger("dropdown:select",{data:o,elm:t}),n&&o){if(this.state.editing?this.onEditTagDone(null,d({__isValid:!0},o)):this["mix"==this.settings.mode?"addMixTags":"addTags"]([o],s),setTimeout((function(){e.DOM.input.focus(),e.toggleFocusClass(!0)})),a)return this.dropdown.hide.call(this);this.dropdown.refilter.call(this)}else this.dropdown.hide.call(this)},selectAll:function(){return this.suggestedListItems.length=0,this.dropdown.hide.call(this),this.addTags(this.dropdown.filterListItems.call(this,""),!0),this},filterListItems:function(t,e){var i,s,a,n,o,r=this,d=this.settings,h=d.dropdown,g=(e=e||{},[]),u=d.whitelist,p=h.maxItems||1/0,f=h.searchKeys,m=0;if(!t||!f.length)return(d.duplicates?u:u.filter((function(t){return!r.isTagDuplicate(l(t)?t.value:t)}))).slice(0,p);function v(t,e){return e.toLowerCase().split(" ").every((function(e){return t.includes(e.toLowerCase())}))}for(o=h.caseSensitive?""+t:(""+t).toLowerCase();m",' tagifySuggestionIdx="'.concat(i,'">'))})).join("")}},u={delimiters:",",pattern:null,tagTextProp:"value",maxTags:1/0,callbacks:{},addTagOnBlur:!0,duplicates:!1,whitelist:[],blacklist:[],enforceWhitelist:!1,keepInvalidTags:!1,mixTagsAllowedAfter:/,|\.|\:|\s/,mixTagsInterpolator:["[[","]]"],backspace:!0,skipInvalid:!1,editTags:{clicks:2,keepInvalid:!0},transformTag:function(){},trim:!0,mixMode:{insertAfterTag:" "},autoComplete:{enabled:!0,rightKey:!1},classNames:{namespace:"tagify",mixMode:"tagify--mix",selectMode:"tagify--select",input:"tagify__input",focus:"tagify--focus",tag:"tagify__tag",tagNoAnimation:"tagify--noAnim",tagInvalid:"tagify--invalid",tagNotAllowed:"tagify--notAllowed",inputInvalid:"tagify__input--invalid",tagX:"tagify__tag__removeBtn",tagText:"tagify__tag-text",dropdown:"tagify__dropdown",dropdownWrapper:"tagify__dropdown__wrapper",dropdownItem:"tagify__dropdown__item",dropdownItemActive:"tagify__dropdown__item--active",dropdownInital:"tagify__dropdown--initial",scopeLoading:"tagify--loading",tagLoading:"tagify__tag--loading",tagEditing:"tagify__tag--editable",tagFlash:"tagify__tag--flash",tagHide:"tagify__tag--hide",hasMaxTags:"tagify--hasMaxTags",hasNoTags:"tagify--noTags",empty:"tagify--empty"},dropdown:{classname:"",enabled:2,maxItems:10,searchKeys:["value","searchBy"],fuzzySearch:!0,caseSensitive:!1,accentedSearch:!0,highlightFirst:!1,closeOnSelect:!0,clearOnSelect:!0,position:"all",appendTarget:null},hooks:{beforeRemoveTag:function(){return Promise.resolve()},suggestionClick:function(){return Promise.resolve()}}};var p={customBinding:function(){var t=this;this.customEventsList.forEach((function(e){t.on(e,t.settings.callbacks[e])}))},binding:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=this.events.callbacks,s=e?"addEventListener":"removeEventListener";if(!this.state.mainEvents||!e)for(var a in this.state.mainEvents=e,e&&!this.listeners.main&&(this.DOM.input.addEventListener(this.isIE?"keydown":"input",i[this.isIE?"onInputIE":"onInput"].bind(this)),this.settings.isJQueryPlugin&&jQuery(this.DOM.originalInput).on("tagify.removeAllTags",this.removeAllTags.bind(this))),t=this.listeners.main=this.listeners.main||{focus:["input",i.onFocusBlur.bind(this)],blur:["input",i.onFocusBlur.bind(this)],keydown:["input",i.onKeydown.bind(this)],click:["scope",i.onClickScope.bind(this)],dblclick:["scope",i.onDoubleClickScope.bind(this)],paste:["input",i.onPaste.bind(this)]})("blur"!=a||e)&&this.DOM[t[a][0]][s](a,t[a][1])},callbacks:{onFocusBlur:function(t){var e=t.target?this.trim(t.target.textContent):"",i=this.settings,s=t.type,a=i.dropdown.enabled>=0,n={relatedTarget:t.relatedTarget},o=this.state.actions.selectOption&&(a||!i.dropdown.closeOnSelect),r=this.state.actions.addNew&&a;if("blur"==s){if(t.relatedTarget===this.DOM.scope)return this.dropdown.hide.call(this),void this.DOM.input.focus();this.postUpdate(),this.triggerChangeEvent()}if(!o&&!r)if(this.state.hasFocus="focus"==s&&+new Date,this.toggleFocusClass(this.state.hasFocus),"mix"!=i.mode){if("focus"==s)return this.trigger("focus",n),void(0===i.dropdown.enabled&&this.dropdown.show.call(this));"blur"==s&&(this.trigger("blur",n),this.loading(!1),("select"==this.settings.mode?!this.value.length||this.value[0].value!=e:e&&!this.state.actions.selectOption&&i.addTagOnBlur)&&this.addTags(e,!0)),this.DOM.input.removeAttribute("style"),this.dropdown.hide.call(this)}else"focus"==s?this.trigger("focus",n):"blur"==t.type&&(this.trigger("blur",n),this.loading(!1),this.dropdown.hide.call(this),this.state.dropdown.visible=void 0,this.setStateSelection())},onKeydown:function(t){var e=this,i=this.trim(t.target.textContent);if(this.trigger("keydown",{originalEvent:this.cloneEvent(t)}),"mix"==this.settings.mode){switch(t.key){case"Left":case"ArrowLeft":this.state.actions.ArrowLeft=!0;break;case"Delete":case"Backspace":if(this.state.editing)return;var s,o,r=document.getSelection(),l="Delete"==t.key&&r.anchorOffset==(r.anchorNode.length||0),d=1==r.anchorNode.nodeType||!r.anchorOffset&&r.anchorNode.previousElementSibling,c=a(this.DOM.input.innerHTML),g=this.getTagElms();if(h&&d)return o=n(d),d.hasAttribute("readonly")||d.remove(),this.DOM.input.focus(),void setTimeout((function(){e.placeCaretAfterNode(o),e.DOM.input.click()}));if("BR"==r.anchorNode.nodeName)return;if((l||d)&&1==r.anchorNode.nodeType?s=0==r.anchorOffset?l?g[0]:null:g[r.anchorOffset-1]:l?s=r.anchorNode.nextElementSibling:d&&(s=d),3==r.anchorNode.nodeType&&!r.anchorNode.nodeValue&&r.anchorNode.previousElementSibling&&t.preventDefault(),(d||l)&&!this.settings.backspace)return void t.preventDefault();if("Range"!=r.type&&!r.anchorOffset&&r.anchorNode==this.DOM.input&&"Delete"!=t.key)return void t.preventDefault();if("Range"!=r.type&&s&&s.hasAttribute("readonly"))return void this.placeCaretAfterNode(n(s));this.isFirefox&&1==r.anchorNode.nodeType&&0!=r.anchorOffset&&(this.removeTags(),this.placeCaretAfterNode(this.setRangeAtStartEnd())),setTimeout((function(){var t=document.getSelection(),i=a(e.DOM.input.innerHTML),s=t.anchorNode.previousElementSibling;if(!h&&i.length>=c.length&&s&&!s.hasAttribute("readonly")&&(e.removeTags(s),e.fixFirefoxLastTagNoCaret(),2==e.DOM.input.children.length&&"BR"==e.DOM.input.children[1].tagName))return e.DOM.input.innerHTML="",e.value.length=0,!0;e.value=[].map.call(g,(function(t,i){var s=e.tagData(t);if(t.parentNode||s.readonly)return s;e.trigger("remove",{tag:t,index:i,data:s})})).filter((function(t){return t}))}),50)}return!0}switch(t.key){case"Backspace":this.state.dropdown.visible&&"manual"!=this.settings.dropdown.position||""!=i&&8203!=i.charCodeAt(0)||(!0===this.settings.backspace?this.removeTags():"edit"==this.settings.backspace&&setTimeout(this.editTag.bind(this),0));break;case"Esc":case"Escape":if(this.state.dropdown.visible)return;t.target.blur();break;case"Down":case"ArrowDown":this.state.dropdown.visible||this.dropdown.show.call(this);break;case"ArrowRight":var u=this.state.inputSuggestion||this.state.ddItemData;if(u&&this.settings.autoComplete.rightKey)return void this.addTags([u],!0);break;case"Tab":var p="select"==this.settings.mode;if(!i||p)return!0;t.preventDefault();case"Enter":if(this.state.dropdown.visible||229==t.keyCode)return;t.preventDefault(),setTimeout((function(){e.state.actions.selectOption||e.addTags(i,!0)}))}},onInput:function(t){if("mix"==this.settings.mode)return this.events.callbacks.onMixTagsInput.call(this,t);var e=this.input.normalize.call(this),i=e.length>=this.settings.dropdown.enabled,s={value:e,inputElm:this.DOM.input};s.isValid=this.validateTag({value:e}),this.trigger("input",s),this.state.inputText!=e&&(this.input.set.call(this,e,!1),-1!=e.search(this.settings.delimiters)?this.addTags(e)&&this.input.set.call(this):this.settings.dropdown.enabled>=0&&this.dropdown[i?"show":"hide"].call(this,e))},onMixTagsInput:function(t){var e,i,s,a,n,o,r,l,c=this,g=this.settings,u=this.value.length,p=this.getTagElms(),f=document.createDocumentFragment(),m=window.getSelection().getRangeAt(0),v=[].map.call(p,(function(t){return c.tagData(t).value}));if("deleteContentBackward"==t.inputType&&h&&this.events.callbacks.onKeydown.call(this,{target:t.target,key:"Backspace"}),this.value.slice().forEach((function(t){t.readonly&&!v.includes(t.value)&&f.appendChild(c.createTagElem(t))})),f.childNodes.length&&(m.insertNode(f),this.setRangeAtStartEnd(!1,f.lastChild)),p.length!=u)return this.value=[].map.call(this.getTagElms(),(function(t){return c.tagData(t)})),void this.update({withoutChangeEvent:!0});if(this.hasMaxTags())return!0;if(window.getSelection&&(o=window.getSelection()).rangeCount>0&&3==o.anchorNode.nodeType){if((m=o.getRangeAt(0).cloneRange()).collapse(!0),m.setStart(o.focusNode,0),s=(e=m.toString().slice(0,m.endOffset)).split(g.pattern).length-1,(i=e.match(g.pattern))&&(a=e.slice(e.lastIndexOf(i[i.length-1]))),a){if(this.state.actions.ArrowLeft=!1,this.state.tag={prefix:a.match(g.pattern)[0],value:a.replace(g.pattern,"")},this.state.tag.baseOffset=o.baseOffset-this.state.tag.value.length,l=this.state.tag.value.match(g.delimiters))return this.state.tag.value=this.state.tag.value.replace(g.delimiters,""),this.state.tag.delimiters=l[0],this.addTags(this.state.tag.value,g.dropdown.clearOnSelect),void this.dropdown.hide.call(this);n=this.state.tag.value.length>=g.dropdown.enabled;try{r=(r=this.state.flaggedTags[this.state.tag.baseOffset]).prefix==this.state.tag.prefix&&r.value[0]==this.state.tag.value[0],this.state.flaggedTags[this.state.tag.baseOffset]&&!this.state.tag.value&&delete this.state.flaggedTags[this.state.tag.baseOffset]}catch(t){}(r||s500)?this.state.dropdown.visible?this.dropdown.hide.call(this):0===e.dropdown.enabled&&"mix"!=e.mode&&this.dropdown.show.call(this):"select"==e.mode&&!this.state.dropdown.visible&&this.dropdown.show.call(this));this.removeTags(t.target.parentNode)}else this.state.hasFocus||this.DOM.input.focus()},onPaste:function(t){var e;t.preventDefault(),this.settings.readonly||(e=(t.clipboardData||window.clipboardData).getData("Text"),this.injectAtCaret(e,window.getSelection().getRangeAt(0)),"mix"!=this.settings.mode&&this.addTags(this.DOM.input.textContent,!0))},onEditTagInput:function(t,i){var s=t.closest("."+this.settings.classNames.tag),a=this.getNodeIndex(s),n=this.tagData(s),o=this.input.normalize.call(this,t),r=s.innerHTML!=s.__tagifyTagData.__originalHTML,l=this.validateTag(e({},this.settings.tagTextProp,o));r||!0!==t.originalIsValid||(l=!0),s.classList.toggle(this.settings.classNames.tagInvalid,!0!==l),n.__isValid=l,s.title=!0===l?n.title||n.value:l,o.length>=this.settings.dropdown.enabled&&(this.state.editing&&(this.state.editing.value=o),this.dropdown.show.call(this,o)),this.trigger("edit:input",{tag:s,index:a,data:d({},this.value[a],{newValue:o}),originalEvent:this.cloneEvent(i)})},onEditTagFocus:function(t){this.state.editing={scope:t,input:t.querySelector("[contenteditable]")}},onEditTagBlur:function(t){var i;if(this.state.hasFocus||this.toggleFocusClass(),this.DOM.scope.contains(t)){var s,a=this.settings,n=t.closest("."+a.classNames.tag),o=this.input.normalize.call(this,t),r=this.tagData(n).__originalData,l=n.innerHTML!=n.__tagifyTagData.__originalHTML,d=this.validateTag(e({},a.tagTextProp,o));if(o)if(l){if(s=this.getWhitelistItem(o)||(e(i={},a.tagTextProp,o),e(i,"value",o),i),a.transformTag.call(this,s,r),!0!==(d=this.validateTag(e({},a.tagTextProp,s[a.tagTextProp])))){if(this.trigger("invalid",{data:s,tag:n,message:d}),a.editTags.keepInvalid)return;a.keepInvalidTags?s.__isValid=d:s=r}this.onEditTagDone(n,s)}else this.onEditTagDone(n,r);else this.onEditTagDone(n)}},onEditTagkeydown:function(t,e){switch(this.trigger("edit:keydown",{originalEvent:this.cloneEvent(t)}),t.key){case"Esc":case"Escape":e.innerHTML=e.__tagifyTagData.__originalHTML;case"Enter":case"Tab":t.preventDefault(),t.target.blur()}},onDoubleClickScope:function(t){var e,i,s=t.target.closest("."+this.settings.classNames.tag),a=this.settings;s&&(e=s.classList.contains(this.settings.classNames.tagEditing),i=s.hasAttribute("readonly"),"select"==a.mode||a.readonly||e||i||!this.settings.editTags||this.editTag(s),this.toggleFocusClass(!0),this.trigger("dblclick",{tag:s,index:this.getNodeIndex(s),data:this.tagData(s)}))}}};function f(e,i){return e?e.previousElementSibling&&e.previousElementSibling.classList.contains("tagify")?(console.warn("Tagify: ","input element is already Tagified",e),this):(d(this,function(e){var i=document.createTextNode("");function s(t,e,s){s&&e.split(/\s+/g).forEach((function(e){return i[t+"EventListener"].call(i,e,s)}))}return{off:function(t,e){return s("remove",t,e),this},on:function(t,e){return e&&"function"==typeof e&&s("add",t,e),this},trigger:function(s,a){var n;if(s)if(e.settings.isJQueryPlugin)"remove"==s&&(s="removeTag"),jQuery(e.DOM.originalInput).triggerHandler(s,[a]);else{try{var o=d({},"object"===t(a)?a:{value:a});if(o.tagify=this,a instanceof Object)for(var r in a)a[r]instanceof HTMLElement&&(o[r]=a[r]);n=new CustomEvent(s,{detail:o})}catch(t){console.warn(t)}i.dispatchEvent(n)}}}}(this)),this.isFirefox="undefined"!=typeof InstallTrigger,this.isIE=window.document.documentMode,this.applySettings(e,i||{}),this.state={inputText:"",editing:!1,actions:{},mixMode:{},dropdown:{},flaggedTags:{}},this.value=[],this.listeners={},this.DOM={},this.build(e),this.getCSSVars(),this.loadOriginalValues(),this.events.customBinding.call(this),this.events.binding.call(this),void(e.autofocus&&this.DOM.input.focus())):(console.warn("Tagify: ","input element not found",e),this)}return f.prototype={dropdown:g,TEXTS:{empty:"empty",exceed:"number of tags exceeded",pattern:"pattern mismatch",duplicate:"already exists",notAllowed:"not allowed"},customEventsList:["change","add","remove","invalid","input","click","keydown","focus","blur","edit:input","edit:updated","edit:start","edit:keydown","dropdown:show","dropdown:hide","dropdown:select","dropdown:updated","dropdown:noMatch"],trim:function(t){return this.settings.trim&&t&&"string"==typeof t?t.trim():t},parseHTML:function(t){return(new DOMParser).parseFromString(t.trim(),"text/html").body.firstElementChild},templates:{wrapper:function(t,e){return'\n \n ')},tag:function(t){return'\n \n
    \n ').concat(t[this.settings.tagTextProp]||t.value,"\n
    \n
    ")},dropdown:function(t){var e=t.dropdown,i="manual"==e.position,s="".concat(t.classNames.dropdown);return'
    \n
    \n
    ')},dropdownItem:function(t){return"
    ').concat(t.value,"
    ")},dropdownItemNoMatch:null},parseTemplate:function(t,e){return t=this.settings.templates[t]||t,this.parseHTML(t.apply(this,e))},applySettings:function(t,e){u.templates=this.templates;var i=this.settings=d({},u,e);if(i.readonly=t.hasAttribute("readonly"),i.placeholder=t.getAttribute("placeholder")||i.placeholder||"",i.required=t.hasAttribute("required"),this.isIE&&(i.autoComplete=!1),["whitelist","blacklist"].forEach((function(e){var s=t.getAttribute("data-"+e);s&&(s=s.split(i.delimiters))instanceof Array&&(i[e]=s)})),"autoComplete"in e&&!l(e.autoComplete)&&(i.autoComplete=u.autoComplete,i.autoComplete.enabled=e.autoComplete),"mix"==i.mode&&(i.autoComplete.rightKey=!0,i.delimiters=e.delimiters||null,i.tagTextProp&&!i.dropdown.searchKeys.includes(i.tagTextProp)&&i.dropdown.searchKeys.push(i.tagTextProp)),t.pattern)try{i.pattern=new RegExp(t.pattern)}catch(t){}if(this.settings.delimiters)try{i.delimiters=new RegExp(this.settings.delimiters,"g")}catch(t){}"select"==i.mode&&(i.dropdown.enabled=0),i.dropdown.appendTarget=e.dropdown&&e.dropdown.appendTarget?e.dropdown.appendTarget:document.body},getAttributes:function(t){if("[object Object]"!=Object.prototype.toString.call(t))return"";var e,i,s=Object.keys(t),a="";for(i=s.length;i--;)"class"!=(e=s[i])&&t.hasOwnProperty(e)&&void 0!==t[e]&&(a+=" "+e+(void 0!==t[e]?'="'.concat(t[e],'"'):""));return a},setStateSelection:function(){var t=window.getSelection(),e={anchorOffset:t.anchorOffset,anchorNode:t.anchorNode,range:t.getRangeAt&&t.rangeCount&&t.getRangeAt(0)};return this.state.selection=e,e},getCaretGlobalPosition:function(){var t=document.getSelection();if(t.rangeCount){var e,i,s=t.getRangeAt(0),a=s.startContainer,n=s.startOffset;if(n>0)return(i=document.createRange()).setStart(a,n-1),i.setEnd(a,n),{left:(e=i.getBoundingClientRect()).right,top:e.top,bottom:e.bottom};if(a.getBoundingClientRect)return a.getBoundingClientRect()}return{left:-9999,top:-9999}},getCSSVars:function(){var t,e=getComputedStyle(this.DOM.scope,null);this.CSSVars={tagHideTransition:function(t){var e=t.value;return"s"==t.unit?1e3*e:e}(function(t){if(!t)return{};var e=(t=t.trim().split(" ")[0]).split(/\d+/g).filter((function(t){return t})).pop().trim();return{value:+t.split(e).filter((function(t){return t}))[0].trim(),unit:e}}((t="tag-hide-transition",e.getPropertyValue("--"+t))))}},build:function(t){var e=this.DOM;this.settings.mixMode.integrated?(e.originalInput=null,e.scope=t,e.input=t):(e.originalInput=t,e.scope=this.parseTemplate("wrapper",[t,this.settings]),e.input=e.scope.querySelector("."+this.settings.classNames.input),t.parentNode.insertBefore(e.scope,t)),this.settings.dropdown.enabled>=0&&this.dropdown.init.call(this)},destroy:function(){this.DOM.scope.parentNode.removeChild(this.DOM.scope),this.dropdown.hide.call(this,!0),clearTimeout(this.dropdownHide__bindEventsTimeout)},loadOriginalValues:function(t){var e,i=this.settings;if(t=t||(i.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value))if(this.removeAllTags(),"mix"==i.mode)this.parseMixTags(t.trim()),(e=this.DOM.input.lastChild)&&"BR"==e.tagName||this.DOM.input.insertAdjacentHTML("beforeend","
    ");else{try{JSON.parse(t)instanceof Array&&(t=JSON.parse(t))}catch(t){}this.addTags(t).forEach((function(t){return t&&t.classList.add(i.classNames.tagNoAnimation)}))}else this.postUpdate();this.state.lastOriginalValueReported=i.mixMode.integrated?"":this.DOM.originalInput.value,this.state.loadedOriginalValues=!0},cloneEvent:function(t){var e={};for(var i in t)e[i]=t[i];return e},loading:function(t){return this.state.isLoading=t,this.DOM.scope.classList[t?"add":"remove"](this.settings.classNames.scopeLoading),this},tagLoading:function(t,e){return t&&t.classList[e?"add":"remove"](this.settings.classNames.tagLoading),this},toggleClass:function(t,e){"string"==typeof t&&this.DOM.scope.classList.toggle(t,e)},toggleFocusClass:function(t){this.toggleClass(this.settings.classNames.focus,!!t)},triggerChangeEvent:function(){if(!this.settings.mixMode.integrated){var t=this.DOM.originalInput,e=this.state.lastOriginalValueReported!==t.value,i=new CustomEvent("change",{bubbles:!0});e&&(this.state.lastOriginalValueReported=t.value,i.simulated=!0,t._valueTracker&&t._valueTracker.setValue(Math.random()),t.dispatchEvent(i),this.trigger("change",this.state.lastOriginalValueReported),t.value=this.state.lastOriginalValueReported)}},events:p,fixFirefoxLastTagNoCaret:function(){},placeCaretAfterNode:function(t){if(t&&t.parentNode){var e=t.nextSibling,i=window.getSelection(),s=i.getRangeAt(0);i.rangeCount&&(s.setStartBefore(e||t),s.setEndBefore(e||t),i.removeAllRanges(),i.addRange(s))}},insertAfterTag:function(t,e){if(e=e||this.settings.mixMode.insertAfterTag,t&&t.parentNode&&e)return e="string"==typeof e?document.createTextNode(e):e,t.parentNode.insertBefore(e,t.nextSibling),e},editTag:function(t,e){var i=this;t=t||this.getLastTag(),e=e||{},this.dropdown.hide.call(this);var s=this.settings;function a(){return t.querySelector("."+s.classNames.tagText)}var n=a(),o=this.getNodeIndex(t),r=this.tagData(t),l=this.events.callbacks,c=this,h=!0;if(n){if(!(r instanceof Object&&"editable"in r)||r.editable)return n.setAttribute("contenteditable",!0),t.classList.add(s.classNames.tagEditing),this.tagData(t,{__originalData:d({},r),__originalHTML:t.innerHTML}),n.addEventListener("focus",l.onEditTagFocus.bind(this,t)),n.addEventListener("blur",(function(){setTimeout((function(){return l.onEditTagBlur.call(c,a())}))})),n.addEventListener("input",l.onEditTagInput.bind(this,n)),n.addEventListener("keydown",(function(e){return l.onEditTagkeydown.call(i,e,t)})),n.focus(),this.setRangeAtStartEnd(!1,n),e.skipValidation||(h=this.editTagToggleValidity(t,r.value)),n.originalIsValid=h,this.trigger("edit:start",{tag:t,index:o,data:r,isValid:h}),this}else console.warn("Cannot find element in Tag template: .",s.classNames.tagText)},editTagToggleValidity:function(t,e){var i,s=this.tagData(t);if(s)return i=!(!s.__isValid||1==s.__isValid),t.classList.toggle(this.settings.classNames.tagInvalid,i),s.__isValid;console.warn("tag has no data: ",t,s)},onEditTagDone:function(t,e){e=e||{};var i={tag:t=t||this.state.editing.scope,index:this.getNodeIndex(t),previousData:this.tagData(t),data:e};this.trigger("edit:beforeUpdate",i),this.state.editing=!1,delete e.__originalData,delete e.__originalHTML,t&&e[this.settings.tagTextProp]?(this.editTagToggleValidity(t),this.replaceTag(t,e)):t&&this.removeTags(t),this.trigger("edit:updated",i),this.dropdown.hide.call(this),this.settings.keepInvalidTags&&this.reCheckInvalidTags()},replaceTag:function(t,e){e&&e.value||(e=t.__tagifyTagData),e.__isValid&&1!=e.__isValid&&d(e,this.getInvalidTagAttrs(e,e.__isValid));var i=this.createTagElem(e);t.parentNode.replaceChild(i,t),this.updateValueByDOMTags()},updateValueByDOMTags:function(){var t=this;this.value.length=0,[].forEach.call(this.getTagElms(),(function(e){e.classList.contains(t.settings.classNames.tagNotAllowed)||t.value.push(t.tagData(e))})),this.update()},setRangeAtStartEnd:function(t,e){t="number"==typeof t?t:!!t,e=(e=e||this.DOM.input).lastChild||e;var i=document.getSelection();try{i.rangeCount>=1&&["Start","End"].forEach((function(s){return i.getRangeAt(0)["set"+s](e,t||e.length)}))}catch(t){console.warn("Tagify: ",t)}},injectAtCaret:function(t,e){if(e=e||this.state.selection.range)return"string"==typeof t&&(t=document.createTextNode(t)),e.deleteContents(),e.insertNode(t),this.setRangeAtStartEnd(!1,t),this.updateValueByDOMTags(),this.update(),this},input:{set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.settings.dropdown.closeOnSelect;this.state.inputText=t,e&&(this.DOM.input.innerHTML=t),!t&&i&&this.dropdown.hide.bind(this),this.input.autocomplete.suggest.call(this),this.input.validate.call(this)},validate:function(){var t=!this.state.inputText||!0===this.validateTag({value:this.state.inputText});return this.DOM.input.classList.toggle(this.settings.classNames.inputInvalid,!t),t},normalize:function(t){var e=t||this.DOM.input,i=[];e.childNodes.forEach((function(t){return 3==t.nodeType&&i.push(t.nodeValue)})),i=i.join("\n");try{i=i.replace(/(?:\r\n|\r|\n)/g,this.settings.delimiters.source.charAt(0))}catch(t){}return i=i.replace(/\s/g," "),this.settings.trim&&(i=i.replace(/^\s+/,"")),i},autocomplete:{suggest:function(t){if(this.settings.autoComplete.enabled){"string"==typeof(t=t||{})&&(t={value:t});var e=t.value?""+t.value:"",i=e.substr(0,this.state.inputText.length).toLowerCase(),s=e.substring(this.state.inputText.length);e&&this.state.inputText&&i==this.state.inputText.toLowerCase()?(this.DOM.input.setAttribute("data-suggest",s),this.state.inputSuggestion=t):(this.DOM.input.removeAttribute("data-suggest"),delete this.state.inputSuggestion)}},set:function(t){var e=this.DOM.input.getAttribute("data-suggest"),i=t||(e?this.state.inputText+e:null);return!!i&&("mix"==this.settings.mode?this.replaceTextWithNode(document.createTextNode(this.state.tag.prefix+i)):(this.input.set.call(this,i),this.setRangeAtStartEnd()),this.input.autocomplete.suggest.call(this),this.dropdown.hide.call(this),!0)}}},getTagIdx:function(t){return this.value.findIndex((function(e){return e.value==t.value}))},getNodeIndex:function(t){var e=0;if(t)for(;t=t.previousElementSibling;)e++;return e},getTagElms:function(){for(var t=arguments.length,e=new Array(t),i=0;i=this.settings.maxTags&&this.TEXTS.exceed},setReadonly:function(t){var e=this.settings;document.activeElement.blur(),e.readonly=t,this.DOM.scope[(t?"set":"remove")+"Attribute"]("readonly",!0),"mix"==e.mode&&(this.DOM.input.contentEditable=!t)},normalizeTags:function(t){var s=this,a=this.settings,n=a.whitelist,o=a.delimiters,r=a.mode,l=a.tagTextProp,d=a.enforceWhitelist,c=[],h=!!n&&n[0]instanceof Object,g=t instanceof Array,u=function(t){return(t+"").split(o).filter((function(t){return t})).map((function(t){var i;return e(i={},l,s.trim(t)),e(i,"value",s.trim(t)),i}))};if("number"==typeof t&&(t=t.toString()),"string"==typeof t){if(!t.trim())return[];t=u(t)}else if(g){var p;t=(p=[]).concat.apply(p,i(t.map((function(t){return t.value?t:u(t)}))))}return h&&(t.forEach((function(t){var e=c.map((function(t){return t.value})),i=s.dropdown.filterListItems.call(s,t[l],{exact:!0}).filter((function(t){return!e.includes(t.value)})),a=i.length>1?s.getWhitelistItem(t[l],l,i):i[0];a&&a instanceof Object?c.push(a):"mix"==r||d||(null==t.value&&(t.value=t[l]),c.push(t))})),t=c),t},parseMixTags:function(t){var e=this,i=this.settings,s=i.mixTagsInterpolator,a=i.duplicates,n=i.transformTag,o=i.enforceWhitelist,r=i.maxTags,l=i.tagTextProp,d=[];return t=t.split(s[0]).map((function(t,i){var c,h,g,u=t.split(s[1]),p=u[0],f=d.length==r;try{if(p==+p)throw Error;h=JSON.parse(p)}catch(t){h=e.normalizeTags(p)[0]||{value:p}}if(f||!(u.length>1)||o&&!e.isTagWhitelisted(h.value)||!a&&e.isTagDuplicate(h.value)){if(t)return i?s[0]+t:t}else n.call(e,h),h[c=h[l]?l:"value"]=e.trim(h[c]),g=e.createTagElem(h),d.push(h),g.classList.add(e.settings.classNames.tagNoAnimation),u[0]=g.outerHTML,e.value.push(h);return u.join("")})).join(""),this.DOM.input.innerHTML=t,this.DOM.input.appendChild(document.createTextNode("")),this.DOM.input.normalize(),this.getTagElms().forEach((function(t,i){return e.tagData(t,d[i])})),this.update({withoutChangeEvent:!0}),t},replaceTextWithNode:function(t,e){if(this.state.tag||e){e=e||this.state.tag.prefix+this.state.tag.value;var i,s,a=window.getSelection(),n=a.anchorNode,o=this.state.tag.delimiters?this.state.tag.delimiters.length:0;return n.splitText(a.anchorOffset-o),i=n.nodeValue.lastIndexOf(e),s=n.splitText(i),t&&n.parentNode.replaceChild(t,s),!0}},selectTag:function(t,e){if(!this.settings.enforceWhitelist||this.isTagWhitelisted(e.value))return this.input.set.call(this,e.value,!0),this.state.actions.selectOption&&setTimeout(this.setRangeAtStartEnd.bind(this)),this.getLastTag()?this.replaceTag(this.getLastTag(),e):this.appendTag(t),this.value[0]=e,this.trigger("add",{tag:t,data:e}),this.update(),[t]},addEmptyTag:function(t){var e=d({value:""},t||{}),i=this.createTagElem(e);this.tagData(i,e),this.appendTag(i),this.editTag(i,{skipValidation:!0})},addTags:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.settings.skipInvalid,a=[],n=this.settings;return t&&0!=t.length?(t=this.normalizeTags(t),"mix"==n.mode?this.addMixTags(t):("select"==n.mode&&(e=!1),this.DOM.input.removeAttribute("style"),t.forEach((function(t){var e,o={},r=Object.assign({},t,{value:t.value+""});if((t=Object.assign({},r)).__isValid=i.hasMaxTags()||i.validateTag(t),n.transformTag.call(i,t),!0!==t.__isValid){if(s)return;d(o,i.getInvalidTagAttrs(t,t.__isValid),{__preInvalidData:r}),t.__isValid==i.TEXTS.duplicate&&i.flashTag(i.getTagElmByValue(t.value))}if(t.readonly&&(o["aria-readonly"]=!0),e=i.createTagElem(d({},t,o)),a.push(e),"select"==n.mode)return i.selectTag(e,t);i.appendTag(e),t.__isValid&&!0===t.__isValid?(i.value.push(t),i.update(),i.trigger("add",{tag:e,index:i.value.length-1,data:t})):(i.trigger("invalid",{data:t,index:i.value.length,tag:e,message:t.__isValid}),n.keepInvalidTags||setTimeout((function(){return i.removeTags(e,!0)}),1e3)),i.dropdown.position.call(i)})),t.length&&e&&this.input.set.call(this),this.dropdown.refilter.call(this),a)):("select"==n.mode&&this.removeAllTags(),a)},addMixTags:function(t){var e=this;if(t[0].prefix||this.state.tag)this.prefixedTextToTag(t[0]);else{"string"==typeof t&&(t=[{value:t}]);var i=!!this.state.selection,s=document.createDocumentFragment();t.forEach((function(t){var i=e.createTagElem(t);s.appendChild(i),e.insertAfterTag(i)})),i?this.injectAtCaret(s):(this.DOM.input.focus(),(i=this.setStateSelection()).range.setStart(this.DOM.input,i.range.endOffset),i.range.setEnd(this.DOM.input,i.range.endOffset),this.DOM.input.appendChild(s),this.updateValueByDOMTags(),this.update())}},prefixedTextToTag:function(t){var e,i=this,s=this.settings,a=this.state.tag.delimiters;if(s.transformTag.call(this,t),t.prefix=t.prefix||this.state.tag?this.state.tag.prefix:(s.pattern.source||s.pattern)[0],e=this.createTagElem(t),this.replaceTextWithNode(e)||this.DOM.input.appendChild(e),setTimeout((function(){return e.classList.add(i.settings.classNames.tagNoAnimation)}),300),this.value.push(t),this.update(),!a){var n=this.insertAfterTag(e)||e;this.placeCaretAfterNode(n)}return this.state.tag=null,this.trigger("add",d({},{tag:e},{data:t})),e},appendTag:function(t){var e=this.DOM.scope.lastElementChild;e===this.DOM.input?this.DOM.scope.insertBefore(t,e):this.DOM.scope.appendChild(t)},createTagElem:function(t){var e,i=d({},t,{value:o(t.value+"")});return function(t){for(var e,i=document.createNodeIterator(t,NodeFilter.SHOW_TEXT,null,!1);e=i.nextNode();)e.textContent.trim()||e.parentNode.removeChild(e)}(e=this.parseTemplate("tag",[i])),this.tagData(e,t),e},reCheckInvalidTags:function(){var t=this,e=this.settings,i=".".concat(e.classNames.tag,".").concat(e.classNames.tagNotAllowed),s=this.DOM.scope.querySelectorAll(i);[].forEach.call(s,(function(e){var i=t.tagData(e),s=e.getAttribute("title")==t.TEXTS.duplicate,a=!0===t.validateTag(i);s&&a&&(i=i.__preInvalidData?i.__preInvalidData:{value:i.value},t.replaceTag(e,i))}))},removeTags:function(t,e,i){var s,a=this;t=t&&t instanceof HTMLElement?[t]:t instanceof Array?t:t?[t]:[this.getLastTag()],s=t.reduce((function(t,e){return e&&"string"==typeof e&&(e=a.getTagElmByValue(e)),e&&t.push({node:e,idx:a.getTagIdx(a.tagData(e)),data:a.tagData(e,{__removed:!0})}),t}),[]),i="number"==typeof i?i:this.CSSVars.tagHideTransition,"select"==this.settings.mode&&(i=0,this.input.set.call(this)),1==s.length&&s[0].node.classList.contains(this.settings.classNames.tagNotAllowed)&&(e=!0),s.length&&this.settings.hooks.beforeRemoveTag(s,{tagify:this}).then((function(){function t(t){t.node.parentNode&&(t.node.parentNode.removeChild(t.node),e?this.settings.keepInvalidTags&&this.trigger("remove",{tag:t.node,index:t.idx}):(this.trigger("remove",{tag:t.node,index:t.idx,data:t.data}),this.dropdown.refilter.call(this),this.dropdown.position.call(this),this.DOM.input.normalize(),this.settings.keepInvalidTags&&this.reCheckInvalidTags()))}i&&i>10&&1==s.length?function(e){e.node.style.width=parseFloat(window.getComputedStyle(e.node).width)+"px",document.body.clientTop,e.node.classList.add(this.settings.classNames.tagHide),setTimeout(t.bind(this),i,e)}.call(a,s[0]):s.forEach(t.bind(a)),e||(s.forEach((function(t){var e=Object.assign({},t.data);delete e.__removed;var i=a.getTagIdx(e);i>-1&&a.value.splice(i,1)})),a.update())})).catch((function(t){}))},removeAllTags:function(){this.value=[],"mix"==this.settings.mode?this.DOM.input.innerHTML="":Array.prototype.slice.call(this.getTagElms()).forEach((function(t){return t.parentNode.removeChild(t)})),this.dropdown.position.call(this),"select"==this.settings.mode&&this.input.set.call(this),this.update()},postUpdate:function(){var t=this.settings.classNames,e="mix"==this.settings.mode?this.settings.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value:this.value.length;this.toggleClass(t.hasMaxTags,this.value.length>=this.settings.maxTags),this.toggleClass(t.hasNoTags,!this.value.length),this.toggleClass(t.empty,!e)},update:function(t){var e,i,s=this.DOM.originalInput,a=(t||{}).withoutChangeEvent,n=(e=this.value,i=["__isValid","__removed"],e.map((function(t){var e={};for(var s in t)i.indexOf(s)<0&&(e[s]=t[s]);return e})));this.settings.mixMode.integrated||(s.value="mix"==this.settings.mode?this.getMixedTagsAsString(n):n.length?this.settings.originalInputValueFormat?this.settings.originalInputValueFormat(n):JSON.stringify(n):""),this.postUpdate(),!a&&this.state.loadedOriginalValues&&this.triggerChangeEvent()},getMixedTagsAsString:function(){var t="",e=this,i=this.settings.mixTagsInterpolator;return function s(a){a.childNodes.forEach((function(a){if(1==a.nodeType){if(a.classList.contains(e.settings.classNames.tag)&&e.tagData(a)){if(e.tagData(a).__removed)return;return void(t+=i[0]+JSON.stringify(a.__tagifyTagData)+i[1])}"BR"!=a.tagName||a.parentNode!=e.DOM.input&&1!=a.parentNode.childNodes.length?"DIV"!=a.tagName&&"P"!=a.tagName||(t+="\r\n",s(a)):t+="\r\n"}else t+=a.textContent}))}(this.DOM.input),t}},f.prototype.removeTag=f.prototype.removeTags,f})); - })(jQuery); \ No newline at end of file diff --git a/js/tagify/react.tagify.js b/js/tagify/react.tagify.js deleted file mode 100644 index 30d7126..0000000 --- a/js/tagify/react.tagify.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.React.tagify=t()}(this,function(){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.MixedTags=void 0;var e,H=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=r?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(n,o,u):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(require("react")),L=require("react-dom/server"),t=require("prop-types"),Q=(e=require("./tagify.min.js"))&&e.__esModule?e:{default:e};function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function r(){return(r=Object.assign||function(e){for(var t=1;t.tagify__input{visibility:hidden;width:0;margin:5px 0}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div{padding:.3em .5em;padding:var(--tag-pad)}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div::before{background:linear-gradient(45deg,var(--tag-bg) 25%,transparent 25%,transparent 50%,var(--tag-bg) 50%,var(--tag-bg) 75%,transparent 75%,transparent) 0/5px 5px;box-shadow:none;filter:brightness(.95)}.tagify[readonly] .tagify__tag__removeBtn{display:none}.tagify--loading .tagify__input::before{content:none}.tagify--loading .tagify__input::after{content:'';vertical-align:middle;opacity:1;width:.7em;height:.7em;width:var(--loader-size);height:var(--loader-size);border:3px solid;border-color:#eee #bbb #888 transparent;border-radius:50%;animation:rotateLoader .4s infinite linear;margin:-2px 0 -2px .5em}.tagify--loading .tagify__input:empty::after{margin-left:0}.tagify+input,.tagify+textarea{display:none!important}.tagify__tag{display:inline-flex;align-items:center;margin:5px 0 5px 5px;position:relative;z-index:1;outline:0;cursor:default;transition:.13s ease-out}.tagify__tag>div{vertical-align:top;box-sizing:border-box;max-width:100%;padding:.3em .5em;padding:var(--tag-pad,.3em .5em);color:#000;color:var(--tag-text-color,#000);line-height:inherit;border-radius:3px;white-space:nowrap;transition:.13s ease-out}.tagify__tag>div>*{white-space:pre-wrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;vertical-align:top;min-width:1ch;max-width:auto;min-width:var(--tag--min-width,1ch);max-width:var(--tag--max-width,auto);transition:.8s ease,.1s color}.tagify__tag>div>[contenteditable]{outline:0;-webkit-user-select:text;user-select:text;cursor:text;margin:-2px;padding:2px;max-width:350px}.tagify__tag>div::before{content:'';position:absolute;border-radius:inherit;left:0;top:0;right:0;bottom:0;z-index:-1;pointer-events:none;transition:120ms ease;animation:tags--bump .3s ease-out 1;box-shadow:0 0 0 1.1em #e5e5e5 inset;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-bg,#e5e5e5) inset}.tagify__tag:hover:not([readonly]) div::before{top:-2px;right:-2px;bottom:-2px;left:-2px;box-shadow:0 0 0 1.1em #d3e2e2 inset;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-hover,#d3e2e2) inset}.tagify__tag--loading{pointer-events:none}.tagify__tag--loading .tagify__tag__removeBtn{display:none}.tagify__tag--loading::after{--loader-size:.4em;content:'';vertical-align:middle;opacity:1;width:.7em;height:.7em;width:var(--loader-size);height:var(--loader-size);border:3px solid;border-color:#eee #bbb #888 transparent;border-radius:50%;animation:rotateLoader .4s infinite linear;margin:0 .5em 0 -.1em}.tagify__tag--flash div::before{animation:none}.tagify__tag--hide{width:0!important;padding-left:0;padding-right:0;margin-left:0;margin-right:0;opacity:0;transform:scale(0);transition:.3s;transition:var(--tag-hide-transition,.3s);pointer-events:none}.tagify__tag--hide>div>*{white-space:nowrap}.tagify__tag.tagify--noAnim>div::before{animation:none}.tagify__tag.tagify--notAllowed:not(.tagify__tag--editable) div>span{opacity:.5}.tagify__tag.tagify--notAllowed:not(.tagify__tag--editable) div::before{box-shadow:0 0 0 1.1em rgba(211,148,148,.5) inset!important;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-invalid-bg,rgba(211,148,148,.5)) inset!important;transition:.2s}.tagify__tag[readonly] .tagify__tag__removeBtn{display:none}.tagify__tag[readonly]>div::before{background:linear-gradient(45deg,var(--tag-bg) 25%,transparent 25%,transparent 50%,var(--tag-bg) 50%,var(--tag-bg) 75%,transparent 75%,transparent) 0/5px 5px;box-shadow:none;filter:brightness(.95)}.tagify__tag--editable>div{color:#000;color:var(--tag-text-color--edit,#000)}.tagify__tag--editable>div::before{box-shadow:0 0 0 2px #d3e2e2 inset!important;box-shadow:0 0 0 2px var(--tag-hover,#d3e2e2) inset!important}.tagify__tag--editable>.tagify__tag__removeBtn{pointer-events:none}.tagify__tag--editable>.tagify__tag__removeBtn::after{opacity:0;transform:translateX(100%) translateX(5px)}.tagify__tag--editable.tagify--invalid>div::before{box-shadow:0 0 0 2px #d39494 inset!important;box-shadow:0 0 0 2px var(--tag-invalid-color,#d39494) inset!important}.tagify__tag__removeBtn{order:5;display:inline-flex;align-items:center;justify-content:center;border-radius:50px;cursor:pointer;font:14px/1 Arial;background:0 0;background:var(--tag-remove-btn-bg,none);color:#000;color:var(--tag-remove-btn-color,#000);width:14px;height:14px;margin-right:4.66667px;margin-left:-4.66667px;overflow:hidden;transition:.2s ease-out}.tagify__tag__removeBtn::after{content:"\00D7";transition:.3s,color 0s}.tagify__tag__removeBtn:hover{color:#fff;background:#c77777;background:var(--tag-remove-btn-bg--hover,#c77777)}.tagify__tag__removeBtn:hover+div>span{opacity:.5}.tagify__tag__removeBtn:hover+div::before{box-shadow:0 0 0 1.1em rgba(211,148,148,.3) inset!important;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-remove-bg,rgba(211,148,148,.3)) inset!important;transition:box-shadow .2s}.tagify:not(.tagify--mix) .tagify__input br{display:none}.tagify:not(.tagify--mix) .tagify__input *{display:inline;white-space:nowrap}.tagify__input{flex-grow:1;display:inline-block;min-width:110px;margin:5px;padding:.3em .5em;padding:var(--tag-pad,.3em .5em);line-height:inherit;position:relative;white-space:pre-wrap;color:inherit;color:var(--input-color,inherit);box-sizing:inherit}.tagify__input:empty::before{transition:.2s ease-out;opacity:1;transform:none;display:inline-block;width:auto}.tagify--mix .tagify__input:empty::before{display:inline-block}.tagify__input:focus{outline:0}.tagify__input:focus::before{transition:.2s ease-out;opacity:0;transform:translatex(6px)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.tagify__input:focus::before{display:none}}@supports (-ms-ime-align:auto){.tagify__input:focus::before{display:none}}.tagify__input:focus:empty::before{transition:.2s ease-out;opacity:1;transform:none;color:rgba(0,0,0,.25);color:var(--placeholder-color-focus)}@-moz-document url-prefix(){.tagify__input:focus:empty::after{display:none}}.tagify__input::before{content:attr(data-placeholder);height:1em;line-height:1em;margin:auto 0;z-index:1;color:rgba(0,0,0,.4);color:var(--placeholder-color);white-space:nowrap;pointer-events:none;opacity:0;position:absolute}.tagify--mix .tagify__input::before{display:none;position:static;line-height:inherit}.tagify__input::after{content:attr(data-suggest);display:inline-block;white-space:pre;color:#000;opacity:.3;pointer-events:none;max-width:100px}.tagify__input .tagify__tag{margin:0}.tagify__input .tagify__tag>div{padding-top:0;padding-bottom:0}.tagify--mix{display:block}.tagify--mix .tagify__input{padding:5px;margin:0;width:100%;height:100%;line-height:1.5}.tagify--mix .tagify__input::before{height:auto}.tagify--mix .tagify__input::after{content:none}.tagify--select::after{content:'>';opacity:.5;position:absolute;top:50%;right:0;bottom:0;font:16px monospace;line-height:8px;height:8px;pointer-events:none;transform:translate(-150%,-50%) scaleX(1.2) rotate(90deg);transition:.2s ease-in-out}.tagify--select[aria-expanded=true]::after{transform:translate(-150%,-50%) rotate(270deg) scaleY(1.2)}.tagify--select .tagify__tag{position:absolute;top:0;right:1.8em;bottom:0}.tagify--select .tagify__tag div{display:none}.tagify--select .tagify__input{width:100%}.tagify--invalid{--tags-border-color:#D39494}.tagify__dropdown{position:absolute;z-index:9999;transform:translateY(1px);overflow:hidden}.tagify__dropdown[placement=top]{margin-top:0;transform:translateY(-100%)}.tagify__dropdown[placement=top] .tagify__dropdown__wrapper{border-top-width:1px;border-bottom-width:0}.tagify__dropdown[position=text]{box-shadow:0 0 0 3px rgba(var(--tagify-dd-color-primary),.1);font-size:.9em}.tagify__dropdown[position=text] .tagify__dropdown__wrapper{border-width:1px}.tagify__dropdown__wrapper{max-height:300px;overflow:hidden;background:#fff;background:var(--tagify-dd-bg-color);border:1px solid #3595f6;border-color:var(--tagify-dd-color-primary);border-top-width:0;box-shadow:0 2px 4px -2px rgba(0,0,0,.2);transition:.25s cubic-bezier(0,1,.5,1)}.tagify__dropdown__wrapper:hover{overflow:auto}.tagify__dropdown--initial .tagify__dropdown__wrapper{max-height:20px;transform:translateY(-1em)}.tagify__dropdown--initial[placement=top] .tagify__dropdown__wrapper{transform:translateY(2em)}.tagify__dropdown__item{box-sizing:inherit;padding:.3em .5em;margin:1px;cursor:pointer;border-radius:2px;position:relative;outline:0}.tagify__dropdown__item--active{background:#3595f6;background:var(--tagify-dd-color-primary);color:#fff}.tagify__dropdown__item:active{filter:brightness(105%)} \ No newline at end of file +:root{--tagify-dd-color-primary:rgb(53,149,246);--tagify-dd-bg-color:white}.tagify{--tags-border-color:#DDD;--tags-hover-border-color:#CCC;--tags-focus-border-color:#3595f6;--tag-bg:#E5E5E5;--tag-hover:#D3E2E2;--tag-text-color:black;--tag-text-color--edit:black;--tag-pad:0.3em 0.5em;--tag-inset-shadow-size:1.1em;--tag-invalid-color:#D39494;--tag-invalid-bg:rgba(211, 148, 148, 0.5);--tag-remove-bg:rgba(211, 148, 148, 0.3);--tag-remove-btn-color:black;--tag-remove-btn-bg:none;--tag-remove-btn-bg--hover:#c77777;--input-color:inherit;--tag--min-width:1ch;--tag--max-width:auto;--tag-hide-transition:0.3s;--placeholder-color:rgba(0, 0, 0, 0.4);--placeholder-color-focus:rgba(0, 0, 0, 0.25);--loader-size:.8em;display:flex;align-items:flex-start;flex-wrap:wrap;border:1px solid #ddd;border:1px solid var(--tags-border-color);padding:0;line-height:1.1;cursor:text;outline:0;position:relative;box-sizing:border-box;transition:.1s}@keyframes tags--bump{30%{transform:scale(1.2)}}@keyframes rotateLoader{to{transform:rotate(1turn)}}.tagify:hover{border-color:#ccc;border-color:var(--tags-hover-border-color)}.tagify.tagify--focus{transition:0s;border-color:#3595f6;border-color:var(--tags-focus-border-color)}.tagify[readonly]:not(.tagify--mix){cursor:default}.tagify[readonly]:not(.tagify--mix)>.tagify__input{visibility:hidden;width:0;margin:5px 0}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div{padding:.3em .5em;padding:var(--tag-pad)}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div::before{background:linear-gradient(45deg,var(--tag-bg) 25%,transparent 25%,transparent 50%,var(--tag-bg) 50%,var(--tag-bg) 75%,transparent 75%,transparent) 0/5px 5px;box-shadow:none;filter:brightness(.95)}.tagify[readonly] .tagify__tag__removeBtn{display:none}.tagify--loading .tagify__input::before{content:none}.tagify--loading .tagify__input::after{content:'';vertical-align:middle;opacity:1;width:.7em;height:.7em;width:var(--loader-size);height:var(--loader-size);border:3px solid;border-color:#eee #bbb #888 transparent;border-radius:50%;animation:rotateLoader .4s infinite linear;margin:-2px 0 -2px .5em}.tagify--loading .tagify__input:empty::after{margin-left:0}.tagify+input,.tagify+textarea{display:none!important}.tagify__tag{display:inline-flex;align-items:center;margin:5px 0 5px 5px;position:relative;z-index:1;outline:0;cursor:default;transition:.13s ease-out}.tagify__tag>div{vertical-align:top;box-sizing:border-box;max-width:100%;padding:.3em .5em;padding:var(--tag-pad,.3em .5em);color:#000;color:var(--tag-text-color,#000);line-height:inherit;border-radius:3px;white-space:nowrap;transition:.13s ease-out}.tagify__tag>div>*{white-space:pre-wrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;vertical-align:top;min-width:1ch;max-width:auto;min-width:var(--tag--min-width,1ch);max-width:var(--tag--max-width,auto);transition:.8s ease,.1s color}.tagify__tag>div>[contenteditable]{outline:0;-webkit-user-select:text;user-select:text;cursor:text;margin:-2px;padding:2px;max-width:350px}.tagify__tag>div::before{content:'';position:absolute;border-radius:inherit;left:0;top:0;right:0;bottom:0;z-index:-1;pointer-events:none;transition:120ms ease;animation:tags--bump .3s ease-out 1;box-shadow:0 0 0 1.1em #e5e5e5 inset;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-bg,#e5e5e5) inset}.tagify__tag:hover:not([readonly]) div::before{top:-2px;right:-2px;bottom:-2px;left:-2px;box-shadow:0 0 0 1.1em #d3e2e2 inset;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-hover,#d3e2e2) inset}.tagify__tag--loading{pointer-events:none}.tagify__tag--loading .tagify__tag__removeBtn{display:none}.tagify__tag--loading::after{--loader-size:.4em;content:'';vertical-align:middle;opacity:1;width:.7em;height:.7em;width:var(--loader-size);height:var(--loader-size);border:3px solid;border-color:#eee #bbb #888 transparent;border-radius:50%;animation:rotateLoader .4s infinite linear;margin:0 .5em 0 -.1em}.tagify__tag--flash div::before{animation:none}.tagify__tag--hide{width:0!important;padding-left:0;padding-right:0;margin-left:0;margin-right:0;opacity:0;transform:scale(0);transition:.3s;transition:var(--tag-hide-transition,.3s);pointer-events:none}.tagify__tag--hide>div>*{white-space:nowrap}.tagify__tag.tagify--noAnim>div::before{animation:none}.tagify__tag.tagify--notAllowed:not(.tagify__tag--editable) div>span{opacity:.5}.tagify__tag.tagify--notAllowed:not(.tagify__tag--editable) div::before{box-shadow:0 0 0 1.1em rgba(211,148,148,.5) inset!important;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-invalid-bg,rgba(211,148,148,.5)) inset!important;transition:.2s}.tagify__tag[readonly] .tagify__tag__removeBtn{display:none}.tagify__tag[readonly]>div::before{background:linear-gradient(45deg,var(--tag-bg) 25%,transparent 25%,transparent 50%,var(--tag-bg) 50%,var(--tag-bg) 75%,transparent 75%,transparent) 0/5px 5px;box-shadow:none;filter:brightness(.95)}.tagify__tag--editable>div{color:#000;color:var(--tag-text-color--edit,#000)}.tagify__tag--editable>div::before{box-shadow:0 0 0 2px #d3e2e2 inset!important;box-shadow:0 0 0 2px var(--tag-hover,#d3e2e2) inset!important}.tagify__tag--editable>.tagify__tag__removeBtn{pointer-events:none}.tagify__tag--editable>.tagify__tag__removeBtn::after{opacity:0;transform:translateX(100%) translateX(5px)}.tagify__tag--editable.tagify--invalid>div::before{box-shadow:0 0 0 2px #d39494 inset!important;box-shadow:0 0 0 2px var(--tag-invalid-color,#d39494) inset!important}.tagify__tag__removeBtn{order:5;display:inline-flex;align-items:center;justify-content:center;border-radius:50px;cursor:pointer;font:14px/1 Arial;background:0 0;background:var(--tag-remove-btn-bg,none);color:#000;color:var(--tag-remove-btn-color,#000);width:14px;height:14px;margin-right:4.66667px;margin-left:-4.66667px;overflow:hidden;transition:.2s ease-out}.tagify__tag__removeBtn::after{content:"\00D7";transition:.3s,color 0s}.tagify__tag__removeBtn:hover{color:#fff;background:#c77777;background:var(--tag-remove-btn-bg--hover,#c77777)}.tagify__tag__removeBtn:hover+div>span{opacity:.5}.tagify__tag__removeBtn:hover+div::before{box-shadow:0 0 0 1.1em rgba(211,148,148,.3) inset!important;box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-remove-bg,rgba(211,148,148,.3)) inset!important;transition:box-shadow .2s}.tagify:not(.tagify--mix) .tagify__input br{display:none}.tagify:not(.tagify--mix) .tagify__input *{display:inline;white-space:nowrap}.tagify__input{flex-grow:1;display:inline-block;min-width:110px;margin:5px;padding:.3em .5em;padding:var(--tag-pad,.3em .5em);line-height:inherit;position:relative;white-space:pre-wrap;color:inherit;color:var(--input-color,inherit);box-sizing:inherit}.tagify__input:empty::before{transition:.2s ease-out;opacity:1;transform:none;display:inline-block;width:auto}.tagify--mix .tagify__input:empty::before{display:inline-block}.tagify__input:focus{outline:0}.tagify__input:focus::before{transition:.2s ease-out;opacity:0;transform:translatex(6px)}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.tagify__input:focus::before{display:none}}@supports (-ms-ime-align:auto){.tagify__input:focus::before{display:none}}.tagify__input:focus:empty::before{transition:.2s ease-out;opacity:1;transform:none;color:rgba(0,0,0,.25);color:var(--placeholder-color-focus)}@-moz-document url-prefix(){.tagify__input:focus:empty::after{display:none}}.tagify__input::before{content:attr(data-placeholder);height:1em;line-height:1em;margin:auto 0;z-index:1;color:rgba(0,0,0,.4);color:var(--placeholder-color);white-space:nowrap;pointer-events:none;opacity:0;position:absolute}.tagify--mix .tagify__input::before{display:none;position:static;line-height:inherit}.tagify__input::after{content:attr(data-suggest);display:inline-block;white-space:pre;color:#000;opacity:.3;pointer-events:none;max-width:100px}.tagify__input .tagify__tag{margin:0}.tagify__input .tagify__tag>div{padding-top:0;padding-bottom:0}.tagify--mix{display:block}.tagify--mix .tagify__input{padding:5px;margin:0;width:100%;height:100%;line-height:1.5}.tagify--mix .tagify__input::before{height:auto}.tagify--mix .tagify__input::after{content:none}.tagify--select::after{content:'>';opacity:.5;position:absolute;top:50%;right:0;bottom:0;font:16px monospace;line-height:8px;height:8px;pointer-events:none;transform:translate(-150%,-50%) scaleX(1.2) rotate(90deg);transition:.2s ease-in-out}.tagify--select[aria-expanded=true]::after{transform:translate(-150%,-50%) rotate(270deg) scaleY(1.2)}.tagify--select .tagify__tag{position:absolute;top:0;right:1.8em;bottom:0}.tagify--select .tagify__tag div{display:none}.tagify--select .tagify__input{width:100%}.tagify--invalid{--tags-border-color:#D39494}.tagify__dropdown{position:absolute;z-index:9999;transform:translateY(1px);overflow:hidden}.tagify__dropdown[placement=top]{margin-top:0;transform:translateY(-100%)}.tagify__dropdown[placement=top] .tagify__dropdown__wrapper{border-top-width:1px;border-bottom-width:0}.tagify__dropdown[position=text]{box-shadow:0 0 0 3px rgba(var(--tagify-dd-color-primary),.1);font-size:.9em}.tagify__dropdown[position=text] .tagify__dropdown__wrapper{border-width:1px}.tagify__dropdown__wrapper{max-height:300px;overflow:hidden;background:#fff;background:var(--tagify-dd-bg-color);border:1px solid #3595f6;border-color:var(--tagify-dd-color-primary);border-width:1.1px;border-top-width:0;box-shadow:0 2px 4px -2px rgba(0,0,0,.2);transition:.25s cubic-bezier(0,1,.5,1)}.tagify__dropdown__wrapper:hover{overflow:auto}.tagify__dropdown--initial .tagify__dropdown__wrapper{max-height:20px;transform:translateY(-1em)}.tagify__dropdown--initial[placement=top] .tagify__dropdown__wrapper{transform:translateY(2em)}.tagify__dropdown__item{box-sizing:inherit;padding:.3em .5em;margin:1px;cursor:pointer;border-radius:2px;position:relative;outline:0}.tagify__dropdown__item--active{background:#3595f6;background:var(--tagify-dd-color-primary);color:#fff}.tagify__dropdown__item:active{filter:brightness(105%)} \ No newline at end of file diff --git a/js/tagify/tagify.min.js b/js/tagify/tagify.min.js index 42a7d09..f9b07d0 100644 --- a/js/tagify/tagify.min.js +++ b/js/tagify/tagify.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Tagify=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function i(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e/g,">").replace(/"/g,""").replace(/`|'/g,"'")}function r(t){return t instanceof Array}function l(t){var e=Object.prototype.toString.call(t).split(" ")[1].slice(0,-1);return t===Object(t)&&"Array"!=e&&"Function"!=e&&"RegExp"!=e&&"HTMLUnknownElement"!=e}function d(t,e,i){function s(t,e){for(var i in e)if(e.hasOwnProperty(i)){if(l(e[i])){l(t[i])?s(t[i],e[i]):t[i]=Object.assign({},e[i]);continue}if(r(e[i])){t[i]=Object.assign([],e[i]);continue}t[i]=e[i]}}return t instanceof Object||(t={}),s(t,e),i&&s(t,i),t}function c(t){return String.prototype.normalize?"string"==typeof t?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):void 0:t}var h=/(?=.*chrome)(?=.*android)/i.test(navigator.userAgent),g={init:function(){this.DOM.dropdown=this.parseTemplate("dropdown",[this.settings]),this.DOM.dropdown.content=this.DOM.dropdown.querySelector("."+this.settings.classNames.dropdownWrapper)},show:function(t){var e,i,a,n=this,o=this.settings,r=window.getSelection(),d="mix"==o.mode&&!o.enforceWhitelist,c=!o.whitelist||!o.whitelist.length,h="manual"==o.dropdown.position;if(t=void 0===t?this.state.inputText:t,(!c||d||o.templates.dropdownItemNoMatch)&&!1!==o.dropdown.enable&&!this.state.isLoading){if(clearTimeout(this.dropdownHide__bindEventsTimeout),this.suggestedListItems=this.dropdown.filterListItems.call(this,t),t&&!this.suggestedListItems.length&&(this.trigger("dropdown:noMatch",t),o.templates.dropdownItemNoMatch&&(a=o.templates.dropdownItemNoMatch.call(this,{value:t}))),!a){if(this.suggestedListItems.length)t&&d&&!this.state.editing.scope&&!s(this.suggestedListItems[0].value,t)&&this.suggestedListItems.unshift({value:t});else{if(!t||!d||this.state.editing.scope)return this.input.autocomplete.suggest.call(this),void this.dropdown.hide.call(this);this.suggestedListItems=[{value:t}]}i=""+(l(e=this.suggestedListItems[0])?e.value:e),o.autoComplete&&i&&0==i.indexOf(t)&&this.input.autocomplete.suggest.call(this,e)}this.dropdown.fill.call(this,a),o.dropdown.highlightFirst&&this.dropdown.highlightOption.call(this,this.DOM.dropdown.content.children[0]),this.state.dropdown.visible||setTimeout(this.dropdown.events.binding.bind(this)),this.state.dropdown.visible=t||!0,this.state.dropdown.query=t,this.state.selection={anchorOffset:r.anchorOffset,anchorNode:r.anchorNode},h||setTimeout((function(){n.dropdown.position.call(n),n.dropdown.render.call(n)})),setTimeout((function(){n.trigger("dropdown:show",n.DOM.dropdown)}))}},hide:function(t){var e=this,i=this.DOM,s=i.scope,a=i.dropdown,n="manual"==this.settings.dropdown.position&&!t;if(a&&document.body.contains(a)&&!n)return window.removeEventListener("resize",this.dropdown.position),this.dropdown.events.binding.call(this,!1),s.setAttribute("aria-expanded",!1),a.parentNode.removeChild(a),setTimeout((function(){e.state.dropdown.visible=!1}),100),this.state.dropdown.query=this.state.ddItemData=this.state.ddItemElm=this.state.selection=null,this.state.tag&&this.state.tag.value.length&&(this.state.flaggedTags[this.state.tag.baseOffset]=this.state.tag),this.trigger("dropdown:hide",a),this},render:function(){var t,e,i,s=this,a=(t=this.DOM.dropdown,(i=t.cloneNode(!0)).style.cssText="position:fixed; top:-9999px; opacity:0",document.body.appendChild(i),e=i.clientHeight,i.parentNode.removeChild(i),e),n=this.settings;return this.DOM.scope.setAttribute("aria-expanded",!0),document.body.contains(this.DOM.dropdown)||(this.DOM.dropdown.classList.add(n.classNames.dropdownInital),this.dropdown.position.call(this,a),n.dropdown.appendTarget.appendChild(this.DOM.dropdown),setTimeout((function(){return s.DOM.dropdown.classList.remove(n.classNames.dropdownInital)}))),this},fill:function(t){var e;t="string"==typeof t?t:this.dropdown.createListHTML.call(this,t||this.suggestedListItems),this.DOM.dropdown.content.innerHTML=(e=t)?e.replace(/\>[\r\n ]+\<").replace(/(<.*?>)|\s+/g,(function(t,e){return e||" "})):""},refilter:function(t){t=t||this.state.dropdown.query||"",this.suggestedListItems=this.dropdown.filterListItems.call(this,t),this.suggestedListItems.length?this.dropdown.fill.call(this):this.dropdown.hide.call(this),this.trigger("dropdown:updated",this.DOM.dropdown)},position:function(t){if("manual"!=this.settings.dropdown.position){var e,i,s,a,n,o,r,l=this.DOM.dropdown,d=document.documentElement.clientHeight,c=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)>480?this.settings.dropdown.position:"all",h=this.DOM["input"==c?"input":"scope"];t=t||l.clientHeight,this.state.dropdown.visible&&("text"==c?(a=(i=this.getCaretGlobalPosition()).bottom,s=i.top,n=i.left,o="auto"):(r=function(t){for(var e=0,i=0;t;)e+=t.offsetLeft||0,i+=t.offsetTop||0,t=t.parentNode;return{left:e,top:i}}(this.settings.dropdown.appendTarget),s=(i=h.getBoundingClientRect()).top+2-r.top,a=i.bottom-1-r.top,n=i.left-r.left,o=i.width+"px"),s=Math.floor(s),a=Math.ceil(a),e=d-i.bottom0&&void 0!==arguments[0])||arguments[0],e=this.dropdown.events.callbacks,i=this.listeners.dropdown=this.listeners.dropdown||{position:this.dropdown.position.bind(this),onKeyDown:e.onKeyDown.bind(this),onMouseOver:e.onMouseOver.bind(this),onMouseLeave:e.onMouseLeave.bind(this),onClick:e.onClick.bind(this),onScroll:e.onScroll.bind(this)},s=t?"addEventListener":"removeEventListener";"manual"!=this.settings.dropdown.position&&(window[s]("resize",i.position),window[s]("keydown",i.onKeyDown)),this.DOM.dropdown[s]("mouseover",i.onMouseOver),this.DOM.dropdown[s]("mouseleave",i.onMouseLeave),this.DOM.dropdown[s]("mousedown",i.onClick),this.DOM.dropdown.content[s]("scroll",i.onScroll)},callbacks:{onKeyDown:function(t){var e=this.DOM.dropdown.querySelector("."+this.settings.classNames.dropdownItemActive),i=e;switch(t.key){case"ArrowDown":case"ArrowUp":case"Down":case"Up":var s;t.preventDefault(),i&&(i=i[("ArrowUp"==t.key||"Up"==t.key?"previous":"next")+"ElementSibling"]),i||(i=(s=this.DOM.dropdown.content.children)["ArrowUp"==t.key||"Up"==t.key?s.length-1:0]),this.dropdown.highlightOption.call(this,i,!0);break;case"Escape":case"Esc":this.dropdown.hide.call(this);break;case"ArrowRight":if(this.state.actions.ArrowLeft)return;case"Tab":if("mix"!=this.settings.mode&&i&&!this.settings.autoComplete.rightKey&&!this.state.editing){t.preventDefault();var a=i.getAttribute("tagifySuggestionIdx"),n=a?this.suggestedListItems[+a]:"";return this.input.autocomplete.set.call(this,n.value||n),!1}return!0;case"Enter":t.preventDefault(),this.dropdown.selectOption.call(this,e);break;case"Backspace":if("mix"==this.settings.mode||this.state.editing.scope)return;var o=this.state.inputText.trim();""!=o&&8203!=o.charCodeAt(0)||(!0===this.settings.backspace?this.removeTags():"edit"==this.settings.backspace&&setTimeout(this.editTag.bind(this),0))}},onMouseOver:function(t){var e=t.target.closest("."+this.settings.classNames.dropdownItem);e&&this.dropdown.highlightOption.call(this,e)},onMouseLeave:function(t){this.dropdown.highlightOption.call(this)},onClick:function(t){var e=this;if(0==t.button&&t.target!=this.DOM.dropdown){var i=t.target.closest("."+this.settings.classNames.dropdownItem);this.state.actions.selectOption=!0,setTimeout((function(){return e.state.actions.selectOption=!1}),50),this.settings.hooks.suggestionClick(t,{tagify:this,suggestionElm:i}).then((function(){i?e.dropdown.selectOption.call(e,i):e.dropdown.hide.call(e)})).catch((function(t){return t}))}},onScroll:function(t){var e=t.target,i=e.scrollTop/(e.scrollHeight-e.parentNode.clientHeight)*100;this.trigger("dropdown:scroll",{percentage:Math.round(i)})}}},highlightOption:function(t,e){var i,s=this.settings.classNames.dropdownItemActive;if(this.state.ddItemElm&&(this.state.ddItemElm.classList.remove(s),this.state.ddItemElm.removeAttribute("aria-selected")),!t)return this.state.ddItemData=null,this.state.ddItemElm=null,void this.input.autocomplete.suggest.call(this);i=this.suggestedListItems[this.getNodeIndex(t)],this.state.ddItemData=i,this.state.ddItemElm=t,t.classList.add(s),t.setAttribute("aria-selected",!0),e&&(t.parentNode.scrollTop=t.clientHeight+t.offsetTop-t.parentNode.clientHeight),this.settings.autoComplete&&(this.input.autocomplete.suggest.call(this,i),this.dropdown.position.call(this))},selectOption:function(t){var e=this,i=this.settings.dropdown,s=i.clearOnSelect,a=i.closeOnSelect;if(!t)return this.addTags(this.state.inputText,!0),void(a&&this.dropdown.hide.call(this));var n=t.getAttribute("tagifySuggestionIdx"),o=this.suggestedListItems[+n];if(this.trigger("dropdown:select",{data:o,elm:t}),n&&o){if(this.state.editing?this.onEditTagDone(null,d({__isValid:!0},o)):this["mix"==this.settings.mode?"addMixTags":"addTags"]([o],s),setTimeout((function(){e.DOM.input.focus(),e.toggleFocusClass(!0)})),a)return this.dropdown.hide.call(this);this.dropdown.refilter.call(this)}else this.dropdown.hide.call(this)},selectAll:function(){return this.suggestedListItems.length=0,this.dropdown.hide.call(this),this.addTags(this.dropdown.filterListItems.call(this,""),!0),this},filterListItems:function(t,e){var i,s,a,n,o,r=this,d=this.settings,h=d.dropdown,g=(e=e||{},[]),u=d.whitelist,p=h.maxItems||1/0,f=h.searchKeys,m=0;if(!t||!f.length)return(d.duplicates?u:u.filter((function(t){return!r.isTagDuplicate(l(t)?t.value:t)}))).slice(0,p);function v(t,e){return e.toLowerCase().split(" ").every((function(e){return t.includes(e.toLowerCase())}))}for(o=h.caseSensitive?""+t:(""+t).toLowerCase();m",' tagifySuggestionIdx="'.concat(i,'">'))})).join("")}},u={delimiters:",",pattern:null,tagTextProp:"value",maxTags:1/0,callbacks:{},addTagOnBlur:!0,duplicates:!1,whitelist:[],blacklist:[],enforceWhitelist:!1,keepInvalidTags:!1,mixTagsAllowedAfter:/,|\.|\:|\s/,mixTagsInterpolator:["[[","]]"],backspace:!0,skipInvalid:!1,editTags:{clicks:2,keepInvalid:!0},transformTag:function(){},trim:!0,mixMode:{insertAfterTag:" "},autoComplete:{enabled:!0,rightKey:!1},classNames:{namespace:"tagify",mixMode:"tagify--mix",selectMode:"tagify--select",input:"tagify__input",focus:"tagify--focus",tag:"tagify__tag",tagNoAnimation:"tagify--noAnim",tagInvalid:"tagify--invalid",tagNotAllowed:"tagify--notAllowed",inputInvalid:"tagify__input--invalid",tagX:"tagify__tag__removeBtn",tagText:"tagify__tag-text",dropdown:"tagify__dropdown",dropdownWrapper:"tagify__dropdown__wrapper",dropdownItem:"tagify__dropdown__item",dropdownItemActive:"tagify__dropdown__item--active",dropdownInital:"tagify__dropdown--initial",scopeLoading:"tagify--loading",tagLoading:"tagify__tag--loading",tagEditing:"tagify__tag--editable",tagFlash:"tagify__tag--flash",tagHide:"tagify__tag--hide",hasMaxTags:"tagify--hasMaxTags",hasNoTags:"tagify--noTags",empty:"tagify--empty"},dropdown:{classname:"",enabled:2,maxItems:10,searchKeys:["value","searchBy"],fuzzySearch:!0,caseSensitive:!1,accentedSearch:!0,highlightFirst:!1,closeOnSelect:!0,clearOnSelect:!0,position:"all",appendTarget:null},hooks:{beforeRemoveTag:function(){return Promise.resolve()},suggestionClick:function(){return Promise.resolve()}}};var p={customBinding:function(){var t=this;this.customEventsList.forEach((function(e){t.on(e,t.settings.callbacks[e])}))},binding:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=this.events.callbacks,s=e?"addEventListener":"removeEventListener";if(!this.state.mainEvents||!e)for(var a in this.state.mainEvents=e,e&&!this.listeners.main&&(this.DOM.input.addEventListener(this.isIE?"keydown":"input",i[this.isIE?"onInputIE":"onInput"].bind(this)),this.settings.isJQueryPlugin&&jQuery(this.DOM.originalInput).on("tagify.removeAllTags",this.removeAllTags.bind(this))),t=this.listeners.main=this.listeners.main||{focus:["input",i.onFocusBlur.bind(this)],blur:["input",i.onFocusBlur.bind(this)],keydown:["input",i.onKeydown.bind(this)],click:["scope",i.onClickScope.bind(this)],dblclick:["scope",i.onDoubleClickScope.bind(this)],paste:["input",i.onPaste.bind(this)]})("blur"!=a||e)&&this.DOM[t[a][0]][s](a,t[a][1])},callbacks:{onFocusBlur:function(t){var e=t.target?this.trim(t.target.textContent):"",i=this.settings,s=t.type,a=i.dropdown.enabled>=0,n={relatedTarget:t.relatedTarget},o=this.state.actions.selectOption&&(a||!i.dropdown.closeOnSelect),r=this.state.actions.addNew&&a;if("blur"==s){if(t.relatedTarget===this.DOM.scope)return this.dropdown.hide.call(this),void this.DOM.input.focus();this.postUpdate(),this.triggerChangeEvent()}if(!o&&!r)if(this.state.hasFocus="focus"==s&&+new Date,this.toggleFocusClass(this.state.hasFocus),"mix"!=i.mode){if("focus"==s)return this.trigger("focus",n),void(0===i.dropdown.enabled&&this.dropdown.show.call(this));"blur"==s&&(this.trigger("blur",n),this.loading(!1),("select"==this.settings.mode?!this.value.length||this.value[0].value!=e:e&&!this.state.actions.selectOption&&i.addTagOnBlur)&&this.addTags(e,!0)),this.DOM.input.removeAttribute("style"),this.dropdown.hide.call(this)}else"focus"==s?this.trigger("focus",n):"blur"==t.type&&(this.trigger("blur",n),this.loading(!1),this.dropdown.hide.call(this),this.state.dropdown.visible=void 0,this.setStateSelection())},onKeydown:function(t){var e=this,i=this.trim(t.target.textContent);if(this.trigger("keydown",{originalEvent:this.cloneEvent(t)}),"mix"==this.settings.mode){switch(t.key){case"Left":case"ArrowLeft":this.state.actions.ArrowLeft=!0;break;case"Delete":case"Backspace":if(this.state.editing)return;var s,o,r=document.getSelection(),l="Delete"==t.key&&r.anchorOffset==(r.anchorNode.length||0),d=1==r.anchorNode.nodeType||!r.anchorOffset&&r.anchorNode.previousElementSibling,c=a(this.DOM.input.innerHTML),g=this.getTagElms();if(h&&d)return o=n(d),d.hasAttribute("readonly")||d.remove(),this.DOM.input.focus(),void setTimeout((function(){e.placeCaretAfterNode(o),e.DOM.input.click()}));if("BR"==r.anchorNode.nodeName)return;if((l||d)&&1==r.anchorNode.nodeType?s=0==r.anchorOffset?l?g[0]:null:g[r.anchorOffset-1]:l?s=r.anchorNode.nextElementSibling:d&&(s=d),3==r.anchorNode.nodeType&&!r.anchorNode.nodeValue&&r.anchorNode.previousElementSibling&&t.preventDefault(),(d||l)&&!this.settings.backspace)return void t.preventDefault();if("Range"!=r.type&&!r.anchorOffset&&r.anchorNode==this.DOM.input&&"Delete"!=t.key)return void t.preventDefault();if("Range"!=r.type&&s&&s.hasAttribute("readonly"))return void this.placeCaretAfterNode(n(s));this.isFirefox&&1==r.anchorNode.nodeType&&0!=r.anchorOffset&&(this.removeTags(),this.placeCaretAfterNode(this.setRangeAtStartEnd())),setTimeout((function(){var t=document.getSelection(),i=a(e.DOM.input.innerHTML),s=t.anchorNode.previousElementSibling;if(!h&&i.length>=c.length&&s&&!s.hasAttribute("readonly")&&(e.removeTags(s),e.fixFirefoxLastTagNoCaret(),2==e.DOM.input.children.length&&"BR"==e.DOM.input.children[1].tagName))return e.DOM.input.innerHTML="",e.value.length=0,!0;e.value=[].map.call(g,(function(t,i){var s=e.tagData(t);if(t.parentNode||s.readonly)return s;e.trigger("remove",{tag:t,index:i,data:s})})).filter((function(t){return t}))}),50)}return!0}switch(t.key){case"Backspace":this.state.dropdown.visible&&"manual"!=this.settings.dropdown.position||""!=i&&8203!=i.charCodeAt(0)||(!0===this.settings.backspace?this.removeTags():"edit"==this.settings.backspace&&setTimeout(this.editTag.bind(this),0));break;case"Esc":case"Escape":if(this.state.dropdown.visible)return;t.target.blur();break;case"Down":case"ArrowDown":this.state.dropdown.visible||this.dropdown.show.call(this);break;case"ArrowRight":var u=this.state.inputSuggestion||this.state.ddItemData;if(u&&this.settings.autoComplete.rightKey)return void this.addTags([u],!0);break;case"Tab":var p="select"==this.settings.mode;if(!i||p)return!0;t.preventDefault();case"Enter":if(this.state.dropdown.visible||229==t.keyCode)return;t.preventDefault(),setTimeout((function(){e.state.actions.selectOption||e.addTags(i,!0)}))}},onInput:function(t){if("mix"==this.settings.mode)return this.events.callbacks.onMixTagsInput.call(this,t);var e=this.input.normalize.call(this),i=e.length>=this.settings.dropdown.enabled,s={value:e,inputElm:this.DOM.input};s.isValid=this.validateTag({value:e}),this.trigger("input",s),this.state.inputText!=e&&(this.input.set.call(this,e,!1),-1!=e.search(this.settings.delimiters)?this.addTags(e)&&this.input.set.call(this):this.settings.dropdown.enabled>=0&&this.dropdown[i?"show":"hide"].call(this,e))},onMixTagsInput:function(t){var e,i,s,a,n,o,r,l,c=this,g=this.settings,u=this.value.length,p=this.getTagElms(),f=document.createDocumentFragment(),m=window.getSelection().getRangeAt(0),v=[].map.call(p,(function(t){return c.tagData(t).value}));if("deleteContentBackward"==t.inputType&&h&&this.events.callbacks.onKeydown.call(this,{target:t.target,key:"Backspace"}),this.value.slice().forEach((function(t){t.readonly&&!v.includes(t.value)&&f.appendChild(c.createTagElem(t))})),f.childNodes.length&&(m.insertNode(f),this.setRangeAtStartEnd(!1,f.lastChild)),p.length!=u)return this.value=[].map.call(this.getTagElms(),(function(t){return c.tagData(t)})),void this.update({withoutChangeEvent:!0});if(this.hasMaxTags())return!0;if(window.getSelection&&(o=window.getSelection()).rangeCount>0&&3==o.anchorNode.nodeType){if((m=o.getRangeAt(0).cloneRange()).collapse(!0),m.setStart(o.focusNode,0),s=(e=m.toString().slice(0,m.endOffset)).split(g.pattern).length-1,(i=e.match(g.pattern))&&(a=e.slice(e.lastIndexOf(i[i.length-1]))),a){if(this.state.actions.ArrowLeft=!1,this.state.tag={prefix:a.match(g.pattern)[0],value:a.replace(g.pattern,"")},this.state.tag.baseOffset=o.baseOffset-this.state.tag.value.length,l=this.state.tag.value.match(g.delimiters))return this.state.tag.value=this.state.tag.value.replace(g.delimiters,""),this.state.tag.delimiters=l[0],this.addTags(this.state.tag.value,g.dropdown.clearOnSelect),void this.dropdown.hide.call(this);n=this.state.tag.value.length>=g.dropdown.enabled;try{r=(r=this.state.flaggedTags[this.state.tag.baseOffset]).prefix==this.state.tag.prefix&&r.value[0]==this.state.tag.value[0],this.state.flaggedTags[this.state.tag.baseOffset]&&!this.state.tag.value&&delete this.state.flaggedTags[this.state.tag.baseOffset]}catch(t){}(r||s500)?this.state.dropdown.visible?this.dropdown.hide.call(this):0===e.dropdown.enabled&&"mix"!=e.mode&&this.dropdown.show.call(this):"select"==e.mode&&!this.state.dropdown.visible&&this.dropdown.show.call(this));this.removeTags(t.target.parentNode)}else this.state.hasFocus||this.DOM.input.focus()},onPaste:function(t){var e;t.preventDefault(),this.settings.readonly||(e=(t.clipboardData||window.clipboardData).getData("Text"),this.injectAtCaret(e,window.getSelection().getRangeAt(0)),"mix"!=this.settings.mode&&this.addTags(this.DOM.input.textContent,!0))},onEditTagInput:function(t,i){var s=t.closest("."+this.settings.classNames.tag),a=this.getNodeIndex(s),n=this.tagData(s),o=this.input.normalize.call(this,t),r=s.innerHTML!=s.__tagifyTagData.__originalHTML,l=this.validateTag(e({},this.settings.tagTextProp,o));r||!0!==t.originalIsValid||(l=!0),s.classList.toggle(this.settings.classNames.tagInvalid,!0!==l),n.__isValid=l,s.title=!0===l?n.title||n.value:l,o.length>=this.settings.dropdown.enabled&&(this.state.editing&&(this.state.editing.value=o),this.dropdown.show.call(this,o)),this.trigger("edit:input",{tag:s,index:a,data:d({},this.value[a],{newValue:o}),originalEvent:this.cloneEvent(i)})},onEditTagFocus:function(t){this.state.editing={scope:t,input:t.querySelector("[contenteditable]")}},onEditTagBlur:function(t){var i;if(this.state.hasFocus||this.toggleFocusClass(),this.DOM.scope.contains(t)){var s,a=this.settings,n=t.closest("."+a.classNames.tag),o=this.input.normalize.call(this,t),r=this.tagData(n).__originalData,l=n.innerHTML!=n.__tagifyTagData.__originalHTML,d=this.validateTag(e({},a.tagTextProp,o));if(o)if(l){if(s=this.getWhitelistItem(o)||(e(i={},a.tagTextProp,o),e(i,"value",o),i),a.transformTag.call(this,s,r),!0!==(d=this.validateTag(e({},a.tagTextProp,s[a.tagTextProp])))){if(this.trigger("invalid",{data:s,tag:n,message:d}),a.editTags.keepInvalid)return;a.keepInvalidTags?s.__isValid=d:s=r}this.onEditTagDone(n,s)}else this.onEditTagDone(n,r);else this.onEditTagDone(n)}},onEditTagkeydown:function(t,e){switch(this.trigger("edit:keydown",{originalEvent:this.cloneEvent(t)}),t.key){case"Esc":case"Escape":e.innerHTML=e.__tagifyTagData.__originalHTML;case"Enter":case"Tab":t.preventDefault(),t.target.blur()}},onDoubleClickScope:function(t){var e,i,s=t.target.closest("."+this.settings.classNames.tag),a=this.settings;s&&(e=s.classList.contains(this.settings.classNames.tagEditing),i=s.hasAttribute("readonly"),"select"==a.mode||a.readonly||e||i||!this.settings.editTags||this.editTag(s),this.toggleFocusClass(!0),this.trigger("dblclick",{tag:s,index:this.getNodeIndex(s),data:this.tagData(s)}))}}};function f(e,i){return e?e.previousElementSibling&&e.previousElementSibling.classList.contains("tagify")?(console.warn("Tagify: ","input element is already Tagified",e),this):(d(this,function(e){var i=document.createTextNode("");function s(t,e,s){s&&e.split(/\s+/g).forEach((function(e){return i[t+"EventListener"].call(i,e,s)}))}return{off:function(t,e){return s("remove",t,e),this},on:function(t,e){return e&&"function"==typeof e&&s("add",t,e),this},trigger:function(s,a){var n;if(s)if(e.settings.isJQueryPlugin)"remove"==s&&(s="removeTag"),jQuery(e.DOM.originalInput).triggerHandler(s,[a]);else{try{var o=d({},"object"===t(a)?a:{value:a});if(o.tagify=this,a instanceof Object)for(var r in a)a[r]instanceof HTMLElement&&(o[r]=a[r]);n=new CustomEvent(s,{detail:o})}catch(t){console.warn(t)}i.dispatchEvent(n)}}}}(this)),this.isFirefox="undefined"!=typeof InstallTrigger,this.isIE=window.document.documentMode,this.applySettings(e,i||{}),this.state={inputText:"",editing:!1,actions:{},mixMode:{},dropdown:{},flaggedTags:{}},this.value=[],this.listeners={},this.DOM={},this.build(e),this.getCSSVars(),this.loadOriginalValues(),this.events.customBinding.call(this),this.events.binding.call(this),void(e.autofocus&&this.DOM.input.focus())):(console.warn("Tagify: ","input element not found",e),this)}return f.prototype={dropdown:g,TEXTS:{empty:"empty",exceed:"number of tags exceeded",pattern:"pattern mismatch",duplicate:"already exists",notAllowed:"not allowed"},customEventsList:["change","add","remove","invalid","input","click","keydown","focus","blur","edit:input","edit:updated","edit:start","edit:keydown","dropdown:show","dropdown:hide","dropdown:select","dropdown:updated","dropdown:noMatch"],trim:function(t){return this.settings.trim&&t&&"string"==typeof t?t.trim():t},parseHTML:function(t){return(new DOMParser).parseFromString(t.trim(),"text/html").body.firstElementChild},templates:{wrapper:function(t,e){return'\n \n ')},tag:function(t){return'\n \n
    \n ').concat(t[this.settings.tagTextProp]||t.value,"\n
    \n
    ")},dropdown:function(t){var e=t.dropdown,i="manual"==e.position,s="".concat(t.classNames.dropdown);return'
    \n
    \n
    ')},dropdownItem:function(t){return"
    ').concat(t.value,"
    ")},dropdownItemNoMatch:null},parseTemplate:function(t,e){return t=this.settings.templates[t]||t,this.parseHTML(t.apply(this,e))},applySettings:function(t,e){u.templates=this.templates;var i=this.settings=d({},u,e);if(i.readonly=t.hasAttribute("readonly"),i.placeholder=t.getAttribute("placeholder")||i.placeholder||"",i.required=t.hasAttribute("required"),this.isIE&&(i.autoComplete=!1),["whitelist","blacklist"].forEach((function(e){var s=t.getAttribute("data-"+e);s&&(s=s.split(i.delimiters))instanceof Array&&(i[e]=s)})),"autoComplete"in e&&!l(e.autoComplete)&&(i.autoComplete=u.autoComplete,i.autoComplete.enabled=e.autoComplete),"mix"==i.mode&&(i.autoComplete.rightKey=!0,i.delimiters=e.delimiters||null,i.tagTextProp&&!i.dropdown.searchKeys.includes(i.tagTextProp)&&i.dropdown.searchKeys.push(i.tagTextProp)),t.pattern)try{i.pattern=new RegExp(t.pattern)}catch(t){}if(this.settings.delimiters)try{i.delimiters=new RegExp(this.settings.delimiters,"g")}catch(t){}"select"==i.mode&&(i.dropdown.enabled=0),i.dropdown.appendTarget=e.dropdown&&e.dropdown.appendTarget?e.dropdown.appendTarget:document.body},getAttributes:function(t){if("[object Object]"!=Object.prototype.toString.call(t))return"";var e,i,s=Object.keys(t),a="";for(i=s.length;i--;)"class"!=(e=s[i])&&t.hasOwnProperty(e)&&void 0!==t[e]&&(a+=" "+e+(void 0!==t[e]?'="'.concat(t[e],'"'):""));return a},setStateSelection:function(){var t=window.getSelection(),e={anchorOffset:t.anchorOffset,anchorNode:t.anchorNode,range:t.getRangeAt&&t.rangeCount&&t.getRangeAt(0)};return this.state.selection=e,e},getCaretGlobalPosition:function(){var t=document.getSelection();if(t.rangeCount){var e,i,s=t.getRangeAt(0),a=s.startContainer,n=s.startOffset;if(n>0)return(i=document.createRange()).setStart(a,n-1),i.setEnd(a,n),{left:(e=i.getBoundingClientRect()).right,top:e.top,bottom:e.bottom};if(a.getBoundingClientRect)return a.getBoundingClientRect()}return{left:-9999,top:-9999}},getCSSVars:function(){var t,e=getComputedStyle(this.DOM.scope,null);this.CSSVars={tagHideTransition:function(t){var e=t.value;return"s"==t.unit?1e3*e:e}(function(t){if(!t)return{};var e=(t=t.trim().split(" ")[0]).split(/\d+/g).filter((function(t){return t})).pop().trim();return{value:+t.split(e).filter((function(t){return t}))[0].trim(),unit:e}}((t="tag-hide-transition",e.getPropertyValue("--"+t))))}},build:function(t){var e=this.DOM;this.settings.mixMode.integrated?(e.originalInput=null,e.scope=t,e.input=t):(e.originalInput=t,e.scope=this.parseTemplate("wrapper",[t,this.settings]),e.input=e.scope.querySelector("."+this.settings.classNames.input),t.parentNode.insertBefore(e.scope,t)),this.settings.dropdown.enabled>=0&&this.dropdown.init.call(this)},destroy:function(){this.DOM.scope.parentNode.removeChild(this.DOM.scope),this.dropdown.hide.call(this,!0),clearTimeout(this.dropdownHide__bindEventsTimeout)},loadOriginalValues:function(t){var e,i=this.settings;if(t=t||(i.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value))if(this.removeAllTags(),"mix"==i.mode)this.parseMixTags(t.trim()),(e=this.DOM.input.lastChild)&&"BR"==e.tagName||this.DOM.input.insertAdjacentHTML("beforeend","
    ");else{try{JSON.parse(t)instanceof Array&&(t=JSON.parse(t))}catch(t){}this.addTags(t).forEach((function(t){return t&&t.classList.add(i.classNames.tagNoAnimation)}))}else this.postUpdate();this.state.lastOriginalValueReported=i.mixMode.integrated?"":this.DOM.originalInput.value,this.state.loadedOriginalValues=!0},cloneEvent:function(t){var e={};for(var i in t)e[i]=t[i];return e},loading:function(t){return this.state.isLoading=t,this.DOM.scope.classList[t?"add":"remove"](this.settings.classNames.scopeLoading),this},tagLoading:function(t,e){return t&&t.classList[e?"add":"remove"](this.settings.classNames.tagLoading),this},toggleClass:function(t,e){"string"==typeof t&&this.DOM.scope.classList.toggle(t,e)},toggleFocusClass:function(t){this.toggleClass(this.settings.classNames.focus,!!t)},triggerChangeEvent:function(){if(!this.settings.mixMode.integrated){var t=this.DOM.originalInput,e=this.state.lastOriginalValueReported!==t.value,i=new CustomEvent("change",{bubbles:!0});e&&(this.state.lastOriginalValueReported=t.value,i.simulated=!0,t._valueTracker&&t._valueTracker.setValue(Math.random()),t.dispatchEvent(i),this.trigger("change",this.state.lastOriginalValueReported),t.value=this.state.lastOriginalValueReported)}},events:p,fixFirefoxLastTagNoCaret:function(){},placeCaretAfterNode:function(t){if(t&&t.parentNode){var e=t.nextSibling,i=window.getSelection(),s=i.getRangeAt(0);i.rangeCount&&(s.setStartBefore(e||t),s.setEndBefore(e||t),i.removeAllRanges(),i.addRange(s))}},insertAfterTag:function(t,e){if(e=e||this.settings.mixMode.insertAfterTag,t&&t.parentNode&&e)return e="string"==typeof e?document.createTextNode(e):e,t.parentNode.insertBefore(e,t.nextSibling),e},editTag:function(t,e){var i=this;t=t||this.getLastTag(),e=e||{},this.dropdown.hide.call(this);var s=this.settings;function a(){return t.querySelector("."+s.classNames.tagText)}var n=a(),o=this.getNodeIndex(t),r=this.tagData(t),l=this.events.callbacks,c=this,h=!0;if(n){if(!(r instanceof Object&&"editable"in r)||r.editable)return n.setAttribute("contenteditable",!0),t.classList.add(s.classNames.tagEditing),this.tagData(t,{__originalData:d({},r),__originalHTML:t.innerHTML}),n.addEventListener("focus",l.onEditTagFocus.bind(this,t)),n.addEventListener("blur",(function(){setTimeout((function(){return l.onEditTagBlur.call(c,a())}))})),n.addEventListener("input",l.onEditTagInput.bind(this,n)),n.addEventListener("keydown",(function(e){return l.onEditTagkeydown.call(i,e,t)})),n.focus(),this.setRangeAtStartEnd(!1,n),e.skipValidation||(h=this.editTagToggleValidity(t,r.value)),n.originalIsValid=h,this.trigger("edit:start",{tag:t,index:o,data:r,isValid:h}),this}else console.warn("Cannot find element in Tag template: .",s.classNames.tagText)},editTagToggleValidity:function(t,e){var i,s=this.tagData(t);if(s)return i=!(!s.__isValid||1==s.__isValid),t.classList.toggle(this.settings.classNames.tagInvalid,i),s.__isValid;console.warn("tag has no data: ",t,s)},onEditTagDone:function(t,e){e=e||{};var i={tag:t=t||this.state.editing.scope,index:this.getNodeIndex(t),previousData:this.tagData(t),data:e};this.trigger("edit:beforeUpdate",i),this.state.editing=!1,delete e.__originalData,delete e.__originalHTML,t&&e[this.settings.tagTextProp]?(this.editTagToggleValidity(t),this.replaceTag(t,e)):t&&this.removeTags(t),this.trigger("edit:updated",i),this.dropdown.hide.call(this),this.settings.keepInvalidTags&&this.reCheckInvalidTags()},replaceTag:function(t,e){e&&e.value||(e=t.__tagifyTagData),e.__isValid&&1!=e.__isValid&&d(e,this.getInvalidTagAttrs(e,e.__isValid));var i=this.createTagElem(e);t.parentNode.replaceChild(i,t),this.updateValueByDOMTags()},updateValueByDOMTags:function(){var t=this;this.value.length=0,[].forEach.call(this.getTagElms(),(function(e){e.classList.contains(t.settings.classNames.tagNotAllowed)||t.value.push(t.tagData(e))})),this.update()},setRangeAtStartEnd:function(t,e){t="number"==typeof t?t:!!t,e=(e=e||this.DOM.input).lastChild||e;var i=document.getSelection();try{i.rangeCount>=1&&["Start","End"].forEach((function(s){return i.getRangeAt(0)["set"+s](e,t||e.length)}))}catch(t){console.warn("Tagify: ",t)}},injectAtCaret:function(t,e){if(e=e||this.state.selection.range)return"string"==typeof t&&(t=document.createTextNode(t)),e.deleteContents(),e.insertNode(t),this.setRangeAtStartEnd(!1,t),this.updateValueByDOMTags(),this.update(),this},input:{set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.settings.dropdown.closeOnSelect;this.state.inputText=t,e&&(this.DOM.input.innerHTML=t),!t&&i&&this.dropdown.hide.bind(this),this.input.autocomplete.suggest.call(this),this.input.validate.call(this)},validate:function(){var t=!this.state.inputText||!0===this.validateTag({value:this.state.inputText});return this.DOM.input.classList.toggle(this.settings.classNames.inputInvalid,!t),t},normalize:function(t){var e=t||this.DOM.input,i=[];e.childNodes.forEach((function(t){return 3==t.nodeType&&i.push(t.nodeValue)})),i=i.join("\n");try{i=i.replace(/(?:\r\n|\r|\n)/g,this.settings.delimiters.source.charAt(0))}catch(t){}return i=i.replace(/\s/g," "),this.settings.trim&&(i=i.replace(/^\s+/,"")),i},autocomplete:{suggest:function(t){if(this.settings.autoComplete.enabled){"string"==typeof(t=t||{})&&(t={value:t});var e=t.value?""+t.value:"",i=e.substr(0,this.state.inputText.length).toLowerCase(),s=e.substring(this.state.inputText.length);e&&this.state.inputText&&i==this.state.inputText.toLowerCase()?(this.DOM.input.setAttribute("data-suggest",s),this.state.inputSuggestion=t):(this.DOM.input.removeAttribute("data-suggest"),delete this.state.inputSuggestion)}},set:function(t){var e=this.DOM.input.getAttribute("data-suggest"),i=t||(e?this.state.inputText+e:null);return!!i&&("mix"==this.settings.mode?this.replaceTextWithNode(document.createTextNode(this.state.tag.prefix+i)):(this.input.set.call(this,i),this.setRangeAtStartEnd()),this.input.autocomplete.suggest.call(this),this.dropdown.hide.call(this),!0)}}},getTagIdx:function(t){return this.value.findIndex((function(e){return e.value==t.value}))},getNodeIndex:function(t){var e=0;if(t)for(;t=t.previousElementSibling;)e++;return e},getTagElms:function(){for(var t=arguments.length,e=new Array(t),i=0;i=this.settings.maxTags&&this.TEXTS.exceed},setReadonly:function(t){var e=this.settings;document.activeElement.blur(),e.readonly=t,this.DOM.scope[(t?"set":"remove")+"Attribute"]("readonly",!0),"mix"==e.mode&&(this.DOM.input.contentEditable=!t)},normalizeTags:function(t){var s=this,a=this.settings,n=a.whitelist,o=a.delimiters,r=a.mode,l=a.tagTextProp,d=a.enforceWhitelist,c=[],h=!!n&&n[0]instanceof Object,g=t instanceof Array,u=function(t){return(t+"").split(o).filter((function(t){return t})).map((function(t){var i;return e(i={},l,s.trim(t)),e(i,"value",s.trim(t)),i}))};if("number"==typeof t&&(t=t.toString()),"string"==typeof t){if(!t.trim())return[];t=u(t)}else if(g){var p;t=(p=[]).concat.apply(p,i(t.map((function(t){return t.value?t:u(t)}))))}return h&&(t.forEach((function(t){var e=c.map((function(t){return t.value})),i=s.dropdown.filterListItems.call(s,t[l],{exact:!0}).filter((function(t){return!e.includes(t.value)})),a=i.length>1?s.getWhitelistItem(t[l],l,i):i[0];a&&a instanceof Object?c.push(a):"mix"==r||d||(null==t.value&&(t.value=t[l]),c.push(t))})),t=c),t},parseMixTags:function(t){var e=this,i=this.settings,s=i.mixTagsInterpolator,a=i.duplicates,n=i.transformTag,o=i.enforceWhitelist,r=i.maxTags,l=i.tagTextProp,d=[];return t=t.split(s[0]).map((function(t,i){var c,h,g,u=t.split(s[1]),p=u[0],f=d.length==r;try{if(p==+p)throw Error;h=JSON.parse(p)}catch(t){h=e.normalizeTags(p)[0]||{value:p}}if(f||!(u.length>1)||o&&!e.isTagWhitelisted(h.value)||!a&&e.isTagDuplicate(h.value)){if(t)return i?s[0]+t:t}else n.call(e,h),h[c=h[l]?l:"value"]=e.trim(h[c]),g=e.createTagElem(h),d.push(h),g.classList.add(e.settings.classNames.tagNoAnimation),u[0]=g.outerHTML,e.value.push(h);return u.join("")})).join(""),this.DOM.input.innerHTML=t,this.DOM.input.appendChild(document.createTextNode("")),this.DOM.input.normalize(),this.getTagElms().forEach((function(t,i){return e.tagData(t,d[i])})),this.update({withoutChangeEvent:!0}),t},replaceTextWithNode:function(t,e){if(this.state.tag||e){e=e||this.state.tag.prefix+this.state.tag.value;var i,s,a=window.getSelection(),n=a.anchorNode,o=this.state.tag.delimiters?this.state.tag.delimiters.length:0;return n.splitText(a.anchorOffset-o),i=n.nodeValue.lastIndexOf(e),s=n.splitText(i),t&&n.parentNode.replaceChild(t,s),!0}},selectTag:function(t,e){if(!this.settings.enforceWhitelist||this.isTagWhitelisted(e.value))return this.input.set.call(this,e.value,!0),this.state.actions.selectOption&&setTimeout(this.setRangeAtStartEnd.bind(this)),this.getLastTag()?this.replaceTag(this.getLastTag(),e):this.appendTag(t),this.value[0]=e,this.trigger("add",{tag:t,data:e}),this.update(),[t]},addEmptyTag:function(t){var e=d({value:""},t||{}),i=this.createTagElem(e);this.tagData(i,e),this.appendTag(i),this.editTag(i,{skipValidation:!0})},addTags:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.settings.skipInvalid,a=[],n=this.settings;return t&&0!=t.length?(t=this.normalizeTags(t),"mix"==n.mode?this.addMixTags(t):("select"==n.mode&&(e=!1),this.DOM.input.removeAttribute("style"),t.forEach((function(t){var e,o={},r=Object.assign({},t,{value:t.value+""});if((t=Object.assign({},r)).__isValid=i.hasMaxTags()||i.validateTag(t),n.transformTag.call(i,t),!0!==t.__isValid){if(s)return;d(o,i.getInvalidTagAttrs(t,t.__isValid),{__preInvalidData:r}),t.__isValid==i.TEXTS.duplicate&&i.flashTag(i.getTagElmByValue(t.value))}if(t.readonly&&(o["aria-readonly"]=!0),e=i.createTagElem(d({},t,o)),a.push(e),"select"==n.mode)return i.selectTag(e,t);i.appendTag(e),t.__isValid&&!0===t.__isValid?(i.value.push(t),i.update(),i.trigger("add",{tag:e,index:i.value.length-1,data:t})):(i.trigger("invalid",{data:t,index:i.value.length,tag:e,message:t.__isValid}),n.keepInvalidTags||setTimeout((function(){return i.removeTags(e,!0)}),1e3)),i.dropdown.position.call(i)})),t.length&&e&&this.input.set.call(this),this.dropdown.refilter.call(this),a)):("select"==n.mode&&this.removeAllTags(),a)},addMixTags:function(t){var e=this;if(t[0].prefix||this.state.tag)this.prefixedTextToTag(t[0]);else{"string"==typeof t&&(t=[{value:t}]);var i=!!this.state.selection,s=document.createDocumentFragment();t.forEach((function(t){var i=e.createTagElem(t);s.appendChild(i),e.insertAfterTag(i)})),i?this.injectAtCaret(s):(this.DOM.input.focus(),(i=this.setStateSelection()).range.setStart(this.DOM.input,i.range.endOffset),i.range.setEnd(this.DOM.input,i.range.endOffset),this.DOM.input.appendChild(s),this.updateValueByDOMTags(),this.update())}},prefixedTextToTag:function(t){var e,i=this,s=this.settings,a=this.state.tag.delimiters;if(s.transformTag.call(this,t),t.prefix=t.prefix||this.state.tag?this.state.tag.prefix:(s.pattern.source||s.pattern)[0],e=this.createTagElem(t),this.replaceTextWithNode(e)||this.DOM.input.appendChild(e),setTimeout((function(){return e.classList.add(i.settings.classNames.tagNoAnimation)}),300),this.value.push(t),this.update(),!a){var n=this.insertAfterTag(e)||e;this.placeCaretAfterNode(n)}return this.state.tag=null,this.trigger("add",d({},{tag:e},{data:t})),e},appendTag:function(t){var e=this.DOM.scope.lastElementChild;e===this.DOM.input?this.DOM.scope.insertBefore(t,e):this.DOM.scope.appendChild(t)},createTagElem:function(t){var e,i=d({},t,{value:o(t.value+"")});return function(t){for(var e,i=document.createNodeIterator(t,NodeFilter.SHOW_TEXT,null,!1);e=i.nextNode();)e.textContent.trim()||e.parentNode.removeChild(e)}(e=this.parseTemplate("tag",[i])),this.tagData(e,t),e},reCheckInvalidTags:function(){var t=this,e=this.settings,i=".".concat(e.classNames.tag,".").concat(e.classNames.tagNotAllowed),s=this.DOM.scope.querySelectorAll(i);[].forEach.call(s,(function(e){var i=t.tagData(e),s=e.getAttribute("title")==t.TEXTS.duplicate,a=!0===t.validateTag(i);s&&a&&(i=i.__preInvalidData?i.__preInvalidData:{value:i.value},t.replaceTag(e,i))}))},removeTags:function(t,e,i){var s,a=this;t=t&&t instanceof HTMLElement?[t]:t instanceof Array?t:t?[t]:[this.getLastTag()],s=t.reduce((function(t,e){return e&&"string"==typeof e&&(e=a.getTagElmByValue(e)),e&&t.push({node:e,idx:a.getTagIdx(a.tagData(e)),data:a.tagData(e,{__removed:!0})}),t}),[]),i="number"==typeof i?i:this.CSSVars.tagHideTransition,"select"==this.settings.mode&&(i=0,this.input.set.call(this)),1==s.length&&s[0].node.classList.contains(this.settings.classNames.tagNotAllowed)&&(e=!0),s.length&&this.settings.hooks.beforeRemoveTag(s,{tagify:this}).then((function(){function t(t){t.node.parentNode&&(t.node.parentNode.removeChild(t.node),e?this.settings.keepInvalidTags&&this.trigger("remove",{tag:t.node,index:t.idx}):(this.trigger("remove",{tag:t.node,index:t.idx,data:t.data}),this.dropdown.refilter.call(this),this.dropdown.position.call(this),this.DOM.input.normalize(),this.settings.keepInvalidTags&&this.reCheckInvalidTags()))}i&&i>10&&1==s.length?function(e){e.node.style.width=parseFloat(window.getComputedStyle(e.node).width)+"px",document.body.clientTop,e.node.classList.add(this.settings.classNames.tagHide),setTimeout(t.bind(this),i,e)}.call(a,s[0]):s.forEach(t.bind(a)),e||(s.forEach((function(t){var e=Object.assign({},t.data);delete e.__removed;var i=a.getTagIdx(e);i>-1&&a.value.splice(i,1)})),a.update())})).catch((function(t){}))},removeAllTags:function(){this.value=[],"mix"==this.settings.mode?this.DOM.input.innerHTML="":Array.prototype.slice.call(this.getTagElms()).forEach((function(t){return t.parentNode.removeChild(t)})),this.dropdown.position.call(this),"select"==this.settings.mode&&this.input.set.call(this),this.update()},postUpdate:function(){var t=this.settings.classNames,e="mix"==this.settings.mode?this.settings.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value:this.value.length;this.toggleClass(t.hasMaxTags,this.value.length>=this.settings.maxTags),this.toggleClass(t.hasNoTags,!this.value.length),this.toggleClass(t.empty,!e)},update:function(t){var e,i,s=this.DOM.originalInput,a=(t||{}).withoutChangeEvent,n=(e=this.value,i=["__isValid","__removed"],e.map((function(t){var e={};for(var s in t)i.indexOf(s)<0&&(e[s]=t[s]);return e})));this.settings.mixMode.integrated||(s.value="mix"==this.settings.mode?this.getMixedTagsAsString(n):n.length?this.settings.originalInputValueFormat?this.settings.originalInputValueFormat(n):JSON.stringify(n):""),this.postUpdate(),!a&&this.state.loadedOriginalValues&&this.triggerChangeEvent()},getMixedTagsAsString:function(){var t="",e=this,i=this.settings.mixTagsInterpolator;return function s(a){a.childNodes.forEach((function(a){if(1==a.nodeType){if(a.classList.contains(e.settings.classNames.tag)&&e.tagData(a)){if(e.tagData(a).__removed)return;return void(t+=i[0]+JSON.stringify(a.__tagifyTagData)+i[1])}"BR"!=a.tagName||a.parentNode!=e.DOM.input&&1!=a.parentNode.childNodes.length?"DIV"!=a.tagName&&"P"!=a.tagName||(t+="\r\n",s(a)):t+="\r\n"}else t+=a.textContent}))}(this.DOM.input),t}},f.prototype.removeTag=f.prototype.removeTags,f})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Tagify=e()}(this,(function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function i(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e/g,">").replace(/"/g,""").replace(/`|'/g,"'")}function r(t){return t instanceof Array}function l(t){var e=Object.prototype.toString.call(t).split(" ")[1].slice(0,-1);return t===Object(t)&&"Array"!=e&&"Function"!=e&&"RegExp"!=e&&"HTMLUnknownElement"!=e}function d(t,e,i){function s(t,e){for(var i in e)if(e.hasOwnProperty(i)){if(l(e[i])){l(t[i])?s(t[i],e[i]):t[i]=Object.assign({},e[i]);continue}if(r(e[i])){t[i]=Object.assign([],e[i]);continue}t[i]=e[i]}}return t instanceof Object||(t={}),s(t,e),i&&s(t,i),t}function c(t){return String.prototype.normalize?"string"==typeof t?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):void 0:t}var h=/(?=.*chrome)(?=.*android)/i.test(navigator.userAgent),g={init:function(){this.DOM.dropdown=this.parseTemplate("dropdown",[this.settings]),this.DOM.dropdown.content=this.DOM.dropdown.querySelector(this.settings.classNames.dropdownWrapperSelector)},show:function(t){var e,i,a,n=this,o=this.settings,r=window.getSelection(),d="mix"==o.mode&&!o.enforceWhitelist,c=!o.whitelist||!o.whitelist.length,h="manual"==o.dropdown.position;if(t=void 0===t?this.state.inputText:t,(!c||d||o.templates.dropdownItemNoMatch)&&!1!==o.dropdown.enable&&!this.state.isLoading){if(clearTimeout(this.dropdownHide__bindEventsTimeout),this.suggestedListItems=this.dropdown.filterListItems.call(this,t),t&&!this.suggestedListItems.length&&(this.trigger("dropdown:noMatch",t),o.templates.dropdownItemNoMatch&&(a=o.templates.dropdownItemNoMatch.call(this,{value:t}))),!a){if(this.suggestedListItems.length)t&&d&&!this.state.editing.scope&&!s(this.suggestedListItems[0].value,t)&&this.suggestedListItems.unshift({value:t});else{if(!t||!d||this.state.editing.scope)return this.input.autocomplete.suggest.call(this),void this.dropdown.hide.call(this);this.suggestedListItems=[{value:t}]}i=""+(l(e=this.suggestedListItems[0])?e.value:e),o.autoComplete&&i&&0==i.indexOf(t)&&this.input.autocomplete.suggest.call(this,e)}this.dropdown.fill.call(this,a),o.dropdown.highlightFirst&&this.dropdown.highlightOption.call(this,this.DOM.dropdown.content.children[0]),this.state.dropdown.visible||setTimeout(this.dropdown.events.binding.bind(this)),this.state.dropdown.visible=t||!0,this.state.dropdown.query=t,this.state.selection={anchorOffset:r.anchorOffset,anchorNode:r.anchorNode},h||setTimeout((function(){n.dropdown.position.call(n),n.dropdown.render.call(n)})),setTimeout((function(){n.trigger("dropdown:show",n.DOM.dropdown)}))}},hide:function(t){var e=this,i=this.DOM,s=i.scope,a=i.dropdown,n="manual"==this.settings.dropdown.position&&!t;if(a&&document.body.contains(a)&&!n)return window.removeEventListener("resize",this.dropdown.position),this.dropdown.events.binding.call(this,!1),s.setAttribute("aria-expanded",!1),a.parentNode.removeChild(a),setTimeout((function(){e.state.dropdown.visible=!1}),100),this.state.dropdown.query=this.state.ddItemData=this.state.ddItemElm=this.state.selection=null,this.state.tag&&this.state.tag.value.length&&(this.state.flaggedTags[this.state.tag.baseOffset]=this.state.tag),this.trigger("dropdown:hide",a),this},render:function(){var t,e,i,s=this,a=(t=this.DOM.dropdown,(i=t.cloneNode(!0)).style.cssText="position:fixed; top:-9999px; opacity:0",document.body.appendChild(i),e=i.clientHeight,i.parentNode.removeChild(i),e),n=this.settings;return this.DOM.scope.setAttribute("aria-expanded",!0),document.body.contains(this.DOM.dropdown)||(this.DOM.dropdown.classList.add(n.classNames.dropdownInital),this.dropdown.position.call(this,a),n.dropdown.appendTarget.appendChild(this.DOM.dropdown),setTimeout((function(){return s.DOM.dropdown.classList.remove(n.classNames.dropdownInital)}))),this},fill:function(t){var e;t="string"==typeof t?t:this.dropdown.createListHTML.call(this,t||this.suggestedListItems),this.DOM.dropdown.content.innerHTML=(e=t)?e.replace(/\>[\r\n ]+\<").replace(/(<.*?>)|\s+/g,(function(t,e){return e||" "})):""},refilter:function(t){t=t||this.state.dropdown.query||"",this.suggestedListItems=this.dropdown.filterListItems.call(this,t),this.dropdown.fill.call(this),this.suggestedListItems.length||this.dropdown.hide.call(this),this.trigger("dropdown:updated",this.DOM.dropdown)},position:function(t){if("manual"!=this.settings.dropdown.position){var e,i,s,a,n,o,r,l=this.DOM.dropdown,d=document.documentElement.clientHeight,c=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)>480?this.settings.dropdown.position:"all",h=this.DOM["input"==c?"input":"scope"];t=t||l.clientHeight,this.state.dropdown.visible&&("text"==c?(a=(i=this.getCaretGlobalPosition()).bottom,s=i.top,n=i.left,o="auto"):(r=function(t){for(var e=0,i=0;t;)e+=t.offsetLeft||0,i+=t.offsetTop||0,t=t.parentNode;return{left:e,top:i}}(this.settings.dropdown.appendTarget),s=(i=h.getBoundingClientRect()).top+2-r.top,a=i.bottom-1-r.top,n=i.left-r.left,o=i.width+"px"),s=Math.floor(s),a=Math.ceil(a),e=d-i.bottom0&&void 0!==arguments[0])||arguments[0],e=this.dropdown.events.callbacks,i=this.listeners.dropdown=this.listeners.dropdown||{position:this.dropdown.position.bind(this),onKeyDown:e.onKeyDown.bind(this),onMouseOver:e.onMouseOver.bind(this),onMouseLeave:e.onMouseLeave.bind(this),onClick:e.onClick.bind(this),onScroll:e.onScroll.bind(this)},s=t?"addEventListener":"removeEventListener";"manual"!=this.settings.dropdown.position&&(window[s]("resize",i.position),window[s]("keydown",i.onKeyDown)),this.DOM.dropdown[s]("mouseover",i.onMouseOver),this.DOM.dropdown[s]("mouseleave",i.onMouseLeave),this.DOM.dropdown[s]("mousedown",i.onClick),this.DOM.dropdown.content[s]("scroll",i.onScroll)},callbacks:{onKeyDown:function(t){var e=this.DOM.dropdown.querySelector(this.settings.classNames.dropdownItemActiveSelector),i=e;switch(t.key){case"ArrowDown":case"ArrowUp":case"Down":case"Up":var s;t.preventDefault(),i&&(i=i[("ArrowUp"==t.key||"Up"==t.key?"previous":"next")+"ElementSibling"]),i||(i=(s=this.DOM.dropdown.content.children)["ArrowUp"==t.key||"Up"==t.key?s.length-1:0]),this.dropdown.highlightOption.call(this,i,!0);break;case"Escape":case"Esc":this.dropdown.hide.call(this);break;case"ArrowRight":if(this.state.actions.ArrowLeft)return;case"Tab":if("mix"!=this.settings.mode&&i&&!this.settings.autoComplete.rightKey&&!this.state.editing){t.preventDefault();var a=i.getAttribute("tagifySuggestionIdx"),n=a?this.suggestedListItems[+a]:"",o=this.dropdown.getMappedValue.call(this,n);return this.input.autocomplete.set.call(this,o),!1}return!0;case"Enter":t.preventDefault(),this.dropdown.selectOption.call(this,e);break;case"Backspace":if("mix"==this.settings.mode||this.state.editing.scope)return;var r=this.state.inputText.trim();""!=r&&8203!=r.charCodeAt(0)||(!0===this.settings.backspace?this.removeTags():"edit"==this.settings.backspace&&setTimeout(this.editTag.bind(this),0))}},onMouseOver:function(t){var e=t.target.closest(this.settings.classNames.dropdownItemSelector);e&&this.dropdown.highlightOption.call(this,e)},onMouseLeave:function(t){this.dropdown.highlightOption.call(this)},onClick:function(t){var e=this;if(0==t.button&&t.target!=this.DOM.dropdown&&t.target!=this.DOM.dropdown.content){var i=t.target.closest(this.settings.classNames.dropdownItemSelector);this.state.actions.selectOption=!0,setTimeout((function(){return e.state.actions.selectOption=!1}),50),this.settings.hooks.suggestionClick(t,{tagify:this,suggestionElm:i}).then((function(){i?e.dropdown.selectOption.call(e,i):e.dropdown.hide.call(e)})).catch((function(t){return t}))}},onScroll:function(t){var e=t.target,i=e.scrollTop/(e.scrollHeight-e.parentNode.clientHeight)*100;this.trigger("dropdown:scroll",{percentage:Math.round(i)})}}},highlightOption:function(t,e){var i,s=this.settings.classNames.dropdownItemActive;if(this.state.ddItemElm&&(this.state.ddItemElm.classList.remove(s),this.state.ddItemElm.removeAttribute("aria-selected")),!t)return this.state.ddItemData=null,this.state.ddItemElm=null,void this.input.autocomplete.suggest.call(this);i=this.suggestedListItems[this.getNodeIndex(t)],this.state.ddItemData=i,this.state.ddItemElm=t,t.classList.add(s),t.setAttribute("aria-selected",!0),e&&(t.parentNode.scrollTop=t.clientHeight+t.offsetTop-t.parentNode.clientHeight),this.settings.autoComplete&&(this.input.autocomplete.suggest.call(this,i),this.dropdown.position.call(this))},selectOption:function(t){var e=this,i=this.settings.dropdown,s=i.clearOnSelect,a=i.closeOnSelect;if(!t)return this.addTags(this.state.inputText,!0),void(a&&this.dropdown.hide.call(this));var n=t.getAttribute("tagifySuggestionIdx"),o=this.suggestedListItems[+n];if(this.trigger("dropdown:select",{data:o,elm:t}),n&&o){if(this.state.editing?this.onEditTagDone(null,d({__isValid:!0},o)):this["mix"==this.settings.mode?"addMixTags":"addTags"]([o],s),setTimeout((function(){e.DOM.input.focus(),e.toggleFocusClass(!0)})),a)return this.dropdown.hide.call(this);this.dropdown.refilter.call(this)}else this.dropdown.hide.call(this)},selectAll:function(){return this.suggestedListItems.length=0,this.dropdown.hide.call(this),this.addTags(this.dropdown.filterListItems.call(this,""),!0),this},filterListItems:function(t,e){var i,s,a,n,o,r=this,d=this.settings,h=d.dropdown,g=(e=e||{},[]),u=d.whitelist,p=h.maxItems||1/0,f=h.searchKeys,m=0;if(!t||!f.length)return(d.duplicates?u:u.filter((function(t){return!r.isTagDuplicate(l(t)?t.value:t)}))).slice(0,p);function v(t,e){return e.toLowerCase().split(" ").every((function(e){return t.includes(e.toLowerCase())}))}for(o=h.caseSensitive?""+t:(""+t).toLowerCase();m",' tagifySuggestionIdx="'.concat(i,'">'))})).join("")}},u={delimiters:",",pattern:null,tagTextProp:"value",maxTags:1/0,callbacks:{},addTagOnBlur:!0,duplicates:!1,whitelist:[],blacklist:[],enforceWhitelist:!1,keepInvalidTags:!1,mixTagsAllowedAfter:/,|\.|\:|\s/,mixTagsInterpolator:["[[","]]"],backspace:!0,skipInvalid:!1,editTags:{clicks:2,keepInvalid:!0},transformTag:function(){},trim:!0,mixMode:{insertAfterTag:" "},autoComplete:{enabled:!0,rightKey:!1},classNames:{namespace:"tagify",mixMode:"tagify--mix",selectMode:"tagify--select",input:"tagify__input",focus:"tagify--focus",tag:"tagify__tag",tagNoAnimation:"tagify--noAnim",tagInvalid:"tagify--invalid",tagNotAllowed:"tagify--notAllowed",inputInvalid:"tagify__input--invalid",tagX:"tagify__tag__removeBtn",tagText:"tagify__tag-text",dropdown:"tagify__dropdown",dropdownWrapper:"tagify__dropdown__wrapper",dropdownItem:"tagify__dropdown__item",dropdownItemActive:"tagify__dropdown__item--active",dropdownInital:"tagify__dropdown--initial",scopeLoading:"tagify--loading",tagLoading:"tagify__tag--loading",tagEditing:"tagify__tag--editable",tagFlash:"tagify__tag--flash",tagHide:"tagify__tag--hide",hasMaxTags:"tagify--hasMaxTags",hasNoTags:"tagify--noTags",empty:"tagify--empty"},dropdown:{classname:"",enabled:2,maxItems:10,searchKeys:["value","searchBy"],fuzzySearch:!0,caseSensitive:!1,accentedSearch:!0,highlightFirst:!1,closeOnSelect:!0,clearOnSelect:!0,position:"all",appendTarget:null},hooks:{beforeRemoveTag:function(){return Promise.resolve()},suggestionClick:function(){return Promise.resolve()}}};var p={customBinding:function(){var t=this;this.customEventsList.forEach((function(e){t.on(e,t.settings.callbacks[e])}))},binding:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=this.events.callbacks,s=e?"addEventListener":"removeEventListener";if(!this.state.mainEvents||!e)for(var a in this.state.mainEvents=e,e&&!this.listeners.main&&(this.DOM.input.addEventListener(this.isIE?"keydown":"input",i[this.isIE?"onInputIE":"onInput"].bind(this)),this.settings.isJQueryPlugin&&jQuery(this.DOM.originalInput).on("tagify.removeAllTags",this.removeAllTags.bind(this))),t=this.listeners.main=this.listeners.main||{focus:["input",i.onFocusBlur.bind(this)],blur:["input",i.onFocusBlur.bind(this)],keydown:["input",i.onKeydown.bind(this)],click:["scope",i.onClickScope.bind(this)],dblclick:["scope",i.onDoubleClickScope.bind(this)],paste:["input",i.onPaste.bind(this)]})("blur"!=a||e)&&this.DOM[t[a][0]][s](a,t[a][1])},callbacks:{onFocusBlur:function(t){var e=t.target?this.trim(t.target.textContent):"",i=this.settings,s=t.type,a=i.dropdown.enabled>=0,n={relatedTarget:t.relatedTarget},o=this.state.actions.selectOption&&(a||!i.dropdown.closeOnSelect),r=this.state.actions.addNew&&a;if("blur"==s){if(t.relatedTarget===this.DOM.scope)return this.dropdown.hide.call(this),void this.DOM.input.focus();this.postUpdate(),this.triggerChangeEvent()}if(!o&&!r)if(this.state.hasFocus="focus"==s&&+new Date,this.toggleFocusClass(this.state.hasFocus),"mix"!=i.mode){if("focus"==s)return this.trigger("focus",n),void(0===i.dropdown.enabled&&this.dropdown.show.call(this));"blur"==s&&(this.trigger("blur",n),this.loading(!1),("select"==this.settings.mode?!this.value.length||this.value[0].value!=e:e&&!this.state.actions.selectOption&&i.addTagOnBlur)&&this.addTags(e,!0)),this.DOM.input.removeAttribute("style"),this.dropdown.hide.call(this)}else"focus"==s?this.trigger("focus",n):"blur"==t.type&&(this.trigger("blur",n),this.loading(!1),this.dropdown.hide.call(this),this.state.dropdown.visible=void 0,this.setStateSelection())},onKeydown:function(t){var e=this,i=this.trim(t.target.textContent);if(this.trigger("keydown",{originalEvent:this.cloneEvent(t)}),"mix"==this.settings.mode){switch(t.key){case"Left":case"ArrowLeft":this.state.actions.ArrowLeft=!0;break;case"Delete":case"Backspace":if(this.state.editing)return;var s,o,r=document.getSelection(),l="Delete"==t.key&&r.anchorOffset==(r.anchorNode.length||0),d=1==r.anchorNode.nodeType||!r.anchorOffset&&r.anchorNode.previousElementSibling,c=a(this.DOM.input.innerHTML),g=this.getTagElms();if(h&&d)return o=n(d),d.hasAttribute("readonly")||d.remove(),this.DOM.input.focus(),void setTimeout((function(){e.placeCaretAfterNode(o),e.DOM.input.click()}));if("BR"==r.anchorNode.nodeName)return;if((l||d)&&1==r.anchorNode.nodeType?s=0==r.anchorOffset?l?g[0]:null:g[r.anchorOffset-1]:l?s=r.anchorNode.nextElementSibling:d&&(s=d),3==r.anchorNode.nodeType&&!r.anchorNode.nodeValue&&r.anchorNode.previousElementSibling&&t.preventDefault(),(d||l)&&!this.settings.backspace)return void t.preventDefault();if("Range"!=r.type&&!r.anchorOffset&&r.anchorNode==this.DOM.input&&"Delete"!=t.key)return void t.preventDefault();if("Range"!=r.type&&s&&s.hasAttribute("readonly"))return void this.placeCaretAfterNode(n(s));this.isFirefox&&1==r.anchorNode.nodeType&&0!=r.anchorOffset&&(this.removeTags(),this.placeCaretAfterNode(this.setRangeAtStartEnd())),setTimeout((function(){var t=document.getSelection(),i=a(e.DOM.input.innerHTML),s=t.anchorNode.previousElementSibling;if(!h&&i.length>=c.length&&s&&!s.hasAttribute("readonly")&&(e.removeTags(s),e.fixFirefoxLastTagNoCaret(),2==e.DOM.input.children.length&&"BR"==e.DOM.input.children[1].tagName))return e.DOM.input.innerHTML="",e.value.length=0,!0;e.value=[].map.call(g,(function(t,i){var s=e.tagData(t);if(t.parentNode||s.readonly)return s;e.trigger("remove",{tag:t,index:i,data:s})})).filter((function(t){return t}))}),50)}return!0}switch(t.key){case"Backspace":this.state.dropdown.visible&&"manual"!=this.settings.dropdown.position||""!=i&&8203!=i.charCodeAt(0)||(!0===this.settings.backspace?this.removeTags():"edit"==this.settings.backspace&&setTimeout(this.editTag.bind(this),0));break;case"Esc":case"Escape":if(this.state.dropdown.visible)return;t.target.blur();break;case"Down":case"ArrowDown":this.state.dropdown.visible||this.dropdown.show.call(this);break;case"ArrowRight":var u=this.state.inputSuggestion||this.state.ddItemData;if(u&&this.settings.autoComplete.rightKey)return void this.addTags([u],!0);break;case"Tab":var p="select"==this.settings.mode;if(!i||p)return!0;t.preventDefault();case"Enter":if(this.state.dropdown.visible||229==t.keyCode)return;t.preventDefault(),setTimeout((function(){e.state.actions.selectOption||e.addTags(i,!0)}))}},onInput:function(t){if("mix"==this.settings.mode)return this.events.callbacks.onMixTagsInput.call(this,t);var e=this.input.normalize.call(this),i=e.length>=this.settings.dropdown.enabled,s={value:e,inputElm:this.DOM.input};s.isValid=this.validateTag({value:e}),this.trigger("input",s),this.state.inputText!=e&&(this.input.set.call(this,e,!1),-1!=e.search(this.settings.delimiters)?this.addTags(e)&&this.input.set.call(this):this.settings.dropdown.enabled>=0&&this.dropdown[i?"show":"hide"].call(this,e))},onMixTagsInput:function(t){var e,i,s,a,n,o,r,l,c=this,g=this.settings,u=this.value.length,p=this.getTagElms(),f=document.createDocumentFragment(),m=window.getSelection().getRangeAt(0),v=[].map.call(p,(function(t){return c.tagData(t).value}));if("deleteContentBackward"==t.inputType&&h&&this.events.callbacks.onKeydown.call(this,{target:t.target,key:"Backspace"}),this.value.slice().forEach((function(t){t.readonly&&!v.includes(t.value)&&f.appendChild(c.createTagElem(t))})),f.childNodes.length&&(m.insertNode(f),this.setRangeAtStartEnd(!1,f.lastChild)),p.length!=u)return this.value=[].map.call(this.getTagElms(),(function(t){return c.tagData(t)})),void this.update({withoutChangeEvent:!0});if(this.hasMaxTags())return!0;if(window.getSelection&&(o=window.getSelection()).rangeCount>0&&3==o.anchorNode.nodeType){if((m=o.getRangeAt(0).cloneRange()).collapse(!0),m.setStart(o.focusNode,0),s=(e=m.toString().slice(0,m.endOffset)).split(g.pattern).length-1,(i=e.match(g.pattern))&&(a=e.slice(e.lastIndexOf(i[i.length-1]))),a){if(this.state.actions.ArrowLeft=!1,this.state.tag={prefix:a.match(g.pattern)[0],value:a.replace(g.pattern,"")},this.state.tag.baseOffset=o.baseOffset-this.state.tag.value.length,l=this.state.tag.value.match(g.delimiters))return this.state.tag.value=this.state.tag.value.replace(g.delimiters,""),this.state.tag.delimiters=l[0],this.addTags(this.state.tag.value,g.dropdown.clearOnSelect),void this.dropdown.hide.call(this);n=this.state.tag.value.length>=g.dropdown.enabled;try{r=(r=this.state.flaggedTags[this.state.tag.baseOffset]).prefix==this.state.tag.prefix&&r.value[0]==this.state.tag.value[0],this.state.flaggedTags[this.state.tag.baseOffset]&&!this.state.tag.value&&delete this.state.flaggedTags[this.state.tag.baseOffset]}catch(t){}(r||s500)?this.state.dropdown.visible?this.dropdown.hide.call(this):0===e.dropdown.enabled&&"mix"!=e.mode&&this.dropdown.show.call(this):"select"==e.mode&&!this.state.dropdown.visible&&this.dropdown.show.call(this));this.removeTags(t.target.parentNode)}else this.state.hasFocus||this.DOM.input.focus()},onPaste:function(t){var e;t.preventDefault(),this.settings.readonly||(e=(t.clipboardData||window.clipboardData).getData("Text"),this.injectAtCaret(e,window.getSelection().getRangeAt(0)),"mix"!=this.settings.mode&&this.addTags(this.DOM.input.textContent,!0))},onEditTagInput:function(t,i){var s=t.closest("."+this.settings.classNames.tag),a=this.getNodeIndex(s),n=this.tagData(s),o=this.input.normalize.call(this,t),r=s.innerHTML!=s.__tagifyTagData.__originalHTML,l=this.validateTag(e({},this.settings.tagTextProp,o));r||!0!==t.originalIsValid||(l=!0),s.classList.toggle(this.settings.classNames.tagInvalid,!0!==l),n.__isValid=l,s.title=!0===l?n.title||n.value:l,o.length>=this.settings.dropdown.enabled&&(this.state.editing&&(this.state.editing.value=o),this.dropdown.show.call(this,o)),this.trigger("edit:input",{tag:s,index:a,data:d({},this.value[a],{newValue:o}),originalEvent:this.cloneEvent(i)})},onEditTagFocus:function(t){this.state.editing={scope:t,input:t.querySelector("[contenteditable]")}},onEditTagBlur:function(t){var i;if(this.state.hasFocus||this.toggleFocusClass(),this.DOM.scope.contains(t)){var s,a=this.settings,n=t.closest("."+a.classNames.tag),o=this.input.normalize.call(this,t),r=this.tagData(n).__originalData,l=n.innerHTML!=n.__tagifyTagData.__originalHTML,d=this.validateTag(e({},a.tagTextProp,o));if(o)if(l){if(s=this.getWhitelistItem(o)||(e(i={},a.tagTextProp,o),e(i,"value",o),i),a.transformTag.call(this,s,r),!0!==(d=this.validateTag(e({},a.tagTextProp,s[a.tagTextProp])))){if(this.trigger("invalid",{data:s,tag:n,message:d}),a.editTags.keepInvalid)return;a.keepInvalidTags?s.__isValid=d:s=r}this.onEditTagDone(n,s)}else this.onEditTagDone(n,r);else this.onEditTagDone(n)}},onEditTagkeydown:function(t,e){switch(this.trigger("edit:keydown",{originalEvent:this.cloneEvent(t)}),t.key){case"Esc":case"Escape":e.innerHTML=e.__tagifyTagData.__originalHTML;case"Enter":case"Tab":t.preventDefault(),t.target.blur()}},onDoubleClickScope:function(t){var e,i,s=t.target.closest("."+this.settings.classNames.tag),a=this.settings;s&&(e=s.classList.contains(this.settings.classNames.tagEditing),i=s.hasAttribute("readonly"),"select"==a.mode||a.readonly||e||i||!this.settings.editTags||this.editTag(s),this.toggleFocusClass(!0),this.trigger("dblclick",{tag:s,index:this.getNodeIndex(s),data:this.tagData(s)}))}}};function f(e,i){return e?e.previousElementSibling&&e.previousElementSibling.classList.contains("tagify")?(console.warn("Tagify: ","input element is already Tagified",e),this):(d(this,function(e){var i=document.createTextNode("");function s(t,e,s){s&&e.split(/\s+/g).forEach((function(e){return i[t+"EventListener"].call(i,e,s)}))}return{off:function(t,e){return s("remove",t,e),this},on:function(t,e){return e&&"function"==typeof e&&s("add",t,e),this},trigger:function(s,a){var n;if(s)if(e.settings.isJQueryPlugin)"remove"==s&&(s="removeTag"),jQuery(e.DOM.originalInput).triggerHandler(s,[a]);else{try{var o=d({},"object"===t(a)?a:{value:a});if(o.tagify=this,a instanceof Object)for(var r in a)a[r]instanceof HTMLElement&&(o[r]=a[r]);n=new CustomEvent(s,{detail:o})}catch(t){console.warn(t)}i.dispatchEvent(n)}}}}(this)),this.isFirefox="undefined"!=typeof InstallTrigger,this.isIE=window.document.documentMode,this.applySettings(e,i||{}),this.state={inputText:"",editing:!1,actions:{},mixMode:{},dropdown:{},flaggedTags:{}},this.value=[],this.listeners={},this.DOM={},this.build(e),this.getCSSVars(),this.loadOriginalValues(),this.events.customBinding.call(this),this.events.binding.call(this),void(e.autofocus&&this.DOM.input.focus())):(console.warn("Tagify: ","input element not found",e),this)}return f.prototype={dropdown:g,TEXTS:{empty:"empty",exceed:"number of tags exceeded",pattern:"pattern mismatch",duplicate:"already exists",notAllowed:"not allowed"},customEventsList:["change","add","remove","invalid","input","click","keydown","focus","blur","edit:input","edit:updated","edit:start","edit:keydown","dropdown:show","dropdown:hide","dropdown:select","dropdown:updated","dropdown:noMatch"],trim:function(t){return this.settings.trim&&t&&"string"==typeof t?t.trim():t},parseHTML:function(t){return(new DOMParser).parseFromString(t.trim(),"text/html").body.firstElementChild},templates:{wrapper:function(t,e){return'\n \n ')},tag:function(t){return'\n \n
    \n ').concat(t[this.settings.tagTextProp]||t.value,"\n
    \n
    ")},dropdown:function(t){var e=t.dropdown,i="manual"==e.position,s="".concat(t.classNames.dropdown);return'
    \n
    \n
    ')},dropdownItem:function(t){return"
    ').concat(t.value,"
    ")},dropdownItemNoMatch:null},parseTemplate:function(t,e){return t=this.settings.templates[t]||t,this.parseHTML(t.apply(this,e))},applySettings:function(t,e){u.templates=this.templates;var i=this.settings=d({},u,e);i.readonly=t.hasAttribute("readonly"),i.placeholder=t.getAttribute("placeholder")||i.placeholder||"",i.required=t.hasAttribute("required");var s=function(t){Object.defineProperty(i.classNames,t+"Selector",{get:function(){return"."+this[t].split(" ").join(".")}})};for(var a in i.classNames)s(a);if(this.isIE&&(i.autoComplete=!1),["whitelist","blacklist"].forEach((function(e){var s=t.getAttribute("data-"+e);s&&(s=s.split(i.delimiters))instanceof Array&&(i[e]=s)})),"autoComplete"in e&&!l(e.autoComplete)&&(i.autoComplete=u.autoComplete,i.autoComplete.enabled=e.autoComplete),"mix"==i.mode&&(i.autoComplete.rightKey=!0,i.delimiters=e.delimiters||null,i.tagTextProp&&!i.dropdown.searchKeys.includes(i.tagTextProp)&&i.dropdown.searchKeys.push(i.tagTextProp)),t.pattern)try{i.pattern=new RegExp(t.pattern)}catch(t){}if(this.settings.delimiters)try{i.delimiters=new RegExp(this.settings.delimiters,"g")}catch(t){}"select"==i.mode&&(i.dropdown.enabled=0),i.dropdown.appendTarget=e.dropdown&&e.dropdown.appendTarget?e.dropdown.appendTarget:document.body},getAttributes:function(t){if("[object Object]"!=Object.prototype.toString.call(t))return"";var e,i,s=Object.keys(t),a="";for(i=s.length;i--;)"class"!=(e=s[i])&&t.hasOwnProperty(e)&&void 0!==t[e]&&(a+=" "+e+(void 0!==t[e]?'="'.concat(t[e],'"'):""));return a},setStateSelection:function(){var t=window.getSelection(),e={anchorOffset:t.anchorOffset,anchorNode:t.anchorNode,range:t.getRangeAt&&t.rangeCount&&t.getRangeAt(0)};return this.state.selection=e,e},getCaretGlobalPosition:function(){var t=document.getSelection();if(t.rangeCount){var e,i,s=t.getRangeAt(0),a=s.startContainer,n=s.startOffset;if(n>0)return(i=document.createRange()).setStart(a,n-1),i.setEnd(a,n),{left:(e=i.getBoundingClientRect()).right,top:e.top,bottom:e.bottom};if(a.getBoundingClientRect)return a.getBoundingClientRect()}return{left:-9999,top:-9999}},getCSSVars:function(){var t,e=getComputedStyle(this.DOM.scope,null);this.CSSVars={tagHideTransition:function(t){var e=t.value;return"s"==t.unit?1e3*e:e}(function(t){if(!t)return{};var e=(t=t.trim().split(" ")[0]).split(/\d+/g).filter((function(t){return t})).pop().trim();return{value:+t.split(e).filter((function(t){return t}))[0].trim(),unit:e}}((t="tag-hide-transition",e.getPropertyValue("--"+t))))}},build:function(t){var e=this.DOM;this.settings.mixMode.integrated?(e.originalInput=null,e.scope=t,e.input=t):(e.originalInput=t,e.scope=this.parseTemplate("wrapper",[t,this.settings]),e.input=e.scope.querySelector(this.settings.classNames.inputSelector),t.parentNode.insertBefore(e.scope,t)),this.settings.dropdown.enabled>=0&&this.dropdown.init.call(this)},destroy:function(){this.DOM.scope.parentNode.removeChild(this.DOM.scope),this.dropdown.hide.call(this,!0),clearTimeout(this.dropdownHide__bindEventsTimeout)},loadOriginalValues:function(t){var e,i=this.settings;if(t=t||(i.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value))if(this.removeAllTags({withoutChangeEvent:!0}),"mix"==i.mode)this.parseMixTags(t.trim()),(e=this.DOM.input.lastChild)&&"BR"==e.tagName||this.DOM.input.insertAdjacentHTML("beforeend","
    ");else{try{JSON.parse(t)instanceof Array&&(t=JSON.parse(t))}catch(t){}this.addTags(t).forEach((function(t){return t&&t.classList.add(i.classNames.tagNoAnimation)}))}else this.postUpdate();this.state.lastOriginalValueReported=i.mixMode.integrated?"":this.DOM.originalInput.value,this.state.loadedOriginalValues=!0},cloneEvent:function(t){var e={};for(var i in t)e[i]=t[i];return e},loading:function(t){return this.state.isLoading=t,this.DOM.scope.classList[t?"add":"remove"](this.settings.classNames.scopeLoading),this},tagLoading:function(t,e){return t&&t.classList[e?"add":"remove"](this.settings.classNames.tagLoading),this},toggleClass:function(t,e){"string"==typeof t&&this.DOM.scope.classList.toggle(t,e)},toggleFocusClass:function(t){this.toggleClass(this.settings.classNames.focus,!!t)},triggerChangeEvent:function(){if(!this.settings.mixMode.integrated){var t=this.DOM.originalInput,e=this.state.lastOriginalValueReported!==t.value,i=new CustomEvent("change",{bubbles:!0});e&&(this.state.lastOriginalValueReported=t.value,i.simulated=!0,t._valueTracker&&t._valueTracker.setValue(Math.random()),t.dispatchEvent(i),this.trigger("change",this.state.lastOriginalValueReported),t.value=this.state.lastOriginalValueReported)}},events:p,fixFirefoxLastTagNoCaret:function(){},placeCaretAfterNode:function(t){if(t&&t.parentNode){var e=t.nextSibling,i=window.getSelection(),s=i.getRangeAt(0);i.rangeCount&&(s.setStartBefore(e||t),s.setEndBefore(e||t),i.removeAllRanges(),i.addRange(s))}},insertAfterTag:function(t,e){if(e=e||this.settings.mixMode.insertAfterTag,t&&t.parentNode&&e)return e="string"==typeof e?document.createTextNode(e):e,t.parentNode.insertBefore(e,t.nextSibling),e},editTag:function(t,e){var i=this;t=t||this.getLastTag(),e=e||{},this.dropdown.hide.call(this);var s=this.settings;function a(){return t.querySelector(s.classNames.tagTextSelector)}var n=a(),o=this.getNodeIndex(t),r=this.tagData(t),l=this.events.callbacks,c=this,h=!0;if(n){if(!(r instanceof Object&&"editable"in r)||r.editable)return n.setAttribute("contenteditable",!0),t.classList.add(s.classNames.tagEditing),this.tagData(t,{__originalData:d({},r),__originalHTML:t.innerHTML}),n.addEventListener("focus",l.onEditTagFocus.bind(this,t)),n.addEventListener("blur",(function(){setTimeout((function(){return l.onEditTagBlur.call(c,a())}))})),n.addEventListener("input",l.onEditTagInput.bind(this,n)),n.addEventListener("keydown",(function(e){return l.onEditTagkeydown.call(i,e,t)})),n.focus(),this.setRangeAtStartEnd(!1,n),e.skipValidation||(h=this.editTagToggleValidity(t,r.value)),n.originalIsValid=h,this.trigger("edit:start",{tag:t,index:o,data:r,isValid:h}),this}else console.warn("Cannot find element in Tag template: .",s.classNames.tagTextSelector)},editTagToggleValidity:function(t,e){var i,s=this.tagData(t);if(s)return i=!(!s.__isValid||1==s.__isValid),t.classList.toggle(this.settings.classNames.tagInvalid,i),s.__isValid;console.warn("tag has no data: ",t,s)},onEditTagDone:function(t,e){e=e||{};var i={tag:t=t||this.state.editing.scope,index:this.getNodeIndex(t),previousData:this.tagData(t),data:e};this.trigger("edit:beforeUpdate",i),this.state.editing=!1,delete e.__originalData,delete e.__originalHTML,t&&e[this.settings.tagTextProp]?(this.editTagToggleValidity(t),this.replaceTag(t,e)):t&&this.removeTags(t),this.trigger("edit:updated",i),this.dropdown.hide.call(this),this.settings.keepInvalidTags&&this.reCheckInvalidTags()},replaceTag:function(t,e){e&&e.value||(e=t.__tagifyTagData),e.__isValid&&1!=e.__isValid&&d(e,this.getInvalidTagAttrs(e,e.__isValid));var i=this.createTagElem(e);t.parentNode.replaceChild(i,t),this.updateValueByDOMTags()},updateValueByDOMTags:function(){var t=this;this.value.length=0,[].forEach.call(this.getTagElms(),(function(e){e.classList.contains(t.settings.classNames.tagNotAllowed.split(" ")[0])||t.value.push(t.tagData(e))})),this.update()},setRangeAtStartEnd:function(t,e){t="number"==typeof t?t:!!t,e=(e=e||this.DOM.input).lastChild||e;var i=document.getSelection();try{i.rangeCount>=1&&["Start","End"].forEach((function(s){return i.getRangeAt(0)["set"+s](e,t||e.length)}))}catch(t){console.warn("Tagify: ",t)}},injectAtCaret:function(t,e){if(e=e||this.state.selection.range)return"string"==typeof t&&(t=document.createTextNode(t)),e.deleteContents(),e.insertNode(t),this.setRangeAtStartEnd(!1,t),this.updateValueByDOMTags(),this.update(),this},input:{set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.settings.dropdown.closeOnSelect;this.state.inputText=t,e&&(this.DOM.input.innerHTML=o(""+t)),!t&&i&&this.dropdown.hide.bind(this),this.input.autocomplete.suggest.call(this),this.input.validate.call(this)},validate:function(){var t=!this.state.inputText||!0===this.validateTag({value:this.state.inputText});return this.DOM.input.classList.toggle(this.settings.classNames.inputInvalid,!t),t},normalize:function(t){var e=t||this.DOM.input,i=[];e.childNodes.forEach((function(t){return 3==t.nodeType&&i.push(t.nodeValue)})),i=i.join("\n");try{i=i.replace(/(?:\r\n|\r|\n)/g,this.settings.delimiters.source.charAt(0))}catch(t){}return i=i.replace(/\s/g," "),this.settings.trim&&(i=i.replace(/^\s+/,"")),i},autocomplete:{suggest:function(t){if(this.settings.autoComplete.enabled){"string"==typeof(t=t||{})&&(t={value:t});var e=t.value?""+t.value:"",i=e.substr(0,this.state.inputText.length).toLowerCase(),s=e.substring(this.state.inputText.length);e&&this.state.inputText&&i==this.state.inputText.toLowerCase()?(this.DOM.input.setAttribute("data-suggest",s),this.state.inputSuggestion=t):(this.DOM.input.removeAttribute("data-suggest"),delete this.state.inputSuggestion)}},set:function(t){var e=this.DOM.input.getAttribute("data-suggest"),i=t||(e?this.state.inputText+e:null);return!!i&&("mix"==this.settings.mode?this.replaceTextWithNode(document.createTextNode(this.state.tag.prefix+i)):(this.input.set.call(this,i),this.setRangeAtStartEnd()),this.input.autocomplete.suggest.call(this),this.dropdown.hide.call(this),!0)}}},getTagIdx:function(t){return this.value.findIndex((function(e){return e.value==t.value}))},getNodeIndex:function(t){var e=0;if(t)for(;t=t.previousElementSibling;)e++;return e},getTagElms:function(){for(var t=arguments.length,e=new Array(t),s=0;s=this.settings.maxTags&&this.TEXTS.exceed},setReadonly:function(t){var e=this.settings;document.activeElement.blur(),e.readonly=t,this.DOM.scope[(t?"set":"remove")+"Attribute"]("readonly",!0),"mix"==e.mode&&(this.DOM.input.contentEditable=!t)},normalizeTags:function(t){var s=this,a=this.settings,n=a.whitelist,o=a.delimiters,r=a.mode,l=a.tagTextProp,d=a.enforceWhitelist,c=[],h=!!n&&n[0]instanceof Object,g=t instanceof Array,u=function(t){return(t+"").split(o).filter((function(t){return t})).map((function(t){var i;return e(i={},l,s.trim(t)),e(i,"value",s.trim(t)),i}))};if("number"==typeof t&&(t=t.toString()),"string"==typeof t){if(!t.trim())return[];t=u(t)}else if(g){var p;t=(p=[]).concat.apply(p,i(t.map((function(t){return t.value?t:u(t)}))))}return h&&(t.forEach((function(t){var e=c.map((function(t){return t.value})),i=s.dropdown.filterListItems.call(s,t[l],{exact:!0}).filter((function(t){return!e.includes(t.value)})),a=i.length>1?s.getWhitelistItem(t[l],l,i):i[0];a&&a instanceof Object?c.push(a):"mix"==r||d||(null==t.value&&(t.value=t[l]),c.push(t))})),t=c),t},parseMixTags:function(t){var e=this,i=this.settings,s=i.mixTagsInterpolator,a=i.duplicates,n=i.transformTag,o=i.enforceWhitelist,r=i.maxTags,l=i.tagTextProp,d=[];return t=t.split(s[0]).map((function(t,i){var c,h,g,u=t.split(s[1]),p=u[0],f=d.length==r;try{if(p==+p)throw Error;h=JSON.parse(p)}catch(t){h=e.normalizeTags(p)[0]||{value:p}}if(f||!(u.length>1)||o&&!e.isTagWhitelisted(h.value)||!a&&e.isTagDuplicate(h.value)){if(t)return i?s[0]+t:t}else n.call(e,h),h[c=h[l]?l:"value"]=e.trim(h[c]),g=e.createTagElem(h),d.push(h),g.classList.add(e.settings.classNames.tagNoAnimation),u[0]=g.outerHTML,e.value.push(h);return u.join("")})).join(""),this.DOM.input.innerHTML=t,this.DOM.input.appendChild(document.createTextNode("")),this.DOM.input.normalize(),this.getTagElms().forEach((function(t,i){return e.tagData(t,d[i])})),this.update({withoutChangeEvent:!0}),t},replaceTextWithNode:function(t,e){if(this.state.tag||e){e=e||this.state.tag.prefix+this.state.tag.value;var i,s,a=window.getSelection(),n=a.anchorNode,o=this.state.tag.delimiters?this.state.tag.delimiters.length:0;return n.splitText(a.anchorOffset-o),i=n.nodeValue.lastIndexOf(e),s=n.splitText(i),t&&n.parentNode.replaceChild(t,s),!0}},selectTag:function(t,e){if(!this.settings.enforceWhitelist||this.isTagWhitelisted(e.value))return this.input.set.call(this,e.value,!0),this.state.actions.selectOption&&setTimeout(this.setRangeAtStartEnd.bind(this)),this.getLastTag()?this.replaceTag(this.getLastTag(),e):this.appendTag(t),this.value[0]=e,this.trigger("add",{tag:t,data:e}),this.update(),[t]},addEmptyTag:function(t){var e=d({value:""},t||{}),i=this.createTagElem(e);this.tagData(i,e),this.appendTag(i),this.editTag(i,{skipValidation:!0})},addTags:function(t,e){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.settings.skipInvalid,a=[],n=this.settings;return t&&0!=t.length?(t=this.normalizeTags(t),"mix"==n.mode?this.addMixTags(t):("select"==n.mode&&(e=!1),this.DOM.input.removeAttribute("style"),t.forEach((function(t){var e,o={},r=Object.assign({},t,{value:t.value+""});if((t=Object.assign({},r)).__isValid=i.hasMaxTags()||i.validateTag(t),n.transformTag.call(i,t),!0!==t.__isValid){if(s)return;d(o,i.getInvalidTagAttrs(t,t.__isValid),{__preInvalidData:r}),t.__isValid==i.TEXTS.duplicate&&i.flashTag(i.getTagElmByValue(t.value))}if(t.readonly&&(o["aria-readonly"]=!0),e=i.createTagElem(d({},t,o)),a.push(e),"select"==n.mode)return i.selectTag(e,t);i.appendTag(e),t.__isValid&&!0===t.__isValid?(i.value.push(t),i.update(),i.trigger("add",{tag:e,index:i.value.length-1,data:t})):(i.trigger("invalid",{data:t,index:i.value.length,tag:e,message:t.__isValid}),n.keepInvalidTags||setTimeout((function(){return i.removeTags(e,!0)}),1e3)),i.dropdown.position.call(i)})),t.length&&e&&this.input.set.call(this),this.dropdown.refilter.call(this),a)):("select"==n.mode&&this.removeAllTags(),a)},addMixTags:function(t){var e=this;if(t[0].prefix||this.state.tag)this.prefixedTextToTag(t[0]);else{"string"==typeof t&&(t=[{value:t}]);var i=!!this.state.selection,s=document.createDocumentFragment();t.forEach((function(t){var i=e.createTagElem(t);s.appendChild(i),e.insertAfterTag(i)})),i?this.injectAtCaret(s):(this.DOM.input.focus(),(i=this.setStateSelection()).range.setStart(this.DOM.input,i.range.endOffset),i.range.setEnd(this.DOM.input,i.range.endOffset),this.DOM.input.appendChild(s),this.updateValueByDOMTags(),this.update())}},prefixedTextToTag:function(t){var e,i=this,s=this.settings,a=this.state.tag.delimiters;if(s.transformTag.call(this,t),t.prefix=t.prefix||this.state.tag?this.state.tag.prefix:(s.pattern.source||s.pattern)[0],e=this.createTagElem(t),this.replaceTextWithNode(e)||this.DOM.input.appendChild(e),setTimeout((function(){return e.classList.add(i.settings.classNames.tagNoAnimation)}),300),this.value.push(t),this.update(),!a){var n=this.insertAfterTag(e)||e;this.placeCaretAfterNode(n)}return this.state.tag=null,this.trigger("add",d({},{tag:e},{data:t})),e},appendTag:function(t){var e=this.DOM.scope.lastElementChild;e===this.DOM.input?this.DOM.scope.insertBefore(t,e):this.DOM.scope.appendChild(t)},createTagElem:function(t){var e,i=d({},t,{value:o(t.value+"")});return function(t){for(var e,i=document.createNodeIterator(t,NodeFilter.SHOW_TEXT,null,!1);e=i.nextNode();)e.textContent.trim()||e.parentNode.removeChild(e)}(e=this.parseTemplate("tag",[i])),this.tagData(e,t),e},reCheckInvalidTags:function(){var t=this,e=this.settings,i="".concat(e.classNames.tagSelector).concat(e.classNames.tagNotAllowedSelector),s=this.DOM.scope.querySelectorAll(i);[].forEach.call(s,(function(e){var i=t.tagData(e),s=e.getAttribute("title")==t.TEXTS.duplicate,a=!0===t.validateTag(i);s&&a&&(i=i.__preInvalidData?i.__preInvalidData:{value:i.value},t.replaceTag(e,i))}))},removeTags:function(t,e,i){var s,a=this;t=t&&t instanceof HTMLElement?[t]:t instanceof Array?t:t?[t]:[this.getLastTag()],s=t.reduce((function(t,e){return e&&"string"==typeof e&&(e=a.getTagElmByValue(e)),e&&t.push({node:e,idx:a.getTagIdx(a.tagData(e)),data:a.tagData(e,{__removed:!0})}),t}),[]),i="number"==typeof i?i:this.CSSVars.tagHideTransition,"select"==this.settings.mode&&(i=0,this.input.set.call(this)),1==s.length&&s[0].node.classList.contains(this.settings.classNames.tagNotAllowed)&&(e=!0),s.length&&this.settings.hooks.beforeRemoveTag(s,{tagify:this}).then((function(){function t(t){t.node.parentNode&&(t.node.parentNode.removeChild(t.node),e?this.settings.keepInvalidTags&&this.trigger("remove",{tag:t.node,index:t.idx}):(this.trigger("remove",{tag:t.node,index:t.idx,data:t.data}),this.dropdown.refilter.call(this),this.dropdown.position.call(this),this.DOM.input.normalize(),this.settings.keepInvalidTags&&this.reCheckInvalidTags()))}i&&i>10&&1==s.length?function(e){e.node.style.width=parseFloat(window.getComputedStyle(e.node).width)+"px",document.body.clientTop,e.node.classList.add(this.settings.classNames.tagHide),setTimeout(t.bind(this),i,e)}.call(a,s[0]):s.forEach(t.bind(a)),e||(s.forEach((function(t){var e=Object.assign({},t.data);delete e.__removed;var i=a.getTagIdx(e);i>-1&&a.value.splice(i,1)})),a.update())})).catch((function(t){}))},removeAllTags:function(t){var e=t.withoutChangeEvent;this.value=[],"mix"==this.settings.mode?this.DOM.input.innerHTML="":Array.prototype.slice.call(this.getTagElms()).forEach((function(t){return t.parentNode.removeChild(t)})),this.dropdown.position.call(this),"select"==this.settings.mode&&this.input.set.call(this),this.update({withoutChangeEvent:e})},postUpdate:function(){var t=this.settings.classNames,e="mix"==this.settings.mode?this.settings.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value:this.value.length;this.toggleClass(t.hasMaxTags,this.value.length>=this.settings.maxTags),this.toggleClass(t.hasNoTags,!this.value.length),this.toggleClass(t.empty,!e)},update:function(t){var e,i,s=this.DOM.originalInput,a=(t||{}).withoutChangeEvent,n=(e=this.value,i=["__isValid","__removed"],e.map((function(t){var e={};for(var s in t)i.indexOf(s)<0&&(e[s]=t[s]);return e})));this.settings.mixMode.integrated||(s.value="mix"==this.settings.mode?this.getMixedTagsAsString(n):n.length?this.settings.originalInputValueFormat?this.settings.originalInputValueFormat(n):JSON.stringify(n):""),this.postUpdate(),!a&&this.state.loadedOriginalValues&&this.triggerChangeEvent()},getMixedTagsAsString:function(){var t="",e=this,i=this.settings.mixTagsInterpolator;return function s(a){a.childNodes.forEach((function(a){if(1==a.nodeType){if(a.classList.contains(e.settings.classNames.tag)&&e.tagData(a)){if(e.tagData(a).__removed)return;return void(t+=i[0]+JSON.stringify(a.__tagifyTagData)+i[1])}"BR"!=a.tagName||a.parentNode!=e.DOM.input&&1!=a.parentNode.childNodes.length?"DIV"!=a.tagName&&"P"!=a.tagName||(t+="\r\n",s(a)):t+="\r\n"}else t+=a.textContent}))}(this.DOM.input),t}},f.prototype.removeTag=f.prototype.removeTags,f})); diff --git a/js/tagify/tagify.polyfills.min.js b/js/tagify/tagify.polyfills.min.js deleted file mode 100644 index 4de06f5..0000000 --- a/js/tagify/tagify.polyfills.min.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var n;"".trim||(String.prototype.trim=function(){return this.replace(/^[\s]+|[\s]+$/g,"")}),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var o=arguments[1],r=0;r>>0,r=0;rthis.length)&&-1!==this.indexOf(t,e)}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(t),o=1;o - diff --git a/primitivenotes.php b/primitivenotes.php index 0f23f1e..7dfa151 100644 --- a/primitivenotes.php +++ b/primitivenotes.php @@ -2,7 +2,7 @@ /** * Roundcube Notes Plugin * - * @version 2.0.4 + * @version 2.0.5 * @author Offerel * @copyright Copyright (c) 2021, Offerel * @license GNU General Public License, version 3 diff --git a/skins/primitivenotes.css b/skins/primitivenotes.css index 24fea78..b59f208 100644 --- a/skins/primitivenotes.css +++ b/skins/primitivenotes.css @@ -13,8 +13,9 @@ body { background: unset; } .editor-toolbar button { - border: 0; - background: transparent; + border: 0; + background: 0 0; + box-shadow: unset; } .editor-toolbar button:hover { background: lightgray; @@ -106,6 +107,7 @@ object { background-repeat: no-repeat; background-position: -7px -671px; background-size: 36px; + border-color: #d4dbde; } #sidebar { width: 400px; @@ -176,22 +178,27 @@ object { border: thin solid #ced4da!important; } .main_area { - position: absolute; - top: 90px; - height: calc(100% - 90px); - width: 100%; - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - background: #fff; - overflow: auto; + position: absolute; + height: calc(100% - 124px); + width: 100%; + background: #fff; + overflow: auto; + top: 122px; +} +#cdiv { + position: fixed; + height: 100%; + width: calc(100% - 395px); + top: 80px; + background: white; + border-top: 1px solid #d4dbde; } .main_area textarea { border: 0; width: calc(100% - 20px); - height: calc(100% - 61px); + height: calc(100% - 20px); white-space: pre; padding: 10px; - top: 35px; position: absolute; font-family: revert; border-radius: revert; @@ -203,12 +210,13 @@ object { } #atoolbar { background: #efefef; - border-bottom: 1px solid #bbb; + border-bottom: 1px solid #d4dbde; padding: 0 10px; - z-index: 12; + z-index: 12; position: absolute; right: 0; left: 0; + top: -1px; } #atoolbar li { border-radius: 4px; @@ -341,6 +349,7 @@ object { border-radius: 5px; display: inline-block; white-space: pre; + max-width: 100%; } .editor-preview a, .editor-preview-side a { color: #42b983; @@ -371,7 +380,8 @@ object { background: #fff; font-family: Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif; color: #333; - background: #fff; + border-top: 1px solid #d4dbde; + padding: 10px; } .editor-preview * { max-width: 860px; @@ -431,15 +441,14 @@ object { left: 395px; width: calc(100% - 396px); top: 80px; - height: calc(100% - 74px); - padding-top: 20px; + height: calc(100% - 80px); } .CodeMirror-vscrollbar { overflow-y: hidden; } .editor-toolbar { position: fixed; - width: calc(100% - 432px); + width: calc(100% - 415px); background: #efefef; border: 0; border-bottom: 1px solid; @@ -448,9 +457,6 @@ object { border-radius: 0; top: 86px; } -.EasyMDEContainer .CodeMirror-scroll { - padding-top: 30px; -} .editor-toolbar::after { margin-top: 2px; } @@ -460,6 +466,7 @@ object { .editor-toolbar button.active, .editor-toolbar button:hover { background: #e3e3e3; border-color: #95a5a6; + box-shadow: unset; } .editor-toolbar.fullscreen { background: #f4f4f4; @@ -596,4 +603,64 @@ tags.edit:focus-within { } .editor-preview code::-webkit-scrollbar-thumb:hover { background: #737677; +} +#ndata { + width: 100%; + z-index: -1; + position: relative; + background: #d4dbde; + margin: 0; + padding: 5px 0 10px 0; + top: -20px; + border: 0; + border-bottom: 1px solid #a9a9a9; + box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75); +} +#ndata span { + width: 100%; + height: 32px; + display: block; + box-shadow: 0 4px 3px 0 rgba(50,50,50,.4); + position: absolute; + top: -30px; + border-bottom: 1px solid #a9a9a9; + background: #efefef; +} +.mtoggle { + z-index: 1 !important; +} +#ndata div { + width: 25%; + float: left; +} +#ndata label { + display: block; + background: 0 0; + font-size: .7em; + color: dimgray; + font-style: italic; + margin-left: 10px; + margin-bottom: 2px; +} +#ndata input { + width: calc(100% - 30px); + margin-left: 10px; + font-size: 0.8em; +} +#ibutton { + right: 46px; + position: absolute; + top: 15px; + cursor: pointer; + z-index: 2; + content: "\f05a"; + font-size: 0.8em; + border: 1px solid #ced4da; + background: #f4f4f4; + color: #535252; + outline: 0; + box-shadow: revert; +} +#source:disabled { + cursor: pointer; } \ No newline at end of file diff --git a/skins/primitivenotes.min.css b/skins/primitivenotes.min.css index 146cddd..96ebd76 100644 --- a/skins/primitivenotes.min.css +++ b/skins/primitivenotes.min.css @@ -1 +1 @@ -.iframebox.simplenotes_{height:100%}.uibox{border:0!important;border-radius:0}#notessplitter{display:none}body{font-size:unset;background:unset}.editor-toolbar button{border:0;background:0 0}.editor-toolbar button:hover{background:#d3d3d3}#suggest{position:absolute;background-color:#fff;border:1px solid #ccf;z-index:100;left:9px;padding:5px;top:70px;overflow:auto}#suggest div{white-space:nowrap;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;font-size:.8em}#suggest div.select{color:#fff;background-color:#36f}#suggest div.over{background-color:#9cf}object{max-width:100%;max-height:100%;width:initial;height:initial;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;z-index:10}.headerTitle{margin:10px;font-size:2em;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:5px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:inherit;margin-top:0}.headerTags{margin:10px;font-size:11px;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:-20px}#content{height:100%;overflow:auto;padding:0 15px}.save_button{position:absolute;right:16px;top:14px;height:24px;width:24px;background:url(images/button_save.png) no-repeat;display:none}.save_button a{width:100%;height:100%;position:absolute}#sidebar .searchbox{position:absolute;width:350px}#sidebar .searchbox input{font-weight:400;background:#fff;height:21px;background-image:url(./../../../skins/larry/images/buttons.png);width:100%;padding:0 4px 0 24px;background-repeat:no-repeat;background-position:-7px -671px;background-size:36px}#sidebar{width:400px;position:absolute;float:left;overflow:hidden;border-radius:0;margin-right:5px;top:0;bottom:0;left:0;right:0;border-right:1px solid #d4dbde!important}#filelist_header{display:block;top:0;left:0;right:0;height:34px;padding:6px;background:#efefef;white-space:nowrap;border-bottom:1px solid #dfdfdf;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#taglist{display:none}#note_tags{border:thin solid #ced4da}.filelist{width:100%;height:calc(100% - 34px);overflow:auto;background:#dcdcdc}.cke_chrome{border:0!important}#main{position:absolute;left:0;right:0;top:0;bottom:0}.main{left:395px!important;border-radius:0!important}.main_header{height:100px;background:#efefef;width:100%;top:0;position:sticky}.main_header input{width:calc(100% - 20px);padding:0;margin-left:6px;margin-top:5px;padding-left:5px;border:thin solid #ced4da!important}.main_area{position:absolute;top:90px;height:calc(100% - 90px);width:100%;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background:#fff;overflow:auto}.main_area textarea{border:0;width:calc(100% - 20px);height:calc(100% - 61px);white-space:pre;padding:10px;top:35px;position:absolute;font-family:revert;border-radius:revert;resize:none;outline:0}.main_area textarea:focus{box-shadow:revert}#atoolbar{background:#efefef;border-bottom:1px solid #bbb;padding:0 10px;z-index:12;position:absolute;right:0;left:0}#atoolbar li{border-radius:4px;cursor:pointer;margin:4px 3px;padding:5px;color:#525252}#atoolbar li:hover{background:#e3e3e3}#atoolbar i.separator{display:inline;width:2px;border-left:1px solid #d9d9d9;border-right:1px solid #fff;margin:0 5px}#filelist{margin:0;padding:0}.fsize{text-align:right;float:right;width:50px;border-radius:9px;padding:0 6px;background:#929292;position:relative;color:#fff!important;font-weight:700!important;line-height:15px}.filelist li{white-space:nowrap;padding:3px 5px 2px 40px;font-weight:700;color:#2c363a;border-bottom:1px solid #f1f3f4;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif;font-size:12px;height:35px}.filelist a:hover span#taglist{display:block;background:#000!important;z-index:10;position:absolute;max-width:300px;border-radius:5px;padding:5px;color:#fff;white-space:normal;margin-top:-55px;box-shadow:1px 1px 3px gray;left:10px}.filelist li.pdf{background:#fff url(images/pdf-icon.png) 5px 7px/27px no-repeat}.filelist li.html,li.htm{background:#fff url(images/html-icon.png) 5px 7px/27px no-repeat}.filelist li.jpg{background:#fff url(images/jpg-icon.png) 5px 7px/27px no-repeat}.filelist li.md{background:#fff url(images/md-icon.png) 5px 7px/27px no-repeat}.filelist li.txt{background:#fff url(images/txt-icon.png) 5px 7px/27px no-repeat}.filelist li{background:#fff url(images/unknown-icon.png) 5px 7px/27px no-repeat}.selected,.selected a,.selected span{background-color:#ebf9ff!important}.selected span.fsize{background:#13aff8!important}.filelist li:hover{background-color:#e8eaf6;text-decoration:none!important}.filelist a>span{color:#666;font-weight:400;font-size:11px;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif}.filelist a{text-decoration:none!important;color:#536871;width:100%;height:100%;display:inline-block;text-overflow:ellipsis;overflow:hidden}.cke_editable{cursor:text;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif}.editor-preview blockquote,.editor-preview-side blockquote{color:#3c763d;background-color:rgba(66,185,131,.1);padding:0;margin:15px 0;border-left:4px solid #42b983;margin-left:auto;margin-right:auto}.editor-preview blockquote p,.editor-preview-side blockquote p{padding:5px}.editor-preview code{overflow-x:auto;scrollbar-width:thin;margin:0 0 -5px 0;user-select:all;width:unset;background:#eed7d7;font-size:.92em;font-family:Consolas,Monaco,monospace!important;color:#e93700;padding:2px 4px;border-radius:5px;display:inline-block;white-space:pre}.editor-preview a,.editor-preview-side a{color:#42b983;text-decoration:none;font-style:normal;font-size:15px;font-weight:600}.editor-preview pre,.editor-preview-side pre{background:#f8f8f8;margin-bottom:10px;padding:7px;font-size:85%;line-height:1.45;border-radius:4px;border:thin solid #dfe2e5;overflow:hidden;margin-left:auto;margin-right:auto;padding-right:10px}.editor-preview pre code{color:unset;background:unset;display:block}.editor-preview{background:#fff;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif;color:#333;background:#fff}.editor-preview *{max-width:860px;margin-left:auto;margin-right:auto}.editor-preview table,.editor-preview-side table{border-spacing:0;border-collapse:collapse;text-shadow:1px 1px 0 #fff}.editor-preview table thead th,.editor-preview-side table thead th{background-color:#e0e0e0;border:1px solid #ddd;padding:5px}.editor-preview table tr:nth-child(2n),.editor-preview-side table tr:nth-child(2n){background:linear-gradient(to bottom,#f8f8f8 0,#f6f6f6 100%)}.editor-preview table td,.editor-preview table th,.editor-preview-side table td,.editor-preview-side table th{border:1px solid #ddd;padding:5px}.editor-preview kbd,.editor-preview-side kbd{font-family:Consolas,"Courier New",monospace;display:inline-block;border-radius:5px;padding:0 4px;margin:2px;font-size:.9em;vertical-align:text-bottom;background:#fff;color:#555;user-select:none;border-width:1px 3px 3px 1px;border-color:#ccc #aaa #888 #bbb;white-space:nowrap;border-style:solid}.editor-preview img{display:block;max-width:860px}.EasyMDEContainer{top:0;position:relative}.EasyMDEContainer .CodeMirror{position:inherit;border:0}.EasyMDEContainerH{display:none!important}.editor-preview-full{position:fixed;left:395px;width:calc(100% - 396px);top:80px;height:calc(100% - 74px);padding-top:20px}.CodeMirror-vscrollbar{overflow-y:hidden}.editor-toolbar{position:fixed;width:calc(100% - 432px);background:#efefef;border:0;border-bottom:1px solid;border-color:#bbb;z-index:101;border-radius:0;top:86px}.EasyMDEContainer .CodeMirror-scroll{padding-top:30px}.editor-toolbar::after{margin-top:2px}.editor-toolbar::before{margin-bottom:2px}.editor-toolbar button.active,.editor-toolbar button:hover{background:#e3e3e3;border-color:#95a5a6}.editor-toolbar.fullscreen{background:#f4f4f4}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{font-size:smaller}.tagify{--tags-border-color:transparent!important;z-index:100;width:calc(100% - 15px);font-size:.7em;font-style:italic;flex-wrap:unset!important;left:7px;border-radius:4px;border:thin solid transparent!important;position:absolute;top:50px}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div::before{box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-hover,#d3e2e2) inset!important}tags{overflow:auto!important}tags.edit{background:#fff;border:thin solid #ced4da!important}tags.edit:focus-within{box-shadow:0 0 5px 2px rgba(71,135,177,.9)!important;z-index:102}.tagify__tag+.tagify__input::before{display:none}.cm-s-easymde .cm-comment{font-family:Consolas,inherit monospace}.db-spinner{width:30px;height:30px;border-radius:50%;background-color:transparent;border:10px solid #2229;border-top:10px solid #03a9f4;border-bottom:100x solid #03a9f4;-webkit-animation:1s spin linear infinite;animation:1s spin linear infinite;position:absolute;top:50%;left:50%;z-index:100}@-webkit-keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}#tocdiv{position:fixed;z-index:10;background:#efefef;width:300px;top:77px;right:-310px;white-space:nowrap;padding:10px 0;box-shadow:1px 3px 3px 0 rgba(50,50,50,.3);border-bottom-left-radius:5px;border-bottom-right-radius:5px;border:1px solid #bbb;border-top:0;overflow:auto;max-height:calc(100% - 140px)}#tocdiv.tdhidden{right:26px}#tbutton{position:absolute;z-index:100;top:15px;right:10px;background:#f4f4f4;border:1px solid #ced4da;border-radius:5px;cursor:pointer;color:#535252;font-size:.8em;padding:3px;outline:0;box-shadow:revert}#tocdiv ul{margin:0;padding-left:20px}#tocdiv li{list-style:none;padding-right:10px}#tocdiv a{color:#42b983;text-decoration:none;font-weight:bolder;overflow:hidden;text-overflow:ellipsis;width:100%;display:inline-block;font-size:.9em}.editor-preview code::-webkit-scrollbar{height:6px;background:#dee2e6}.editor-preview code::-webkit-scrollbar-thumb{background:#bbb;border-radius:6px}.editor-preview code::-webkit-scrollbar-thumb:hover{background:#737677} \ No newline at end of file +.iframebox.simplenotes_{height:100%}.uibox{border:0!important;border-radius:0}#notessplitter{display:none}body{font-size:unset;background:unset}.editor-toolbar button{border:0;background:0 0;box-shadow:unset}.editor-toolbar button:hover{background:#d3d3d3}#suggest{position:absolute;background-color:#fff;border:1px solid #ccf;z-index:100;left:9px;padding:5px;top:70px;overflow:auto}#suggest div{white-space:nowrap;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;font-size:.8em}#suggest div.select{color:#fff;background-color:#36f}#suggest div.over{background-color:#9cf}object{max-width:100%;max-height:100%;width:initial;height:initial;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;z-index:10}.headerTitle{margin:10px;font-size:2em;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:5px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:inherit;margin-top:0}.headerTags{margin:10px;font-size:11px;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:-20px}#content{height:100%;overflow:auto;padding:0 15px}.save_button{position:absolute;right:16px;top:14px;height:24px;width:24px;background:url(images/button_save.png) no-repeat;display:none}.save_button a{width:100%;height:100%;position:absolute}#sidebar .searchbox{position:absolute;width:350px}#sidebar .searchbox input{font-weight:400;background:#fff;height:21px;background-image:url(./../../../skins/larry/images/buttons.png);width:100%;padding:0 4px 0 24px;background-repeat:no-repeat;background-position:-7px -671px;background-size:36px;border-color:#d4dbde}#sidebar{width:400px;position:absolute;float:left;overflow:hidden;border-radius:0;margin-right:5px;top:0;bottom:0;left:0;right:0;border-right:1px solid #d4dbde!important}#filelist_header{display:block;top:0;left:0;right:0;height:34px;padding:6px;background:#efefef;white-space:nowrap;border-bottom:1px solid #dfdfdf;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#taglist{display:none}#note_tags{border:thin solid #ced4da}.filelist{width:100%;height:calc(100% - 34px);overflow:auto;background:#dcdcdc}.cke_chrome{border:0!important}#main{position:absolute;left:0;right:0;top:0;bottom:0}.main{left:395px!important;border-radius:0!important}.main_header{height:100px;background:#efefef;width:100%;top:0;position:sticky}.main_header input{width:calc(100% - 20px);padding:0;margin-left:6px;margin-top:5px;padding-left:5px;border:thin solid #ced4da!important}.main_area{position:absolute;height:calc(100% - 124px);width:100%;background:#fff;overflow:auto;top:122px}#cdiv{position:fixed;height:100%;width:calc(100% - 395px);top:80px;background:#fff;border-top:1px solid #d4dbde}.main_area textarea{border:0;width:calc(100% - 20px);height:calc(100% - 20px);white-space:pre;padding:10px;position:absolute;font-family:revert;border-radius:revert;resize:none;outline:0}.main_area textarea:focus{box-shadow:revert}#atoolbar{background:#efefef;border-bottom:1px solid #d4dbde;padding:0 10px;z-index:12;position:absolute;right:0;left:0;top:-1px}#atoolbar li{border-radius:4px;cursor:pointer;margin:4px 3px;padding:5px;color:#525252}#atoolbar li:hover{background:#e3e3e3}#atoolbar i.separator{display:inline;width:2px;border-left:1px solid #d9d9d9;border-right:1px solid #fff;margin:0 5px}#filelist{margin:0;padding:0}.fsize{text-align:right;float:right;width:50px;border-radius:9px;padding:0 6px;background:#929292;position:relative;color:#fff!important;font-weight:700!important;line-height:15px}.filelist li{white-space:nowrap;padding:3px 5px 2px 40px;font-weight:700;color:#2c363a;border-bottom:1px solid #f1f3f4;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif;font-size:12px;height:35px}.filelist a:hover span#taglist{display:block;background:#000!important;z-index:10;position:absolute;max-width:300px;border-radius:5px;padding:5px;color:#fff;white-space:normal;margin-top:-55px;box-shadow:1px 1px 3px gray;left:10px}.filelist li.pdf{background:#fff url(images/pdf-icon.png) 5px 7px/27px no-repeat}.filelist li.html,li.htm{background:#fff url(images/html-icon.png) 5px 7px/27px no-repeat}.filelist li.jpg{background:#fff url(images/jpg-icon.png) 5px 7px/27px no-repeat}.filelist li.md{background:#fff url(images/md-icon.png) 5px 7px/27px no-repeat}.filelist li.txt{background:#fff url(images/txt-icon.png) 5px 7px/27px no-repeat}.filelist li{background:#fff url(images/unknown-icon.png) 5px 7px/27px no-repeat}.selected,.selected a,.selected span{background-color:#ebf9ff!important}.selected span.fsize{background:#13aff8!important}.filelist li:hover{background-color:#e8eaf6;text-decoration:none!important}.filelist a>span{color:#666;font-weight:400;font-size:11px;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif}.filelist a{text-decoration:none!important;color:#536871;width:100%;height:100%;display:inline-block;text-overflow:ellipsis;overflow:hidden}.cke_editable{cursor:text;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif}.editor-preview blockquote,.editor-preview-side blockquote{color:#3c763d;background-color:rgba(66,185,131,.1);padding:0;margin:15px 0;border-left:4px solid #42b983;margin-left:auto;margin-right:auto}.editor-preview blockquote p,.editor-preview-side blockquote p{padding:5px}.editor-preview code{overflow-x:auto;scrollbar-width:thin;margin:0 0 -5px 0;user-select:all;width:unset;background:#eed7d7;font-size:.92em;font-family:Consolas,Monaco,monospace!important;color:#e93700;padding:2px 4px;border-radius:5px;display:inline-block;white-space:pre;max-width:100%}.editor-preview a,.editor-preview-side a{color:#42b983;text-decoration:none;font-style:normal;font-size:15px;font-weight:600}.editor-preview pre,.editor-preview-side pre{background:#f8f8f8;margin-bottom:10px;padding:7px;font-size:85%;line-height:1.45;border-radius:4px;border:thin solid #dfe2e5;overflow:hidden;margin-left:auto;margin-right:auto;padding-right:10px}.editor-preview pre code{color:unset;background:unset;display:block}.editor-preview{background:#fff;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif;color:#333;border-top:1px solid #d4dbde;padding:10px}.editor-preview *{max-width:860px;margin-left:auto;margin-right:auto}.editor-preview table,.editor-preview-side table{border-spacing:0;border-collapse:collapse;text-shadow:1px 1px 0 #fff}.editor-preview table thead th,.editor-preview-side table thead th{background-color:#e0e0e0;border:1px solid #ddd;padding:5px}.editor-preview table tr:nth-child(2n),.editor-preview-side table tr:nth-child(2n){background:linear-gradient(to bottom,#f8f8f8 0,#f6f6f6 100%)}.editor-preview table td,.editor-preview table th,.editor-preview-side table td,.editor-preview-side table th{border:1px solid #ddd;padding:5px}.editor-preview kbd,.editor-preview-side kbd{font-family:Consolas,"Courier New",monospace;display:inline-block;border-radius:5px;padding:0 4px;margin:2px;font-size:.9em;vertical-align:text-bottom;background:#fff;color:#555;user-select:none;border-width:1px 3px 3px 1px;border-color:#ccc #aaa #888 #bbb;white-space:nowrap;border-style:solid}.editor-preview img{display:block;max-width:860px}.EasyMDEContainer{top:0;position:relative}.EasyMDEContainer .CodeMirror{position:inherit;border:0}.EasyMDEContainerH{display:none!important}.editor-preview-full{position:fixed;left:395px;width:calc(100% - 396px);top:80px;height:calc(100% - 80px)}.CodeMirror-vscrollbar{overflow-y:hidden}.editor-toolbar{position:fixed;width:calc(100% - 415px);background:#efefef;border:0;border-bottom:1px solid;border-color:#bbb;z-index:101;border-radius:0;top:86px}.editor-toolbar::after{margin-top:2px}.editor-toolbar::before{margin-bottom:2px}.editor-toolbar button.active,.editor-toolbar button:hover{background:#e3e3e3;border-color:#95a5a6;box-shadow:unset}.editor-toolbar.fullscreen{background:#f4f4f4}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{font-size:smaller}.tagify{--tags-border-color:transparent!important;z-index:100;width:calc(100% - 15px);font-size:.7em;font-style:italic;flex-wrap:unset!important;left:7px;border-radius:4px;border:thin solid transparent!important;position:absolute;top:50px}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div::before{box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-hover,#d3e2e2) inset!important}tags{overflow:auto!important}tags.edit{background:#fff;border:thin solid #ced4da!important}tags.edit:focus-within{box-shadow:0 0 5px 2px rgba(71,135,177,.9)!important;z-index:102}.tagify__tag+.tagify__input::before{display:none}.cm-s-easymde .cm-comment{font-family:Consolas,inherit monospace}.db-spinner{width:30px;height:30px;border-radius:50%;background-color:transparent;border:10px solid #2229;border-top:10px solid #03a9f4;border-bottom:100x solid #03a9f4;-webkit-animation:1s spin linear infinite;animation:1s spin linear infinite;position:absolute;top:50%;left:50%;z-index:100}@-webkit-keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}#tocdiv{position:fixed;z-index:10;background:#efefef;width:300px;top:77px;right:-310px;white-space:nowrap;padding:10px 0;box-shadow:1px 3px 3px 0 rgba(50,50,50,.3);border-bottom-left-radius:5px;border-bottom-right-radius:5px;border:1px solid #bbb;border-top:0;overflow:auto;max-height:calc(100% - 140px)}#tocdiv.tdhidden{right:26px}#tbutton{position:absolute;z-index:100;top:15px;right:10px;background:#f4f4f4;border:1px solid #ced4da;border-radius:5px;cursor:pointer;color:#535252;font-size:.8em;padding:3px;outline:0;box-shadow:revert}#tocdiv ul{margin:0;padding-left:20px}#tocdiv li{list-style:none;padding-right:10px}#tocdiv a{color:#42b983;text-decoration:none;font-weight:bolder;overflow:hidden;text-overflow:ellipsis;width:100%;display:inline-block;font-size:.9em}.editor-preview code::-webkit-scrollbar{height:6px;background:#dee2e6}.editor-preview code::-webkit-scrollbar-thumb{background:#bbb;border-radius:6px}.editor-preview code::-webkit-scrollbar-thumb:hover{background:#737677}#ndata{width:100%;z-index:-1;position:relative;background:#d4dbde;margin:0;padding:5px 0 10px 0;top:-20px;border:0;border-bottom:1px solid #a9a9a9;box-shadow:0 3px 5px 0 rgba(0,0,0,.75)}#ndata span{width:100%;height:32px;display:block;box-shadow:0 4px 3px 0 rgba(50,50,50,.4);position:absolute;top:-30px;border-bottom:1px solid #a9a9a9;background:#efefef}.mtoggle{z-index:1!important}#ndata div{width:25%;float:left}#ndata label{display:block;background:0 0;font-size:.7em;color:#696969;font-style:italic;margin-left:10px;margin-bottom:2px}#ndata input{width:calc(100% - 30px);margin-left:10px;font-size:.8em}#ibutton{right:46px;position:absolute;top:15px;cursor:pointer;z-index:2;content:"\f05a";font-size:.8em;border:1px solid #ced4da;background:#f4f4f4;color:#535252;outline:0;box-shadow:revert}#source:disabled{cursor:pointer} \ No newline at end of file