Ubuntu

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ !function(){var e={1873:function(e,t,n){var a=n(9325).Symbol;e.exports=a},2552:function(e,t,n){var a=n(1873),r=n(659),i=n(9350),o=a?a.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?r(e):i(e)}},4128:function(e,t,n){var a=n(1800),r=/^\s+/;e.exports=function(e){return e?e.slice(0,a(e)+1).replace(r,""):e}},4840:function(e,t,n){var a="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=a},659:function(e,t,n){var a=n(1873),r=Object.prototype,i=r.hasOwnProperty,o=r.toString,l=a?a.toStringTag:void 0;e.exports=function(e){var t=i.call(e,l),n=e[l];try{e[l]=void 0;var a=!0}catch(e){}var r=o.call(e);return a&&(t?e[l]=n:delete e[l]),r}},9350:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9325:function(e,t,n){var a=n(4840),r="object"==typeof self&&self&&self.Object===Object&&self,i=a||r||Function("return this")();e.exports=i},1800:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},8221:function(e,t,n){var a=n(3805),r=n(124),i=n(9374),o=Math.max,l=Math.min;e.exports=function(e,t,n){var s,c,u,p,d,m,h=0,g=!1,f=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function w(t){var n=s,a=c;return s=c=void 0,h=t,p=e.apply(a,n)}function y(e){var n=e-m;return void 0===m||n>=t||n<0||f&&e-h>=u}function b(){var e=r();if(y(e))return k(e);d=setTimeout(b,function(e){var n=t-(e-m);return f?l(n,u-(e-h)):n}(e))}function k(e){return d=void 0,v&&s?w(e):(s=c=void 0,p)}function _(){var e=r(),n=y(e);if(s=arguments,c=this,m=e,n){if(void 0===d)return function(e){return h=e,d=setTimeout(b,t),g?w(e):p}(m);if(f)return clearTimeout(d),d=setTimeout(b,t),w(m)}return void 0===d&&(d=setTimeout(b,t)),p}return t=i(t)||0,a(n)&&(g=!!n.leading,u=(f="maxWait"in n)?o(i(n.maxWait)||0,t):u,v="trailing"in n?!!n.trailing:v),_.cancel=function(){void 0!==d&&clearTimeout(d),h=0,s=m=c=d=void 0},_.flush=function(){return void 0===d?p:k(r())},_}},3805:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},4394:function(e,t,n){var a=n(2552),r=n(346);e.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==a(e)}},124:function(e,t,n){var a=n(9325);e.exports=function(){return a.Date.now()}},9374:function(e,t,n){var a=n(4128),r=n(3805),i=n(4394),o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=a(e);var n=l.test(e);return n||s.test(e)?c(e.slice(2),n?2:8):o.test(e)?NaN:+e}},6942:function(e,t){var n;!function(){"use strict";var a={}.hasOwnProperty;function r(){for(var e="",t=0;t0?a[0].name:null)},e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(t,e),function(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"render",value:function(){var e=this,t=this.state.selected,n=this.props,a=n.activeClass,r=void 0===a?"is-active":a,i=n.className,o=n.instanceId,l=n.orientation,u=void 0===l?"horizontal":l,d=n.tabs,m=(0,c.find)(d,{name:t}),h=o+"-"+m.name,g=d.slice(4);return wp.element.createElement("div",{className:i},wp.element.createElement(p.NavigableMenu,{role:"tablist",orientation:u,onNavigate:this.onNavigate,className:"components-tab-panel__tabs "+t},d.slice(0,4).map(function(n){return wp.element.createElement(_,{className:s()("components-tab-panel__tabs-item",n.className,y({},r,n.name===t)),tabId:o+"-"+n.name,"aria-controls":o+"-"+n.name+"-view",selected:n.name===t,key:n.name,onClick:(0,c.partial)(e.handleClick,n.name)},n.title)}),g.map(function(n){return wp.element.createElement(_,{className:s()("components-tab-panel__tabs-item",n.className,y({},r,n.name===t)),tabId:o+"-"+n.name,"aria-controls":o+"-"+n.name+"-view",selected:n.name===t,key:n.name,onClick:(0,c.partial)(e.handleClick,n.name)},n.title)})),m&&wp.element.createElement("div",{"aria-labelledby":h,role:"tabpanel",id:h+"-view",className:"components-tab-panel__tab-content"},this.props.children(m)))}}])}(o.Component),T=(0,u.withInstanceId)(E),x=document.createElement("div");function O(e){return e&&"string"==typeof e&&(e=e.replace(/]*>([\S\s]*?)<\/script>/gim,"").replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,""),x.innerHTML=e,e=x.textContent,x.textContent=""),e}function S(e,t,n){var a=0;return!1!==(0,c.get)(n,"pixelWidth",!1)&&(a=Math.min(100,Math.floor(t/n.pixelWidth*100))),Math.max(Math.min(100,Math.floor(e/n.max*100)),a)+"%"}function N(e,t){return e<=t.min||e>t.max}function C(e,t){return e<=t.minWidth||e>t.pixelWidth}var I=function(e){var t=function(e,t){var n=O(e).length,a=0,r=!1;if(!1!==(0,c.get)(t,"pixelWidth",!1)){r=!0;var i=document.createTextNode(e),o=document.createElement("span");o.appendChild(i),o.id="rank-math-width-tester",o.className=t.widthCheckerClass;var l=document.body.appendChild(o);a=document.getElementById("rank-math-width-tester").offsetWidth,l.outerHTML=""}return{left:S(n,a,t),isInvalid:N(n,t),isInvalidWidth:!!r&&C(a,t),count:n+" / "+t.max,pixelWidth:r?a+"px / "+t.pixelWidth+"px":""}}(e.source,e),n=t.pixelWidth?" (".concat(t.pixelWidth,")"):"";return wp.element.createElement("span",{className:s()("length-indicator-wrapper",{invalid:t.isInvalid||t.isInvalidWidth})},wp.element.createElement("span",{className:"length-count"},t.count,n),wp.element.createElement("span",{className:"length-indicator"},wp.element.createElement("span",{style:{left:t.left}})))},M=wp.htmlEntities,D=React;function A(e){return e.startsWith("{{/")?{type:"componentClose",value:e.replace(/\W/g,"")}:e.endsWith("/}}")?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.startsWith("{{")?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}function P(e,t){let n,a,r=[];for(let i=0;i","{{strong}}").replace("","{{/strong}}"))))},this))),wp.element.createElement(p.Button,{icon:"arrow-down-alt2",onClick:function(){e.toggle()}}))}},{key:"toggle",value:function(){this.state.isOpen?document.removeEventListener("click",this.handleOutsideClick,!0):document.addEventListener("click",this.handleOutsideClick,!0),this.setState({display:this.state.isOpen?"none":"block",isOpen:!this.state.isOpen})}},{key:"handleOutsideClick",value:function(e){this.node.contains(e.target)||this.toggle()}},{key:"handleSearch",value:function(e){var t=e.toLowerCase();2>t.length?this.setState({filtered:this.state.variables}):this.setState({filtered:this.state.variables.filter(function(e){return-1!==Object.values(e).join(" ").toLowerCase().indexOf(t)})})}}])}(o.Component),G=W,K=(0,u.compose)((0,i.withSelect)(function(e){var t=e("rank-math");return{title:t.getTitle(),serpTitle:t.getSerpTitle()}}),(0,i.withDispatch)(function(e){return{updateTitle:function(t){e("rank-math").updateSerpTitle(t),e("rank-math").updateTitle(t)}}}))(function(e){var t=e.title,n=e.serpTitle,a=e.updateTitle;return wp.element.createElement("div",{className:"field-group"},wp.element.createElement("label",{htmlFor:"rank-math-editor-title"},(0,r.__)("Title","rank-math")),wp.element.createElement(I,{source:n,min:15,max:60,pixelWidth:580,widthCheckerClass:"title"}),wp.element.createElement("div",{className:"variable-group"},wp.element.createElement(p.TextControl,{id:"rank-math-editor-title",value:t,placeholder:rankMath.assessor.serpData.titleTemplate,help:(0,r.__)("This is what will appear in the first line when this post shows up in the search results.","rank-math"),onChange:a,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),wp.element.createElement(G,{exclude:["seo_title","seo_description"],onClick:function(e){return a(t+" %"+e.variable+"%")}})))}),q=wp.url,Y=function(e){return e.replace(/<\/?[a-z][^>]*?>/gi,"")},$=function(e){return e.replace(/]*>([\S\s]*?)<\/style>/gim,"")},J=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.replace(/]*>([\S\s]*?)<\/script>/gim,t)},X=function(e){return e.replace(//g,"")};function Z(e){return e.replace(/ | /gi," ").replace(/\s{2,}/g," ").replace(/\s\./g,".").replace(/(\r\n|\n|\r)/gm,"")}function Q(e){return(0,c.isUndefined)(e)?"":(0,c.flow)([$,J,Y,X,Z])(e)}var ee={};(0,c.isUndefined)(rankMath.assessor)||(0,c.forEach)(rankMath.assessor.diacritics,function(e,t){return ee[t]=new RegExp(e,"g")});var te=function(e){if((0,c.isUndefined)(e))return e;for(var t in ee)e=e.replace(ee[t],t);return e};var ne=function(){return!(0,c.isNull)(document.getElementById("site-editor"))&&(0,c.endsWith)(wp.data.select("core/editor").getCurrentPostId(),"//home")},ae=(0,u.compose)((0,i.withSelect)(function(e){var t=rankMathEditor.assessor.dataCollector,n=e("rank-math").getSerpSlug();return{permalink:n||t.getSlug(),serpPermalink:t.getPermalink()}}),(0,i.withDispatch)(function(){return{updatePermalink:function(e){rankMathEditor.updatePermalink(Q(e),!0)},updatePermalinkSanitize:function(e){rankMathEditor.updatePermalinkSanitize(function(e){return e=e.replace(/,/g,""),Q(e=te(e))}(e))}}}))(function(e){var t=e.permalink,n=e.serpPermalink,a=e.updatePermalink,i=e.updatePermalinkSanitize;return wp.element.createElement("div",{className:"field-group"},wp.element.createElement("label",{htmlFor:"rank-math-editor-permalink"},(0,r.__)("Permalink","rank-math")),wp.element.createElement(I,{source:(0,q.safeDecodeURIComponent)(n),min:5,max:75}),wp.element.createElement(p.TextControl,{id:"rank-math-editor-permalink",value:rankMath.is_front_page||ne()?"/":(0,q.safeDecodeURIComponent)(t),onChange:a,help:rankMath.is_front_page||ne()?(0,r.__)("Editing Homepage permalink is not possible.","rank-math"):(0,r.__)("This is the unique URL of this page, displayed below the post title in the search results.","rank-math"),disabled:rankMath.is_front_page||ne()?"disabled":"",onBlur:function(e){i(e.target.value)},__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}))}),re=(0,u.compose)((0,i.withSelect)(function(e){var t=e("rank-math");return{description:t.getDescription(),serpDescription:t.getSerpDescription()}}),(0,i.withDispatch)(function(e){return{updateDescription:function(t){e("rank-math").updateSerpDescription(t),e("rank-math").updateDescription(t)}}}))(function(e){var t=e.description,n=e.serpDescription,a=e.updateDescription;return wp.element.createElement("div",{className:"field-group"},wp.element.createElement("label",{htmlFor:"rank-math-editor-description"},(0,r.__)("Description","rank-math")),wp.element.createElement(I,{source:n,min:80,max:160,pixelWidth:920,widthCheckerClass:"description"}),wp.element.createElement("div",{className:"variable-group rank-math-description-variables"},wp.element.createElement(p.TextareaControl,{id:"rank-math-editor-description",value:O(t),placeholder:n||(0,c.unescape)(rankMath.assessor.serpData.descriptionTemplate),help:(0,r.__)("This is what will appear as the description when this post shows up in the search results.","rank-math"),onChange:a,__nextHasNoMarginBottom:!0}),wp.element.createElement(G,{exclude:["seo_title","seo_description"],onClick:function(e){return a(t+" %"+e.variable+"%")}})))}),ie=(0,u.compose)((0,i.withSelect)(function(e){return{type:e("rank-math").getSnippetPreviewType()}}),(0,i.withDispatch)(function(e,t){return{updatePreviewType:function(n){e("rank-math").updateSnippetPreviewType(n===t.type?"":n)}}}))(function(e){var t=e.type,n=e.updatePreviewType,r=s()("button button-secondary button-small",{active:"desktop"===t}),i=s()("button button-secondary button-small",{active:"mobile"===t});return wp.element.createElement("div",{className:"rank-math-button-devices alignright"},(0,a.applyFilters)("rank_math_before_serp_devices",""),wp.element.createElement("div",{onClick:function(){return n("desktop")},className:r},wp.element.createElement("i",{className:"rm-icon rm-icon-desktop"})),wp.element.createElement("div",{onClick:function(){return n("mobile")},className:i},wp.element.createElement("i",{className:"rm-icon rm-icon-mobile"})))});function oe(e){return 100'+e+""}))}function ce(e){return e.replace(/(^\w{1})|(\s+\w{1})/g,function(e){return e.toUpperCase()})}var ue=function(e,t){for(var n=[],a=1;a<=e;a++)n.push(wp.element.createElement(p.Dashicon,{key:Math.random(),size:"13",icon:"star-"+t}));return n},pe=(0,i.withSelect)(function(e){var t=e("rank-math").getSchemas();return{schema:(0,c.find)(t,function(e){return!(0,c.isEmpty)(e.metadata.isPrimary)})}})(function(e){var t=e.schema;if((0,c.isEmpty)(t))return null;var n=(0,c.get)(t,"review.reviewRating",{}),a=n.ratingValue;if((0,c.isEmpty)(a))return null;(0,c.get)(n,"worstRating",1);var i=(0,c.get)(n,"bestRating",5);return wp.element.createElement("div",{className:"rank-math-rating-preview"},wp.element.createElement("div",{className:"serp-ratings"},ue(i,"filled"),function(e,t,n){return e*=100/n,wp.element.createElement("div",{className:"serp-result",style:{width:e+"%"}},ue(n,"filled"))}(a,0,i)),wp.element.createElement("span",{className:"serp-rating-label"},(0,r.__)("Rating: ","rank-math")),wp.element.createElement("span",{className:"serp-rating-value"},a))});function de(e){return de="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},de(e)}function me(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=de(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=de(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==de(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var he=(0,i.withSelect)(function(e){var t=e("rank-math"),n=t.getRobots();return{title:t.getSerpTitle(),permalink:rankMathEditor.assessor.dataCollector.getPermalink(),description:t.getSerpDescription(),previewType:t.getSnippetPreviewType(),isNoIndex:"noindex"in n,keyword:t.getSelectedKeyword().data.value}})(function(e){var t=e.title,n=e.permalink,a=e.description,i=e.previewType,o=void 0===i?"desktop":i,l=e.isNoIndex,c=e.keyword,u=e.onClick,p=e.showScore,d=void 0===p||p,m=e.showDevices,h=void 0!==m&&m,g=s()("serp-preview",me(me({"expanded-preview":""!==o},"".concat(o,"-preview"),""!==o&&h),"noindex-preview",l)),f=rankMath.capitalizeTitle?ce(t):t,v=rankMathEditor.assessor.getResearch("slugify")(c);return wp.element.createElement("div",{className:g},wp.element.createElement("div",{className:"serp-preview-title","data-title":(0,r.__)("Preview","rank-math"),"data-desktop":(0,r.__)("Desktop Preview","rank-math"),"data-mobile":(0,r.__)("Mobile Preview","rank-math")},d&&wp.element.createElement(le,null)," ",h&&wp.element.createElement(ie,null)),wp.element.createElement("div",{className:"serp-preview-wrapper"},wp.element.createElement("div",{className:"serp-preview-bg"},wp.element.createElement("div",{className:"serp-preview-input"},wp.element.createElement("input",{type:"text",value:c||(0,r.__)("Rank Math","rank-math"),disabled:!0}),wp.element.createElement("span",{className:"serp-icon-search"},wp.element.createElement("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},wp.element.createElement("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}))),wp.element.createElement("span",{className:"serp-icon-mic"})),wp.element.createElement("div",{className:"serp-preview-menus"},wp.element.createElement("ul",null,wp.element.createElement("li",{className:"current"},wp.element.createElement("img",{src:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgyNHYyNEgweiIvPjxwYXRoIGZpbGw9IiMzNEE4NTMiIGQ9Ik0xMCAydjJhNiA2IDAgMCAxIDYgNmgyYTggOCAwIDAgMC04LTh6Ii8+PHBhdGggZmlsbD0iI0VBNDMzNSIgZD0iTTEwIDRWMmE4IDggMCAwIDAtOCA4aDJjMC0zLjMgMi43LTYgNi02eiIvPjxwYXRoIGZpbGw9IiNGQkJDMDQiIGQ9Ik00IDEwSDJhOCA4IDAgMCAwIDggOHYtMmMtMy4zIDAtNi0yLjY5LTYtNnoiLz48cGF0aCBmaWxsPSIjNDI4NUY0IiBkPSJNMjIgMjAuNTlsLTUuNjktNS42OUE3Ljk2IDcuOTYgMCAwIDAgMTggMTBoLTJhNiA2IDAgMCAxLTYgNnYyYzEuODUgMCAzLjUyLS42NCA0Ljg4LTEuNjhsNS42OSA1LjY5TDIyIDIwLjU5eiIvPjwvc3ZnPgo=",alt:"","data-atf":"1"}),(0,r.__)("All","rank-math")),wp.element.createElement("li",null,wp.element.createElement("svg",{focusable:"false",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),wp.element.createElement("path",{d:"M14 13l4 5H6l4-4 1.79 1.78L14 13zm-6.01-2.99A2 2 0 0 0 8 6a2 2 0 0 0-.01 4.01zM22 5v14a3 3 0 0 1-3 2.99H5c-1.64 0-3-1.36-3-3V5c0-1.64 1.36-3 3-3h14c1.65 0 3 1.36 3 3zm-2.01 0a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h7v-.01h7a1 1 0 0 0 1-1V5z"}))," ",(0,r.__)("Images","rank-math")),wp.element.createElement("li",null,wp.element.createElement("svg",{focusable:"false",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{clipRule:"evenodd",d:"M0 0h24v24H0z",fill:"none"}),wp.element.createElement("path",{clipRule:"evenodd",d:"M10 16.5l6-4.5-6-4.5v9zM5 20h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1zm14.5 2H5a3 3 0 0 1-3-3V4.4A2.4 2.4 0 0 1 4.4 2h15.2A2.4 2.4 0 0 1 22 4.4v15.1a2.5 2.5 0 0 1-2.5 2.5z",fillRule:"evenodd"}))," ",(0,r.__)("Videos","rank-math")),wp.element.createElement("li",null,wp.element.createElement("svg",{focusable:"false",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),wp.element.createElement("path",{d:"M12 11h6v2h-6v-2zm-6 6h12v-2H6v2zm0-4h4V7H6v6zm16-7.22v12.44c0 1.54-1.34 2.78-3 2.78H5c-1.64 0-3-1.25-3-2.78V5.78C2 4.26 3.36 3 5 3h14c1.64 0 3 1.25 3 2.78zM19.99 12V5.78c0-.42-.46-.78-1-.78H5c-.54 0-1 .36-1 .78v12.44c0 .42.46.78 1 .78h14c.54 0 1-.36 1-.78V12zM12 9h6V7h-6v2z"}))," ",(0,r.__)("News","rank-math")),wp.element.createElement("li",null,wp.element.createElement("svg",{focusable:"false",viewBox:"0 0 16 16"},wp.element.createElement("path",{d:"M7.503 0c3.09 0 5.502 2.487 5.502 5.427 0 2.337-1.13 3.694-2.26 5.05-.454.528-.906 1.13-1.358 1.734-.452.603-.754 1.508-.98 1.96-.226.452-.377.829-.904.829-.528 0-.678-.377-.905-.83-.226-.451-.527-1.356-.98-1.959-.452-.603-.904-1.206-1.356-1.734C3.132 9.121 2 7.764 2 5.427 2 2.487 4.412 0 7.503 0zm0 1.364c-2.283 0-4.14 1.822-4.14 4.063 0 1.843.86 2.873 1.946 4.177.468.547.942 1.178 1.4 1.79.34.452.596.99.794 1.444.198-.455.453-.992.793-1.445.459-.61.931-1.242 1.413-1.803 1.074-1.29 1.933-2.32 1.933-4.163 0-2.24-1.858-4.063-4.139-4.063zm0 2.734a1.33 1.33 0 11-.001 2.658 1.33 1.33 0 010-2.658"}))," ",(0,r.__)("Maps","rank-math")),wp.element.createElement("li",null,wp.element.createElement("svg",{focusable:"false",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},wp.element.createElement("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}))," ",(0,r.__)("More","rank-math"))),wp.element.createElement("ul",{className:"menus-right"},wp.element.createElement("li",null,(0,r.__)("Settings","rank-math")),wp.element.createElement("li",null,(0,r.__)("Tools","rank-math")))),wp.element.createElement("div",{className:"serp-preview-result-stats"},(0,r.__)("About 43,700,000 results (0.32 seconds) ","rank-math"))),wp.element.createElement("div",{className:"serp-preview-body",role:"button",tabIndex:0,onClick:function(){u&&u()}},wp.element.createElement("div",{className:"group"},wp.element.createElement("img",{src:rankMath.siteFavIcon,width:"16",height:"16",className:"serp-preview-favicon",alt:""}),wp.element.createElement("div",{className:"serp-url",dangerouslySetInnerHTML:{__html:se(v,Q((0,q.safeDecodeURIComponent)(n)),75,/-? +/)}})),wp.element.createElement("div",{className:"group"},wp.element.createElement("h5",{className:"serp-title",dangerouslySetInnerHTML:{__html:se(c,Q(f),60)}})),wp.element.createElement(pe,null),wp.element.createElement("div",{className:"group"},wp.element.createElement("div",{className:"serp-description",dangerouslySetInnerHTML:{__html:se(c,Q(a),160)}}))),wp.element.createElement("div",{className:"serp-preview-noindex"},wp.element.createElement("h3",null,(0,r.__)("Noindex robots meta is enabled","rank-math")),wp.element.createElement("p",null,(0,r.__)("This page will not appear in search results. You can disable noindex in the Advanced tab.","rank-math")))))}),ge=(0,i.withSelect)(function(e){return{isNoIndex:"noindex"in e("rank-math").getRobots()}})(function(){return wp.element.createElement("div",{className:"rank-math-editor-general"},wp.element.createElement(he,{showScore:!1,showDevices:!0}),wp.element.createElement(K,null),wp.element.createElement(ae,null),wp.element.createElement(re,null))});function fe(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t(0,o.createElement)("path",e),ye=e=>(0,o.createElement)("rect",e),be=(0,o.forwardRef)(({className:e,isPressed:t,...n},a)=>{const r={...n,className:ve(e,{"is-pressed":t})||void 0,"aria-hidden":!0,focusable:!1};return(0,o.createElement)("svg",{...r,ref:a})});function ke(e){var t=e.height,n=void 0===t?16:t,a=e.width,r=void 0===a?16:a,i=e.style,o=void 0===i?{}:i;return wp.element.createElement(be,{viewBox:"0 0 32 32",fill:"none",height:n,width:r,style:o},wp.element.createElement(ye,{width:"32",height:"32",fill:"none"}),wp.element.createElement(we,{d:"M17.9686 14.1623L26.7065 4H24.6358L17.0488 12.8238L10.9891 4H4L13.1634 17.3432L4 28H6.07069L14.0827 18.6817L20.4822 28H27.4714L17.9681 14.1623H17.9686ZM15.1326 17.4607L14.2041 16.132L6.81679 5.55961H9.99723L15.9589 14.0919L16.8873 15.4206L24.6368 26.5113H21.4564L15.1326 17.4612V17.4607Z",fill:"currentColor"}))}function _e(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=rankMath.links[e]||"";if(!a)return"#";if(!t)return a;var r={utm_source:"Plugin",utm_medium:encodeURIComponent(t),utm_campaign:"WP"},i=a,o="",l=a.indexOf("#");-1!==l&&(i=a.substring(0,l),o=a.substring(l));var s=Object.keys(r).map(function(e){return"".concat(e,"=").concat(r[e])}).join("&"),c=i.includes("?")&&!i.endsWith("?")?"&":"?";return i+c+s+o+n}be.displayName="SVG";var Ee=jQuery,Te=n.n(Ee);function xe(e){return xe="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},xe(e)}function Oe(e,t){for(var n=0;n0?(0,r.__)("Replace Image","rank-math"):(0,r.__)("Add Image","rank-math")),e.imageID>0&&wp.element.createElement(p.Button,{className:"button",isDestructive:!0,isLink:!0,onClick:e.removeImage},(0,r.__)("Remove Image","rank-math")))},onSelect:e.updateImage}),wp.element.createElement("p",{className:"components-base-control__help"},(0,r.__)("Upload at least 600x315px image. Recommended size is 1200x630px.","rank-math")),wp.element.createElement("div",{className:"notice notice-warning inline hidden"},wp.element.createElement("p",null,(0,r.__)("Image is smaller than the minimum size, please select a different image.","rank-math"))))};function Pe(){var e=rankMath.overlayImages,t=[];return Object.keys(e).forEach(function(n){t.push({label:e[n].name,value:n})}),t}function je(){return je=Object.assign?Object.assign.bind():function(e){for(var t=1;t3?n.removeClass("normal angry").addClass("happy"):n.removeClass("happy angry").addClass("normal")})}},{key:"shouldComponentUpdate",value:function(){return!1}},{key:"_handleRef",value:function(e){this.component=e}},{key:"render",value:function(){for(var e=this,t=[],n=1;n<=5;n++)t.push(wp.element.createElement("a",{key:n,href:"https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?filter=5#new-post",target:"_blank",rel:"noopener noreferrer"},wp.element.createElement("span",{className:"dashicons dashicons-star-filled"})));return wp.element.createElement("div",{className:"ask-review",ref:this._handleRef},wp.element.createElement("h3",null,(0,r.__)("Rate Rank Math SEO","rank-math")),wp.element.createElement("p",null,wp.element.createElement(R,{tags:"em"},(0,r.__)("Hey, we noticed you are using Rank Math SEO plugin for more than a week now –{{em}}that's awesome!{{/em}} Could you please do us a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?","rank-math"))),wp.element.createElement("div",{className:"stars-wrapper"},wp.element.createElement("div",{className:"face"},wp.element.createElement("div",{className:"smiley happy"},wp.element.createElement("div",{className:"eyes"},wp.element.createElement("div",{className:"eye"}),wp.element.createElement("div",{className:"eye"})),wp.element.createElement("div",{className:"mouth"}))),wp.element.createElement("div",{className:"stars"},t)),wp.element.createElement(p.CheckboxControl,{label:wp.element.createElement(o.Fragment,null,wp.element.createElement("span",null,(0,r.__)("I already did. Please don't show this message again.","rank-math"))),onChange:function(){return e.alreadyReviewed()},__nextHasNoMarginBottom:!0}))}},{key:"alreadyReviewed",value:function(){Te().ajax({url:rankMath.ajaxurl,data:{action:"rank_math_already_reviewed",security:rankMath.security}}),rankMath.pluginReviewed=!0,Te()(this.component).animate({opacity:.01},1500,function(){var e=Te()(".rank-math-editor > .components-tab-panel__tabs > button");e.first().click(),e.last().remove()})}}])}(o.Component),Je=$e,Xe=(0,p.withFilters)("rankMath.analytics.reportButton")(function(){return null}),Ze=(0,u.compose)((0,i.withSelect)(function(e){return{isOpen:e("rank-math").isSnippetEditorOpen()}}),(0,i.withDispatch)(function(e,t){return{toggleEditor:function(){e("rank-math").toggleSnippetEditor(!t.isOpen)}}}))(function(e){var t=e.isOpen,n=e.initialTab,a=void 0===n?"":n,i=e.toggleEditor,l=[{name:"general",title:wp.element.createElement(o.Fragment,null,wp.element.createElement("i",{className:"rm-icon rm-icon-settings"}),wp.element.createElement("span",null,(0,r.__)("General","rank-math"))),view:ge}];return rankMath.canUser.social&&l.push({name:"social",title:wp.element.createElement(o.Fragment,null,wp.element.createElement("i",{className:"rm-icon rm-icon-social"}),wp.element.createElement("span",null,(0,r.__)("Social","rank-math"))),view:Ue}),rankMath.showReviewTab&&!1===rankMath.pluginReviewed&&l.push({name:"review",className:"review-tab",title:wp.element.createElement(o.Fragment,null,wp.element.createElement("i",{className:"rm-icon rm-icon-heart-filled"})),view:Je}),wp.element.createElement(o.Fragment,null,wp.element.createElement(p.Button,{isPrimary:!0,className:"rank-math-edit-snippet",onClick:i},(0,r.__)("Edit Snippet","rank-math")),""===a&&wp.element.createElement(Xe,null),t&&wp.element.createElement(p.Modal,{title:(0,r.__)("Preview Snippet Editor","rank-math"),closeButtonLabel:(0,r.__)("Close","rank-math"),shouldCloseOnClickOutside:!1,onRequestClose:function(e){void 0!==e&&(document.body.classList.remove("modal-open"),i())},className:"rank-math-modal",overlayClassName:"rank-math-modal-overlay"},wp.element.createElement(p.TabPanel,{className:"rank-math-tabs rank-math-editor",activeClass:"is-active",initialTabName:a,tabs:l},function(e){return(0,o.createElement)(e.view)})))}),Qe=function(){return wp.element.createElement(p.PanelBody,{initialOpen:!0},wp.element.createElement(p.BaseControl,{className:"rank-math-social",__nextHasNoMarginBottom:!0},wp.element.createElement("span",{className:"components-base-control__label"},(0,r.__)("Social Media Preview","rank-math")),wp.element.createElement("p",{className:"cmb2-metabox-description"},(0,r.__)("Here you can view and edit the thumbnail, title and description that will be displayed when your site is shared on social media.","rank-math")),wp.element.createElement("p",{className:"cmb2-metabox-description"},(0,r.__)("Click on the button below to view and edit the preview.","rank-math")),wp.element.createElement(Ze,{buttonLabel:(0,r.__)("Preview & Edit Social Media","rank-math"),initialTab:"social"})))},et=wp.wordcount,tt=wp.richText,nt="core/annotations",at="core/annotation",rt="annotation-text-";var it={name:at,title:(0,r.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit(){return null},__experimentalGetPropsForEditableTreePreparation(e,{richTextIdentifier:t,blockClientId:n}){return{annotations:e(nt).__experimentalGetAnnotationsForRichText(n,t)}},__experimentalCreatePrepareEditableTree({annotations:e}){return(t,n)=>{if(0===e.length)return t;let a={formats:t,text:n};return a=function(e,t=[]){return t.forEach(t=>{let{start:n,end:a}=t;n>e.text.length&&(n=e.text.length),a>e.text.length&&(a=e.text.length);const r=rt+t.source,i=rt+t.id;e=(0,tt.applyFormat)(e,{type:at,attributes:{className:r,id:i}},n,a)}),e}(a,e),a.formats}},__experimentalGetPropsForEditableTreeChangeHandler(e){return{removeAnnotation:e(nt).__experimentalRemoveAnnotation,updateAnnotationRange:e(nt).__experimentalUpdateAnnotationRange}},__experimentalCreateOnChangeEditableValue(e){return t=>{const n=function(e){const t={};return e.forEach((e,n)=>{(e=(e=e||[]).filter(e=>e.type===at)).forEach(e=>{let{id:a}=e.attributes;a=a.replace(rt,""),t.hasOwnProperty(a)||(t[a]={start:n}),t[a].end=n+1})}),t}(t),{removeAnnotation:a,updateAnnotationRange:r,annotations:i}=e;!function(e,t,{removeAnnotation:n,updateAnnotationRange:a}){e.forEach(e=>{const r=t[e.id];if(!r)return void n(e.id);const{start:i,end:o}=e;i===r.start&&o===r.end||a(e.id,r.start,r.end)})}(i,n,{removeAnnotation:a,updateAnnotationRange:r})}}},{name:ot,...lt}=it;(0,tt.registerFormatType)(ot,lt);function st(e,t){const n=e.filter(t);return e.length===n.length?e:n}(0,a.addFilter)("editor.BlockListBlock","core/annotations",e=>(0,i.withSelect)((e,{clientId:t,className:n})=>({className:e(nt).__experimentalGetAnnotationsForBlock(t).map(e=>"is-annotated-by-"+e.source).concat(n).filter(Boolean).join(" ")}))(e));var ct=(e,t)=>Object.entries(e).reduce((e,[n,a])=>({...e,[n]:t(a)}),{});var ut=function(e={},t){switch(t.type){case"ANNOTATION_ADD":const n=t.blockClientId,a={id:t.id,blockClientId:n,richTextIdentifier:t.richTextIdentifier,source:t.source,selector:t.selector,range:t.range};if("range"===a.selector&&!function(e){return"number"==typeof e.start&&"number"==typeof e.end&&e.start<=e.end}(a.range))return e;const r=e?.[n]??[];return{...e,[n]:[...r,a]};case"ANNOTATION_REMOVE":return ct(e,e=>st(e,e=>e.id!==t.annotationId));case"ANNOTATION_UPDATE_RANGE":return ct(e,e=>{let n=!1;const a=e.map(e=>e.id===t.annotationId?(n=!0,{...e,range:{start:t.start,end:t.end}}):e);return n?a:e});case"ANNOTATION_REMOVE_SOURCE":return ct(e,e=>st(e,e=>e.source!==t.source))}return e},pt=[],dt=(0,i.createSelector)((e,t)=>(e?.[t]??[]).filter(e=>"block"===e.selector),(e,t)=>[e?.[t]??pt]);function mt(e,t){return e?.[t]??pt}var ht=(0,i.createSelector)((e,t,n)=>(e?.[t]??[]).filter(e=>"range"===e.selector&&n===e.richTextIdentifier).map(e=>{const{range:t,...n}=e;return{...t,...n}}),(e,t)=>[e?.[t]??pt]);function gt(e){return Object.values(e).flat()}var ft={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let vt;const wt=new Uint8Array(16);function yt(){if(!vt&&(vt="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vt(wt)}const bt=[];for(let e=0;e<256;++e)bt.push((e+256).toString(16).slice(1));function kt(e,t=0){return bt[e[t+0]]+bt[e[t+1]]+bt[e[t+2]]+bt[e[t+3]]+"-"+bt[e[t+4]]+bt[e[t+5]]+"-"+bt[e[t+6]]+bt[e[t+7]]+"-"+bt[e[t+8]]+bt[e[t+9]]+"-"+bt[e[t+10]]+bt[e[t+11]]+bt[e[t+12]]+bt[e[t+13]]+bt[e[t+14]]+bt[e[t+15]]}var _t=function(e,t,n){if(ft.randomUUID&&!t&&!e)return ft.randomUUID();const a=(e=e||{}).random||(e.rng||yt)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=a[e];return t}return kt(a)};function Et({blockClientId:e,richTextIdentifier:t=null,range:n=null,selector:a="range",source:r="default",id:i=_t()}){const o={type:"ANNOTATION_ADD",id:i,blockClientId:e,richTextIdentifier:t,source:r,selector:a};return"range"===a&&(o.range=n),o}function Tt(e){return{type:"ANNOTATION_REMOVE",annotationId:e}}function xt(e,t,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:e,start:t,end:n}}function Ot(e){return{type:"ANNOTATION_REMOVE_SOURCE",source:e}}var St=(0,i.createReduxStore)(nt,{reducer:ut,selectors:e,actions:t});function Nt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,r=function(){};return{s:r,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){l=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(l)throw i}}}}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if("classic"!==rankMath.currentEditor){if(!e)return(0,i.dispatch)(It).__experimentalRemoveAnnotationsBySource(Mt),void n([]);var r=(0,i.select)("core/block-editor").getBlocks();(0,c.forEach)(r,function(e){if("core/paragraph"===e.name){var a=e.clientId;(0,et.count)(e.attributes.content,"words")<120?(0,c.includes)(t,a)&&((0,i.dispatch)(It).__experimentalRemoveAnnotation(a),t=(0,c.remove)(t,a),n(t)):(t.push(a),n(t),(0,i.dispatch)(It).__experimentalAddAnnotation({id:a,blockClientId:a,source:Mt,richTextIdentifier:"content",range:{start:0,end:e.attributes.content.length}}))}})}else!function(e){var t=window.tinymce.get(window.wpActiveEditor);if(!t)return!1;if(!e)return t.focus(),t.annotator.remove(Mt),void(0,a.doAction)("rank_math_annotations_removed");var n=t.getBody().children||[];Dt(n,t)}(e)},Pt=(0,p.withFilters)("rankMath.checklists.FixWithAI")(function(){return null});function jt(e){return jt="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},jt(e)}function Rt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,a=new Array(t);n/g,">").replace(/"/g,""").replace(/`|'/g,"'"):e}function sn(e){var t=Object.prototype.toString.call(e).split(" ")[1].slice(0,-1);return e===Object(e)&&"Array"!=t&&"Function"!=t&&"RegExp"!=t&&"HTMLUnknownElement"!=t}function cn(e,t,n){var a,r;function i(e,t){for(var n in t)if(t.hasOwnProperty(n)){if(sn(t[n])){sn(e[n])?i(e[n],t[n]):e[n]=Object.assign({},t[n]);continue}if(Array.isArray(t[n])){e[n]=Object.assign([],t[n]);continue}e[n]=t[n]}}return a=e,(null!=(r=Object)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?r[Symbol.hasInstance](a):a instanceof r)||(e={}),i(e,t),n&&i(e,n),e}function un(){var e=[],t={},n=!0,a=!1,r=void 0;try{for(var i,o=arguments[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){var l=i.value,s=!0,c=!1,u=void 0;try{for(var p,d=l[Symbol.iterator]();!(s=(p=d.next()).done);s=!0){var m=p.value;sn(m)?t[m.value]||(e.push(m),t[m.value]=1):e.includes(m)||e.push(m)}}catch(e){c=!0,u=e}finally{try{s||null==d.return||d.return()}finally{if(c)throw u}}}}catch(e){a=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw r}}return e}function pn(e){return String.prototype.normalize?"string"==typeof e?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):void 0:e}var dn=function(){return/(?=.*chrome)(?=.*android)/i.test(navigator.userAgent)};function mn(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}function hn(e){var t,n=fn.call(this,e),a=null==e||null===(t=e.classList)||void 0===t?void 0:t.contains(this.settings.classNames.tag);return n&&a}function gn(e){return fn.call(this,e)&&(null==e?void 0:e.closest(this.settings.classNames.tagSelector))}function fn(e){var t;return(null==e||null===(t=e.closest)||void 0===t?void 0:t.call(e,this.settings.classNames.namespaceSelector))===this.DOM.scope}function vn(e,t){var n=window.getSelection();return t=t||n.getRangeAt(0),"string"==typeof e&&(e=document.createTextNode(e)),t&&(t.deleteContents(),t.insertNode(e)),e}function wn(e,t,n){return e?(t&&(e.__tagifyTagData=n?t:cn({},e.__tagifyTagData||{},t)),e.__tagifyTagData):(en.warn("tag element doesn't exist",{tagElm:e,data:t}),t)}function yn(e){if(e&&e.parentNode){var t=e,n=window.getSelection(),a=n.getRangeAt(0);n.rangeCount&&(a.setStartAfter(t),a.collapse(!0),n.removeAllRanges(),n.addRange(a))}}function bn(e,t){e.forEach(function(e){if(wn(e.previousSibling)||!e.previousSibling){var n=document.createTextNode("​");e.before(n),t&&yn(n)}})}var kn={delimiters:",",pattern:null,tagTextProp:"value",maxTags:1/0,callbacks:{},addTagOnBlur:!0,addTagOn:["blur","tab","enter"],onChangeAfterBlur:!0,duplicates:!1,whitelist:[],blacklist:[],enforceWhitelist:!1,userInput:!0,focusable:!0,focusInputOnRemove:!0,keepInvalidTags:!1,createInvalidTags:!0,mixTagsAllowedAfter:/,|\.|\:|\s/,mixTagsInterpolator:["[[","]]"],backspace:!0,skipInvalid:!1,pasteAsTags:!0,editTags:{clicks:2,keepInvalid:!0},transformTag:function(){},trim:!0,a11y:{focusableTags:!1,inputAriaLabel:"Tags input field"},mixMode:{insertAfterTag:" "},autoComplete:{enabled:!0,rightKey:!1,tabKey:!1},classNames:{namespace:"tagify",mixMode:"tagify--mix",selectMode:"tagify--select",input:"tagify__input",focus:"tagify--focus",tagNoAnimation:"tagify--noAnim",tagInvalid:"tagify--invalid",tagNotAllowed:"tagify--notAllowed",scopeLoading:"tagify--loading",hasMaxTags:"tagify--hasMaxTags",hasNoTags:"tagify--noTags",empty:"tagify--empty",inputInvalid:"tagify__input--invalid",dropdown:"tagify__dropdown",dropdownWrapper:"tagify__dropdown__wrapper",dropdownHeader:"tagify__dropdown__header",dropdownFooter:"tagify__dropdown__footer",dropdownItem:"tagify__dropdown__item",dropdownItemActive:"tagify__dropdown__item--active",dropdownItemHidden:"tagify__dropdown__item--hidden",dropdownItemSelected:"tagify__dropdown__item--selected",dropdownInital:"tagify__dropdown--initial",tag:"tagify__tag",tagText:"tagify__tag-text",tagX:"tagify__tag__removeBtn",tagLoading:"tagify__tag--loading",tagEditing:"tagify__tag--editable",tagFlash:"tagify__tag--flash",tagHide:"tagify__tag--hide"},dropdown:{classname:"",enabled:2,maxItems:10,searchKeys:["value","searchBy"],fuzzySearch:!0,caseSensitive:!1,accentedSearch:!0,includeSelectedTags:!1,escapeHTML:!0,highlightFirst:!0,closeOnSelect:!0,clearOnSelect:!0,position:"all",appendTarget:null},hooks:{beforeRemoveTag:function(){return Promise.resolve()},beforePaste:function(){return Promise.resolve()},suggestionClick:function(){return Promise.resolve()},beforeKeyDown:function(){return Promise.resolve()}}};function _n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function En(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,a=new Array(t);n0&&void 0!==arguments[0])||arguments[0],t=this.dropdown.events.callbacks,n=this.listeners.dropdown=this.listeners.dropdown||{position:this.dropdown.position.bind(this,null),onKeyDown:t.onKeyDown.bind(this),onMouseOver:t.onMouseOver.bind(this),onMouseLeave:t.onMouseLeave.bind(this),onClick:t.onClick.bind(this),onScroll:t.onScroll.bind(this)},a=e?"addEventListener":"removeEventListener";"manual"!=this.settings.dropdown.position&&(document[a]("scroll",n.position,!0),window[a]("resize",n.position),window[a]("keydown",n.onKeyDown)),this.DOM.dropdown[a]("mouseover",n.onMouseOver),this.DOM.dropdown[a]("mouseleave",n.onMouseLeave),this.DOM.dropdown[a]("mousedown",n.onClick),this.DOM.dropdown.content[a]("scroll",n.onScroll)},callbacks:{onKeyDown:function(e){var t=this;if(this.state.hasFocus&&!this.state.composing){var n=this.settings,a=n.dropdown.includeSelectedTags,r=this.DOM.dropdown.querySelector(n.classNames.dropdownItemActiveSelector),i=this.dropdown.getSuggestionDataByNode(r),o="mix"==n.mode,l="select"==n.mode;n.hooks.beforeKeyDown(e,{tagify:this}).then(function(s){switch(e.key){case"ArrowDown":case"ArrowUp":case"Down":case"Up":e.preventDefault();var c=t.dropdown.getAllSuggestionsRefs(),u="ArrowUp"==e.key||"Up"==e.key;r&&(r=t.dropdown.getNextOrPrevOption(r,!u)),r&&r.matches(n.classNames.dropdownItemSelector)||(r=c[u?c.length-1:0]),t.dropdown.highlightOption(r,!0);break;case"PageUp":case"PageDown":var p;e.preventDefault();var d=t.dropdown.getAllSuggestionsRefs(),m=Math.floor(t.DOM.dropdown.content.clientHeight/(null===(p=d[0])||void 0===p?void 0:p.offsetHeight))||1,h="PageUp"===e.key;if(r){var g=d.indexOf(r),f=h?Math.max(0,g-m):Math.min(d.length-1,g+m);r=d[f]}else r=d[0];t.dropdown.highlightOption(r,!0);break;case"Home":case"End":e.preventDefault();var v=t.dropdown.getAllSuggestionsRefs();r=v["Home"===e.key?0:v.length-1],t.dropdown.highlightOption(r,!0);break;case"Escape":case"Esc":t.dropdown.hide();break;case"ArrowRight":if(t.state.actions.ArrowLeft||n.autoComplete.rightKey)return;case"Tab":var w=!n.autoComplete.rightKey||!n.autoComplete.tabKey;if(!o&&!l&&r&&w&&!t.state.editing&&i){e.preventDefault();var y=t.dropdown.getMappedValue(i);return t.state.autoCompleteData=i,t.input.autocomplete.set.call(t,y),!1}return!0;case"Enter":e.preventDefault(),t.state.actions.selectOption=!0,setTimeout(function(){return t.state.actions.selectOption=!1},100),n.hooks.suggestionClick(e,{tagify:t,tagData:i,suggestionElm:r}).then(function(){if(r){var n=a?r:t.dropdown.getNextOrPrevOption(r,!u);t.dropdown.selectOption(r,e,function(){if(n){var e=n.getAttribute("value");n=t.dropdown.getSuggestionNodeByValue(e),t.dropdown.highlightOption(n)}})}else t.dropdown.hide(),o||t.addTags(t.state.inputText.trim(),!0)}).catch(function(e){return en.warn(e)});break;case"Backspace":if(o||t.state.editing.scope)return;var b=t.input.raw.call(t);""!=b&&8203!=b.charCodeAt(0)||(!0===n.backspace?t.removeTags():"edit"==n.backspace&&setTimeout(t.editTag.bind(t),0))}})}},onMouseOver:function(e){var t=e.target.closest(this.settings.classNames.dropdownItemSelector);this.dropdown.highlightOption(t)},onMouseLeave:function(e){this.dropdown.highlightOption()},onClick:function(e){var t=this;if(0==e.button&&e.target!=this.DOM.dropdown&&e.target!=this.DOM.dropdown.content){var n=e.target.closest(this.settings.classNames.dropdownItemSelector),a=this.dropdown.getSuggestionDataByNode(n);this.state.actions.selectOption=!0,setTimeout(function(){return t.state.actions.selectOption=!1},100),this.settings.hooks.suggestionClick(e,{tagify:this,tagData:a,suggestionElm:n}).then(function(){n?t.dropdown.selectOption(n,e):t.dropdown.hide()}).catch(function(e){return en.warn(e)})}},onScroll:function(e){var t=e.target,n=t.scrollTop/(t.scrollHeight-t.parentNode.clientHeight)*100;this.trigger("dropdown:scroll",{percentage:Math.round(n)})}}},refilter:function(e){e=e||this.state.dropdown.query||"",this.suggestedListItems=this.dropdown.filterListItems(e),this.dropdown.fill(),this.suggestedListItems.length||this.dropdown.hide(),this.trigger("dropdown:updated",this.DOM.dropdown)},getSuggestionDataByNode:function(e){for(var t,n=e&&e.getAttribute("value"),a=this.suggestedListItems.length;a--;){if(sn(t=this.suggestedListItems[a])&&t.value==n)return t;if(t==n)return{value:t}}},getSuggestionNodeByValue:function(e){return this.dropdown.getAllSuggestionsRefs().find(function(t){return t.getAttribute("value")===e})},getNextOrPrevOption:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.dropdown.getAllSuggestionsRefs(),a=n.findIndex(function(t){return t===e});return t?n[a+1]:n[a-1]},highlightOption:function(e,t){var n,a=this.settings.classNames.dropdownItemActive;if(this.state.ddItemElm&&(this.state.ddItemElm.classList.remove(a),this.state.ddItemElm.removeAttribute("aria-selected")),!e)return this.state.ddItemData=null,this.state.ddItemElm=null,void this.input.autocomplete.suggest.call(this);n=this.dropdown.getSuggestionDataByNode(e),this.state.ddItemData=n,this.state.ddItemElm=e,e.classList.add(a),e.setAttribute("aria-selected",!0),t&&(e.parentNode.scrollTop=e.clientHeight+e.offsetTop-e.parentNode.clientHeight),this.settings.autoComplete&&(this.input.autocomplete.suggest.call(this,n),this.dropdown.position())},selectOption:function(e,t,n){var a=this,r=this.settings,i=r.dropdown.includeSelectedTags,o=r.dropdown,l=o.clearOnSelect,s=o.closeOnSelect;if(!e)return this.addTags(this.state.inputText,!0),void(s&&this.dropdown.hide());t=t||{};var c=e.getAttribute("value"),u="noMatch"==c,p="mix"==r.mode,d=this.suggestedListItems.find(function(e){var t;return(null!==(t=e.value)&&void 0!==t?t:e)==c});if(this.trigger("dropdown:select",{data:d,elm:e,event:t}),d||u){if(this.state.editing){var m=this.normalizeTags([d])[0];d=r.transformTag.call(this,m)||m,this.onEditTagDone(null,cn({__isValid:!0},d))}else this[p?"addMixTags":"addTags"]([d||this.input.raw.call(this)],l);(p||this.DOM.input.parentNode)&&(setTimeout(function(){a.DOM.input.focus(),a.toggleFocusClass(!0)}),s&&setTimeout(this.dropdown.hide.bind(this)),i?n&&n():(e.addEventListener("transitionend",function(){a.dropdown.fillHeaderFooter(),setTimeout(function(){e.remove(),a.dropdown.refilter(),n&&n()},100)},{once:!0}),e.classList.add(this.settings.classNames.dropdownItemHidden)))}else s&&setTimeout(this.dropdown.hide.bind(this))},selectAll:function(e){this.suggestedListItems.length=0,this.dropdown.hide(),this.dropdown.filterListItems("");var t=this.dropdown.filterListItems("");return e||(t=this.state.dropdown.suggestions),this.addTags(t,!0),this},filterListItems:function(e,t){var n,a,r,i,o,l,s=function(){var e,s,c=void 0,u=void 0;e=h[y],a=(null!=(s=Object)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](e):e instanceof s)?h[y]:{value:h[y]};var g,f=Object.keys(a).some(function(e){return w.includes(e)})?w:["value"];p.fuzzySearch&&!t.exact?(i=f.reduce(function(e,t){return e+" "+(a[t]||"")},"").toLowerCase().trim(),p.accentedSearch&&(i=pn(i),l=pn(l)),c=0==i.indexOf(l),u=i===l,g=i,r=l.toLowerCase().split(" ").every(function(e){return g.includes(e.toLowerCase())})):(c=!0,r=f.some(function(e){var n=""+(a[e]||"");return p.accentedSearch&&(n=pn(n),l=pn(l)),p.caseSensitive||(n=n.toLowerCase()),u=n===l,t.exact?n===l:0==n.indexOf(l)})),o=!p.includeSelectedTags&&n.isTagDuplicate(sn(a)?a.value:a),r&&!o&&(u&&c?m.push(a):"startsWith"==p.sortby&&c?d.unshift(a):d.push(a))},c=this,u=this.settings,p=u.dropdown,d=(t=t||{},[]),m=[],h=u.whitelist,g=p.maxItems>=0?p.maxItems:1/0,f=p.includeSelectedTags,v="function"==typeof p.sortby,w=p.searchKeys,y=0;if(!(e="select"==u.mode&&this.value.length&&this.value[0][u.tagTextProp]==e?"":e)||!w.length){d=f?h:h.filter(function(e){return!c.isTagDuplicate(sn(e)?e.value:e)});var b=v?p.sortby(d,l):d.slice(0,g);return this.state.dropdown.suggestions=b,b}for(l=p.caseSensitive?""+e:(""+e).toLowerCase();y[\r\n ]+\<").split(/>\s+<").trim():""},fillHeaderFooter:function(){var e=this.dropdown.filterListItems(this.state.dropdown.query),t=this.parseTemplate("dropdownHeader",[e]),n=this.parseTemplate("dropdownFooter",[e]),a=this.dropdown.getHeaderRef(),r=this.dropdown.getFooterRef();t&&(null==a||a.parentNode.replaceChild(t,a)),n&&(null==r||r.parentNode.replaceChild(n,r))},position:function(e){var t=this.settings.dropdown,n=this.dropdown.getAppendTarget();if("manual"!=t.position&&n){var a,r,i,o,l,s,c,u,p,d,m=this.DOM.dropdown,h=t.RTL,g=n===document.body,f=n===this.DOM.scope,v=g?window.pageYOffset:n.scrollTop,w=document.fullscreenElement||document.webkitFullscreenElement||document.documentElement,y=w.clientHeight,b=Math.max(w.clientWidth||0,window.innerWidth||0),k=b>480?t.position:"all",_=this.DOM["input"==k?"input":"scope"];if(e=e||m.clientHeight,this.state.dropdown.visible){if("text"==k?(i=(a=function(){var e=document.getSelection();if(e.rangeCount){var t,n,a=e.getRangeAt(0),r=a.startContainer,i=a.startOffset;if(i>0)return(n=document.createRange()).setStart(r,i-1),n.setEnd(r,i),{left:(t=n.getBoundingClientRect()).right,top:t.top,bottom:t.bottom};if(r.getBoundingClientRect)return r.getBoundingClientRect()}return{left:-9999,top:-9999}}()).bottom,r=a.top,o=a.left,l="auto"):(s=function(e){var t=0,n=0;for(e=e.parentNode;e&&e!=w;)t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.parentNode;return{top:t,left:n}}(n),a=_.getBoundingClientRect(),r=f?-1:a.top-s.top,i=(f?a.height:a.bottom-s.top)-1,o=f?-1:a.left-s.left,l=a.width+"px"),!g){var E=function(){for(var e=0,n=t.appendTarget.parentNode;n;)e+=n.scrollTop||0,n=n.parentNode;return e}();r+=E,i+=E}var T;r=Math.floor(r),i=Math.ceil(i),u=b-o<120,p=((c=null!==(T=t.placeAbove)&&void 0!==T?T:y-a.bottom\n ').concat(this.settings.templates.input.call(this),"\n ").concat(Xt,"\n ")},input:function(){var e=this.settings,t=e.placeholder||Xt;return"')},tag:function(e,t){var n=t.settings;return'\n \n
\n ').concat(e[n.tagTextProp]||e.value,"\n
\n
")},dropdown:function(e){var t=e.dropdown,n="manual"==t.position;return'
\n
\n
')},dropdownContent:function(e){var t=this.settings.templates,n=this.state.dropdown.suggestions;return"\n ".concat(t.dropdownHeader.call(this,n),"\n ").concat(e,"\n ").concat(t.dropdownFooter.call(this,n),"\n ")},dropdownItem:function(e){return"
').concat(e.mappedValue||e.value,"
")},dropdownHeader:function(e){return"
')},dropdownFooter:function(e){var t=e.length-this.settings.dropdown.maxItems;return t>0?"
\n ').concat(t," more items. Refine your search.\n
"):""},dropdownItemNoMatch:null};function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);n0&&void 0!==arguments[0])||arguments[0],n=this.settings,a=this.events.callbacks,r=t?"addEventListener":"removeEventListener";if(!(this.state.mainEvents&&t||n.disabled||n.readonly)){for(var i in this.state.mainEvents=t,t&&!this.listeners.main&&(this.events.bindGlobal.call(this),this.settings.isJQueryPlugin&&jQuery(this.DOM.originalInput).on("tagify.removeAllTags",this.removeAllTags.bind(this))),e=this.listeners.main=this.listeners.main||{keydown:["input",a.onKeydown.bind(this)],click:["scope",a.onClickScope.bind(this)],dblclick:"select"!=n.mode&&["scope",a.onDoubleClickScope.bind(this)],paste:["input",a.onPaste.bind(this)],drop:["input",a.onDrop.bind(this)],compositionstart:["input",a.onCompositionStart.bind(this)],compositionend:["input",a.onCompositionEnd.bind(this)]})e[i]&&this.DOM[e[i][0]][r](i,e[i][1]);var o=this.listeners.main.inputMutationObserver||new MutationObserver(a.onInputDOMChange.bind(this));o.disconnect(),"mix"==n.mode&&o.observe(this.DOM.input,{childList:!0}),this.events.bindOriginaInputListener.call(this),t&&(this.listeners.main=void 0)}},bindOriginaInputListener:function(e){var t=(e||0)+500;this.listeners.main&&(clearInterval(this.listeners.main.originalInputValueObserverInterval),this.listeners.main.originalInputValueObserverInterval=setInterval(this.events.callbacks.observeOriginalInputValue.bind(this),t))},bindGlobal:function(e){var t,n=this.events.callbacks,a=e?"removeEventListener":"addEventListener";if(this.listeners&&(e||!this.listeners.global)){this.listeners.global=this.listeners.global||[{type:this.isIE?"keydown":"input",target:this.DOM.input,cb:n[this.isIE?"onInputIE":"onInput"].bind(this)},{type:"keydown",target:window,cb:n.onWindowKeyDown.bind(this)},{type:"focusin",target:this.DOM.scope,cb:n.onFocusBlur.bind(this)},{type:"focusout",target:this.DOM.scope,cb:n.onFocusBlur.bind(this)},{type:"click",target:document,cb:n.onClickAnywhere.bind(this),useCapture:!0}];var r=!0,i=!1,o=void 0;try{for(var l,s=this.listeners.global[Symbol.iterator]();!(r=(l=s.next()).done);r=!0)(t=l.value).target[a](t.type,t.cb,!!t.useCapture)}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}e&&(this.listeners.global=void 0)}},unbindGlobal:function(){this.events.bindGlobal.call(this,!0)},callbacks:{onFocusBlur:function(e){var t,n,a=this.settings,r=gn.call(this,e.relatedTarget),i=hn.call(this,e.target),o=e.target.classList.contains(a.classNames.tagX),l="focusin"==e.type,s="focusout"==e.type;o&&"mix"!=a.mode&&a.focusInputOnRemove&&this.DOM.input.focus(),r&&l&&!i&&!o&&this.toggleFocusClass(this.state.hasFocus=+new Date);var c=e.target?this.trim(this.DOM.input.textContent):"",u=null===(n=this.value)||void 0===n||null===(t=n[0])||void 0===t?void 0:t[a.tagTextProp],p=a.dropdown.enabled>=0,d={relatedTarget:e.relatedTarget},m=this.state.actions.selectOption&&(p||!a.dropdown.closeOnSelect),h=this.state.actions.addNew&&p;if(s){if(e.relatedTarget===this.DOM.scope)return this.dropdown.hide(),void this.DOM.input.focus();this.postUpdate(),a.onChangeAfterBlur&&this.triggerChangeEvent()}if(!(m||h||o))if(this.state.hasFocus=!(!l&&!r)&&+new Date,this.toggleFocusClass(this.state.hasFocus),"mix"!=a.mode){if(l){if(!a.focusable)return;var g=0===a.dropdown.enabled&&!this.state.dropdown.visible,f=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector);return this.trigger("focus",d),void(g&&!i&&(this.dropdown.show(this.value.length?"":void 0),"select"===a.mode&&this.setRangeAtStartEnd(!1,f)))}if(s){if(this.trigger("blur",d),this.loading(!1),"select"==a.mode){if(this.value.length){var v=this.getTagElms()[0];c=this.trim(v.textContent)}u===c&&(c="")}c&&!this.state.actions.selectOption&&a.addTagOnBlur&&a.addTagOn.includes("blur")&&this.addTags(c,!0)}r||(this.DOM.input.removeAttribute("style"),this.dropdown.hide())}else l?this.trigger("focus",d):s&&(this.trigger("blur",d),this.loading(!1),this.dropdown.hide(),this.state.dropdown.visible=void 0,this.setStateSelection())},onCompositionStart:function(e){this.state.composing=!0},onCompositionEnd:function(e){this.state.composing=!1},onWindowKeyDown:function(e){var t,n=this.settings,a=document.activeElement,r=gn.call(this,a)&&this.DOM.scope.contains(a),i=a===this.DOM.input,o=r&&a.hasAttribute("readonly"),l=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector),s=this.state.dropdown.visible;if(("Tab"===e.key&&s||this.state.hasFocus||r&&!o)&&!i){t=a.nextElementSibling;var c=e.target.classList.contains(n.classNames.tagX);switch(e.key){case"Backspace":n.readonly||this.state.editing||(this.removeTags(a),(t||this.DOM.input).focus());break;case"Enter":if(c)return void this.removeTags(e.target.parentNode);n.a11y.focusableTags&&hn.call(this,a)&&setTimeout(this.editTag.bind(this),0,a);break;case"ArrowDown":this.state.dropdown.visible||"mix"==n.mode||this.dropdown.show();break;case"Tab":null==l||l.focus()}}},onKeydown:function(e){var t=this,n=this.settings;if(!this.state.composing&&n.userInput){"select"==n.mode&&n.enforceWhitelist&&this.value.length&&"Tab"!=e.key&&e.preventDefault();var a=this.trim(e.target.textContent);this.trigger("keydown",{event:e}),n.hooks.beforeKeyDown(e,{tagify:this}).then(function(r){if("mix"==n.mode){switch(e.key){case"Left":case"ArrowLeft":t.state.actions.ArrowLeft=!0;break;case"Delete":case"Backspace":if(t.state.editing)return;var i=document.getSelection(),o="Delete"==e.key&&i.anchorOffset==(i.anchorNode.length||0),l=i.anchorNode.previousSibling,s=1==i.anchorNode.nodeType||!i.anchorOffset&&l&&1==l.nodeType&&i.anchorNode.previousSibling;!function(e){var t=document.createElement("div");e.replace(/\&#?[0-9a-z]+;/gi,function(e){return t.innerHTML=e,t.innerText})}(t.DOM.input.innerHTML);var c,u,p,d=t.getTagElms(),m=1===i.anchorNode.length&&i.anchorNode.nodeValue==String.fromCharCode(8203);if("edit"==n.backspace&&s)return c=1==i.anchorNode.nodeType?null:i.anchorNode.previousElementSibling,setTimeout(t.editTag.bind(t),0,c),void e.preventDefault();if(dn()&&Fn(s,Element))return p=on(s),s.hasAttribute("readonly")||s.remove(),t.DOM.input.focus(),void setTimeout(function(){yn(p),t.DOM.input.click()});if("BR"==i.anchorNode.nodeName)return;if((o||s)&&1==i.anchorNode.nodeType?u=0==i.anchorOffset?o?d[0]:null:d[Math.min(d.length,i.anchorOffset)-1]:o?u=i.anchorNode.nextElementSibling:Fn(s,Element)&&(u=s),3==i.anchorNode.nodeType&&!i.anchorNode.nodeValue&&i.anchorNode.previousElementSibling&&e.preventDefault(),(s||o)&&!n.backspace)return void e.preventDefault();if("Range"!=i.type&&!i.anchorOffset&&i.anchorNode==t.DOM.input&&"Delete"!=e.key)return void e.preventDefault();if("Range"!=i.type&&u&&u.hasAttribute("readonly"))return void yn(on(u));"Delete"==e.key&&m&&wn(i.anchorNode.nextSibling)&&t.removeTags(i.anchorNode.nextSibling);break;case"Enter":if(e.preventDefault(),t.state.tag)return;var h=window.getSelection();h.getRangeAt(0).insertNode(document.createElement("br")),h.collapseToEnd()}return!0}var g="manual"==n.dropdown.position;switch(e.key){case"Backspace":"select"==n.mode&&n.enforceWhitelist&&t.value.length?t.removeTags():t.state.dropdown.visible&&"manual"!=n.dropdown.position||""!=e.target.textContent&&8203!=a.charCodeAt(0)||(!0===n.backspace?t.removeTags():"edit"==n.backspace&&setTimeout(t.editTag.bind(t),0));break;case"Esc":case"Escape":if(t.state.dropdown.visible)return;e.target.blur();break;case"Down":case"ArrowDown":t.state.dropdown.visible||t.dropdown.show();break;case"ArrowRight":var f=t.state.inputSuggestion||t.state.ddItemData;if(f&&n.autoComplete.rightKey)return void t.addTags([f],!0);break;case"Tab":if(!n.addTagOn.includes(e.key.toLowerCase()))break;case"Enter":if(t.state.dropdown.visible&&!g)return;var v=t.state.autoCompleteData||a;if(!v&&"Tab"===e.key)return!0;e.preventDefault(),setTimeout(function(){t.state.dropdown.visible&&!g||t.state.actions.selectOption||!n.addTagOn.includes(e.key.toLowerCase())||(t.addTags([v],!0),t.state.autoCompleteData=null)})}}).catch(function(e){return e})}},onInput:function(e){this.postUpdate();var t=this.settings;if("mix"==t.mode)return this.events.callbacks.onMixTagsInput.call(this,e);var n=this.input.normalize.call(this,void 0,{trim:!1}),a=n.length>=t.dropdown.enabled,r={value:n,inputElm:this.DOM.input},i=this.validateTag({value:n});"select"==t.mode&&this.toggleScopeValidation(i),r.isValid=i,this.state.inputText!=n&&(this.input.set.call(this,n,!1),-1!=n.search(t.delimiters)?this.addTags(n)&&this.input.set.call(this):t.dropdown.enabled>=0&&this.dropdown[a?"show":"hide"](n),this.trigger("input",r))},onMixTagsInput:function(e){var t,n,a,r,i,o,l,s,c=this,u=this.settings,p=this.value.length,d=this.getTagElms(),m=document.createDocumentFragment(),h=window.getSelection().getRangeAt(0),g=[].map.call(d,function(e){return wn(e).value});if("deleteContentBackward"==e.inputType&&dn()&&this.events.callbacks.onKeydown.call(this,{target:e.target,key:"Backspace"}),bn(this.getTagElms()),this.value.slice().forEach(function(e){e.readonly&&!g.includes(e.value)&&m.appendChild(c.createTagElem(e))}),m.childNodes.length&&(h.insertNode(m),this.setRangeAtStartEnd(!1,m.lastChild)),d.length!=p)return this.value=[].map.call(this.getTagElms(),function(e){return wn(e)}),void this.update({withoutChangeEvent:!0});if(this.hasMaxTags())return!0;if(window.getSelection&&(o=window.getSelection()).rangeCount>0&&3==o.anchorNode.nodeType){if((h=o.getRangeAt(0).cloneRange()).collapse(!0),h.setStart(o.focusNode,0),a=(t=h.toString().slice(0,h.endOffset)).split(u.pattern).length-1,(n=t.match(u.pattern))&&(r=t.slice(t.lastIndexOf(n[n.length-1]))),r){if(this.state.actions.ArrowLeft=!1,this.state.tag={prefix:r.match(u.pattern)[0],value:r.replace(u.pattern,"")},this.state.tag.baseOffset=o.baseOffset-this.state.tag.value.length,s=this.state.tag.value.match(u.delimiters))return this.state.tag.value=this.state.tag.value.replace(u.delimiters,""),this.state.tag.delimiters=s[0],this.addTags(this.state.tag.value,u.dropdown.clearOnSelect),void this.dropdown.hide();i=this.state.tag.value.length>=u.dropdown.enabled;try{l=(l=this.state.flaggedTags[this.state.tag.baseOffset]).prefix==this.state.tag.prefix&&l.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(e){}(l||a500||!t.focusable)?this.state.dropdown.visible?this.dropdown.hide():0===t.dropdown.enabled&&"mix"!=t.mode&&this.dropdown.show(this.value.length?"":void 0):"select"!=t.mode||0!==t.dropdown.enabled||this.state.dropdown.visible||(this.events.callbacks.onDoubleClickScope.call(this,function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}(function(e){for(var t=1;t=this.settings.dropdown.enabled&&(this.state.editing&&(this.state.editing.value=o),this.dropdown.show(o)),this.trigger("edit:input",{tag:a,index:r,data:cn({},this.value[r],{newValue:o}),event:t})},onEditTagPaste:function(e,t){var n=(t.clipboardData||window.clipboardData).getData("Text");t.preventDefault();var a=vn(n);this.setRangeAtStartEnd(!1,a)},onEditTagClick:function(e,t){this.events.callbacks.onClickScope.call(this,t)},onEditTagFocus:function(e){this.state.editing={scope:e,input:e.querySelector("[contenteditable]")}},onEditTagBlur:function(e,t){var n=hn.call(this,t.relatedTarget);if("select"==this.settings.mode&&n&&t.relatedTarget.contains(t.target))this.dropdown.hide();else if(this.state.editing&&(this.state.hasFocus||this.toggleFocusClass(),this.DOM.scope.contains(document.activeElement)||this.trigger("blur",{}),this.DOM.scope.contains(e))){var a,r,i,o=this.settings,l=e.closest("."+o.classNames.tag),s=wn(l),c=this.input.normalize.call(this,e),u=(Ln(a={},o.tagTextProp,c),Ln(a,"__tagId",s.__tagId),a),p=s.__originalData,d=this.editTagChangeDetected(cn(s,u)),m=this.validateTag(u);if(c)if(d){var h;if(r=this.hasMaxTags(),i=cn({},p,(Ln(h={},o.tagTextProp,this.trim(c)),Ln(h,"__isValid",m),h)),o.transformTag.call(this,i,p),!0!==(m=(!r||!0===p.__isValid)&&this.validateTag(i))){if(this.trigger("invalid",{data:i,tag:l,message:m}),o.editTags.keepInvalid)return;o.keepInvalidTags?i.__isValid=m:i=p}else o.keepInvalidTags&&(delete i.title,delete i["aria-invalid"],delete i.class);this.onEditTagDone(l,i)}else this.onEditTagDone(l,p);else this.onEditTagDone(l)}},onEditTagkeydown:function(e,t){if(!this.state.composing)switch(this.trigger("edit:keydown",{event:e}),e.key){case"Esc":case"Escape":this.state.editing=!1,t.__tagifyTagData.__originalData.value?t.parentNode.replaceChild(t.__tagifyTagData.__originalHTML,t):t.remove();break;case"Enter":case"Tab":e.preventDefault(),setTimeout(function(){return e.target.blur()},0)}},onDoubleClickScope:function(e){var t=e.target.closest("."+this.settings.classNames.tag);if(t){var n,a,r=wn(t),i=this.settings;!1!==(null==r?void 0:r.editable)&&(n=t.classList.contains(this.settings.classNames.tagEditing),a=t.hasAttribute("readonly"),i.readonly||n||a||!this.settings.editTags||!i.userInput||(this.events.callbacks.onEditTagFocus.call(this,t),this.editTag(t)),this.toggleFocusClass(!0),"select"!=i.mode&&this.trigger("dblclick",{tag:t,index:this.getNodeIndex(t),data:wn(t)}))}},onInputDOMChange:function(e){var t=this,n=this.DOM.input.lastChild;e.forEach(function(e){e.addedNodes.forEach(function(e){if("

"==e.outerHTML)e.replaceWith(document.createElement("br"));else if(1==e.nodeType&&e.querySelector(t.settings.classNames.tagSelector)){var n,a=document.createTextNode("");3==e.childNodes[0].nodeType&&"BR"!=e.previousSibling.nodeName&&(a=document.createTextNode("\n")),(n=e).replaceWith.apply(n,Bn([a].concat(Bn(Bn(e.childNodes).slice(0,-1))))),yn(a)}else if(hn.call(t,e)){var r;if(3!=(null===(r=e.previousSibling)||void 0===r?void 0:r.nodeType)||e.previousSibling.textContent||e.previousSibling.remove(),e.previousSibling&&"BR"==e.previousSibling.nodeName){e.previousSibling.replaceWith("\n​");for(var i=e.nextSibling,o="";i;)o+=i.textContent,i=i.nextSibling;o.trim()&&yn(e.previousSibling)}else e.previousSibling&&!wn(e.previousSibling)||e.before("​")}}),e.removedNodes.forEach(function(e){e&&"BR"==e.nodeName&&hn.call(t,n)&&(t.removeTags(n),t.fixFirefoxLastTagNoCaret())})}),n&&""==n.nodeValue&&n.remove(),n&&"BR"==n.nodeName||this.DOM.input.appendChild(document.createElement("br"))}}};function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n");else{try{zn(JSON.parse(e),Array)&&(e=JSON.parse(e))}catch(e){}this.addTags(e,!0).forEach(function(e){return e&&e.classList.add(n.classNames.tagNoAnimation)})}else this.postUpdate();this.state.lastOriginalValueReported=n.mixMode.integrated?"":this.DOM.originalInput.value},cloneEvent:function(e){var t={};for(var n in e)"path"!=n&&(t[n]=e[n]);return t},loading:function(e){return this.state.isLoading=e,this.DOM.scope.classList[e?"add":"remove"](this.settings.classNames.scopeLoading),this},tagLoading:function(e,t){return e&&e.classList[t?"add":"remove"](this.settings.classNames.tagLoading),this},toggleClass:function(e,t){"string"==typeof e&&this.DOM.scope.classList.toggle(e,t)},toggleScopeValidation:function(e){var t=!0===e||void 0===e;!this.settings.required&&e&&e===this.TEXTS.empty&&(t=!0),this.toggleClass(this.settings.classNames.tagInvalid,!t),this.DOM.scope.title=t?"":e},toggleFocusClass:function(e){this.toggleClass(this.settings.classNames.focus,!!e)},setPlaceholder:function(e){var t=this;["data","aria"].forEach(function(n){return t.DOM.input.setAttribute("".concat(n,"-placeholder"),e)})},triggerChangeEvent:function(){if(!this.settings.mixMode.integrated){var e=this.DOM.originalInput,t=this.state.lastOriginalValueReported!==e.value,n=new CustomEvent("change",{bubbles:!0});t&&(this.state.lastOriginalValueReported=e.value,n.simulated=!0,e._valueTracker&&e._valueTracker.setValue(Math.random()),e.dispatchEvent(n),this.trigger("change",this.state.lastOriginalValueReported),e.value=this.state.lastOriginalValueReported)}},events:Hn,fixFirefoxLastTagNoCaret:function(){},setRangeAtStartEnd:function(e,t){if(t){e="number"==typeof e?e:!!e,t=t.lastChild||t;var n=document.getSelection();if(zn(n.focusNode,Element)&&!this.DOM.input.contains(n.focusNode))return!0;try{n.rangeCount>=1&&["Start","End"].forEach(function(a){return n.getRangeAt(0)["set"+a](t,e||t.length)})}catch(e){console.warn(e)}}},insertAfterTag:function(e,t){if(t=t||this.settings.mixMode.insertAfterTag,e&&e.parentNode&&t)return t="string"==typeof t?document.createTextNode(t):t,e.parentNode.insertBefore(t,e.nextSibling),t},editTagChangeDetected:function(e){var t=e.__originalData;for(var n in t)if(!this.dataProps.includes(n)&&e[n]!=t[n])return!0;return!1},getTagTextNode:function(e){return e.querySelector(this.settings.classNames.tagTextSelector)},setTagTextNode:function(e,t){this.getTagTextNode(e).innerHTML=ln(t)},editTag:function(e,t){var n=this;e=e||this.getLastTag(),t=t||{};var a=this.settings,r=this.getTagTextNode(e),i=this.getNodeIndex(e),o=wn(e),l=this.events.callbacks,s=!0,c="select"==a.mode;if(!c&&this.dropdown.hide(),r){if(!zn(o,Object)||!("editable"in o)||o.editable)return o=wn(e,{__originalData:cn({},o),__originalHTML:e.cloneNode(!0)}),wn(o.__originalHTML,o.__originalData),r.setAttribute("contenteditable",!0),e.classList.add(a.classNames.tagEditing),this.events.callbacks.onEditTagFocus.call(this,e),r.addEventListener("click",l.onEditTagClick.bind(this,e)),r.addEventListener("blur",l.onEditTagBlur.bind(this,this.getTagTextNode(e))),r.addEventListener("input",l.onEditTagInput.bind(this,r)),r.addEventListener("paste",l.onEditTagPaste.bind(this,r)),r.addEventListener("keydown",function(t){return l.onEditTagkeydown.call(n,t,e)}),r.addEventListener("compositionstart",l.onCompositionStart.bind(this)),r.addEventListener("compositionend",l.onCompositionEnd.bind(this)),t.skipValidation||(s=this.editTagToggleValidity(e)),r.originalIsValid=s,this.trigger("edit:start",{tag:e,index:i,data:o,isValid:s}),r.focus(),!c&&this.setRangeAtStartEnd(!1,r),0===a.dropdown.enabled&&!c&&this.dropdown.show(),this.state.hasFocus=!0,this}else en.warn("Cannot find element in Tag template: .",a.classNames.tagTextSelector)},editTagToggleValidity:function(e,t){var n;if(t=t||wn(e))return(n=!("__isValid"in t)||!0===t.__isValid)||this.removeTagsFromValue(e),this.update(),e.classList.toggle(this.settings.classNames.tagNotAllowed,!n),t.__isValid=n,t.__isValid;en.warn("tag has no data: ",e,t)},onEditTagDone:function(e,t){e=e||this.state.editing.scope,t=t||{};var n,a,r=this.settings,i={tag:e,index:this.getNodeIndex(e),previousData:wn(e),data:t};this.trigger("edit:beforeUpdate",i,{cloneData:!1}),this.state.editing=!1,delete t.__originalData,delete t.__originalHTML,e&&e.parentNode&&((void 0!==(a=t[r.tagTextProp])?null===(n=(a+="").trim)||void 0===n?void 0:n.call(a):r.tagTextProp in t?void 0:t.value)?(e=this.replaceTag(e,t),this.editTagToggleValidity(e,t),r.a11y.focusableTags?e.focus():"select"!=r.mode&&yn(e)):this.removeTags(e)),this.trigger("edit:updated",i),r.dropdown.closeOnSelect&&this.dropdown.hide(),this.settings.keepInvalidTags&&this.reCheckInvalidTags()},replaceTag:function(e,t){t&&""!==t.value&&void 0!==t.value||(t=e.__tagifyTagData),t.__isValid&&1!=t.__isValid&&cn(t,this.getInvalidTagAttrs(t,t.__isValid));var n=this.createTagElem(t);return e.parentNode.replaceChild(n,e),this.updateValueByDOMTags(),n},updateValueByDOMTags:function(){var e=this;this.value.length=0;var t=this.settings.classNames,n=[t.tagNotAllowed.split(" ")[0],t.tagHide];[].forEach.call(this.getTagElms(),function(t){Kn(t.classList).some(function(e){return n.includes(e)})||e.value.push(wn(t))}),this.update(),this.dropdown.refilter()},injectAtCaret:function(e,t){var n;if(t=t||(null===(n=this.state.selection)||void 0===n?void 0:n.range),"string"==typeof e&&(e=document.createTextNode(e)),!e)return this;var a=11===e.nodeType?Array.prototype.slice.call(e.childNodes):[e];if(!a.length)return this;if(!t)return this.appendMixTags(e),this;if(!this.DOM.scope.contains(null==t?void 0:t.startContainer))return this;vn(e,t);var r=a[a.length-1]||e;return(null==r?void 0:r.parentNode)&&yn(r),this.setStateSelection(),this.updateValueByDOMTags(),this.update(),this},input:{set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.settings,a=n.dropdown.closeOnSelect;this.state.inputText=e,t&&(this.DOM.input.innerHTML=ln(""+e),e&&this.toggleClass(n.classNames.empty,!this.DOM.input.innerHTML)),!e&&a&&this.dropdown.hide.bind(this),this.input.autocomplete.suggest.call(this),this.input.validate.call(this)},raw:function(){return this.DOM.input.textContent},validate:function(){var e=!this.state.inputText||!0===this.validateTag({value:this.state.inputText});return this.DOM.input.classList.toggle(this.settings.classNames.inputInvalid,!e),e},normalize:function(e,t){var n=e||this.DOM.input,a=[];n.childNodes.forEach(function(e){return 3==e.nodeType&&a.push(e.nodeValue)}),a=a.join("\n");try{a=a.replace(/(?:\r\n|\r|\n)/g,this.settings.delimiters.source.charAt(0))}catch(e){}return a=a.replace(/\s/g," "),(null==t?void 0:t.trim)?this.trim(a):a},autocomplete:{suggest:function(e){if(this.settings.autoComplete.enabled){"object"!=typeof(e=e||{value:""})&&(e={value:e});var t=this.dropdown.getMappedValue(e);if("number"!=typeof t){var n=this.state.inputText.toLowerCase(),a=t.substr(0,this.state.inputText.length).toLowerCase(),r=t.substring(this.state.inputText.length);t&&this.state.inputText&&a==n?(this.DOM.input.setAttribute("data-suggest",r),this.state.inputSuggestion=e):(this.DOM.input.removeAttribute("data-suggest"),delete this.state.inputSuggestion)}}},set:function(e){var t=this.DOM.input.getAttribute("data-suggest"),n=e||(t?this.state.inputText+t:null);return!!n&&("mix"==this.settings.mode?this.replaceTextWithNode(document.createTextNode(this.state.tag.prefix+n)):(this.input.set.call(this,n),this.setRangeAtStartEnd(!1,this.DOM.input)),this.input.autocomplete.suggest.call(this),this.dropdown.hide(),!0)}}},getTagIdx:function(e){return this.value.findIndex(function(t){return t.__tagId==(e||{}).__tagId})},getNodeIndex:function(e){var t=0;if(e)for(;e=e.previousElementSibling;)t++;return t},getTagElms:function(){for(var e=arguments.length,t=new Array(e),n=0;n=this.settings.maxTags&&this.TEXTS.exceed},setReadonly:function(e,t){var n=this.settings;this.DOM.scope.contains(document.activeElement)&&document.activeElement.blur(),n[t||"readonly"]=e,this.DOM.scope[(e?"set":"remove")+"Attribute"](t||"readonly",!0),this.settings.userInput=!0,this.setContentEditable(!e),e||(this.events.binding.call(this,!0),this.events.binding.call(this))},setContentEditable:function(e){this.DOM.scope.querySelectorAll("[data-can-editable]").forEach(function(t){t.contentEditable=e,t.tabIndex=e?0:-1})},setDisabled:function(e){this.setReadonly(e,"disabled")},normalizeTags:function(e){var t=this,n=this.settings,a=n.whitelist,r=n.delimiters,i=n.mode,o=n.tagTextProp,l=[],s=!!a&&zn(a[0],Object),c=Array.isArray(e),u=c&&e[0].value,p=function(e){return(e+"").split(r).reduce(function(e,n){var a,r=t.trim(n);return r&&e.push((Vn(a={},o,r),Vn(a,"value",r),a)),e},[])};if("number"==typeof e&&(e=e.toString()),"string"==typeof e){if(!e.trim())return[];e=p(e)}else c&&(e=e.reduce(function(e,n){if(sn(n)){var a=cn({},n);o in a||(o="value"),a[o]=t.trim(a[o]),(a[o]||0===a[o])&&e.push(a)}else if(null!=n&&""!==n&&void 0!==n){var r;(r=e).push.apply(r,Kn(p(n)))}return e},[]));return s&&!u&&(e.forEach(function(e){var n=l.map(function(e){return e.value}),a=t.dropdown.filterListItems.call(t,e[o],{exact:!0});t.settings.duplicates||(a=a.filter(function(e){return!n.includes(e.value)}));var r=a.length>1?t.getWhitelistItem(e[o],o,a):a[0];r&&zn(r,Object)?l.push(r):"mix"!=i&&(null==e.value&&(e.value=e[o]),l.push(e))}),l.length&&(e=l)),e},parseMixTags:function(e,t){var n=this,a=this.settings,r=a.mixTagsInterpolator,i=a.duplicates,o=a.transformTag,l=a.enforceWhitelist,s=a.maxTags,c=a.tagTextProp,u=null==t?void 0:t.skipDOM,p=u?document.createDocumentFragment():null,d=[];if(e=e.split(r[0]).map(function(e,t){var a,m,h,g=e.split(r[1]),f=g[0],v=d.length==s;if(u&&0==t&&e)return p.appendChild(document.createTextNode(e)),"";try{if(f==+f)throw Error;m=JSON.parse(f)}catch(e){m=n.normalizeTags(f)[0]||{value:f}}if(o.call(n,m),v||!(g.length>1)||l&&!n.isTagWhitelisted(m.value)||!i&&n.isTagDuplicate(m.value)){if(e)return u?(p.appendChild(document.createTextNode(r[0]+e)),""):t?r[0]+e:e}else{if(m[a=m[c]?c:"value"]=n.trim(m[a]),h=n.createTagElem(m),d.push(m),h.classList.add(n.settings.classNames.tagNoAnimation),u)return p.appendChild(h),g[1]&&p.appendChild(document.createTextNode(g[1])),"";g[0]=h.outerHTML,n.value.push(m)}return g.join("")}).join(""),u)return p.__tagifyTagsData=d,p;this.DOM.input.innerHTML=e,this.DOM.input.appendChild(document.createTextNode("")),this.DOM.input.normalize();var m=this.getTagElms();return m.forEach(function(e,t){return wn(e,d[t])}),this.update({withoutChangeEvent:!0}),bn(m,this.state.hasFocus),e},convertPastedTextToMixTags:function(e){var t=this.settings,n=t.pattern,a=t.whitelist,r=t.mixTagsInterpolator,i=t.mixTagsAllowedAfter,o=t.tagTextProp;if(!n||!(null==a?void 0:a.length))return e;var l=n.source?n.source.split("|"):[n],s={};l.forEach(function(e){var t=e.replace(/\\/g,"");s[t]=a.map(function(e){var t;return t="string"==typeof e?e:e[o]||e.value,{originalItem:e,value:t=String(t),searchValue:t.toLowerCase()}}).sort(function(e,t){return t.value.length-e.value.length})});for(var c,u=new RegExp(n.source,"g"),p=[];null!==(c=u.exec(e));){var d=c[0],m=c.index,h=m+d.length,g=e.slice(h),f=s[d];if(f){var v=null,w=0,y=!0,b=!1,k=void 0;try{for(var _,E=f[Symbol.iterator]();!(y=(_=E.next()).done);y=!0){var T=_.value,x=T.value.length;if(g.slice(0,x).toLowerCase()===T.searchValue){var O=g[x];if(!O||i.test(O)){v=T,w=x;break}}}}catch(e){b=!0,k=e}finally{try{y||null==E.return||E.return()}finally{if(b)throw k}}if(v){var S="string"==typeof v.originalItem?{value:v.value,prefix:d}:Gn(Wn({},v.originalItem),{prefix:d});if(!0===this.validateTag(S)){var N="".concat(r[0]).concat(JSON.stringify(S)).concat(r[1]);p.push({start:m,end:h+w,replacement:N}),u.lastIndex=h+w}}}}var C=e;return p.reverse().forEach(function(e){var t=e.start,n=e.end,a=e.replacement;C=C.slice(0,t)+a+C.slice(n)}),C},replaceTextWithNode:function(e,t){if(this.state.tag||t){t=t||this.state.tag.prefix+this.state.tag.value;var n,a,r=this.state.selection||window.getSelection(),i=r.anchorNode,o=this.state.tag.delimiters?this.state.tag.delimiters.length:0;return i.splitText(r.anchorOffset-o),-1==(n=i.nodeValue.lastIndexOf(t))||(a=i.splitText(n),e&&i.parentNode.replaceChild(e,a)),!0}},prepareNewTagNode:function(e,t){t=t||{};var n=this.settings,a=[],r={},i=Object.assign({},e,{value:e.value+""});if(e=Object.assign({},i),n.transformTag.call(this,e),e.__isValid=this.hasMaxTags()||this.validateTag(e),!0!==e.__isValid){if(t.skipInvalid)return;if(cn(r,this.getInvalidTagAttrs(e,e.__isValid),{__preInvalidData:i}),e.__isValid==this.TEXTS.duplicate&&this.flashTag(this.getTagElmByValue(e.value)),!n.createInvalidTags)return void a.push(e.value)}return"readonly"in e&&(e.readonly?r["aria-readonly"]=!0:delete e.readonly),{tagElm:this.createTagElem(e,r),tagData:e,aggregatedInvalidInput:a}},postProcessNewTagNode:function(e,t){var n=this,a=this.settings,r=t.__isValid;r&&!0===r?this.value.push(t):(this.trigger("invalid",{data:t,index:this.value.length,tag:e,message:r}),a.keepInvalidTags||setTimeout(function(){return n.removeTags(e,!0)},1e3)),this.dropdown.position()},selectTag:function(e,t){var n=this;if(!this.settings.enforceWhitelist||this.isTagWhitelisted(t.value)){this.state.actions.selectOption&&setTimeout(function(){return n.setRangeAtStartEnd(!1,n.DOM.input)});var a=this.getLastTag();return a?this.replaceTag(a,t):this.appendTag(e),this.value[0]=t,this.update(),this.trigger("add",{tag:e,data:t}),[e]}},addEmptyTag:function(e){var t=cn({value:""},e||{}),n=this.createTagElem(t);wn(n,t),this.appendTag(n),this.editTag(n,{skipValidation:!0}),this.toggleFocusClass(!0)},addTags:function(e,t,n){var a=this,r=[],i=this.settings,o=[],l=document.createDocumentFragment(),s=[];if(!e||0==e.length)return r;switch(e=this.normalizeTags(e),i.mode){case"mix":return this.addMixTags(e);case"select":t=!1,this.removeAllTags()}return this.DOM.input.removeAttribute("style"),e.forEach(function(e){var t=a.prepareNewTagNode(e,{skipInvalid:n||i.skipInvalid});if(t){var c=t.tagElm;if(e=t.tagData,o=t.aggregatedInvalidInput,r.push(c),"select"==i.mode)return a.selectTag(c,e);l.appendChild(c),a.postProcessNewTagNode(c,e),s.push({tagElm:c,tagData:e})}}),this.appendTag(l),s.forEach(function(e){var t=e.tagElm,n=e.tagData;return a.trigger("add",{tag:t,index:a.getTagIdx(n),data:n})}),this.update(),e.length&&t&&(this.input.set.call(this,i.createInvalidTags?"":o.join(i._delimiters)),this.setRangeAtStartEnd(!1,this.DOM.input)),this.dropdown.refilter(),r},addMixTags:function(e){var t=this;if((e=this.normalizeTags(e))[0].prefix||this.state.tag)return this.prefixedTextToTag(e[0]);var n=document.createDocumentFragment(),a=[];return e.forEach(function(e){var r=t.prepareNewTagNode(e);n.appendChild(r.tagElm),t.insertAfterTag(r.tagElm),t.postProcessNewTagNode(r.tagElm,r.tagData),a.push({tagElm:r.tagElm,tagData:r.tagData})}),this.appendMixTags(n,a),n.children},appendMixTags:function(e,t){var n,a=null===(n=this.state.selection)||void 0===n?void 0:n.range,r=!!a&&this.DOM.scope.contains(a.startContainer),i=e?11===e.nodeType?Array.prototype.slice.call(e.childNodes):[e]:[];if(r)this.injectAtCaret(e);else{this.DOM.input.focus();var o=this.setStateSelection();(null==o?void 0:o.range)&&(o.range.setStart(this.DOM.input,o.range.endOffset),o.range.setEnd(this.DOM.input,o.range.endOffset)),this.DOM.input.appendChild(e),this.updateValueByDOMTags(),this.update();var l=i[i.length-1];(null==l?void 0:l.parentNode)&&yn(l),this.setStateSelection()}var s=(null==t?void 0:t.length)?t:i.filter(function(e){return 1===e.nodeType});(null==s?void 0:s.length)&&this.trigger("add",{tags:s})},prefixedTextToTag:function(e){var t,n,a,r=this,i=this.settings,o=null===(t=this.state.tag)||void 0===t?void 0:t.delimiters;if(e.prefix=e.prefix||this.state.tag?this.state.tag.prefix:(i.pattern.source||i.pattern)[0],a=this.prepareNewTagNode(e),n=a.tagElm,this.replaceTextWithNode(n)||this.DOM.input.appendChild(n),setTimeout(function(){return n.classList.add(r.settings.classNames.tagNoAnimation)},300),this.update(),!o){var l=this.insertAfterTag(n)||n;setTimeout(yn,0,l)}return this.state.tag=null,this.postProcessNewTagNode(n,a.tagData),this.trigger("add",{tag:a,data:e}),n},appendTag:function(e){var t=this.DOM,n=t.input;t.scope.insertBefore(e,n)},createTagElem:function(e,t){var n;e.__tagId=mn();var a,r=cn({},e,Wn((Vn(n={},this.settings.tagTextProp,ln((e[this.settings.tagTextProp]||e.value)+"")),Vn(n,"title",ln((e.title||e.value)+"")),Vn(n,"value",ln(e.value+"")),n),t));return function(e){for(var t,n=document.createNodeIterator(e,NodeFilter.SHOW_TEXT,null,!1);t=n.nextNode();)t.textContent.trim()||t.parentNode.removeChild(t)}(a=this.parseTemplate("tag",[r,this])),wn(a,e),a},reCheckInvalidTags:function(){var e=this,t=this.settings;this.getTagElms(t.classNames.tagNotAllowed).forEach(function(n,a){var r=wn(n),i=e.hasMaxTags(),o=e.validateTag(r),l=!0===o&&!i;if("select"==t.mode&&e.toggleScopeValidation(o),l)return r=r.__preInvalidData?r.__preInvalidData:{value:r.value},e.replaceTag(n,r);n.title=i||o})},removeTags:function(e,t,n){var a,r=this,i=this.settings;if(e=e&&zn(e,HTMLElement)?[e]:zn(e,Array)?e:e?[e]:[this.getLastTag()].filter(function(e){return e}),a=e.reduce(function(e,t){t&&"string"==typeof t&&(t=r.getTagElmByValue(t));var n=wn(t);return t&&n&&!n.readonly&&e.push({node:t,idx:r.getTagIdx(n),data:wn(t,{__removed:!0})}),e},[]),n="number"==typeof n?n:this.CSSVars.tagHideTransition,"select"==i.mode&&(n=0,this.input.set.call(this)),1==a.length&&"select"!=i.mode&&a[0].node.classList.contains(i.classNames.tagNotAllowed)&&(t=!0),a.length)return i.hooks.beforeRemoveTag(a,{tagify:this}).then(function(){var e=function(e){e.node.parentNode&&(e.node.parentNode.removeChild(e.node),t?i.keepInvalidTags&&this.trigger("remove",{tag:e.node,index:e.idx}):(this.dropdown.refilter(),this.dropdown.position(),this.DOM.input.normalize(),i.keepInvalidTags&&this.reCheckInvalidTags(),this.trigger("remove",{tag:e.node,index:e.idx,data:e.data})))};t||(r.removeTagsFromValue(a.map(function(e){return e.node})),r.update(),"select"==i.mode&&i.userInput&&r.setContentEditable(!0)),n&&n>10&&1==a.length?function(t){t.node.style.width=parseFloat(window.getComputedStyle(t.node).width)+"px",document.body.clientTop,t.node.classList.add(i.classNames.tagHide),setTimeout(e.bind(this),n,t)}.call(r,a[0]):a.forEach(e.bind(r))}).catch(function(e){})},removeTagsFromDOM:function(){this.getTagElms().forEach(function(e){return e.remove()})},removeTagsFromValue:function(e){var t=this;(e=Array.isArray(e)?e:[e]).forEach(function(e){var n=wn(e),a=t.getTagIdx(n);a>-1&&t.value.splice(a,1)})},removeAllTags:function(e){var t=this;e=e||{},this.value=[],"mix"==this.settings.mode?this.DOM.input.innerHTML="":this.removeTagsFromDOM(),this.dropdown.refilter(),this.dropdown.position(),this.state.dropdown.visible&&setTimeout(function(){t.DOM.input.focus()}),"select"==this.settings.mode&&(this.input.set.call(this),this.settings.userInput&&this.setContentEditable(!0));var n=this.state.blockChangeEvent?void 0:function(){!t.state.blockChangeEvent&&t.trigger("remove",{})};this.update(e,n)},postUpdate:function(){this.state.blockChangeEvent=!1;var e,t,n=this.settings,a=n.classNames,r="mix"==n.mode?n.mixMode.integrated?this.DOM.input.textContent:this.DOM.originalInput.value.trim():this.value.length+this.input.raw.call(this).length;this.toggleClass(a.hasMaxTags,this.value.length>=n.maxTags),this.toggleClass(a.hasNoTags,!this.value.length),this.toggleClass(a.empty,!r),"select"==n.mode&&this.toggleScopeValidation(null===(t=this.value)||void 0===t||null===(e=t[0])||void 0===e?void 0:e.__isValid)},setOriginalInputValue:function(e){var t=this.DOM.originalInput;this.settings.mixMode.integrated||(t.value=e,t.tagifyValue=t.value)},update:function(e,t){clearTimeout(this.debouncedUpdateTimeout),this.debouncedUpdateTimeout=setTimeout(function(){this.setPersistedData(n,"value"),this.settings.onChangeAfterBlur&&(e||{}).withoutChangeEvent||this.state.blockChangeEvent||this.triggerChangeEvent(),this.postUpdate(),null==t||t()}.bind(this),100),this.events.bindOriginaInputListener.call(this,100);var n=this.getInputValue();this.setOriginalInputValue(n)},getInputValue:function(){var e=this.getCleanValue();return"mix"==this.settings.mode?this.getMixedTagsAsString(e):e.length?this.settings.originalInputValueFormat?this.settings.originalInputValueFormat(e):JSON.stringify(e):""},getCleanValue:function(e){return nn(e||this.value,this.dataProps)},getMixedTagsAsString:function(){var e="",t=this,n=this.settings,a=n.originalInputValueFormat||JSON.stringify,r=n.mixTagsInterpolator;return function n(i){i.childNodes.forEach(function(i){if(1==i.nodeType){var o=wn(i);if("BR"==i.tagName&&(e+="\r\n"),o&&hn.call(t,i)){if(o.__removed)return;e+=r[0]+a(an(o,t.dataProps))+r[1]}else i.getAttribute("style")||["B","I","U"].includes(i.tagName)?e+=i.textContent:"DIV"!=i.tagName&&"P"!=i.tagName||(e+="\r\n",n(i))}else e+=i.textContent})}(this.DOM.input),e}},qn.prototype.removeTag=qn.prototype.removeTags;var na=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Zn(this,t,[e]))._handleRef=n._handleRef.bind(n),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ta(e,t)}(t,e),function(e,t,n){return t&&Jn(e.prototype,t),n&&Jn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"componentDidMount",value:function(){var e=this;this.tagify||(this.tagify=new qn(this.component,this.props.settings||{})),this.props.settings.callbacks.setup&&setTimeout(function(){e.props.settings.callbacks.setup.call(e.tagify),e.tagify.DOM.input.setAttribute("contenteditable",!0),e.tagify.DOM.input.addEventListener("blur",e.props.settings.callbacks.blur)},100),this.props.settings.callbacks.dragEnd&&this.tagify.DOM.scope.addEventListener("dragend",this.props.settings.callbacks.dragEnd),(0,a.doAction)("rank_math_tagify_init",this)}},{key:"shouldComponentUpdate",value:function(e){return this.tagify.settings.whitelist=e.settings.whitelist,e.showDropdown&&this.tagify.dropdown.show.call(this.tagify,e.showDropdown),!1===e.showDropdown&&this.tagify.dropdown.hide.call(this.tagify,!0),!1}},{key:"_handleRef",value:function(e){this.component=e}},{key:"render",value:function(){var e={ref:this._handleRef,id:this.props.id,name:this.props.name,className:this.props.className,placeholder:this.props.placeholder};return"textarea"===this.props.mode?wp.element.createElement("textarea",$n({},e,{defaultValue:this.props.initialValue})):wp.element.createElement("input",$n({},e,{defaultValue:this.props.initialValue}))}},{key:"toArray",value:function(){return this.tagify.value.map(function(e){return e.value})}},{key:"toString",value:function(){return this.toArray().join(",")}},{key:"queryTags",value:function(){return this.tagify.DOM.scope.querySelectorAll("tag")}}])}(o.Component),aa=na,ra=function(e){return e=Te()("