!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,s=a?a.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var a=!0}catch(e){}var r=o.call(e);return a&&(t?e[s]=n:delete e[s]),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,s=Math.min;e.exports=function(e,t,n){var l,c,u,p,d,m,h=0,g=!1,f=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=l,a=c;return l=c=void 0,h=t,p=e.apply(a,n)}function w(e){var n=e-m;return void 0===m||n>=t||n<0||f&&e-h>=u}function b(){var e=r();if(w(e))return k(e);d=setTimeout(b,function(e){var n=t-(e-m);return f?s(n,u-(e-h)):n}(e))}function k(e){return d=void 0,v&&l?y(e):(l=c=void 0,p)}function _(){var e=r(),n=w(e);if(l=arguments,c=this,m=e,n){if(void 0===d)return function(e){return h=e,d=setTimeout(b,t),g?y(e):p}(m);if(f)return clearTimeout(d),d=setTimeout(b,t),y(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,l=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,s=/^0b[01]+$/i,l=/^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=s.test(e);return n||l.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&&y(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,s=n.orientation,u=void 0===s?"horizontal":s,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:l()("components-tab-panel__tabs-item",n.className,w({},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:l()("components-tab-panel__tabs-item",n.className,w({},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);const T=(0,u.withInstanceId)(E);n.dn(O);var 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}function I(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 s=document.body.appendChild(o);a=document.getElementById("rank-math-width-tester").offsetWidth,s.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":""}}n.dn(I);const M=function(e){var t=I(e.source,e),n=t.pixelWidth?" (".concat(t.pixelWidth,")"):"";return wp.element.createElement("span",{className:l()("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}})))},D=wp.htmlEntities,A=React;function P(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 j(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);const K=G;const q=(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","seo-by-rank-math")),wp.element.createElement(M,{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.","seo-by-rank-math"),onChange:a,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),wp.element.createElement(K,{exclude:["seo_title","seo_description"],onClick:function(e){return a(t+" %"+e.variable+"%")}})))}),Y=wp.url,$=function(e){return e.replace(/<\/?[a-z][^>]*?>/gi,"")};n.dn($);const J=function(e){return e.replace(/]*>([\S\s]*?)<\/style>/gim,"")};n.dn(J);const X=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.replace(/]*>([\S\s]*?)<\/script>/gim,t)};n.dn(X);const Z=function(e){return e.replace(//g,"")};function Q(e){return e.replace(/ | /gi," ").replace(/\s{2,}/g," ").replace(/\s\./g,".").replace(/(\r\n|\n|\r)/gm,"")}function ee(e){return(0,c.isUndefined)(e)?"":(0,c.flow)([J,X,$,Z,Q])(e)}n.dn(Z);var te={};(0,c.isUndefined)(rankMath.assessor)||(0,c.forEach)(rankMath.assessor.diacritics,function(e,t){return te[t]=new RegExp(e,"g")});const ne=function(e){if((0,c.isUndefined)(e))return e;for(var t in te)e=e.replace(te[t],t);return e};n.dn(ne);const ae=function(){return!(0,c.isNull)(document.getElementById("site-editor"))};n.dn(ae);const re=function(){if(!ae())return!1;var e=wp.data.select("core/editor"),t=e.getCurrentPostId();if(rankMath.frontPageId&&rankMath.frontPageId===t)return!0;var n=e.getCurrentTemplateId()||t;return!(!(0,c.endsWith)(n,"//home")&&!(0,c.endsWith)(n,"//front-page"))||!(!(0,c.endsWith)(n,"//page")&&!(0,c.endsWith)(n,"//index"))&&"/"===new URLSearchParams(window.location.search).get("p")};n.dn(re);const ie=(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(ee(e),!0)},updatePermalinkSanitize:function(e){rankMathEditor.updatePermalinkSanitize(function(e){return e=e.replace(/,/g,""),ee(e=ne(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","seo-by-rank-math")),wp.element.createElement(M,{source:(0,Y.safeDecodeURIComponent)(n),min:5,max:75}),wp.element.createElement(p.TextControl,{id:"rank-math-editor-permalink",value:rankMath.is_front_page||re()?"/":(0,Y.safeDecodeURIComponent)(t),onChange:a,help:rankMath.is_front_page||re()?(0,r.__)("Editing Homepage permalink is not possible.","seo-by-rank-math"):(0,r.__)("This is the unique URL of this page, displayed below the post title in the search results.","seo-by-rank-math"),disabled:rankMath.is_front_page||re()?"disabled":"",onBlur:function(e){i(e.target.value)},__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}))});const oe=(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","seo-by-rank-math")),wp.element.createElement(M,{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.","seo-by-rank-math"),onChange:a,__nextHasNoMarginBottom:!0}),wp.element.createElement(K,{exclude:["seo_title","seo_description"],onClick:function(e){return a(t+" %"+e.variable+"%")}})))});const se=(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=l()("button button-secondary button-small",{active:"desktop"===t}),i=l()("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 le(e){return 100'+e+""}))}function de(e){return e.replace(/(^\w{1})|(\s+\w{1})/g,function(e){return e.toUpperCase()})}n.dn(ue),n.dn(pe);var me=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};const he=(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"},me(i,"filled"),function(e,t,n){return e*=100/n,wp.element.createElement("div",{className:"serp-result",style:{width:e+"%"}},me(n,"filled"))}(a,0,i)),wp.element.createElement("span",{className:"serp-rating-label"},(0,r.__)("Rating: ","seo-by-rank-math")),wp.element.createElement("span",{className:"serp-rating-value"},a))});function ge(e){return ge="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},ge(e)}function fe(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=ge(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=ge(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ge(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ve=(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,s=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=l()("serp-preview",fe(fe({"expanded-preview":""!==o},"".concat(o,"-preview"),""!==o&&h),"noindex-preview",s)),f=rankMath.capitalizeTitle?de(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","seo-by-rank-math"),"data-desktop":(0,r.__)("Desktop Preview","seo-by-rank-math"),"data-mobile":(0,r.__)("Mobile Preview","seo-by-rank-math")},d&&wp.element.createElement(ce,null)," ",h&&wp.element.createElement(se,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","seo-by-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","seo-by-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","seo-by-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","seo-by-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","seo-by-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","seo-by-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","seo-by-rank-math"))),wp.element.createElement("ul",{className:"menus-right"},wp.element.createElement("li",null,(0,r.__)("Settings","seo-by-rank-math")),wp.element.createElement("li",null,(0,r.__)("Tools","seo-by-rank-math")))),wp.element.createElement("div",{className:"serp-preview-result-stats"},(0,r.__)("About 43,700,000 results (0.32 seconds) ","seo-by-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:pe(v,ee((0,Y.safeDecodeURIComponent)(n)),75,/-? +/)}})),wp.element.createElement("div",{className:"group"},wp.element.createElement("h5",{className:"serp-title",dangerouslySetInnerHTML:{__html:pe(c,ee(f),60)}})),wp.element.createElement(he,null),wp.element.createElement("div",{className:"group"},wp.element.createElement("div",{className:"serp-description",dangerouslySetInnerHTML:{__html:pe(c,ee(a),160)}}))),wp.element.createElement("div",{className:"serp-preview-noindex"},wp.element.createElement("h3",null,(0,r.__)("Noindex robots meta is enabled","seo-by-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.","seo-by-rank-math")))))});const ye=(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(ve,{showScore:!1,showDevices:!0}),wp.element.createElement(q,null),wp.element.createElement(ie,null),wp.element.createElement(oe,null))});function we(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),_e=e=>(0,o.createElement)("rect",e),Ee=(0,o.forwardRef)(({className:e,isPressed:t,...n},a)=>{const r={...n,className:be(e,{"is-pressed":t})||void 0,"aria-hidden":!0,focusable:!1};return(0,o.createElement)("svg",{...r,ref:a})});function Te(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(Ee,{viewBox:"0 0 32 32",fill:"none",height:n,width:r,style:o},wp.element.createElement(_e,{width:"32",height:"32",fill:"none"}),wp.element.createElement(ke,{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 xe(){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="",s=a.indexOf("#");-1!==s&&(i=a.substring(0,s),o=a.substring(s));var l=Object.keys(r).map(function(e){return"".concat(e,"=").concat(r[e])}).join("&"),c=i.includes("?")&&!i.endsWith("?")?"&":"?";return i+c+l+o+n}Ee.displayName="SVG",n.dn(Te),n.dn(xe);const Oe=jQuery;var Se=n.n(Oe);function Ne(e){return Ne="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},Ne(e)}function Ce(e,t){for(var n=0;n0?(0,r.__)("Replace Image","seo-by-rank-math"):(0,r.__)("Add Image","seo-by-rank-math")),e.imageID>0&&wp.element.createElement(p.Button,{className:"button",isDestructive:!0,isLink:!0,onClick:e.removeImage},(0,r.__)("Remove Image","seo-by-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.","seo-by-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.","seo-by-rank-math"))))};function Le(){var e=rankMath.overlayImages,t=[];return Object.keys(e).forEach(function(n){t.push({label:e[n].name,value:n})}),t}function Be(){return Be=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","seo-by-rank-math")),wp.element.createElement("p",null,wp.element.createElement(L,{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?","seo-by-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.","seo-by-rank-math"))),onChange:function(){return e.alreadyReviewed()},__nextHasNoMarginBottom:!0}))}},{key:"alreadyReviewed",value:function(){Se().ajax({url:rankMath.ajaxurl,data:{action:"rank_math_already_reviewed",security:rankMath.security}}),rankMath.pluginReviewed=!0,Se()(this.component).animate({opacity:.01},1500,function(){var e=Se()(".rank-math-editor > .components-tab-panel__tabs > button");e.first().click(),e.last().remove()})}}])}(o.Component);const Qe=Ze;const et=(0,p.withFilters)("rankMath.analytics.reportButton")(function(){return null});const tt=(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,s=[{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","seo-by-rank-math"))),view:ye}];return rankMath.canUser.social&&s.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","seo-by-rank-math"))),view:We}),rankMath.showReviewTab&&!1===rankMath.pluginReviewed&&s.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:Qe}),wp.element.createElement(o.Fragment,null,wp.element.createElement(p.Button,{isPrimary:!0,className:"rank-math-edit-snippet",onClick:i},(0,r.__)("Edit Snippet","seo-by-rank-math")),""===a&&wp.element.createElement(et,null),t&&wp.element.createElement(p.Modal,{title:(0,r.__)("Preview Snippet Editor","seo-by-rank-math"),closeButtonLabel:(0,r.__)("Close","seo-by-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:s},function(e){return(0,o.createElement)(e.view)})))});const nt=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","seo-by-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.","seo-by-rank-math")),wp.element.createElement("p",{className:"cmb2-metabox-description"},(0,r.__)("Click on the button below to view and edit the preview.","seo-by-rank-math")),wp.element.createElement(tt,{buttonLabel:(0,r.__)("Preview & Edit Social Media","seo-by-rank-math"),initialTab:"social"})))},at=wp.wordcount,rt=wp.richText;var it="core/annotations",ot="core/annotation",st="annotation-text-";var lt={name:ot,title:(0,r.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},interactive:!1,object:!1,edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(e,{richTextIdentifier:t,blockClientId:n})=>({annotations:e(it).__experimentalGetAnnotationsForRichText(n,t)}),__experimentalCreatePrepareEditableTree:({annotations:e})=>(t,n)=>{if(0===e.length)return t;let a={formats:t,text:n,replacements:[],start:0,end:0};return a=function(e,t=[]){return t.forEach(t=>{let{start:n,end:a}=t;if("number"!=typeof n||"number"!=typeof a)return;n>e.text.length&&(n=e.text.length),a>e.text.length&&(a=e.text.length);const r=st+t.source,i=st+t.id;e=(0,rt.applyFormat)(e,{type:ot,attributes:{className:r,id:i}},n,a)}),e}(a,e),a.formats},__experimentalGetPropsForEditableTreeChangeHandler:e=>({removeAnnotation:e(it).__experimentalRemoveAnnotation,updateAnnotationRange:e(it).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:e=>t=>{const n=function(e){const t={};return e.forEach((e,n)=>{(e=(e=e||[]).filter(e=>e.type===ot)).forEach(e=>{let{id:a}=e.attributes;a=a.replace(st,""),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;"number"!=typeof i||"number"!=typeof o||i===r.start&&o===(r.end??r.start)||a(e.id,r.start,r.end??r.start)})}(i,n,{removeAnnotation:a,updateAnnotationRange:r})}},{name:ct,...ut}=lt;function pt(e,t){const n=e.filter(t);return e.length===n.length?e:n}(0,rt.registerFormatType)(ct,ut);var dt=(e,t)=>Object.entries(e).reduce((e,[n,a])=>void 0===a?e:{...e,[n]:t(a)},{});var mt=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 Boolean(e.range&&"number"==typeof e.range.start&&"number"==typeof e.range.end&&e.range.start<=e.range.end)}(a))return e;const r=e?.[n]??[];return{...e,[n]:[...r,a]};case"ANNOTATION_REMOVE":return dt(e,e=>pt(e,e=>e.id!==t.annotationId));case"ANNOTATION_UPDATE_RANGE":return dt(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 dt(e,e=>pt(e,e=>e.source!==t.source))}return e},ht=[],gt=(0,i.createSelector)((e,t)=>(e?.[t]??[]).filter(e=>"block"===e.selector),(e,t)=>[e?.[t]??ht]);function ft(e,t){return e?.[t]??ht}var vt=(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]??ht]);function yt(e){return Object.values(e).filter(e=>Boolean(e)).flat()}const wt=new Uint8Array(16);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]]).toLowerCase()}const _t=function(e,t,n){return t||e||!crypto.randomUUID?function(e,t,n){e=e||{};const a=e.random??e.rng?.()??crypto.getRandomValues(wt);if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=a[e];return t}return kt(a)}(e,t,n):crypto.randomUUID()};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&&null!==n&&(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)(it,{reducer:mt,selectors:e,actions:t});(0,i.register)(St);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,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n(0,i.withSelect)((e,t)=>{const{clientId:n,className:a}=t;return{className:e(St).__experimentalGetAnnotationsForBlock(n).map(e=>"is-annotated-by-"+e.source).concat(a||"").filter(Boolean).join(" ")}})(e));var It="core/annotations",Mt="rank-math-annotations",Dt=function(e,t){var n,a=Nt(e);try{for(a.s();!(n=a.n()).done;){var r=n.value;if("div"===r.localName&&r.children&&Dt(r.children,t),"p"===r.localName)if((0,at.count)(r.innerText,"words")<120)t.annotator.remove(Mt),r.getElementsByClassName("rank-math-content-ai-tooltip").length&&r.getElementsByClassName("rank-math-content-ai-tooltip")[0].remove();else{var i=t.selection.win.getSelection();i.selectAllChildren(r),t.annotator.annotate(Mt,{uid:"rank-math-annotation"}),i.empty()}}}catch(e){a.e(e)}finally{a.f()}};const At=function(){var e=!(arguments.length>0&&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,at.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)};n.dn(At);const Pt=(0,p.withFilters)("rankMath.checklists.FixWithAI")(function(){return null}),jt=function(e,t){var n=(0,c.round)(e/t*100);if(!(100<=n))return 49e.length)&&(t=e.length);for(var n=0,a=new Array(t);n/g,">").replace(/"/g,""").replace(/`|'/g,"'"):e}function cn(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 un(e,t,n){var a,r;function i(e,t){for(var n in t)if(t.hasOwnProperty(n)){if(cn(t[n])){cn(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 pn(){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 s=i.value,l=!0,c=!1,u=void 0;try{for(var p,d=s[Symbol.iterator]();!(l=(p=d.next()).done);l=!0){var m=p.value;cn(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{l||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 dn(e){return String.prototype.normalize?"string"==typeof e?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):void 0:e}var mn=function(){return/(?=.*chrome)(?=.*android)/i.test(navigator.userAgent)};function hn(){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 gn(e){var t,n=vn.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 fn(e){return vn.call(this,e)&&(null==e?void 0:e.closest(this.settings.classNames.tagSelector))}function vn(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 yn(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:un({},e.__tagifyTagData||{},t)),e.__tagifyTagData):(tn.warn("tag element doesn't exist",{tagElm:e,data:t}),t)}function bn(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 kn(e,t){e.forEach(function(e){if(wn(e.previousSibling)||!e.previousSibling){var n=document.createTextNode("โ€‹");e.before(n),t&&bn(n)}})}var _n={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,allowCaretBetweenTags:!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 En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tn(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,s="select"==n.mode;n.hooks.beforeKeyDown(e,{tagify:this}).then(function(l){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||n.allowCaretBetweenTags)return;case"Tab":var y=!n.autoComplete.rightKey||!n.autoComplete.tabKey;if(!o&&!s&&r&&y&&!t.state.editing&&i){e.preventDefault();var w=t.dropdown.getMappedValue(i);return t.state.autoCompleteData=i,t.input.autocomplete.set.call(t,w),!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 tn.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 tn.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(cn(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,s=o.clearOnSelect,l=o.closeOnSelect;if(!e)return this.addTags(this.state.inputText,!0),void(l&&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,un({__isValid:!0},d))}else this[p?"addMixTags":"addTags"]([d||this.input.raw.call(this)],s);(p||this.DOM.input.parentNode)&&(setTimeout(function(){a.DOM.input.focus(),a.toggleFocusClass(!0)}),l&&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 l&&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,s,l=function(){var e,l,c=void 0,u=void 0;e=h[w],a=(null!=(l=Object)&&"undefined"!=typeof Symbol&&l[Symbol.hasInstance]?l[Symbol.hasInstance](e):e instanceof l)?h[w]:{value:h[w]};var g,f=Object.keys(a).some(function(e){return y.includes(e)})?y:["value"];p.fuzzySearch&&!t.exact?(i=f.reduce(function(e,t){return e+" "+(a[t]||"")},"").toLowerCase().trim(),p.accentedSearch&&(i=dn(i),s=dn(s)),c=0==i.indexOf(s),u=i===s,g=i,r=s.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=dn(n),s=dn(s)),p.caseSensitive||(n=n.toLowerCase()),u=n===s,t.exact?n===s:0==n.indexOf(s)})),o=!p.includeSelectedTags&&n.isTagDuplicate(cn(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,y=p.searchKeys,w=0;if(!(e="select"==u.mode&&this.value.length&&this.value[0][u.tagTextProp]==e?"":e)||!y.length){d=f?h:h.filter(function(e){return!c.isTagDuplicate(cn(e)?e.value:e)});var b=v?p.sortby(d,s):d.slice(0,g);return this.state.dropdown.suggestions=b,b}for(s=p.caseSensitive?""+e:(""+e).toLowerCase();w[\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,n=this.settings.dropdown,a=this.dropdown.getAppendTarget();if("manual"!=n.position&&a){var r,i,o,s,l,c,u,p,d,m,h=this.DOM.dropdown,g=n.RTL,f=a===document.body,v=a===this.DOM.scope,y=f?window.pageYOffset:a.scrollTop,w=document.fullscreenElement||document.webkitFullscreenElement||document.documentElement,b=w.clientHeight,k=Math.max(w.clientWidth||0,window.innerWidth||0),_=k>480?n.position:"all",E=this.DOM["input"==_?"input":"scope"];if(e=e||h.clientHeight,this.state.dropdown.visible){if("text"==_?(o=(r=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,i=r.top,s=r.left,l="auto"):(c=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}}(a),r=E.getBoundingClientRect(),i=v?-1:r.top-c.top,o=(v?r.height:r.bottom-c.top)-1,s=v?-1:r.left-c.left,l=r.width+"px"),!f){var T=function(){for(var e=0,t=n.appendTarget.parentNode;t;)e+=t.scrollTop||0,t=t.parentNode;return e}();i+=T,o+=T}i=Math.floor(i),o=Math.ceil(o),p=k-s<120,d=((u=null!==(t=n.placeAbove)&&void 0!==t?t:b-r.bottom\n ').concat(this.settings.templates.input.call(this),"\n ").concat(Zt,"\n ")},input:function(){var e=this.settings,t=e.placeholder||Zt;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 jn(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 s,l=this.listeners.global[Symbol.iterator]();!(r=(s=l.next()).done);r=!0)(t=s.value).target[a](t.type,t.cb,!!t.useCapture)}catch(e){i=!0,o=e}finally{try{r||null==l.return||l.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=fn.call(this,e.relatedTarget),i=gn.call(this,e.target),o=e.target.classList.contains(a.classNames.tagX),s="focusin"==e.type,l="focusout"==e.type;o&&"mix"!=a.mode&&a.focusInputOnRemove&&this.DOM.input.focus(),r&&s&&!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(l){var g;if("mix"!=a.mode&&(e.relatedTarget&&(null===(g=this.DOM.dropdown)||void 0===g?void 0:g.contains(e.relatedTarget))||this.repositionScopeInput("reset",{focus:!1})),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=!(!s&&!r)&&+new Date,this.toggleFocusClass(this.state.hasFocus),"mix"!=a.mode){if(s){if(!a.focusable)return;var f=0===a.dropdown.enabled&&!this.state.dropdown.visible,v=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector);return this.trigger("focus",d),void(f&&!i&&(this.dropdown.show(this.value.length?"":void 0),"select"===a.mode&&this.setRangeAtStartEnd(!1,v)))}if(l){if(this.trigger("blur",d),this.loading(!1),"select"==a.mode){if(this.value.length){var y=this.getTagElms()[0];c=this.trim(y.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 s?this.trigger("focus",d):l&&(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=fn.call(this,a)&&this.DOM.scope.contains(a),i=a===this.DOM.input,o=r&&a.hasAttribute("readonly"),s=this.DOM.scope.querySelector(this.settings.classNames.tagTextSelector),l=this.state.dropdown.visible;if(("Tab"===e.key&&l||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&&gn.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==s||s.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),s=i.anchorNode.previousSibling,l=1==i.anchorNode.nodeType||!i.anchorOffset&&s&&1==s.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&&l)return c=1==i.anchorNode.nodeType?null:i.anchorNode.previousElementSibling,setTimeout(t.editTag.bind(t),0,c),void e.preventDefault();if(mn()&&Hn(l,Element))return p=sn(l),l.hasAttribute("readonly")||l.remove(),t.DOM.input.focus(),void setTimeout(function(){bn(p),t.DOM.input.click()});if("BR"==i.anchorNode.nodeName)return;if((o||l)&&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:Hn(l,Element)&&(u=l),3==i.anchorNode.nodeType&&!i.anchorNode.nodeValue&&i.anchorNode.previousElementSibling&&e.preventDefault(),(l||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 bn(sn(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":var f=t.getTagElmBeforeInput();"select"==n.mode&&n.enforceWhitelist&&t.value.length?f&&t.removeTags(f):t.state.dropdown.visible&&"manual"!=n.dropdown.position||""!=e.target.textContent&&8203!=a.charCodeAt(0)||(!0===n.backspace?f&&t.removeTags(f):"edit"==n.backspace&&f&&setTimeout(function(){return t.editTag(f)},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"ArrowLeft":t.repositionScopeInput("left")&&e.preventDefault();break;case"ArrowRight":if(t.repositionScopeInput("right")){e.preventDefault();break}var v=t.state.inputSuggestion||t.state.ddItemData;if(v&&n.autoComplete.rightKey)return void t.addTags([v],!0);break;case"Tab":if(!n.addTagOn.includes(e.key.toLowerCase()))break;case"Enter":if(t.state.dropdown.visible&&!g)return;var y=t.state.autoCompleteData||a;if(!y&&"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([y],!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,s,l,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&&mn()&&this.events.callbacks.onKeydown.call(this,{target:e.target,key:"Backspace"}),kn(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,l=this.state.tag.value.match(u.delimiters))return this.state.tag.value=this.state.tag.value.replace(u.delimiters,""),this.state.tag.delimiters=l[0],this.addTags(this.state.tag.value,u.dropdown.clearOnSelect),void this.dropdown.hide();i=this.state.tag.value.length>=u.dropdown.enabled;try{s=(s=this.state.flaggedTags[this.state.tag.baseOffset]).prefix==this.state.tag.prefix&&s.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){}(s||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:un({},this.value[r],{newValue:o}),event:t})},onEditTagPaste:function(e,t){var n=(t.clipboardData||window.clipboardData).getData("Text");t.preventDefault();var a=yn(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=gn.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,s=e.closest("."+o.classNames.tag),l=wn(s),c=this.input.normalize.call(this,e),u=(Fn(a={},o.tagTextProp,c),Fn(a,"__tagId",l.__tagId),a),p=l.__originalData,d=this.editTagChangeDetected(un(l,u)),m=this.validateTag(u);if(c)if(d){var h;if(r=this.hasMaxTags(),i=un({},p,(Fn(h={},o.tagTextProp,this.trim(c)),Fn(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:s,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(s,i)}else this.onEditTagDone(s,p);else this.onEditTagDone(s)}},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,Un([a].concat(Un(Un(e.childNodes).slice(0,-1))))),bn(a)}else if(gn.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()&&bn(e.previousSibling)}else e.previousSibling&&!wn(e.previousSibling)||e.before("โ€‹")}}),e.removedNodes.forEach(function(e){e&&"BR"==e.nodeName&&gn.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 zn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n");else{try{Gn(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:Vn,fixFirefoxLastTagNoCaret:function(){},setRangeAtStartEnd:function(e,t){if(t){e="number"==typeof e?e:!!e,t=t.lastChild||t;var n=document.getSelection();if(Gn(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),s=this.events.callbacks,l=!0,c="select"==a.mode;if(!c&&this.dropdown.hide(),r){if(!Gn(o,Object)||!("editable"in o)||o.editable)return o=wn(e,{__originalData:un({},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",s.onEditTagClick.bind(this,e)),r.addEventListener("blur",s.onEditTagBlur.bind(this,this.getTagTextNode(e))),r.addEventListener("input",s.onEditTagInput.bind(this,r)),r.addEventListener("paste",s.onEditTagPaste.bind(this,r)),r.addEventListener("keydown",function(t){return s.onEditTagkeydown.call(n,t,e)}),r.addEventListener("compositionstart",s.onCompositionStart.bind(this)),r.addEventListener("compositionend",s.onCompositionEnd.bind(this)),t.skipValidation||(l=this.editTagToggleValidity(e)),r.originalIsValid=l,this.trigger("edit:start",{tag:e,index:i,data:o,isValid:l}),r.focus(),!c&&this.setRangeAtStartEnd(!1,r),0===a.dropdown.enabled&&!c&&this.dropdown.show(),this.state.hasFocus=!0,this}else tn.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;tn.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&&bn(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&&un(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){Yn(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;yn(e,t);var r=a[a.length-1]||e;return(null==r?void 0:r.parentNode)&&bn(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"!==(void 0===(e=e||{value:""})?"undefined":$n(e))&&(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),n.dropdown.enabled=this.origSettings.dropdown.enabled)},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,s=[],l=!!a&&Gn(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((Wn(a={},o,r),Wn(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(cn(n)){var a=un({},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,Yn(p(n)))}return e},[]));return l&&!u&&(e.forEach(function(e){var n=s.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&&Gn(r,Object)?s.push(r):"mix"!=i&&(null==e.value&&(e.value=e[o]),s.push(e))}),s.length&&(e=s)),e},parseMixTags:function(e,t){var n=this,a=this.settings,r=a.mixTagsInterpolator,i=a.duplicates,o=a.transformTag,s=a.enforceWhitelist,l=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==l;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)||s&&!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}),kn(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 s=n.source?n.source.split("|"):[n],l={};s.forEach(function(e){var t=e.replace(/\\/g,"");l[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=l[d];if(f){var v=null,y=0,w=!0,b=!1,k=void 0;try{for(var _,E=f[Symbol.iterator]();!(w=(_=E.next()).done);w=!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,y=x;break}}}}catch(e){b=!0,k=e}finally{try{w||null==E.return||E.return()}finally{if(b)throw k}}if(v){var S="string"==typeof v.originalItem?{value:v.value,prefix:d}:qn(Kn({},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+y,replacement:N}),u.lastIndex=h+y}}}}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(un(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=un({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=[],s=document.createDocumentFragment(),l=[];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);s.appendChild(c),a.postProcessNewTagNode(c,e),l.push({tagElm:c,tagData:e})}}),this.appendTag(s),l.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 s=i[i.length-1];(null==s?void 0:s.parentNode)&&bn(s),this.setStateSelection()}var l=(null==t?void 0:t.length)?t:i.filter(function(e){return 1===e.nodeType});(null==l?void 0:l.length)&&this.trigger("add",{tags:l})},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 s=this.insertAfterTag(n)||n;setTimeout(bn,0,s)}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)},repositionScopeInput:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.DOM.input,a=this.DOM.scope,r=this.settings,i=n&&n.parentNode,o="reset"===e,s=void 0!==t.focus?t.focus:!o;if("mix"==r.mode||this.state.dropdown.visible)return!1;if(!n||!a||i!=a)return!1;if(o){var l=this.getTagElms(),c=l[l.length-1];return!!c&&c.nextElementSibling!==n&&(c.after(n),s&&n.focus(),!0)}if(!r.allowCaretBetweenTags)return!1;if("left"===e||"ArrowLeft"===e){var u=this.getTagElmBeforeInput();return!!u&&(a.insertBefore(n,u),s&&n.focus(),!0)}if("right"===e||"ArrowRight"===e){var p=n.nextElementSibling;return!!gn.call(this,p)&&(p.after(n),s&&n.focus(),!0)}return!1},createTagElem:function(e,t){var n;e.__tagId=hn();var a,r=un({},e,Kn((Wn(n={},this.settings.tagTextProp,ln((e[this.settings.tagTextProp]||e.value)+"")),Wn(n,"title",ln((e.title||e.value)+"")),Wn(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),s=!0===o&&!i;if("select"==t.mode&&e.toggleScopeValidation(o),s)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&&Gn(e,HTMLElement)?[e]:Gn(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 an(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&&gn.call(t,i)){if(o.__removed)return;e+=r[0]+a(rn(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}},Jn.prototype.removeTag=Jn.prototype.removeTags;var ia=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=ta(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&&ra(e,t)}(t,e),function(e,t,n){return t&&Qn(e.prototype,t),n&&Qn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"componentDidMount",value:function(){var e=this;this.tagify||(this.tagify=new Jn(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",Zn({},e,{defaultValue:this.props.initialValue})):wp.element.createElement("input",Zn({},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);const oa=ia,sa=function(e){return e=Se()("