@blueking/bkflow-canvas-editor 0.0.37-beta.1 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -2
- package/dist/index.cjs.js +36 -36
- package/dist/index.es.min-BBOgAuB2.js +3214 -0
- package/dist/index.es.min-DQIH7mAl.cjs +2 -0
- package/dist/index.esm.js +15635 -15213
- package/dist/style.css +1 -1
- package/package.json +7 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),ht=require("bkui-vue");var ur=Object.create,Rn=Object.defineProperty,cr=Object.getOwnPropertyDescriptor,dr=Object.getOwnPropertyNames,fr=Object.getPrototypeOf,hr=Object.prototype.hasOwnProperty,pr=(d,f)=>()=>(f||d((f={exports:{}}).exports,f),f.exports),gr=(d,f,c,i)=>{if(f&&typeof f=="object"||typeof f=="function")for(var s=dr(f),m=0,h=s.length,_;m<h;m++)_=s[m],!hr.call(d,_)&&_!==c&&Rn(d,_,{get:(w=>f[w]).bind(null,_),enumerable:!(i=cr(f,_))||i.enumerable});return d},vr=(d,f,c)=>(c=d!=null?ur(fr(d)):{},gr(!d||!d.__esModule?Rn(c,"default",{value:d,enumerable:!0}):c,d)),mr=vr(pr(((d,f)=>{(function(c,i){typeof d=="object"&&typeof f<"u"?f.exports=i():typeof define=="function"&&define.amd?define(i):(c=c||self,c.Sortable=i())})(d,(function(){function c(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable})),t.push.apply(t,n)}return t}function i(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?c(Object(t),!0).forEach(function(n){m(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function s(r){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?s=function(e){return typeof e}:s=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(r)}function m(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function h(){return h=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},h.apply(this,arguments)}function _(r,e){if(r==null)return{};var t={},n=Object.keys(r),o,l;for(l=0;l<n.length;l++)o=n[l],!(e.indexOf(o)>=0)&&(t[o]=r[o]);return t}function w(r,e){if(r==null)return{};var t=_(r,e),n,o;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(r);for(o=0;o<l.length;o++)n=l[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function R(r){return G(r)||H(r)||he(r)||Ae()}function G(r){if(Array.isArray(r))return Oe(r)}function H(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function he(r,e){if(r){if(typeof r=="string")return Oe(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Oe(r,e)}}function Oe(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Ae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Ce="1.15.6";function q(r){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(r)}var z=q(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ye=q(/Edge/i),ot=q(/firefox/i),$=q(/safari/i)&&!q(/chrome/i)&&!q(/android/i),X=q(/iP(ad|od|hone)/i),T=q(/chrome/i)&&q(/android/i),oe={capture:!1,passive:!1};function O(r,e,t){r.addEventListener(e,t,!z&&oe)}function x(r,e,t){r.removeEventListener(e,t,!z&&oe)}function Y(r,e){if(e){if(e[0]===">"&&(e=e.substring(1)),r)try{if(r.matches)return r.matches(e);if(r.msMatchesSelector)return r.msMatchesSelector(e);if(r.webkitMatchesSelector)return r.webkitMatchesSelector(e)}catch{return!1}return!1}}function pe(r){return r.host&&r!==document&&r.host.nodeType?r.host:r.parentNode}function te(r,e,t,n){if(r){t=t||document;do{if(e!=null&&(e[0]===">"?r.parentNode===t&&Y(r,e):Y(r,e))||n&&r===t)return r;if(r===t)break}while(r=pe(r))}return null}var ze=/\s+/g;function U(r,e,t){r&&e&&(r.classList?r.classList[t?"add":"remove"](e):r.className=((" "+r.className+" ").replace(ze," ").replace(" "+e+" "," ")+(t?" "+e:"")).replace(ze," "))}function E(r,e,t){var n=r&&r.style;if(n){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(r,""):r.currentStyle&&(t=r.currentStyle),e===void 0?t:t[e];!(e in n)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),n[e]=t+(typeof t=="string"?"":"px")}}function De(r,e){var t="";if(typeof r=="string")t=r;else do{var n=E(r,"transform");n&&n!=="none"&&(t=n+" "+t)}while(!e&&(r=r.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(t)}function Bt(r,e,t){if(r){var n=r.getElementsByTagName(e),o=0,l=n.length;if(t)for(;o<l;o++)t(n[o],o);return n}return[]}function Se(){var r=document.scrollingElement;return r||document.documentElement}function j(r,e,t,n,o){if(!(!r.getBoundingClientRect&&r!==window)){var l,u,p,v,y,D,S;if(r!==window&&r.parentNode&&r!==Se()?(l=r.getBoundingClientRect(),u=l.top,p=l.left,v=l.bottom,y=l.right,D=l.height,S=l.width):(u=0,p=0,v=window.innerHeight,y=window.innerWidth,D=window.innerHeight,S=window.innerWidth),(e||t)&&r!==window&&(o=o||r.parentNode,!z))do if(o&&o.getBoundingClientRect&&(E(o,"transform")!=="none"||t&&E(o,"position")!=="static")){var k=o.getBoundingClientRect();u-=k.top+parseInt(E(o,"border-top-width")),p-=k.left+parseInt(E(o,"border-left-width")),v=u+l.height,y=p+l.width;break}while(o=o.parentNode);if(n&&r!==window){var F=De(o||r),N=F&&F.a,V=F&&F.d;F&&(u/=V,p/=N,S/=N,D/=V,v=u+D,y=p+S)}return{top:u,left:p,bottom:v,right:y,width:S,height:D}}}function Mt(r,e,t){for(var n=be(r,!0),o=j(r)[e];n;){var l=j(n)[t],u=void 0;if(u=o>=l,!u)return n;if(n===Se())break;n=be(n,!1)}return!1}function je(r,e,t,n){for(var o=0,l=0,u=r.children;l<u.length;){if(u[l].style.display!=="none"&&u[l]!==A.ghost&&(n||u[l]!==A.dragged)&&te(u[l],t.draggable,r,!1)){if(o===e)return u[l];o++}l++}return null}function pt(r,e){for(var t=r.lastElementChild;t&&(t===A.ghost||E(t,"display")==="none"||e&&!Y(t,e));)t=t.previousElementSibling;return t||null}function ee(r,e){var t=0;if(!r||!r.parentNode)return-1;for(;r=r.previousElementSibling;)r.nodeName.toUpperCase()!=="TEMPLATE"&&r!==A.clone&&(!e||Y(r,e))&&t++;return t}function it(r){var e=0,t=0,n=Se();if(r)do{var o=De(r),l=o.a,u=o.d;e+=r.scrollLeft*l,t+=r.scrollTop*u}while(r!==n&&(r=r.parentNode));return[e,t]}function Nt(r,e){for(var t in r)if(r.hasOwnProperty(t)){for(var n in e)if(e.hasOwnProperty(n)&&e[n]===r[t][n])return Number(t)}return-1}function be(r,e){if(!r||!r.getBoundingClientRect)return Se();var t=r,n=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var o=E(t);if(t.clientWidth<t.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return Se();if(n||e)return t;n=!0}}while(t=t.parentNode);return Se()}function lt(r,e){if(r&&e)for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}function Ke(r,e){return Math.round(r.top)===Math.round(e.top)&&Math.round(r.left)===Math.round(e.left)&&Math.round(r.height)===Math.round(e.height)&&Math.round(r.width)===Math.round(e.width)}var Re;function Qe(r,e){return function(){if(!Re){var t=arguments,n=this;t.length===1?r.call(n,t[0]):r.apply(n,t),Re=setTimeout(function(){Re=void 0},e)}}}function nn(){clearTimeout(Re),Re=void 0}function Pt(r,e,t){r.scrollLeft+=e,r.scrollTop+=t}function Ze(r){var e=window.Polymer,t=window.jQuery||window.Zepto;return e&&e.dom?e.dom(r).cloneNode(!0):t?t(r).clone(!0)[0]:r.cloneNode(!0)}function gt(r,e){E(r,"position","absolute"),E(r,"top",e.top),E(r,"left",e.left),E(r,"width",e.width),E(r,"height",e.height)}function st(r){E(r,"position",""),E(r,"top",""),E(r,"left",""),E(r,"width",""),E(r,"height","")}function vt(r,e,t){var n={};return Array.from(r.children).forEach(function(o){var l,u,p,v;if(!(!te(o,e.draggable,r,!1)||o.animated||o===t)){var y=j(o);n.left=Math.min((l=n.left)!==null&&l!==void 0?l:1/0,y.left),n.top=Math.min((u=n.top)!==null&&u!==void 0?u:1/0,y.top),n.right=Math.max((p=n.right)!==null&&p!==void 0?p:-1/0,y.right),n.bottom=Math.max((v=n.bottom)!==null&&v!==void 0?v:-1/0,y.bottom)}}),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var ne="Sortable"+new Date().getTime();function Rt(){var r=[],e;return{captureAnimationState:function(){r=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(n){if(!(E(n,"display")==="none"||n===A.ghost)){r.push({target:n,rect:j(n)});var o=i({},r[r.length-1].rect);if(n.thisAnimationDuration){var l=De(n,!0);l&&(o.top-=l.f,o.left-=l.e)}n.fromRect=o}})},addAnimationState:function(n){r.push(n)},removeAnimationState:function(n){r.splice(Nt(r,{target:n}),1)},animateAll:function(n){var o=this;if(!this.options.animation){clearTimeout(e),typeof n=="function"&&n();return}var l=!1,u=0;r.forEach(function(p){var v=0,y=p.target,D=y.fromRect,S=j(y),k=y.prevFromRect,F=y.prevToRect,N=p.rect,V=De(y,!0);V&&(S.top-=V.f,S.left-=V.e),y.toRect=S,y.thisAnimationDuration&&Ke(k,S)&&!Ke(D,S)&&(N.top-S.top)/(N.left-S.left)===(D.top-S.top)/(D.left-S.left)&&(v=ut(N,k,F,o.options)),Ke(S,D)||(y.prevFromRect=D,y.prevToRect=S,v||(v=o.options.animation),o.animate(y,N,S,v)),v&&(l=!0,u=Math.max(u,v),clearTimeout(y.animationResetTimer),y.animationResetTimer=setTimeout(function(){y.animationTime=0,y.prevFromRect=null,y.fromRect=null,y.prevToRect=null,y.thisAnimationDuration=null},v),y.thisAnimationDuration=v)}),clearTimeout(e),l?e=setTimeout(function(){typeof n=="function"&&n()},u):typeof n=="function"&&n(),r=[]},animate:function(n,o,l,u){if(u){E(n,"transition",""),E(n,"transform","");var p=De(this.el),v=p&&p.a,y=p&&p.d,D=(o.left-l.left)/(v||1),S=(o.top-l.top)/(y||1);n.animatingX=!!D,n.animatingY=!!S,E(n,"transform","translate3d("+D+"px,"+S+"px,0)"),this.forRepaintDummy=mt(n),E(n,"transition","transform "+u+"ms"+(this.options.easing?" "+this.options.easing:"")),E(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){E(n,"transition",""),E(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},u)}}}}function mt(r){return r.offsetWidth}function ut(r,e,t,n){return Math.sqrt(Math.pow(e.top-r.top,2)+Math.pow(e.left-r.left,2))/Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))*n.animation}var ge=[],yt={initializeByDefault:!0},Be={mount:function(e){for(var t in yt)yt.hasOwnProperty(t)&&!(t in e)&&(e[t]=yt[t]);ge.forEach(function(n){if(n.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),ge.push(e)},pluginEvent:function(e,t,n){var o=this;this.eventCanceled=!1,n.cancel=function(){o.eventCanceled=!0};var l=e+"Global";ge.forEach(function(u){t[u.pluginName]&&(t[u.pluginName][l]&&t[u.pluginName][l](i({sortable:t},n)),t.options[u.pluginName]&&t[u.pluginName][e]&&t[u.pluginName][e](i({sortable:t},n)))})},initializePlugins:function(e,t,n,o){ge.forEach(function(p){var v=p.pluginName;if(!(!e.options[v]&&!p.initializeByDefault)){var y=new p(e,t,e.options);y.sortable=e,y.options=e.options,e[v]=y,h(n,y.defaults)}});for(var l in e.options)if(e.options.hasOwnProperty(l)){var u=this.modifyOption(e,l,e.options[l]);typeof u<"u"&&(e.options[l]=u)}},getEventProperties:function(e,t){var n={};return ge.forEach(function(o){typeof o.eventProperties=="function"&&h(n,o.eventProperties.call(t[o.pluginName],e))}),n},modifyOption:function(e,t,n){var o;return ge.forEach(function(l){e[l.pluginName]&&l.optionListeners&&typeof l.optionListeners[t]=="function"&&(o=l.optionListeners[t].call(e[l.pluginName],n))}),o}};function Le(r){var e=r.sortable,t=r.rootEl,n=r.name,o=r.targetEl,l=r.cloneEl,u=r.toEl,p=r.fromEl,v=r.oldIndex,y=r.newIndex,D=r.oldDraggableIndex,S=r.newDraggableIndex,k=r.originalEvent,F=r.putSortable,N=r.extraEventProperties;if(e=e||t&&t[ne],!!e){var V,fe=e.options,Ie="on"+n.charAt(0).toUpperCase()+n.substr(1);window.CustomEvent&&!z&&!ye?V=new CustomEvent(n,{bubbles:!0,cancelable:!0}):(V=document.createEvent("Event"),V.initEvent(n,!0,!0)),V.to=u||t,V.from=p||t,V.item=o||t,V.clone=l,V.oldIndex=v,V.newIndex=y,V.oldDraggableIndex=D,V.newDraggableIndex=S,V.originalEvent=k,V.pullMode=F?F.lastPutMode:void 0;var P=i(i({},N),Be.getEventProperties(n,e));for(var Z in P)V[Z]=P[Z];t&&t.dispatchEvent(V),fe[Ie]&&fe[Ie].call(e,V)}}var Ue=["evt"],le=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=n.evt,l=w(n,Ue);Be.pluginEvent.bind(A)(e,t,i({dragEl:b,parentEl:K,ghostEl:B,rootEl:W,nextEl:Fe,lastDownEl:ce,cloneEl:J,cloneHidden:Me,dragStarted:tt,putSortable:ie,activeSortable:A.active,originalEvent:o,oldIndex:He,oldDraggableIndex:Je,newIndex:de,newDraggableIndex:Ne,hideGhostForTarget:kn,unhideGhostForTarget:xn,cloneNowHidden:function(){Me=!0},cloneNowShown:function(){Me=!1},dispatchSortableEvent:function(p){re({sortable:t,name:p,originalEvent:o})}},l))};function re(r){Le(i({putSortable:ie,cloneEl:J,targetEl:b,rootEl:W,oldIndex:He,oldDraggableIndex:Je,newIndex:de,newDraggableIndex:Ne},r))}var b,K,B,W,Fe,ce,J,Me,He,de,Je,Ne,qe,ie,Te=!1,$e=!1,g=[],C,I,L,ve,Ye,et,tt,ct,bt,wt=!1,Lt=!1,Ft,ue,rn=[],an=!1,qt=[],Vt=typeof document<"u",Gt=X,In=ye||z?"cssFloat":"float",jn=Vt&&!T&&!X&&"draggable"in document.createElement("div"),Dn=(function(){if(Vt){if(z)return!1;var r=document.createElement("x");return r.style.cssText="pointer-events:auto",r.style.pointerEvents==="auto"}})(),Un=function(e,t){var n=E(e),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),l=je(e,0,t),u=je(e,1,t),p=l&&E(l),v=u&&E(u),y=p&&parseInt(p.marginLeft)+parseInt(p.marginRight)+j(l).width,D=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+j(u).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(l&&p.float&&p.float!=="none"){var S=p.float==="left"?"left":"right";return u&&(v.clear==="both"||v.clear===S)?"vertical":"horizontal"}return l&&(p.display==="block"||p.display==="flex"||p.display==="table"||p.display==="grid"||y>=o&&n[In]==="none"||u&&n[In]==="none"&&y+D>o)?"vertical":"horizontal"},Kn=function(e,t,n){var o=n?e.left:e.top,l=n?e.right:e.bottom,u=n?e.width:e.height,p=n?t.left:t.top,v=n?t.right:t.bottom,y=n?t.width:t.height;return o===p||l===v||o+u/2===p+y/2},Hn=function(e,t){var n;return g.some(function(o){var l=o[ne].options.emptyInsertThreshold;if(!(!l||pt(o))){var u=j(o),p=e>=u.left-l&&e<=u.right+l,v=t>=u.top-l&&t<=u.bottom+l;if(p&&v)return n=o}}),n},Tn=function(e){function t(l,u){return function(p,v,y,D){var S=p.options.group.name&&v.options.group.name&&p.options.group.name===v.options.group.name;if(l==null&&(u||S))return!0;if(l==null||l===!1)return!1;if(u&&l==="clone")return l;if(typeof l=="function")return t(l(p,v,y,D),u)(p,v,y,D);var k=(u?p:v).options.group.name;return l===!0||typeof l=="string"&&l===k||l.join&&l.indexOf(k)>-1}}var n={},o=e.group;(!o||s(o)!="object")&&(o={name:o}),n.name=o.name,n.checkPull=t(o.pull,!0),n.checkPut=t(o.put),n.revertClone=o.revertClone,e.group=n},kn=function(){!Dn&&B&&E(B,"display","none")},xn=function(){!Dn&&B&&E(B,"display","")};Vt&&!T&&document.addEventListener("click",function(r){if($e)return r.preventDefault(),r.stopPropagation&&r.stopPropagation(),r.stopImmediatePropagation&&r.stopImmediatePropagation(),$e=!1,!1},!0);var nt=function(e){if(b){e=e.touches?e.touches[0]:e;var t=Hn(e.clientX,e.clientY);if(t){var n={};for(var o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ne]._onDragOver(n)}}},Yn=function(e){b&&b.parentNode[ne]._isOutsideThisEl(e.target)};function A(r,e){if(!(r&&r.nodeType&&r.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(r));this.el=r,this.options=e=h({},e),r[ne]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(r.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Un(r,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(u,p){u.setData("Text",p.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:A.supportPointer!==!1&&"PointerEvent"in window&&(!$||X),emptyInsertThreshold:5};Be.initializePlugins(this,r,t);for(var n in t)!(n in e)&&(e[n]=t[n]);Tn(e);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=e.forceFallback?!1:jn,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?O(r,"pointerdown",this._onTapStart):(O(r,"mousedown",this._onTapStart),O(r,"touchstart",this._onTapStart)),this.nativeDraggable&&(O(r,"dragover",this),O(r,"dragenter",this)),g.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),h(this,Rt())}A.prototype={constructor:A,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(ct=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,b):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,o=this.options,l=o.preventOnFilter,u=e.type,p=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,v=(p||e).target,y=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||v,D=o.filter;if(tr(n),!b&&!(/mousedown|pointerdown/.test(u)&&e.button!==0||o.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&$&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=te(v,o.draggable,n,!1),!(v&&v.animated)&&ce!==v)){if(He=ee(v),Je=ee(v,o.draggable),typeof D=="function"){if(D.call(this,e,v,this)){re({sortable:t,rootEl:y,name:"filter",targetEl:v,toEl:n,fromEl:n}),le("filter",t,{evt:e}),l&&e.preventDefault();return}}else if(D&&(D=D.split(",").some(function(S){if(S=te(y,S.trim(),n,!1),S)return re({sortable:t,rootEl:S,name:"filter",targetEl:v,fromEl:n,toEl:n}),le("filter",t,{evt:e}),!0}),D)){l&&e.preventDefault();return}o.handle&&!te(y,o.handle,n,!1)||this._prepareDragStart(e,p,v)}}},_prepareDragStart:function(e,t,n){var o=this,l=o.el,u=o.options,p=l.ownerDocument,v;if(n&&!b&&n.parentNode===l){var y=j(n);if(W=l,b=n,K=b.parentNode,Fe=b.nextSibling,ce=n,qe=u.group,A.dragged=b,C={target:b,clientX:(t||e).clientX,clientY:(t||e).clientY},Ye=C.clientX-y.left,et=C.clientY-y.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,b.style["will-change"]="all",v=function(){if(le("delayEnded",o,{evt:e}),A.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!ot&&o.nativeDraggable&&(b.draggable=!0),o._triggerDragStart(e,t),re({sortable:o,name:"choose",originalEvent:e}),U(b,u.chosenClass,!0)},u.ignore.split(",").forEach(function(D){Bt(b,D.trim(),on)}),O(p,"dragover",nt),O(p,"mousemove",nt),O(p,"touchmove",nt),u.supportPointer?(O(p,"pointerup",o._onDrop),!this.nativeDraggable&&O(p,"pointercancel",o._onDrop)):(O(p,"mouseup",o._onDrop),O(p,"touchend",o._onDrop),O(p,"touchcancel",o._onDrop)),ot&&this.nativeDraggable&&(this.options.touchStartThreshold=4,b.draggable=!0),le("delayStart",this,{evt:e}),u.delay&&(!u.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(ye||z))){if(A.eventCanceled){this._onDrop();return}u.supportPointer?(O(p,"pointerup",o._disableDelayedDrag),O(p,"pointercancel",o._disableDelayedDrag)):(O(p,"mouseup",o._disableDelayedDrag),O(p,"touchend",o._disableDelayedDrag),O(p,"touchcancel",o._disableDelayedDrag)),O(p,"mousemove",o._delayedDragTouchMoveHandler),O(p,"touchmove",o._delayedDragTouchMoveHandler),u.supportPointer&&O(p,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(v,u.delay)}else v()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){b&&on(b),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;x(e,"mouseup",this._disableDelayedDrag),x(e,"touchend",this._disableDelayedDrag),x(e,"touchcancel",this._disableDelayedDrag),x(e,"pointerup",this._disableDelayedDrag),x(e,"pointercancel",this._disableDelayedDrag),x(e,"mousemove",this._delayedDragTouchMoveHandler),x(e,"touchmove",this._delayedDragTouchMoveHandler),x(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||e.pointerType=="touch"&&e,!this.nativeDraggable||t?this.options.supportPointer?O(document,"pointermove",this._onTouchMove):t?O(document,"touchmove",this._onTouchMove):O(document,"mousemove",this._onTouchMove):(O(b,"dragend",this),O(W,"dragstart",this._onDragStart));try{document.selection?jt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,t){if(Te=!1,W&&b){le("dragStarted",this,{evt:t}),this.nativeDraggable&&O(document,"dragover",Yn);var n=this.options;!e&&U(b,n.dragClass,!1),U(b,n.ghostClass,!0),A.active=this,e&&this._appendGhost(),re({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(I){this._lastX=I.clientX,this._lastY=I.clientY,kn();for(var e=document.elementFromPoint(I.clientX,I.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(I.clientX,I.clientY),e!==t);)t=e;if(b.parentNode[ne]._isOutsideThisEl(e),t)do{if(t[ne]){var n=void 0;if(n=t[ne]._onDragOver({clientX:I.clientX,clientY:I.clientY,target:e,rootEl:t}),n&&!this.options.dragoverBubble)break}e=t}while(t=pe(t));xn()}},_onTouchMove:function(e){if(C){var t=this.options,n=t.fallbackTolerance,o=t.fallbackOffset,l=e.touches?e.touches[0]:e,u=B&&De(B,!0),p=B&&u&&u.a,v=B&&u&&u.d,y=Gt&&ue&&it(ue),D=(l.clientX-C.clientX+o.x)/(p||1)+(y?y[0]-rn[0]:0)/(p||1),S=(l.clientY-C.clientY+o.y)/(v||1)+(y?y[1]-rn[1]:0)/(v||1);if(!A.active&&!Te){if(n&&Math.max(Math.abs(l.clientX-this._lastX),Math.abs(l.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(B){u?(u.e+=D-(L||0),u.f+=S-(ve||0)):u={a:1,b:0,c:0,d:1,e:D,f:S};var k="matrix(".concat(u.a,",").concat(u.b,",").concat(u.c,",").concat(u.d,",").concat(u.e,",").concat(u.f,")");E(B,"webkitTransform",k),E(B,"mozTransform",k),E(B,"msTransform",k),E(B,"transform",k),L=D,ve=S,I=l}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!B){var e=this.options.fallbackOnBody?document.body:W,t=j(b,!0,Gt,!0,e),n=this.options;if(Gt){for(ue=e;E(ue,"position")==="static"&&E(ue,"transform")==="none"&&ue!==document;)ue=ue.parentNode;ue!==document.body&&ue!==document.documentElement?(ue===document&&(ue=Se()),t.top+=ue.scrollTop,t.left+=ue.scrollLeft):ue=Se(),rn=it(ue)}B=b.cloneNode(!0),U(B,n.ghostClass,!1),U(B,n.fallbackClass,!0),U(B,n.dragClass,!0),E(B,"transition",""),E(B,"transform",""),E(B,"box-sizing","border-box"),E(B,"margin",0),E(B,"top",t.top),E(B,"left",t.left),E(B,"width",t.width),E(B,"height",t.height),E(B,"opacity","0.8"),E(B,"position",Gt?"absolute":"fixed"),E(B,"zIndex","100000"),E(B,"pointerEvents","none"),A.ghost=B,e.appendChild(B),E(B,"transform-origin",Ye/parseInt(B.style.width)*100+"% "+et/parseInt(B.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,o=e.dataTransfer,l=n.options;if(le("dragStart",this,{evt:e}),A.eventCanceled){this._onDrop();return}le("setupClone",this),A.eventCanceled||(J=Ze(b),J.removeAttribute("id"),J.draggable=!1,J.style["will-change"]="",this._hideClone(),U(J,this.options.chosenClass,!1),A.clone=J),n.cloneId=jt(function(){le("clone",n),!A.eventCanceled&&(n.options.removeCloneOnHide||W.insertBefore(J,b),n._hideClone(),re({sortable:n,name:"clone"}))}),!t&&U(b,l.dragClass,!0),t?($e=!0,n._loopId=setInterval(n._emulateDragOver,50)):(x(document,"mouseup",n._onDrop),x(document,"touchend",n._onDrop),x(document,"touchcancel",n._onDrop),o&&(o.effectAllowed="move",l.setData&&l.setData.call(n,o,b)),O(document,"drop",n),E(b,"transform","translateZ(0)")),Te=!0,n._dragStartId=jt(n._dragStarted.bind(n,t,e)),O(document,"selectstart",n),tt=!0,window.getSelection().removeAllRanges(),$&&E(document.body,"user-select","none")},_onDragOver:function(e){var t=this.el,n=e.target,o,l,u,p=this.options,v=p.group,y=A.active,D=qe===v,S=p.sort,k=ie||y,F,N=this,V=!1;if(an)return;function fe(xt,lr){le(xt,N,i({evt:e,isOwner:D,axis:F?"vertical":"horizontal",revert:u,dragRect:o,targetRect:l,canSort:S,fromSortable:k,target:n,completed:P,onMove:function(Mn,sr){return zt(W,t,b,o,Mn,j(Mn),e,sr)},changed:Z},lr))}function Ie(){fe("dragOverAnimationCapture"),N.captureAnimationState(),N!==k&&k.captureAnimationState()}function P(xt){return fe("dragOverCompleted",{insertion:xt}),xt&&(D?y._hideClone():y._showClone(N),N!==k&&(U(b,ie?ie.options.ghostClass:y.options.ghostClass,!1),U(b,p.ghostClass,!0)),ie!==N&&N!==A.active?ie=N:N===A.active&&ie&&(ie=null),k===N&&(N._ignoreWhileAnimating=n),N.animateAll(function(){fe("dragOverAnimationComplete"),N._ignoreWhileAnimating=null}),N!==k&&(k.animateAll(),k._ignoreWhileAnimating=null)),(n===b&&!b.animated||n===t&&!n.animated)&&(ct=null),!p.dragoverBubble&&!e.rootEl&&n!==document&&(b.parentNode[ne]._isOutsideThisEl(e.target),!xt&&nt(e)),!p.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),V=!0}function Z(){de=ee(b),Ne=ee(b,p.draggable),re({sortable:N,name:"change",toEl:t,newIndex:de,newDraggableIndex:Ne,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),n=te(n,p.draggable,t,!0),fe("dragOver"),A.eventCanceled)return V;if(b.contains(e.target)||n.animated&&n.animatingX&&n.animatingY||N._ignoreWhileAnimating===n)return P(!1);if($e=!1,y&&!p.disabled&&(D?S||(u=K!==W):ie===this||(this.lastPutMode=qe.checkPull(this,y,b,e))&&v.checkPut(this,y,b,e))){if(F=this._getDirection(e,n)==="vertical",o=j(b),fe("dragOverValid"),A.eventCanceled)return V;if(u)return K=W,Ie(),this._hideClone(),fe("revert"),A.eventCanceled||(Fe?W.insertBefore(b,Fe):W.appendChild(b)),P(!0);var se=pt(t,p.draggable);if(!se||Zn(e,F,this)&&!se.animated){if(se===b)return P(!1);if(se&&t===e.target&&(n=se),n&&(l=j(n)),zt(W,t,b,o,n,l,e,!!n)!==!1)return Ie(),se&&se.nextSibling?t.insertBefore(b,se.nextSibling):t.appendChild(b),K=t,Z(),P(!0)}else if(se&&Qn(e,F,this)){var Ve=je(t,0,p,!0);if(Ve===b)return P(!1);if(n=Ve,l=j(n),zt(W,t,b,o,n,l,e,!1)!==!1)return Ie(),t.insertBefore(b,Ve),K=t,Z(),P(!0)}else if(n.parentNode===t){l=j(n);var Pe=0,rt,Dt=b.parentNode!==t,_e=!Kn(b.animated&&b.toRect||o,n.animated&&n.toRect||l,F),Ut=F?"top":"left",Xe=Mt(n,"top","top")||Mt(b,"top","top"),Tt=Xe?Xe.scrollTop:void 0;ct!==n&&(rt=l[Ut],wt=!1,Lt=!_e&&p.invertSwap||Dt),Pe=Jn(e,n,l,F,_e?1:p.swapThreshold,p.invertedSwapThreshold==null?p.swapThreshold:p.invertedSwapThreshold,Lt,ct===n);var Ge;if(Pe!==0){var at=ee(b);do at-=Pe,Ge=K.children[at];while(Ge&&(E(Ge,"display")==="none"||Ge===B))}if(Pe===0||Ge===n)return P(!1);ct=n,bt=Pe;var kt=n.nextElementSibling,We=!1;We=Pe===1;var Wt=zt(W,t,b,o,n,l,e,We);if(Wt!==!1)return(Wt===1||Wt===-1)&&(We=Wt===1),an=!0,setTimeout(Wn,30),Ie(),We&&!kt?t.appendChild(b):n.parentNode.insertBefore(b,We?kt:n),Xe&&Pt(Xe,0,Tt-Xe.scrollTop),K=b.parentNode,rt!==void 0&&!Lt&&(Ft=Math.abs(rt-j(n)[Ut])),Z(),P(!0)}if(t.contains(b))return P(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){x(document,"mousemove",this._onTouchMove),x(document,"touchmove",this._onTouchMove),x(document,"pointermove",this._onTouchMove),x(document,"dragover",nt),x(document,"mousemove",nt),x(document,"touchmove",nt)},_offUpEvents:function(){var e=this.el.ownerDocument;x(e,"mouseup",this._onDrop),x(e,"touchend",this._onDrop),x(e,"pointerup",this._onDrop),x(e,"pointercancel",this._onDrop),x(e,"touchcancel",this._onDrop),x(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;if(de=ee(b),Ne=ee(b,n.draggable),le("drop",this,{evt:e}),K=b&&b.parentNode,de=ee(b),Ne=ee(b,n.draggable),A.eventCanceled){this._nulling();return}Te=!1,Lt=!1,wt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ln(this.cloneId),ln(this._dragStartId),this.nativeDraggable&&(x(document,"drop",this),x(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),$&&E(document.body,"user-select",""),E(b,"transform",""),e&&(tt&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),B&&B.parentNode&&B.parentNode.removeChild(B),(W===K||ie&&ie.lastPutMode!=="clone")&&J&&J.parentNode&&J.parentNode.removeChild(J),b&&(this.nativeDraggable&&x(b,"dragend",this),on(b),b.style["will-change"]="",tt&&!Te&&U(b,ie?ie.options.ghostClass:this.options.ghostClass,!1),U(b,this.options.chosenClass,!1),re({sortable:this,name:"unchoose",toEl:K,newIndex:null,newDraggableIndex:null,originalEvent:e}),W!==K?(de>=0&&(re({rootEl:K,name:"add",toEl:K,fromEl:W,originalEvent:e}),re({sortable:this,name:"remove",toEl:K,originalEvent:e}),re({rootEl:K,name:"sort",toEl:K,fromEl:W,originalEvent:e}),re({sortable:this,name:"sort",toEl:K,originalEvent:e})),ie&&ie.save()):de!==He&&de>=0&&(re({sortable:this,name:"update",toEl:K,originalEvent:e}),re({sortable:this,name:"sort",toEl:K,originalEvent:e})),A.active&&((de==null||de===-1)&&(de=He,Ne=Je),re({sortable:this,name:"end",toEl:K,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){le("nulling",this),W=b=K=B=Fe=J=ce=Me=C=I=tt=de=Ne=He=Je=ct=bt=ie=qe=A.dragged=A.ghost=A.clone=A.active=null,qt.forEach(function(e){e.checked=!0}),qt.length=L=ve=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":b&&(this._onDragOver(e),Xn(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,n=this.el.children,o=0,l=n.length,u=this.options;o<l;o++)t=n[o],te(t,u.draggable,this.el,!1)&&e.push(t.getAttribute(u.dataIdAttr)||er(t));return e},sort:function(e,t){var n={},o=this.el;this.toArray().forEach(function(l,u){var p=o.children[u];te(p,this.options.draggable,o,!1)&&(n[l]=p)},this),t&&this.captureAnimationState(),e.forEach(function(l){n[l]&&(o.removeChild(n[l]),o.appendChild(n[l]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return te(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(t===void 0)return n[e];var o=Be.modifyOption(this,e,t);typeof o<"u"?n[e]=o:n[e]=t,e==="group"&&Tn(n)},destroy:function(){le("destroy",this);var e=this.el;e[ne]=null,x(e,"mousedown",this._onTapStart),x(e,"touchstart",this._onTapStart),x(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(x(e,"dragover",this),x(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),g.splice(g.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Me){if(le("hideClone",this),A.eventCanceled)return;E(J,"display","none"),this.options.removeCloneOnHide&&J.parentNode&&J.parentNode.removeChild(J),Me=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(Me){if(le("showClone",this),A.eventCanceled)return;b.parentNode==W&&!this.options.group.revertClone?W.insertBefore(J,b):Fe?W.insertBefore(J,Fe):W.appendChild(J),this.options.group.revertClone&&this.animate(b,J),E(J,"display",""),Me=!1}}};function Xn(r){r.dataTransfer&&(r.dataTransfer.dropEffect="move"),r.cancelable&&r.preventDefault()}function zt(r,e,t,n,o,l,u,p){var v,y=r[ne],D=y.options.onMove,S;return window.CustomEvent&&!z&&!ye?v=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(v=document.createEvent("Event"),v.initEvent("move",!0,!0)),v.to=e,v.from=r,v.dragged=t,v.draggedRect=n,v.related=o||e,v.relatedRect=l||j(e),v.willInsertAfter=p,v.originalEvent=u,r.dispatchEvent(v),D&&(S=D.call(y,v,u)),S}function on(r){r.draggable=!1}function Wn(){an=!1}function Qn(r,e,t){var n=j(je(t.el,0,t.options,!0)),o=vt(t.el,t.options,B),l=10;return e?r.clientX<o.left-l||r.clientY<n.top&&r.clientX<n.right:r.clientY<o.top-l||r.clientY<n.bottom&&r.clientX<n.left}function Zn(r,e,t){var n=j(pt(t.el,t.options.draggable)),o=vt(t.el,t.options,B),l=10;return e?r.clientX>o.right+l||r.clientY>n.bottom&&r.clientX>n.left:r.clientY>o.bottom+l||r.clientX>n.right&&r.clientY>n.top}function Jn(r,e,t,n,o,l,u,p){var v=n?r.clientY:r.clientX,y=n?t.height:t.width,D=n?t.top:t.left,S=n?t.bottom:t.right,k=!1;if(!u){if(p&&Ft<y*o){if(!wt&&(bt===1?v>D+y*l/2:v<S-y*l/2)&&(wt=!0),wt)k=!0;else if(bt===1?v<D+Ft:v>S-Ft)return-bt}else if(v>D+y*(1-o)/2&&v<S-y*(1-o)/2)return $n(e)}return k=k||u,k&&(v<D+y*l/2||v>S-y*l/2)?v>D+y/2?1:-1:0}function $n(r){return ee(b)<ee(r)?1:-1}function er(r){for(var e=r.tagName+r.className+r.src+r.href+r.textContent,t=e.length,n=0;t--;)n+=e.charCodeAt(t);return n.toString(36)}function tr(r){qt.length=0;for(var e=r.getElementsByTagName("input"),t=e.length;t--;){var n=e[t];n.checked&&qt.push(n)}}function jt(r){return setTimeout(r,0)}function ln(r){return clearTimeout(r)}Vt&&O(document,"touchmove",function(r){(A.active||Te)&&r.cancelable&&r.preventDefault()}),A.utils={on:O,off:x,css:E,find:Bt,is:function(e,t){return!!te(e,t,e,!1)},extend:lt,throttle:Qe,closest:te,toggleClass:U,clone:Ze,index:ee,nextTick:jt,cancelNextTick:ln,detectDirection:Un,getChild:je,expando:ne},A.get=function(r){return r[ne]},A.mount=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];e[0].constructor===Array&&(e=e[0]),e.forEach(function(n){if(!n.prototype||!n.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(n));n.utils&&(A.utils=i(i({},A.utils),n.utils)),Be.mount(n)})},A.create=function(r,e){return new A(r,e)},A.version=Ce;var ae=[],_t,sn,un=!1,cn,dn,Kt,Ct;function nr(){function r(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return r.prototype={dragStarted:function(t){var n=t.originalEvent;this.sortable.nativeDraggable?O(document,"dragover",this._handleAutoScroll):this.options.supportPointer?O(document,"pointermove",this._handleFallbackAutoScroll):n.touches?O(document,"touchmove",this._handleFallbackAutoScroll):O(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var n=t.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?x(document,"dragover",this._handleAutoScroll):(x(document,"pointermove",this._handleFallbackAutoScroll),x(document,"touchmove",this._handleFallbackAutoScroll),x(document,"mousemove",this._handleFallbackAutoScroll)),On(),Ht(),nn()},nulling:function(){Kt=sn=_t=un=Ct=cn=dn=null,ae.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,n){var o=this,l=(t.touches?t.touches[0]:t).clientX,u=(t.touches?t.touches[0]:t).clientY,p=document.elementFromPoint(l,u);if(Kt=t,n||this.options.forceAutoScrollFallback||ye||z||$){fn(t,this.options,p,n);var v=be(p,!0);un&&(!Ct||l!==cn||u!==dn)&&(Ct&&On(),Ct=setInterval(function(){var y=be(document.elementFromPoint(l,u),!0);y!==v&&(v=y,Ht()),fn(t,o.options,y,n)},10),cn=l,dn=u)}else{if(!this.options.bubbleScroll||be(p,!0)===Se()){Ht();return}fn(t,this.options,be(p,!1),!1)}}},h(r,{pluginName:"scroll",initializeByDefault:!0})}function Ht(){ae.forEach(function(r){clearInterval(r.pid)}),ae=[]}function On(){clearInterval(Ct)}var fn=Qe(function(r,e,t,n){if(e.scroll){var o=(r.touches?r.touches[0]:r).clientX,l=(r.touches?r.touches[0]:r).clientY,u=e.scrollSensitivity,p=e.scrollSpeed,v=Se(),y=!1,D;sn!==t&&(sn=t,Ht(),_t=e.scroll,D=e.scrollFn,_t===!0&&(_t=be(t,!0)));var S=0,k=_t;do{var F=k,N=j(F),V=N.top,fe=N.bottom,Ie=N.left,P=N.right,Z=N.width,se=N.height,Ve=void 0,Pe=void 0,rt=F.scrollWidth,Dt=F.scrollHeight,_e=E(F),Ut=F.scrollLeft,Xe=F.scrollTop;F===v?(Ve=Z<rt&&(_e.overflowX==="auto"||_e.overflowX==="scroll"||_e.overflowX==="visible"),Pe=se<Dt&&(_e.overflowY==="auto"||_e.overflowY==="scroll"||_e.overflowY==="visible")):(Ve=Z<rt&&(_e.overflowX==="auto"||_e.overflowX==="scroll"),Pe=se<Dt&&(_e.overflowY==="auto"||_e.overflowY==="scroll"));var Tt=Ve&&(Math.abs(P-o)<=u&&Ut+Z<rt)-(Math.abs(Ie-o)<=u&&!!Ut),Ge=Pe&&(Math.abs(fe-l)<=u&&Xe+se<Dt)-(Math.abs(V-l)<=u&&!!Xe);if(!ae[S])for(var at=0;at<=S;at++)ae[at]||(ae[at]={});(ae[S].vx!=Tt||ae[S].vy!=Ge||ae[S].el!==F)&&(ae[S].el=F,ae[S].vx=Tt,ae[S].vy=Ge,clearInterval(ae[S].pid),(Tt!=0||Ge!=0)&&(y=!0,ae[S].pid=setInterval((function(){n&&this.layer===0&&A.active._onTouchMove(Kt);var kt=ae[this.layer].vy?ae[this.layer].vy*p:0,We=ae[this.layer].vx?ae[this.layer].vx*p:0;typeof D=="function"&&D.call(A.dragged.parentNode[ne],We,kt,r,Kt,ae[this.layer].el)!=="continue"||Pt(ae[this.layer].el,We,kt)}).bind({layer:S}),24))),S++}while(e.bubbleScroll&&k!==v&&(k=be(k,!1)));un=y}},30),An=function(e){var t=e.originalEvent,n=e.putSortable,o=e.dragEl,l=e.activeSortable,u=e.dispatchSortableEvent,p=e.hideGhostForTarget,v=e.unhideGhostForTarget;if(t){var y=n||l;p();var D=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,S=document.elementFromPoint(D.clientX,D.clientY);v(),y&&!y.el.contains(S)&&(u("spill"),this.onSpill({dragEl:o,putSortable:n}))}};function hn(){}hn.prototype={startIndex:null,dragStart:function(e){this.startIndex=e.oldDraggableIndex},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var o=je(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(t,o):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:An},h(hn,{pluginName:"revertOnSpill"});function pn(){}pn.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:An},h(pn,{pluginName:"removeOnSpill"});var Ee;function rr(){function r(){this.defaults={swapClass:"sortable-swap-highlight"}}return r.prototype={dragStart:function(t){Ee=t.dragEl},dragOverValid:function(t){var n=t.completed,o=t.target,l=t.onMove,u=t.activeSortable,p=t.changed,v=t.cancel;if(u.options.swap){var y=this.sortable.el,D=this.options;if(o&&o!==y){var S=Ee;l(o)!==!1?(U(o,D.swapClass,!0),Ee=o):Ee=null,S&&S!==Ee&&U(S,D.swapClass,!1)}p(),n(!0),v()}},drop:function(t){var n=t.activeSortable,o=t.putSortable,l=t.dragEl,u=o||this.sortable,p=this.options;Ee&&U(Ee,p.swapClass,!1),Ee&&(p.swap||o&&o.options.swap)&&l!==Ee&&(u.captureAnimationState(),u!==n&&n.captureAnimationState(),ar(l,Ee),u.animateAll(),u!==n&&n.animateAll())},nulling:function(){Ee=null}},h(r,{pluginName:"swap",eventProperties:function(){return{swapItem:Ee}}})}function ar(r,e){var t=r.parentNode,n=e.parentNode,o,l;!t||!n||t.isEqualNode(e)||n.isEqualNode(r)||(o=ee(r),l=ee(e),t.isEqualNode(n)&&o<l&&l++,t.insertBefore(e,t.children[o]),n.insertBefore(r,n.children[l]))}var M=[],we=[],St,ke,Et=!1,me=!1,dt=!1,Q,It,Yt;function or(){function r(e){for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this));e.options.avoidImplicitDeselect||(e.options.supportPointer?O(document,"pointerup",this._deselectMultiDrag):(O(document,"mouseup",this._deselectMultiDrag),O(document,"touchend",this._deselectMultiDrag))),O(document,"keydown",this._checkKeyDown),O(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:!1,setData:function(o,l){var u="";M.length&&ke===e?M.forEach(function(p,v){u+=(v?", ":"")+p.textContent}):u=l.textContent,o.setData("Text",u)}}}return r.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal:function(t){Q=t.dragEl},delayEnded:function(){this.isMultiDrag=~M.indexOf(Q)},setupClone:function(t){var n=t.sortable,o=t.cancel;if(this.isMultiDrag){for(var l=0;l<M.length;l++)we.push(Ze(M[l])),we[l].sortableIndex=M[l].sortableIndex,we[l].draggable=!1,we[l].style["will-change"]="",U(we[l],this.options.selectedClass,!1),M[l]===Q&&U(we[l],this.options.chosenClass,!1);n._hideClone(),o()}},clone:function(t){var n=t.sortable,o=t.rootEl,l=t.dispatchSortableEvent,u=t.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||M.length&&ke===n&&(Bn(!0,o),l("clone"),u()))},showClone:function(t){var n=t.cloneNowShown,o=t.rootEl,l=t.cancel;this.isMultiDrag&&(Bn(!1,o),we.forEach(function(u){E(u,"display","")}),n(),Yt=!1,l())},hideClone:function(t){var n=this;t.sortable;var o=t.cloneNowHidden,l=t.cancel;this.isMultiDrag&&(we.forEach(function(u){E(u,"display","none"),n.options.removeCloneOnHide&&u.parentNode&&u.parentNode.removeChild(u)}),o(),Yt=!0,l())},dragStartGlobal:function(t){t.sortable,!this.isMultiDrag&&ke&&ke.multiDrag._deselectMultiDrag(),M.forEach(function(n){n.sortableIndex=ee(n)}),M=M.sort(function(n,o){return n.sortableIndex-o.sortableIndex}),dt=!0},dragStarted:function(t){var n=this,o=t.sortable;if(this.isMultiDrag){if(this.options.sort&&(o.captureAnimationState(),this.options.animation)){M.forEach(function(u){u!==Q&&E(u,"position","absolute")});var l=j(Q,!1,!0,!0);M.forEach(function(u){u!==Q&>(u,l)}),me=!0,Et=!0}o.animateAll(function(){me=!1,Et=!1,n.options.animation&&M.forEach(function(u){st(u)}),n.options.sort&&Xt()})}},dragOver:function(t){var n=t.target,o=t.completed,l=t.cancel;me&&~M.indexOf(n)&&(o(!1),l())},revert:function(t){var n=t.fromSortable,o=t.rootEl,l=t.sortable,u=t.dragRect;M.length>1&&(M.forEach(function(p){l.addAnimationState({target:p,rect:me?j(p):u}),st(p),p.fromRect=u,n.removeAnimationState(p)}),me=!1,ir(!this.options.removeCloneOnHide,o))},dragOverCompleted:function(t){var n=t.sortable,o=t.isOwner,l=t.insertion,u=t.activeSortable,p=t.parentEl,v=t.putSortable,y=this.options;if(l){if(o&&u._hideClone(),Et=!1,y.animation&&M.length>1&&(me||!o&&!u.options.sort&&!v)){var D=j(Q,!1,!0,!0);M.forEach(function(k){k!==Q&&(gt(k,D),p.appendChild(k))}),me=!0}if(!o)if(me||Xt(),M.length>1){var S=Yt;u._showClone(n),u.options.animation&&!Yt&&S&&we.forEach(function(k){u.addAnimationState({target:k,rect:It}),k.fromRect=It,k.thisAnimationDuration=null})}else u._showClone(n)}},dragOverAnimationCapture:function(t){var n=t.dragRect,o=t.isOwner,l=t.activeSortable;if(M.forEach(function(p){p.thisAnimationDuration=null}),l.options.animation&&!o&&l.multiDrag.isMultiDrag){It=h({},n);var u=De(Q,!0);It.top-=u.f,It.left-=u.e}},dragOverAnimationComplete:function(){me&&(me=!1,Xt())},drop:function(t){var n=t.originalEvent,o=t.rootEl,l=t.parentEl,u=t.sortable,p=t.dispatchSortableEvent,v=t.oldIndex,y=t.putSortable,D=y||this.sortable;if(n){var S=this.options,k=l.children;if(!dt)if(S.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),U(Q,S.selectedClass,!~M.indexOf(Q)),~M.indexOf(Q))M.splice(M.indexOf(Q),1),St=null,Le({sortable:u,rootEl:o,name:"deselect",targetEl:Q,originalEvent:n});else{if(M.push(Q),Le({sortable:u,rootEl:o,name:"select",targetEl:Q,originalEvent:n}),n.shiftKey&&St&&u.el.contains(St)){var F=ee(St),N=ee(Q);~F&&~N&&F!==N&&(function(){var P,Z;N>F?(Z=F,P=N):(Z=N,P=F+1);for(var se=S.filter;Z<P;Z++)~M.indexOf(k[Z])||te(k[Z],S.draggable,l,!1)&&(se&&(typeof se=="function"?se.call(u,n,k[Z],u):se.split(",").some(function(Ve){return te(k[Z],Ve.trim(),l,!1)}))||(U(k[Z],S.selectedClass,!0),M.push(k[Z]),Le({sortable:u,rootEl:o,name:"select",targetEl:k[Z],originalEvent:n})))})()}else St=Q;ke=D}if(dt&&this.isMultiDrag){if(me=!1,(l[ne].options.sort||l!==o)&&M.length>1){var V=j(Q),fe=ee(Q,":not(."+this.options.selectedClass+")");if(!Et&&S.animation&&(Q.thisAnimationDuration=null),D.captureAnimationState(),!Et&&(S.animation&&(Q.fromRect=V,M.forEach(function(P){if(P.thisAnimationDuration=null,P!==Q){var Z=me?j(P):V;P.fromRect=Z,D.addAnimationState({target:P,rect:Z})}})),Xt(),M.forEach(function(P){k[fe]?l.insertBefore(P,k[fe]):l.appendChild(P),fe++}),v===ee(Q))){var Ie=!1;M.forEach(function(P){if(P.sortableIndex!==ee(P)){Ie=!0;return}}),Ie&&(p("update"),p("sort"))}M.forEach(function(P){st(P)}),D.animateAll()}ke=D}(o===l||y&&y.lastPutMode!=="clone")&&we.forEach(function(P){P.parentNode&&P.parentNode.removeChild(P)})}},nullingGlobal:function(){this.isMultiDrag=dt=!1,we.length=0},destroyGlobal:function(){this._deselectMultiDrag(),x(document,"pointerup",this._deselectMultiDrag),x(document,"mouseup",this._deselectMultiDrag),x(document,"touchend",this._deselectMultiDrag),x(document,"keydown",this._checkKeyDown),x(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(t){if(!(typeof dt<"u"&&dt)&&ke===this.sortable&&!(t&&te(t.target,this.options.draggable,this.sortable.el,!1))&&!(t&&t.button!==0))for(;M.length;){var n=M[0];U(n,this.options.selectedClass,!1),M.shift(),Le({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:n,originalEvent:t})}},_checkKeyDown:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},h(r,{pluginName:"multiDrag",utils:{select:function(t){var n=t.parentNode[ne];!n||!n.options.multiDrag||~M.indexOf(t)||(ke&&ke!==n&&(ke.multiDrag._deselectMultiDrag(),ke=n),U(t,n.options.selectedClass,!0),M.push(t))},deselect:function(t){var n=t.parentNode[ne],o=M.indexOf(t);!n||!n.options.multiDrag||!~o||(U(t,n.options.selectedClass,!1),M.splice(o,1))}},eventProperties:function(){var t=this,n=[],o=[];return M.forEach(function(l){n.push({multiDragElement:l,index:l.sortableIndex});var u;me&&l!==Q?u=-1:me?u=ee(l,":not(."+t.options.selectedClass+")"):u=ee(l),o.push({multiDragElement:l,index:u})}),{items:R(M),clones:[].concat(we),oldIndicies:n,newIndicies:o}},optionListeners:{multiDragKey:function(t){return t=t.toLowerCase(),t==="ctrl"?t="Control":t.length>1&&(t=t.charAt(0).toUpperCase()+t.substr(1)),t}}})}function ir(r,e){M.forEach(function(t,n){var o=e.children[t.sortableIndex+(r?Number(n):0)];o?e.insertBefore(t,o):e.appendChild(t)})}function Bn(r,e){we.forEach(function(t,n){var o=e.children[t.sortableIndex+(r?Number(n):0)];o?e.insertBefore(t,o):e.appendChild(t)})}function Xt(){M.forEach(function(r){r!==Q&&r.parentNode&&r.parentNode.removeChild(r)})}return A.mount(new nr),A.mount(pn,hn),A.mount(new rr),A.mount(new or),A}))}))()),ft="bk_username",xe={USER:"user",VIRTUAL:"virtual",CUSTOM:"custom",USER_GROUP:"userGroup"},yr=Symbol("bkUserSelectorApiConfig"),br=/^[A-Za-z0-9_-]{1,64}$/,gn={apiBaseUrl:"",tenantId:"",allowedApiOrigins:[],allowPrivateApiHost:!1,allowCrossOriginCredentials:!1},Ln=()=>typeof window>"u"||!window.location?.origin?"http://localhost":window.location.origin,wr=d=>{const f=d.split(".").map(Number);if(f.length!==4||f.some(Number.isNaN))return!1;const[c,i]=f;return c===10||c===127||c===172&&i>=16&&i<=31||c===192&&i===168||c===169&&i===254||c===100&&i>=64&&i<=127},_r=d=>{const f=d.toLowerCase();return!!(f==="localhost"||f==="[::1]"||f==="::1"||wr(f)||f.startsWith("fc")||f.startsWith("fd"))},Fn=(d=[])=>{const f=Ln();return Array.from(new Set(d.map(c=>{try{const i=new URL(c,f);return["http:","https:"].includes(i.protocol)?i.origin:""}catch{return""}}).filter(Boolean)))},qn=(d,f=[],c=!1)=>{if(!d)return"";try{const i=new URL(d,Ln());if(!["http:","https:"].includes(i.protocol))return console.warn("[bk-user-selector] apiBaseUrl 仅支持 http/https 协议"),"";if(!c&&_r(i.hostname))return console.warn("[bk-user-selector] apiBaseUrl 指向私网或 localhost,已被安全策略拦截"),"";const s=Fn(f);if(s.length>0&&!s.includes(i.origin))return console.warn("[bk-user-selector] apiBaseUrl 未命中 allowedApiOrigins 白名单,已被安全策略拦截"),"";const m=i.pathname.replace(/\/+$/,"");return`${i.origin}${m}`}catch{return console.warn("[bk-user-selector] apiBaseUrl 格式非法,已被安全策略拦截"),""}},Vn=d=>{const f=String(d||"").trim();return f?br.test(f)?f:(console.warn("[bk-user-selector] tenantId 格式非法,已被安全策略拦截"),""):""},Cr=()=>gn,Sr=(d,f,c=[],i=!1,s=!1,m={})=>{const h=Fn(c);gn={apiBaseUrl:qn(d,h,i),tenantId:Vn(f),allowedApiOrigins:h,allowPrivateApiHost:i,allowCrossOriginCredentials:s,onError:m.onError,onUnauthorized:m.onUnauthorized},a.provide(yr,gn)},Er=()=>`__jsonp_callback_${Date.now()}_${Math.random().toString(36).slice(2,9)}`,Ir=(d,f={})=>new Promise((c,i)=>{const s=a.unref(d),{timeout:m=1e3*60*2,params:h}=f,_=Er(),w=document.createElement("script");let R=null;w.setAttribute("type","text/javascript");const G=()=>{R&&clearTimeout(R),w.parentNode&&w.parentNode.removeChild(w),window[_]&&delete window[_]};window[_]=H=>{G(),c(H.data||H)},R=setTimeout(()=>{G(),i(new Error(`JSONP request timeout: ${s}`))},m),w.onerror=()=>{G(),i(new Error(`JSONP request failed: ${s}`))},w.src=`${s}${s.includes("?")?"&":"?"}callback=${_}${h?`&${Object.entries(h).map(([H,he])=>he?`${H}=${he}`:"").filter(Boolean).join("&")}`:""}`,document.head.appendChild(w)}),Ot="[BkUserSelector]",Nn={debug:0,info:1,warn:2,error:3},Dr={level:"warn"},Qt=d=>Nn[d]>=Nn[Dr.level],vn={debug:(d,...f)=>{Qt("debug")&&console.debug(`${Ot} ${d}`,...f)},info:(d,...f)=>{Qt("info")&&console.info(`${Ot} ${d}`,...f)},warn:(d,...f)=>{Qt("warn")&&console.warn(`${Ot} ${d}`,...f)},error:(d,f)=>{Qt("error")&&console.error(`${Ot} ${d}`,f)}},Pn=(d,f)=>{if(d)try{d(f)}catch(c){console.error(`${Ot} error handler threw:`,c)}},Ur=(d,f,c,i=!1)=>({scene:d,cause:f,status:c,isUnauthorized:i}),$t=(d,f,c,i,s=!1)=>{s?vn.warn(`${d}: 登录态已失效,请重新登录`):vn.error(`${d}失败:`,f);const m=Ur(d,f,i,s);s&&Pn(c?.onUnauthorized,m),Pn(c?.onError,m)},yn=(d,f)=>{vn.warn(`${d}需要提供有效的参数: ${f.join(", ")}`)},en=401,bn=(d,f)=>{if(typeof window>"u"||!window.location?.origin)return"same-origin";try{return new URL(d,window.location.origin).origin===window.location.origin||f?"include":"omit"}catch{return"same-origin"}},wn=(d,f)=>{const c=Cr(),i=c.allowPrivateApiHost,s=c.allowedApiOrigins;return{allowCrossOriginCredentials:c.allowCrossOriginCredentials,apiBaseUrl:qn(c.apiBaseUrl||d,s,i),tenantId:Vn(c.tenantId||f),apiConfig:c}},_n=(d,f,c)=>{if(!d.ok){if(d.status===en){const i=new Error(`${f}失败: 登录态已失效`);throw $t(f,i,c,d.status,!0),i}throw new Error(`${d.status} ${d.statusText}`)}},Cn=d=>{if(typeof d=="object"&&d!==null&&"status"in d){const f=d.status;return typeof f=="number"?f:void 0}if(d instanceof Error){const f=/^(\d{3})\s/.exec(d.message);if(f)return Number(f[1])}},Tr=async(d,f)=>{const c=wn(d,f);if(!c.apiBaseUrl||!c.tenantId)return yn("获取租户信息",["apiBaseUrl","tenantId"]),[];try{const i=`${c.apiBaseUrl}/api/v3/open-web/tenant/data-source-owner-tenants/`,s=bn(i,c.allowCrossOriginCredentials),m=await fetch(i,{method:"GET",headers:{"x-bk-tenant-id":c.tenantId},credentials:s});return _n(m,"获取租户信息",c.apiConfig),(await m.json()).data||[]}catch(i){const s=Cn(i);return s!==en&&$t("获取租户信息",i,c.apiConfig,s,!1),[]}},kr=async d=>{const{apiBaseUrl:f,tenantId:c,keyword:i,enableMultiTenantMode:s=!0}=d;if(!s)try{return await Gn(f,{keyword:i,pageSize:100,page:1})}catch{return[]}const m=wn(f,c);if(!i||!m.apiBaseUrl||!m.tenantId)return yn("搜索用户",["apiBaseUrl","tenantId","keyword"]),[];try{const h=`${m.apiBaseUrl}/api/v3/open-web/tenant/users/-/search/?keyword=${encodeURIComponent(i)}`,_=bn(h,m.allowCrossOriginCredentials),w=await fetch(h,{method:"GET",headers:{"x-bk-tenant-id":m.tenantId},credentials:_});return _n(w,"搜索用户",m.apiConfig),(await w.json()).data||[]}catch(h){const _=Cn(h);return _!==en&&$t("搜索用户",h,m.apiConfig,_,!1),[]}},Jt=async d=>{const{apiBaseUrl:f,tenantId:c,exactSearchKey:i="bk_username",usersList:s=[],enableMultiTenantMode:m=!0}=d,h=s.filter(Boolean).map(w=>typeof w=="string"?w.trim():String(w).trim());if(!m)try{const w=await Gn(f,{userIds:h});return h.map(R=>w.find(G=>G.username===R)).filter(Boolean)}catch{return[]}const _=wn(f,c);if(h.length===0||!_.apiBaseUrl||!_.tenantId)return yn("批量查找用户",["apiBaseUrl","tenantId","usersList"]),[];try{const w=`${_.apiBaseUrl}/api/v3/open-web/tenant/users/-/lookup/?lookups=${h.join(",")}&lookup_fields=${i}`,R=bn(w,_.allowCrossOriginCredentials),G=await fetch(w,{method:"GET",headers:{"x-bk-tenant-id":_.tenantId},credentials:R});return _n(G,"批量查找用户",_.apiConfig),(await G.json()).data||[]}catch(w){const R=Cn(w);return R!==en&&$t("批量查找用户",w,_.apiConfig,R,!1),[]}},At=(d,f=!0)=>!d||!Array.isArray(d)?[]:f?d.map(c=>({id:c.bk_username,name:c.display_name,type:c.data_source_type,tenantId:c.owner_tenant_id,...c})):d.map(c=>({...c,id:c.username,name:`${c.display_name}(${c.username})`,type:c.data_source_type,tenantId:c.owner_tenant_id})),Gn=async(d,f)=>{const{userIds:c,keyword:i,pageSize:s=20,page:m=1,appCode:h="bk-magicbox"}=f;return(await Ir(d,{params:{exact_lookups:c?.join(",")||void 0,fuzzy_lookups:i||void 0,page_size:Math.max(c?.length||0,20,Number(s)).toString(),page:m.toString(),app_code:h}}))?.results||[]},xr=d=>{const{apiBaseUrl:f,tenantId:c,currentUserId:i,exactSearchKey:s=ft,enableMultiTenantMode:m=!0}=d,h=a.ref(!1);return{loading:h,fetchCurrentUser:async()=>{if(!i)return null;h.value=!0;try{const w=At(await Jt({apiBaseUrl:f,tenantId:c,exactSearchKey:s,usersList:[i],enableMultiTenantMode:m}),m);return w.length>0?w[0]:null}catch(w){return console.error("获取当前用户信息失败:",w),null}finally{h.value=!1}}}};function Zt(d){for(var f=1;f<arguments.length;f++){var c=arguments[f];for(var i in c)d[i]=c[i]}return d}var Or={read:function(d){return d[0]==='"'&&(d=d.slice(1,-1)),d.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(d){return encodeURIComponent(d).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function mn(d,f){function c(s,m,h){if(!(typeof document>"u")){h=Zt({},f,h),typeof h.expires=="number"&&(h.expires=new Date(Date.now()+h.expires*864e5)),h.expires&&(h.expires=h.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var _="";for(var w in h)h[w]&&(_+="; "+w,h[w]!==!0&&(_+="="+h[w].split(";")[0]));return document.cookie=s+"="+d.write(m,s)+_}}function i(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var m=document.cookie?document.cookie.split("; "):[],h={},_=0;_<m.length;_++){var w=m[_].split("="),R=w.slice(1).join("=");try{var G=decodeURIComponent(w[0]);if(h[G]=d.read(R,G),s===G)break}catch{}}return s?h[s]:h}}return Object.create({set:c,get:i,remove:function(s,m){c(s,"",Zt({},m,{expires:-1}))},withAttributes:function(s){return mn(this.converter,Zt({},this.attributes,s))},withConverter:function(s){return mn(Zt({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(f)},converter:{value:Object.freeze(d)}})}var Ar=mn(Or,{path:"/"}),Br={我:"Me",请输入人员名称搜索:"Please enter the name of the user to search",最近选择:"Recent selections",用户群组:"User Group",无匹配人员:"No matching users",虚拟账号:"Virtual Account",用户:"User"},Mr={我:"我",请输入人员名称搜索:"请输入人员名称搜索",最近选择:"最近选择",用户群组:"用户群组",无匹配人员:"无匹配人员",虚拟账号:"虚拟账号",用户:"用户"},Nr="blueking_language",Pr={"en-US":Br,"zh-CN":Mr},Rr=(d,f,c)=>{const i=/^\w/.test(f)?f.split("."):[f],{length:s}=i;let m=d,h=0;for(;h<=s&&m;)if(typeof m=="string"||(c?(m=m[i[h]],typeof m=="string"&&Object.keys(c).forEach(_=>{m=m.replace(`{${_}}`,c[_])})):m=m[i[h]],h=h+1,!m))return m;return m},Sn=()=>{let d="zh-CN";const f=Ar.get(Nr);f&&f.toLowerCase()==="en"&&(d="en-US");const c=Pr[d];return{local:d,t:(s,m)=>{const h=Rr(c,s,m);return h===void 0&&console.warn(`缺少索引 * ${s} *`),h}}},Lr=d=>{const{apiBaseUrl:f,tenantId:c,searchQuery:i,selectedUsers:s,allowCreate:m=!1,freePaste:h=!1,enableMultiTenantMode:_=!0,maxCount:w=0,onAddUser:R,onBatchAddUsers:G}=d,H=a.ref(!1),he=100,Oe=100,Ae=$=>({id:$,name:$,type:xe.CUSTOM,tenantId:"",login_name:$}),Ce=$=>{const X=$.split(/[,,;\n\s]+/).filter(Boolean).map(T=>T.trim().replace(/\s*\(.*?\)\s*/,"")).filter(Boolean);return Array.from(new Set(X)).slice(0,he)},q=($,X)=>{const T=[];for(let oe=0;oe<$.length;oe+=X)T.push($.slice(oe,oe+X));return T},z=($,X)=>{const T=new Map;for(const oe of[...$,...X])T.has(oe.id)||T.set(oe.id,oe);return Array.from(T.values())};return{isPasting:H,parsePastedText:Ce,handleEnterCreate:$=>{if($.key!=="Enter"||!m||!i.value.trim())return;const X=Ae(i.value.trim());s.value.some(T=>T.id===X.id)||R(X)},handlePaste:async $=>{$.preventDefault();const X=$.clipboardData?.getData("text")?.trim();if(X){H.value=!0;try{const T=Ce(X);if(T.length===0)return;const oe=q(T,Oe),O=[];for(const Y of oe){const pe=await Jt({apiBaseUrl:f,tenantId:c,exactSearchKey:"login_name",usersList:Y,enableMultiTenantMode:_});O.push(...pe)}const x=At(O,_);if(G){let Y=z(s.value,x);if(h)for(const pe of T)Y.some(te=>te.login_name===pe||te.id===pe)||Y.push(Ae(pe));w>0&&Y.length>w&&(Y=Y.slice(0,w)),G(Y)}else x.length>0?R(x[0]):h&&T.length>0&&R(Ae(T[0]))}catch(T){console.error("精准查找用户失败:",T)}finally{H.value=!1}}}}},Fr=(d,f,c={})=>{const{immediate:i=!0}=c;let s=null;const m=()=>{s&&(s.disconnect(),s=null)},h=()=>{if(m(),!!d.value&&(s=new ResizeObserver(_=>{for(const w of _)f(w)}),s.observe(d.value),i&&d.value)){const _=d.value.getBoundingClientRect();f({target:d.value,contentRect:_,borderBoxSize:[{blockSize:_.height,inlineSize:_.width}],contentBoxSize:[{blockSize:_.height,inlineSize:_.width}],devicePixelContentBoxSize:[{blockSize:_.height,inlineSize:_.width}]})}};return a.watch(d,h,{immediate:!0}),a.onUnmounted(m),m},qr=(d,f,c=!0)=>{const i=a.ref({}),s=a.ref(!1),m=async()=>{if(!d||!f){console.warn("获取租户需要提供有效的API基础URL和租户ID");return}s.value=!0;try{const h=await Tr(d,f),_={};h.forEach(w=>{w.id&&w.name&&(_[w.id]=w.name)}),i.value=_}catch(h){console.error("获取租户数据失败:",h)}finally{s.value=!1}};return a.onBeforeMount(()=>{c&&m()}),{tenants:i,loading:s,fetchTenants:m}},Vr=(d,f)=>{let c=null;return function(...i){c&&clearTimeout(c),c=window.setTimeout(()=>{d(...i),c=null},f)}},Gr=(d,f,c)=>{if(!d||!f.length)return 0;let i=0,s=0;for(const m of Array.from(f)){const h=m;if(!h)continue;const _=window.getComputedStyle(h),w=h.offsetWidth,R=parseInt(_.marginLeft,10)||0,G=parseInt(_.marginRight,10)||0;if(i+=w+R+G,i>c)break;s++}return Math.max(1,s)},zr=(d,f,c=!0)=>{const i=a.ref([]),s=a.ref(!1),m=a.ref(""),h=async G=>{if(!G?.length){i.value=[],s.value=!1;return}if(c&&(!d||!f)){console.warn("执行用户搜索需要提供有效的API基础URL和租户ID"),s.value=!1;return}s.value=!0;try{i.value=At(await kr({apiBaseUrl:d,tenantId:f,keyword:G,enableMultiTenantMode:c}),c)}catch(H){console.error("用户搜索失败:",H),i.value=[]}finally{s.value=!1}},_=Vr(h,300);return{searchResults:i,loading:s,searchQuery:m,performSearch:h,handleSearchInput:G=>{s.value=!0,m.value=G.trim(),_(m.value)},clearSearch:()=>{m.value="",i.value=[],s.value=!1}}},jr=d=>{const{selectedUserIds:f,excludeUserIds:c,userGroup:i,searchQuery:s}=d,m=w=>({id:w,name:w,type:xe.CUSTOM,tenantId:"",login_name:w}),h=w=>f.value.includes(w);return{createCustomUser:m,isUserSelected:h,filterOptions:w=>w.filter(R=>!h(R.id)).filter(R=>!c?.value?.includes(R.id)),filteredUserGroup:a.computed(()=>i?.value?.length?i.value.filter(w=>{if(!(!h(w.id)&&!w.hidden))return!1;const R=s.value.trim();return R?w.id?.includes(R)||w.name?.includes(R):!0}):[])}},Kr=a.defineComponent({name:"MeTag",__name:"me-tag",props:{currentUserId:{type:String,required:!1,default:""},isDisabled:{type:Boolean,required:!1,default:!1}},emits:["click"],setup(d,{expose:f,emit:c}){f();const{t:i}=Sn(),s=d,m=c,_={t:i,props:s,emit:m,handleClick:()=>{s.isDisabled||m("click")}};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),tn=(d,f)=>{const c=d.__vccOpts||d;for(const[i,s]of f)c[i]=s;return c};function Hr(d,f,c,i,s,m){return c.currentUserId?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["me-tag",{disabled:c.isDisabled}]),onClick:a.withModifiers(i.handleClick,["stop"])},a.toDisplayString(i.t("我")),3)):a.createCommentVNode("v-if",!0)}var Yr=tn(Kr,[["render",Hr],["__scopeId","data-v-a1054364"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/me-tag.vue"]]),Xr="data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20style='fill:%20%23A3C5FD;'%3e%3cpath%20fill-rule='evenodd'%20d='M405.7858816%20162.66256256C416.4461344%20160.6535248%20439.8986944%20159.44810208%20457.3815104%20160.25171712%20484.2453504%20161.05533248%20494.052784%20163.4661776%20516.226112%20174.7167888%20567.8217376%20200.43247136%20597.670448%20242.22045568%20606.6250624%20301.28616416%20617.711728%20374.415136%20593.4063488%20443.5260352%20535.8409792%20500.180896%20509.8299584%20525.8965792%20505.565856%20537.5489984%20514.0940608%20557.237568%20521.3430336%20572.9080608%20546.0748224%20586.5695168%20629.2248%20620.3213504%20691.054272%20645.2334208%20760.985536%20687.4232096%20767.8080992%20703.8973216%20774.6306624%20720.3714304%20784.8645056%20752.114224%20791.6870688%20777.4280992%20799.7888608%20807.1618592%20793.3927072%20818.8142784%20761.8383584%20832.4757344%20720.4765728%20850.155264%20669.3073536%20857.3878016%20546.9276416%20862.2094912%20392.9935776%20868.2366048%20227.12002944%20858.5932224%20162.30568672%20840.1100768%20134.5890272%20832.4757344%20108.15159776%20815.1980096%20100.47621504%20799.5275136%2093.6536528%20786.2678656%2094.08006304%20784.2588288%20105.59313696%20746.4889184%20116.67980096%20709.924432%20119.23826176%20705.5045504%20141.41158944%20685.4141728%20143.84821888%20683.2001312%20146.05397248%20681.2036448%20148.2232096%20679.3252416L152.13038144%20676.0501632C159.5946992%20670.0236288%20167.98497088%20664.6722176%20184.94031712%20656.0863296L191.29263904%20652.915344C215.97973152%20640.7492736%20256.51622304%20622.3959904%20329.458464%20589.3821696%20359.7335872%20575.3189056%20371.2466592%20563.6664896%20375.084352%20542.772496%20377.2164032%20530.316464%20374.6579424%20526.7001952%20345.2356416%20496.9664352%20295.34565344%20446.338688%20274.02514592%20396.9163584%20273.59873568%20331.0199232%20273.59873568%20291.24097568%20282.12693888%20265.52529312%20307.71154784%20228.15719168%20332.8697472%20191.19089792%20365.703328%20169.49329056%20405.7858816%20162.66256256ZM668.7713728%20226.60405184C756.683056%20211.50282816%20820.4190272%20263.09867616%20827.0124032%20354.9644544%20831.8475456%20416.6277856%20815.1443264%20461.931456%20770.3093664%20510.1714752%20752.287472%20529.4674848%20747.891888%20536.5986176%20748.3314464%20548.344016%20748.7710048%20555.8946272%20751.4083552%20565.123152%20754.485264%20568.8984576%20757.5621728%20572.2542848%20788.331264%20588.1944672%20823.0563776%20604.1346464%20944.3745024%20659.92528%20966.791984%20682.996592%20958.4403712%20744.6599232%20954.923904%20771.9260224%20956.6821376%20771.0870656%20890.308816%20787.0272448%20867.4517792%20792.8999456%20845.0343008%20798.3531648%20841.0782752%20799.6116%20835.3640128%20801.2895136%20833.1662208%20797.9336864%20830.5288704%20781.5740256%20824.3750528%20739.6261824%20812.0674176%20710.6821696%20790.0894976%20687.6108576%20752.287472%20647.3409248%20703.9360448%20619.6553504%20624.3759712%20593.6476864%20597.5629088%20584.4191616%20560.64%20550.8608864%20560.64%20534.920704%20560.64%20527.7895712%20569.8707264%20514.7857408%20589.6508544%20494.6507744%20620.859504%20461.931456%20639.7605152%20429.631616%20648.5516832%20394.8149056%20655.5846208%20366.7098496%20652.0681504%20283.23364096%20642.837424%20254.7091072%20635.3649312%20231.63779328%20634.4858144%20232.47675008%20668.7713728%20226.60405184Z'%3e%3c/path%3e%3c/svg%3e",Wr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='32px'%20height='32px'%20viewBox='0%200%2032%2032'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eIcon/用户%3c/title%3e%3cg%20id='Icon/用户'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='user-(1)'%20transform='translate(3,%202)'%20fill='%23A3C5FD'%20fill-rule='nonzero'%3e%3cpath%20d='M13.0077612,27.9989067%20C10.3002732,27.9989067%207.59285518,28.0018792%204.88515705,27.997455%20C3.95018807,27.9959342%203.05044678,27.8282323%202.22816433,27.3628696%20C0.998627601,26.6672451%200.29953695,25.6114692%200.0864200465,24.2387462%20C-0.0656962495,23.259079%200.0147040645,22.4675755%200.0874005263,21.4879775%20C0.187970957,20.13461%200.423078914,19.3321844%200.863249688,18.0430358%20C1.22365046,16.9873982%201.73014453,16.0067633%202.49702917,15.175719%20C3.42254341,14.1726178%204.6014447,13.7297906%205.9255989,13.6440041%20C6.33292322,13.6073668%206.66741099,13.712025%206.9979768,13.9263185%20C7.58886318,14.3094892%208.17393665,14.7060014%208.79220674,15.0421658%20C10.1097776,15.758321%2011.5447274,16.1099698%2013.0616182,16.0930337%20C14.6806203,16.0750607%2016.2142496,15.63963%2017.592821,14.8169502%20C18.0555431,14.5407189%2018.5150436,14.256538%2018.9569652,13.9491996%20C19.3610679,13.6681294%2019.7808585,13.5749462%2020.274326,13.6337733%20C21.462472,13.7340074%2022.3872158,14.1103345%2023.2340106,14.8851094%20C23.902636,15.496952%2024.3685096,16.2520257%2024.7518119,17.0611566%20C25.272453,18.1598604%2025.5462904,18.7976948%2025.7441396,19.9861253%20C25.9499728,21.2233595%2026.0256808,22.2792045%2025.9924842,23.5308171%20C25.9627193,24.6543374%2025.6405577,25.6840525%2024.8535729,26.5307194%20C24.1686994,27.2671979%2023.3129402,27.7090574%2022.3211027,27.8808379%20C21.9232331,27.9495501%2021.5154185,27.9922014%2021.1120162,27.9935148%20C18.4104811,28.0036073%2015.7090862,27.9989067%2013.0077612,27.9989067%20L13.0077612,27.9989067%20Z%20M5.91775495,6.98479749%20C5.84814002,3.25685016%209.08684454,-0.00255470186%2013.0162355,1.5025268e-06%20C16.9117994,0.00256071584%2020.1304739,3.23452217%2020.1095656,7.04113598%20C20.0884528,10.8082092%2016.8998935,14.015354%2013.0058002,14.0149393%20C9.10134181,14.0145245%205.83322254,10.7695672%205.91775495,6.98479749%20Z'%20id='形状'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Qr="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='32px'%20height='32px'%20viewBox='0%200%2032%2032'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eIcon/虚拟icon%3c/title%3e%3cg%20id='Icon/虚拟icon'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M27.4705882,3%20C28.315259,3%2029,3.68474098%2029,4.52941178%20L29,22.4623054%20C29,23.3069762%2028.315259,23.9917172%2027.4705882,23.9917172%20L20.5882353,23.9917172%20L20.5882353,27.0244081%20L24.0294118,27.0244081%20C24.2405794,27.0244081%2024.4117647,27.1955933%2024.4117647,27.406761%20L24.4117647,28.617647%20C24.4117647,28.8288148%2024.2405795,29%2024.0294118,29%20L7.97058824,29%20C7.75942054,29%207.58823529,28.8288148%207.58823529,28.617647%20L7.58823529,27.406761%20C7.58823531,27.1955933%207.75942055,27.0244081%207.97058824,27.0244081%20L11.4117647,27.0244081%20L11.4117647,23.9917172%20L4.52941178,23.9917172%20C3.68474098,23.9917172%203,23.3069762%203,22.4623054%20L3,4.52941178%20C3,3.68474098%203.68474098,3%204.52941178,3%20L27.4705882,3%20Z%20M19,24%20L13,24%20L13,27%20L19,27%20L19,24%20Z%20M23.4117647,7%20L8.58823529,7%20C8.03595054,7%207.58823529,7.44771525%207.58823529,8%20L7.58823529,19%20C7.58823529,19.5522847%208.03595054,20%208.58823529,20%20L23.4117647,20%20C23.9640495,20%2024.4117647,19.5522847%2024.4117647,19%20L24.4117647,8%20C24.4117647,7.44771525%2023.9640495,7%2023.4117647,7%20Z%20M12,10%20C12.5522847,10%2013,10.4477153%2013,11%20L13,13%20C13,13.5522847%2012.5522847,14%2012,14%20C11.4477153,14%2011,13.5522847%2011,13%20L11,11%20C11,10.4477153%2011.4477153,10%2012,10%20Z%20M20,10%20C20.5522847,10%2021,10.4477153%2021,11%20L21,13%20C21,13.5522847%2020.5522847,14%2020,14%20C19.4477153,14%2019,13.5522847%2019,13%20L19,11%20C19,10.4477153%2019.4477153,10%2020,10%20Z%20M26,5%20C25.4477153,5%2025,5.44771525%2025,6%20C25,6.55228475%2025.4477153,7%2026,7%20C26.5522847,7%2027,6.55228475%2027,6%20C27,5.44771525%2026.5522847,5%2026,5%20Z'%20id='蒙版'%20fill='%23A3C5FD'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",En=a.defineComponent({name:"UserRender",props:{user:{type:Object,required:!0},tenantId:{type:String,default:"default"},tenants:{type:Object,required:!0},render:{type:Function,required:!1},hasAvatar:{type:Boolean,default:!1},avatarBaseUrl:{type:String,default:""}},setup(d){const f=i=>{if(i.type==="virtual")return Qr;if(i.type==="userGroup")return Xr;if(!d.avatarBaseUrl)return Wr;const s=i.login_name||i.bk_username||i.id;return`${d.avatarBaseUrl}${s}.png?default_when_absent=true`},c=(i,s)=>i("div",{style:{display:"flex",alignItems:"center"}},[s.hasAvatar?i("img",{src:f(s.user),style:{width:"20px",height:"20px",borderRadius:"50%",marginRight:"6px",flexShrink:0}}):null,i("span",s.user.name),s.user.tenantId!==s.tenantId&&s.user.tenantId?i("span",{style:{color:"#f59500",marginLeft:"4px"}},`@${s.tenants[s.user.tenantId]||s.user.tenantId}`):null]);return()=>{try{return d.render?d.render(a.h,d.user):c(a.h,d)}catch(i){return console.error("Error rendering tag:",i),c(a.h,d)}}}}),Zr=a.defineComponent({name:"SelectionPopover",__name:"selection-popover",props:{avatarBaseUrl:{type:String,required:!1,default:""},containerWidth:{type:[Number,String],required:!1,default:"auto"},emptyText:{type:String,required:!1,default:""},flatOptions:{type:Array,required:!1,default:()=>[]},hasAvatar:{type:Boolean,required:!1,default:!1},highlightedIndex:{type:Number,required:!1,default:-1},isShow:{type:Boolean,required:!1,default:!1},loading:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!1,default:()=>[]},recentUsers:{type:Array,required:!1,default:()=>[]},recentUsersName:{type:String,required:!1,default:""},renderListItem:{type:Function,required:!1},searchQuery:{type:String,required:!1,default:""},tenantId:{type:String,required:!1,default:"default"},tenants:{type:Object,required:!1,default:()=>({})},userGroup:{type:Array,required:!1,default:()=>[]},userGroupName:{type:String,required:!1,default:""}},emits:["click-outside","select-user"],setup(d,{expose:f,emit:c}){f();const{t:i}=Sn(),s=a.ref(null),m=a.ref(null),h=d,_=c,w=a.computed(()=>{const q={};return Array.isArray(h.userGroup)&&h.userGroup.length>0&&(q[h.userGroupName]=h.userGroup.map(z=>({...z,tenantId:"",type:xe.USER_GROUP}))),h.options.forEach(z=>{const ye=z.data_source_type===xe.VIRTUAL?i("虚拟账号"):i("用户");q[ye]||(q[ye]=[]),q[ye].push(z)}),q}),R=a.computed(()=>Object.values(w.value).some(q=>q.length>0)),G=a.computed(()=>h.recentUsers.length>0),H=a.computed(()=>R.value||G.value),he=q=>h.highlightedIndex<0||!h.flatOptions.length?!1:h.flatOptions[h.highlightedIndex]===q,Oe=q=>{_("select-user",q)},Ae=({event:q})=>{const z=q.target;s.value?.contains(z)||m.value?.contains(z)||_("click-outside",q)};a.watch(()=>h.highlightedIndex,q=>{q<0||!m.value||a.nextTick(()=>{const z=m.value?.querySelector(".user-option.is-highlighted");z&&z.scrollIntoView({block:"nearest",inline:"nearest",behavior:"auto"})})});const Ce={t:i,slotContainerRef:s,contentContainerRef:m,props:h,emit:_,groupedUsers:w,hasMainOptions:R,hasRecentUsers:G,hasDropdownOptions:H,isHighlighted:he,selectUser:Oe,handleClickOutside:Ae,get Loading(){return ht.Loading},get Popover(){return ht.Popover},get UserRender(){return En}};return Object.defineProperty(Ce,"__isScriptSetup",{enumerable:!1,value:!0}),Ce}}),Jr={ref:"contentContainerRef"},$r={key:0,class:"no-data"},ea={key:0,class:"dropdown-panel dropdown-panel-main"},ta={class:"group-name"},na={class:"group-count"},ra=["onClick"],aa={key:1,class:"dropdown-panel dropdown-panel-recent"},oa={class:"group-name"},ia={class:"group-count"},la=["onClick"],sa={ref:"slotContainerRef"};function ua(d,f,c,i,s,m){return a.openBlock(),a.createBlock(i.Popover,{arrow:!1,"ext-cls":"bk-user-selector-popover","is-show":c.isShow,offset:{mainAxis:4},placement:"bottom-start",theme:"light",trigger:"manual",width:c.containerWidth,onClickoutside:i.handleClickOutside},{content:a.withCtx(()=>[a.createElementVNode("div",Jr,[a.createVNode(i.Loading,{class:"dropdown-content",loading:c.loading,mode:"spin",size:"mini"},{default:a.withCtx(()=>[i.hasDropdownOptions?(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(["dropdown-panels",{"is-two-column":i.hasMainOptions&&i.hasRecentUsers}])},[i.hasMainOptions?(a.openBlock(),a.createElementBlock("div",ea,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.groupedUsers,(h,_)=>(a.openBlock(),a.createElementBlock("div",{key:_,class:"user-group"},[Object.keys(i.groupedUsers).length>1||h.some(w=>w.type==="userGroup")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"group-header",onClick:f[0]||(f[0]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",ta,a.toDisplayString(_),1),a.createElementVNode("span",na,"("+a.toDisplayString(h.length)+")",1)])):a.createCommentVNode("v-if",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(h,w=>(a.openBlock(),a.createElementBlock("div",{key:w.id,class:a.normalizeClass(["user-option",{"is-highlighted":i.isHighlighted(w)}]),onClick:a.withModifiers(R=>i.selectUser(w),["prevent"]),onMousedown:f[1]||(f[1]=a.withModifiers(()=>{},["prevent"]))},[a.createVNode(i.UserRender,{"avatar-base-url":c.avatarBaseUrl,"has-avatar":c.hasAvatar,render:c.renderListItem,"tenant-id":c.tenantId,tenants:c.tenants,user:w},null,8,["avatar-base-url","has-avatar","render","tenant-id","tenants","user"])],42,ra))),128))]))),128))])):a.createCommentVNode("v-if",!0),i.hasRecentUsers?(a.openBlock(),a.createElementBlock("div",aa,[c.recentUsersName?(a.openBlock(),a.createElementBlock("div",{key:0,class:"group-header",onClick:f[2]||(f[2]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",oa,a.toDisplayString(c.recentUsersName),1),a.createElementVNode("span",ia,"("+a.toDisplayString(c.recentUsers.length)+")",1)])):a.createCommentVNode("v-if",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.recentUsers,h=>(a.openBlock(),a.createElementBlock("div",{key:h.id,class:a.normalizeClass(["user-option",{"is-highlighted":i.isHighlighted(h)}]),onClick:a.withModifiers(_=>i.selectUser(h),["prevent"]),onMousedown:f[3]||(f[3]=a.withModifiers(()=>{},["prevent"]))},[a.createVNode(i.UserRender,{"avatar-base-url":c.avatarBaseUrl,"has-avatar":c.hasAvatar,render:c.renderListItem,"tenant-id":c.tenantId,tenants:c.tenants,user:h},null,8,["avatar-base-url","has-avatar","render","tenant-id","tenants","user"])],42,la))),128))])):a.createCommentVNode("v-if",!0)],2)):(a.openBlock(),a.createElementBlock("div",$r,[a.createElementVNode("span",null,a.toDisplayString(c.emptyText),1)]))]),_:1},8,["loading"])],512)]),default:a.withCtx(()=>[a.createElementVNode("div",sa,[a.renderSlot(d.$slots,"default",{},void 0,!0)],512)]),_:3},8,["is-show","width"])}var ca=tn(Zr,[["render",ua],["__scopeId","data-v-9173accf"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/selection-popover.vue"]]),da=a.defineComponent({name:"UserTag",__name:"user-tag",props:{active:{type:Boolean,required:!1},avatarBaseUrl:{type:String,required:!1},currentTenantId:{type:String,required:!0},draggable:{type:Boolean,required:!1},hasAvatar:{type:Boolean,required:!1},renderTag:{type:Function,required:!1},showTenant:{type:Boolean,required:!1},tenants:{type:Object,required:!0},user:{type:Object,required:!0}},emits:["click","close"],setup(d,{expose:f,emit:c}){f();const i=c,h={emit:i,handleClick:()=>{i("click")},handleClose:()=>{i("close")},get Tag(){return ht.Tag},get UserRender(){return En}};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}});function fa(d,f,c,i,s,m){return a.openBlock(),a.createBlock(i.Tag,{class:a.normalizeClass(["user-tag",{draggable:c.draggable,active:c.active,"is-custom":c.user.type==="custom"}]),closable:"",disabled:"",onClick:a.withModifiers(i.handleClick,["stop"]),onClose:i.handleClose},{default:a.withCtx(()=>[a.createVNode(i.UserRender,{"avatar-base-url":c.avatarBaseUrl,"has-avatar":c.hasAvatar,render:c.renderTag,"tenant-id":c.currentTenantId,tenants:c.tenants,user:c.user},null,8,["avatar-base-url","has-avatar","render","tenant-id","tenants","user"])]),_:1},8,["class"])}var ha=tn(da,[["render",fa],["__scopeId","data-v-d1173d20"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/user-tag.vue"]]),pa=a.defineComponent({name:"BkUserSelector",__name:"user-selector",props:{autoFocus:{type:Boolean,required:!1,default:!1},draggable:{type:Boolean,required:!1,default:!1},maxCount:{type:Number,required:!1,default:0},modelValue:{type:[String,Array],required:!1,default:""},multiple:{type:Boolean,required:!1,default:!1},resize:{type:Boolean,required:!1,default:!0},rows:{type:Number,required:!1,default:4},type:{type:String,required:!1,default:"input"},allowCreate:{type:Boolean,required:!1,default:!1},allowCrossOriginCredentials:{type:Boolean,required:!1,default:!0},allowedApiOrigins:{type:Array,required:!1,default:()=>[]},allowPrivateApiHost:{type:Boolean,required:!1,default:!0},apiBaseUrl:{type:String,required:!0,default:""},avatarBaseUrl:{type:String,required:!1,default:""},currentUserId:{type:String,required:!1,default:""},disabled:{type:Boolean,required:!1,default:!1},emptyText:{type:String,required:!1,default:""},enableMultiTenantMode:{type:Boolean,required:!1,default:!0},exactSearchKey:{type:String,required:!1,default:ft},excludeUserIds:{type:Array,required:!1,default:()=>[]},freePaste:{type:Boolean,required:!1,default:!1},hasAvatar:{type:Boolean,required:!1,default:!1},placeholder:{type:String,required:!1,default:""},recentUserIds:{type:Array,required:!1,default:()=>[]},renderListItem:{type:Function,required:!1},renderTag:{type:Function,required:!1},tenantId:{type:String,required:!1,default:"default"},userGroup:{type:Array,required:!1,default:()=>[]},userGroupName:{type:String,required:!1,default:""}},emits:["blur","change","dragEnd","dragStart","error","focus","unauthorized","update:modelValue"],setup(d,{expose:f,emit:c}){const{t:i}=Sn();ht.provideGlobalConfig({prefix:"bk"});const s=d,m=c,h=g=>{m("error",g)},_=g=>{m("unauthorized",g)};Sr(s.apiBaseUrl,s.tenantId,s.allowedApiOrigins,s.allowPrivateApiHost,s.allowCrossOriginCredentials,{onError:h,onUnauthorized:_});const{tenants:w}=qr(s.apiBaseUrl,s.tenantId,s.enableMultiTenantMode),{searchResults:R,loading:G,searchQuery:H,clearSearch:he,handleSearchInput:Oe}=zr(s.apiBaseUrl,s.tenantId,s.enableMultiTenantMode),{fetchCurrentUser:Ae}=xr({apiBaseUrl:s.apiBaseUrl,tenantId:s.tenantId,currentUserId:s.currentUserId||"",exactSearchKey:s.exactSearchKey,enableMultiTenantMode:s.enableMultiTenantMode}),Ce=a.ref(null),q=a.ref(null),z=a.ref(null),ye=a.ref(null),ot=a.ref(null),$=a.ref(null),X=a.ref(!1),T=a.ref(-1),oe=a.ref(null),O=a.ref([]),x=a.ref(0),Y=a.ref(-1),pe=a.ref([]);let te=0,ze=[];const U=a.ref([]),E=a.computed(()=>s.type==="textarea"),De=a.ref(s.rows*32),Bt=a.computed(()=>{if(E.value)return{height:`${De.value}px`,resize:s.resize?"vertical":"none",overflowY:"auto"}}),Se=a.computed(()=>E.value?U.value:O.value),j=a.computed(()=>s.multiple?Array.isArray(s.modelValue)?s.modelValue:[]:s.modelValue?[s.modelValue]:[]),Mt=a.computed(()=>s.placeholder||i("请输入人员名称搜索")),je=a.computed(()=>s.userGroupName||i("用户群组")),pt=a.computed(()=>s.emptyText||i("无匹配人员")),ee=a.computed(()=>i("最近选择")),it=a.computed(()=>U.value.map(g=>g.id)),Nt=(g,C)=>C?[g.id,g.name,g.bk_username,g.username,g.login_name,g.display_name,g.full_name].some(I=>String(I||"").includes(C)):!0,be=g=>g.split(",").map(C=>C.trim()).filter(Boolean),lt=(g,C,I)=>g.find(L=>{if(L.id===C)return!0;const ve=L;return I.some(Ye=>String(ve[Ye]||"")===C)}),Ke=(g,C,I)=>C.map(L=>lt(g,L,I)).filter(Boolean),Re=async g=>{const C=be(s.exactSearchKey),I=At(await Jt({apiBaseUrl:s.apiBaseUrl,tenantId:s.tenantId,exactSearchKey:s.exactSearchKey,usersList:g,enableMultiTenantMode:s.enableMultiTenantMode}),s.enableMultiTenantMode),L=g.filter(et=>!lt(I,et,C));if(L.length===0||s.exactSearchKey==="bk_username")return Ke(I,g,C);const ve=At(await Jt({apiBaseUrl:s.apiBaseUrl,tenantId:s.tenantId,exactSearchKey:ft,usersList:L,enableMultiTenantMode:s.enableMultiTenantMode}),s.enableMultiTenantMode),Ye=[...I];return ve.forEach(et=>{Ye.some(tt=>tt.id===et.id)||Ye.push(et)}),Ke(Ye,g,[...new Set([...C,ft])])},Qe=a.computed(()=>!s.maxCount||s.maxCount<=0?!1:U.value.length>=s.maxCount),nn=a.computed(()=>Qe.value||!!s.currentUserId&&U.value.some(g=>g[s.exactSearchKey]===s.currentUserId)),Pt=a.computed(()=>({avatarBaseUrl:s.avatarBaseUrl,currentTenantId:s.tenantId,hasAvatar:s.hasAvatar,renderTag:s.renderTag,tenants:w.value})),{filteredUserGroup:Ze,filterOptions:gt,createCustomUser:st}=jr({selectedUserIds:it,excludeUserIds:a.toRef(s,"excludeUserIds"),userGroup:a.toRef(s,"userGroup"),searchQuery:H}),{handlePaste:vt}=Lr({apiBaseUrl:s.apiBaseUrl,tenantId:s.tenantId,searchQuery:H,selectedUsers:U,allowCreate:s.allowCreate,freePaste:s.freePaste,enableMultiTenantMode:s.enableMultiTenantMode,maxCount:s.maxCount,onAddUser:qe,onBatchAddUsers:s.multiple?Ue:void 0}),ne=a.computed(()=>gt(R.value)),Rt=a.computed(()=>{const g=Ze.value.map(L=>({...L,tenantId:"",type:xe.USER_GROUP})),C=ne.value.filter(L=>L.data_source_type!==xe.VIRTUAL),I=ne.value.filter(L=>L.data_source_type===xe.VIRTUAL);return[...g,...C,...I]}),mt=a.computed(()=>{const g=H.value.trim();return pe.value.filter(C=>!it.value.includes(C.id)).filter(C=>!s.excludeUserIds.includes(C.id)).filter(C=>Nt(C,g))}),ut=a.computed(()=>X.value&&(Ze.value.length>0||mt.value.length>0||H.value.trim()!=="")),ge=a.computed(()=>[...Rt.value,...mt.value]),yt=a.computed(()=>{const g=H.value;if(!g)return"20px";const C=g.split("").reduce((I,L)=>I+(/[\u4e00-\u9fa5]/.test(L)?12:8),0);return`${Math.max(20,C+4)}px`}),Be=async()=>{const g=j.value;if(g.length===0){U.value=[];return}let C=[];s.userGroup.length>0&&(C=s.userGroup.filter(I=>g.includes(I.id)).map(I=>({...I,tenantId:"",type:xe.USER_GROUP})));try{const I=[...C,...await Re(g)];if(s.allowCreate){const L=[...new Set([...be(s.exactSearchKey),ft])];I.push(...g.filter(ve=>!lt(I,ve,L)).map(ve=>({id:ve,name:ve,type:xe.CUSTOM,tenantId:""})))}U.value=Ke(I,g,[...new Set([...be(s.exactSearchKey),ft])])}catch(I){console.error("获取选中用户信息失败:",I),U.value=[]}},Le=async()=>{const g=s.recentUserIds.filter(Boolean),C=++te;if(ze=[...g],g.length===0){pe.value=[];return}try{const I=(await Re(g)).filter(L=>L.data_source_type!==xe.VIRTUAL&&L.type!==xe.USER_GROUP);if(C!==te)return;pe.value=I}catch(I){if(C!==te)return;console.error("获取最近选择用户信息失败:",I),pe.value=[]}};function Ue(g){if(U.value=g,s.multiple)m("update:modelValue",g.map(C=>C.id)),m("change",g);else{const C=g.length>0?g[0]:null;m("update:modelValue",C?C.id:""),m("change",C)}}const le=()=>{!s.draggable||!s.multiple||!q.value||(oe.value&&oe.value.destroy(),oe.value=new mr.default(q.value,{animation:150,draggable:".tag-wrapper",onStart:g=>{m("dragStart",g)},onEnd:g=>{const{oldIndex:C,newIndex:I}=g;if(C===I||C===void 0||I===void 0)return;const L=[...U.value],[ve]=L.splice(C,1);L.splice(I,0,ve),Ue(L),m("dragEnd",g)}}))},re=()=>{if(!U.value.length){O.value=[],x.value=0;return}if(!z.value){O.value=[...U.value],x.value=0;return}const g=z.value.offsetWidth,C=z.value.querySelectorAll(".user-tag");if(C.length!==U.value.length){O.value=[...U.value],x.value=0,a.nextTick(re);return}const I=Gr(z.value,C,g-100);O.value=U.value.slice(0,I),x.value=Math.max(0,U.value.length-I)},b=()=>{X.value=!0,T.value=U.value.length-1,a.nextTick(()=>ce())},K=()=>{X.value||a.nextTick(re)},B=()=>{X.value&&m("blur"),X.value=!1,T.value=U.value.length-1,he(),Y.value=-1,K()},W=g=>{const C=g.target,I=Ce.value;I?.contains(C)||I===C||B()},Fe=()=>{T.value=U.value.length-1,a.nextTick(()=>ce())},ce=()=>{T.value===-1&&U.value.length>0?ye.value?.focus():T.value>=U.value.length-1?$.value?.focus():ot.value?.[0]?.focus()},J=g=>{T.value=g,a.nextTick(()=>ce())},Me=()=>{m("focus"),X.value=!0},He=()=>{Oe(H.value)},de=async()=>{if(!s.currentUserId||U.value.some(C=>C[s.exactSearchKey]===s.currentUserId)||s.multiple&&Qe.value)return;const g=await Ae();g&&(s.multiple?U.value.some(C=>C.id===g.id)||Ue([...U.value,g]):Ue([g]),he(),Y.value=-1,X.value=!0,T.value=U.value.length-1,a.nextTick(()=>ce()))},Je=async g=>{await vt(g),T.value=U.value.length-1,a.nextTick(()=>ce())},Ne=g=>{if(g.key==="Backspace"&&!H.value&&U.value.length>0){if(T.value>=0){const C=U.value[T.value],I=T.value>0?T.value-1:-1;Ue(U.value.filter(L=>L.id!==C.id)),T.value=I,K(),a.nextTick(()=>ce())}return}if(g.key==="ArrowDown"&&ut.value&&ge.value.length>0){g.preventDefault();const C=ge.value.length-1;Y.value=Math.min(Y.value+1,C);return}if(g.key==="ArrowUp"&&ut.value&&ge.value.length>0){g.preventDefault(),Y.value=Math.max(Y.value-1,0);return}if(g.key==="Enter"){s.allowCreate&&H.value?qe(st(H.value)):Y.value>=0&&ge.value[Y.value]&&qe(ge.value[Y.value]);return}if(g.key==="ArrowLeft"&&!H.value&&U.value.length>0){g.preventDefault(),T.value===0?T.value=-1:T.value>0&&T.value--,a.nextTick(()=>ce());return}if(g.key==="ArrowRight"&&!H.value&&U.value.length>0){g.preventDefault(),T.value===-1?T.value=0:T.value<U.value.length-1&&T.value++,a.nextTick(()=>ce());return}};function qe(g){if(g?.id){if(s.multiple&&Qe.value){he(),Y.value=-1;return}if(!s.multiple)Ue([g]),T.value=0;else if(!U.value.some(C=>C.id===g.id)){let C,I;T.value===-1?(C=[g,...U.value],I=0):(C=[...U.value.slice(0,T.value+1),g,...U.value.slice(T.value+1)],I=T.value+1),Ue(C),T.value=I}he(),Y.value=-1,X.value=!0,a.nextTick(()=>ce())}}const ie=g=>{if(!g?.id)return;const C=U.value.findIndex(L=>L.id===g.id),I=U.value.filter(L=>L.id!==g.id);Ue(I),I.length===0?T.value=-1:T.value>C?T.value--:T.value>=I.length&&(T.value=I.length-1),K()};a.watch(U,()=>{K()},{deep:!0}),a.watch(X,g=>{if(E.value){const C=g?z.value:Ce.value?.querySelector(".tags-container.focused");C&&C.offsetHeight>0&&(De.value=C.offsetHeight)}g&&a.nextTick(()=>le())}),a.watch(ge,g=>{g.length>0&&ut.value?Y.value=0:Y.value=-1}),a.watch(()=>s.userGroup,()=>{Be()}),a.watch(()=>s.recentUserIds,()=>{const g=s.recentUserIds.filter(Boolean);ze.length===g.length&&ze.every((C,I)=>C===g[I])||Le()},{deep:!0}),a.watch(()=>s.modelValue,()=>{const g=U.value.map(I=>I.id),C=j.value;(g.length!==C.length||!g.every((I,L)=>I===C[L]))&&Be()},{deep:!0}),Fr(Ce,()=>{K()});let Te;a.onBeforeMount(()=>{Te=Promise.all([Be(),Le()]).then(()=>{})}),a.onMounted(async()=>{le(),a.nextTick(re),s.autoFocus&&!s.disabled&&(await Te,await a.nextTick(),b())}),a.onUnmounted(()=>{oe.value?.destroy()}),f({focus:b,blur:B});const $e={t:i,props:s,emit:m,handleApiError:h,handleApiUnauthorized:_,tenants:w,searchResults:R,searchLoading:G,searchQuery:H,clearSearch:he,handleSearchInput:Oe,fetchCurrentUser:Ae,containerRef:Ce,sortableContainerRef:q,collapsedContainerRef:z,frontInputRef:ye,inlineInputRef:ot,lastInputRef:$,isFocused:X,activeTagIndex:T,sortableInstance:oe,visibleUsers:O,hiddenCount:x,highlightedIndex:Y,recentUsers:pe,get recentUsersRequestId(){return te},set recentUsersRequestId(g){te=g},get recentUserIdsSnapshot(){return ze},set recentUserIdsSnapshot(g){ze=g},selectedUsers:U,isTextareaMode:E,textareaHeight:De,textareaStyle:Bt,collapsedDisplayUsers:Se,modelValueIds:j,computedPlaceholder:Mt,computedUserGroupName:je,computedEmptyText:pt,computedRecentUsersName:ee,selectedUserIds:it,isUserMatchedByQuery:Nt,getLookupFields:be,findUserByLookupId:lt,sortUsersByLookupIds:Ke,lookupFormattedUsersByIds:Re,isMaxCountReached:Qe,isMeTagDisabled:nn,userTagCommonProps:Pt,filteredUserGroup:Ze,filterOptions:gt,createCustomUser:st,handlePaste:vt,displayOptions:ne,mainNavigableUsers:Rt,filteredRecentUsers:mt,showDropdown:ut,flatOptions:ge,inputWidth:yt,initSelectedUsers:Be,initRecentUsers:Le,updateSelectedUsers:Ue,initSortable:le,calculateVisibleUsers:re,handleFocus:b,scheduleVisibleUsersCalculation:K,blur:B,handleClickOutside:W,handleContainerClick:Fe,focusCurrentInput:ce,handleTagClick:J,handleInputFocus:Me,handleInput:He,addCurrentUser:de,onPaste:Je,handleKeyDown:Ne,addUser:qe,removeUser:ie,get initPromise(){return Te},set initPromise(g){Te=g},get Popover(){return ht.Popover},get Tag(){return ht.Tag},MeTag:Yr,SelectionPopover:ca,get UserRender(){return En},UserTag:ha};return Object.defineProperty($e,"__isScriptSetup",{enumerable:!1,value:!0}),$e}}),ga={ref:"sortableContainerRef",class:"tag-list"},va=["placeholder"],ma={class:"hidden-users"},ya=["placeholder"];function ba(d,f,c,i,s,m){return a.openBlock(),a.createElementBlock("div",{ref:"containerRef",class:a.normalizeClass(["bk-user-selector",{"is-disabled":c.disabled,"is-textarea":i.isTextareaMode}])},[a.createCommentVNode(" 下拉选项列表 "),a.createVNode(i.SelectionPopover,{"avatar-base-url":c.avatarBaseUrl,"container-width":i.containerRef?i.containerRef.offsetWidth:"auto","empty-text":i.computedEmptyText,"flat-options":i.flatOptions,"has-avatar":c.hasAvatar,"highlighted-index":i.highlightedIndex,"is-show":i.showDropdown,loading:i.searchLoading,options:i.displayOptions,"recent-users":i.filteredRecentUsers,"recent-users-name":i.computedRecentUsersName,"render-list-item":c.renderListItem,"search-query":i.searchQuery,"tenant-id":c.tenantId,tenants:i.tenants,"user-group":i.filteredUserGroup,"user-group-name":i.computedUserGroupName,onClickOutside:i.handleClickOutside,onSelectUser:i.addUser},{default:a.withCtx(()=>[a.createCommentVNode(" 聚焦状态 - 可编辑模式 "),a.withDirectives(a.createElementVNode("div",{class:"tags-container focused",style:a.normalizeStyle(i.textareaStyle),onClick:a.withModifiers(i.handleContainerClick,["stop"])},[a.createCommentVNode(" 用户标签列表 "),a.createElementVNode("div",ga,[a.createCommentVNode(" 在第一个标签之前的输入框 "),i.activeTagIndex===-1&&i.selectedUsers.length>0?a.withDirectives((a.openBlock(),a.createElementBlock("input",{key:0,ref:"frontInputRef","onUpdate:modelValue":f[0]||(f[0]=h=>i.searchQuery=h),autofocus:"",class:"search-input input-inline",style:a.normalizeStyle({width:i.inputWidth}),onFocus:i.handleInputFocus,onInput:i.handleInput,onKeydown:i.handleKeyDown,onPaste:i.onPaste},null,36)),[[a.vModelText,i.searchQuery]]):a.createCommentVNode("v-if",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.selectedUsers,(h,_)=>(a.openBlock(),a.createElementBlock("div",{key:h.id,class:"tag-wrapper"},[a.createVNode(i.UserTag,a.mergeProps({ref_for:!0},i.userTagCommonProps,{active:_===i.activeTagIndex,draggable:c.draggable&&c.multiple,user:h,onClick:w=>i.handleTagClick(_),onClose:w=>i.removeUser(h)}),null,16,["active","draggable","user","onClick","onClose"]),a.createCommentVNode(" 在当前激活标签后插入输入框 "),_===i.activeTagIndex&&i.activeTagIndex!==i.selectedUsers.length-1?a.withDirectives((a.openBlock(),a.createElementBlock("input",{key:0,ref_for:!0,ref:"inlineInputRef","onUpdate:modelValue":f[1]||(f[1]=w=>i.searchQuery=w),autofocus:"",class:"search-input input-inline",style:a.normalizeStyle({width:i.inputWidth}),onFocus:i.handleInputFocus,onInput:i.handleInput,onKeydown:i.handleKeyDown,onPaste:i.onPaste},null,36)),[[a.vModelText,i.searchQuery]]):a.createCommentVNode("v-if",!0)]))),128)),a.createCommentVNode(" 最后一个输入框(末尾位置或无用户时显示) "),i.activeTagIndex>=i.selectedUsers.length-1?a.withDirectives((a.openBlock(),a.createElementBlock("input",{key:1,ref:"lastInputRef","onUpdate:modelValue":f[2]||(f[2]=h=>i.searchQuery=h),autofocus:"",class:"search-input input-last",placeholder:i.selectedUsers.length?"":i.computedPlaceholder,onFocus:i.handleInputFocus,onInput:i.handleInput,onKeydown:i.handleKeyDown,onPaste:i.onPaste},null,40,va)),[[a.vModelText,i.searchQuery]]):a.createCommentVNode("v-if",!0),a.createCommentVNode(' "我"标签 '),a.createVNode(i.MeTag,{"current-user-id":c.currentUserId,"is-disabled":i.isMeTagDisabled,onClick:i.addCurrentUser},null,8,["current-user-id","is-disabled"])],512)],4),[[a.vShow,i.isFocused]]),a.createCommentVNode(" 未聚焦状态 - 只读展示模式 "),a.withDirectives(a.createElementVNode("div",{ref:"collapsedContainerRef",class:"tags-container tags-container-collapsed",style:a.normalizeStyle(i.textareaStyle),onClick:a.withModifiers(i.handleFocus,["stop"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.collapsedDisplayUsers,h=>(a.openBlock(),a.createBlock(i.UserTag,a.mergeProps({key:h.id},{ref_for:!0},i.userTagCommonProps,{"show-tenant":!0,user:h,onClick:i.handleFocus,onClose:_=>i.removeUser(h)}),null,16,["user","onClose"]))),128)),a.createCommentVNode(" 显示折叠标签数量(textarea 模式下不折叠) "),i.hiddenCount>0&&!i.isTextareaMode?(a.openBlock(),a.createBlock(i.Popover,{key:0,placement:"top"},{content:a.withCtx(()=>[a.createElementVNode("div",ma,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.selectedUsers.slice(i.visibleUsers.length),h=>(a.openBlock(),a.createBlock(i.UserRender,{key:h.id,"avatar-base-url":c.avatarBaseUrl,"has-avatar":c.hasAvatar,"tenant-id":c.tenantId,tenants:i.tenants,user:h},null,8,["avatar-base-url","has-avatar","tenant-id","tenants","user"]))),128))])]),default:a.withCtx(()=>[a.createVNode(i.Tag,null,{default:a.withCtx(()=>[a.createTextVNode(" +"+a.toDisplayString(i.hiddenCount),1)]),_:1})]),_:1})):a.createCommentVNode("v-if",!0),a.createCommentVNode(" 搜索输入框 "),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":f[3]||(f[3]=h=>i.searchQuery=h),class:"search-input search-input-collapsed",placeholder:i.selectedUsers.length?"":i.computedPlaceholder,onFocus:i.handleFocus},null,40,ya),[[a.vModelText,i.searchQuery]]),a.createCommentVNode(' 未聚焦状态下的"我"标签 '),a.createVNode(i.MeTag,{"current-user-id":c.currentUserId,"is-disabled":i.isMeTagDisabled,onClick:i.addCurrentUser},null,8,["current-user-id","is-disabled"])],4),[[a.vShow,!i.isFocused]])]),_:1},8,["avatar-base-url","container-width","empty-text","flat-options","has-avatar","highlighted-index","is-show","loading","options","recent-users","recent-users-name","render-list-item","search-query","tenant-id","tenants","user-group","user-group-name"])],2)}var zn=tn(pa,[["render",ba],["__scopeId","data-v-089550be"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/user-selector.vue"]]),wa=zn;exports.BkUserSelector=zn;exports.default=wa;
|