-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.min.js
26 lines (26 loc) · 17 KB
/
index.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*!
*
* The MIT License (MIT)
*
* Copyright © 2024 Taufik Nurrohman <https://github.com/taufik-nurrohman>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the “Software”), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TagPicker=e()}(this,(function(){"use strict";var t=function(t,e){return-1!==e.indexOf(t)},e=function(t){return Array.isArray(t)},n=function(t){return void 0!==t},r=function(t){return"function"==typeof t},i=function(t,e,n){return!(!t||"object"!=typeof t)&&(n?s(e)&&s(t.constructor)&&e===t.constructor:s(e)&&t instanceof e)},u=function(t){return"number"==typeof t},a=function(t,e){return void 0===e&&(e=!0),!(!t||"object"!=typeof t)&&(!e||i(t,Object,1))},s=function(t){return n(t)&&!function(t){return null===t}(t)},o=function(t){return"string"==typeof t},f=function(t){return t.length},c=function(t){if(e(t))return t.map((function(t){return c(t)}));if(function(t){return/^-?(?:\d*.)?\d+$/.test(t+"")}(t))return function(t,e){return void 0===e&&(e=10),e?parseInt(t,e):parseFloat(t)}(t);if(a(t)){for(var n in t)t[n]=c(t[n]);return t}return"false"!==t&&("null"===t?null:"true"===t||t)},l=function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var u=r.shift(),o=0,c=f(r);o<c;++o)for(var v in r[o])if(s(u[v]))if(e(u[v])&&e(r[o][v])){u[v]=[].concat(u[v]);for(var p=0,_=f(r[o][v]);p<_;++p)t(r[o][v][p],u[v])||u[v].push(r[o][v][p])}else a(u[v])&&a(r[o][v])?u[v]=l({},u[v],r[o][v]):u[v]=r[o][v];else u[v]=r[o][v];return u},v=function(t){if(e(t))return t.map((function(e){return v(t)}));if(a(t)){for(var n in t)t[n]=v(t[n]);return t}return!1===t?"false":null===t?"null":!0===t?"true":""+t},p=document,_=window,h=function(t,e){return d(t,e||0)},g=function(t){return t.firstElementChild||null},d=function(t,e){var n=[].slice.call(t.children);return u(e)?n[e]||null:n},m=function(t,e,n){var r=function(t,e,n){if(void 0===n&&(n=!0),!j(t,e))return null;var r=t.getAttribute(e);return n?c(r):r}(t,"data-"+e,n);return r},b=function(t,e){return t["next"+(e?"":"Element")+"Sibling"]||null},k=function(t,e){return e?t.closest(e)||null:t.parentNode||null},y=function(t){var e="form";return A(t,e)&&e===function(t){return(t&&t.nodeName||"").toLowerCase()||null}(t[e])?t[e]:k(t,e)},x=function(t,e){return t.previousElementSibling||null},w=function(t,e){void 0===e&&(e=!0);var n="textContent";if(!A(t,n))return!1;var r=t[n];return""!==(r=e?r.trim():r)?r:null},j=function(t,e){return t.hasAttribute(e)},E=function(t,e){return t.classList.contains(e)},A=function(t,e){return e in t},S=function(t,e){return t.removeAttribute(e),t},D=function(t,e){return t.classList.remove(e),t},T=function(t){var e=k(t);return t.remove(),e},C=function(t,e,n){return!0===n&&(n=e),t.setAttribute(e,v(n)),t},R=function(t,e){return t.append(e),e},L=function(t,e){return t.classList.add(e),t},q=function(t,e,n){return t=o(t)?p.createElement(t):t,a(e)&&(n=e,e=!1),o(e)&&N(t,e),a(n)&&function(t,e){var n;for(var r in e)(n=e[r])||""===n||0===n?C(t,r,n):S(t,r)}(t,n),t},N=function(t,e,n){if(void 0===n&&(n=!0),null===e)return t;var r="innerHTML";return A(t,r)&&(t[r]=n?e.trim():e),t},z=function(t,e){return k(t).insertBefore(e,t),e},K=function(t,e,n){if(void 0===n&&(n=!0),null===e)return t;var r="textContent";return A(t,r)&&(t[r]=n?e.trim():e),t},M=function(t,e,n){return t.classList.toggle(e,n),t},O=function(t,e){return function(){var n=arguments,r=this;setTimeout((function(){return t.apply(r,n)}),e)}};var P=function(t,e,n){e.removeEventListener(t,n)},B=function(t){return t&&t.preventDefault()},I=function(t,e,n,r){void 0===r&&(r=!1),e.addEventListener(t,n,r)},H=function(t,e){return function(t){return i(t,RegExp)}(t)?t:RegExp(t,s(e)?e:"g")},F="ArrowLeft",W="ArrowRight",$="Home",G="Backspace",J="End",Q="Enter",U=new WeakMap;function V(t,e,n){Object.defineProperty(t,e,n)}function X(t){t.focus()}function Y(t,e){t.forEach(e)}function Z(t,e){Y(t,e)}function tt(t){return rt(t,U)||null}function et(t){return m(t,"value",!1)}function nt(t){return(t.value||"").replace(/\r/g,"")}function rt(t,e){return e.get(t)}function it(t,e){return e.has(t)}function ut(t){return t.disabled}function at(t){var e=p.getSelection();e.rangeCount&&e.removeRange(e.getRangeAt(0))}function st(t,e){var n=p.getSelection();at();var r=p.createRange();r.selectNodeContents(t),n.addRange(r),1===e?n.collapseToEnd():-1===e&&n.collapseToStart()}function ot(t,e){return ft(t,e,U)}function ft(t,e,n){return n.set(t,e)}function ct(t){var e=[];return Z(t,(function(t,n){return e.push(n)})),e}function lt(t){return pt(t).shift()}function vt(t){return pt(t).pop()}function pt(t){var e=[];return Z(t,(function(t){return e.push(t)})),e}function _t(t,e){var n=this;if(!t)return n;if(!i(n,_t))return new _t(t,e);ot(t,function(t,e){return(e=e||t).fire=function(t,e,n){var r=this,i=r.hooks;return s(i[t])?(i[t].forEach((function(t){return t.apply(n||r,e)})),r):r},e.off=function(t,e){var n=this,r=n.hooks;if(!s(t))return r={},n;if(s(r[t]))if(s(e)){var i=r[t].length;if(0===i)delete r[t];else for(var u=0;u<i;++u)if(e===r[t][u]){r[t].splice(u,1);break}}else delete r[t];return n},e.on=function(t,e){var n=this.hooks;return s(n[t])||(n[t]=[]),s(e)&&n[t].push(e),this},t.hooks={},t}(n,_t._));var r=l({},_t.state,o(e)?{join:e}:e||{});return a(e)&&e.escape&&(r.escape=e.escape),n.attach(t,r)}_t.from=function(t,e){return new _t(t,e)},_t.of=tt,_t.state={escape:[","],join:", ",max:1/0,min:0,n:"tag-picker",pattern:null,with:[]},_t.version="4.1.0",V(_t,"name",{value:"TagPicker"});var ht=_t._=_t.prototype;V(ht,"text",{get:function(){return w(this._mask.input)},set:function(t){var e=this._mask,n=this.self,r=e.hint,i=e.input;K(r,""===(t+="")?n.placeholder:""),K(i,t),st(i)}}),V(ht,"value",{get:function(){var t=nt(this.self);return""===t?null:t},set:function(t){var e=this,n=e._event,r=e.state;e.value&&Y(e.value.split(r.join),(function(t){return e.let(t,1)})),Y(t.split(r.join),(function(t){return e.set(t,-1,1)})),e.fire("change",[n])}}),ht._let=!1,ht._set=!1,ht._valid=function(t){var e=this.state;return(t||"").replace(/[^ -~]/g," ").split(e.join).join("").replace(/\s+/g," ").trim()};var gt=!1,dt=!1;function mt(t){at();var e=tt(this);e._mask;var n=e._tags,r=e.mask,i=e.state.n;e._event=t,gt||dt||Z(n,(function(t){return D(t,i+"__tag--selected")})),D(r,i+="--focus"),D(r,i+="-tag")}function bt(t){at();var e=tt(this),n=e._mask,r=e.mask,i=e.state,u=n.text,a=i.n;e._event=t,D(u,a+"__text--focus"),D(r,a+="--focus"),D(r,a+="-text"),e.fire("blur",[t])}function kt(t){var e=tt(this),n=t.target,r=e.state.n+"__tag";e._event=t,E(n,r)||k(n,"."+r)||e.focus()}function yt(t){var e=this,n=tt(e),r=n.state.n+"__tag--selected";n._event=t,L(e,r),X(e),st(g(e))}function xt(t){var e=tt(this),n=e._tags,r=e.state,i=r.n+"__tag--selected",u=[];e._event=t,Z(n,(function(t,e){E(t,i)&&u.push(e)})),t.clipboardData.setData("text/plain",u.join(r.join)),e.fire("copy",[t,u]).focus(),B(t)}function wt(t){var e=tt(this),n=e._mask,r=e._tags,i=e.state;n.input;var u=i.n+"__tag--selected",a=[];e._event=t,Z(r,(function(t,n){E(t,u)&&(a.push(n),e.let(n,1))})),t.clipboardData.setData("text/plain",a.join(i.join)),e.fire("cut",[t,a]).fire("change",[t,et(this)]).focus(),B(t)}function jt(t){var e=tt(this),n=e._mask,r=e._tags,i=e.mask,u=e.self,a=e.state,s=n.hint,o=n.input,f=n.text,c=a.n;e._event=t,Z(r,(function(t){return D(t,c+"__tag--selected")})),L(f,c+"__text--focus"),L(i,c+="--focus"),L(i,c+="-text"),O((function(){return K(s,w(o,!1)?"":u.placeholder)}),1)(),e.focus().fire("focus",[t])}function Et(t){var e=tt(this);e._event=t,e.focus()}function At(t){var e=tt(this);e._event=t,e.fire("min.tags",[t]).focus(),B(t)}function St(t){var e=tt(this);e._mask;var n=e.mask,r=e.state.n;e._event=t,L(n,r+="--focus"),L(n,r+="-tag"),e.fire("focus.tag",[t])}function Dt(t){var e,n=this,r=t.key,i=gt=t.ctrlKey,u=dt=t.shiftKey,a=tt(n),s=a._mask,o=a._tags;a.mask;var c,l,v,p=a.state,_=s.text,h=x(n),d=b(n),m=p.n+"__tag--selected";if(a._event=t,u)L(n,m),st(g(n)),F===r?(h&&(E(h,m)?D(n,m):L(h,m),X(h),st(g(h))),e=!0):W===r&&(d&&_!==d&&(E(d,m)?D(n,m):L(d,m),X(d),st(g(d))),e=!0);else if(i)"a"===r?(Z(o,(function(t){X(t),st(g(t)),L(t,m)})),e=!0):F===r?(h&&X(h),e=!0):W===r?(d&&_!==d?X(d):a.focus(),e=!0):Q!==r&&" "!==r||(M(n,m),E(n,m)?(X(n),st(g(n))):st(g(vt(o))),e=!0);else{var k=[];if(Z(o,(function(t,e){E(t,m)&&k.push(e),n!==t&&D(t,m)})),$===r)(c=lt(o))&&X(c),e=!0;else if(J===r)(l=vt(o))&&X(l),e=!0;else if(Q===r||" "===r)M(n,m),E(n,m)?(X(n),st(g(n))):st(g(vt(o))),e=!0;else if(F===r)h&&X(h),e=!0;else if(W===r)d&&_!==d?X(d):a.focus(),e=!0;else if(G===r){if(a.let(v=et(n),1),f(k)>1)for(var y,w;w=k.pop();)h=(y=rt(w,o))&&x(y),a.let(w,1);a.fire("change",[t,v]),h?(X(h),st(g(h))):a.focus(),e=!0}else if("Delete"===r){if(a.let(v=et(n),1),f(k)>1)for(var j;j=k.shift();)d=rt(j,o)&&b(j),a.let(j,1);a.fire("change",[t,v]),d&&_!==d?(X(d),st(g(d))):a.focus(),e=!0}else"Escape"===r||"Tab"===r?(a.focus(),e=!0):(a.focus(),e=!1)}e&&B(t)}function Tt(t){var e=t.key,n=tt(this),r=n._tags,i=n.state.n+"__tag--selected";if(n._event=t,dt)if(F===e||W===e);else{var u=0;Z(r,(function(t){E(t,i)&&++u})),u<2&&D(this,i)}gt=dt=!1}function Ct(e){var n=e.data,r=tt(this),i=r.state.escape,u=o(n)&&1===f(n)?n:0;if(r._event=e,"\n"===u&&(t("\n",i)||t(13,i))||"\t"===u&&(t("\t",i)||t(9,i))||t(u,i))return r.set(w(this)).focus().text="",B(e)}function Rt(e){var n,i=this,u=e.key,a=e.keyCode,s=gt=e.ctrlKey,o=dt=e.shiftKey,f=tt(i),c=f._active,l=f._mask,v=f._tags;f.mask;var h,d,m=f.self,b=f.state,k=l.hint,x=b.n+"__tag--selected";if(escape=b.escape,!c)return B(e);if(f._event=e,Q===u&&(t("\n",escape)||t(13,escape))||"Tab"===u&&(t("\t",escape)||t(9,escape))||t(u,escape)||t(a,escape))return f.set(w(i)).focus().text="",B(e);O((function(){return K(k,w(i,!1)?"":m.placeholder)}),1)();var j,E=""===function(t){var e,n=_.getSelection();if(n.rangeCount)return(e=n.getRangeAt(0).cloneRange()).collapse(!0),e.setStart(t,0),(e+"").slice(-1)}(i),A=null===w(i,!1);if(o)(A||E)&&F===u&&(d=vt(v))&&(d&&(X(d),st(g(d))),L(d,x),n=!0);else if(s)"a"===u&&null===w(i,!1)&&null!==f.value?(Z(v,(function(t){X(t),st(g(t)),L(t,x)})),n=!0):$===u?((h=lt(v))&&X(h),n=!0):J===u||F===u?((d=vt(v))&&X(d),n=!0):G===u&&((d=vt(v))&&f.let(et(d)),f.focus(),n=!0);else if(Q===u){var S=y(m);if(S&&r(S.requestSubmit)){var D=(j="button:not([type]),button[type=submit],input[type=image],input[type=submit]",(S||p).querySelector(j));D?S.requestSubmit(D):S.requestSubmit()}n=!0}else A?$===u?((h=lt(v))&&X(h),n=!0):J===u||F===u?((d=vt(v))&&X(d),n=!0):G===u&&((d=vt(v))&&f.let(et(d)),f.focus(),n=!0):E&&F===u&&((d=vt(v))&&X(d),n=!0);n&&B(e)}function Lt(t){tt(this)._event=t,gt=dt=!1}function qt(t){var e=tt(this),n=e._tags,r=e.state,i=r.n+"__tag--selected",u=!0,a=(t.clipboardData||_.clipboardData).getData("text")+"";e._event=t;try{Z(n,(function(t){if(!E(t,i))throw u=!1,""}))}catch(t){}u&&e.value&&Y(e.value.split(r.join),(function(t){return e.let(t,1)}));var s=a.split(r.join);Y(s,(function(t){return e.set(t,-1,1)})),e.fire("paste",[t,s]).focus().fire("change",[t]),B(t)}function Nt(t){var e=this,n=tt(e),r=n._mask,i=n.self,u=n.state,a=r.hint,s=(t.clipboardData||_.clipboardData).getData("text")+"";n._event=t,function(t,e){var n,r=_.getSelection();r.rangeCount&&((n=r.getRangeAt(0)).deleteContents(),n.insertNode(p.createTextNode(e)))}(0,s),K(a,w(e)?"":i.placeholder),O((function(){if(s=w(e),n.text="",s){var r=s.split(u.join);Y(r,(function(t){return n.set(t,-1,1)})),n.fire("paste",[t,r]).fire("change",[t])}}),1)(),B(t)}function zt(t){var e=this,n=tt(e),r=n._active,i=n._mask,u=n._tags,a=n.state,s=i.text,o=a.n+"__tag--selected";if(r){if(n._event=t,X(e),M(e,o),gt);else if(dt){at();var c,l=k(e),v=(y="."+o,(l||p).querySelectorAll(y)),_=v[0],h=v[f(v)-1];if(_!==h)for(;(c=b(_))&&s!==c&&_!==h;)L(_=c,o)}else{at();var d=2===t.button,m=0;Z(u,(function(t){E(t,o)&&++m,e===t||d||D(t,o)})),m>0&&L(e,o)}var y;E(e,o)?(X(e),st(g(e))):st(vt(u)),n.fire("touch.tag",[t]),B(t),function(t){t&&t.stopPropagation()}(t)}}function Kt(t){var e=this,n=k(e),r=tt(n);r._event=t,P("mousedown",e,Kt),P("touchstart",e,Kt),r.let(et(n)).focus(),B(t)}function Mt(t){var e=tt(this);e._event=t,e.let().fire("reset",[t])}function Ot(t){var e=tt(this),n=e._tags,r=e.state;return e._event=t,n.size<r.min?(e.fire("min.tags",[t]).focus(),B(t)):e.fire("submit",[t])}return ht.attach=function(t,n){var i=this;if(t=t||i.self,n&&o(n)&&(n={join:n}),n=l({},i.state,n||{}),E(t,n.n+"__self"))return i;(function(t){return t.required})(t)&&!n.min&&(n.min=1),i._active=!ut(t)&&!function(t){return t.readOnly}(t),i._event=null,i._tags=new Map,i._value=nt(t)||null,i.self=t,i.state=n;var u=n.n,c=y(t),v=q("div",{class:u,tabindex:!ut(t)&&-1});i.mask=v;var p,_,h=q("span",{class:u+"__tags"}),g=q("span",{class:u+"__text"}),d=q("span",{autocapitalize:"off",contenteditable:!ut(t)&&"",spellcheck:"false"}),m=q("span",t.placeholder+"");R(v,h),R(h,g),R(g,d),R(g,m),L(t,u+"__self"),_=v,k(p=t).insertBefore(_,b(p,!0)),c&&(ot(c,i),I("reset",c,Mt),I("submit",c,Ot)),I("beforeinput",d,Ct),I("blur",d,bt),I("click",v,kt),I("focus",t,Et),I("focus",d,jt),I("invalid",t,At),I("keydown",d,Rt),I("keyup",d,Lt),I("paste",d,Nt),t.tabIndex=-1,ot(v,i),ot(d,i);var x={};if(x.hint=m,x.input=d,x.of=t,x.self=v,x.tags=h,x.text=g,i._mask=x,i._value&&Y(i._value.split(n.join),(function(t){return i.set(t,-1,1,1)})),s(n)&&e(n.with))for(var w=0,j=f(n.with);w<j;++w){var A=n.with[w];o(A)&&(A=_t[A]),r(A)?A.call(i,t,n):a(A)&&r(A.attach)&&A.attach.call(i,t,n)}return i},ht.blur=function(){at();var t=this._mask,e=this._tags,n=t.input;return Z(e,(function(t){return t.blur()})),n.blur()},ht.detach=function(){var t=this,n=t._mask,i=t.mask,u=t.self,s=t.state,c=n.input;if(!E(u,s.n+"__self"))return t;var l=y(u);if(t._active=!1,t._value=nt(u)||null,l&&(P("reset",l,Mt),P("submit",l,Ot)),P("beforeinput",c,Ct),P("blur",c,bt),P("click",i,kt),P("focus",c,jt),P("focus",u,Et),P("invalid",u,At),P("keydown",c,Rt),P("keyup",c,Lt),P("paste",c,Nt),e(s.with))for(var v=0,p=f(s.with);v<p;++v){var _=s.with[v];o(_)&&(_=_t[_]),a(_)&&r(_.detach)&&_.detach.call(t,u,s)}return u.tabIndex=null,D(u,s.n+"__self"),T(i),t._mask={of:u},t.mask=null,t},ht.focus=function(t){var e=this._mask.input;return e&&(X(e),st(e,t)),this},ht.get=function(t){var e=this,n=e._active,r=e._event,i=e._tags;if(!n)return!1;if(e.fire("get.tag",[r,t]),!it(t,i))return null;var u=-1;try{Z(i,(function(e,n){if(++u,t===n)throw""}))}catch(t){}return u},ht.let=function(t,i){var u=this,a=u._active,s=u._event,o=u._let,f=u._tags,c=u._value,l=u.self,v=u.state;if(!a)return u;if(!n(t))return u.value&&Y(u.value.split(v.join),(function(t){return u.let(t,1)})),Y(c.split(v.join),(function(t){return u.set(t,-1,1)})),u.fire("change",[s]);if(e(t)||(t=[t,t]),f.size<v.min+1)return u.fire("min.tags",[s,t[0]]);if(!it(t[0],f))return u.fire("not.tag",[s,t[0]]);u.fire("is.tag",[s,t[0]]);var p=rt(t[0],f);h(p,0);var _,g=h(p,1);return r(o)&&o.call(u,p),P("blur",p,mt),P("contextmenu",p,yt),P("copy",p,xt),P("cut",p,wt),P("focus",p,St),P("keydown",p,Dt),P("keyup",p,Tt),P("mousedown",p,zt),P("mousedown",g,Kt),P("paste",p,qt),P("touchstart",p,zt),P("touchstart",g,Kt),T(p),_=t[0],u._tags.delete(_),l.value=ct(u._tags).join(v.join),u.fire("let.tag",[s,t[0]]),i||u.fire("change",[s,t[0]]),u},ht.set=function(t,n,i,a){var s,f=this,c=f._active,l=f._event,v=f._mask,p=f._set,_=f._tags,h=f._valid,g=f.self,d=f.state,m=v.text,b=d.n,k=d.pattern;if(!c&&!a)return f;if(e(t)||(t=[t,t]),_.size>=d.max)return f.fire("max.tags",[l,t[0]]);if(r(h)&&(t[0]=h.call(f,t[0])),""===t[0]||o(k)&&!H(k).test(t[0]))return f.fire("not.tag",[l,t[0]]);if(it(t[0],_))return f.fire("has.tag",[l,t[0]]);f.fire("is.tag",[l,t[0]]);var y=q("span",{class:b+"__tag","data-value":t[0],tabindex:!!c&&-1}),x=q("span",(null!=(s=t[1])?s:t[0]).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<")),w=q("span",{class:b+"__x",tabindex:-1});if(c&&(I("blur",y,mt),I("contextmenu",y,yt),I("copy",y,xt),I("cut",y,wt),I("focus",y,St),I("keydown",y,Dt),I("keyup",y,Tt),I("mousedown",y,zt),I("mousedown",w,Kt),I("paste",y,qt),I("touchstart",y,zt),I("touchstart",w,Kt),ot(y,f)),R(y,x),R(y,w),function(t){return u(t)&&0==t%1}(n)&&n>=0){var j=ct(_);j.splice(n,0,t[0]),f._tags=new Map,ft(t[0],y,_),r(p)&&p.call(f,y),Y(j,(function(t){var e;ft(t,e=rt(t,_),f._tags),z(m,e)}))}else ft(t[0],y,f._tags),r(p)&&p.call(f,y),z(m,y);return g.value=ct(f._tags).join(d.join),f.fire("set.tag",[l,t[0]]),i||f.fire("change",[l,t[0]]),f},_t}));