@vaebe/ccui 2.0.0-beta.0 → 2.0.1-beta.1

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.
Files changed (83) hide show
  1. package/README.md +4 -0
  2. package/button/index.es.js +28 -22
  3. package/button/index.umd.js +1 -1
  4. package/calendar/index.es.js +445 -90
  5. package/calendar/index.umd.js +1 -1
  6. package/ccui-cli.css +1 -1
  7. package/check-box/index.es.js +8 -2
  8. package/check-box/index.umd.js +1 -1
  9. package/chunk-Ndeg2fpE.js +20 -0
  10. package/collapse/index.es.js +10 -7
  11. package/collapse/index.umd.js +1 -1
  12. package/config-provider/chunk-C_CI6nMA.js +13 -0
  13. package/config-provider/en-BG83iZ_P.js +24 -0
  14. package/config-provider/index.es.js +408 -53
  15. package/config-provider/index.umd.js +1 -1
  16. package/config-provider/ja-B-93MQG5.js +56 -0
  17. package/config-provider/ko-86th3uXt.js +56 -0
  18. package/config-provider/zh-cn-BQE-LNg1.js +59 -0
  19. package/date-picker/ccui-cli.css +1 -1
  20. package/date-picker/index.es.js +664 -482
  21. package/date-picker/index.umd.js +1 -1
  22. package/drawer/index.es.js +271 -279
  23. package/drawer/index.umd.js +1 -1
  24. package/dropdown/index.es.js +187 -171
  25. package/dropdown/index.umd.js +1 -1
  26. package/empty/index.es.js +341 -24
  27. package/empty/index.umd.js +1 -1
  28. package/en-BVwCvuzF.js +24 -0
  29. package/float-button/index.es.js +1134 -46
  30. package/float-button/index.umd.js +1 -1
  31. package/form/index.es.js +1357 -261
  32. package/form/index.umd.js +1 -1
  33. package/icon/index.es.js +93 -10
  34. package/icon/index.umd.js +1 -1
  35. package/image/index.es.js +353 -36
  36. package/image/index.umd.js +1 -1
  37. package/input/index.es.js +24 -15
  38. package/input/index.umd.js +1 -1
  39. package/input-number/index.es.js +45 -25
  40. package/input-number/index.umd.js +1 -1
  41. package/ja-B4U4rt8A.js +56 -0
  42. package/ko-BG35I8uK.js +56 -0
  43. package/menu/index.es.js +3 -1
  44. package/menu/index.umd.js +1 -1
  45. package/message/index.es.js +1179 -86
  46. package/message/index.umd.js +1 -1
  47. package/modal/index.es.js +735 -335
  48. package/modal/index.umd.js +1 -1
  49. package/notification/index.es.js +1176 -83
  50. package/notification/index.umd.js +1 -1
  51. package/package.json +9 -9
  52. package/pagination/index.es.js +381 -60
  53. package/pagination/index.umd.js +1 -1
  54. package/popconfirm/index.es.js +469 -143
  55. package/popconfirm/index.umd.js +1 -1
  56. package/popover/index.es.js +192 -175
  57. package/popover/index.umd.js +1 -1
  58. package/radio/index.es.js +8 -2
  59. package/radio/index.umd.js +1 -1
  60. package/rate/index.es.js +22 -12
  61. package/rate/index.umd.js +1 -1
  62. package/select/index.es.js +135 -53
  63. package/select/index.umd.js +1 -1
  64. package/slider/index.es.js +165 -155
  65. package/slider/index.umd.js +1 -1
  66. package/steps/index.es.js +1140 -49
  67. package/steps/index.umd.js +1 -1
  68. package/switch/index.es.js +2 -0
  69. package/switch/index.umd.js +1 -1
  70. package/tabs/index.es.js +31 -5
  71. package/tabs/index.umd.js +1 -1
  72. package/tag/index.es.js +53 -35
  73. package/tag/index.umd.js +1 -1
  74. package/tooltip/index.es.js +78 -77
  75. package/tooltip/index.umd.js +1 -1
  76. package/tree/ccui-cli.css +1 -1
  77. package/tree/index.es.js +1491 -276
  78. package/tree/index.umd.js +1 -1
  79. package/typography/index.es.js +1213 -125
  80. package/typography/index.umd.js +1 -1
  81. package/vue-ccui.es.js +8726 -7604
  82. package/vue-ccui.umd.js +1 -1
  83. package/zh-cn-C8nbfD5S.js +59 -0
