@blueking/bkflow-canvas-editor 1.2.0-beta.1 → 1.2.0-beta.2
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/dist/advanced.d.ts +53 -2
- package/dist/{index-CFs7FBc2.js → index-BDAWGVae.js} +1 -1
- package/dist/{index-BxGg3wAN.cjs → index-BPyjvoGz.cjs} +1 -1
- package/dist/{index-Bg_GQyNU.js → index-CJ5t_LGa.js} +1 -1
- package/dist/index-ClP9Gq3W.cjs +93 -0
- package/dist/index-CwMEGzur.js +58458 -0
- package/dist/{index-uUrwPR1f.cjs → index-Ddr99mq4.cjs} +1 -1
- package/dist/{index-C98sai1H.cjs → index-DuVnZGZk.cjs} +1 -1
- package/dist/{index-YTEMyQpg.js → index-RubzksMv.js} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +81 -3
- package/dist/index.es.min-BpHMrg2Y.cjs +2 -0
- package/dist/index.es.min-DYp0DL9J.js +3543 -0
- package/dist/index.esm.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/dist/bkflow-canvas-editor_false-B70uLuHL.cjs +0 -1
- package/dist/bkflow-canvas-editor_false-BlC281Zg.cjs +0 -1
- package/dist/bkflow-canvas-editor_false-Casww7p4.js +0 -5
- package/dist/bkflow-canvas-editor_false-i9G8sqQi.js +0 -5
- package/dist/index-Bij1hZGP.js +0 -56012
- package/dist/index-DuddWhYg.cjs +0 -93
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),d=require("./index-DuddWhYg.cjs"),L={class:"debug-result-node-list"},D=["data-node-id","aria-selected","onClick","onKeydown"],z=["title"],A={key:0,class:"debug-result-node-list__mock","data-test":"node-mock-flag"},P={key:1,class:"debug-result-node-list__empty"},I=e.defineComponent({__name:"node-list",props:{nodes:{},modelValue:{default:""}},emits:["update:modelValue"],setup(c,{emit:g}){const t=c,s=g,r=e.ref(""),m=e.ref("all"),_=e.ref(null),p={not_run:"未执行",finished:"成功",failed:"失败",running:"正在调试",suspended:"挂起",skipped:"跳过",revoked:"终止"},k=[{value:"all",label:"全部"},{value:"finished",icon:"bkflow-canvas-dark-circle-checkbox",iconColor:"#5fb8ac",tooltip:p.finished},{value:"failed",icon:"bkflow-canvas-dark-circle-close",iconColor:"#fa4e41",tooltip:p.failed},{value:"revoked",icon:"bkflow-canvas-stop-fill",iconColor:"#fa4e41",tooltip:p.revoked},{value:"running",iconComponent:d.LoadingStatusIcon,iconColor:"#3a84ff",tooltip:p.running},{value:"not_run",icon:"bkflow-canvas-weizhixing2",iconColor:"#b8bbc4",tooltip:p.not_run},{value:"suspended",icon:"bkflow-canvas-zanting",iconColor:"#f59500",tooltip:p.suspended},{value:"skipped",icon:"bkflow-canvas-tiaoguo2",iconColor:"#6e89af",tooltip:p.skipped}],w=e.computed(()=>k.map(a=>({...a,count:a.value==="all"?t.nodes.length:t.nodes.filter(n=>n.status===a.value).length}))),V=e.computed(()=>{const a=r.value.trim().toLowerCase();return t.nodes.filter(n=>m.value!=="all"&&n.status!==m.value?!1:a?n.name.toLowerCase().includes(a)||n.type.toLowerCase().includes(a)||(n.typeName??"").toLowerCase().includes(a):!0)}),C=e.computed(()=>r.value.trim()?"搜索结果为空":m.value!=="all"?`暂无${p[m.value]}状态节点`:"暂无节点"),x=()=>{r.value="",m.value="all"},y=a=>{const n=_.value,v=n?.querySelector(`[data-node-id="${CSS.escape(a)}"]`);if(!n||!v)return;const o=n.getBoundingClientRect(),b=v.getBoundingClientRect();b.top<o.top?n.scrollTop-=o.top-b.top:b.bottom>o.bottom&&(n.scrollTop+=b.bottom-o.bottom)};return e.watch(()=>t.modelValue,async a=>{if(!a)return;!V.value.some(v=>v.id===a)&&t.nodes.some(v=>v.id===a)&&(r.value="",m.value="all"),await e.nextTick(),y(a)},{flush:"post"}),(a,n)=>{const v=e.resolveComponent("bk-input");return e.openBlock(),e.createElementBlock("aside",L,[e.createVNode(v,{modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=o=>r.value=o),class:"debug-result-node-list__search",placeholder:"搜索节点名称 / 类型",type:"search",clearable:"","data-test":"node-search"},null,8,["modelValue"]),e.createVNode(d.SegmentTabs,{modelValue:m.value,"onUpdate:modelValue":n[1]||(n[1]=o=>m.value=o),class:"debug-result-node-list__filters","data-test":"status-filters",items:w.value},null,8,["modelValue","items"]),V.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"itemsRef",ref:_,class:"debug-result-node-list__items",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["debug-result-node-list__item",`is-${o.status}`,{"is-active":o.id===t.modelValue,"is-unconfigured":!o.isConfigured}]),role:"option","data-test":"node-item","data-node-id":o.id,"aria-selected":o.id===t.modelValue,tabindex:"0",onClick:b=>s("update:modelValue",o.id),onKeydown:e.withKeys(e.withModifiers(b=>s("update:modelValue",o.id),["prevent"]),["enter","space"])},[e.createElementVNode("span",{class:e.normalizeClass(["debug-result-node-list__status",`is-${o.status}`,{"is-placeholder":!o.isConfigured}])},[o.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(o.icon),"data-test":"node-icon"},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",{class:"debug-result-node-list__name",title:o.isConfigured?`${o.name} ${o.typeName||o.type}`:o.name},e.toDisplayString(o.name),9,z),o.isMock?(e.openBlock(),e.createElementBlock("span",A,"MOCK")):e.createCommentVNode("",!0)],42,D))),128))],512)):(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(d.EmptyException,{"is-search":!1,title:C.value,onClear:x},null,8,["title"])]))])}}}),H=d._export_sfc(I,[["__scopeId","data-v-db0cb31c"]]);function U(c){if(c==null)return"";if(typeof c=="string")return c;if(typeof c=="object"){const g=c,t=g.message;if(typeof t=="string"&&t){const s=g.type;return typeof s=="string"&&s?`${s}: ${t}`:t}try{return JSON.stringify(c)}catch{return String(c)}}return String(c)}const O={class:"debug-result-tabs"},F={class:"debug-result-tabs__failed-actions","data-test":"output-error-actions"},G={class:"debug-result-tabs__execution","data-test":"tab-execution"},K={class:"debug-result-tabs__row"},j={class:"value"},q={class:"debug-result-tabs__row"},Y={class:"value"},J={key:0,class:"debug-result-tabs__row is-error"},Q={class:"value"},W={class:"debug-result-tabs__mock-hint","data-test":"mock-banner"},X={class:"debug-result-tabs__logs","data-test":"tab-logs"},Z=e.defineComponent({__name:"result-tabs",props:{result:{},component:{},isMock:{type:Boolean,default:!1},canRunNodeDebug:{type:Boolean,default:!1}},emits:["reEditMock","runReal","runMock","logsTabActive"],setup(c,{emit:g}){const t=c,s=g,r=e.ref("execution");e.watch(r,f=>s("logsTabActive",f==="logs"),{immediate:!0});const m={not_run:"未调试",running:"正在调试",finished:"成功",failed:"失败",suspended:"挂起",skipped:"跳过",revoked:"已终止"},_=e.computed(()=>m[t.result.execution.status]??t.result.execution.status),p=e.computed(()=>d.formatSummaryDuration(t.result.execution.durationMs)),k=e.computed(()=>U(t.result.error||t.result.execution.errorDetail)),w=e.computed(()=>t.result.execution.status==="revoked"),V=e.computed(()=>d.isDebugAbnormalStatus(t.result.execution.status)),C=e.computed(()=>w.value?"该节点调试已终止,可":"该节点执行失败,可"),{loading:x,error:y,visibleInputs:a,visibleOutputs:n,outputNameMap:v}=d.usePluginParamMeta({component:()=>t.component}),o=e.computed(()=>t.result.loading||x.value),b=e.computed(()=>t.result.detailError||y.value),h=e.computed(()=>a.value.filter(({key:f})=>Object.prototype.hasOwnProperty.call(t.result.inputs,f)).map(({key:f,name:l})=>({key:f,name:l,value:t.result.inputs[f]}))),B=e.computed(()=>d.orderDebugRowsByDeclaredKeys(d.toDebugOutputValueRows(t.result.outputs,v.value),n.value.map(f=>f.key))),R=e.computed(()=>d.shouldShowMockReEditHint(t.isMock,n.value)),T=e.computed(()=>t.result.logs==null?"":d.normalizeLogText(t.result.logs));return(f,l)=>{const i=e.resolveComponent("bk-button"),u=e.resolveComponent("bk-tab-panel"),S=e.resolveComponent("bk-tab");return e.openBlock(),e.createElementBlock("div",O,[e.createVNode(S,{active:r.value,"onUpdate:active":l[3]||(l[3]=E=>r.value=E),type:"card-grid"},e.createSlots({default:e.withCtx(()=>[e.createVNode(u,{name:"execution",label:"执行信息"},{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createElementVNode("div",K,[l[8]||(l[8]=e.createElementVNode("span",{class:"label"},"执行状态",-1)),e.createElementVNode("span",j,e.toDisplayString(_.value),1)]),e.createElementVNode("div",q,[l[9]||(l[9]=e.createElementVNode("span",{class:"label"},"调试用时",-1)),e.createElementVNode("span",Y,e.toDisplayString(p.value),1)]),k.value?(e.openBlock(),e.createElementBlock("div",J,[l[10]||(l[10]=e.createElementVNode("span",{class:"label"},"错误信息",-1)),e.createElementVNode("span",Q,e.toDisplayString(k.value),1)])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(u,{name:"inputs",label:"输入参数"},{default:e.withCtx(()=>[e.createVNode(d.DebugValueTable,{rows:h.value,loading:o.value,error:b.value,"empty-text":"暂无输入参数"},null,8,["rows","loading","error"])]),_:1}),e.createVNode(u,{name:"outputs",label:"输出结果"},{default:e.withCtx(()=>[e.createVNode(d.DebugValueTable,{rows:B.value,loading:o.value,error:b.value,"empty-text":"暂无输出结果"},e.createSlots({_:2},[R.value?{name:"toolbar",fn:e.withCtx(()=>[e.createElementVNode("div",W,[l[12]||(l[12]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-info debug-result-tabs__mock-info","aria-hidden":"true"},null,-1)),l[13]||(l[13]=e.createElementVNode("span",null,"当前为 Mock 数据",-1)),e.createVNode(i,{text:"",theme:"primary",size:"small","data-test":"re-edit-mock",onClick:l[2]||(l[2]=E=>s("reEditMock"))},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode(" 重新编辑 ",-1)])]),_:1})])]),key:"0"}:void 0]),1032,["rows","loading","error"])]),_:1}),e.createVNode(u,{name:"logs",label:"调用日志"},{default:e.withCtx(()=>[e.createElementVNode("div",X,[e.createVNode(d.CallLogsViewer,{"log-text":T.value,loading:t.result.logLoading,error:t.result.logError},null,8,["log-text","loading","error"])])]),_:1})]),_:2},[V.value&&t.canRunNodeDebug?{name:"setting",fn:e.withCtx(()=>[e.createElementVNode("div",F,[l[6]||(l[6]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-alert"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(C.value),1),e.createVNode(i,{text:"",theme:"primary","data-test":"rerun-real",onClick:l[0]||(l[0]=E=>s("runReal"))},{default:e.withCtx(()=>[...l[4]||(l[4]=[e.createTextVNode("重新调试",-1)])]),_:1}),l[7]||(l[7]=e.createElementVNode("span",null,"或直接",-1)),e.createVNode(i,{text:"",theme:"primary","data-test":"run-mock",onClick:l[1]||(l[1]=E=>s("runMock"))},{default:e.withCtx(()=>[...l[5]||(l[5]=[e.createTextVNode("Mock 输出",-1)])]),_:1})])]),key:"0"}:void 0]),1032,["active"])])}}}),ee=d._export_sfc(Z,[["__scopeId","data-v-2a925689"]]),te={class:"debug-result-drawer__header"},oe={class:"debug-result-drawer__header-left"},le={class:"debug-result-drawer__body"},se={class:"debug-result-drawer__content"},ne={class:"debug-result-drawer__result"},ae={key:1,class:"debug-result-drawer__unselected","data-test":"node-unselected"},N=44,$=420,ue=e.defineComponent({__name:"index",props:{open:{type:Boolean},context:{},pipelineTree:{},mockNodeIds:{},modelValue:{default:""},result:{},hasGlobalRun:{type:Boolean,default:!1},viewParamsPending:{type:Boolean,default:!1},offsetLeft:{default:0}},emits:["update:open","update:modelValue","reEditMock","runReal","runMock","viewParams","logsTabActive"],setup(c,{emit:g}){const t=c,s=g,r=e.ref($),m=e.ref(!1);let _=0,p=0,k="",w="";const V=e.computed(()=>({left:`${t.offsetLeft}px`,height:`${t.open?r.value:N}px`})),C=()=>{t.open||(r.value=$),s("update:open",!t.open)},x=i=>{const u=i>N;u!==t.open&&s("update:open",u)},y=i=>{const u=p-(i.clientY-_);r.value=Math.max(N,Math.min(window.innerHeight*.8,u)),x(r.value)},a=()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",a),document.body.style.cursor=k,document.body.style.userSelect=w,m.value=!1,r.value<=N&&(r.value=$,s("update:open",!1))},n=i=>{i.preventDefault(),m.value=!0,_=i.clientY,t.open?p=r.value:(s("update:open",!0),r.value=N,p=N),k=document.body.style.cursor,w=document.body.style.userSelect,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",a)};e.onBeforeUnmount(a);const v=e.computed({get:()=>t.modelValue,set:i=>s("update:modelValue",i)});e.watch(()=>t.modelValue,i=>{i||s("logsTabActive",!1)},{immediate:!0});const o=e.computed(()=>d.buildDebugResultNodeItems(t.pipelineTree,t.context?.nodes,t.mockNodeIds)),b=e.computed(()=>t.mockNodeIds.has(t.modelValue)),h=e.computed(()=>d.getActivityComponent(t.pipelineTree?.activities?.[t.modelValue])),B=e.computed(()=>{const i=o.value.find(u=>u.id===t.modelValue);return i?.type==="ServiceActivity"&&i.isConfigured}),R=()=>{!t.hasGlobalRun||t.viewParamsPending||s("viewParams")},T=()=>{t.modelValue&&s("reEditMock",t.modelValue)},f=()=>{t.modelValue&&s("runReal",t.modelValue)},l=()=>{t.modelValue&&s("runMock",t.modelValue)};return(i,u)=>{const S=e.resolveComponent("bk-button"),E=e.resolveDirective("bk-tooltips");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["debug-result-drawer-wrapper",{"is-resizing":m.value}]),style:e.normalizeStyle(V.value)},[e.createElementVNode("div",{class:"debug-result-drawer__resize",onMousedown:n},null,32),e.createElementVNode("section",{class:e.normalizeClass(["debug-result-drawer",{"is-collapsed":!t.open}])},[e.createElementVNode("header",te,[e.createElementVNode("div",oe,[u[3]||(u[3]=e.createElementVNode("span",{class:"debug-result-drawer__title"},"调试结果",-1)),u[4]||(u[4]=e.createElementVNode("span",{class:"debug-result-drawer__divider"},null,-1)),e.withDirectives((e.openBlock(),e.createBlock(S,{text:"",theme:"primary",disabled:!t.hasGlobalRun,loading:t.viewParamsPending,onClick:R},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-audit view-params-icon"},null,-1),e.createTextVNode(" 查看参数 ",-1)])]),_:1},8,["disabled","loading"])),[[E,{content:"请先进行调试",disabled:t.hasGlobalRun}]])]),e.createElementVNode("span",{class:"debug-result-drawer__collapse",onClick:C},[e.createElementVNode("span",null,e.toDisplayString(t.open?"收起":"展开"),1),e.createElementVNode("i",{class:e.normalizeClass(["bkflow-canvas-icon bkflow-canvas-arrows-down debug-result-drawer__collapse-icon",{"is-expanded":t.open}])},null,2)])]),e.createElementVNode("div",le,[e.createElementVNode("div",se,[e.createVNode(H,{modelValue:v.value,"onUpdate:modelValue":u[0]||(u[0]=M=>v.value=M),nodes:o.value},null,8,["modelValue","nodes"]),e.createElementVNode("div",ne,[t.modelValue?(e.openBlock(),e.createBlock(ee,{key:0,result:t.result,component:h.value,"is-mock":b.value,"can-run-node-debug":B.value,onReEditMock:T,onRunReal:f,onRunMock:l,onLogsTabActive:u[1]||(u[1]=M=>s("logsTabActive",M))},null,8,["result","component","is-mock","can-run-node-debug"])):(e.openBlock(),e.createElementBlock("div",ae," 请先选择节点查看调试详情 "))])])])],2)],6)}}}),re=d._export_sfc(ue,[["__scopeId","data-v-1d34ca9a"]]);exports.default=re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),d=require("./index-ClP9Gq3W.cjs"),L={class:"debug-result-node-list"},D=["data-node-id","aria-selected","onClick","onKeydown"],z=["title"],A={key:0,class:"debug-result-node-list__mock","data-test":"node-mock-flag"},P={key:1,class:"debug-result-node-list__empty"},I=e.defineComponent({__name:"node-list",props:{nodes:{},modelValue:{default:""}},emits:["update:modelValue"],setup(c,{emit:g}){const t=c,s=g,r=e.ref(""),m=e.ref("all"),_=e.ref(null),p={not_run:"未执行",finished:"成功",failed:"失败",running:"正在调试",suspended:"挂起",skipped:"跳过",revoked:"终止"},k=[{value:"all",label:"全部"},{value:"finished",icon:"bkflow-canvas-dark-circle-checkbox",iconColor:"#5fb8ac",tooltip:p.finished},{value:"failed",icon:"bkflow-canvas-dark-circle-close",iconColor:"#fa4e41",tooltip:p.failed},{value:"revoked",icon:"bkflow-canvas-stop-fill",iconColor:"#fa4e41",tooltip:p.revoked},{value:"running",iconComponent:d.LoadingStatusIcon,iconColor:"#3a84ff",tooltip:p.running},{value:"not_run",icon:"bkflow-canvas-weizhixing2",iconColor:"#b8bbc4",tooltip:p.not_run},{value:"suspended",icon:"bkflow-canvas-zanting",iconColor:"#f59500",tooltip:p.suspended},{value:"skipped",icon:"bkflow-canvas-tiaoguo2",iconColor:"#6e89af",tooltip:p.skipped}],w=e.computed(()=>k.map(a=>({...a,count:a.value==="all"?t.nodes.length:t.nodes.filter(n=>n.status===a.value).length}))),V=e.computed(()=>{const a=r.value.trim().toLowerCase();return t.nodes.filter(n=>m.value!=="all"&&n.status!==m.value?!1:a?n.name.toLowerCase().includes(a)||n.type.toLowerCase().includes(a)||(n.typeName??"").toLowerCase().includes(a):!0)}),C=e.computed(()=>r.value.trim()?"搜索结果为空":m.value!=="all"?`暂无${p[m.value]}状态节点`:"暂无节点"),x=()=>{r.value="",m.value="all"},y=a=>{const n=_.value,v=n?.querySelector(`[data-node-id="${CSS.escape(a)}"]`);if(!n||!v)return;const o=n.getBoundingClientRect(),b=v.getBoundingClientRect();b.top<o.top?n.scrollTop-=o.top-b.top:b.bottom>o.bottom&&(n.scrollTop+=b.bottom-o.bottom)};return e.watch(()=>t.modelValue,async a=>{if(!a)return;!V.value.some(v=>v.id===a)&&t.nodes.some(v=>v.id===a)&&(r.value="",m.value="all"),await e.nextTick(),y(a)},{flush:"post"}),(a,n)=>{const v=e.resolveComponent("bk-input");return e.openBlock(),e.createElementBlock("aside",L,[e.createVNode(v,{modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=o=>r.value=o),class:"debug-result-node-list__search",placeholder:"搜索节点名称 / 类型",type:"search",clearable:"","data-test":"node-search"},null,8,["modelValue"]),e.createVNode(d.SegmentTabs,{modelValue:m.value,"onUpdate:modelValue":n[1]||(n[1]=o=>m.value=o),class:"debug-result-node-list__filters","data-test":"status-filters",items:w.value},null,8,["modelValue","items"]),V.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"itemsRef",ref:_,class:"debug-result-node-list__items",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["debug-result-node-list__item",`is-${o.status}`,{"is-active":o.id===t.modelValue,"is-unconfigured":!o.isConfigured}]),role:"option","data-test":"node-item","data-node-id":o.id,"aria-selected":o.id===t.modelValue,tabindex:"0",onClick:b=>s("update:modelValue",o.id),onKeydown:e.withKeys(e.withModifiers(b=>s("update:modelValue",o.id),["prevent"]),["enter","space"])},[e.createElementVNode("span",{class:e.normalizeClass(["debug-result-node-list__status",`is-${o.status}`,{"is-placeholder":!o.isConfigured}])},[o.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(o.icon),"data-test":"node-icon"},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",{class:"debug-result-node-list__name",title:o.isConfigured?`${o.name} ${o.typeName||o.type}`:o.name},e.toDisplayString(o.name),9,z),o.isMock?(e.openBlock(),e.createElementBlock("span",A,"MOCK")):e.createCommentVNode("",!0)],42,D))),128))],512)):(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(d.EmptyException,{"is-search":!1,title:C.value,onClear:x},null,8,["title"])]))])}}}),H=d._export_sfc(I,[["__scopeId","data-v-db0cb31c"]]);function U(c){if(c==null)return"";if(typeof c=="string")return c;if(typeof c=="object"){const g=c,t=g.message;if(typeof t=="string"&&t){const s=g.type;return typeof s=="string"&&s?`${s}: ${t}`:t}try{return JSON.stringify(c)}catch{return String(c)}}return String(c)}const O={class:"debug-result-tabs"},F={class:"debug-result-tabs__failed-actions","data-test":"output-error-actions"},G={class:"debug-result-tabs__execution","data-test":"tab-execution"},K={class:"debug-result-tabs__row"},j={class:"value"},q={class:"debug-result-tabs__row"},Y={class:"value"},J={key:0,class:"debug-result-tabs__row is-error"},Q={class:"value"},W={class:"debug-result-tabs__mock-hint","data-test":"mock-banner"},X={class:"debug-result-tabs__logs","data-test":"tab-logs"},Z=e.defineComponent({__name:"result-tabs",props:{result:{},component:{},isMock:{type:Boolean,default:!1},canRunNodeDebug:{type:Boolean,default:!1}},emits:["reEditMock","runReal","runMock","logsTabActive"],setup(c,{emit:g}){const t=c,s=g,r=e.ref("execution");e.watch(r,f=>s("logsTabActive",f==="logs"),{immediate:!0});const m={not_run:"未调试",running:"正在调试",finished:"成功",failed:"失败",suspended:"挂起",skipped:"跳过",revoked:"已终止"},_=e.computed(()=>m[t.result.execution.status]??t.result.execution.status),p=e.computed(()=>d.formatSummaryDuration(t.result.execution.durationMs)),k=e.computed(()=>U(t.result.error||t.result.execution.errorDetail)),w=e.computed(()=>t.result.execution.status==="revoked"),V=e.computed(()=>d.isDebugAbnormalStatus(t.result.execution.status)),C=e.computed(()=>w.value?"该节点调试已终止,可":"该节点执行失败,可"),{loading:x,error:y,visibleInputs:a,visibleOutputs:n,outputNameMap:v}=d.usePluginParamMeta({component:()=>t.component}),o=e.computed(()=>t.result.loading||x.value),b=e.computed(()=>t.result.detailError||y.value),h=e.computed(()=>a.value.filter(({key:f})=>Object.prototype.hasOwnProperty.call(t.result.inputs,f)).map(({key:f,name:l})=>({key:f,name:l,value:t.result.inputs[f]}))),B=e.computed(()=>d.orderDebugRowsByDeclaredKeys(d.toDebugOutputValueRows(t.result.outputs,v.value),n.value.map(f=>f.key))),R=e.computed(()=>d.shouldShowMockReEditHint(t.isMock,n.value)),T=e.computed(()=>t.result.logs==null?"":d.normalizeLogText(t.result.logs));return(f,l)=>{const i=e.resolveComponent("bk-button"),u=e.resolveComponent("bk-tab-panel"),S=e.resolveComponent("bk-tab");return e.openBlock(),e.createElementBlock("div",O,[e.createVNode(S,{active:r.value,"onUpdate:active":l[3]||(l[3]=E=>r.value=E),type:"card-grid"},e.createSlots({default:e.withCtx(()=>[e.createVNode(u,{name:"execution",label:"执行信息"},{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createElementVNode("div",K,[l[8]||(l[8]=e.createElementVNode("span",{class:"label"},"执行状态",-1)),e.createElementVNode("span",j,e.toDisplayString(_.value),1)]),e.createElementVNode("div",q,[l[9]||(l[9]=e.createElementVNode("span",{class:"label"},"调试用时",-1)),e.createElementVNode("span",Y,e.toDisplayString(p.value),1)]),k.value?(e.openBlock(),e.createElementBlock("div",J,[l[10]||(l[10]=e.createElementVNode("span",{class:"label"},"错误信息",-1)),e.createElementVNode("span",Q,e.toDisplayString(k.value),1)])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(u,{name:"inputs",label:"输入参数"},{default:e.withCtx(()=>[e.createVNode(d.DebugValueTable,{rows:h.value,loading:o.value,error:b.value,"empty-text":"暂无输入参数"},null,8,["rows","loading","error"])]),_:1}),e.createVNode(u,{name:"outputs",label:"输出结果"},{default:e.withCtx(()=>[e.createVNode(d.DebugValueTable,{rows:B.value,loading:o.value,error:b.value,"empty-text":"暂无输出结果"},e.createSlots({_:2},[R.value?{name:"toolbar",fn:e.withCtx(()=>[e.createElementVNode("div",W,[l[12]||(l[12]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-info debug-result-tabs__mock-info","aria-hidden":"true"},null,-1)),l[13]||(l[13]=e.createElementVNode("span",null,"当前为 Mock 数据",-1)),e.createVNode(i,{text:"",theme:"primary",size:"small","data-test":"re-edit-mock",onClick:l[2]||(l[2]=E=>s("reEditMock"))},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode(" 重新编辑 ",-1)])]),_:1})])]),key:"0"}:void 0]),1032,["rows","loading","error"])]),_:1}),e.createVNode(u,{name:"logs",label:"调用日志"},{default:e.withCtx(()=>[e.createElementVNode("div",X,[e.createVNode(d.CallLogsViewer,{"log-text":T.value,loading:t.result.logLoading,error:t.result.logError},null,8,["log-text","loading","error"])])]),_:1})]),_:2},[V.value&&t.canRunNodeDebug?{name:"setting",fn:e.withCtx(()=>[e.createElementVNode("div",F,[l[6]||(l[6]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-alert"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(C.value),1),e.createVNode(i,{text:"",theme:"primary","data-test":"rerun-real",onClick:l[0]||(l[0]=E=>s("runReal"))},{default:e.withCtx(()=>[...l[4]||(l[4]=[e.createTextVNode("重新调试",-1)])]),_:1}),l[7]||(l[7]=e.createElementVNode("span",null,"或直接",-1)),e.createVNode(i,{text:"",theme:"primary","data-test":"run-mock",onClick:l[1]||(l[1]=E=>s("runMock"))},{default:e.withCtx(()=>[...l[5]||(l[5]=[e.createTextVNode("Mock 输出",-1)])]),_:1})])]),key:"0"}:void 0]),1032,["active"])])}}}),ee=d._export_sfc(Z,[["__scopeId","data-v-2a925689"]]),te={class:"debug-result-drawer__header"},oe={class:"debug-result-drawer__header-left"},le={class:"debug-result-drawer__body"},se={class:"debug-result-drawer__content"},ne={class:"debug-result-drawer__result"},ae={key:1,class:"debug-result-drawer__unselected","data-test":"node-unselected"},N=44,$=420,ue=e.defineComponent({__name:"index",props:{open:{type:Boolean},context:{},pipelineTree:{},mockNodeIds:{},modelValue:{default:""},result:{},hasGlobalRun:{type:Boolean,default:!1},viewParamsPending:{type:Boolean,default:!1},offsetLeft:{default:0}},emits:["update:open","update:modelValue","reEditMock","runReal","runMock","viewParams","logsTabActive"],setup(c,{emit:g}){const t=c,s=g,r=e.ref($),m=e.ref(!1);let _=0,p=0,k="",w="";const V=e.computed(()=>({left:`${t.offsetLeft}px`,height:`${t.open?r.value:N}px`})),C=()=>{t.open||(r.value=$),s("update:open",!t.open)},x=i=>{const u=i>N;u!==t.open&&s("update:open",u)},y=i=>{const u=p-(i.clientY-_);r.value=Math.max(N,Math.min(window.innerHeight*.8,u)),x(r.value)},a=()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",a),document.body.style.cursor=k,document.body.style.userSelect=w,m.value=!1,r.value<=N&&(r.value=$,s("update:open",!1))},n=i=>{i.preventDefault(),m.value=!0,_=i.clientY,t.open?p=r.value:(s("update:open",!0),r.value=N,p=N),k=document.body.style.cursor,w=document.body.style.userSelect,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",a)};e.onBeforeUnmount(a);const v=e.computed({get:()=>t.modelValue,set:i=>s("update:modelValue",i)});e.watch(()=>t.modelValue,i=>{i||s("logsTabActive",!1)},{immediate:!0});const o=e.computed(()=>d.buildDebugResultNodeItems(t.pipelineTree,t.context?.nodes,t.mockNodeIds)),b=e.computed(()=>t.mockNodeIds.has(t.modelValue)),h=e.computed(()=>d.getActivityComponent(t.pipelineTree?.activities?.[t.modelValue])),B=e.computed(()=>{const i=o.value.find(u=>u.id===t.modelValue);return i?.type==="ServiceActivity"&&i.isConfigured}),R=()=>{!t.hasGlobalRun||t.viewParamsPending||s("viewParams")},T=()=>{t.modelValue&&s("reEditMock",t.modelValue)},f=()=>{t.modelValue&&s("runReal",t.modelValue)},l=()=>{t.modelValue&&s("runMock",t.modelValue)};return(i,u)=>{const S=e.resolveComponent("bk-button"),E=e.resolveDirective("bk-tooltips");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["debug-result-drawer-wrapper",{"is-resizing":m.value}]),style:e.normalizeStyle(V.value)},[e.createElementVNode("div",{class:"debug-result-drawer__resize",onMousedown:n},null,32),e.createElementVNode("section",{class:e.normalizeClass(["debug-result-drawer",{"is-collapsed":!t.open}])},[e.createElementVNode("header",te,[e.createElementVNode("div",oe,[u[3]||(u[3]=e.createElementVNode("span",{class:"debug-result-drawer__title"},"调试结果",-1)),u[4]||(u[4]=e.createElementVNode("span",{class:"debug-result-drawer__divider"},null,-1)),e.withDirectives((e.openBlock(),e.createBlock(S,{text:"",theme:"primary",disabled:!t.hasGlobalRun,loading:t.viewParamsPending,onClick:R},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-audit view-params-icon"},null,-1),e.createTextVNode(" 查看参数 ",-1)])]),_:1},8,["disabled","loading"])),[[E,{content:"请先进行调试",disabled:t.hasGlobalRun}]])]),e.createElementVNode("span",{class:"debug-result-drawer__collapse",onClick:C},[e.createElementVNode("span",null,e.toDisplayString(t.open?"收起":"展开"),1),e.createElementVNode("i",{class:e.normalizeClass(["bkflow-canvas-icon bkflow-canvas-arrows-down debug-result-drawer__collapse-icon",{"is-expanded":t.open}])},null,2)])]),e.createElementVNode("div",le,[e.createElementVNode("div",se,[e.createVNode(H,{modelValue:v.value,"onUpdate:modelValue":u[0]||(u[0]=M=>v.value=M),nodes:o.value},null,8,["modelValue","nodes"]),e.createElementVNode("div",ne,[t.modelValue?(e.openBlock(),e.createBlock(ee,{key:0,result:t.result,component:h.value,"is-mock":b.value,"can-run-node-debug":B.value,onReEditMock:T,onRunReal:f,onRunMock:l,onLogsTabActive:u[1]||(u[1]=M=>s("logsTabActive",M))},null,8,["result","component","is-mock","can-run-node-debug"])):(e.openBlock(),e.createElementBlock("div",ae," 请先选择节点查看调试详情 "))])])])],2)],6)}}}),re=d._export_sfc(ue,[["__scopeId","data-v-1d34ca9a"]]);exports.default=re;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),M=require("bkui-vue/lib"),N=require("bkui-vue/lib/message"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),M=require("bkui-vue/lib"),N=require("bkui-vue/lib/message"),s=require("./index-ClP9Gq3W.cjs"),O={key:0,class:"mock-data-sideslider__title-sep"},F=["title"],S={class:"mock-data-sideslider"},D={class:"mock-data-sideslider__footer"},j="当前节点的输出不支持mock,是否需要在调试时跳过当前节点?",q="跳过调试",Y=e.defineComponent({__name:"index",props:{show:{type:Boolean},node:{default:null},outputs:{default:()=>({})},pending:{type:Boolean,default:!1}},emits:["confirm","close","update:show"],setup(f,{emit:y}){const o=f,p=y,h=s.useFlowApiConfig(),k=e.ref(!1),u=e.shallowRef([]),d=e.ref({}),_=e.ref({}),m=e.ref(!1),b=e.computed(()=>m.value?j:"暂无输出结果"),C=e.computed(()=>m.value?q:"确定"),w=async()=>{if(o.node){k.value=!0,_.value={},m.value=!1;try{const t=await s.pluginDetailRequest(h,o.node.component);u.value=s.mergeOutputs(t.outputs??[]),m.value=s.hasOnlySystemOutputs(t.outputs);const n=o.outputs??{},a={};u.value.forEach(l=>{const c=Object.prototype.hasOwnProperty.call(n,l.key)?n[l.key]:l.type==="object"?{}:void 0,r=s.resolveMockFormControl(l);a[l.key]=r==="json-editor"||r==="data-table"?s.formatJsonFieldValue(c):c}),d.value=a}catch(t){console.error(t),u.value=[],d.value={},m.value=!1,N({theme:"error",message:"加载输出结果失败"})}finally{k.value=!1}}},g=()=>{const t={},n={};return u.value.forEach(a=>{const l=d.value[a.key],c=s.resolveMockFormControl(a);if(c==="json-editor"||c==="data-table"){const r=s.parseJsonFieldValue(l);if(!r.valid){t[a.key]=r.message;return}r.value!==void 0&&(n[a.key]=r.value);return}l!==void 0&&l!==""&&(n[a.key]=l)}),{errors:t,outputs:n}},x=t=>{M.InfoBox({title:"确认 Mock 输出?",content:"Mock 输出将覆盖当前输出结果,执行时跳过该节点并以 Mock 值替代实际输出",confirmText:"确定",cancelText:"取消",width:400,onConfirm:()=>{t()}})},V=()=>{if(m.value){p("confirm",{outputs:{}});return}const{errors:t,outputs:n}=g();_.value=t,!(Object.keys(t).length>0)&&x(()=>p("confirm",{outputs:n}))},v=()=>{p("close"),p("update:show",!1)};return e.watch(()=>[o.show,o.node?.id],([t])=>{t&&o.node&&(d.value=s.cloneDeep(o.outputs??{}),w())},{immediate:!0}),(t,n)=>{const a=e.resolveComponent("bk-form-item"),l=e.resolveComponent("bk-form"),c=e.resolveComponent("bk-exception"),r=e.resolveComponent("bk-button"),B=e.resolveComponent("bk-sideslider"),E=e.resolveDirective("bkloading");return e.openBlock(),e.createBlock(B,{"is-show":o.show,width:960,"quick-close":"","esc-close":!1,onClosed:v},{header:e.withCtx(()=>[n[0]||(n[0]=e.createElementVNode("span",{class:"mock-data-sideslider__title"},"Mock输出",-1)),o.node?.name?(e.openBlock(),e.createElementBlock("span",O,"-")):e.createCommentVNode("",!0),o.node?.name?(e.openBlock(),e.createElementBlock("span",{key:1,class:"mock-data-sideslider__title-node",title:o.node.name},e.toDisplayString(o.node.name),9,F)):e.createCommentVNode("",!0)]),footer:e.withCtx(()=>[e.createElementVNode("div",D,[e.createVNode(r,{theme:"primary","data-test":"mock-confirm",loading:o.pending,onClick:V},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.value),1)]),_:1},8,["loading"]),e.createVNode(r,{disabled:o.pending,onClick:v},{default:e.withCtx(()=>[...n[1]||(n[1]=[e.createTextVNode("取消",-1)])]),_:1},8,["disabled"])])]),default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",S,[u.value.length>0?(e.openBlock(),e.createBlock(l,{key:0,"form-type":"vertical","label-width":120,"data-test":"mock-outputs-form"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,i=>(e.openBlock(),e.createBlock(a,{key:i.key,label:i.name||i.key},{default:e.withCtx(()=>[e.createVNode(s.MockFieldRenderer,{modelValue:d.value[i.key],"onUpdate:modelValue":T=>d.value[i.key]=T,field:i,error:_.value[i.key]},null,8,["modelValue","onUpdate:modelValue","field","error"])]),_:2},1032,["label"]))),128))]),_:1})):k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(c,{key:1,class:"mock-data-sideslider__exception",scene:"part",type:"empty",title:b.value},null,8,["title"]))])),[[E,{loading:k.value}]])]),_:1},8,["is-show"])}}}),I=s._export_sfc(Y,[["__scopeId","data-v-c4e2476a"]]);exports.default=I;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as A, ref as V, shallowRef as x, computed as C, watch as U, resolveComponent as j, resolveDirective as K, openBlock as l, createBlock as f, createSlots as S, withCtx as y, withDirectives as G, createElementBlock as d, createElementVNode as i, createCommentVNode as v, Fragment as H, renderList as J, toDisplayString as B, unref as Y, createVNode as R, createTextVNode as E } from "vue";
|
|
2
|
-
import { c as _, u as z, i as M, b as Q, d as W, g as X, D as Z, B as ee, R as te, E as ae, _ as oe } from "./index-
|
|
2
|
+
import { c as _, u as z, i as M, b as Q, d as W, g as X, D as Z, B as ee, R as te, E as ae, _ as oe } from "./index-CwMEGzur.js";
|
|
3
3
|
import "bkui-vue/lib/message";
|
|
4
4
|
import "bkui-vue/lib/icon";
|
|
5
5
|
import "monaco-editor";
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-ClP9Gq3W.cjs"),o=require("./context-Bj442dps.cjs");exports.BkFlowCanvas=e.BkFlowCanvas;exports.BkFlowModelAccessor=e.BkFlowModelAccessor;exports.BkFlowNodeAccessor=e.BkFlowNodeAccessor;exports.FlowCreateTask=e.FlowCreateTask;exports.FlowDebug=e.FlowDebug;exports.FlowDetail=e.index;exports.FlowEdit=e.edit;exports.FlowExecute=e.execute;exports.FlowMockDebug=e.mock;exports.FlowView=e.view;exports.bkflowConnectionValidator=e.bkflowConnectionValidator;exports.createBkflowPlugin=e.createBkflowPlugin;exports.createBkflowSchema=e.createBkflowSchema;exports.createExecutionStatusPlugin=e.createExecutionStatusPlugin;exports.default=e.index$1;exports.exportToPipelineTree=e.exportToPipelineTree;exports.getUniformApiPluginFormValue=e.getUniformApiPluginFormValue;exports.getVariableDefaultConfig=e.getVariableDefaultConfig;exports.importFromPipelineTree=e.importFromPipelineTree;exports.isMockableNode=e.isMockableNode;exports.mergeOutputs=e.mergeOutputs;exports.normalizePluginOutputItems=e.normalizePluginOutputItems;exports.provideFilterVariableConfig=e.provideFilterVariableConfig;exports.provideFlowApiConfig=e.provideFlowApiConfig;exports.provideMemberSelectorConfig=e.provideMemberSelectorConfig;exports.provideSelectPanelConfig=e.provideSelectPanelConfig;exports.resolveExecutionActions=e.resolveExecutionActions;exports.resolveMockFormControl=e.resolveMockFormControl;exports.useFlowApiConfig=e.useFlowApiConfig;exports.useFlowEditApiConfig=e.useFlowEditApiConfig;exports.useFlowViewApiConfig=e.useFlowViewApiConfig;exports.useMemberSelectorConfig=e.useMemberSelectorConfig;exports.useSelectPanelConfig=e.useSelectPanelConfig;exports.validatePipelineTree=e.validatePipelineTree;exports.generateId=o.generateId;exports.random4=o.random4;
|
package/dist/index.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ type PortOrientation = 'Top' | 'Right' | 'Bottom' | 'Left';
|
|
|
124
124
|
|
|
125
125
|
type GatewayType = 'ExclusiveGateway' | 'ParallelGateway' | 'ConditionalParallelGateway' | 'ConvergeGateway';
|
|
126
126
|
|
|
127
|
-
type NodeType = StartEvent | EndEvent | Activity | SubProcessActivity | Gateway;
|
|
127
|
+
type NodeType = StartEvent | EndEvent | Activity | SubProcessActivity | SubCanvasActivity | Gateway;
|
|
128
128
|
|
|
129
129
|
interface PluginInputDataItem {
|
|
130
130
|
value:
|
|
@@ -193,6 +193,7 @@ interface Activity {
|
|
|
193
193
|
loop?: number | null;
|
|
194
194
|
/** 执行态:生命周期阶段 */
|
|
195
195
|
phase?: number;
|
|
196
|
+
parent?: string | null;
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
/**
|
|
@@ -284,7 +285,51 @@ interface SubProcessActivity {
|
|
|
284
285
|
phase?: number;
|
|
285
286
|
}
|
|
286
287
|
|
|
287
|
-
|
|
288
|
+
/**
|
|
289
|
+
* 循环体容器节点(SubCanvas)节点。
|
|
290
|
+
*/
|
|
291
|
+
interface SubCanvasActivity {
|
|
292
|
+
id: string;
|
|
293
|
+
name: string;
|
|
294
|
+
stage_name?: string;
|
|
295
|
+
type: 'SubCanvas';
|
|
296
|
+
incoming: string[];
|
|
297
|
+
outgoing: string;
|
|
298
|
+
optional?: boolean;
|
|
299
|
+
/** 循环执行配置 */
|
|
300
|
+
loop_config?: LoopConfig;
|
|
301
|
+
/** 嵌套的完整子流程 */
|
|
302
|
+
pipeline: PipelineTree;
|
|
303
|
+
/** 节点标签 */
|
|
304
|
+
labels?: string[];
|
|
305
|
+
status?: NodeExecutionStatus;
|
|
306
|
+
/** 执行态:循环执行次数(未执行时为 null) */
|
|
307
|
+
loop?: number | null;
|
|
308
|
+
error_ignorable?: boolean;
|
|
309
|
+
retryable?: boolean;
|
|
310
|
+
skippable?: boolean;
|
|
311
|
+
auto_retry?: {
|
|
312
|
+
enable: boolean;
|
|
313
|
+
interval: number;
|
|
314
|
+
times: number;
|
|
315
|
+
};
|
|
316
|
+
timeout_config?: {
|
|
317
|
+
enable: boolean;
|
|
318
|
+
seconds: number;
|
|
319
|
+
action: string;
|
|
320
|
+
};
|
|
321
|
+
/** 执行态:实际重试次数 */
|
|
322
|
+
retry?: number;
|
|
323
|
+
/** 执行态:是否被跳过 */
|
|
324
|
+
skip?: boolean;
|
|
325
|
+
/** 执行态:是否自动忽略错误 */
|
|
326
|
+
error_ignored?: boolean;
|
|
327
|
+
/** 执行态:生命周期阶段 */
|
|
328
|
+
phase?: number;
|
|
329
|
+
parent?: string | null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
type ActivityUnion = Activity | SubProcessActivity | SubCanvasActivity;
|
|
288
333
|
|
|
289
334
|
interface StartEvent {
|
|
290
335
|
id: string;
|
|
@@ -327,6 +372,7 @@ interface Gateway {
|
|
|
327
372
|
parse_lang?: 'boolrule' | 'FEEL' | 'MAKO';
|
|
328
373
|
};
|
|
329
374
|
status?: NodeExecutionStatus;
|
|
375
|
+
parent?: string | null;
|
|
330
376
|
}
|
|
331
377
|
|
|
332
378
|
interface Flow {
|
|
@@ -343,15 +389,20 @@ interface Location {
|
|
|
343
389
|
| 'endpoint'
|
|
344
390
|
| 'tasknode'
|
|
345
391
|
| 'subflow'
|
|
392
|
+
| 'SubCanvas'
|
|
346
393
|
| 'branchgateway'
|
|
347
394
|
| 'convergegateway'
|
|
348
395
|
| 'parallelgateway'
|
|
349
396
|
| 'conditionalparallelgateway';
|
|
350
397
|
x: number;
|
|
351
398
|
y: number;
|
|
399
|
+
/** 容器节点(SubCanvas)resize 后持久化的尺寸 */
|
|
400
|
+
width?: number;
|
|
401
|
+
height?: number;
|
|
352
402
|
group?: string;
|
|
353
403
|
icon?: string;
|
|
354
404
|
name?: string;
|
|
405
|
+
parent?: string | boolean;
|
|
355
406
|
}
|
|
356
407
|
|
|
357
408
|
interface Line {
|
|
@@ -1613,9 +1664,29 @@ type __VLS_Props$5 = {
|
|
|
1613
1664
|
apiConfig: FlowApiConfig;
|
|
1614
1665
|
bkflowSaasUrl?: string;
|
|
1615
1666
|
showHeader?: boolean;
|
|
1667
|
+
showNodeActions?: boolean;
|
|
1668
|
+
autoFitView?: boolean;
|
|
1616
1669
|
onBack?: () => void;
|
|
1617
1670
|
};
|
|
1618
|
-
|
|
1671
|
+
/**
|
|
1672
|
+
* 网关条件数据
|
|
1673
|
+
*/
|
|
1674
|
+
interface GatewayConditionClickData {
|
|
1675
|
+
id: string;
|
|
1676
|
+
nodeId: string;
|
|
1677
|
+
name: string;
|
|
1678
|
+
value: string;
|
|
1679
|
+
tag: string;
|
|
1680
|
+
loc?: number;
|
|
1681
|
+
isDefault?: boolean;
|
|
1682
|
+
}
|
|
1683
|
+
declare function focusNode(nodeId: string, options?: {
|
|
1684
|
+
select?: boolean;
|
|
1685
|
+
highlight?: boolean;
|
|
1686
|
+
}): boolean;
|
|
1687
|
+
declare const __VLS_base$5: vue.DefineComponent<__VLS_Props$5, {
|
|
1688
|
+
focusNode: typeof focusNode;
|
|
1689
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
1619
1690
|
retry: (nodeId: string) => any;
|
|
1620
1691
|
skip: (nodeId: string) => any;
|
|
1621
1692
|
resume: (nodeId: string) => any;
|
|
@@ -1629,6 +1700,8 @@ declare const __VLS_base$5: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, v
|
|
|
1629
1700
|
nodeId: string;
|
|
1630
1701
|
} & {
|
|
1631
1702
|
type: "node.click";
|
|
1703
|
+
nodeId: string;
|
|
1704
|
+
condition?: GatewayConditionClickData;
|
|
1632
1705
|
}) => any;
|
|
1633
1706
|
"execution-action": (payload: {
|
|
1634
1707
|
nodeId: string;
|
|
@@ -1648,6 +1721,8 @@ declare const __VLS_base$5: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, v
|
|
|
1648
1721
|
nodeId: string;
|
|
1649
1722
|
} & {
|
|
1650
1723
|
type: "node.click";
|
|
1724
|
+
nodeId: string;
|
|
1725
|
+
condition?: GatewayConditionClickData;
|
|
1651
1726
|
}) => any) | undefined;
|
|
1652
1727
|
"onExecution-action"?: ((payload: {
|
|
1653
1728
|
nodeId: string;
|
|
@@ -1657,6 +1732,8 @@ declare const __VLS_base$5: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, v
|
|
|
1657
1732
|
showHeader: boolean;
|
|
1658
1733
|
defaultZoom: number;
|
|
1659
1734
|
nodeStates: TaskExecutionStates;
|
|
1735
|
+
showNodeActions: boolean;
|
|
1736
|
+
autoFitView: boolean;
|
|
1660
1737
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
1661
1738
|
declare const __VLS_export$5: __VLS_WithSlots$5<typeof __VLS_base$5, __VLS_Slots$5>;
|
|
1662
1739
|
declare const _default$6: typeof __VLS_export$5;
|
|
@@ -2343,6 +2420,7 @@ declare function exportToPipelineTree(flowModel: FlowModel): PipelineTree;
|
|
|
2343
2420
|
* - node.remove:主动查找将被级联删除的边,清理对应网关条件;
|
|
2344
2421
|
* 若删除的是分支网关,级联删除关联的 placeholder 节点;
|
|
2345
2422
|
* 同时清理全局变量中对被删除节点的 source_info 引用,并删除已无引用的变量
|
|
2423
|
+
* - node.move / node.set-extensions(parentId):循环容器大小自适应(子节点移动后容器包住内容)
|
|
2346
2424
|
*/
|
|
2347
2425
|
declare function createBkflowPlugin(): CanvasPlugin;
|
|
2348
2426
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),Qe=require("bkui-vue");var dr=Object.create,Gn=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,hr=Object.getOwnPropertyNames,pr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty,vr=(u,f)=>()=>(f||u((f={exports:{}}).exports,f),f.exports),mr=(u,f,c,o)=>{if(f&&typeof f=="object"||typeof f=="function")for(var l=hr(f),v=0,g=l.length,b;v<g;v++)b=l[v],!gr.call(u,b)&&b!==c&&Gn(u,b,{get:(S=>f[S]).bind(null,b),enumerable:!(o=fr(f,b))||o.enumerable});return u},yr=(u,f,c)=>(c=u!=null?dr(pr(u)):{},mr(!u||!u.__esModule?Gn(c,"default",{value:u,enumerable:!0}):c,u)),br=yr(vr(((u,f)=>{(function(c,o){typeof u=="object"&&typeof f<"u"?f.exports=o():typeof define=="function"&&define.amd?define(o):(c=c||self,c.Sortable=o())})(u,(function(){function c(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function o(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){v(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 l(r){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?l=function(e){return typeof e}:l=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(r)}function v(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function g(){return g=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},g.apply(this,arguments)}function b(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function S(r,e){if(r==null)return{};var t=b(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i<s.length;i++)n=s[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function P(r){return z(r)||k(r)||F(r)||ne()}function z(r){if(Array.isArray(r))return L(r)}function k(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function F(r,e){if(r){if(typeof r=="string")return L(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 L(r,e)}}function L(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 ne(){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 De="1.15.6";function re(r){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(r)}var N=re(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Y=re(/Edge/i),me=re(/firefox/i),ye=re(/safari/i)&&!re(/chrome/i)&&!re(/android/i),pe=re(/iP(ad|od|hone)/i),R=re(/chrome/i)&&re(/android/i),Pe={capture:!1,passive:!1};function O(r,e,t){r.addEventListener(e,t,!N&&Pe)}function T(r,e,t){r.removeEventListener(e,t,!N&&Pe)}function te(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 se(r){return r.host&&r!==document&&r.host.nodeType?r.host:r.parentNode}function X(r,e,t,n){if(r){t=t||document;do{if(e!=null&&(e[0]===">"?r.parentNode===t&&te(r,e):te(r,e))||n&&r===t)return r;if(r===t)break}while(r=se(r))}return null}var Te=/\s+/g;function E(r,e,t){r&&e&&(r.classList?r.classList[t?"add":"remove"](e):r.className=((" "+r.className+" ").replace(Te," ").replace(" "+e+" "," ")+(t?" "+e:"")).replace(Te," "))}function U(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 qe(r,e){var t="";if(typeof r=="string")t=r;else do{var n=U(r,"transform");n&&n!=="none"&&(t=n+" "+t)}while(!e&&(r=r.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(t)}function yt(r,e,t){if(r){var n=r.getElementsByTagName(e),i=0,s=n.length;if(t)for(;i<s;i++)t(n[i],i);return n}return[]}function ge(){var r=document.scrollingElement;return r||document.documentElement}function W(r,e,t,n,i){if(!(!r.getBoundingClientRect&&r!==window)){var s,d,p,m,y,D,_;if(r!==window&&r.parentNode&&r!==ge()?(s=r.getBoundingClientRect(),d=s.top,p=s.left,m=s.bottom,y=s.right,D=s.height,_=s.width):(d=0,p=0,m=window.innerHeight,y=window.innerWidth,D=window.innerHeight,_=window.innerWidth),(e||t)&&r!==window&&(i=i||r.parentNode,!N))do if(i&&i.getBoundingClientRect&&(U(i,"transform")!=="none"||t&&U(i,"position")!=="static")){var x=i.getBoundingClientRect();d-=x.top+parseInt(U(i,"border-top-width")),p-=x.left+parseInt(U(i,"border-left-width")),m=d+s.height,y=p+s.width;break}while(i=i.parentNode);if(n&&r!==window){var G=qe(i||r),V=G&&G.a,j=G&&G.d;G&&(d/=j,p/=V,_/=V,D/=j,m=d+D,y=p+_)}return{top:d,left:p,bottom:m,right:y,width:_,height:D}}}function Ge(r,e,t){for(var n=Re(r,!0),i=W(r)[e];n;){var s=W(n)[t],d=void 0;if(d=i>=s,!d)return n;if(n===ge())break;n=Re(n,!1)}return!1}function Ze(r,e,t,n){for(var i=0,s=0,d=r.children;s<d.length;){if(d[s].style.display!=="none"&&d[s]!==A.ghost&&(n||d[s]!==A.dragged)&&X(d[s],t.draggable,r,!1)){if(i===e)return d[s];i++}s++}return null}function kt(r,e){for(var t=r.lastElementChild;t&&(t===A.ghost||U(t,"display")==="none"||e&&!te(t,e));)t=t.previousElementSibling;return t||null}function Q(r,e){var t=0;if(!r||!r.parentNode)return-1;for(;r=r.previousElementSibling;)r.nodeName.toUpperCase()!=="TEMPLATE"&&r!==A.clone&&(!e||te(r,e))&&t++;return t}function bt(r){var e=0,t=0,n=ge();if(r)do{var i=qe(r),s=i.a,d=i.d;e+=r.scrollLeft*s,t+=r.scrollTop*d}while(r!==n&&(r=r.parentNode));return[e,t]}function Je(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 Re(r,e){if(!r||!r.getBoundingClientRect)return ge();var t=r,n=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var i=U(t);if(t.clientWidth<t.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return ge();if(n||e)return t;n=!0}}while(t=t.parentNode);return ge()}function hn(r,e){if(r&&e)for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}function Tt(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 it;function $e(r,e){return function(){if(!it){var t=arguments,n=this;t.length===1?r.call(n,t[0]):r.apply(n,t),it=setTimeout(function(){it=void 0},e)}}}function lt(){clearTimeout(it),it=void 0}function wt(r,e,t){r.scrollLeft+=e,r.scrollTop+=t}function At(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 Xt(r,e){U(r,"position","absolute"),U(r,"top",e.top),U(r,"left",e.left),U(r,"width",e.width),U(r,"height",e.height)}function Ct(r){U(r,"position",""),U(r,"top",""),U(r,"left",""),U(r,"width",""),U(r,"height","")}function et(r,e,t){var n={};return Array.from(r.children).forEach(function(i){var s,d,p,m;if(!(!X(i,e.draggable,r,!1)||i.animated||i===t)){var y=W(i);n.left=Math.min((s=n.left)!==null&&s!==void 0?s:1/0,y.left),n.top=Math.min((d=n.top)!==null&&d!==void 0?d:1/0,y.top),n.right=Math.max((p=n.right)!==null&&p!==void 0?p:-1/0,y.right),n.bottom=Math.max((m=n.bottom)!==null&&m!==void 0?m:-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 ae="Sortable"+new Date().getTime();function _t(){var r=[],e;return{captureAnimationState:function(){r=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(n){if(!(U(n,"display")==="none"||n===A.ghost)){r.push({target:n,rect:W(n)});var i=o({},r[r.length-1].rect);if(n.thisAnimationDuration){var s=qe(n,!0);s&&(i.top-=s.f,i.left-=s.e)}n.fromRect=i}})},addAnimationState:function(n){r.push(n)},removeAnimationState:function(n){r.splice(Je(r,{target:n}),1)},animateAll:function(n){var i=this;if(!this.options.animation){clearTimeout(e),typeof n=="function"&&n();return}var s=!1,d=0;r.forEach(function(p){var m=0,y=p.target,D=y.fromRect,_=W(y),x=y.prevFromRect,G=y.prevToRect,V=p.rect,j=qe(y,!0);j&&(_.top-=j.f,_.left-=j.e),y.toRect=_,y.thisAnimationDuration&&Tt(x,_)&&!Tt(D,_)&&(V.top-_.top)/(V.left-_.left)===(D.top-_.top)/(D.left-_.left)&&(m=Ot(V,x,G,i.options)),Tt(_,D)||(y.prevFromRect=D,y.prevToRect=_,m||(m=i.options.animation),i.animate(y,V,_,m)),m&&(s=!0,d=Math.max(d,m),clearTimeout(y.animationResetTimer),y.animationResetTimer=setTimeout(function(){y.animationTime=0,y.prevFromRect=null,y.fromRect=null,y.prevToRect=null,y.thisAnimationDuration=null},m),y.thisAnimationDuration=m)}),clearTimeout(e),s?e=setTimeout(function(){typeof n=="function"&&n()},d):typeof n=="function"&&n(),r=[]},animate:function(n,i,s,d){if(d){U(n,"transition",""),U(n,"transform","");var p=qe(this.el),m=p&&p.a,y=p&&p.d,D=(i.left-s.left)/(m||1),_=(i.top-s.top)/(y||1);n.animatingX=!!D,n.animatingY=!!_,U(n,"transform","translate3d("+D+"px,"+_+"px,0)"),this.forRepaintDummy=St(n),U(n,"transition","transform "+d+"ms"+(this.options.easing?" "+this.options.easing:"")),U(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){U(n,"transition",""),U(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},d)}}}}function St(r){return r.offsetWidth}function Ot(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 Ae=[],Bt={initializeByDefault:!0},st={mount:function(e){for(var t in Bt)Bt.hasOwnProperty(t)&&!(t in e)&&(e[t]=Bt[t]);Ae.forEach(function(n){if(n.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),Ae.push(e)},pluginEvent:function(e,t,n){var i=this;this.eventCanceled=!1,n.cancel=function(){i.eventCanceled=!0};var s=e+"Global";Ae.forEach(function(d){t[d.pluginName]&&(t[d.pluginName][s]&&t[d.pluginName][s](o({sortable:t},n)),t.options[d.pluginName]&&t[d.pluginName][e]&&t[d.pluginName][e](o({sortable:t},n)))})},initializePlugins:function(e,t,n,i){Ae.forEach(function(p){var m=p.pluginName;if(!(!e.options[m]&&!p.initializeByDefault)){var y=new p(e,t,e.options);y.sortable=e,y.options=e.options,e[m]=y,g(n,y.defaults)}});for(var s in e.options)if(e.options.hasOwnProperty(s)){var d=this.modifyOption(e,s,e.options[s]);typeof d<"u"&&(e.options[s]=d)}},getEventProperties:function(e,t){var n={};return Ae.forEach(function(i){typeof i.eventProperties=="function"&&g(n,i.eventProperties.call(t[i.pluginName],e))}),n},modifyOption:function(e,t,n){var i;return Ae.forEach(function(s){e[s.pluginName]&&s.optionListeners&&typeof s.optionListeners[t]=="function"&&(i=s.optionListeners[t].call(e[s.pluginName],n))}),i}};function ze(r){var e=r.sortable,t=r.rootEl,n=r.name,i=r.targetEl,s=r.cloneEl,d=r.toEl,p=r.fromEl,m=r.oldIndex,y=r.newIndex,D=r.oldDraggableIndex,_=r.newDraggableIndex,x=r.originalEvent,G=r.putSortable,V=r.extraEventProperties;if(e=e||t&&t[ae],!!e){var j,Ce=e.options,ke="on"+n.charAt(0).toUpperCase()+n.substr(1);window.CustomEvent&&!N&&!Y?j=new CustomEvent(n,{bubbles:!0,cancelable:!0}):(j=document.createEvent("Event"),j.initEvent(n,!0,!0)),j.to=d||t,j.from=p||t,j.item=i||t,j.clone=s,j.oldIndex=m,j.newIndex=y,j.oldDraggableIndex=D,j.newDraggableIndex=_,j.originalEvent=x,j.pullMode=G?G.lastPutMode:void 0;var q=o(o({},V),st.getEventProperties(n,e));for(var $ in q)j[$]=q[$];t&&t.dispatchEvent(j),Ce[ke]&&Ce[ke].call(e,j)}}var Qt=["evt"],ue=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=n.evt,s=S(n,Qt);st.pluginEvent.bind(A)(e,t,o({dragEl:w,parentEl:ee,ghostEl:B,rootEl:Z,nextEl:Oe,lastDownEl:je,cloneEl:K,cloneHidden:Ve,dragStarted:ut,putSortable:oe,activeSortable:A.active,originalEvent:i,oldIndex:Be,oldDraggableIndex:ve,newIndex:he,newDraggableIndex:Se,hideGhostForTarget:Jt,unhideGhostForTarget:Bn,cloneNowHidden:function(){Ve=!0},cloneNowShown:function(){Ve=!1},dispatchSortableEvent:function(p){ce({sortable:t,name:p,originalEvent:i})}},s))};function ce(r){ze(o({putSortable:oe,cloneEl:K,targetEl:w,rootEl:Z,oldIndex:Be,oldDraggableIndex:ve,newIndex:he,newDraggableIndex:Se},r))}var w,ee,B,Z,Oe,je,K,Ve,Be,he,ve,Se,tt,oe,Fe=!1,Ke=!1,nt=[],be,we,Mt,Nt,Ee,Zt,ut,rt,ct,dt=!1,Et=!1,He,de,Pt=[],Ut=!1,It=[],We=typeof document<"u",ft=pe,h=Y||N?"cssFloat":"float",C=We&&!R&&!pe&&"draggable"in document.createElement("div"),I=(function(){if(We){if(N)return!1;var r=document.createElement("x");return r.style.cssText="pointer-events:auto",r.style.pointerEvents==="auto"}})(),H=function(e,t){var n=U(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),s=Ze(e,0,t),d=Ze(e,1,t),p=s&&U(s),m=d&&U(d),y=p&&parseInt(p.marginLeft)+parseInt(p.marginRight)+W(s).width,D=m&&parseInt(m.marginLeft)+parseInt(m.marginRight)+W(d).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(s&&p.float&&p.float!=="none"){var _=p.float==="left"?"left":"right";return d&&(m.clear==="both"||m.clear===_)?"vertical":"horizontal"}return s&&(p.display==="block"||p.display==="flex"||p.display==="table"||p.display==="grid"||y>=i&&n[h]==="none"||d&&n[h]==="none"&&y+D>i)?"vertical":"horizontal"},ie=function(e,t,n){var i=n?e.left:e.top,s=n?e.right:e.bottom,d=n?e.width:e.height,p=n?t.left:t.top,m=n?t.right:t.bottom,y=n?t.width:t.height;return i===p||s===m||i+d/2===p+y/2},ht=function(e,t){var n;return nt.some(function(i){var s=i[ae].options.emptyInsertThreshold;if(!(!s||kt(i))){var d=W(i),p=e>=d.left-s&&e<=d.right+s,m=t>=d.top-s&&t<=d.bottom+s;if(p&&m)return n=i}}),n},pt=function(e){function t(s,d){return function(p,m,y,D){var _=p.options.group.name&&m.options.group.name&&p.options.group.name===m.options.group.name;if(s==null&&(d||_))return!0;if(s==null||s===!1)return!1;if(d&&s==="clone")return s;if(typeof s=="function")return t(s(p,m,y,D),d)(p,m,y,D);var x=(d?p:m).options.group.name;return s===!0||typeof s=="string"&&s===x||s.join&&s.indexOf(x)>-1}}var n={},i=e.group;(!i||l(i)!="object")&&(i={name:i}),n.name=i.name,n.checkPull=t(i.pull,!0),n.checkPut=t(i.put),n.revertClone=i.revertClone,e.group=n},Jt=function(){!I&&B&&U(B,"display","none")},Bn=function(){!I&&B&&U(B,"display","")};We&&!R&&document.addEventListener("click",function(r){if(Ke)return r.preventDefault(),r.stopPropagation&&r.stopPropagation(),r.stopImmediatePropagation&&r.stopImmediatePropagation(),Ke=!1,!1},!0);var gt=function(e){if(w){e=e.touches?e.touches[0]:e;var t=ht(e.clientX,e.clientY);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ae]._onDragOver(n)}}},Xn=function(e){w&&w.parentNode[ae]._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=g({},e),r[ae]=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 H(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(d,p){d.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&&(!ye||pe),emptyInsertThreshold:5};st.initializePlugins(this,r,t);for(var n in t)!(n in e)&&(e[n]=t[n]);pt(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:C,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)),nt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),g(this,_t())}A.prototype={constructor:A,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(rt=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,w):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,i=this.options,s=i.preventOnFilter,d=e.type,p=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,m=(p||e).target,y=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||m,D=i.filter;if(rr(n),!w&&!(/mousedown|pointerdown/.test(d)&&e.button!==0||i.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&ye&&m&&m.tagName.toUpperCase()==="SELECT")&&(m=X(m,i.draggable,n,!1),!(m&&m.animated)&&je!==m)){if(Be=Q(m),ve=Q(m,i.draggable),typeof D=="function"){if(D.call(this,e,m,this)){ce({sortable:t,rootEl:y,name:"filter",targetEl:m,toEl:n,fromEl:n}),ue("filter",t,{evt:e}),s&&e.preventDefault();return}}else if(D&&(D=D.split(",").some(function(_){if(_=X(y,_.trim(),n,!1),_)return ce({sortable:t,rootEl:_,name:"filter",targetEl:m,fromEl:n,toEl:n}),ue("filter",t,{evt:e}),!0}),D)){s&&e.preventDefault();return}i.handle&&!X(y,i.handle,n,!1)||this._prepareDragStart(e,p,m)}}},_prepareDragStart:function(e,t,n){var i=this,s=i.el,d=i.options,p=s.ownerDocument,m;if(n&&!w&&n.parentNode===s){var y=W(n);if(Z=s,w=n,ee=w.parentNode,Oe=w.nextSibling,je=n,tt=d.group,A.dragged=w,be={target:w,clientX:(t||e).clientX,clientY:(t||e).clientY},Ee=be.clientX-y.left,Zt=be.clientY-y.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,w.style["will-change"]="all",m=function(){if(ue("delayEnded",i,{evt:e}),A.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!me&&i.nativeDraggable&&(w.draggable=!0),i._triggerDragStart(e,t),ce({sortable:i,name:"choose",originalEvent:e}),E(w,d.chosenClass,!0)},d.ignore.split(",").forEach(function(D){yt(w,D.trim(),pn)}),O(p,"dragover",gt),O(p,"mousemove",gt),O(p,"touchmove",gt),d.supportPointer?(O(p,"pointerup",i._onDrop),!this.nativeDraggable&&O(p,"pointercancel",i._onDrop)):(O(p,"mouseup",i._onDrop),O(p,"touchend",i._onDrop),O(p,"touchcancel",i._onDrop)),me&&this.nativeDraggable&&(this.options.touchStartThreshold=4,w.draggable=!0),ue("delayStart",this,{evt:e}),d.delay&&(!d.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(Y||N))){if(A.eventCanceled){this._onDrop();return}d.supportPointer?(O(p,"pointerup",i._disableDelayedDrag),O(p,"pointercancel",i._disableDelayedDrag)):(O(p,"mouseup",i._disableDelayedDrag),O(p,"touchend",i._disableDelayedDrag),O(p,"touchcancel",i._disableDelayedDrag)),O(p,"mousemove",i._delayedDragTouchMoveHandler),O(p,"touchmove",i._delayedDragTouchMoveHandler),d.supportPointer&&O(p,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(m,d.delay)}else m()}},_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(){w&&pn(w),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;T(e,"mouseup",this._disableDelayedDrag),T(e,"touchend",this._disableDelayedDrag),T(e,"touchcancel",this._disableDelayedDrag),T(e,"pointerup",this._disableDelayedDrag),T(e,"pointercancel",this._disableDelayedDrag),T(e,"mousemove",this._delayedDragTouchMoveHandler),T(e,"touchmove",this._delayedDragTouchMoveHandler),T(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(w,"dragend",this),O(Z,"dragstart",this._onDragStart));try{document.selection?en(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,t){if(Fe=!1,Z&&w){ue("dragStarted",this,{evt:t}),this.nativeDraggable&&O(document,"dragover",Xn);var n=this.options;!e&&E(w,n.dragClass,!1),E(w,n.ghostClass,!0),A.active=this,e&&this._appendGhost(),ce({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(we){this._lastX=we.clientX,this._lastY=we.clientY,Jt();for(var e=document.elementFromPoint(we.clientX,we.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(we.clientX,we.clientY),e!==t);)t=e;if(w.parentNode[ae]._isOutsideThisEl(e),t)do{if(t[ae]){var n=void 0;if(n=t[ae]._onDragOver({clientX:we.clientX,clientY:we.clientY,target:e,rootEl:t}),n&&!this.options.dragoverBubble)break}e=t}while(t=se(t));Bn()}},_onTouchMove:function(e){if(be){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,s=e.touches?e.touches[0]:e,d=B&&qe(B,!0),p=B&&d&&d.a,m=B&&d&&d.d,y=ft&&de&&bt(de),D=(s.clientX-be.clientX+i.x)/(p||1)+(y?y[0]-Pt[0]:0)/(p||1),_=(s.clientY-be.clientY+i.y)/(m||1)+(y?y[1]-Pt[1]:0)/(m||1);if(!A.active&&!Fe){if(n&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(B){d?(d.e+=D-(Mt||0),d.f+=_-(Nt||0)):d={a:1,b:0,c:0,d:1,e:D,f:_};var x="matrix(".concat(d.a,",").concat(d.b,",").concat(d.c,",").concat(d.d,",").concat(d.e,",").concat(d.f,")");U(B,"webkitTransform",x),U(B,"mozTransform",x),U(B,"msTransform",x),U(B,"transform",x),Mt=D,Nt=_,we=s}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!B){var e=this.options.fallbackOnBody?document.body:Z,t=W(w,!0,ft,!0,e),n=this.options;if(ft){for(de=e;U(de,"position")==="static"&&U(de,"transform")==="none"&&de!==document;)de=de.parentNode;de!==document.body&&de!==document.documentElement?(de===document&&(de=ge()),t.top+=de.scrollTop,t.left+=de.scrollLeft):de=ge(),Pt=bt(de)}B=w.cloneNode(!0),E(B,n.ghostClass,!1),E(B,n.fallbackClass,!0),E(B,n.dragClass,!0),U(B,"transition",""),U(B,"transform",""),U(B,"box-sizing","border-box"),U(B,"margin",0),U(B,"top",t.top),U(B,"left",t.left),U(B,"width",t.width),U(B,"height",t.height),U(B,"opacity","0.8"),U(B,"position",ft?"absolute":"fixed"),U(B,"zIndex","100000"),U(B,"pointerEvents","none"),A.ghost=B,e.appendChild(B),U(B,"transform-origin",Ee/parseInt(B.style.width)*100+"% "+Zt/parseInt(B.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,i=e.dataTransfer,s=n.options;if(ue("dragStart",this,{evt:e}),A.eventCanceled){this._onDrop();return}ue("setupClone",this),A.eventCanceled||(K=At(w),K.removeAttribute("id"),K.draggable=!1,K.style["will-change"]="",this._hideClone(),E(K,this.options.chosenClass,!1),A.clone=K),n.cloneId=en(function(){ue("clone",n),!A.eventCanceled&&(n.options.removeCloneOnHide||Z.insertBefore(K,w),n._hideClone(),ce({sortable:n,name:"clone"}))}),!t&&E(w,s.dragClass,!0),t?(Ke=!0,n._loopId=setInterval(n._emulateDragOver,50)):(T(document,"mouseup",n._onDrop),T(document,"touchend",n._onDrop),T(document,"touchcancel",n._onDrop),i&&(i.effectAllowed="move",s.setData&&s.setData.call(n,i,w)),O(document,"drop",n),U(w,"transform","translateZ(0)")),Fe=!0,n._dragStartId=en(n._dragStarted.bind(n,t,e)),O(document,"selectstart",n),ut=!0,window.getSelection().removeAllRanges(),ye&&U(document.body,"user-select","none")},_onDragOver:function(e){var t=this.el,n=e.target,i,s,d,p=this.options,m=p.group,y=A.active,D=tt===m,_=p.sort,x=oe||y,G,V=this,j=!1;if(Ut)return;function Ce(Ht,ur){ue(Ht,V,o({evt:e,isOwner:D,axis:G?"vertical":"horizontal",revert:d,dragRect:i,targetRect:s,canSort:_,fromSortable:x,target:n,completed:q,onMove:function(Rn,cr){return $t(Z,t,w,i,Rn,W(Rn),e,cr)},changed:$},ur))}function ke(){Ce("dragOverAnimationCapture"),V.captureAnimationState(),V!==x&&x.captureAnimationState()}function q(Ht){return Ce("dragOverCompleted",{insertion:Ht}),Ht&&(D?y._hideClone():y._showClone(V),V!==x&&(E(w,oe?oe.options.ghostClass:y.options.ghostClass,!1),E(w,p.ghostClass,!0)),oe!==V&&V!==A.active?oe=V:V===A.active&&oe&&(oe=null),x===V&&(V._ignoreWhileAnimating=n),V.animateAll(function(){Ce("dragOverAnimationComplete"),V._ignoreWhileAnimating=null}),V!==x&&(x.animateAll(),x._ignoreWhileAnimating=null)),(n===w&&!w.animated||n===t&&!n.animated)&&(rt=null),!p.dragoverBubble&&!e.rootEl&&n!==document&&(w.parentNode[ae]._isOutsideThisEl(e.target),!Ht&>(e)),!p.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),j=!0}function $(){he=Q(w),Se=Q(w,p.draggable),ce({sortable:V,name:"change",toEl:t,newIndex:he,newDraggableIndex:Se,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),n=X(n,p.draggable,t,!0),Ce("dragOver"),A.eventCanceled)return j;if(w.contains(e.target)||n.animated&&n.animatingX&&n.animatingY||V._ignoreWhileAnimating===n)return q(!1);if(Ke=!1,y&&!p.disabled&&(D?_||(d=ee!==Z):oe===this||(this.lastPutMode=tt.checkPull(this,y,w,e))&&m.checkPut(this,y,w,e))){if(G=this._getDirection(e,n)==="vertical",i=W(w),Ce("dragOverValid"),A.eventCanceled)return j;if(d)return ee=Z,ke(),this._hideClone(),Ce("revert"),A.eventCanceled||(Oe?Z.insertBefore(w,Oe):Z.appendChild(w)),q(!0);var fe=kt(t,p.draggable);if(!fe||$n(e,G,this)&&!fe.animated){if(fe===w)return q(!1);if(fe&&t===e.target&&(n=fe),n&&(s=W(n)),$t(Z,t,w,i,n,s,e,!!n)!==!1)return ke(),fe&&fe.nextSibling?t.insertBefore(w,fe.nextSibling):t.appendChild(w),ee=t,$(),q(!0)}else if(fe&&Jn(e,G,this)){var Ye=Ze(t,0,p,!0);if(Ye===w)return q(!1);if(n=Ye,s=W(n),$t(Z,t,w,i,n,s,e,!1)!==!1)return ke(),t.insertBefore(w,Ye),ee=t,$(),q(!0)}else if(n.parentNode===t){s=W(n);var Le=0,vt,Gt=w.parentNode!==t,Ie=!ie(w.animated&&w.toRect||i,n.animated&&n.toRect||s,G),zt=G?"top":"left",at=Ge(n,"top","top")||Ge(w,"top","top"),jt=at?at.scrollTop:void 0;rt!==n&&(vt=s[zt],dt=!1,Et=!Ie&&p.invertSwap||Gt),Le=er(e,n,s,G,Ie?1:p.swapThreshold,p.invertedSwapThreshold==null?p.swapThreshold:p.invertedSwapThreshold,Et,rt===n);var Xe;if(Le!==0){var mt=Q(w);do mt-=Le,Xe=ee.children[mt];while(Xe&&(U(Xe,"display")==="none"||Xe===B))}if(Le===0||Xe===n)return q(!1);rt=n,ct=Le;var Kt=n.nextElementSibling,ot=!1;ot=Le===1;var on=$t(Z,t,w,i,n,s,e,ot);if(on!==!1)return(on===1||on===-1)&&(ot=on===1),Ut=!0,setTimeout(Zn,30),ke(),ot&&!Kt?t.appendChild(w):n.parentNode.insertBefore(w,ot?Kt:n),at&&wt(at,0,jt-at.scrollTop),ee=w.parentNode,vt!==void 0&&!Et&&(He=Math.abs(vt-W(n)[zt])),$(),q(!0)}if(t.contains(w))return q(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){T(document,"mousemove",this._onTouchMove),T(document,"touchmove",this._onTouchMove),T(document,"pointermove",this._onTouchMove),T(document,"dragover",gt),T(document,"mousemove",gt),T(document,"touchmove",gt)},_offUpEvents:function(){var e=this.el.ownerDocument;T(e,"mouseup",this._onDrop),T(e,"touchend",this._onDrop),T(e,"pointerup",this._onDrop),T(e,"pointercancel",this._onDrop),T(e,"touchcancel",this._onDrop),T(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;if(he=Q(w),Se=Q(w,n.draggable),ue("drop",this,{evt:e}),ee=w&&w.parentNode,he=Q(w),Se=Q(w,n.draggable),A.eventCanceled){this._nulling();return}Fe=!1,Et=!1,dt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),gn(this.cloneId),gn(this._dragStartId),this.nativeDraggable&&(T(document,"drop",this),T(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ye&&U(document.body,"user-select",""),U(w,"transform",""),e&&(ut&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),B&&B.parentNode&&B.parentNode.removeChild(B),(Z===ee||oe&&oe.lastPutMode!=="clone")&&K&&K.parentNode&&K.parentNode.removeChild(K),w&&(this.nativeDraggable&&T(w,"dragend",this),pn(w),w.style["will-change"]="",ut&&!Fe&&E(w,oe?oe.options.ghostClass:this.options.ghostClass,!1),E(w,this.options.chosenClass,!1),ce({sortable:this,name:"unchoose",toEl:ee,newIndex:null,newDraggableIndex:null,originalEvent:e}),Z!==ee?(he>=0&&(ce({rootEl:ee,name:"add",toEl:ee,fromEl:Z,originalEvent:e}),ce({sortable:this,name:"remove",toEl:ee,originalEvent:e}),ce({rootEl:ee,name:"sort",toEl:ee,fromEl:Z,originalEvent:e}),ce({sortable:this,name:"sort",toEl:ee,originalEvent:e})),oe&&oe.save()):he!==Be&&he>=0&&(ce({sortable:this,name:"update",toEl:ee,originalEvent:e}),ce({sortable:this,name:"sort",toEl:ee,originalEvent:e})),A.active&&((he==null||he===-1)&&(he=Be,Se=ve),ce({sortable:this,name:"end",toEl:ee,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){ue("nulling",this),Z=w=ee=B=Oe=K=je=Ve=be=we=ut=he=Se=Be=ve=rt=ct=oe=tt=A.dragged=A.ghost=A.clone=A.active=null,It.forEach(function(e){e.checked=!0}),It.length=Mt=Nt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":w&&(this._onDragOver(e),Qn(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,n=this.el.children,i=0,s=n.length,d=this.options;i<s;i++)t=n[i],X(t,d.draggable,this.el,!1)&&e.push(t.getAttribute(d.dataIdAttr)||nr(t));return e},sort:function(e,t){var n={},i=this.el;this.toArray().forEach(function(s,d){var p=i.children[d];X(p,this.options.draggable,i,!1)&&(n[s]=p)},this),t&&this.captureAnimationState(),e.forEach(function(s){n[s]&&(i.removeChild(n[s]),i.appendChild(n[s]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return X(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(t===void 0)return n[e];var i=st.modifyOption(this,e,t);typeof i<"u"?n[e]=i:n[e]=t,e==="group"&&pt(n)},destroy:function(){ue("destroy",this);var e=this.el;e[ae]=null,T(e,"mousedown",this._onTapStart),T(e,"touchstart",this._onTapStart),T(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(T(e,"dragover",this),T(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),nt.splice(nt.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Ve){if(ue("hideClone",this),A.eventCanceled)return;U(K,"display","none"),this.options.removeCloneOnHide&&K.parentNode&&K.parentNode.removeChild(K),Ve=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(Ve){if(ue("showClone",this),A.eventCanceled)return;w.parentNode==Z&&!this.options.group.revertClone?Z.insertBefore(K,w):Oe?Z.insertBefore(K,Oe):Z.appendChild(K),this.options.group.revertClone&&this.animate(w,K),U(K,"display",""),Ve=!1}}};function Qn(r){r.dataTransfer&&(r.dataTransfer.dropEffect="move"),r.cancelable&&r.preventDefault()}function $t(r,e,t,n,i,s,d,p){var m,y=r[ae],D=y.options.onMove,_;return window.CustomEvent&&!N&&!Y?m=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent("move",!0,!0)),m.to=e,m.from=r,m.dragged=t,m.draggedRect=n,m.related=i||e,m.relatedRect=s||W(e),m.willInsertAfter=p,m.originalEvent=d,r.dispatchEvent(m),D&&(_=D.call(y,m,d)),_}function pn(r){r.draggable=!1}function Zn(){Ut=!1}function Jn(r,e,t){var n=W(Ze(t.el,0,t.options,!0)),i=et(t.el,t.options,B),s=10;return e?r.clientX<i.left-s||r.clientY<n.top&&r.clientX<n.right:r.clientY<i.top-s||r.clientY<n.bottom&&r.clientX<n.left}function $n(r,e,t){var n=W(kt(t.el,t.options.draggable)),i=et(t.el,t.options,B),s=10;return e?r.clientX>i.right+s||r.clientY>n.bottom&&r.clientX>n.left:r.clientY>i.bottom+s||r.clientX>n.right&&r.clientY>n.top}function er(r,e,t,n,i,s,d,p){var m=n?r.clientY:r.clientX,y=n?t.height:t.width,D=n?t.top:t.left,_=n?t.bottom:t.right,x=!1;if(!d){if(p&&He<y*i){if(!dt&&(ct===1?m>D+y*s/2:m<_-y*s/2)&&(dt=!0),dt)x=!0;else if(ct===1?m<D+He:m>_-He)return-ct}else if(m>D+y*(1-i)/2&&m<_-y*(1-i)/2)return tr(e)}return x=x||d,x&&(m<D+y*s/2||m>_-y*s/2)?m>D+y/2?1:-1:0}function tr(r){return Q(w)<Q(r)?1:-1}function nr(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 rr(r){It.length=0;for(var e=r.getElementsByTagName("input"),t=e.length;t--;){var n=e[t];n.checked&&It.push(n)}}function en(r){return setTimeout(r,0)}function gn(r){return clearTimeout(r)}We&&O(document,"touchmove",function(r){(A.active||Fe)&&r.cancelable&&r.preventDefault()}),A.utils={on:O,off:T,css:U,find:yt,is:function(e,t){return!!X(e,t,e,!1)},extend:hn,throttle:$e,closest:X,toggleClass:E,clone:At,index:Q,nextTick:en,cancelNextTick:gn,detectDirection:H,getChild:Ze,expando:ae},A.get=function(r){return r[ae]},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=o(o({},A.utils),n.utils)),st.mount(n)})},A.create=function(r,e){return new A(r,e)},A.version=De;var le=[],Rt,vn,mn=!1,yn,bn,tn,Vt;function ar(){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?T(document,"dragover",this._handleAutoScroll):(T(document,"pointermove",this._handleFallbackAutoScroll),T(document,"touchmove",this._handleFallbackAutoScroll),T(document,"mousemove",this._handleFallbackAutoScroll)),Mn(),nn(),lt()},nulling:function(){tn=vn=Rt=mn=Vt=yn=bn=null,le.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,n){var i=this,s=(t.touches?t.touches[0]:t).clientX,d=(t.touches?t.touches[0]:t).clientY,p=document.elementFromPoint(s,d);if(tn=t,n||this.options.forceAutoScrollFallback||Y||N||ye){wn(t,this.options,p,n);var m=Re(p,!0);mn&&(!Vt||s!==yn||d!==bn)&&(Vt&&Mn(),Vt=setInterval(function(){var y=Re(document.elementFromPoint(s,d),!0);y!==m&&(m=y,nn()),wn(t,i.options,y,n)},10),yn=s,bn=d)}else{if(!this.options.bubbleScroll||Re(p,!0)===ge()){nn();return}wn(t,this.options,Re(p,!1),!1)}}},g(r,{pluginName:"scroll",initializeByDefault:!0})}function nn(){le.forEach(function(r){clearInterval(r.pid)}),le=[]}function Mn(){clearInterval(Vt)}var wn=$e(function(r,e,t,n){if(e.scroll){var i=(r.touches?r.touches[0]:r).clientX,s=(r.touches?r.touches[0]:r).clientY,d=e.scrollSensitivity,p=e.scrollSpeed,m=ge(),y=!1,D;vn!==t&&(vn=t,nn(),Rt=e.scroll,D=e.scrollFn,Rt===!0&&(Rt=Re(t,!0)));var _=0,x=Rt;do{var G=x,V=W(G),j=V.top,Ce=V.bottom,ke=V.left,q=V.right,$=V.width,fe=V.height,Ye=void 0,Le=void 0,vt=G.scrollWidth,Gt=G.scrollHeight,Ie=U(G),zt=G.scrollLeft,at=G.scrollTop;G===m?(Ye=$<vt&&(Ie.overflowX==="auto"||Ie.overflowX==="scroll"||Ie.overflowX==="visible"),Le=fe<Gt&&(Ie.overflowY==="auto"||Ie.overflowY==="scroll"||Ie.overflowY==="visible")):(Ye=$<vt&&(Ie.overflowX==="auto"||Ie.overflowX==="scroll"),Le=fe<Gt&&(Ie.overflowY==="auto"||Ie.overflowY==="scroll"));var jt=Ye&&(Math.abs(q-i)<=d&&zt+$<vt)-(Math.abs(ke-i)<=d&&!!zt),Xe=Le&&(Math.abs(Ce-s)<=d&&at+fe<Gt)-(Math.abs(j-s)<=d&&!!at);if(!le[_])for(var mt=0;mt<=_;mt++)le[mt]||(le[mt]={});(le[_].vx!=jt||le[_].vy!=Xe||le[_].el!==G)&&(le[_].el=G,le[_].vx=jt,le[_].vy=Xe,clearInterval(le[_].pid),(jt!=0||Xe!=0)&&(y=!0,le[_].pid=setInterval((function(){n&&this.layer===0&&A.active._onTouchMove(tn);var Kt=le[this.layer].vy?le[this.layer].vy*p:0,ot=le[this.layer].vx?le[this.layer].vx*p:0;typeof D=="function"&&D.call(A.dragged.parentNode[ae],ot,Kt,r,tn,le[this.layer].el)!=="continue"||wt(le[this.layer].el,ot,Kt)}).bind({layer:_}),24))),_++}while(e.bubbleScroll&&x!==m&&(x=Re(x,!1)));mn=y}},30),Nn=function(e){var t=e.originalEvent,n=e.putSortable,i=e.dragEl,s=e.activeSortable,d=e.dispatchSortableEvent,p=e.hideGhostForTarget,m=e.unhideGhostForTarget;if(t){var y=n||s;p();var D=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,_=document.elementFromPoint(D.clientX,D.clientY);m(),y&&!y.el.contains(_)&&(d("spill"),this.onSpill({dragEl:i,putSortable:n}))}};function Cn(){}Cn.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 i=Ze(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:Nn},g(Cn,{pluginName:"revertOnSpill"});function _n(){}_n.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:Nn},g(_n,{pluginName:"removeOnSpill"});var xe;function or(){function r(){this.defaults={swapClass:"sortable-swap-highlight"}}return r.prototype={dragStart:function(t){xe=t.dragEl},dragOverValid:function(t){var n=t.completed,i=t.target,s=t.onMove,d=t.activeSortable,p=t.changed,m=t.cancel;if(d.options.swap){var y=this.sortable.el,D=this.options;if(i&&i!==y){var _=xe;s(i)!==!1?(E(i,D.swapClass,!0),xe=i):xe=null,_&&_!==xe&&E(_,D.swapClass,!1)}p(),n(!0),m()}},drop:function(t){var n=t.activeSortable,i=t.putSortable,s=t.dragEl,d=i||this.sortable,p=this.options;xe&&E(xe,p.swapClass,!1),xe&&(p.swap||i&&i.options.swap)&&s!==xe&&(d.captureAnimationState(),d!==n&&n.captureAnimationState(),ir(s,xe),d.animateAll(),d!==n&&n.animateAll())},nulling:function(){xe=null}},g(r,{pluginName:"swap",eventProperties:function(){return{swapItem:xe}}})}function ir(r,e){var t=r.parentNode,n=e.parentNode,i,s;!t||!n||t.isEqualNode(e)||n.isEqualNode(r)||(i=Q(r),s=Q(e),t.isEqualNode(n)&&i<s&&s++,t.insertBefore(e,t.children[i]),n.insertBefore(r,n.children[s]))}var M=[],Ue=[],Ft,Me,Lt=!1,_e=!1,Dt=!1,J,qt,rn;function lr(){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(i,s){var d="";M.length&&Me===e?M.forEach(function(p,m){d+=(m?", ":"")+p.textContent}):d=s.textContent,i.setData("Text",d)}}}return r.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal:function(t){J=t.dragEl},delayEnded:function(){this.isMultiDrag=~M.indexOf(J)},setupClone:function(t){var n=t.sortable,i=t.cancel;if(this.isMultiDrag){for(var s=0;s<M.length;s++)Ue.push(At(M[s])),Ue[s].sortableIndex=M[s].sortableIndex,Ue[s].draggable=!1,Ue[s].style["will-change"]="",E(Ue[s],this.options.selectedClass,!1),M[s]===J&&E(Ue[s],this.options.chosenClass,!1);n._hideClone(),i()}},clone:function(t){var n=t.sortable,i=t.rootEl,s=t.dispatchSortableEvent,d=t.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||M.length&&Me===n&&(Pn(!0,i),s("clone"),d()))},showClone:function(t){var n=t.cloneNowShown,i=t.rootEl,s=t.cancel;this.isMultiDrag&&(Pn(!1,i),Ue.forEach(function(d){U(d,"display","")}),n(),rn=!1,s())},hideClone:function(t){var n=this;t.sortable;var i=t.cloneNowHidden,s=t.cancel;this.isMultiDrag&&(Ue.forEach(function(d){U(d,"display","none"),n.options.removeCloneOnHide&&d.parentNode&&d.parentNode.removeChild(d)}),i(),rn=!0,s())},dragStartGlobal:function(t){t.sortable,!this.isMultiDrag&&Me&&Me.multiDrag._deselectMultiDrag(),M.forEach(function(n){n.sortableIndex=Q(n)}),M=M.sort(function(n,i){return n.sortableIndex-i.sortableIndex}),Dt=!0},dragStarted:function(t){var n=this,i=t.sortable;if(this.isMultiDrag){if(this.options.sort&&(i.captureAnimationState(),this.options.animation)){M.forEach(function(d){d!==J&&U(d,"position","absolute")});var s=W(J,!1,!0,!0);M.forEach(function(d){d!==J&&Xt(d,s)}),_e=!0,Lt=!0}i.animateAll(function(){_e=!1,Lt=!1,n.options.animation&&M.forEach(function(d){Ct(d)}),n.options.sort&&an()})}},dragOver:function(t){var n=t.target,i=t.completed,s=t.cancel;_e&&~M.indexOf(n)&&(i(!1),s())},revert:function(t){var n=t.fromSortable,i=t.rootEl,s=t.sortable,d=t.dragRect;M.length>1&&(M.forEach(function(p){s.addAnimationState({target:p,rect:_e?W(p):d}),Ct(p),p.fromRect=d,n.removeAnimationState(p)}),_e=!1,sr(!this.options.removeCloneOnHide,i))},dragOverCompleted:function(t){var n=t.sortable,i=t.isOwner,s=t.insertion,d=t.activeSortable,p=t.parentEl,m=t.putSortable,y=this.options;if(s){if(i&&d._hideClone(),Lt=!1,y.animation&&M.length>1&&(_e||!i&&!d.options.sort&&!m)){var D=W(J,!1,!0,!0);M.forEach(function(x){x!==J&&(Xt(x,D),p.appendChild(x))}),_e=!0}if(!i)if(_e||an(),M.length>1){var _=rn;d._showClone(n),d.options.animation&&!rn&&_&&Ue.forEach(function(x){d.addAnimationState({target:x,rect:qt}),x.fromRect=qt,x.thisAnimationDuration=null})}else d._showClone(n)}},dragOverAnimationCapture:function(t){var n=t.dragRect,i=t.isOwner,s=t.activeSortable;if(M.forEach(function(p){p.thisAnimationDuration=null}),s.options.animation&&!i&&s.multiDrag.isMultiDrag){qt=g({},n);var d=qe(J,!0);qt.top-=d.f,qt.left-=d.e}},dragOverAnimationComplete:function(){_e&&(_e=!1,an())},drop:function(t){var n=t.originalEvent,i=t.rootEl,s=t.parentEl,d=t.sortable,p=t.dispatchSortableEvent,m=t.oldIndex,y=t.putSortable,D=y||this.sortable;if(n){var _=this.options,x=s.children;if(!Dt)if(_.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),E(J,_.selectedClass,!~M.indexOf(J)),~M.indexOf(J))M.splice(M.indexOf(J),1),Ft=null,ze({sortable:d,rootEl:i,name:"deselect",targetEl:J,originalEvent:n});else{if(M.push(J),ze({sortable:d,rootEl:i,name:"select",targetEl:J,originalEvent:n}),n.shiftKey&&Ft&&d.el.contains(Ft)){var G=Q(Ft),V=Q(J);~G&&~V&&G!==V&&(function(){var q,$;V>G?($=G,q=V):($=V,q=G+1);for(var fe=_.filter;$<q;$++)~M.indexOf(x[$])||X(x[$],_.draggable,s,!1)&&(fe&&(typeof fe=="function"?fe.call(d,n,x[$],d):fe.split(",").some(function(Ye){return X(x[$],Ye.trim(),s,!1)}))||(E(x[$],_.selectedClass,!0),M.push(x[$]),ze({sortable:d,rootEl:i,name:"select",targetEl:x[$],originalEvent:n})))})()}else Ft=J;Me=D}if(Dt&&this.isMultiDrag){if(_e=!1,(s[ae].options.sort||s!==i)&&M.length>1){var j=W(J),Ce=Q(J,":not(."+this.options.selectedClass+")");if(!Lt&&_.animation&&(J.thisAnimationDuration=null),D.captureAnimationState(),!Lt&&(_.animation&&(J.fromRect=j,M.forEach(function(q){if(q.thisAnimationDuration=null,q!==J){var $=_e?W(q):j;q.fromRect=$,D.addAnimationState({target:q,rect:$})}})),an(),M.forEach(function(q){x[Ce]?s.insertBefore(q,x[Ce]):s.appendChild(q),Ce++}),m===Q(J))){var ke=!1;M.forEach(function(q){if(q.sortableIndex!==Q(q)){ke=!0;return}}),ke&&(p("update"),p("sort"))}M.forEach(function(q){Ct(q)}),D.animateAll()}Me=D}(i===s||y&&y.lastPutMode!=="clone")&&Ue.forEach(function(q){q.parentNode&&q.parentNode.removeChild(q)})}},nullingGlobal:function(){this.isMultiDrag=Dt=!1,Ue.length=0},destroyGlobal:function(){this._deselectMultiDrag(),T(document,"pointerup",this._deselectMultiDrag),T(document,"mouseup",this._deselectMultiDrag),T(document,"touchend",this._deselectMultiDrag),T(document,"keydown",this._checkKeyDown),T(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(t){if(!(typeof Dt<"u"&&Dt)&&Me===this.sortable&&!(t&&X(t.target,this.options.draggable,this.sortable.el,!1))&&!(t&&t.button!==0))for(;M.length;){var n=M[0];E(n,this.options.selectedClass,!1),M.shift(),ze({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)}},g(r,{pluginName:"multiDrag",utils:{select:function(t){var n=t.parentNode[ae];!n||!n.options.multiDrag||~M.indexOf(t)||(Me&&Me!==n&&(Me.multiDrag._deselectMultiDrag(),Me=n),E(t,n.options.selectedClass,!0),M.push(t))},deselect:function(t){var n=t.parentNode[ae],i=M.indexOf(t);!n||!n.options.multiDrag||!~i||(E(t,n.options.selectedClass,!1),M.splice(i,1))}},eventProperties:function(){var t=this,n=[],i=[];return M.forEach(function(s){n.push({multiDragElement:s,index:s.sortableIndex});var d;_e&&s!==J?d=-1:_e?d=Q(s,":not(."+t.options.selectedClass+")"):d=Q(s),i.push({multiDragElement:s,index:d})}),{items:P(M),clones:[].concat(Ue),oldIndicies:n,newIndicies:i}},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 sr(r,e){M.forEach(function(t,n){var i=e.children[t.sortableIndex+(r?Number(n):0)];i?e.insertBefore(t,i):e.appendChild(t)})}function Pn(r,e){Ue.forEach(function(t,n){var i=e.children[t.sortableIndex+(r?Number(n):0)];i?e.insertBefore(t,i):e.appendChild(t)})}function an(){M.forEach(function(r){r!==J&&r.parentNode&&r.parentNode.removeChild(r)})}return A.mount(new ar),A.mount(_n,Cn),A.mount(new or),A.mount(new lr),A}))}))()),xt="bk_username",Ne={USER:"user",VIRTUAL:"virtual",CUSTOM:"custom",USER_GROUP:"userGroup"},wr=Symbol("bkUserSelectorApiConfig"),Cr=/^[A-Za-z0-9_-]{1,64}$/,Sn={apiBaseUrl:"",tenantId:"",allowedApiOrigins:[],allowPrivateApiHost:!1,allowCrossOriginCredentials:!1},zn=()=>typeof window>"u"||!window.location?.origin?"http://localhost":window.location.origin,_r=u=>{const f=u.split(".").map(Number);if(f.length!==4||f.some(Number.isNaN))return!1;const[c,o]=f;return c===10||c===127||c===172&&o>=16&&o<=31||c===192&&o===168||c===169&&o===254||c===100&&o>=64&&o<=127},Sr=u=>{const f=u.toLowerCase();return!!(f==="localhost"||f==="[::1]"||f==="::1"||_r(f)||f.startsWith("fc")||f.startsWith("fd"))},jn=(u=[])=>{const f=zn();return Array.from(new Set(u.map(c=>{try{const o=new URL(c,f);return["http:","https:"].includes(o.protocol)?o.origin:""}catch{return""}}).filter(Boolean)))},Kn=(u,f=[],c=!1)=>{if(!u)return"";try{const o=new URL(u,zn());if(!["http:","https:"].includes(o.protocol))return console.warn("[bk-user-selector] apiBaseUrl 仅支持 http/https 协议"),"";if(!c&&Sr(o.hostname))return console.warn("[bk-user-selector] apiBaseUrl 指向私网或 localhost,已被安全策略拦截"),"";const l=jn(f);if(l.length>0&&!l.includes(o.origin))return console.warn("[bk-user-selector] apiBaseUrl 未命中 allowedApiOrigins 白名单,已被安全策略拦截"),"";const v=o.pathname.replace(/\/+$/,"");return`${o.origin}${v}`}catch{return console.warn("[bk-user-selector] apiBaseUrl 格式非法,已被安全策略拦截"),""}},Hn=u=>{const f=String(u||"").trim();return f?Cr.test(f)?f:(console.warn("[bk-user-selector] tenantId 格式非法,已被安全策略拦截"),""):""},Er=()=>Sn,Ur=(u,f,c=[],o=!1,l=!1,v={})=>{const g=jn(c);Sn={apiBaseUrl:Kn(u,g,o),tenantId:Hn(f),allowedApiOrigins:g,allowPrivateApiHost:o,allowCrossOriginCredentials:l,onError:v.onError,onUnauthorized:v.onUnauthorized},a.provide(wr,Sn)},Ir=()=>`__jsonp_callback_${Date.now()}_${Math.random().toString(36).slice(2,9)}`,Dr=(u,f={})=>new Promise((c,o)=>{const l=a.unref(u),{timeout:v=1e3*60*2,params:g}=f,b=Ir(),S=document.createElement("script");let P=null;S.setAttribute("type","text/javascript");const z=()=>{P&&clearTimeout(P),S.parentNode&&S.parentNode.removeChild(S),window[b]&&delete window[b]};window[b]=k=>{z(),c(k.data||k)},P=setTimeout(()=>{z(),o(new Error(`JSONP request timeout: ${l}`))},v),S.onerror=()=>{z(),o(new Error(`JSONP request failed: ${l}`))},S.src=`${l}${l.includes("?")?"&":"?"}callback=${b}${g?`&${Object.entries(g).map(([k,F])=>F?`${k}=${F}`:"").filter(Boolean).join("&")}`:""}`,document.head.appendChild(S)}),Wt="[BkUserSelector]",Vn={debug:0,info:1,warn:2,error:3},xr={level:"warn"},ln=u=>Vn[u]>=Vn[xr.level],En={debug:(u,...f)=>{ln("debug")&&console.debug(`${Wt} ${u}`,...f)},info:(u,...f)=>{ln("info")&&console.info(`${Wt} ${u}`,...f)},warn:(u,...f)=>{ln("warn")&&console.warn(`${Wt} ${u}`,...f)},error:(u,f)=>{ln("error")&&console.error(`${Wt} ${u}`,f)}},Fn=(u,f)=>{if(u)try{u(f)}catch(c){console.error(`${Wt} error handler threw:`,c)}},kr=(u,f,c,o=!1)=>({scene:u,cause:f,status:c,isUnauthorized:o}),cn=(u,f,c,o,l=!1)=>{l?En.warn(`${u}: 登录态已失效,请重新登录`):En.error(`${u}失败:`,f);const v=kr(u,f,o,l);l&&Fn(c?.onUnauthorized,v),Fn(c?.onError,v)},In=(u,f)=>{En.warn(`${u}需要提供有效的参数: ${f.join(", ")}`)},dn=401,Dn=(u,f)=>{if(typeof window>"u"||!window.location?.origin)return"same-origin";try{return new URL(u,window.location.origin).origin===window.location.origin||f?"include":"omit"}catch{return"same-origin"}},xn=(u,f)=>{const c=Er(),o=c.allowPrivateApiHost,l=c.allowedApiOrigins;return{allowCrossOriginCredentials:c.allowCrossOriginCredentials,apiBaseUrl:Kn(c.apiBaseUrl||u,l,o),tenantId:Hn(c.tenantId||f),apiConfig:c}},kn=(u,f,c)=>{if(!u.ok){if(u.status===dn){const o=new Error(`${f}失败: 登录态已失效`);throw cn(f,o,c,u.status,!0),o}throw new Error(`${u.status} ${u.statusText}`)}},Tn=u=>{if(typeof u=="object"&&u!==null&&"status"in u){const f=u.status;return typeof f=="number"?f:void 0}if(u instanceof Error){const f=/^(\d{3})\s/.exec(u.message);if(f)return Number(f[1])}},Tr=async(u,f)=>{const c=xn(u,f);if(!c.apiBaseUrl||!c.tenantId)return In("获取租户信息",["apiBaseUrl","tenantId"]),[];try{const o=`${c.apiBaseUrl}/api/v3/open-web/tenant/data-source-owner-tenants/`,l=Dn(o,c.allowCrossOriginCredentials),v=await fetch(o,{method:"GET",headers:{"x-bk-tenant-id":c.tenantId},credentials:l});return kn(v,"获取租户信息",c.apiConfig),(await v.json()).data||[]}catch(o){const l=Tn(o);return l!==dn&&cn("获取租户信息",o,c.apiConfig,l,!1),[]}},Ar=async u=>{const{apiBaseUrl:f,tenantId:c,keyword:o,enableMultiTenantMode:l=!0}=u;if(!l)try{return await Wn(f,{keyword:o,pageSize:100,page:1})}catch{return[]}const v=xn(f,c);if(!o||!v.apiBaseUrl||!v.tenantId)return In("搜索用户",["apiBaseUrl","tenantId","keyword"]),[];try{const g=`${v.apiBaseUrl}/api/v3/open-web/tenant/users/-/search/?keyword=${encodeURIComponent(o)}`,b=Dn(g,v.allowCrossOriginCredentials),S=await fetch(g,{method:"GET",headers:{"x-bk-tenant-id":v.tenantId},credentials:b});return kn(S,"搜索用户",v.apiConfig),(await S.json()).data||[]}catch(g){const b=Tn(g);return b!==dn&&cn("搜索用户",g,v.apiConfig,b,!1),[]}},un=async u=>{const{apiBaseUrl:f,tenantId:c,exactSearchKey:o="bk_username",usersList:l=[],enableMultiTenantMode:v=!0}=u,g=l.filter(Boolean).map(S=>typeof S=="string"?S.trim():String(S).trim());if(!v)try{const S=await Wn(f,{userIds:g});return g.map(P=>S.find(z=>z.username===P)).filter(Boolean)}catch{return[]}const b=xn(f,c);if(g.length===0||!b.apiBaseUrl||!b.tenantId)return In("批量查找用户",["apiBaseUrl","tenantId","usersList"]),[];try{const S=`${b.apiBaseUrl}/api/v3/open-web/tenant/users/-/lookup/?lookups=${g.join(",")}&lookup_fields=${o}`,P=Dn(S,b.allowCrossOriginCredentials),z=await fetch(S,{method:"GET",headers:{"x-bk-tenant-id":b.tenantId},credentials:P});return kn(z,"批量查找用户",b.apiConfig),(await z.json()).data||[]}catch(S){const P=Tn(S);return P!==dn&&cn("批量查找用户",S,b.apiConfig,P,!1),[]}},Yt=(u,f=!0)=>!u||!Array.isArray(u)?[]:f?u.map(c=>({id:c.bk_username,name:c.display_name,type:c.data_source_type,tenantId:c.owner_tenant_id,...c})):u.map(c=>({...c,id:c.username,name:`${c.display_name}(${c.username})`,type:c.data_source_type,tenantId:c.owner_tenant_id})),Wn=async(u,f)=>{const{userIds:c,keyword:o,pageSize:l=20,page:v=1,appCode:g="bk-magicbox"}=f;return(await Dr(u,{params:{exact_lookups:c?.join(",")||void 0,fuzzy_lookups:o||void 0,page_size:Math.max(c?.length||0,20,Number(l)).toString(),page:v.toString(),app_code:g}}))?.results||[]},Or=u=>{const f=a.ref(!1);return{loading:f,fetchCurrentUser:async()=>{const o=a.toValue(u.currentUserId);if(!o)return null;const l=a.toValue(u.enableMultiTenantMode)??!0;f.value=!0;try{const v=Yt(await un({apiBaseUrl:a.toValue(u.apiBaseUrl),tenantId:a.toValue(u.tenantId),exactSearchKey:a.toValue(u.exactSearchKey)||"bk_username",usersList:[o],enableMultiTenantMode:l}),l);return v.length>0?v[0]:null}catch(v){return console.error("获取当前用户信息失败:",v),null}finally{f.value=!1}}}};function sn(u){for(var f=1;f<arguments.length;f++){var c=arguments[f];for(var o in c)u[o]=c[o]}return u}var Br={read:function(u){return u[0]==='"'&&(u=u.slice(1,-1)),u.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(u){return encodeURIComponent(u).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Un(u,f){function c(l,v,g){if(!(typeof document>"u")){g=sn({},f,g),typeof g.expires=="number"&&(g.expires=new Date(Date.now()+g.expires*864e5)),g.expires&&(g.expires=g.expires.toUTCString()),l=encodeURIComponent(l).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var b="";for(var S in g)g[S]&&(b+="; "+S,g[S]!==!0&&(b+="="+g[S].split(";")[0]));return document.cookie=l+"="+u.write(v,l)+b}}function o(l){if(!(typeof document>"u"||arguments.length&&!l)){for(var v=document.cookie?document.cookie.split("; "):[],g={},b=0;b<v.length;b++){var S=v[b].split("="),P=S.slice(1).join("=");try{var z=decodeURIComponent(S[0]);if(g[z]=u.read(P,z),l===z)break}catch{}}return l?g[l]:g}}return Object.create({set:c,get:o,remove:function(l,v){c(l,"",sn({},v,{expires:-1}))},withAttributes:function(l){return Un(this.converter,sn({},this.attributes,l))},withConverter:function(l){return Un(sn({},this.converter,l),this.attributes)}},{attributes:{value:Object.freeze(f)},converter:{value:Object.freeze(u)}})}var Mr=Un(Br,{path:"/"}),Nr={我:"Me",请输入人员名称搜索:"Please enter the name of the user to search",最近选择:"Recent selections",用户群组:"User Group",无匹配人员:"No matching users",虚拟账号:"Virtual Account",用户:"User",复制全部:"Copy All",已复制:"Copied",复制失败:"Copy Failed",删除全部:"Delete All","确认删除全部已选人员?":"Delete all selected users?","删除全部后无法撤回,请谨慎确认。":"This action cannot be undone. Please confirm carefully.",取消:"Cancel",删除:"Delete"},Pr={我:"我",请输入人员名称搜索:"请输入人员名称搜索",最近选择:"最近选择",用户群组:"用户群组",无匹配人员:"无匹配人员",虚拟账号:"虚拟账号",用户:"用户",复制全部:"复制全部",已复制:"已复制",复制失败:"复制失败",删除全部:"删除全部","确认删除全部已选人员?":"确认删除全部已选人员?","删除全部后无法撤回,请谨慎确认。":"删除全部后无法撤回,请谨慎确认。",取消:"取消",删除:"删除"},Rr="blueking_language",Vr={"en-US":Nr,"zh-CN":Pr},Fr=(u,f,c)=>{const o=/^\w/.test(f)?f.split("."):[f],{length:l}=o;let v=u,g=0;for(;g<=l&&v;)if(typeof v=="string"||(c?(v=v[o[g]],typeof v=="string"&&Object.keys(c).forEach(b=>{v=v.replace(`{${b}}`,c[b])})):v=v[o[g]],g=g+1,!v))return v;return v},An=()=>{let u="zh-CN";const f=Mr.get(Rr);f&&f.toLowerCase()==="en"&&(u="en-US");const c=Vr[u];return{local:u,t:(l,v)=>{const g=Fr(c,l,v);return g===void 0&&console.warn(`缺少索引 * ${l} *`),g}}},Lr=u=>{const f=a.ref(!1),c=()=>{const k=u.onBatchAddUsers,F=a.toValue(u.multiple);return{apiBaseUrl:a.toValue(u.apiBaseUrl),tenantId:a.toValue(u.tenantId),searchQuery:u.searchQuery,selectedUsers:u.selectedUsers,allowCreate:a.toValue(u.allowCreate)??!1,freePaste:a.toValue(u.freePaste)??!1,enableMultiTenantMode:a.toValue(u.enableMultiTenantMode)??!0,maxCount:a.toValue(u.maxCount)??0,isUserDisabled:u.isUserDisabled??(()=>!1),onAddUser:u.onAddUser,onBatchAddUsers:k,shouldBatch:(F??!!k)&&!!k}},o=100,l=100,v=k=>({id:k,name:k,type:Ne.CUSTOM,tenantId:"",login_name:k}),g=k=>{const F=k.split(/[,,;\n\s]+/).filter(Boolean).map(L=>L.trim().replace(/\s*\(.*?\)\s*/,"")).filter(Boolean);return Array.from(new Set(F)).slice(0,o)},b=(k,F)=>{const L=[];for(let ne=0;ne<k.length;ne+=F)L.push(k.slice(ne,ne+F));return L},S=(k,F)=>{const L=new Map;for(const ne of[...k,...F])L.has(ne.id)||L.set(ne.id,ne);return Array.from(L.values())};return{isPasting:f,parsePastedText:g,handleEnterCreate:k=>{const{allowCreate:F,searchQuery:L,selectedUsers:ne,isUserDisabled:De,onAddUser:re}=c();if(k.key!=="Enter"||!F||!L.value.trim())return;const N=v(L.value.trim());!ne.value.some(Y=>Y.id===N.id)&&!De(N)&&re(N)},handlePaste:async k=>{k.preventDefault();const F=k.clipboardData?.getData("text")?.trim();if(F){f.value=!0;try{const L=g(F);if(L.length===0)return;const{apiBaseUrl:ne,tenantId:De,enableMultiTenantMode:re,freePaste:N,maxCount:Y,isUserDisabled:me,onAddUser:ye,onBatchAddUsers:pe,shouldBatch:R,selectedUsers:Pe}=c(),O=b(L,l),T=[];for(const se of O){const X=await un({apiBaseUrl:ne,tenantId:De,exactSearchKey:"login_name",usersList:se,enableMultiTenantMode:re});T.push(...X)}const te=Yt(T,re).filter(se=>!me(se));if(R){let se=S(Pe.value,te);if(N)for(const X of L)!se.some(Te=>Te.login_name===X||Te.id===X)&&!me(X)&&se.push(v(X));Y>0&&se.length>Y&&(se=se.slice(0,Y)),pe?.(se)}else te.length>0?ye(te[0]):N&&L.length>0&&ye(v(L[0]))}catch(L){console.error("精准查找用户失败:",L)}finally{f.value=!1}}}}},qr=(u,f,c={})=>{const{immediate:o=!0}=c;let l=null;const v=()=>{l&&(l.disconnect(),l=null)},g=()=>{if(v(),!!u.value&&(l=new ResizeObserver(b=>{for(const S of b)f(S)}),l.observe(u.value),o&&u.value)){const b=u.value.getBoundingClientRect();f({target:u.value,contentRect:b,borderBoxSize:[{blockSize:b.height,inlineSize:b.width}],contentBoxSize:[{blockSize:b.height,inlineSize:b.width}],devicePixelContentBoxSize:[{blockSize:b.height,inlineSize:b.width}]})}};return a.watch(u,g,{immediate:!0}),a.onUnmounted(v),v},Gr=(u,f,c=!0)=>{const o=a.ref({}),l=a.ref(!1);let v=0;const g=async()=>{const b=a.toValue(u),S=a.toValue(f);if(!b||!S){console.warn("获取租户需要提供有效的API基础URL和租户ID");return}const P=++v;l.value=!0;try{const z=await Tr(b,S);if(P!==v)return;const k={};z.forEach(F=>{F.id&&F.name&&(k[F.id]=F.name)}),o.value=k}catch(z){if(P!==v)return;console.error("获取租户数据失败:",z)}finally{P===v&&(l.value=!1)}};return a.onBeforeMount(()=>{a.toValue(c)&&g()}),a.watch(()=>[a.toValue(u),a.toValue(f),a.toValue(c)],([,,b])=>{b&&g()}),{tenants:o,loading:l,fetchTenants:g}},zr=(u,f)=>{let c=null;return function(...o){c&&clearTimeout(c),c=window.setTimeout(()=>{u(...o),c=null},f)}},Ln=(u,f,c)=>{if(!u||!f.length)return 0;let o=0,l=0;for(const v of Array.from(f)){const g=v;if(!g)continue;const b=window.getComputedStyle(g),S=g.offsetWidth,P=parseInt(b.marginLeft,10)||0,z=parseInt(b.marginRight,10)||0;if(o+=S+P+z,o>c)break;l++}return Math.max(1,l)},jr=u=>{const f=window.getComputedStyle(u),c=parseFloat(f.paddingLeft)||0,o=parseFloat(f.paddingRight)||0;return Math.max(0,u.clientWidth-c-o)},Kr=(u,f,c)=>{const o=jr(u);if(Ln(u,f,o)>=c)return{hiddenCount:0,visibleCount:c};const l=Ln(u,f,o-48);return{hiddenCount:Math.max(0,c-l),visibleCount:l}},Hr=(u,f,c=!0)=>{const o=a.ref([]),l=a.ref(!1),v=a.ref(""),g=async z=>{if(!z?.length){o.value=[],l.value=!1;return}const k=a.toValue(u),F=a.toValue(f),L=a.toValue(c);if(L&&(!k||!F)){console.warn("执行用户搜索需要提供有效的API基础URL和租户ID"),l.value=!1;return}l.value=!0;try{o.value=Yt(await Ar({apiBaseUrl:k,tenantId:F,keyword:z,enableMultiTenantMode:L}),L)}catch(ne){console.error("用户搜索失败:",ne),o.value=[]}finally{l.value=!1}},b=zr(g,300);return{searchResults:o,loading:l,searchQuery:v,performSearch:g,handleSearchInput:z=>{l.value=!0,v.value=z.trim(),b(v.value)},clearSearch:()=>{v.value="",o.value=[],l.value=!1}}},Wr=u=>{const{searchQuery:f}=u,c=b=>({id:b,name:b,type:Ne.CUSTOM,tenantId:"",login_name:b}),o=b=>a.toValue(u.selectedUserIds).includes(b),l=b=>{const S=a.toValue(u.disabledUserIds)??[];if(typeof b=="string")return S.includes(b);const P=a.toValue(u.disabledUserFields),z=P?.length?P:["id"],k=b;return z.some(F=>{const L=F==="id"?b.id:k[F];return L!=null&&S.includes(String(L))})},v=b=>{const S=a.toValue(u.excludeUserIds)??[];return b.filter(P=>!o(P.id)).filter(P=>!S.includes(P.id))};return{createCustomUser:c,filterNavigableOptions:b=>v(b).filter(S=>!l(S)),isUserSelected:o,isUserDisabled:l,filterOptions:v,filteredUserGroup:a.computed(()=>{const b=a.toValue(u.userGroup);return b?.length?b.filter(S=>{if(!(!o(S.id)&&!S.hidden))return!1;const P=f.value.trim();return P?S.id?.includes(P)||S.name?.includes(P):!0}):[]})}},Yr=u=>typeof u.message=="function"?u.message():u.message,qn=async(u,f)=>{if(!f?.length)return{message:"",valid:!0};for(const c of f){let o=!1;try{o=await c.validator(u)}catch{o=!1}if(!o)return{message:Yr(c),valid:!1}}return{message:"",valid:!0}},Xr=a.defineComponent({name:"MeTag",__name:"me-tag",props:{currentUserId:{type:String,required:!1,default:""},isDisabled:{type:Boolean,required:!1,default:!1}},emits:["click"],setup(u,{expose:f,emit:c}){f();const{t:o}=An(),l=u,v=c,b={t:o,props:l,emit:v,handleClick:()=>{l.isDisabled||v("click")}};return Object.defineProperty(b,"__isScriptSetup",{enumerable:!1,value:!0}),b}}),fn=(u,f)=>{const c=u.__vccOpts||u;for(const[o,l]of f)c[o]=l;return c};function Qr(u,f,c,o,l,v){return c.currentUserId?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["me-tag",{disabled:c.isDisabled}]),onClick:a.withModifiers(o.handleClick,["stop"])},a.toDisplayString(o.t("我")),3)):a.createCommentVNode("v-if",!0)}var Zr=fn(Xr,[["render",Qr],["__scopeId","data-v-a1054364"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/me-tag.vue"]]),Jr="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",$r="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",ea="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",On=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(u){const f=o=>{if(o.type==="virtual")return ea;if(o.type==="userGroup")return Jr;if(!u.avatarBaseUrl)return $r;const l=o.login_name||o.bk_username||o.id;return`${u.avatarBaseUrl}${l}.png?default_when_absent=true`},c=(o,l)=>o("div",{style:{display:"flex",alignItems:"center",maxWidth:"100%",minWidth:0,overflow:"hidden"}},[l.hasAvatar?o("img",{src:f(l.user),style:{width:"20px",height:"20px",borderRadius:"50%",marginRight:"6px",flexShrink:0}}):null,o("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},l.user.name),l.user.tenantId!==l.tenantId&&l.user.tenantId?o("span",{style:{color:"#f59500",marginLeft:"4px"}},`@${l.tenants[l.user.tenantId]||l.user.tenantId}`):null]);return()=>{try{return u.render?u.render(a.h,u.user):c(a.h,u)}catch(o){return console.error("Error rendering tag:",o),c(a.h,u)}}}}),ta=a.defineComponent({name:"SelectionPopover",__name:"selection-popover",props:{avatarBaseUrl:{type:String,required:!1,default:""},containerWidth:{type:[Number,String],required:!1,default:"auto"},disabledUserFields:{type:Array,required:!1,default:()=>["id"]},disabledUserIds:{type:Array,required:!1,default:()=>[]},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(u,{expose:f,emit:c}){f();const{t:o}=An(),l=a.ref(null),v=a.ref(null),g=u,b=c,S=a.computed(()=>{const N={};return Array.isArray(g.userGroup)&&g.userGroup.length>0&&(N[g.userGroupName]=g.userGroup.map(Y=>({...Y,tenantId:"",type:Ne.USER_GROUP}))),g.options.forEach(Y=>{const me=Y.data_source_type===Ne.VIRTUAL?o("虚拟账号"):o("用户");N[me]||(N[me]=[]),N[me].push(Y)}),N}),P=a.computed(()=>Object.values(S.value).some(N=>N.length>0)),z=a.computed(()=>g.recentUsers.length>0),k=a.computed(()=>P.value||z.value),F=N=>g.highlightedIndex<0||!g.flatOptions.length?!1:g.flatOptions[g.highlightedIndex]===N,L=N=>{const Y=N;return g.disabledUserFields.some(me=>{const ye=me==="id"?N.id:Y[me];return ye!=null&&g.disabledUserIds.includes(String(ye))})},ne=N=>{L(N)||b("select-user",N)},De=({event:N})=>{const Y=N.target;l.value?.contains(Y)||v.value?.contains(Y)||b("click-outside",N)};a.watch(()=>g.highlightedIndex,N=>{N<0||!v.value||a.nextTick(()=>{const Y=v.value?.querySelector(".user-option.is-highlighted");Y&&Y.scrollIntoView({block:"nearest",inline:"nearest",behavior:"auto"})})});const re={t:o,slotContainerRef:l,contentContainerRef:v,props:g,emit:b,groupedUsers:S,hasMainOptions:P,hasRecentUsers:z,hasDropdownOptions:k,isHighlighted:F,isUserDisabled:L,selectUser:ne,handleClickOutside:De,get Loading(){return Qe.Loading},get Popover(){return Qe.Popover},get UserRender(){return On}};return Object.defineProperty(re,"__isScriptSetup",{enumerable:!1,value:!0}),re}}),na={ref:"contentContainerRef"},ra={key:0,class:"no-data"},aa={key:0,class:"dropdown-panel dropdown-panel-main"},oa={class:"group-name"},ia={class:"group-count"},la=["aria-disabled","onClick"],sa={key:1,class:"dropdown-panel dropdown-panel-recent"},ua={class:"group-name"},ca={class:"group-count"},da=["aria-disabled","onClick"],fa={ref:"slotContainerRef",class:"selection-trigger"};function ha(u,f,c,o,l,v){return a.openBlock(),a.createBlock(o.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:o.handleClickOutside},{content:a.withCtx(()=>[a.createElementVNode("div",na,[a.createVNode(o.Loading,{class:"dropdown-content",loading:c.loading,mode:"spin",size:"mini"},{default:a.withCtx(()=>[o.hasDropdownOptions?(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(["dropdown-panels",{"is-two-column":o.hasMainOptions&&o.hasRecentUsers}])},[o.hasMainOptions?(a.openBlock(),a.createElementBlock("div",aa,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.groupedUsers,(g,b)=>(a.openBlock(),a.createElementBlock("div",{key:b,class:"user-group"},[Object.keys(o.groupedUsers).length>1||g.some(S=>S.type==="userGroup")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"group-header",onClick:f[0]||(f[0]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",oa,a.toDisplayString(b),1),a.createElementVNode("span",ia,"("+a.toDisplayString(g.length)+")",1)])):a.createCommentVNode("v-if",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(g,S=>(a.openBlock(),a.createElementBlock("div",{key:S.id,"aria-disabled":o.isUserDisabled(S),class:a.normalizeClass(["user-option",{"is-highlighted":o.isHighlighted(S),"is-disabled":o.isUserDisabled(S)}]),onClick:a.withModifiers(P=>o.selectUser(S),["prevent"]),onMousedown:f[1]||(f[1]=a.withModifiers(()=>{},["prevent"]))},[a.createVNode(o.UserRender,{"avatar-base-url":c.avatarBaseUrl,"has-avatar":c.hasAvatar,render:c.renderListItem,"tenant-id":c.tenantId,tenants:c.tenants,user:S},null,8,["avatar-base-url","has-avatar","render","tenant-id","tenants","user"])],42,la))),128))]))),128))])):a.createCommentVNode("v-if",!0),o.hasRecentUsers?(a.openBlock(),a.createElementBlock("div",sa,[c.recentUsersName?(a.openBlock(),a.createElementBlock("div",{key:0,class:"group-header",onClick:f[2]||(f[2]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",ua,a.toDisplayString(c.recentUsersName),1),a.createElementVNode("span",ca,"("+a.toDisplayString(c.recentUsers.length)+")",1)])):a.createCommentVNode("v-if",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.recentUsers,g=>(a.openBlock(),a.createElementBlock("div",{key:g.id,"aria-disabled":o.isUserDisabled(g),class:a.normalizeClass(["user-option",{"is-highlighted":o.isHighlighted(g),"is-disabled":o.isUserDisabled(g)}]),onClick:a.withModifiers(b=>o.selectUser(g),["prevent"]),onMousedown:f[3]||(f[3]=a.withModifiers(()=>{},["prevent"]))},[a.createVNode(o.UserRender,{"avatar-base-url":c.avatarBaseUrl,"has-avatar":c.hasAvatar,render:c.renderListItem,"tenant-id":c.tenantId,tenants:c.tenants,user:g},null,8,["avatar-base-url","has-avatar","render","tenant-id","tenants","user"])],42,da))),128))])):a.createCommentVNode("v-if",!0)],2)):(a.openBlock(),a.createElementBlock("div",ra,[a.createElementVNode("span",null,a.toDisplayString(c.emptyText),1)]))]),_:1},8,["loading"])],512)]),default:a.withCtx(()=>[a.createElementVNode("div",fa,[a.renderSlot(u.$slots,"default",{},void 0,!0)],512)]),_:3},8,["is-show","width"])}var pa=fn(ta,[["render",ha],["__scopeId","data-v-9173accf"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/selection-popover.vue"]]),ga=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(u,{expose:f,emit:c}){f();const o=c,g={emit:o,handleClick:()=>{o("click")},handleClose:()=>{o("close")},get Tag(){return Qe.Tag},get UserRender(){return On}};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}});function va(u,f,c,o,l,v){return a.openBlock(),a.createBlock(o.Tag,{class:a.normalizeClass(["user-tag",{draggable:c.draggable,active:c.active,"is-custom":c.user.type==="custom"}]),closable:"",disabled:"",onClick:a.withModifiers(o.handleClick,["stop"]),onClose:o.handleClose},{default:a.withCtx(()=>[a.createVNode(o.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 ma=fn(ga,[["render",va],["__scopeId","data-v-d1173d20"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/user-tag.vue"]]),ya=a.defineComponent({name:"BkUserSelector",__name:"user-selector",props:{autoFocus:{type:Boolean,required:!1,default:!1},autoHeight:{type:Boolean,required:!1,default:!1},draggable:{type:Boolean,required:!1,default:!1},maxCount:{type:Number,required:!1,default:0},mode:{type:String,required:!1,default:"default"},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},rules:{type:Array,required:!1,default:()=>[]},showCopyAll:{type:Boolean,required:!1,default:!1},showDeleteAll:{type:Boolean,required:!1,default:!1},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},disabledUserIds:{type:Array,required:!1,default:()=>[]},emptyText:{type:String,required:!1,default:""},enableMultiTenantMode:{type:Boolean,required:!1,default:!0},exactSearchKey:{type:String,required:!1,default:xt},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(u,{expose:f,emit:c}){const{t:o}=An();Qe.provideGlobalConfig({prefix:"bk"});const l=u,v=c,g=h=>{v("error",h)},b=h=>{v("unauthorized",h)};Ur(l.apiBaseUrl,l.tenantId,l.allowedApiOrigins,l.allowPrivateApiHost,l.allowCrossOriginCredentials,{onError:g,onUnauthorized:b});const{tenants:S}=Gr(()=>l.apiBaseUrl,()=>l.tenantId,()=>l.enableMultiTenantMode),{searchResults:P,loading:z,searchQuery:k,clearSearch:F,handleSearchInput:L}=Hr(()=>l.apiBaseUrl,()=>l.tenantId,()=>l.enableMultiTenantMode),{fetchCurrentUser:ne}=Or({apiBaseUrl:()=>l.apiBaseUrl,tenantId:()=>l.tenantId,currentUserId:()=>l.currentUserId||"",exactSearchKey:()=>l.exactSearchKey,enableMultiTenantMode:()=>l.enableMultiTenantMode}),De=a.ref(null),re=a.ref(null),N=a.ref(null),Y=a.ref(null),me=a.ref(null),ye=a.ref(null),pe=a.ref(!1),R=a.ref(-1),Pe=a.ref(null),O=a.ref([]),T=a.ref(0),te=a.ref(-1),se=a.ref([]);let X=0,Te=[];const E=a.ref([]),U=a.computed(()=>l.type==="textarea"),qe=a.computed(()=>l.mode==="cell"),yt=a.ref(l.rows*32),ge=a.ref({message:"",valid:!0}),W=a.computed(()=>!ge.value.valid);let Ge=0;const Ze=a.computed(()=>{if(U.value)return{height:`${yt.value}px`,resize:l.resize?"vertical":"none",overflowY:"auto"}}),kt=a.computed(()=>U.value?E.value:O.value),Q=a.computed(()=>l.multiple?Array.isArray(l.modelValue)?l.modelValue:[]:l.modelValue?[l.modelValue]:[]),bt=()=>l.multiple?Q.value:l.modelValue||"",Je=a.ref(bt()),Re=a.computed(()=>l.placeholder||o("请输入人员名称搜索")),hn=a.computed(()=>l.userGroupName||o("用户群组")),Tt=a.computed(()=>l.emptyText||o("无匹配人员")),it=a.computed(()=>o("最近选择")),$e=a.computed(()=>E.value.map(h=>h.id)),lt=a.computed(()=>l.multiple&&!l.disabled&&E.value.length>0&&(l.showCopyAll||l.showDeleteAll)),wt=a.computed(()=>Number(lt.value&&l.showCopyAll)+Number(lt.value&&l.showDeleteAll)+ +!!l.currentUserId),At=a.computed(()=>wt.value>0),Xt=a.computed(()=>{const h=Number(lt.value&&l.showCopyAll)*20+Number(lt.value&&l.showDeleteAll)*20+ +!!l.currentUserId*24,C=Math.max(0,wt.value-1)*8;return`${18+h+C}px`}),Ct=(h,C)=>C?[h.id,h.name,h.bk_username,h.username,h.login_name,h.display_name,h.full_name].some(I=>String(I||"").includes(C)):!0,et=h=>h.split(",").map(C=>C.trim()).filter(Boolean),ae=a.computed(()=>[...new Set(["id",...et(l.exactSearchKey),xt,"login_name","username"])]),_t=(h,C,I)=>h.find(H=>{if(H.id===C)return!0;const ie=H;return I.some(ht=>String(ie[ht]||"")===C)}),St=(h,C,I)=>C.map(H=>_t(h,H,I)).filter(Boolean),Ot=async h=>{const C=et(l.exactSearchKey),I=Yt(await un({apiBaseUrl:l.apiBaseUrl,tenantId:l.tenantId,exactSearchKey:l.exactSearchKey,usersList:h,enableMultiTenantMode:l.enableMultiTenantMode}),l.enableMultiTenantMode),H=h.filter(pt=>!_t(I,pt,C));if(H.length===0||l.exactSearchKey==="bk_username")return St(I,h,C);const ie=Yt(await un({apiBaseUrl:l.apiBaseUrl,tenantId:l.tenantId,exactSearchKey:xt,usersList:H,enableMultiTenantMode:l.enableMultiTenantMode}),l.enableMultiTenantMode),ht=[...I];return ie.forEach(pt=>{ht.some(Jt=>Jt.id===pt.id)||ht.push(pt)}),St(ht,h,[...new Set([...C,xt])])},Ae=a.computed(()=>!l.maxCount||l.maxCount<=0?!1:E.value.length>=l.maxCount),Bt=a.computed(()=>Ae.value||!!l.currentUserId&&l.disabledUserIds.includes(l.currentUserId)||!!l.currentUserId&&E.value.some(h=>h[l.exactSearchKey]===l.currentUserId)),st=a.computed(()=>({avatarBaseUrl:l.avatarBaseUrl,currentTenantId:l.tenantId,hasAvatar:l.hasAvatar,renderTag:l.renderTag,tenants:S.value})),{filteredUserGroup:ze,filterOptions:Qt,filterNavigableOptions:ue,createCustomUser:ce,isUserDisabled:w}=Wr({selectedUserIds:$e,disabledUserFields:ae,disabledUserIds:()=>l.disabledUserIds,excludeUserIds:()=>l.excludeUserIds,userGroup:()=>l.userGroup,searchQuery:k}),{handlePaste:ee}=Lr({apiBaseUrl:()=>l.apiBaseUrl,tenantId:()=>l.tenantId,searchQuery:k,selectedUsers:E,allowCreate:()=>l.allowCreate,freePaste:()=>l.freePaste,enableMultiTenantMode:()=>l.enableMultiTenantMode,maxCount:()=>l.maxCount,multiple:()=>l.multiple,isUserDisabled:w,onAddUser:He,onBatchAddUsers:ve}),B=a.computed(()=>Qt(P.value)),Z=a.computed(()=>{const h=ue(ze.value.map(ie=>({...ie,tenantId:"",type:Ne.USER_GROUP}))),C=ue(B.value),I=C.filter(ie=>ie.data_source_type!==Ne.VIRTUAL),H=C.filter(ie=>ie.data_source_type===Ne.VIRTUAL);return[...h,...I,...H]}),Oe=a.computed(()=>{const h=k.value.trim();return se.value.filter(C=>!$e.value.includes(C.id)).filter(C=>!l.excludeUserIds.includes(C.id)).filter(C=>Ct(C,h))}),je=a.computed(()=>pe.value&&(ze.value.length>0||Oe.value.length>0||k.value.trim()!=="")),K=a.computed(()=>[...Z.value,...ue(Oe.value)]),Ve=a.computed(()=>{const h=k.value;if(!h)return"20px";const C=h.split("").reduce((I,H)=>I+(/[\u4e00-\u9fa5]/.test(H)?12:8),0);return`${Math.max(20,C+4)}px`}),Be=async()=>{const h=Q.value;if(h.length===0){E.value=[];return}let C=[];l.userGroup.length>0&&(C=l.userGroup.filter(I=>h.includes(I.id)).map(I=>({...I,tenantId:"",type:Ne.USER_GROUP})));try{const I=[...C,...await Ot(h)];if(l.allowCreate){const H=[...new Set([...et(l.exactSearchKey),xt])];I.push(...h.filter(ie=>!_t(I,ie,H)).map(ie=>({id:ie,name:ie,type:Ne.CUSTOM,tenantId:""})))}E.value=St(I,h,[...new Set([...et(l.exactSearchKey),xt])])}catch(I){console.error("获取选中用户信息失败:",I),E.value=[]}},he=async()=>{const h=l.recentUserIds.filter(Boolean),C=++X;if(Te=[...h],h.length===0){se.value=[];return}try{const I=(await Ot(h)).filter(H=>H.data_source_type!==Ne.VIRTUAL&&H.type!==Ne.USER_GROUP);if(C!==X)return;se.value=I}catch(I){if(C!==X)return;console.error("获取最近选择用户信息失败:",I),se.value=[]}};function ve(h){if(E.value=h,l.multiple){const C=h.map(I=>I.id);Je.value=C,v("update:modelValue",C),v("change",h),tt(C)}else{const C=h.length>0?h[0]:null,I=C?C.id:"";Je.value=I,v("update:modelValue",I),v("change",C),tt(I)}}const Se=async()=>{const h=++Ge,C=await qn(Je.value,l.rules);return h===Ge&&(ge.value=C),C.valid},tt=h=>{if(!W.value)return;const C=++Ge;qn(h,l.rules).then(I=>{C===Ge&&(ge.value=I)})},oe=async()=>{if(!await Se())throw new Error(ge.value.message);return Je.value},Fe=()=>{!l.draggable||!l.multiple||!re.value||(Pe.value&&Pe.value.destroy(),Pe.value=new br.default(re.value,{animation:150,draggable:".tag-wrapper",onStart:h=>{v("dragStart",h)},onEnd:h=>{const{oldIndex:C,newIndex:I}=h;if(C===I||C===void 0||I===void 0)return;const H=[...E.value],[ie]=H.splice(C,1);H.splice(I,0,ie),ve(H),v("dragEnd",h)}}))},Ke=()=>{if(!E.value.length||U.value){O.value=U.value?[...E.value]:[],T.value=0;return}if(!N.value){O.value=[...E.value],T.value=0;return}const h=N.value.querySelectorAll(".user-tag");if(h.length!==E.value.length){O.value=[...E.value],T.value=0,a.nextTick(Ke);return}const{hiddenCount:C,visibleCount:I}=Kr(N.value,h,E.value.length);O.value=E.value.slice(0,I),T.value=C},nt=()=>{pe.value=!0,R.value=E.value.length-1,a.nextTick(()=>Ee())},be=()=>{pe.value||a.nextTick(Ke)},we=()=>{pe.value&&v("blur"),pe.value=!1,R.value=E.value.length-1,F(),te.value=-1,be()},Mt=h=>{const C=h.target,I=De.value;I?.contains(C)||I===C||we()},Nt=()=>{R.value=E.value.length-1,a.nextTick(()=>Ee())},Ee=()=>{R.value===-1&&E.value.length>0?Y.value?.focus():R.value>=E.value.length-1?ye.value?.focus():me.value?.[0]?.focus()},Zt=h=>{R.value=h,a.nextTick(()=>Ee())},ut=()=>{v("focus"),pe.value=!0},rt=()=>{L(k.value)},ct=async()=>{if(!l.currentUserId||l.disabledUserIds.includes(l.currentUserId)||E.value.some(C=>C[l.exactSearchKey]===l.currentUserId)||l.multiple&&Ae.value)return;const h=await ne();if(h){if(w(h))return;l.multiple?E.value.some(C=>C.id===h.id)||ve([...E.value,h]):ve([h]),F(),te.value=-1,pe.value=!0,R.value=E.value.length-1,a.nextTick(()=>Ee())}},dt=async h=>{await ee(h),R.value=E.value.length-1,a.nextTick(()=>Ee())},Et=h=>{const C=h.target;if(!(h.isComposing||h.keyCode===229||C?.composing)){if(h.key==="Backspace"&&!k.value&&E.value.length>0){if(R.value>=0){const I=E.value[R.value],H=R.value>0?R.value-1:-1;ve(E.value.filter(ie=>ie.id!==I.id)),R.value=H,be(),a.nextTick(()=>Ee())}return}if(h.key==="ArrowDown"&&je.value&&K.value.length>0){h.preventDefault();const I=K.value.length-1;te.value=Math.min(te.value+1,I);return}if(h.key==="ArrowUp"&&je.value&&K.value.length>0){h.preventDefault(),te.value=Math.max(te.value-1,0);return}if(h.key==="Enter"){l.allowCreate&&k.value?He(ce(k.value)):te.value>=0&&K.value[te.value]&&He(K.value[te.value]);return}if(h.key==="ArrowLeft"&&!k.value&&E.value.length>0){h.preventDefault(),R.value===0?R.value=-1:R.value>0&&R.value--,a.nextTick(()=>Ee());return}if(h.key==="ArrowRight"&&!k.value&&E.value.length>0){h.preventDefault(),R.value===-1?R.value=0:R.value<E.value.length-1&&R.value++,a.nextTick(()=>Ee());return}}};function He(h){if(h?.id&&!w(h)){if(l.multiple&&Ae.value){F(),te.value=-1;return}if(!l.multiple)ve([h]),R.value=0;else if(!E.value.some(C=>C.id===h.id)){let C,I;R.value===-1?(C=[h,...E.value],I=0):(C=[...E.value.slice(0,R.value+1),h,...E.value.slice(R.value+1)],I=R.value+1),ve(C),R.value=I}F(),te.value=-1,pe.value=!0,a.nextTick(()=>Ee())}}const de=h=>{if(!h?.id)return;const C=E.value.findIndex(H=>H.id===h.id),I=E.value.filter(H=>H.id!==h.id);ve(I),I.length===0?R.value=-1:R.value>C?R.value--:R.value>=I.length&&(R.value=I.length-1),be()},Pt=()=>{E.value.length&&(R.value=-1,F(),ve([]),be())},Ut=async h=>{if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(h);return}catch{}const C=document.createElement("textarea");C.value=h,C.setAttribute("readonly",""),C.style.position="fixed",C.style.opacity="0",document.body.appendChild(C),C.select();const I=document.execCommand("copy");if(document.body.removeChild(C),!I)throw new Error("复制失败")},It=async()=>{if($e.value.length)try{await Ut($e.value.join(";")),Qe.Message({message:o("已复制"),theme:"success"})}catch(h){Qe.Message({message:o("复制失败"),theme:"error"}),console.error("复制全部用户失败:",h)}};a.watch(E,()=>{be()},{deep:!0}),a.watch(pe,h=>{if(U.value){const C=h?N.value:De.value?.querySelector(".tags-container.focused");C&&C.offsetHeight>0&&(yt.value=C.offsetHeight)}h&&a.nextTick(()=>Fe())}),a.watch(K,h=>{h.length>0&&je.value?te.value=0:te.value=-1}),a.watch(()=>l.userGroup,()=>{Be()}),a.watch(()=>l.recentUserIds,()=>{const h=l.recentUserIds.filter(Boolean);Te.length===h.length&&Te.every((C,I)=>C===h[I])||he()},{deep:!0}),a.watch([()=>l.modelValue,()=>l.multiple],()=>{Je.value=bt();const h=E.value.map(I=>I.id),C=Q.value;(h.length!==C.length||!h.every((I,H)=>I===C[H]))&&Be()},{deep:!0}),a.watch(()=>l.rules,()=>{!W.value&&(l.rules?.length??0)>0||Se()},{deep:!0}),qr(De,()=>{be()});let We;a.onBeforeMount(()=>{We=Promise.all([Be(),he()]).then(()=>{})}),a.onMounted(async()=>{Fe(),a.nextTick(Ke),l.autoFocus&&!l.disabled&&(await We,await a.nextTick(),nt())}),a.onUnmounted(()=>{Pe.value?.destroy()}),f({focus:nt,blur:we,validate:Se,getValue:oe});const ft={t:o,props:l,emit:v,handleApiError:g,handleApiUnauthorized:b,tenants:S,searchResults:P,searchLoading:z,searchQuery:k,clearSearch:F,handleSearchInput:L,fetchCurrentUser:ne,containerRef:De,sortableContainerRef:re,collapsedContainerRef:N,frontInputRef:Y,inlineInputRef:me,lastInputRef:ye,isFocused:pe,activeTagIndex:R,sortableInstance:Pe,visibleUsers:O,hiddenCount:T,highlightedIndex:te,recentUsers:se,get recentUsersRequestId(){return X},set recentUsersRequestId(h){X=h},get recentUserIdsSnapshot(){return Te},set recentUserIdsSnapshot(h){Te=h},selectedUsers:E,isTextareaMode:U,isCellMode:qe,textareaHeight:yt,validationState:ge,isInvalid:W,get validationRequestId(){return Ge},set validationRequestId(h){Ge=h},textareaStyle:Ze,collapsedDisplayUsers:kt,modelValueIds:Q,getCurrentPropModelValue:bt,currentModelValue:Je,computedPlaceholder:Re,computedUserGroupName:hn,computedEmptyText:Tt,computedRecentUsersName:it,selectedUserIds:$e,showBatchActions:lt,selectorActionCount:wt,showSelectorActions:At,selectorActionsPadding:Xt,isUserMatchedByQuery:Ct,getLookupFields:et,disabledUserFields:ae,findUserByLookupId:_t,sortUsersByLookupIds:St,lookupFormattedUsersByIds:Ot,isMaxCountReached:Ae,isMeTagDisabled:Bt,userTagCommonProps:st,filteredUserGroup:ze,filterOptions:Qt,filterNavigableOptions:ue,createCustomUser:ce,isUserDisabled:w,handlePaste:ee,displayOptions:B,mainNavigableUsers:Z,filteredRecentUsers:Oe,showDropdown:je,flatOptions:K,inputWidth:Ve,initSelectedUsers:Be,initRecentUsers:he,updateSelectedUsers:ve,validate:Se,validateAfterInvalid:tt,getValue:oe,initSortable:Fe,calculateVisibleUsers:Ke,handleFocus:nt,scheduleVisibleUsersCalculation:be,blur:we,handleClickOutside:Mt,handleContainerClick:Nt,focusCurrentInput:Ee,handleTagClick:Zt,handleInputFocus:ut,handleInput:rt,addCurrentUser:ct,onPaste:dt,handleKeyDown:Et,addUser:He,removeUser:de,deleteAllUsers:Pt,writeClipboardText:Ut,copyAllUsers:It,get initPromise(){return We},set initPromise(h){We=h},get PopConfirm(){return Qe.PopConfirm},get Popover(){return Qe.Popover},get Tag(){return Qe.Tag},get RESERVED_SPACE_FOR_OVERFLOW_TAG(){return 48},MeTag:Zr,SelectionPopover:pa,get UserRender(){return On},UserTag:ma};return Object.defineProperty(ft,"__isScriptSetup",{enumerable:!1,value:!0}),ft}}),ba={ref:"sortableContainerRef",class:"tag-list"},wa=["placeholder"],Ca={class:"hidden-users"},_a=["placeholder"],Sa=["aria-label","title"],Ea=["aria-label","title"];function Ua(u,f,c,o,l,v){return a.openBlock(),a.createElementBlock("div",{ref:"containerRef",class:a.normalizeClass(["bk-user-selector",{"has-selector-actions":o.showSelectorActions,"is-auto-height":c.autoHeight,"is-cell":o.isCellMode,"is-disabled":c.disabled,"is-focused":o.isFocused,"is-invalid":o.isInvalid,"is-textarea":o.isTextareaMode}]),style:a.normalizeStyle({"--overflow-tag-reserve":`${o.RESERVED_SPACE_FOR_OVERFLOW_TAG}px`,"--selector-actions-padding":o.selectorActionsPadding})},[a.createCommentVNode(" 下拉选项列表 "),a.createVNode(o.SelectionPopover,{"avatar-base-url":c.avatarBaseUrl,"container-width":o.containerRef?o.containerRef.offsetWidth:"auto","disabled-user-fields":o.disabledUserFields,"disabled-user-ids":c.disabledUserIds,"empty-text":o.computedEmptyText,"flat-options":o.flatOptions,"has-avatar":c.hasAvatar,"highlighted-index":o.highlightedIndex,"is-show":o.showDropdown,loading:o.searchLoading,options:o.displayOptions,"recent-users":o.filteredRecentUsers,"recent-users-name":o.computedRecentUsersName,"render-list-item":c.renderListItem,"search-query":o.searchQuery,"tenant-id":c.tenantId,tenants:o.tenants,"user-group":o.filteredUserGroup,"user-group-name":o.computedUserGroupName,onClickOutside:o.handleClickOutside,onSelectUser:o.addUser},{default:a.withCtx(()=>[a.createCommentVNode(" 聚焦状态 - 可编辑模式 "),a.withDirectives(a.createElementVNode("div",{class:a.normalizeClass(["tags-container focused",{"has-selection":o.selectedUsers.length>0}]),style:a.normalizeStyle(o.textareaStyle),onClick:a.withModifiers(o.handleContainerClick,["stop"])},[a.createCommentVNode(" 用户标签列表 "),a.createElementVNode("div",ba,[a.createCommentVNode(" 在第一个标签之前的输入框 "),o.activeTagIndex===-1&&o.selectedUsers.length>0?a.withDirectives((a.openBlock(),a.createElementBlock("input",{key:0,ref:"frontInputRef","onUpdate:modelValue":f[0]||(f[0]=g=>o.searchQuery=g),autofocus:"",class:"search-input input-inline",style:a.normalizeStyle({width:o.inputWidth}),onFocus:o.handleInputFocus,onInput:o.handleInput,onKeydown:o.handleKeyDown,onPaste:o.onPaste},null,36)),[[a.vModelText,o.searchQuery]]):a.createCommentVNode("v-if",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.selectedUsers,(g,b)=>(a.openBlock(),a.createElementBlock("div",{key:g.id,class:"tag-wrapper"},[a.createVNode(o.UserTag,a.mergeProps({ref_for:!0},o.userTagCommonProps,{active:b===o.activeTagIndex,draggable:c.draggable&&c.multiple,user:g,onClick:S=>o.handleTagClick(b),onClose:S=>o.removeUser(g)}),null,16,["active","draggable","user","onClick","onClose"]),a.createCommentVNode(" 在当前激活标签后插入输入框 "),b===o.activeTagIndex&&o.activeTagIndex!==o.selectedUsers.length-1?a.withDirectives((a.openBlock(),a.createElementBlock("input",{key:0,ref_for:!0,ref:"inlineInputRef","onUpdate:modelValue":f[1]||(f[1]=S=>o.searchQuery=S),autofocus:"",class:"search-input input-inline",style:a.normalizeStyle({width:o.inputWidth}),onFocus:o.handleInputFocus,onInput:o.handleInput,onKeydown:o.handleKeyDown,onPaste:o.onPaste},null,36)),[[a.vModelText,o.searchQuery]]):a.createCommentVNode("v-if",!0)]))),128)),a.createCommentVNode(" 最后一个输入框(末尾位置或无用户时显示) "),o.activeTagIndex>=o.selectedUsers.length-1?a.withDirectives((a.openBlock(),a.createElementBlock("input",{key:1,ref:"lastInputRef","onUpdate:modelValue":f[2]||(f[2]=g=>o.searchQuery=g),autofocus:"",class:"search-input input-last",placeholder:o.selectedUsers.length?"":o.computedPlaceholder,onFocus:o.handleInputFocus,onInput:o.handleInput,onKeydown:o.handleKeyDown,onPaste:o.onPaste},null,40,wa)),[[a.vModelText,o.searchQuery]]):a.createCommentVNode("v-if",!0)],512)],6),[[a.vShow,o.isFocused]]),a.createCommentVNode(" 未聚焦状态 - 只读展示模式 "),a.withDirectives(a.createElementVNode("div",{ref:"collapsedContainerRef",class:a.normalizeClass(["tags-container tags-container-collapsed",{"has-overflow":o.hiddenCount>0,"has-selection":o.selectedUsers.length>0}]),style:a.normalizeStyle(o.textareaStyle),onClick:a.withModifiers(o.handleFocus,["stop"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.collapsedDisplayUsers,g=>(a.openBlock(),a.createBlock(o.UserTag,a.mergeProps({key:g.id},{ref_for:!0},o.userTagCommonProps,{"show-tenant":!0,user:g,onClick:o.handleFocus,onClose:b=>o.removeUser(g)}),null,16,["user","onClose"]))),128)),a.createCommentVNode(" 显示折叠标签数量(textarea 模式下不折叠) "),o.hiddenCount>0&&!o.isTextareaMode?(a.openBlock(),a.createBlock(o.Popover,{key:0,placement:"top"},{content:a.withCtx(()=>[a.createElementVNode("div",Ca,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.selectedUsers.slice(o.visibleUsers.length),g=>(a.openBlock(),a.createBlock(o.UserRender,{key:g.id,"avatar-base-url":c.avatarBaseUrl,"has-avatar":c.hasAvatar,"tenant-id":c.tenantId,tenants:o.tenants,user:g},null,8,["avatar-base-url","has-avatar","tenant-id","tenants","user"]))),128))])]),default:a.withCtx(()=>[a.createVNode(o.Tag,null,{default:a.withCtx(()=>[a.createTextVNode(" +"+a.toDisplayString(o.hiddenCount),1)]),_:1})]),_:1})):a.createCommentVNode("v-if",!0),a.createCommentVNode(" 搜索输入框 "),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":f[3]||(f[3]=g=>o.searchQuery=g),class:"search-input search-input-collapsed",placeholder:o.selectedUsers.length?"":o.computedPlaceholder,onFocus:o.handleFocus},null,40,_a),[[a.vModelText,o.searchQuery]])],6),[[a.vShow,!o.isFocused]])]),_:1},8,["avatar-base-url","container-width","disabled-user-fields","disabled-user-ids","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"]),a.createCommentVNode(' 右侧操作区:"我"、复制全部、删除全部横向并列,避免相互遮挡 '),o.showSelectorActions?(a.openBlock(),a.createElementBlock("div",{key:0,class:"selector-actions",onMousedown:f[4]||(f[4]=a.withModifiers(()=>{},["prevent"]))},[o.showBatchActions&&c.showCopyAll?(a.openBlock(),a.createElementBlock("button",{key:0,class:"batch-action","aria-label":o.t("复制全部"),title:o.t("复制全部"),type:"button",onClick:a.withModifiers(o.copyAllUsers,["stop"])},[...f[6]||(f[6]=[a.createElementVNode("span",{class:"batch-action-icon copy-all-icon"},null,-1)])],8,Sa)):a.createCommentVNode("v-if",!0),o.showBatchActions&&c.showDeleteAll?(a.openBlock(),a.createBlock(o.PopConfirm,{key:1,"cancel-text":o.t("取消"),"confirm-config":{theme:"danger"},"confirm-text":o.t("删除"),content:o.t("删除全部后无法撤回,请谨慎确认。"),"ext-cls":"bk-user-selector-delete-confirm",placement:"bottom-end",title:o.t("确认删除全部已选人员?"),trigger:"click",width:260,onConfirm:o.deleteAllUsers},{default:a.withCtx(()=>[a.createElementVNode("button",{class:"batch-action batch-action-danger","aria-label":o.t("删除全部"),title:o.t("删除全部"),type:"button"},[...f[7]||(f[7]=[a.createElementVNode("span",{class:"batch-action-icon delete-all-icon"},null,-1)])],8,Ea)]),_:1},8,["cancel-text","confirm-text","content","title"])):a.createCommentVNode("v-if",!0),a.createVNode(o.MeTag,{"current-user-id":c.currentUserId,"is-disabled":o.isMeTagDisabled,onClick:o.addCurrentUser},null,8,["current-user-id","is-disabled"])],32)):a.createCommentVNode("v-if",!0),o.isInvalid?(a.openBlock(),a.createBlock(o.Popover,{key:1,content:o.validationState.message,placement:"top"},{default:a.withCtx(()=>[a.createElementVNode("span",{class:"validation-error-icon",onClick:f[5]||(f[5]=a.withModifiers(()=>{},["stop"]))}," ! ")]),_:1},8,["content"])):a.createCommentVNode("v-if",!0)],6)}var Yn=fn(ya,[["render",Ua],["__scopeId","data-v-089550be"],["__file","/Users/brooklin/project/bkui-monorepo/packages/bk-user-selector/src/components/user-selector.vue"]]),Ia=Yn;exports.BkUserSelector=Yn;exports.default=Ia;
|