vs-tree.system.js 46.7 KB
Newer Older
1
System.register([],(function(e){"use strict";return{execute:function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function s(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const c="production"!==process.env.NODE_ENV?Object.freeze({}):{},d=("production"!==process.env.NODE_ENV&&Object.freeze([]),()=>{}),h=/^on[^a-z]/,l=e=>h.test(e),u=Object.assign,p=Array.isArray,f=e=>"function"==typeof e,v=e=>"string"==typeof e,m=e=>null!==e&&"object"==typeof e;let g;const y=()=>g||(g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function k(e){if(p(e)){const t={};for(let n=0;n<e.length;n++){const i=e[n],s=v(i)?C(i):k(i);if(s)for(const e in s)t[e]=s[e]}return t}return v(e)||m(e)?e:void 0}const b=/;(?![^(]*\))/g,x=/:([^]+)/,N=/\/\*[^]*?\*\//g;function C(e){const t={};return e.replace(N,"").split(b).forEach((e=>{if(e){const n=e.split(x);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function E(e){let t="";if(v(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){const i=E(e[n]);i&&(t+=i+" ")}else if(m(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}Symbol("production"!==process.env.NODE_ENV?"iterate":""),Symbol("production"!==process.env.NODE_ENV?"Map key iterate":"");function w(e){return _(e)?w(e.__v_raw):!(!e||!e.__v_isReactive)}function _(e){return!(!e||!e.__v_isReadonly)}function L(e){return w(e)||_(e)}function S(e){const t=e&&e.__v_raw;return t?S(t):e}function O(e){return!(!e||!0!==e.__v_isRef)}const I=[];function D(e,...t){if("production"===process.env.NODE_ENV)return;const n=I.length?I[I.length-1].component:null,i=n&&n.appContext.config.warnHandler,s=function(){let e=I[I.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const i=e.component&&e.component.parent;e=i&&i.vnode}return t}();if(i)M(i,n,11,[e+t.join(""),n&&n.proxy,s.map((({vnode:e})=>`at <${Ne(n,e.type)}>`)).join("\n"),s]);else{const n=[`[Vue warn]: ${e}`,...t];s.length&&n.push("\n",...function(e){const t=[];return e.forEach(((e,n)=>{t.push(...0===n?[]:["\n"],...function({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",i=!!e.component&&null==e.component.parent,s=` at <${Ne(e.component,e.type,i)}`,r=">"+n;return e.props?[s,...T(e.props),r]:[s+r]}(e))})),t}(s)),console.warn(...n)}}function T(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach((n=>{t.push(...F(n,e[n]))})),n.length>3&&t.push(" ..."),t}function F(e,t,n){return v(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):"number"==typeof t||"boolean"==typeof t||null==t?n?t:[`${e}=${t}`]:O(t)?(t=F(e,S(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):f(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=S(t),n?t:[`${e}=`,t])}const R={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"};function M(e,t,n,i){let s;try{s=i?e(...i):e()}catch(e){!function(e,t,n,i=!0){const s=t?t.vnode:null;if(t){let i=t.parent;const s=t.proxy,r="production"!==process.env.NODE_ENV?R[n]:n;for(;i;){const t=i.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,s,r))return;i=i.parent}const o=t.appContext.config.errorHandler;if(o)return void M(o,null,10,[e,s,r])}!function(e,t,n,i=!0){if("production"!==process.env.NODE_ENV){const r=R[t];if(n&&(s=n,I.push(s)),D("Unhandled error"+(r?` during execution of ${r}`:"")),n&&I.pop(),i)throw e;console.error(e)}else console.error(e);var s}(e,n,s,i)}(e,t,n)}return s}let P=!1,H=!1;const $=[];let j=0;const V=[];let B=null,z=0;const A=Promise.resolve();let K=null;function q(e){$.length&&$.includes(e,P&&e.allowRecurse?j+1:j)||(null==e.id?$.push(e):$.splice(function(e){let t=j+1,n=$.length;for(;t<n;){const i=t+n>>>1;Y($[i])<e?t=i+1:n=i}return t}(e.id),0,e),U())}function U(){P||H||(H=!0,K=A.then(X))}const Y=e=>null==e.id?1/0:e.id,J=(e,t)=>{const n=Y(e)-Y(t);if(0===n){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function X(e){H=!1,P=!0,"production"!==process.env.NODE_ENV&&(e=e||new Map),$.sort(J);const t="production"!==process.env.NODE_ENV?t=>G(e,t):d;try{for(j=0;j<$.length;j++){const e=$[j];if(e&&!1!==e.active){if("production"!==process.env.NODE_ENV&&t(e))continue;M(e,null,14)}}}finally{j=0,$.length=0,function(e){if(V.length){const t=[...new Set(V)];if(V.length=0,B)return void B.push(...t);for(B=t,"production"!==process.env.NODE_ENV&&(e=e||new Map),B.sort(((e,t)=>Y(e)-Y(t))),z=0;z<B.length;z++)"production"!==process.env.NODE_ENV&&G(e,B[z])||B[z]();B=null,z=0}}(e),P=!1,K=null,($.length||V.length)&&X(e)}}function G(e,t){if(e.has(t)){const n=e.get(t);if(n>100){const e=t.ownerInstance,n=e&&xe(e.type);return D(`Maximum recursive updates exceeded${n?` in component <${n}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`),!0}e.set(t,n+1)}else e.set(t,1)}const Q=new Set;"production"!==process.env.NODE_ENV&&(y().__VUE_HMR_RUNTIME__={createRecord:te((function(e,t){if(W.has(e))return!1;return W.set(e,{initialDef:Z(t),instances:new Set}),!0})),rerender:te((function(e,t){const n=W.get(e);if(!n)return;n.initialDef.render=t,[...n.instances].forEach((e=>{t&&(e.render=t,Z(e.type).render=t),e.renderCache=[],e.update()}))})),reload:te((function(e,t){const n=W.get(e);if(!n)return;t=Z(t),ee(n.initialDef,t);const i=[...n.instances];for(const e of i){const i=Z(e.type);Q.has(i)||(i!==n.initialDef&&ee(i,t),Q.add(i)),e.appContext.propsCache.delete(e.type),e.appContext.emitsCache.delete(e.type),e.appContext.optionsCache.delete(e.type),e.ceReload?(Q.add(i),e.ceReload(t.styles),Q.delete(i)):e.parent?q(e.parent.update):e.appContext.reload?e.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required.")}s=()=>{for(const e of i)Q.delete(Z(e.type))},p(s)?V.push(...s):B&&B.includes(s,s.allowRecurse?z+1:z)||V.push(s),U();var s}))});const W=new Map;function Z(e){return Ce(e)?e.__vccOpts:e}function ee(e,t){u(e,t);for(const n in e)"__file"===n||n in t||delete e[n]}function te(e){return(t,n)=>{try{return e(t,n)}catch(e){console.error(e),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let ne=null;const ie=Symbol.for("v-ndc");process.env.NODE_ENV;const se=Symbol.for("v-fgt"),re=Symbol.for("v-txt"),oe=Symbol.for("v-cmt");function ae(e){return!!e&&!0===e.__v_isVNode}const ce="__vInternal",de=({key:e})=>null!=e?e:null,he=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?v(e)||O(e)||f(e)?{i:ne,r:e,k:t,f:!!n}:e:null);const le="production"!==process.env.NODE_ENV?(...e)=>ue(...e):ue;function ue(e,t=null,n=null,i=0,s=null,r=!1){if(e&&e!==ie||("production"===process.env.NODE_ENV||e||D(`Invalid vnode type when creating vnode: ${e}.`),e=oe),ae(e)){const i=pe(e,t,!0);return n&&me(i,n),i.patchFlag|=-2,i}if(Ce(e)&&(e=e.__vccOpts),t){t=function(e){return e?L(e)||ce in e?u({},e):e:null}(t);let{class:e,style:n}=t;e&&!v(e)&&(t.class=E(e)),m(n)&&(L(n)&&!p(n)&&(n=u({},n)),t.style=k(n))}const o=v(e)?1:(e=>e.__isSuspense)(e)?128:(e=>e.__isTeleport)(e)?64:m(e)?4:f(e)?2:0;return"production"!==process.env.NODE_ENV&&4&o&&L(e)&&D("Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.","\nComponent that was made reactive: ",e=S(e)),function(e,t=null,n=null,i=0,s=null,r=(e===se?0:1),o=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&de(t),ref:t&&he(t),scopeId:null,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:ne};return a?(me(c,n),128&r&&e.normalize(c)):n&&(c.shapeFlag|=v(n)?8:16),"production"!==process.env.NODE_ENV&&c.key!=c.key&&D("VNode created with invalid key (NaN). VNode type:",c.type),c}(e,t,n,i,s,o,r,!0)}function pe(e,t,n=!1){const{props:i,ref:s,patchFlag:r,children:o}=e,a=t?function(...e){const t={};for(let n=0;n<e.length;n++){const i=e[n];for(const e in i)if("class"===e)t.class!==i.class&&(t.class=E([t.class,i.class]));else if("style"===e)t.style=k([t.style,i.style]);else if(l(e)){const n=t[e],s=i[e];!s||n===s||p(n)&&n.includes(s)||(t[e]=n?[].concat(n,s):s)}else""!==e&&(t[e]=i[e])}return t}(i||{},t):i;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&de(a),ref:t&&t.ref?n&&s?p(s)?s.concat(he(t)):[s,he(t)]:he(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:"production"!==process.env.NODE_ENV&&-1===r&&p(o)?o.map(fe):o,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==se?-1===r?16:16|r:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&pe(e.ssContent),ssFallback:e.ssFallback&&pe(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce}}function fe(e){const t=pe(e);return p(e.children)&&(t.children=e.children.map(fe)),t}function ve(e=" ",t=0){return le(re,null,e,t)}function me(e,t){let n=0;const{shapeFlag:i}=e;if(null==t)t=null;else if(p(t))n=16;else if("object"==typeof t){if(65&i){const n=t.default;return void(n&&(n._c&&(n._d=!1),me(e,n()),n._c&&(n._d=!0)))}{n=32;const e=t._;e||ce in t||(t._ctx=ne)}}else f(t)?(t={default:t,_ctx:ne},n=32):(t=String(t),64&i?(n=16,t=[ve(t)]):n=8);e.children=t,e.shapeFlag|=n}let ge,ye=null,ke="__VUE_INSTANCE_SETTERS__";(ge=y()[ke])||(ge=y()[ke]=[]),ge.push((e=>ye=e));const be=/(?:^|[-_])(\w)/g;function xe(e,t=!0){return f(e)?e.displayName||e.name:e.name||t&&e.__name}function Ne(e,t,n=!1){let i=xe(t);if(!i&&t.__file){const e=t.__file.match(/([^/\\]+)\.\w+$/);e&&(i=e[1])}if(!i&&e&&e.parent){const n=e=>{for(const n in e)if(e[n]===t)return n};i=n(e.components||e.parent.type.components)||n(e.appContext.components)}return i?i.replace(be,(e=>e.toUpperCase())).replace(/[-_]/g,""):n?"App":"Anonymous"}function Ce(e){return f(e)&&"__vccOpts"in e}function Ee(e){return!(!e||!e.__v_isShallow)}"production"!==process.env.NODE_ENV&&function(){if("production"===process.env.NODE_ENV||"undefined"==typeof window)return;const e={style:"color:#3ba776"},t={style:"color:#0b1bc9"},n={style:"color:#b62e24"},i={style:"color:#9d288c"},s={header:t=>m(t)?t.__isVue?["div",e,"VueInstance"]:O(t)?["div",{},["span",e,l(t)],"<",a(t.value),">"]:w(t)?["div",{},["span",e,Ee(t)?"ShallowReactive":"Reactive"],"<",a(t),">"+(_(t)?" (readonly)":"")]:_(t)?["div",{},["span",e,Ee(t)?"ShallowReadonly":"Readonly"],"<",a(t),">"]:null:null,hasBody:e=>e&&e.__isVue,body(e){if(e&&e.__isVue)return["div",{},...r(e.$)]}};function r(e){const t=[];e.type.props&&e.props&&t.push(o("props",S(e.props))),e.setupState!==c&&t.push(o("setup",e.setupState)),e.data!==c&&t.push(o("data",S(e.data)));const n=d(e,"computed");n&&t.push(o("computed",n));const s=d(e,"inject");return s&&t.push(o("injected",s)),t.push(["div",{},["span",{style:i.style+";opacity:0.66"},"$ (internal): "],["object",{object:e}]]),t}function o(e,t){return t=u({},t),Object.keys(t).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},e],["div",{style:"padding-left:1.25em"},...Object.keys(t).map((e=>["div",{},["span",i,e+": "],a(t[e],!1)]))]]:["span",{}]}function a(e,s=!0){return"number"==typeof e?["span",t,e]:"string"==typeof e?["span",n,JSON.stringify(e)]:"boolean"==typeof e?["span",i,e]:m(e)?["object",{object:s?S(e):e}]:["span",n,String(e)]}function d(e,t){const n=e.type;if(f(n))return;const i={};for(const s in e.ctx)h(n,s,t)&&(i[s]=e.ctx[s]);return i}function h(e,t,n){const i=e[n];return!!(p(i)&&i.includes(t)||m(i)&&t in i)||!(!e.extends||!h(e.extends,t,n))||!(!e.mixins||!e.mixins.some((e=>h(e,t,n))))||void 0}function l(e){return Ee(e)?"ShallowRef":e.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(s):window.devtoolsFormatters=[s]}();var we=function(e,t){var n=t.store.slots[e];if(n){var i=n.node.cloneNode(!0);i.classList.add("vs-tree-text"),i.setAttribute("tree-node-id",t.id),t.__buffer={};var s="\n        var ".concat(n.scope," = _;\n      ");return n.text.replace(n.interpolate,(function(e,t){s+="_.__buffer['".concat(e,"'] = ").concat(t,";")})),new Function("_",s).call(t,t),i.innerText=i.innerText.replace(n.interpolate,(function(e){return t.__buffer[e]})).replace(/\n/g,""),i}return!1},_e=0,Le=function(){function e(i){if(n(this,e),this.id=_e++,this.checked=!1,this.expanded=!1,this.indeterminate=!1,this.visbile=!1,this.disabled=!1,this.loaded=!1,this.isLeaf=!1,this.level=0,this.childNodes=[],this.store=i.store,this.parent=i.parent,this.originData=i.data,this.customNodeClick=i.customNodeClick,this.__buffer={},this.data=Object.assign({},i.data),"function"==typeof this.store.format&&!i.data._vsroot){var s=this.store.format(Object.assign({},i.data),this);if("object"!==t(s))throw new Error("format must return object! \nformat: function(data) {\n  return {id, name, children, isLeaf}\n}");for(var r=["id","name","children","isLeaf","icon","extra"],o=0,a=r.length;o<a;o++)Object.prototype.hasOwnProperty.call(s,r[o])&&(this.data[r[o]]=s[r[o]])}this.store.checkInherit&&this.parent&&(this.checked=this.parent.checked),this.store.checkedKeys&&this.store.checkedKeys.includes(this.data.id)&&(this.checked=this.store.checkedKeys.includes(this.data.id)||this.checked),this.store.disabledInherit&&this.parent&&(this.disabled=this.parent.disabled),this.store.expandKeys.includes(this.data.id)&&(this.expanded=!0),this.store.disabledKeys.includes(this.data.id)&&(this.disabled=!0),this.parent&&(this.level=this.parent.level+1),this.data&&this.setData(this.data),this.initData()}return s(e,[{key:"initData",value:function(){var e;!(this.level>this.store.expandLevel&&-1!==this.store.expandLevel)||null!==(e=this.parent)&&void 0!==e&&e.expanded?this.visbile=!0:this.visbile=!1}},{key:"createNode",value:function(){var e=this;if(this.dom)return this.checkboxNode&&(this.checkboxNode.checked=this.checked),this.radioNode&&(this.radioNode.checked=this.checked),this.indeterminate&&this.dom.classList.add("is-indeterminate"),this.dom;var t=document.createElement("div");t.className="vs-tree-node ".concat(this.isLeaf?"vs-tree-node--leaf":"vs-tree-node--noLeaf"),t.setAttribute("vs-index",this.id),this.indeterminate&&t.classList.add("is-indeterminate"),!this.isLeaf&&this.childNodes.length&&t.setAttribute("vs-child",!0),t.appendChild(this.createInner());var n=we("append",this);return n?t.appendChild(n):this.store.renderContent&&t.appendChild(this.createContent()),t.addEventListener("click",(function(n){e.store.highlightCurrent&&(e.store.selectedCurrent&&e.store.selectedCurrent.dom.classList.remove("selected"),t.classList.add("selected")),e.store.selectedCurrent=e,n.stopPropagation(),e.customNodeClick?e.customNodeClick(n,e):(!e.store.checkOnClickNode||e.disabled||e.store.breadcrumb&&!e.isLeaf||e.handleCheckChange({target:{checked:!e.checked}}),e.store.breadcrumb&&!e.isLeaf&&(e.store.breadcrumb.list.push(e),e.setExpand(!0)),e.store.click(n,e))}),{passive:!1}),t.addEventListener("contextmenu",(function(t){e.store.contextmenu&&"function"==typeof e.store.contextmenu&&(t.stopPropagation(),t.preventDefault(),e.store.contextmenu(t,e))})),this.store.draggable&&this.createDragable(t),this.dom=t,t}},{key:"createInner",value:function(){var e=document.createElement("div");e.className="vs-tree-inner";var t,n=this.level+(this.store.hideRoot?-1:0);if(this.store.breadcrumb&&(n=0),this.store.showLine)for(var i=0;i<n;i++){var s=document.createElement("span");s.className="vs-indent-unit",e.appendChild(s)}else e.style.paddingLeft=n*this.store.indent+"px";if(this.store.breadcrumb)this.loadingEl=document.createElement("span"),this.loadingEl.className="vs-loading-unit",e.appendChild(this.loadingEl);else{var r;if(this.store.strictLeaf)t=this.isLeaf?this.createExpandEmpty():this.createExpand();else t=(null!==(r=this.childNodes)&&void 0!==r&&r.length||this.store.lazy)&&!this.isLeaf?this.createExpand():this.createExpandEmpty();e.appendChild(t)}return(this.store.showCheckbox||this.store.showRadio)&&(!this.store.nocheckParent||this.isLeaf&&!this.childNodes.length)&&e.appendChild(this.createCheckbox()),this.store.showIcon&&(this.store.onlyShowLeafIcon&&this.childNodes.length&&!this.isLeaf||e.appendChild(this.createIcon())),e.appendChild(this.createText()),e}},{key:"cusmtomNode",value:function(e,t){var n=this,i=document.createElement(e);return t.text&&(i.innerText=t.text),t.className&&(i.className=t.className),t.children&&t.children.forEach((function(e){i.appendChild(e)})),"function"==typeof t.click&&i.addEventListener("click",(function(e){e.stopPropagation(),t.click(e,n)}),{passive:!1}),i}},{key:"createContent",value:function(){var e=this.store.renderContent(this.cusmtomNode.bind(this),this);return e?(e.addEventListener("click",(function(e){e.stopPropagation()}),{passive:!1}),e):document.createElement("span")}},{key:"createExpandEmpty",value:function(){var e=document.createElement("span");return e.className="expand-empty "+this.store.expandClass,e}},{key:"createExpand",value:function(){var e=this,t=document.createElement("span");return t.className="expand "+this.store.expandClass,(this.level<this.store.expandLevel||-1===this.store.expandLevel||this.expanded)&&(t.classList.add("expanded"),this.expanded=!0),t.addEventListener("click",(function(n){if(n.stopPropagation(),!e.loading){var i=!t.classList.contains("expanded");e.setExpand(i)}}),{passive:!1}),this.expandEl=t,t}},{key:"createCheckbox",value:function(){var e=this,t="checkbox";this.store.showRadio&&(t="radio");var n=document.createElement("label");n.className="vs-".concat(t);var i=document.createElement("span");i.className="vs-".concat(t,"__inner");var s=document.createElement("input");return s.type=t,s.checked=this.checked,s.disabled=this.disabled,s.className="vs-".concat(t,"__original"),s.name="radio"===t?"vs-radio"+(this.store.radioParentoOnly&&this.parent?this.parent.id:""):"vs-checkbox","radio"===t?(s.name="vs-radio"+(this.store.radioParentoOnly&&this.parent?this.parent.id:""),this.radioNode=s):(s.name="vs-checkbox",this.checkboxNode=s),n.appendChild(s),n.appendChild(i),n.addEventListener("click",(function(e){e.stopPropagation()}),{passive:!1}),s.addEventListener("click",(function(t){e.store.check(t,e)}),{passive:!1}),s.addEventListener("change",(function(t){t.stopPropagation(),e.handleCheckChange(t)})),this.checkboxEl=s,n}},{key:"handleCheckChange",value:function(e){var t=e.target.checked;if("function"!=typeof this.store.beforeCheck||this.store.beforeCheck(this)){if(t&&this.store.checkMaxNodes(this))return this.store.limitAlert(),void(e.target.checked=!1);this.store.showRadio?this.updateRadioChecked(t):(this.updateChecked(t),this.updateCheckedParent(t)),this.store._change(this)}else e.target.checked=!t}},{key:"createText",value:function(){var e=we("name",this);if(e)return e;var t=document.createElement("span");return t.innerText=this.data.name,t.className="vs-tree-text",t}},{key:"createIcon",value:function(){var e=document.createElement("span");return e.className=this.isLeaf&&!this.childNodes.length?"vs-icon-leaf":"vs-icon-parent",this.data.icon&&(this.data.icon instanceof HTMLElement?(e.style.backgroundImage="none",e.appendChild(this.data.icon)):e.classList.add(this.data.icon)),e}},{key:"setData",value:function(t){var n;this.store.dataMap.set(t.id,this),this.store.nodeMap.set(this.id,this),this.data=t,this.childNodes=[],"boolean"==typeof t.isLeaf?this.isLeaf=t.isLeaf:t.children||this.store.lazy||(this.isLeaf=!0),(n=0===this.level&&this.data instanceof e?this.data:this.data.children||[]).length&&(this.loaded=!0);for(var i=0,s=n.length;i<s;i++)this.insertChild({data:n[i]})}},{key:"insertChild",value:function(t,n){return t instanceof e||(Object.assign(t,{parent:this,store:this.store,customNodeClick:this.customNodeClick}),t=new e(t)),t.level=this.level+1,void 0===n||n<0?this.childNodes.push(t):this.childNodes.splice(n,0,t),t}},{key:"insertBefore",value:function(e,t){var n;t&&(n=this.childNodes.indexOf(t)),this.insertChild(e,n)}},{key:"insertAfter",value:function(e,t){var n;t&&-1!==(n=this.childNodes.indexOf(t))&&(n+=1),this.insertChild(e,n)}},{key:"updateExpand",value:function(e){var t=this;this.childNodes.length&&this.childNodes.forEach((function(n){e&&t.expanded?n.visbile=!0:n.visbile=!1,n.updateExpand(e)}))}},{key:"updateChecked",value:function(e,t){!t&&this.disabled||this.store.showCheckbox&&(this.checked=e,this.sortId=Date.now(),this.checkboxNode&&(this.checkboxNode.checked=e),this.dom&&this.dom.classList.remove("is-indeterminate"),this.store.allowEmit(e,"p")&&this.parent&&(this.parent.indeterminate=!1),this.store.allowEmit(e,"s")&&this.childNodes.length&&this.childNodes.forEach((function(t){t.updateChecked(e)})))}},{key:"updateCheckedParent",value:function(e,t){if((t||!this.disabled)&&this.store.showCheckbox&&this.store.allowEmit(e,"p")&&this.parent&&!this.store.nocheckParent){var n=this.parent.childNodes.every((function(e){return e.checked})),i=this.parent.childNodes.some((function(e){return e.checked||e.indeterminate}));n?(this.parent.checked=!0,this.parent.indeterminate=!1,this.parent.checkboxNode&&(this.parent.checkboxNode.checked=!0),this.parent.dom&&this.parent.dom.classList.remove("is-indeterminate")):i?(this.parent.checked=!1,this.parent.indeterminate=!0,this.parent.checkboxNode&&(this.parent.checkboxNode.checked=!1),this.parent.dom&&this.parent.dom.classList.add("is-indeterminate")):(this.parent.checked=!1,this.parent.indeterminate=!1,this.parent.checkboxNode&&(this.parent.checkboxNode.checked=!1),this.parent.dom&&this.parent.dom.classList.remove("is-indeterminate")),this.parent.updateCheckedParent()}}},{key:"updateRadioChecked",value:function(e,t){!t&&this.disabled||(!this.store.nocheckParent||!this.childNodes.length&&this.isLeaf)&&(this.store.radioParentoOnly?(this.store.radioMap[this.parent.id]&&(this.store.radioMap[this.parent.id].checked=!1),this.store.radioMap[this.parent.id]=this):(this.store.radioNode&&(this.store.radioNode=!1),this.store.radioNode=this),this.checked=e,this.radioNode&&(this.radioNode.checked=e))}},{key:"setChecked",value:function(e,t){e&&this.store.checkMaxNodes(this)?this.store.limitAlert():this.store.showRadio?this.updateRadioChecked(e,t):this.store.showCheckbox&&(this.updateChecked(e,t),this.updateCheckedParent(e,t),this.store._change(this))}},{key:"setDisabled",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.disabled=e,this.checkboxEl&&(this.checkboxEl.disabled=e)}},{key:"setExpand",value:function(e,t){var n=this;this.expanded=e,this.updateExpand(this.expanded),this.setAccordion(e),this.expandEl&&(e?this.expandEl.classList.add("expanded"):this.expandEl.classList.remove("expanded")),this.store.lazy&&!this.loaded?this.loadData((function(e){e&&!t&&n.storeUpdate()})):!t&&this.storeUpdate()}},{key:"storeUpdate",value:function(){this.store.animation?this.createAnimation():this.store.update()}},{key:"createAnimation",value:function(){var e=this;this.transitionNode&&this.transitionNode.parentNode&&this.transitionNode.parentNode.removeChild(this.transitionNode);var t,n,i,s=document.createElement("div");if(s.className="vs-transition",this.childNodes.length>this.store.showCount)for(var r=0;r<this.store.showCount-1;r++){var o=this.childNodes[r];s.appendChild(o.dom||o.createNode())}else this.childNodes.forEach((function(e){s.appendChild(e.dom||e.createNode())}));t=s,n=this.dom,(i=n.parentNode)&&(i.lastChild===n?i.appendChild(t):i.insertBefore(t,n.nextSibling));var a=(this.childNodes.length>this.store.showCount?this.store.showCount:this.childNodes.length)*this.store.itemHeight+"px";this.expanded?setTimeout((function(){s.style.height=a}),0):(s.style.height=a,setTimeout((function(){s.style.height=0}),0));s.addEventListener("transitionend",(function t(){s.removeEventListener("transitionend",t),s.parentNode&&s.parentNode.removeChild(s),s.removeEventListener("transitionend",t),e.store.update()})),this.transitionNode=s}},{key:"createDragable",value:function(e){var t=this;function n(e){e&&(e.classList.remove("vs-drag-enter"),e.classList.remove("vs-drag-over-gap-bottom"),e.classList.remove("vs-drag-over-gap-top"))}e.draggable=!0,e.addEventListener("dragstart",(function(e){e.stopPropagation(),t.store.dragNode=t,t.store.onDragstart(e,t);try{e.dataTransfer.setData("text/plain","")}catch(e){}})),e.addEventListener("dragover",(function(e){e.preventDefault()})),e.addEventListener("dragenter",(function(e){e.stopPropagation(),e.preventDefault(),n(t.store.dropNode);var i=t.dom;if(i){var s=function(e,t){var n=t.getBoundingClientRect().top,i=t.offsetHeight,s=e.pageY;return s>n+i-i?1:s<n+2?-1:0}(e,i);if((t.store.dragNode.dom!==i||0!==s)&&(t.store.dropPostion=s,t.store.dropNode=i,t.store.onDragenter(e,t,i,s),t.store.dropable)){if(t.expanded||t.isLeaf||t.setExpand(!0),-1===s)return void i.classList.add("vs-drag-over-gap-top");if(1===s)return void i.classList.add("vs-drag-over-gap-bottom");t.isLeaf||i.classList.add("vs-drag-enter")}}})),e.addEventListener("dragleave",(function(e){t.store.dropable&&n(e.target)})),e.addEventListener("drop",(function(e){if(e.stopPropagation(),t.store.onDrop(e,t,t.store.dropPostion),t.store.dropable){n(t.store.dropNode);var i=t.store.dragNode;if(i&&t.parent){var s=Object.assign({},i.data);if(i.remove(),!s)return;-1===t.store.dropPostion?(t.parent.insertBefore({data:s},t),t.updateCheckedParent(),t.store.updateNodes()):1===t.store.dropPostion?(t.parent.insertAfter({data:s},t),t.updateCheckedParent(),t.store.updateNodes()):t.isLeaf||t.append(s)}}}))}},{key:"setAccordion",value:function(e){if(this.store.accordion&&this.parent&&e){var t=this.store.expandMap[this.parent.id];if(t===this)return;t&&t.setExpand(!1),this.store.expandMap[this.parent.id]=this}}},{key:"loadData",value:function(e){var t=this;if(!this.loading){this.loading=!0,this.expandEl?this.expandEl.classList.add("is-loading"):this.loadingEl&&this.loadingEl.classList.add("is-loading");this.store.load(this,(function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.loaded=!0,t.loading=!1,t.expandEl?t.expandEl.classList.remove("is-loading"):t.loadingEl&&t.loadingEl.classList.remove("is-loading"),n.length&&(n.forEach((function(e){t.insertChild({data:e,store:t.store})})),t.childNodes[0].updateCheckedParent(),t.store.updateNodes()),e&&e.call(t,n)}))}}},{key:"remove",value:function(){var e=this,t=this.parent;if(t){var n=t.childNodes||[],i=n.findIndex((function(t){return t.id===e.id}));i>-1&&n.splice(i,1),this.store.updateNodes()}}},{key:"append",value:function(e){if(e&&"object"===t(e)){var n=this.dom;0!==this.childNodes.length&&(n=null);var i=this.insertChild({data:e,store:this.store});this.data.children?this.data.children.push(e):this.data.children=[e],this.isLeaf=!1,n&&(delete this.dom,n.parentNode.replaceChild(this.createNode(),n)),i.updateCheckedParent(),this.store.updateNodes()}}}]),e}(),Se=function(){function e(t){for(var i in n(this,e),t)Object.prototype.hasOwnProperty.call(t,i)&&(this[i]=t[i]);this.nodes=[],this.dataMap=new Map,this.nodeMap=new Map,this.radioMap={},this.expandMap={},this.root=new Le({data:this.data,store:this,customNodeClick:this.customNodeClick}),this.updateNodes(),this.breadcrumb&&this.breadcrumb.list.push(this.root),this.changeNodes=[]}return s(e,[{key:"setData",value:function(e){this.root.childNodes=[],this.root.setData(e),this.updateNodes()}},{key:"updateNodes",value:function(){this.nodes=this.flattenTreeData(),this.nodesChange(this.nodes)}},{key:"flattenTreeData",value:function(){var e=[];return function t(n){if(e.push(n),n.childNodes&&n.childNodes.length)for(var i=0,s=n.childNodes.length;i<s;i++)t(n.childNodes[i])}(this.root),e}},{key:"getNodeById",value:function(e){return this.dataMap.get(e)}},{key:"getCheckedNodes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.nodes.filter((function(t){return t.checked&&!t.data._vsroot&&e._checkVerify(t)&&(!e.nocheckParent||!t.childNodes.length)}));if(this.sort){var i=n.sort((function(e,t){return e.sortId-t.sortId}));return t?i:i.map((function(e){return e.data}))}return t?n:n.map((function(e){return e.data}))}},{key:"setDefaultChecked",value:function(){var e=this;this.checkedKeys.forEach((function(t){var n=e.getNodeById(t);n?n.setChecked(!0,!0):console.warn("not found node by "+t)}))}},{key:"checkMaxNodes",value:function(e){if(!this.max)return!1;if(!e.checked&&e.hasChildCount>this.max)return!0;var t=this.getCheckedNodes().length;return!e.checked&&t+(e.isLeaf?1:this.getUnCheckLeafsCount(e))>this.max}},{key:"getUnCheckLeafsCount",value:function(e){var t=this,n=this._checkVerify(e)&&!e.checked?1:0;return e.childNodes.forEach((function(e){n+=t.getUnCheckLeafsCount(e)})),n}},{key:"allowEmit",value:function(e,t){var n=this.checkboxType,i=n.Y,s=n.N;if(e){if(!i.includes(t))return!1}else if(!s.includes(t))return!1;return!0}},{key:"_checkVerify",value:function(e){return"function"==typeof this.checkFilter?this.checkFilter(e):!this.checkFilterLeaf||e.isLeaf}},{key:"_change",value:function(e){var t=this;this.changeNodes.push(e),this._changeTimer&&clearTimeout(this._changeTimer),this._changeTimer=setTimeout((function(){t.change(t.changeNodes),t.changeNodes=[]}),0)}}]),e}(),Oe="FRONT",Ie="BEHIND",De="INIT",Te="FIXED",Fe=function(){function e(t,i){n(this,e),this.init(t,i)}return s(e,[{key:"init",value:function(e,t){this.param=e,this.callUpdate=t,this.sizes=new Map,this.firstRangeTotalSize=0,this.firstRangeAverageSize=0,this.lastCalcIndex=0,this.fixedSizeValue=0,this.calcType=De,this.offset=0,this.direction="",this.range=Object.create(null),e&&this.checkRange(0,e.keeps-1)}},{key:"destroy",value:function(){this.init(null,null)}},{key:"getRange",value:function(){var e=Object.create(null);return e.start=this.range.start,e.end=this.range.end,e.padFront=this.range.padFront,e.padBehind=this.range.padBehind,e}},{key:"isBehind",value:function(){return this.direction===Ie}},{key:"isFront",value:function(){return this.direction===Oe}},{key:"getOffset",value:function(e){return(e<1?0:this.getIndexOffset(e))+this.param.slotHeaderSize}},{key:"updateParam",value:function(e,t){var n=this;this.param&&e in this.param&&("uniqueIds"===e&&this.sizes.forEach((function(e,i){t.includes(i)||n.sizes.delete(i)})),this.param[e]=t)}},{key:"handleDataSourcesChange",value:function(){var e=this.range.start;this.isFront()?e-=2:this.isBehind()&&(e+=2),e=Math.max(e,0),this.updateRange(this.range.start,this.getEndByStart(e))}},{key:"handleSlotSizeChange",value:function(){this.handleDataSourcesChange()}},{key:"handleScroll",value:function(e){this.direction=e<this.offset?Oe:Ie,this.offset=e,this.param&&(this.direction===Oe?this.handleFront():this.direction===Ie&&this.handleBehind())}},{key:"handleFront",value:function(){var e=this.getScrollOvers();if(!(e>this.range.start)){var t=Math.max(e-this.param.buffer,0);this.checkRange(t,this.getEndByStart(t))}}},{key:"handleBehind",value:function(){var e=this.getScrollOvers();e<this.range.start+this.param.buffer||this.checkRange(e,this.getEndByStart(e))}},{key:"getScrollOvers",value:function(){var e=this.offset-this.param.slotHeaderSize;if(e<=0)return 0;if(this.isFixedType())return Math.floor(e/this.fixedSizeValue);for(var t=0,n=0,i=0,s=this.param.uniqueIds.length;t<=s;){if(n=t+Math.floor((s-t)/2),(i=this.getIndexOffset(n))===e)return n;i<e?t=n+1:i>e&&(s=n-1)}return t>0?--t:0}},{key:"getIndexOffset",value:function(e){if(!e)return 0;for(var t=0,n=0,i=0;i<e;i++)t+="number"==typeof(n=this.sizes.get(this.param.uniqueIds[i]))?n:this.getEstimateSize();return this.lastCalcIndex=Math.max(this.lastCalcIndex,e-1),this.lastCalcIndex=Math.min(this.lastCalcIndex,this.getLastIndex()),t}},{key:"isFixedType",value:function(){return this.calcType===Te}},{key:"getLastIndex",value:function(){return this.param.uniqueIds.length-1}},{key:"checkRange",value:function(e,t){var n=this.param.keeps;this.param.uniqueIds.length<=n?(e=0,t=this.getLastIndex()):t-e<n-1&&(e=t-n+1),this.range.start!==e&&this.updateRange(e,t)}},{key:"updateRange",value:function(e,t){this.range.start=e,this.range.end=t,this.range.padFront=this.getPadFront(),this.range.padBehind=this.getPadBehind(),this.callUpdate(this.getRange())}},{key:"getEndByStart",value:function(e){var t=e+this.param.keeps-1;return Math.min(t,this.getLastIndex())}},{key:"getPadFront",value:function(){return this.isFixedType()?this.fixedSizeValue*this.range.start:this.getIndexOffset(this.range.start)}},{key:"getPadBehind",value:function(){var e=this.range.end,t=this.getLastIndex();return this.isFixedType()?(t-e)*this.fixedSizeValue:this.lastCalcIndex===t?this.getIndexOffset(t)-this.getIndexOffset(e):(t-e)*this.getEstimateSize()}},{key:"getEstimateSize",value:function(){return this.isFixedType()?this.fixedSizeValue:this.firstRangeAverageSize||this.param.estimateSize}}]),e}(),Re=function(){function e(t){n(this,e),this.range=null,this.$el=t.root,this.$el.style.maxHeight="number"==typeof t.maxHeight?t.maxHeight+"px":t.maxHeight,this.$el.style.minHeight="number"==typeof t.minHeight?t.minHeight+"px":t.minHeight,this.$el.style.overflowY="auto",this.dataSources=t.data,this.wrapper=document.createElement("div"),this.wrapper.className="vs-virtual-list",this.$el.appendChild(this.wrapper),this.$el.addEventListener("scroll",this.onScroll.bind(this),{passive:!1}),this.keeps=t.keeps||20,this.estimateSize=t.estimateSize||26,this.dataKey="id",this.installVirtual()}return s(e,[{key:"getOffset",value:function(){var e=this.$el;return e?Math.ceil(e.scrollTop):0}},{key:"getClientSize",value:function(){var e=this.$el;return e?Math.ceil(e.clientHeight):0}},{key:"getScrollSize",value:function(){var e=this.$el;return e?Math.ceil(e.scrollHeight):0}},{key:"scrollToIndex",value:function(e){if(e>=this.dataSources.length-1)this.scrollToBottom();else{var t=this.virtual.getOffset(e);this.scrollToOffset(t)}}},{key:"reset",value:function(){this.virtual.destroy(),this.scrollToOffset(0),this.installVirtual()}},{key:"installVirtual",value:function(){this.virtual=new Fe({slotHeaderSize:0,slotFooterSize:0,keeps:this.keeps,estimateSize:this.estimateSize,buffer:Math.round(this.keeps/3),uniqueIds:this.getUniqueIdFromDataSources()},this.onRangeChanged.bind(this)),this.range=this.virtual.getRange(),this.render()}},{key:"getUniqueIdFromDataSources",value:function(){var e=this.dataKey;return this.dataSources.map((function(t){return"function"==typeof e?e(t):t[e]}))}},{key:"onRangeChanged",value:function(e){this.range=e,this.render()}},{key:"onScroll",value:function(){var e=this.getOffset(),t=this.getClientSize(),n=this.getScrollSize();e<0||e+t>n+1||!n||this.virtual.handleScroll(e)}},{key:"getRenderSlots",value:function(){var e=this.range,t=e.start,n=e.end,i=this.dataSources,s=this.dataKey;this.wrapper.innerHTML="";for(var r=t;r<=n;r++){var o=i[r];if(o){var a="function"==typeof s?s(o):o[s];if("string"==typeof a||"number"==typeof a){var c=o.createNode();if(o.store.onlySearchLeaf?c.classList.add("vs-search-only-leaf"):c.classList.remove("vs-search-only-leaf"),o.store.isSearch&&o.store.searchRender){var d=o.store.searchRender(o,c.cloneNode(!0));if(!(d instanceof HTMLElement))throw Error("searchRender must return HTMLElement");this.wrapper.appendChild(d)}else this.wrapper.appendChild(c)}else console.warn("Cannot get the data-key '".concat(s,"' from data-sources."))}else console.warn("Cannot get the index '".concat(r,"' from data-sources."))}}},{key:"update",value:function(e){this.dataSources=e,this.wrapper.innerHTML="",this.virtual.updateParam("uniqueIds",this.getUniqueIdFromDataSources()),this.virtual.handleDataSourcesChange()}},{key:"render",value:function(){var e=this.range,t=e.padFront,n=e.padBehind,i="".concat(t,"px 0px ").concat(n,"px");this.wrapper.style.padding=i,this.getRenderSlots()}}]),e}(),Me=function(){function e(t,i){n(this,e),this.node=t,this.data=t.data,this.store=t.store,this.parent=i;var s=this.parent.options,r=s.icon,o=s.link,a=s.separator,c=void 0===a?"/":a;this.renderIcon=r,this.renderLink=o,this.renderSeparator=c}return s(e,[{key:"createDom",value:function(){var e=this,t=this.parent.list,n=t.findIndex((function(t){return t===e.node})),i=n===t.length-1,s=document.createElement("span");if(this.renderIcon){var r=this.createIcon();r&&s.appendChild(r)}return s.appendChild(this.createLink(t,n,i)),i||s.appendChild(this.createSeparator()),s}},{key:"createIcon",value:function(){var e;if(!(e="function"==typeof this.renderIcon?this.renderIcon(this.node,this.data):this.renderIcon))return!1;var t=document.createElement("span");return t.className="vs-breadcrumb-icon","function"==typeof this.renderIcon?e instanceof HTMLElement?t.appendChild(e):t.innerHTML=e:t.innerHTML=this.renderIcon,t}},{key:"createLink",value:function(e,t,n){var i=this,s=document.createElement("span");if(s.className="vs-breadcrumb-link","function"==typeof this.renderLink){var r=this.renderLink(this.node,this.data);r instanceof HTMLElement?s.appendChild(r):s.innerHTML=r}else s.innerHTML=this.data.name;return s.addEventListener("click",(function(s){s.preventDefault(),s.stopPropagation(),n||(e.splice(t+1),i.store.update())})),s}},{key:"createSeparator",value:function(){var e=document.createElement("span");return e.className="vs-breadcrumb-separator","function"==typeof this.renderSeparator?e.innerHTML=this.renderSeparator(this.node,this.data):e.innerHTML=this.renderSeparator,e}}]),e}(),Pe=function(){function e(t){n(this,e),this.list=[],this.options=t}return s(e,[{key:"renderBreadcrumb",value:function(){var e=this;this.store=this.current.store;var t,n=this.options,i=n.el,s=n.change,r=void 0===s?function(){}:s;i instanceof HTMLElement?t=i:i&&"string"==typeof i&&(t=document.querySelector(i)),t||(t=document.createElement("section")),t.classList.add("vs-breadcrumb");var o=this.list.map((function(t){return new Me(t,e).createDom()}));t.innerHTML="",o.forEach((function(e){t.appendChild(e)})),r(t,this.list,this.current)}},{key:"current",get:function(){return this.list[this.list.length-1]}}]),e}(),He=function(){},$e=function(){function e(i,s){var r=this;if(n(this,e),this.$el="string"==typeof i?document.querySelector(i):i,!(this.$el instanceof HTMLElement))throw Error("请为组件提供根节点");this.$el.classList.add("vs-tree"),s.breadcrumb&&this.$el.classList.add("vs-tree-breadcrumb");var o=["#\\[\\[","\\]\\]"],a=o[0]+"([\\s\\S]+?)"+o[1];this.interpolate=new RegExp(a,"igm");var c={},d=this.$el.querySelectorAll("[tree-slot]");if(d&&d.length&&d.forEach((function(e){var t=e.attributes["tree-slot"].value,n=e.attributes["tree-slot-scope"].value;c[t]={scope:n,node:e,interpolate:r.interpolate,text:e.innerText,inner:e.outerHTML},e.parentNode.removeChild(e)})),s.theme&&this.$el.classList.add("vs-theme-"+s.theme),Array.isArray(s.data))this._data={_vsroot:!0,name:s.rootName||"---",children:s.data},s.rootName||(s.hideRoot=!0);else{if("object"!==t(s.data))throw Error("参数data仅支持对象或数组!");this._data=s.data}this.nodes=[];var h=s.virtual||{},l=h.showCount,u=void 0===l?20:l,p=h.itemHeight,f=void 0===p?26:p,v=h.maxHeight,m=void 0===v?"400px":v,g=h.minHeight,y=void 0===g?"0px":g;this.itemHeight=f,this.showCount=u,this.maxHeight=s.maxHeight||m,this.minHeight=s.minHeight||y,this.data=[],this.keyword="",this.searchFilter=s.searchFilter,this.ready=s.ready||He,"[object Object]"===Object.prototype.toString.call(s.breadcrumb)&&(this.$$breadcrumb=new Pe(s.breadcrumb));var k=function(){r.store=new Se({data:r._data,max:s.max,slots:c,breadcrumb:r.$$breadcrumb||null,strictLeaf:s.strictLeaf||!1,showCount:r.showCount,itemHeight:r.itemHeight,hideRoot:s.hideRoot||!1,animation:s.animation||!1,expandLevel:"number"==typeof s.expandLevel?s.expandLevel:1,beforeCheck:s.beforeCheck||null,showLine:s.showLine||!1,showIcon:s.showIcon||!1,onlyShowLeafIcon:s.onlyShowLeafIcon||!1,showCheckbox:s.showCheckbox||!1,checkboxType:s.checkboxType||{Y:"ps",N:"ps"},checkInherit:s.checkInherit||!1,disabledInherit:s.disabledInherit||!1,showRadio:s.showRadio||!1,highlightCurrent:s.highlightCurrent||!1,checkFilterLeaf:s.checkFilterLeaf||!1,checkFilter:s.checkFilter||null,accordion:s.accordion||!1,draggable:s.draggable||!1,dropable:s.dropable||!1,lazy:s.lazy||!1,sort:s.sort||!1,indent:s.indent||10,checkedKeys:s.checkedKeys||[],expandKeys:s.expandKeys||[],disabledKeys:s.disabledKeys||[],limitAlert:s.limitAlert||He,click:s.click||He,check:s.check||He,change:s.change||He,load:s.load||He,contextmenu:s.contextmenu||null,radioParentoOnly:"level"===s.radioType?"level":"all",renderContent:s.renderContent||null,nocheckParent:s.nocheckParent||!1,checkOnClickNode:s.checkOnClickNode||!1,format:s.format||null,searchRender:s.searchRender||null,searchDisabledChecked:s.searchDisabledChecked||!1,expandClass:s.expandClass||"vs-expand-icon",onDragstart:s.onDragstart||He,onDragenter:s.onDragenter||He,onDrop:s.onDrop||He,customNodeClick:s.customNodeClick||void 0,update:function(){r._render()},nodesChange:function(e){r.nodes=e,r.vlist&&r._render()}}),r.store.hideRoot&&r.store.root.createNode(),r._init(),r.store.setDefaultChecked()};s.async?setTimeout((function(){k()}),0):k()}return s(e,[{key:"_init",value:function(){this.vlist=new Re({root:this.$el,data:[],maxHeight:this.maxHeight,minHeight:this.minHeight,estimateSize:this.itemHeight,keeps:this.showCount}),this._render(),this.ready&&this.ready(this)}},{key:"_render",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.$$breadcrumb){var t=this.$$breadcrumb.current;this.data=this.nodes.filter((function(e){return e.parent&&e.parent.id===t.id})),this._keywordFilter(this.data),this.$$breadcrumb.renderBreadcrumb()}else this._keywordFilter(this.nodes);e&&this.vlist.update(this.data)}},{key:"_keywordFilter",value:function(e){var t=this;this.data=e.filter((function(e){return t._hasKeyword(e)&&e.visbile&&!(t.store.hideRoot&&0===e.level)}))}},{key:"_hasKeyword",value:function(e){var t=this;if(!this.keyword)return!0;var n=this._checkFilter(e);return n?e.parent&&(e.parent.requireExpand=!0):e.childNodes.forEach((function(e){n||(n=t._hasKeyword(e))})),n}},{key:"_checkFilter",value:function(e){if(this.keyword)return"function"==typeof this.searchFilter?this.searchFilter(this.keyword,e,e.data):e.data.name&&e.data.name.includes(this.keyword)}},{key:"filter",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;if(this.keyword=t,this.store.onlySearchLeaf=n&&!!t,this.store.isSearch=!!t,this.store.onlySearchLeaf){var i=this.nodes.filter((function(t){return!t.childNodes.length&&e._checkFilter(t)&&!(e.store.hideRoot&&0===t.level)}));return this.vlist.update(i),i}this._render(!1);for(var s=0,r=this.data.length;s<r;s++){var o=this.data[s];o.requireExpand&&(o.requireExpand=!1,o.setExpand(!0,!0))}return this._render(),this.data}},{key:"getNodeById",value:function(e){return this.store.getNodeById(e)}},{key:"getCheckedNodes",value:function(){var e;return(e=this.store).getCheckedNodes.apply(e,arguments)}},{key:"setMaxValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.store.max=e}},{key:"scrollToIndex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.vlist.scrollToIndex(e)}},{key:"clearCheckedNodes",value:function(){this.getCheckedNodes(!0).forEach((function(e){e.setChecked(!1)}))}}]),e}(),je=e("VsTreeComponent",{props:{data:Array|Object,options:Object,async:Boolean,animation:Boolean,draggable:Boolean,dropable:Boolean,hideRoot:Boolean,showCheckbox:Boolean,checkboxType:Object,showRadio:Boolean,radioType:String,showLine:Boolean,showIcon:Boolean,onlyShowLeafIcon:Boolean,highlightCurrent:Boolean,accordion:Boolean,nocheckParent:Boolean,sort:Boolean,checkOnClickNode:Boolean,checkFilterLeaf:Boolean,strictLeaf:Boolean,rootName:String,max:Number,lazy:Boolean,load:Function,format:Function,disabledKeys:Array,checkedKeys:Array,expandKeys:Array,keyword:String,expandClass:String,theme:String,breadcrumb:Object,virtual:Object,expandLevel:{type:Number,default:1},indent:{type:Number,default:10},showCount:{type:Number,default:20},itemHeight:{type:Number,default:26},maxHeight:String,minHeight:String,beforeCheck:Function,renderContent:Function,checkFilter:Function,searchFilter:Function,searchRender:Function,onDragstart:Function,onDragenter:Function,onDrop:Function,customNodeClick:Function},data:function(){return{tree:{},id:null}},watch:{max:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.setMaxValue(e)},keyword:function(e){this.filter(e)}},created:function(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}this.id="tree".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())},mounted:function(){var e=this;this.$nextTick((function(){e._vsinit()}))},methods:{_vsinit:function(){var e=this;this.tree.tree=new $e("#"+this.id,Object.assign({},this.$props,a(a({},this.options),{},{data:this.data,click:function(t,n){e.$emit("click",t,n)},check:function(t,n){e.$emit("check",t,n)},change:function(t){e.$emit("change",t)},contextmenu:function(t,n){e.$emit("node-contextmenu",t,n)},limitAlert:function(){e.$emit("limit-alert")}}))),console.timeEnd("render:tree")},getNodeById:function(e){return this.tree.tree.getNodeById(e)},getCheckedNodes:function(){return this.tree.tree.getCheckedNodes()},filter:function(e){return this.tree.tree.filter(e)},setMaxValue:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.tree.tree.setMaxValue(e)}},render:function(){return function(e,t,n){const i=arguments.length;return 2===i?m(t)&&!p(t)?ae(t)?le(e,null,[t]):le(e,t):le(e,null,t):(i>3?n=Array.prototype.slice.call(arguments,2):3===i&&ae(n)&&(n=[n]),le(e,t,n))}("div",{id:this.id},this.$slots.default)}});e("default",{install:function(e){e.component("vs-tree",je)}}),e("version","0.1.0")}}}));