package/tree/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.index={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n(e){if(!(e==null||e===``))return typeof e==`number`?`${e}px`:e}function r(e){let{name:r,viewBox:i=`0 0 1024 1024`,path:a}=e,o=Array.isArray(a)?a:[a],s=e=>{let r=n(e.size),a={display:`inline-flex`,lineHeight:0,verticalAlign:`-0.125em`};r&&(a.fontSize=r),e.color&&(a.color=e.color);let s=e.rotate;s!==void 0&&s!==``&&(a.transform=`rotate(${typeof s==`number`?`${s}deg`:s})`,a.transformOrigin=`center`);let c=typeof e.style==`string`?a:{...a,...e.style};return(0,t.h)(`span`,{class:[`ccui-icon`,e.spin&&`ccui-icon--spin`,e.class],style:c,"aria-hidden":`true`},(0,t.h)(`svg`,{viewBox:i,width:`1em`,height:`1em`,fill:`currentColor`},o.map(e=>(0,t.h)(`path`,{d:e}))))};return s.displayName=r,s.props=[`size`,`color`,`rotate`,`spin`,`class`,`style`],s}var i=r({name:`CaretRightOutlined`,path:`M384 192v640l384-320.064z`});function a(e,t,n){let r=e;return t&&(r+=`__${t}`),n&&(r+=`--${n}`),r}function o(e,t=!1){let n=t?`.ccui-${e}`:`ccui-${e}`;return{b:()=>a(n),e:e=>e?a(n,e):``,m:e=>e?a(n,``,e):``,em:(e,t)=>e&&t?a(n,e,t):``,is:e=>`is-${e}`}}function s(e,n){let r=(0,t.ref)(0),i=n.buffer??4,a=(0,t.computed)(()=>e.value.length*n.itemHeight),o=(0,t.computed)(()=>Math.min(n.maxHeight,a.value));return{scrollTop:r,onScroll:e=>{r.value=e.currentTarget.scrollTop},visible:(0,t.computed)(()=>{let t=e.value;if(t.length===0)return[];let a=Math.max(0,Math.floor(r.value/n.itemHeight)-i),s=Math.ceil(o.value/n.itemHeight)+i*2,c=Math.min(t.length,a+s),l=[];for(let e=a;e<c;e+=1)l.push({index:e,data:t[e],top:e*n.itemHeight});return l}),totalHeight:a,containerHeight:o,scrollToIndex:(e,t)=>{if(!t)return;let i=e*n.itemHeight;i<r.value?t.scrollTop=i:i+n.itemHeight>r.value+o.value&&(t.scrollTop=i-o.value+n.itemHeight)}}}function c(e,n,r){return(0,t.computed)(()=>{let{flatAll:t,byKey:i}=e.value;if(r.value)return{checked:new Set(n.value),halfChecked:new Set};let a=new Set,o=new Set,s=new Set(n.value),c=e=>{let t=i.get(e);return!!t&&!t.disableCheckbox&&!t.disabled};for(let e of t)if(s.has(e.key)){let t=[e];for(;t.length;){let e=t.pop();c(e.key)&&a.add(e.key);for(let n of e.childKeys){let e=i.get(n);e&&t.push(e)}}}for(let e=t.length-1;e>=0;--e){let n=t[e];if(!n.hasChildren)continue;let r=n.childKeys.map(e=>i.get(e)).filter(e=>!!e&&c(e.key));if(r.length===0)continue;let s=r.every(e=>a.has(e.key)),l=r.some(e=>a.has(e.key)||o.has(e.key));s?(c(n.key)&&a.add(n.key),o.delete(n.key)):l&&(o.add(n.key),a.delete(n.key))}return{checked:a,halfChecked:o}})}function l(e,t,n,r){let i=e.byKey.get(n);if(!i||i.disabled||i.disableCheckbox)return Array.from(t);let a=t.has(n),o=new Set(t);if(r)return a?o.delete(n):o.add(n),Array.from(o);let s=[],c=[n];for(;c.length;){let t=c.pop();s.push(t);let n=e.byKey.get(t);if(n)for(let e of n.childKeys)c.push(e)}if(a)for(let e of s)o.delete(e);else for(let t of s){let n=e.byKey.get(t);n&&!n.disabled&&!n.disableCheckbox&&o.add(t)}for(let t of[...i.parentKeys].reverse()){let n=e.byKey.get(t);if(!n)continue;let r=n.childKeys.map(t=>e.byKey.get(t)).filter(e=>!!e&&!e.disableCheckbox&&!e.disabled);r.length!==0&&(r.every(e=>o.has(e.key))?o.add(t):o.delete(t))}return Array.from(o)}var u={key:`key`,title:`title`,children:`children`,disabled:`disabled`,disableCheckbox:`disableCheckbox`,isLeaf:`isLeaf`,selectable:`selectable`};function d(e){return{...u,...e}}function f(e,t,n){return e[t.key]??`__auto_${n}`}function p(e,t){let n=e[t.children];return Array.isArray(n)?n:void 0}function m(e,t,n,r,i){let a=p(e,t),o=e[t.isLeaf],s=!!a&&a.length>0,c=o===void 0?!s&&!e.loadable:o,l=f(e,t,i);return{key:l,raw:e,title:e[t.title]??l,level:n,parentKeys:r,isLeaf:c,disabled:!!e[t.disabled],disableCheckbox:!!e[t.disableCheckbox],selectable:e[t.selectable]!==!1,hasChildren:s,childKeys:s?a.map((e,n)=>f(e,t,i*1e3+n)):[]}}function h(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function ee(e,n){return(0,t.computed)(()=>{let t=[],r=new Map,i=new Map,a=[],o=n.value,s=0,c=(e,n,l)=>{let u=[];for(let i of e){s+=1;let e=m(i,o,n,l,s);t.push(e),u.push(e),r.set(e.key,e);let a=p(i,o);a&&c(a,n+1,[...l,e.key])}l.length===0?a.push(...u.map(e=>e.key)):i.set(l[l.length-1],u)};return c(e.value,0,[]),{flatAll:t,byKey:r,childrenByKey:i,rootKeys:a}})}function te(e,n,r,i){return(0,t.computed)(()=>{let{flatAll:t}=e.value,a=n.value,o=r.value.trim(),s=i?.value,c=[],l=new Set;if(o||s){for(let e of t)if(s?s(e.raw,e.parentKeys):o.length>0&&h(e.title).toLowerCase().includes(o.toLowerCase())){l.add(e.key);for(let t of e.parentKeys)l.add(t)}}for(let e of t)l.size>0&&!l.has(e.key)||e.parentKeys.every(e=>a.has(e))&&c.push(e);return c})}function g(e){return new Set(e??[])}function _(e,n,r){let i=(0,t.ref)(g(n.value));return(0,t.watch)(e,e=>{e!==void 0&&(i.value=g(e))}),{current:(0,t.computed)(()=>e.value===void 0?i.value:g(e.value)),setKeys:t=>{e.value===void 0&&(i.value=g(t)),r(t)}}}function ne(e,n,r){let i=(0,t.computed)(()=>e.selectedKeys),a=(0,t.computed)(()=>e.defaultSelectedKeys??[]),o=(0,t.computed)(()=>e.checkedKeys),s=(0,t.computed)(()=>e.defaultCheckedKeys??[]),c=(0,t.computed)(()=>e.expandedKeys),l=(0,t.computed)(()=>e.expandedKeys?e.expandedKeys:n.value.length>0?n.value:e.defaultExpandedKeys??[]),u=_(i,a,e=>r(`update:selectedKeys`,e)),d=_(o,s,e=>r(`update:checkedKeys`,e)),f=_(c,l,e=>r(`update:expandedKeys`,e));return{selectedKeys:u.current,setSelectedKeys:u.setKeys,checkedKeys:d.current,setCheckedKeys:d.setKeys,expandedKeys:f.current,setExpandedKeys:f.setKeys}}var v={data:{type:Array,default:()=>[]},fieldNames:{type:Object,default:()=>({})},selectable:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1},selectedKeys:{type:Array,default:void 0},defaultSelectedKeys:{type:Array,default:()=>[]},checkable:{type:Boolean,default:!1},checkedKeys:{type:Array,default:void 0},defaultCheckedKeys:{type:Array,default:()=>[]},checkStrictly:{type:Boolean,default:!1},expandedKeys:{type:Array,default:void 0},defaultExpandedKeys:{type:Array,default:()=>[]},defaultExpandAll:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loadData:{type:Function,default:void 0},draggable:{type:Boolean,default:!1},showLine:{type:Boolean,default:!1},blockNode:{type:Boolean,default:!1},expandAction:{type:[String,Boolean],default:`click`},searchValue:{type:String,default:``},filterTreeNode:{type:Function,default:void 0},indentSize:{type:Number,default:24},virtualScroll:{type:Boolean,default:!1},virtualItemHeight:{type:Number,default:32},virtualMaxHeight:{type:Number,default:320},focusedKey:{type:[String,Number],default:void 0},dragHoverExpandDelay:{type:Number,default:600},dragAutoScroll:{type:Boolean,default:!0},dragAutoScrollEdge:{type:Number,default:32},dragAutoScrollSpeed:{type:Number,default:12},classNames:{type:Object,default:void 0},styles:{type:Object,default:void 0}};function re(e){return e.filter(e=>e.hasChildren).map(e=>e.key)}function y(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function ie(e,n){let r=y(e);if(!n)return r;let i=r.toLowerCase(),a=n.toLowerCase(),o=i.indexOf(a);return o<0?r:(0,t.h)(`span`,null,[r.slice(0,o),(0,t.h)(`span`,{class:`ccui-tree__highlight`},r.slice(o,o+n.length)),r.slice(o+n.length)])}var b=(0,t.defineComponent)({name:`CTree`,props:v,emits:[`update:selectedKeys`,`update:checkedKeys`,`update:expandedKeys`,`update:focusedKey`,`select`,`check`,`expand`,`load`,`drop`,`dragstart`,`dragenter`,`dragover`,`dragleave`,`focus-change`,`load-error`],setup(e,{emit:n,expose:r,slots:a}){let u=o(`tree`),f=(0,t.computed)(()=>d(e.fieldNames)),p=(0,t.toRef)(e,`data`),m=(0,t.toRef)(e,`searchValue`),h=(0,t.computed)(()=>e.filterTreeNode),g=ee(p,f),_=(0,t.ref)([]);e.defaultExpandAll&&e.expandedKeys===void 0&&(e.defaultExpandedKeys??[]).length===0&&(_.value=re(g.value.flatAll));let{selectedKeys:v,setSelectedKeys:y,checkedKeys:b,setCheckedKeys:ae,expandedKeys:x,setExpandedKeys:oe}=ne(e,_,n),S=c(g,b,(0,t.computed)(()=>e.checkStrictly)),C=te(g,x,m,h),w=(0,t.ref)(new Set),T=(0,t.ref)(new Set),E=(0,t.ref)(new Set),D=(0,t.shallowRef)(null),O=(0,t.shallowRef)(null),k=(0,t.shallowRef)(null),A=(0,t.shallowRef)(null),j=(0,t.shallowRef)(null),M=(0,t.shallowRef)(0),N=(0,t.ref)(e.focusedKey),P=(0,t.computed)(()=>e.focusedKey===void 0?N.value:e.focusedKey),F=t=>{e.focusedKey===void 0&&(N.value=t),n(`update:focusedKey`,t),n(`focus-change`,t)},I=(0,t.ref)(null),L=(0,t.ref)(null),R=(0,t.computed)(()=>{let e=new Map;return C.value.forEach((t,n)=>e.set(t.key,n)),e}),z=(0,t.computed)(()=>e.virtualScroll&&C.value.length>0),B=s(C,{itemHeight:e.virtualItemHeight,maxHeight:e.virtualMaxHeight}),V=async(t,r)=>{if(e.loadData){E.value.delete(t.key),E.value=new Set(E.value),w.value.add(t.key),w.value=new Set(w.value);try{await e.loadData(t.raw),T.value.add(t.key),T.value=new Set(T.value),n(`load`,Array.from(T.value),{event:r,node:t})}catch(e){E.value.add(t.key),E.value=new Set(E.value),n(`load-error`,{error:e,node:t})}finally{w.value.delete(t.key),w.value=new Set(w.value)}}},H=async(t,r)=>{if(e.disabled)return;let i=x.value.has(t.key),a=new Set(x.value);i?a.delete(t.key):(a.add(t.key),e.loadData&&!t.hasChildren&&!t.isLeaf&&!T.value.has(t.key)&&await V(t,r));let o=Array.from(a);oe(o),n(`expand`,o,{expanded:!i,node:t})},U=async t=>{let n=g.value.byKey.get(t);!n||!e.loadData||await V(n)},W=(t,r)=>{if(e.disabled||!e.selectable||!t.selectable||t.disabled)return;let i=v.value.has(t.key),a;a=e.multiple?i?Array.from(v.value).filter(e=>e!==t.key):[...v.value,t.key]:i?[]:[t.key],y(a),n(`select`,a,{selectedKeys:a,selected:!i,node:t,event:r})},G=(t,r)=>{if(e.disabled||!e.checkable||t.disableCheckbox||t.disabled)return;let i=S.value.checked.has(t.key),a=e.checkStrictly?b.value:S.value.checked,o=l(g.value,a,t.key,e.checkStrictly);ae(o),n(`check`,o,{checkedKeys:o,halfCheckedKeys:Array.from(S.value.halfChecked),checked:!i,node:t,event:r})},se=(t,r)=>{if(!e.draggable||r.disabled){t.preventDefault();return}O.value=r.key,t.dataTransfer?.setData(`text/plain`,String(r.key)),n(`dragstart`,{event:t,node:r})},K=(e,t)=>{let n=t.getBoundingClientRect();if(!n.height)return`inside`;let r=(e.clientY-n.top)/n.height;return r<.25?`before`:r>.75?`after`:`inside`},q=()=>{k.value&&=(clearTimeout(k.value),null),A.value=null},ce=(t,n)=>{!e.dragHoverExpandDelay||e.dragHoverExpandDelay<=0||!t.hasChildren&&(!e.loadData||t.isLeaf)||x.value.has(t.key)||A.value!==t.key&&(q(),A.value=t.key,k.value=setTimeout(()=>{O.value!==null&&A.value===t.key&&H(t,n),k.value=null},e.dragHoverExpandDelay))},J=()=>{M.value=0,j.value!==null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(j.value),j.value=null},Y=()=>{let e=L.value;if(!e||M.value===0){j.value=null;return}e.scrollTop+=M.value,typeof requestAnimationFrame==`function`?j.value=requestAnimationFrame(Y):j.value=null},le=t=>{if(!e.dragAutoScroll)return;let n=L.value;if(!n)return;let r=n.getBoundingClientRect(),i=e.dragAutoScrollEdge,a=e.dragAutoScrollSpeed,o=t.clientY-r.top,s=r.bottom-t.clientY,c=0;o<i&&o>0?c=-a:s<i&&s>0&&(c=a);let l=M.value===0;M.value=c,c!==0&&l&&typeof requestAnimationFrame==`function`?j.value=requestAnimationFrame(Y):c===0&&J()},ue=(t,r)=>{if(!e.draggable||O.value===null)return;t.preventDefault();let i=K(t,t.currentTarget);D.value={key:r.key,position:i},i===`inside`?ce(r,t):A.value!==null&&q(),le(t),n(`dragover`,{event:t,node:r})},de=(t,r)=>{e.draggable&&n(`dragenter`,{event:t,node:r})},fe=(t,r)=>{e.draggable&&(A.value===r.key&&q(),n(`dragleave`,{event:t,node:r}))},pe=(t,r)=>{if(!e.draggable||O.value===null)return;t.preventDefault(),q(),J();let i=g.value.byKey.get(O.value);if(!i||i.key===r.key){O.value=null,D.value=null;return}n(`drop`,{event:t,node:r,dragNode:i,dropPosition:D.value?.key===r.key?D.value.position:`inside`}),O.value=null,D.value=null},me=n=>{if(a.switcher)return a.switcher({expanded:x.value.has(n.key),node:n,loading:w.value.has(n.key),loadFailed:E.value.has(n.key)});let r=x.value.has(n.key),o=w.value.has(n.key),s=E.value.has(n.key);return o?(0,t.h)(`span`,{class:u.e(`switcher-loading`)},`○`):s?(0,t.h)(`span`,{class:u.e(`switcher-error`),role:`button`,title:`Click to retry`,onClick:e=>{e.stopPropagation(),U(n.key)}},`!`):n.isLeaf&&!n.hasChildren?(0,t.h)(`span`,{class:u.e(`switcher-leaf`)}):(0,t.h)(`span`,{class:[u.e(`switcher`),r&&u.em(`switcher`,`open`),e.classNames?.switcher],style:e.styles?.switcher},(0,t.h)(i,{size:12}))},he=n=>{if(!e.checkable)return null;let r=S.value.checked.has(n.key),i=S.value.halfChecked.has(n.key);return(0,t.h)(`span`,{class:[u.e(`checkbox`),r&&u.em(`checkbox`,`checked`),i&&u.em(`checkbox`,`indeterminate`),(n.disabled||n.disableCheckbox)&&u.em(`checkbox`,`disabled`)],role:`checkbox`,"aria-checked":i?`mixed`:r,onClick:e=>{e.stopPropagation(),G(n,e)}},r?`✓`:i?`–`:``)},ge=e=>a.title?a.title({node:e,data:e.raw,expanded:x.value.has(e.key)}):ie(e.title,m.value),_e=e=>a.icon?(0,t.h)(`span`,{class:u.e(`icon`)},a.icon({node:e,expanded:x.value.has(e.key)})):e.raw.icon?(0,t.h)(`span`,{class:u.e(`icon`)},e.raw.icon):null,ve=n=>{if(!e.showLine||n.level===0)return null;let r=[];for(let i=0;i<n.level;i+=1)a.connector?r.push((0,t.h)(`span`,{key:`guide-${i}`,class:u.e(`guide`),style:{left:`${i*e.indentSize+e.indentSize/2}px`}},a.connector({depth:i,node:n}))):r.push((0,t.h)(`span`,{key:`guide-${i}`,class:u.e(`guide`),style:{left:`${i*e.indentSize+e.indentSize/2}px`}}));return r},ye=()=>{q(),J(),O.value=null,D.value=null},X=(n,r)=>{let i={paddingLeft:`${e.indentSize*n.level}px`,...r},a=v.value.has(n.key),o=P.value===n.key,s=D.value?.key===n.key,c=s?D.value.position:null,l=A.value===n.key;return(0,t.h)(`div`,{key:n.key,class:[u.e(`node`),a&&u.em(`node`,`selected`),o&&u.em(`node`,`focused`),n.disabled&&u.em(`node`,`disabled`),s&&c===`inside`&&u.em(`node`,`drop-inside`),s&&c===`before`&&u.em(`node`,`drop-before`),s&&c===`after`&&u.em(`node`,`drop-after`),e.blockNode&&u.em(`node`,`block`),l&&u.em(`node`,`hover-expand`),e.classNames?.node],role:`treeitem`,tabindex:o?0:-1,"aria-selected":a,"aria-expanded":n.hasChildren?x.value.has(n.key):void 0,"aria-disabled":n.disabled||void 0,"data-key":n.key,style:[i,e.styles?.node],draggable:e.draggable&&!n.disabled?!0:void 0,onDragstart:e=>se(e,n),onDragover:e=>ue(e,n),onDragenter:e=>de(e,n),onDragleave:e=>fe(e,n),onDrop:e=>pe(e,n),onDragend:ye,onFocus:()=>{P.value!==n.key&&F(n.key)}},[...ve(n)||[],(0,t.h)(`span`,{class:u.e(`switcher-wrap`),onClick:t=>{t.stopPropagation(),(n.hasChildren||e.loadData&&!n.isLeaf)&&H(n,t)}},me(n)),he(n),(0,t.h)(`span`,{class:[u.e(`content`),e.classNames?.label],style:e.styles?.label,onClick:t=>{W(n,t),e.expandAction===`click`&&!e.disabled&&!n.disabled&&(n.hasChildren||e.loadData&&!n.isLeaf)&&H(n,t)}},[_e(n),(0,t.h)(`span`,{class:u.e(`title`)},ge(n))])])},Z=e=>{let t=C.value;if(t.length===0)return;let n=P.value,r=n===void 0?-1:R.value.get(n)??-1,i=Math.max(0,Math.min(t.length-1,r+e));if(r===i&&n!==void 0)return;let a=t[i].key;F(a)},Q=e=>{let t=C.value;t.length!==0&&F(t[e===1?t.length-1:0].key)},$=t=>{if(e.disabled)return;let n=C.value;if(n.length===0)return;let r=P.value??n[0].key,i=R.value.get(r)??0,a=n[i];switch(t.key){case`ArrowDown`:t.preventDefault(),Z(1);break;case`ArrowUp`:t.preventDefault(),Z(-1);break;case`ArrowRight`:if(t.preventDefault(),a.hasChildren&&!x.value.has(a.key))H(a,t);else if(a.hasChildren){let e=n[i+1];e&&e.parentKeys.includes(a.key)&&F(e.key)}else e.loadData&&!a.isLeaf&&!T.value.has(a.key)&&H(a,t);break;case`ArrowLeft`:if(t.preventDefault(),a.hasChildren&&x.value.has(a.key))H(a,t);else if(a.parentKeys.length>0){let e=a.parentKeys[a.parentKeys.length-1];F(e)}break;case`Home`:t.preventDefault(),Q(-1);break;case`End`:t.preventDefault(),Q(1);break;case`Enter`:case` `:{t.preventDefault();let n=new MouseEvent(`click`);e.checkable?G(a,n):W(a,n);break}}},be=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/(["\\])/g,`\\$1`),xe=()=>{let e=P.value;if(e===void 0)return;let t=R.value.get(e);t!==void 0&&(z.value?B.scrollToIndex(t,L.value):I.value&&I.value.querySelector(`[data-key="${be(String(e))}"]`)?.focus({preventScroll:!1}))};return(0,t.watch)(P,()=>{(0,t.nextTick)(xe)}),(0,t.onUnmounted)(()=>{q(),J()}),r({retryLoad:U,isNodeLoading:e=>w.value.has(e),hasLoadError:e=>E.value.has(e)}),()=>{let n=[u.b(),e.disabled&&u.m(`disabled`),e.showLine&&u.m(`show-line`),e.draggable&&u.m(`draggable`),e.classNames?.root],r=e.styles?.root;if(C.value.length===0)return(0,t.h)(`div`,{ref:I,class:n,style:r,role:`tree`,onKeydown:$},(0,t.h)(`div`,{class:u.e(`empty`)},`No data`));if(z.value){let i=B.visible.value.map(({data:t,top:n})=>X(t,{position:`absolute`,top:`${n}px`,left:0,right:0,height:`${e.virtualItemHeight}px`}));return(0,t.h)(`div`,{ref:I,class:n,style:r,role:`tree`,onKeydown:$},(0,t.h)(`div`,{ref:L,class:u.e(`virtual`),style:{height:`${B.containerHeight.value}px`,overflow:`auto`,position:`relative`},onScroll:B.onScroll},(0,t.h)(`div`,{style:{height:`${B.totalHeight.value}px`,position:`relative`}},i)))}return(0,t.h)(`div`,{ref:I,class:n,style:r,role:`tree`,onKeydown:$,tabindex:P.value===void 0?0:-1},C.value.map(e=>X(e)))}}});b.install=function(e){e.component(b.name,b)},e.Tree=b,e.default={title:`Tree 树`,category:`数据展示`,status:`100%`,install(e){e.component(b.name,b)}}});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.index={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=/^[a-z0-9]+(-[a-z0-9]+)*$/,r=(e,t,n,r=``)=>{let a=e.split(`:`);if(e.slice(0,1)===`@`){if(a.length<2||a.length>3)return null;r=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){let e=a.pop(),n=a.pop(),o={provider:a.length>0?a[0]:r,prefix:n,name:e};return t&&!i(o)?null:o}let o=a[0],s=o.split(`-`);if(s.length>1){let e={provider:r,prefix:s.shift(),name:s.join(`-`)};return t&&!i(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:o};return t&&!i(e,n)?null:e}return null},i=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1;function a(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var o=Object.freeze({left:0,top:0,width:16,height:16}),s=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),c=Object.freeze({...o,...s}),l=Object.freeze({...c,body:``,hidden:!1});function u(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function d(e,t){let n=u(e,t);for(let r in l)r in s?r in e&&!(r in n)&&(n[r]=s[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function f(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=d(r[e]||i[e],a)}return o(t),n.forEach(o),d(e,a)}function p(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=a(e);for(let i in r){let a=r[i];a&&(t(i,f(e,i,a)),n.push(i))}return n}var m={provider:``,aliases:{},not_found:{},...o};function h(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function g(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!h(e,m))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!h(t,l))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!h(t,l))return null}return t}var _=Object.create(null);function v(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function y(e,t){let n=_[e]||(_[e]=Object.create(null));return n[t]||(n[t]=v(e,t))}function b(e,t){return g(t)?p(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function x(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var S=!1;function C(e){return typeof e==`boolean`&&(S=e),S}function w(e){let t=typeof e==`string`?r(e,!0,S):e;if(t){let e=y(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function T(e,t){let n=r(e,!0,S);if(!n)return!1;let i=y(n.provider,n.prefix);return t?x(i,n.name,t):(i.missing.add(n.name),!0)}function E(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),S&&!t&&!e.prefix){let t=!1;return g(e)&&(e.prefix=``,p(e,(e,n)=>{T(e,n)&&(t=!0)})),t}let n=e.prefix;return i({prefix:n,name:`a`})?!!b(y(t,n),e):!1}var D=Object.freeze({width:null,height:null}),O=Object.freeze({...D,...s}),ee=/(-?[0-9.]*[0-9]+[0-9.]*)/g,k=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function A(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(ee);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=k.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function j(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function M(e,t){return e?`<defs>`+e+`</defs>`+t:t}function N(e,t,n){let r=j(e);return M(r.defs,t+r.content+n)}var te=e=>e===`unset`||e===`undefined`||e===`none`;function P(e,t){let n={...c,...e},r={...O,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=N(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,l=i.width,u=i.height,d,f;o===null?(f=s===null?`1em`:s===`auto`?u:s,d=A(f,l/u)):(d=o===`auto`?l:o,f=s===null?A(d,u/l):s===`auto`?u:s);let p={},m=(e,t)=>{te(t)||(p[e]=t.toString())};m(`width`,d),m(`height`,f);let h=[i.left,i.top,l,u];return p.viewBox=h.join(` `),{attributes:p,viewBox:h,body:a}}var ne=/\sid="(\S+)"/g,F=new Map;function re(e){e=e.replace(/[0-9]+$/,``)||`a`;let t=F.get(e)||0;return F.set(e,t+1),t?`${e}${t}`:e}function ie(e){let t=[],n;for(;n=ne.exec(e);)t.push(n[1]);if(!t.length)return e;let r=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(t=>{let n=re(t),i=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+i+`)([")]|\\.[a-z])`,`g`),`$1`+n+r+`$3`)}),e=e.replace(new RegExp(r,`g`),``),e}var I=Object.create(null);function ae(e,t){I[e]=t}function L(e){return I[e]||I[``]}function R(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var z=Object.create(null),B=[`https://api.simplesvg.com`,`https://api.unisvg.com`],V=[];B.length>0;)B.length===1||Math.random()>.5?V.push(B.shift()):V.push(B.pop());z[``]=R({resources:[`https://api.iconify.design`].concat(V)});function oe(e,t){let n=R(t);return n===null?!1:(z[e]=n,!0)}function H(e){return z[e]}var U=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function se(e,t){let n=H(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function ce(e){return e===404}var le=(e,t,n)=>{let r=[],i=se(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function ue(e){if(typeof e==`string`){let t=H(e);if(t)return t.path}return`/`}var de={prepare:le,send:(e,t,n)=>{if(!U){n(`abort`,424);return}let r=ue(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;U(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(ce(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function W(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function fe(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||W([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var pe=0;function G(e,t,n){let r=pe++,i=W.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function me(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=y(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function he(e,t=!0,n=!1){let i=[];return e.forEach(e=>{let a=typeof e==`string`?r(e,t,n):e;a&&i.push(a)}),i}var K={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ge(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function q(e){let t={...K,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=ge(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function _e(){}var ve=Object.create(null);function ye(e){if(!ve[e]){let t=H(e);if(!t)return;ve[e]={config:t,redundancy:q(t)}}return ve[e]}function be(e,t,n){let r,i;if(typeof e==`string`){let t=L(e);if(!t)return n(void 0,424),_e;i=t.send;let a=ye(e);a&&(r=a.redundancy)}else{let t=R(e);if(t){r=q(t);let n=L(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),_e):r.query(t,i,n)().abort}function xe(){}function Se(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,fe(e)}))}function Ce(e){let t=[],r=[];return e.forEach(e=>{(e.match(n)?t:r).push(e)}),{valid:t,invalid:r}}function J(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!b(e,n).length){r();return}}catch(e){console.error(e)}r(),Se(e)}function we(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Te(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:r}=e,i=e.iconsToLoad;if(delete e.iconsToLoad,!i||!i.length)return;let a=e.loadIcon;if(e.loadIcons&&(i.length>1||!a)){we(e.loadIcons(i,r,t),t=>{J(e,i,t)});return}if(a){i.forEach(n=>{we(a(n,r,t),t=>{J(e,[n],t?{prefix:r,icons:{[n]:t}}:null)})});return}let{valid:o,invalid:s}=Ce(i);if(s.length&&J(e,s,null),!o.length)return;let c=r.match(n)?L(t):null;if(!c){J(e,o,null);return}c.prepare(t,r,o).forEach(n=>{be(t,n,t=>{J(e,n.icons,t)})})}))}var Ee=(e,t)=>{let n=me(he(e,!0,C()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,xe)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(y(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=y(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Te(e,t)}),t?G(t,n,i):xe};function De(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in D?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Oe=/[\s,]+/;function ke(e,t){t.split(Oe).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function Ae(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function je(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Me(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Ne(e){return`data:image/svg+xml,`+Me(e)}function Pe(e){return`url("`+Ne(e)+`")`}var Fe={...O,inline:!1},Ie={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Le={display:`inline-block`},Re={backgroundColor:`currentColor`},ze={backgroundColor:`transparent`},Be={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},Ve={webkitMask:Re,mask:Re,background:ze};for(let e in Ve){let t=Ve[e];for(let n in Be)t[e+n]=Be[n]}var Y={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;Y[e+`-flip`]=t,Y[e.slice(0,1)+`-flip`]=t,Y[e+`Flip`]=t});function He(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var Ue=(e,n)=>{let r=De(Fe,n),i={...Ie},a=n.mode||`svg`,o={},s=n.style,c=typeof s==`object`&&!(s instanceof Array)?s:{};for(let e in n){let t=n[e];if(t!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:case`customise`:break;case`inline`:case`hFlip`:case`vFlip`:r[e]=t===!0||t===`true`||t===1;break;case`flip`:typeof t==`string`&&ke(r,t);break;case`color`:o.color=t;break;case`rotate`:typeof t==`string`?r[e]=Ae(t):typeof t==`number`&&(r[e]=t);break;case`ariaHidden`:case`aria-hidden`:t!==!0&&t!==`true`&&delete i[`aria-hidden`];break;default:{let n=Y[e];n?(t===!0||t===`true`||t===1)&&(r[n]=!0):Fe[e]===void 0&&(i[e]=t)}}}let l=P(e,r),u=l.attributes;if(r.inline&&(o.verticalAlign=`-0.125em`),a===`svg`)return i.style={...o,...c},Object.assign(i,u),i.innerHTML=ie(l.body),(0,t.h)(`svg`,i);let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=je(d,{...u,width:f+``,height:p+``});return i.style={...o,"--svg":Pe(h),width:He(u.width),height:He(u.height),...Le,...m?Re:ze,...c},(0,t.h)(`span`,i)};if(C(!0),ae(``,de),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!E(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;oe(e,r)||console.error(n)}catch{console.error(n)}}}}var We={...c,body:``},Ge=(0,t.defineComponent)((e,{emit:n})=>{let i=(0,t.ref)(null);function a(){i.value&&=(i.value.abort?.(),null)}let o=(0,t.ref)(!!e.ssr),s=(0,t.ref)(``),l=(0,t.shallowRef)(null);function u(){let o=e.icon;if(typeof o==`object`&&o&&typeof o.body==`string`)return s.value=``,{data:o};let c;if(typeof o!=`string`||(c=r(o,!1,!0))===null)return null;let l=w(c);if(!l){let e=i.value;return(!e||e.name!==o)&&(l===null?i.value={name:o}:i.value={name:o,abort:Ee([c],d)}),null}a(),s.value!==o&&(s.value=o,(0,t.nextTick)(()=>{n(`load`,o)}));let u=e.customise;if(u){l=Object.assign({},l);let e=u(l.body,c.name,c.prefix,c.provider);typeof e==`string`&&(l.body=e)}let f=[`iconify`];return c.prefix!==``&&f.push(`iconify--`+c.prefix),c.provider!==``&&f.push(`iconify--`+c.provider),{data:l,classes:f}}function d(){let e=u();e?e.data!==l.value?.data&&(l.value=e):l.value=null}return o.value?d():(0,t.onMounted)(()=>{o.value=!0,d()}),(0,t.watch)(()=>e.icon,d),(0,t.onUnmounted)(a),()=>{let t=l.value;if(!t)return Ue(We,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),Ue({...c,...t.data},n)}},{props:[`icon`,`mode`,`ssr`,`width`,`height`,`style`,`color`,`inline`,`rotate`,`hFlip`,`horizontalFlip`,`vFlip`,`verticalFlip`,`flip`,`id`,`ariaHidden`,`customise`,`title`],emits:[`load`]}),Ke=Symbol(`ccui-config`);function X(e,t,n){let r=e;return t&&(r+=`__${t}`),n&&(r+=`--${n}`),r}function qe(e,t=!1){let n=t?`.ccui-${e}`:`ccui-${e}`;return{b:()=>X(n),e:e=>e?X(n,e):``,m:e=>e?X(n,``,e):``,em:(e,t)=>e&&t?X(n,e,t):``,is:e=>`is-${e}`}}var Je=new Map;function Ye(e){return e.trim()}function Xe(e){if(e)return Je.get(Ye(e))}var Ze={name:{type:String,default:``},component:{type:Object,default:void 0},size:{type:[Number,String],default:void 0},color:{type:String,default:``},twoToneColor:{type:String,default:``},theme:{type:String,default:void 0},themePrefixMap:{type:Object,default:void 0},rotate:{type:Number,default:0},spin:{type:Boolean,default:!1},spinDirection:{type:String,default:`cw`},loading:{type:Boolean,default:!1},clickable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},iconifyPrefix:{type:String,default:``},title:{type:String,default:``},ariaLabel:{type:String,default:``},prefixCls:{type:String,default:``}},Qe={prefix:`mdi`,icons:{"alert-circle":{width:24,height:24,body:`<path fill="currentColor" d="M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2Z"/>`},"arrow-up":{width:24,height:24,body:`<path fill="currentColor" d="M13 20h-2V8l-5.5 5.5l-1.42-1.42L12 4.16l7.92 7.92l-1.42 1.42L13 8v12Z"/>`},"calendar-outline":{width:24,height:24,body:`<path fill="currentColor" d="M12 12h5v5h-5v-5m7-9h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 2v2H5V5h14M5 19V9h14v10H5Z"/>`},check:{width:24,height:24,body:`<path fill="currentColor" d="M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59L21 7Z"/>`},"check-circle":{width:24,height:24,body:`<path fill="currentColor" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2m-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9Z"/>`},"chevron-right":{width:24,height:24,body:`<path fill="currentColor" d="M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6l-1.41-1.42Z"/>`},"clock-outline":{width:24,height:24,body:`<path fill="currentColor" d="M12 20a8 8 0 0 0 8-8a8 8 0 0 0-8-8a8 8 0 0 0-8 8a8 8 0 0 0 8 8m0-18a10 10 0 0 1 10 10a10 10 0 0 1-10 10C6.47 22 2 17.5 2 12A10 10 0 0 1 12 2m.5 5v5.25l4.5 2.67l-.75 1.23L11 13V7h1.5Z"/>`},close:{width:24,height:24,body:`<path fill="currentColor" d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z"/>`},"close-circle":{width:24,height:24,body:`<path fill="currentColor" d="M12 2c5.53 0 10 4.47 10 10s-4.47 10-10 10S2 17.53 2 12S6.47 2 12 2m3.59 5L12 10.59L8.41 7L7 8.41L10.59 12L7 15.59L8.41 17L12 13.41L15.59 17L17 15.59L13.41 12L17 8.41L15.59 7Z"/>`},"content-copy":{width:24,height:24,body:`<path fill="currentColor" d="M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z"/>`},loading:{width:24,height:24,body:`<path fill="currentColor" d="M12 4V2A10 10 0 0 0 2 12h2a8 8 0 0 1 8-8Z"/>`},magnify:{width:24,height:24,body:`<path fill="currentColor" d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5l-1.5 1.5l-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14S14 12 14 9.5S12 5 9.5 5Z"/>`},"menu-down":{width:24,height:24,body:`<path fill="currentColor" d="m7 10l5 5l5-5H7Z"/>`},"menu-right":{width:24,height:24,body:`<path fill="currentColor" d="m10 17l5-5l-5-5v10Z"/>`}}},$e=!1;function et(){$e||=(E(Qe),!0)}et();var tt={prefixCls:`ccui`,componentSize:`middle`,locale:void 0,direction:`ltr`,theme:void 0,iconPrefixCls:`ccui-icon`},nt={small:14,large:20};function rt(e){return!!e&&e.includes(`:`)}function it(e,t){let n=e===void 0?t:e;if(!(n==null||n===``||n===`default`))return typeof n==`number`?`${n}px`:n in nt?`${nt[n]}px`:n}function at(e){return e===`middle`?`default`:e}var ot=(0,t.defineComponent)({name:`CIcon`,inheritAttrs:!1,props:Ze,emits:[`click`],setup(e,{slots:n,emit:r}){let i=(0,t.useAttrs)(),a=qe(`icon`),o=(0,t.inject)(Ke,tt),s=(0,t.computed)(()=>e.prefixCls||o.iconPrefixCls||`ccui-icon`),c=(0,t.computed)(()=>{if(!(!e.theme||!e.themePrefixMap))return e.themePrefixMap[e.theme]}),l=(0,t.computed)(()=>e.name?e.name.includes(`:`)?e.name:c.value?`${c.value}:${e.name}`:e.iconifyPrefix?`${e.iconifyPrefix}:${e.name}`:e.name:``),u=(0,t.computed)(()=>rt(l.value)?l.value:void 0),d=(0,t.computed)(()=>{if(e.component)return e.component;if(e.name&&!u.value)return Xe(e.name)}),f=(0,t.computed)(()=>!!e.name&&!u.value&&!d.value&&!e.component),p=(0,t.computed)(()=>{let t={},n=it(e.size,at(o.componentSize));return n&&(t.fontSize=n),e.color&&(t.color=e.color),e.twoToneColor&&(t[`--ccui-icon-two-tone-color`]=e.twoToneColor),e.rotate!==void 0&&(t[`--ccui-icon-rotate`]=`${e.rotate}deg`),t}),m=(0,t.computed)(()=>({[a.b()]:!0,[a.m(`spin`)]:e.spin||e.loading,[a.m(`spin-ccw`)]:(e.spin||e.loading)&&e.spinDirection===`ccw`,[a.m(`font`)]:f.value,[a.m(`svg`)]:!!d.value||!!u.value||!!n.default,[a.m(`iconify`)]:!!u.value,[a.m(e.theme)]:!!e.theme,[a.m(`clickable`)]:e.clickable&&!e.disabled,[a.m(`disabled`)]:e.clickable&&e.disabled,[a.m(`loading`)]:e.loading})),h=t=>{if(e.clickable&&e.disabled){t.preventDefault(),t.stopPropagation();return}r(`click`,t)},g=t=>{!e.clickable||e.disabled||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.currentTarget.click())};return()=>{let{class:r,style:o,...c}=i,l;l=e.loading?(0,t.h)(`svg`,{viewBox:`0 0 24 24`,class:a.e(`loading-spinner`),"aria-hidden":`true`},(0,t.h)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-dasharray":`40 18`})):d.value?(0,t.h)(d.value):u.value?(0,t.h)(Ge,{icon:u.value}):f.value?(0,t.h)(`i`,{class:[s.value,`${s.value}-${e.name}`]}):n.default?.();let _=e.clickable,v=_?`button`:e.title||e.ariaLabel?`img`:void 0,y=_?e.disabled?-1:0:void 0;return(0,t.h)(`span`,{...c,class:[r,m.value],style:[o,p.value],role:v,tabindex:y,"aria-hidden":_||e.title||e.ariaLabel?void 0:`true`,"aria-label":e.ariaLabel||e.title||void 0,"aria-disabled":_&&e.disabled?`true`:void 0,"aria-busy":e.loading?`true`:void 0,title:e.title||void 0,onClick:h,onKeydown:g},l)}}});function st(e,n){let r=(0,t.ref)(0),i=n.buffer??4,a=(0,t.computed)(()=>e.value.length*n.itemHeight),o=(0,t.computed)(()=>Math.min(n.maxHeight,a.value));return{scrollTop:r,onScroll:e=>{r.value=e.currentTarget.scrollTop},visible:(0,t.computed)(()=>{let t=e.value;if(t.length===0)return[];let a=Math.max(0,Math.floor(r.value/n.itemHeight)-i),s=Math.ceil(o.value/n.itemHeight)+i*2,c=Math.min(t.length,a+s),l=[];for(let e=a;e<c;e+=1)l.push({index:e,data:t[e],top:e*n.itemHeight});return l}),totalHeight:a,containerHeight:o,scrollToIndex:(e,t)=>{if(!t)return;let i=e*n.itemHeight;i<r.value?t.scrollTop=i:i+n.itemHeight>r.value+o.value&&(t.scrollTop=i-o.value+n.itemHeight)}}}function ct(e,n,r){return(0,t.computed)(()=>{let{flatAll:t,byKey:i}=e.value;if(r.value)return{checked:new Set(n.value),halfChecked:new Set};let a=new Set,o=new Set,s=new Set(n.value),c=e=>{let t=i.get(e);return!!t&&!t.disableCheckbox&&!t.disabled};for(let e of t)if(s.has(e.key)){let t=[e];for(;t.length;){let e=t.pop();c(e.key)&&a.add(e.key);for(let n of e.childKeys){let e=i.get(n);e&&t.push(e)}}}for(let e=t.length-1;e>=0;--e){let n=t[e];if(!n.hasChildren)continue;let r=n.childKeys.map(e=>i.get(e)).filter(e=>!!e&&c(e.key));if(r.length===0)continue;let s=r.every(e=>a.has(e.key)),l=r.some(e=>a.has(e.key)||o.has(e.key));s?(c(n.key)&&a.add(n.key),o.delete(n.key)):l&&(o.add(n.key),a.delete(n.key))}return{checked:a,halfChecked:o}})}function lt(e,t,n,r){let i=e.byKey.get(n);if(!i||i.disabled||i.disableCheckbox)return Array.from(t);let a=t.has(n),o=new Set(t);if(r)return a?o.delete(n):o.add(n),Array.from(o);let s=[],c=[n];for(;c.length;){let t=c.pop();s.push(t);let n=e.byKey.get(t);if(n)for(let e of n.childKeys)c.push(e)}if(a)for(let e of s)o.delete(e);else for(let t of s){let n=e.byKey.get(t);n&&!n.disabled&&!n.disableCheckbox&&o.add(t)}for(let t of[...i.parentKeys].reverse()){let n=e.byKey.get(t);if(!n)continue;let r=n.childKeys.map(t=>e.byKey.get(t)).filter(e=>!!e&&!e.disableCheckbox&&!e.disabled);r.length!==0&&(r.every(e=>o.has(e.key))?o.add(t):o.delete(t))}return Array.from(o)}var ut={key:`key`,title:`title`,children:`children`,disabled:`disabled`,disableCheckbox:`disableCheckbox`,isLeaf:`isLeaf`,selectable:`selectable`};function dt(e){return{...ut,...e}}function ft(e,t,n){return e[t.key]??`__auto_${n}`}function pt(e,t){let n=e[t.children];return Array.isArray(n)?n:void 0}function mt(e,t,n,r,i){let a=pt(e,t),o=e[t.isLeaf],s=!!a&&a.length>0,c=o===void 0?!s&&!e.loadable:o,l=ft(e,t,i);return{key:l,raw:e,title:e[t.title]??l,level:n,parentKeys:r,isLeaf:c,disabled:!!e[t.disabled],disableCheckbox:!!e[t.disableCheckbox],selectable:e[t.selectable]!==!1,hasChildren:s,childKeys:s?a.map((e,n)=>ft(e,t,i*1e3+n)):[]}}function ht(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function gt(e,n){return(0,t.computed)(()=>{let t=[],r=new Map,i=new Map,a=[],o=n.value,s=0,c=(e,n,l)=>{let u=[];for(let i of e){s+=1;let e=mt(i,o,n,l,s);t.push(e),u.push(e),r.set(e.key,e);let a=pt(i,o);a&&c(a,n+1,[...l,e.key])}l.length===0?a.push(...u.map(e=>e.key)):i.set(l[l.length-1],u)};return c(e.value,0,[]),{flatAll:t,byKey:r,childrenByKey:i,rootKeys:a}})}function _t(e,n,r,i){return(0,t.computed)(()=>{let{flatAll:t}=e.value,a=n.value,o=r.value.trim(),s=i?.value,c=[],l=new Set;if(o||s){for(let e of t)if(s?s(e.raw,e.parentKeys):o.length>0&&ht(e.title).toLowerCase().includes(o.toLowerCase())){l.add(e.key);for(let t of e.parentKeys)l.add(t)}}for(let e of t)l.size>0&&!l.has(e.key)||e.parentKeys.every(e=>a.has(e))&&c.push(e);return c})}function Z(e){return new Set(e??[])}function Q(e,n,r){let i=(0,t.ref)(Z(n.value));return(0,t.watch)(e,e=>{e!==void 0&&(i.value=Z(e))}),{current:(0,t.computed)(()=>e.value===void 0?i.value:Z(e.value)),setKeys:t=>{e.value===void 0&&(i.value=Z(t)),r(t)}}}function vt(e,n,r){let i=(0,t.computed)(()=>e.selectedKeys),a=(0,t.computed)(()=>e.defaultSelectedKeys??[]),o=(0,t.computed)(()=>e.checkedKeys),s=(0,t.computed)(()=>e.defaultCheckedKeys??[]),c=(0,t.computed)(()=>e.expandedKeys),l=(0,t.computed)(()=>e.expandedKeys?e.expandedKeys:n.value.length>0?n.value:e.defaultExpandedKeys??[]),u=Q(i,a,e=>r(`update:selectedKeys`,e)),d=Q(o,s,e=>r(`update:checkedKeys`,e)),f=Q(c,l,e=>r(`update:expandedKeys`,e));return{selectedKeys:u.current,setSelectedKeys:u.setKeys,checkedKeys:d.current,setCheckedKeys:d.setKeys,expandedKeys:f.current,setExpandedKeys:f.setKeys}}var yt={data:{type:Array,default:()=>[]},fieldNames:{type:Object,default:()=>({})},selectable:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1},selectedKeys:{type:Array,default:void 0},defaultSelectedKeys:{type:Array,default:()=>[]},checkable:{type:Boolean,default:!1},checkedKeys:{type:Array,default:void 0},defaultCheckedKeys:{type:Array,default:()=>[]},checkStrictly:{type:Boolean,default:!1},expandedKeys:{type:Array,default:void 0},defaultExpandedKeys:{type:Array,default:()=>[]},defaultExpandAll:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loadData:{type:Function,default:void 0},draggable:{type:Boolean,default:!1},showLine:{type:Boolean,default:!1},blockNode:{type:Boolean,default:!1},expandAction:{type:[String,Boolean],default:`click`},searchValue:{type:String,default:``},filterTreeNode:{type:Function,default:void 0},indentSize:{type:Number,default:24},virtualScroll:{type:Boolean,default:!1},virtualItemHeight:{type:Number,default:32},virtualMaxHeight:{type:Number,default:320},focusedKey:{type:[String,Number],default:void 0},dragHoverExpandDelay:{type:Number,default:600},dragAutoScroll:{type:Boolean,default:!0},dragAutoScrollEdge:{type:Number,default:32},dragAutoScrollSpeed:{type:Number,default:12},classNames:{type:Object,default:void 0},styles:{type:Object,default:void 0}};function bt(e){return e.filter(e=>e.hasChildren).map(e=>e.key)}function xt(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function St(e,n){let r=xt(e);if(!n)return r;let i=r.toLowerCase(),a=n.toLowerCase(),o=i.indexOf(a);return o<0?r:(0,t.h)(`span`,null,[r.slice(0,o),(0,t.h)(`span`,{class:`ccui-tree__highlight`},r.slice(o,o+n.length)),r.slice(o+n.length)])}var $=(0,t.defineComponent)({name:`CTree`,props:yt,emits:[`update:selectedKeys`,`update:checkedKeys`,`update:expandedKeys`,`update:focusedKey`,`select`,`check`,`expand`,`load`,`drop`,`dragstart`,`dragenter`,`dragover`,`dragleave`,`focus-change`,`load-error`],setup(e,{emit:n,expose:r,slots:i}){let a=qe(`tree`),o=(0,t.computed)(()=>dt(e.fieldNames)),s=(0,t.toRef)(e,`data`),c=(0,t.toRef)(e,`searchValue`),l=(0,t.computed)(()=>e.filterTreeNode),u=gt(s,o),d=(0,t.ref)([]);e.defaultExpandAll&&e.expandedKeys===void 0&&(e.defaultExpandedKeys??[]).length===0&&(d.value=bt(u.value.flatAll));let{selectedKeys:f,setSelectedKeys:p,checkedKeys:m,setCheckedKeys:h,expandedKeys:g,setExpandedKeys:_}=vt(e,d,n),v=ct(u,m,(0,t.computed)(()=>e.checkStrictly)),y=_t(u,g,c,l),b=(0,t.ref)(new Set),x=(0,t.ref)(new Set),S=(0,t.ref)(new Set),C=(0,t.shallowRef)(null),w=(0,t.shallowRef)(null),T=(0,t.shallowRef)(null),E=(0,t.shallowRef)(null),D=(0,t.shallowRef)(null),O=(0,t.shallowRef)(0),ee=(0,t.ref)(e.focusedKey),k=(0,t.computed)(()=>e.focusedKey===void 0?ee.value:e.focusedKey),A=t=>{e.focusedKey===void 0&&(ee.value=t),n(`update:focusedKey`,t),n(`focus-change`,t)},j=(0,t.ref)(null),M=(0,t.ref)(null),N=(0,t.computed)(()=>{let e=new Map;return y.value.forEach((t,n)=>e.set(t.key,n)),e}),te=(0,t.computed)(()=>e.virtualScroll&&y.value.length>0),P=st(y,{itemHeight:e.virtualItemHeight,maxHeight:e.virtualMaxHeight}),ne=async(t,r)=>{if(e.loadData){S.value.delete(t.key),S.value=new Set(S.value),b.value.add(t.key),b.value=new Set(b.value);try{await e.loadData(t.raw),x.value.add(t.key),x.value=new Set(x.value),n(`load`,Array.from(x.value),{event:r,node:t})}catch(e){S.value.add(t.key),S.value=new Set(S.value),n(`load-error`,{error:e,node:t})}finally{b.value.delete(t.key),b.value=new Set(b.value)}}},F=async(t,r)=>{if(e.disabled)return;let i=g.value.has(t.key),a=new Set(g.value);i?a.delete(t.key):(a.add(t.key),e.loadData&&!t.hasChildren&&!t.isLeaf&&!x.value.has(t.key)&&await ne(t,r));let o=Array.from(a);_(o),n(`expand`,o,{expanded:!i,node:t})},re=async t=>{let n=u.value.byKey.get(t);!n||!e.loadData||await ne(n)},ie=(t,r)=>{if(e.disabled||!e.selectable||!t.selectable||t.disabled)return;let i=f.value.has(t.key),a;a=e.multiple?i?Array.from(f.value).filter(e=>e!==t.key):[...f.value,t.key]:i?[]:[t.key],p(a),n(`select`,a,{selectedKeys:a,selected:!i,node:t,event:r})},I=(t,r)=>{if(e.disabled||!e.checkable||t.disableCheckbox||t.disabled)return;let i=v.value.checked.has(t.key),a=e.checkStrictly?m.value:v.value.checked,o=lt(u.value,a,t.key,e.checkStrictly);h(o),n(`check`,o,{checkedKeys:o,halfCheckedKeys:Array.from(v.value.halfChecked),checked:!i,node:t,event:r})},ae=(t,r)=>{if(!e.draggable||r.disabled){t.preventDefault();return}w.value=r.key,t.dataTransfer?.setData(`text/plain`,String(r.key)),n(`dragstart`,{event:t,node:r})},L=(e,t)=>{let n=t.getBoundingClientRect();if(!n.height)return`inside`;let r=(e.clientY-n.top)/n.height;return r<.25?`before`:r>.75?`after`:`inside`},R=()=>{T.value&&=(clearTimeout(T.value),null),E.value=null},z=(t,n)=>{!e.dragHoverExpandDelay||e.dragHoverExpandDelay<=0||!t.hasChildren&&(!e.loadData||t.isLeaf)||g.value.has(t.key)||E.value!==t.key&&(R(),E.value=t.key,T.value=setTimeout(()=>{w.value!==null&&E.value===t.key&&F(t,n),T.value=null},e.dragHoverExpandDelay))},B=()=>{O.value=0,D.value!==null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(D.value),D.value=null},V=()=>{let e=M.value;if(!e||O.value===0){D.value=null;return}e.scrollTop+=O.value,typeof requestAnimationFrame==`function`?D.value=requestAnimationFrame(V):D.value=null},oe=t=>{if(!e.dragAutoScroll)return;let n=M.value;if(!n)return;let r=n.getBoundingClientRect(),i=e.dragAutoScrollEdge,a=e.dragAutoScrollSpeed,o=t.clientY-r.top,s=r.bottom-t.clientY,c=0;o<i&&o>0?c=-a:s<i&&s>0&&(c=a);let l=O.value===0;O.value=c,c!==0&&l&&typeof requestAnimationFrame==`function`?D.value=requestAnimationFrame(V):c===0&&B()},H=(t,r)=>{if(!e.draggable||w.value===null)return;t.preventDefault();let i=L(t,t.currentTarget);C.value={key:r.key,position:i},i===`inside`?z(r,t):E.value!==null&&R(),oe(t),n(`dragover`,{event:t,node:r})},U=(t,r)=>{e.draggable&&n(`dragenter`,{event:t,node:r})},se=(t,r)=>{e.draggable&&(E.value===r.key&&R(),n(`dragleave`,{event:t,node:r}))},ce=(t,r)=>{if(!e.draggable||w.value===null)return;t.preventDefault(),R(),B();let i=u.value.byKey.get(w.value);if(!i||i.key===r.key){w.value=null,C.value=null;return}n(`drop`,{event:t,node:r,dragNode:i,dropPosition:C.value?.key===r.key?C.value.position:`inside`}),w.value=null,C.value=null},le=n=>{if(i.switcher)return i.switcher({expanded:g.value.has(n.key),node:n,loading:b.value.has(n.key),loadFailed:S.value.has(n.key)});let r=g.value.has(n.key),o=b.value.has(n.key),s=S.value.has(n.key);return o?(0,t.h)(`span`,{class:a.e(`switcher-loading`)},`○`):s?(0,t.h)(`span`,{class:a.e(`switcher-error`),role:`button`,title:`Click to retry`,onClick:e=>{e.stopPropagation(),re(n.key)}},`!`):n.isLeaf&&!n.hasChildren?(0,t.h)(`span`,{class:a.e(`switcher-leaf`)}):(0,t.h)(`span`,{class:[a.e(`switcher`),r&&a.em(`switcher`,`open`),e.classNames?.switcher],style:e.styles?.switcher},(0,t.h)(ot,{name:`mdi:menu-right`,size:12}))},ue=n=>{if(!e.checkable)return null;let r=v.value.checked.has(n.key),i=v.value.halfChecked.has(n.key);return(0,t.h)(`span`,{class:[a.e(`checkbox`),r&&a.em(`checkbox`,`checked`),i&&a.em(`checkbox`,`indeterminate`),(n.disabled||n.disableCheckbox)&&a.em(`checkbox`,`disabled`)],role:`checkbox`,"aria-checked":i?`mixed`:r,onClick:e=>{e.stopPropagation(),I(n,e)}},r?`✓`:i?`–`:``)},de=e=>i.title?i.title({node:e,data:e.raw,expanded:g.value.has(e.key)}):St(e.title,c.value),W=e=>i.icon?(0,t.h)(`span`,{class:a.e(`icon`)},i.icon({node:e,expanded:g.value.has(e.key)})):e.raw.icon?(0,t.h)(`span`,{class:a.e(`icon`)},e.raw.icon):null,fe=n=>{if(!e.showLine||n.level===0)return null;let r=[];for(let o=0;o<n.level;o+=1)i.connector?r.push((0,t.h)(`span`,{key:`guide-${o}`,class:a.e(`guide`),style:{left:`${o*e.indentSize+e.indentSize/2}px`}},i.connector({depth:o,node:n}))):r.push((0,t.h)(`span`,{key:`guide-${o}`,class:a.e(`guide`),style:{left:`${o*e.indentSize+e.indentSize/2}px`}}));return r},pe=()=>{R(),B(),w.value=null,C.value=null},G=(n,r)=>{let i={paddingLeft:`${e.indentSize*n.level}px`,...r},o=f.value.has(n.key),s=k.value===n.key,c=C.value?.key===n.key,l=c?C.value.position:null,u=E.value===n.key;return(0,t.h)(`div`,{key:n.key,class:[a.e(`node`),o&&a.em(`node`,`selected`),s&&a.em(`node`,`focused`),n.disabled&&a.em(`node`,`disabled`),c&&l===`inside`&&a.em(`node`,`drop-inside`),c&&l===`before`&&a.em(`node`,`drop-before`),c&&l===`after`&&a.em(`node`,`drop-after`),e.blockNode&&a.em(`node`,`block`),u&&a.em(`node`,`hover-expand`),e.classNames?.node],role:`treeitem`,tabindex:s?0:-1,"aria-selected":o,"aria-expanded":n.hasChildren?g.value.has(n.key):void 0,"aria-disabled":n.disabled||void 0,"aria-level":n.level+1,"data-key":n.key,style:[i,e.styles?.node],draggable:e.draggable&&!n.disabled?!0:void 0,onDragstart:e=>ae(e,n),onDragover:e=>H(e,n),onDragenter:e=>U(e,n),onDragleave:e=>se(e,n),onDrop:e=>ce(e,n),onDragend:pe,onFocus:()=>{k.value!==n.key&&A(n.key)}},[...fe(n)||[],(0,t.h)(`span`,{class:a.e(`switcher-wrap`),onClick:t=>{t.stopPropagation(),(n.hasChildren||e.loadData&&!n.isLeaf)&&F(n,t)}},le(n)),ue(n),(0,t.h)(`span`,{class:[a.e(`content`),e.classNames?.label],style:e.styles?.label,onClick:t=>{ie(n,t),e.expandAction===`click`&&!e.disabled&&!n.disabled&&(n.hasChildren||e.loadData&&!n.isLeaf)&&F(n,t)}},[W(n),(0,t.h)(`span`,{class:a.e(`title`)},de(n))])])},me=e=>{let t=y.value;if(t.length===0)return;let n=k.value,r=n===void 0?-1:N.value.get(n)??-1,i=Math.max(0,Math.min(t.length-1,r+e));if(r===i&&n!==void 0)return;let a=t[i].key;A(a)},he=e=>{let t=y.value;t.length!==0&&A(t[e===1?t.length-1:0].key)},K=t=>{if(e.disabled)return;let n=y.value;if(n.length===0)return;let r=k.value??n[0].key,i=N.value.get(r)??0,a=n[i];switch(t.key){case`ArrowDown`:t.preventDefault(),me(1);break;case`ArrowUp`:t.preventDefault(),me(-1);break;case`ArrowRight`:if(t.preventDefault(),a.hasChildren&&!g.value.has(a.key))F(a,t);else if(a.hasChildren){let e=n[i+1];e&&e.parentKeys.includes(a.key)&&A(e.key)}else e.loadData&&!a.isLeaf&&!x.value.has(a.key)&&F(a,t);break;case`ArrowLeft`:if(t.preventDefault(),a.hasChildren&&g.value.has(a.key))F(a,t);else if(a.parentKeys.length>0){let e=a.parentKeys[a.parentKeys.length-1];A(e)}break;case`Home`:t.preventDefault(),he(-1);break;case`End`:t.preventDefault(),he(1);break;case`Enter`:case` `:{t.preventDefault();let n=new MouseEvent(`click`);e.checkable?I(a,n):ie(a,n);break}}},ge=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/(["\\])/g,`\\$1`),q=()=>{let e=k.value;if(e===void 0)return;let t=N.value.get(e);t!==void 0&&(te.value?P.scrollToIndex(t,M.value):j.value&&j.value.querySelector(`[data-key="${ge(String(e))}"]`)?.focus({preventScroll:!1}))};return(0,t.watch)(k,()=>{(0,t.nextTick)(q)}),(0,t.onUnmounted)(()=>{R(),B()}),r({retryLoad:re,isNodeLoading:e=>b.value.has(e),hasLoadError:e=>S.value.has(e)}),()=>{let n=[a.b(),e.disabled&&a.m(`disabled`),e.showLine&&a.m(`show-line`),e.draggable&&a.m(`draggable`),e.classNames?.root],r=e.styles?.root,i=e.multiple||e.checkable;if(y.value.length===0)return(0,t.h)(`div`,{ref:j,class:n,style:r,role:`tree`,"aria-multiselectable":i||void 0,"aria-disabled":e.disabled||void 0,onKeydown:K},(0,t.h)(`div`,{class:a.e(`empty`)},`No data`));if(te.value){let o=P.visible.value.map(({data:t,top:n})=>G(t,{position:`absolute`,top:`${n}px`,left:0,right:0,height:`${e.virtualItemHeight}px`}));return(0,t.h)(`div`,{ref:j,class:n,style:r,role:`tree`,"aria-multiselectable":i||void 0,"aria-disabled":e.disabled||void 0,onKeydown:K},(0,t.h)(`div`,{ref:M,class:a.e(`virtual`),style:{height:`${P.containerHeight.value}px`,overflow:`auto`,position:`relative`},onScroll:P.onScroll},(0,t.h)(`div`,{style:{height:`${P.totalHeight.value}px`,position:`relative`}},o)))}return(0,t.h)(`div`,{ref:j,class:n,style:r,role:`tree`,"aria-multiselectable":i||void 0,"aria-disabled":e.disabled||void 0,onKeydown:K,tabindex:k.value===void 0?0:-1},y.value.map(e=>G(e)))}}});$.install=function(e){e.component($.name,$)},e.Tree=$,e.default={title:`Tree 树`,category:`数据展示`,status:`100%`,install(e){e.component($.name,$)}}});