/*! * vue-treeselect v0.4.0 | (c) 2017-2019 Riophae Lee * Released under the MIT License. * https://vue-treeselect.js.org/ */ module.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=16)}([function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t){e.exports=require("babel-helper-vue-jsx-merge-props")},function(e,t){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,t){e.exports=require("lodash/noop")},function(e,t){e.exports=require("lodash/debounce")},function(e,t){e.exports=require("is-promise")},function(e,t){e.exports=require("lodash/once")},function(e,t){e.exports=require("lodash/identity")},function(e,t){e.exports=require("lodash/constant")},function(e,t){e.exports=require("lodash/last")},function(e,t){e.exports=require("@babel/runtime/helpers/slicedToArray")},function(e,t){e.exports=require("fuzzysearch")},function(e,t){e.exports=require("watch-size")},function(e,t){e.exports=require("@babel/runtime/helpers/typeof")},function(e,t){e.exports=require("vue")},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var i=n(10),r=n.n(i),s=n(2),o=n.n(s),a=n(0),l=n.n(a),c=n(11),u=n.n(c),d=n(3),h=n.n(d).a;function p(e){return function(t){if("mousedown"===t.type&&0===t.button){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;rn.bottom?e.scrollTop=Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+r,e.scrollHeight):i.top-r0},single:function(){return!this.multiple},visibleOptionIds:function(){var e=this,t=[];return this.traverseAllNodesByIndex((function(n){if(e.localSearch.active&&!e.shouldOptionBeIncludedInSearchResult(n)||t.push(n.id),n.isBranch&&!e.shouldExpand(n))return!1})),t},hasVisibleOptions:function(){return 0!==this.visibleOptionIds.length},showCountOnSearchComputed:function(){return"boolean"==typeof this.showCountOnSearch?this.showCountOnSearch:this.showCount},hasBranchNodes:function(){return this.forest.normalizedOptions.some((function(e){return e.isBranch}))},shouldFlattenOptions:function(){return this.localSearch.active&&this.flattenSearchResults}},watch:{alwaysOpen:function(e){e?this.openMenu():this.closeMenu()},branchNodesFirst:function(){this.initialize()},disabled:function(e){e&&this.menu.isOpen?this.closeMenu():e||this.menu.isOpen||!this.alwaysOpen||this.openMenu()},flat:function(){this.initialize()},internalValue:function(e,t){Q(e,t)&&this.$emit("input",this.getValue(),this.getInstanceId())},matchKeys:function(){this.initialize()},multiple:function(e){e&&this.buildForestState()},options:{handler:function(){this.async||(this.initialize(),this.rootOptionsStates.isLoaded=Array.isArray(this.options))},deep:!0,immediate:!0},"trigger.searchQuery":function(){this.async?this.handleRemoteSearch():this.handleLocalSearch(),this.$emit("search-change",this.trigger.searchQuery,this.getInstanceId())},value:function(){var e=this.extractCheckedNodeIdsFromValue();Q(e,this.internalValue)&&this.fixSelectedNodeIds(e)}},methods:{verifyProps:function(){var e=this;if(h((function(){return!e.async||e.searchable}),(function(){return'For async search mode, the value of "searchable" prop must be true.'})),null!=this.options||this.loadOptions||h((function(){return!1}),(function(){return'Are you meant to dynamically load options? You need to use "loadOptions" prop.'})),this.flat&&h((function(){return e.multiple}),(function(){return'You are using flat mode. But you forgot to add "multiple=true"?'})),!this.flat){["autoSelectAncestors","autoSelectDescendants","autoDeselectAncestors","autoDeselectDescendants"].forEach((function(t){h((function(){return!e[t]}),(function(){return'"'.concat(t,'" only applies to flat mode.')}))}))}},resetFlags:function(){this._blurOnSelect=!1},initialize:function(){var e=this.async?this.getRemoteSearchEntry().options:this.options;if(Array.isArray(e)){var t=this.forest.nodeMap;this.forest.nodeMap=z(),this.keepDataOfSelectedNodes(t),this.forest.normalizedOptions=this.normalize(null,e,t),this.fixSelectedNodeIds(this.internalValue)}else this.forest.normalizedOptions=[]},getInstanceId:function(){return null==this.instanceId?this.id:this.instanceId},getValue:function(){var e=this;if("id"===this.valueFormat)return this.multiple?this.internalValue.slice():this.internalValue[0];var t=this.internalValue.map((function(t){return e.getNode(t).raw}));return this.multiple?t:t[0]},getNode:function(e){return h((function(){return null!=e}),(function(){return"Invalid node id: ".concat(e)})),null==e?null:e in this.forest.nodeMap?this.forest.nodeMap[e]:this.createFallbackNode(e)},createFallbackNode:function(e){var t=this.extractNodeFromValue(e),n={id:e,label:this.enhancedNormalizer(t).label||"".concat(e," (unknown)"),ancestors:[],parentNode:null,isFallbackNode:!0,isRootNode:!0,isLeaf:!0,isBranch:!1,isDisabled:!1,isNew:!1,index:[-1],level:0,raw:t};return this.$set(this.forest.nodeMap,e,n)},extractCheckedNodeIdsFromValue:function(){var e=this;return null==this.value?[]:"id"===this.valueFormat?this.multiple?this.value.slice():[this.value]:(this.multiple?this.value:[this.value]).map((function(t){return e.enhancedNormalizer(t)})).map((function(e){return e.id}))},extractNodeFromValue:function(e){var t=this,n={id:e};return"id"===this.valueFormat?n:q(this.multiple?Array.isArray(this.value)?this.value:[]:this.value?[this.value]:[],(function(n){return n&&t.enhancedNormalizer(n).id===e}))||n},fixSelectedNodeIds:function(e){var t=this,n=[];if(this.single||this.flat||this.disableBranchNodes||"ALL"===this.valueConsistsOf)n=e;else if("BRANCH_PRIORITY"===this.valueConsistsOf)e.forEach((function(e){n.push(e);var i=t.getNode(e);i.isBranch&&t.traverseDescendantsBFS(i,(function(e){n.push(e.id)}))}));else if("LEAF_PRIORITY"===this.valueConsistsOf)for(var i=z(),r=e.slice();r.length;){var s=r.shift(),o=this.getNode(s);n.push(s),o.isRootNode||(o.parentNode.id in i||(i[o.parentNode.id]=o.parentNode.children.length),0==--i[o.parentNode.id]&&r.push(o.parentNode.id))}else if("ALL_WITH_INDETERMINATE"===this.valueConsistsOf)for(var a=z(),l=e.filter((function(e){var n=t.getNode(e);return n.isLeaf||0===n.children.length}));l.length;){var c=l.shift(),u=this.getNode(c);n.push(c),u.isRootNode||(u.parentNode.id in a||(a[u.parentNode.id]=u.parentNode.children.length),0==--a[u.parentNode.id]&&l.push(u.parentNode.id))}Q(this.forest.selectedNodeIds,n)&&(this.forest.selectedNodeIds=n),this.buildForestState()},keepDataOfSelectedNodes:function(e){var t=this;this.forest.selectedNodeIds.forEach((function(n){if(e[n]){var i=re({},e[n],{isFallbackNode:!0});t.$set(t.forest.nodeMap,n,i)}}))},isSelected:function(e){return!0===this.forest.selectedNodeMap[e.id]},traverseDescendantsBFS:function(e,t){if(e.isBranch)for(var n=e.children.slice();n.length;){var i=n[0];i.isBranch&&n.push.apply(n,o()(i.children)),t(i),n.shift()}},traverseDescendantsDFS:function(e,t){var n=this;e.isBranch&&e.children.forEach((function(e){n.traverseDescendantsDFS(e,t),t(e)}))},traverseAllNodesDFS:function(e){var t=this;this.forest.normalizedOptions.forEach((function(n){t.traverseDescendantsDFS(n,e),e(n)}))},traverseAllNodesByIndex:function(e){!function t(n){n.children.forEach((function(n){!1!==e(n)&&n.isBranch&&t(n)}))}({children:this.forest.normalizedOptions})},toggleClickOutsideEvent:function(e){e?document.addEventListener("mousedown",this.handleClickOutside,!1):document.removeEventListener("mousedown",this.handleClickOutside,!1)},getValueContainer:function(){return this.$refs.control.$refs["value-container"]},getInput:function(){return this.getValueContainer().$refs.input},focusInput:function(){this.getInput().focus()},blurInput:function(){this.getInput().blur()},handleMouseDown:p((function(e){(e.preventDefault(),e.stopPropagation(),this.disabled)||(this.getValueContainer().$el.contains(e.target)&&!this.menu.isOpen&&(this.openOnClick||this.trigger.isFocused)&&this.openMenu(),this._blurOnSelect?this.blurInput():this.focusInput(),this.resetFlags())})),handleClickOutside:function(e){this.$refs.wrapper&&!this.$refs.wrapper.contains(e.target)&&(this.blurInput(),this.closeMenu())},handleLocalSearch:function(){var e=this,t=this.trigger.searchQuery,n=function(){return e.resetHighlightedOptionWhenNecessary(!0)};if(!t)return this.localSearch.active=!1,n();this.localSearch.active=!0,this.localSearch.noResults=!0,this.traverseAllNodesDFS((function(t){var n;t.isBranch&&(t.isExpandedOnSearch=!1,t.showAllChildrenOnSearch=!1,t.isMatched=!1,t.hasMatchedDescendants=!1,e.$set(e.localSearch.countMap,t.id,(n={},l()(n,"ALL_CHILDREN",0),l()(n,"ALL_DESCENDANTS",0),l()(n,"LEAF_CHILDREN",0),l()(n,"LEAF_DESCENDANTS",0),n)))}));var i=t.trim().toLocaleLowerCase(),r=i.replace(/\s+/g," ").split(" ");this.traverseAllNodesDFS((function(t){e.searchNested&&r.length>1?t.isMatched=r.every((function(e){return oe(!1,e,t.nestedSearchLabel)})):t.isMatched=e.matchKeys.some((function(n){return oe(!e.disableFuzzyMatching,i,t.lowerCased[n])})),t.isMatched&&(e.localSearch.noResults=!1,t.ancestors.forEach((function(t){return e.localSearch.countMap[t.id].ALL_DESCENDANTS++})),t.isLeaf&&t.ancestors.forEach((function(t){return e.localSearch.countMap[t.id].LEAF_DESCENDANTS++})),null!==t.parentNode&&(e.localSearch.countMap[t.parentNode.id].ALL_CHILDREN+=1,t.isLeaf&&(e.localSearch.countMap[t.parentNode.id].LEAF_CHILDREN+=1))),(t.isMatched||t.isBranch&&t.isExpandedOnSearch)&&null!==t.parentNode&&(t.parentNode.isExpandedOnSearch=!0,t.parentNode.hasMatchedDescendants=!0)})),n()},handleRemoteSearch:function(){var e=this,t=this.trigger.searchQuery,n=this.getRemoteSearchEntry(),i=function(){e.initialize(),e.resetHighlightedOptionWhenNecessary(!0)};if((""===t||this.cacheOptions)&&n.isLoaded)return i();this.callLoadOptionsProp({action:"ASYNC_SEARCH",args:{searchQuery:t},isPending:function(){return n.isLoading},start:function(){n.isLoading=!0,n.isLoaded=!1,n.loadingError=""},succeed:function(r){n.isLoaded=!0,n.options=r,e.trigger.searchQuery===t&&i()},fail:function(e){n.loadingError=ae(e)},end:function(){n.isLoading=!1}})},getRemoteSearchEntry:function(){var e=this,t=this.trigger.searchQuery,n=this.remoteSearch[t]||re({},{isLoaded:!1,isLoading:!1,loadingError:""},{options:[]});if(this.$watch((function(){return n.options}),(function(){e.trigger.searchQuery===t&&e.initialize()}),{deep:!0}),""===t){if(Array.isArray(this.defaultOptions))return n.options=this.defaultOptions,n.isLoaded=!0,n;if(!0!==this.defaultOptions)return n.isLoaded=!0,n}return this.remoteSearch[t]||this.$set(this.remoteSearch,t,n),n},shouldExpand:function(e){return this.localSearch.active?e.isExpandedOnSearch:e.isExpanded},shouldOptionBeIncludedInSearchResult:function(e){return!!e.isMatched||(!(!e.isBranch||!e.hasMatchedDescendants||this.flattenSearchResults)||!(e.isRootNode||!e.parentNode.showAllChildrenOnSearch))},shouldShowOptionInMenu:function(e){return!(this.localSearch.active&&!this.shouldOptionBeIncludedInSearchResult(e))},getControl:function(){return this.$refs.control.$el},getMenu:function(){var e=(this.appendToBody?this.$refs.portal.portalTarget:this).$refs.menu.$refs.menu;return e&&"#comment"!==e.nodeName?e:null},setCurrentHighlightedOption:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.menu.current;if(null!=i&&i in this.forest.nodeMap&&(this.forest.nodeMap[i].isHighlighted=!1),this.menu.current=e.id,e.isHighlighted=!0,this.menu.isOpen&&n){var r=function(){var n=t.getMenu(),i=n.querySelector('.vue-treeselect__option[data-id="'.concat(e.id,'"]'));i&&f(n,i)};this.getMenu()?r():this.$nextTick(r)}},resetHighlightedOptionWhenNecessary:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.menu.current;!e&&null!=t&&t in this.forest.nodeMap&&this.shouldShowOptionInMenu(this.getNode(t))||this.highlightFirstOption()},highlightFirstOption:function(){if(this.hasVisibleOptions){var e=this.visibleOptionIds[0];this.setCurrentHighlightedOption(this.getNode(e))}},highlightPrevOption:function(){if(this.hasVisibleOptions){var e=this.visibleOptionIds.indexOf(this.menu.current)-1;if(-1===e)return this.highlightLastOption();this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]))}},highlightNextOption:function(){if(this.hasVisibleOptions){var e=this.visibleOptionIds.indexOf(this.menu.current)+1;if(e===this.visibleOptionIds.length)return this.highlightFirstOption();this.setCurrentHighlightedOption(this.getNode(this.visibleOptionIds[e]))}},highlightLastOption:function(){if(this.hasVisibleOptions){var e=j()(this.visibleOptionIds);this.setCurrentHighlightedOption(this.getNode(e))}},resetSearchQuery:function(){this.trigger.searchQuery=""},closeMenu:function(){!this.menu.isOpen||!this.disabled&&this.alwaysOpen||(this.saveMenuScrollPosition(),this.menu.isOpen=!1,this.toggleClickOutsideEvent(!1),this.resetSearchQuery(),this.$emit("close",this.getValue(),this.getInstanceId()))},openMenu:function(){this.disabled||this.menu.isOpen||(this.menu.isOpen=!0,this.$nextTick(this.resetHighlightedOptionWhenNecessary),this.$nextTick(this.restoreMenuScrollPosition),this.options||this.async||this.loadRootOptions(),this.toggleClickOutsideEvent(!0),this.$emit("open",this.getInstanceId()))},toggleMenu:function(){this.menu.isOpen?this.closeMenu():this.openMenu()},toggleExpanded:function(e){var t;this.localSearch.active?(t=e.isExpandedOnSearch=!e.isExpandedOnSearch)&&(e.showAllChildrenOnSearch=!0):t=e.isExpanded=!e.isExpanded,t&&!e.childrenStates.isLoaded&&this.loadChildrenOptions(e)},buildForestState:function(){var e=this,t=z();this.forest.selectedNodeIds.forEach((function(e){t[e]=!0})),this.forest.selectedNodeMap=t;var n=z();this.multiple&&(this.traverseAllNodesByIndex((function(e){n[e.id]=0})),this.selectedNodes.forEach((function(t){n[t.id]=2,e.flat||e.disableBranchNodes||t.ancestors.forEach((function(t){e.isSelected(t)||(n[t.id]=1)}))}))),this.forest.checkedStateMap=n},enhancedNormalizer:function(e){return re({},e,{},this.normalizer(e,this.getInstanceId()))},normalize:function(e,t,n){var i=this,s=t.map((function(e){return[i.enhancedNormalizer(e),e]})).map((function(t,s){var o=r()(t,2),a=o[0],c=o[1];i.checkDuplication(a),i.verifyNodeShape(a);var u=a.id,d=a.label,p=a.children,f=a.isDefaultExpanded,v=null===e,m=v?0:e.level+1,g=Array.isArray(p)||null===p,S=!g,O=!!a.isDisabled||!i.flat&&!v&&e.isDisabled,y=!!a.isNew,b=i.matchKeys.reduce((function(e,t){return re({},e,l()({},t,(n=a[t],"string"==typeof n?n:"number"!=typeof n||x(n)?"":n+"").toLocaleLowerCase()));var n}),{}),_=v?b.label:e.nestedSearchLabel+" "+b.label,E=i.$set(i.forest.nodeMap,u,z());if(i.$set(E,"id",u),i.$set(E,"label",d),i.$set(E,"level",m),i.$set(E,"ancestors",v?[]:[e].concat(e.ancestors)),i.$set(E,"index",(v?[]:e.index).concat(s)),i.$set(E,"parentNode",e),i.$set(E,"lowerCased",b),i.$set(E,"nestedSearchLabel",_),i.$set(E,"isDisabled",O),i.$set(E,"isNew",y),i.$set(E,"isMatched",!1),i.$set(E,"isHighlighted",!1),i.$set(E,"isBranch",g),i.$set(E,"isLeaf",S),i.$set(E,"isRootNode",v),i.$set(E,"raw",c),g){var N,L=Array.isArray(p);i.$set(E,"childrenStates",re({},{isLoaded:!1,isLoading:!1,loadingError:""},{isLoaded:L})),i.$set(E,"isExpanded","boolean"==typeof f?f:ms+40,c=a>s+40;r.top>=0&&r.top<=o||r.top<0&&r.bottom>0?"auto"!==e.openDirection?e.menu.placement=je[e.openDirection]:e.menu.placement=l||!c?"bottom":"top":e.closeMenu()}},setupMenuSizeWatcher:function(){var e=this.instance.getMenu();this.menuSizeWatcher||(this.menuSizeWatcher={remove:L(e,this.adjustMenuOpenDirection)})},setupMenuResizeAndScrollEventListeners:function(){var e=this.instance.getControl();this.menuResizeAndScrollEventListeners||(this.menuResizeAndScrollEventListeners={remove:C(e,this.adjustMenuOpenDirection)})},removeMenuSizeWatcher:function(){this.menuSizeWatcher&&(this.menuSizeWatcher.remove(),this.menuSizeWatcher=null)},removeMenuResizeAndScrollEventListeners:function(){this.menuResizeAndScrollEventListeners&&(this.menuResizeAndScrollEventListeners.remove(),this.menuResizeAndScrollEventListeners=null)}},render:function(){var e=arguments[0];return e("div",{ref:"menu-container",class:"vue-treeselect__menu-container",style:this.menuContainerStyle},[e("transition",{attrs:{name:"vue-treeselect__menu--transition"}},[this.renderMenu()])])}},void 0,void 0,!1,null,null,null);We.options.__file="src/components/Menu.vue";var qe=We.exports,Qe=n(14),Ye=n.n(Qe);function Ke(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}var Xe,Ue={name:"vue-treeselect--portal-target",inject:["instance"],watch:{"instance.menu.isOpen":function(e){e?this.setupHandlers():this.removeHandlers()},"instance.menu.placement":function(){this.updateMenuContainerOffset()}},created:function(){this.controlResizeAndScrollEventListeners=null,this.controlSizeWatcher=null},mounted:function(){this.instance.menu.isOpen&&this.setupHandlers()},methods:{setupHandlers:function(){this.updateWidth(),this.updateMenuContainerOffset(),this.setupControlResizeAndScrollEventListeners(),this.setupControlSizeWatcher()},removeHandlers:function(){this.removeControlResizeAndScrollEventListeners(),this.removeControlSizeWatcher()},setupControlResizeAndScrollEventListeners:function(){var e=this.instance.getControl();this.controlResizeAndScrollEventListeners||(this.controlResizeAndScrollEventListeners={remove:C(e,this.updateMenuContainerOffset)})},setupControlSizeWatcher:function(){var e=this,t=this.instance.getControl();this.controlSizeWatcher||(this.controlSizeWatcher={remove:L(t,(function(){e.updateWidth(),e.updateMenuContainerOffset()}))})},removeControlResizeAndScrollEventListeners:function(){this.controlResizeAndScrollEventListeners&&(this.controlResizeAndScrollEventListeners.remove(),this.controlResizeAndScrollEventListeners=null)},removeControlSizeWatcher:function(){this.controlSizeWatcher&&(this.controlSizeWatcher.remove(),this.controlSizeWatcher=null)},updateWidth:function(){var e=this.instance,t=this.$el,n=e.getControl().getBoundingClientRect();t.style.width=n.width+"px"},updateMenuContainerOffset:function(){var e=this.instance,t=e.getControl(),n=this.$el,i=t.getBoundingClientRect(),r=n.getBoundingClientRect(),s="bottom"===e.menu.placement?i.height:0,o=Math.round(i.left-r.left)+"px",a=Math.round(i.top-r.top+s)+"px";this.$refs.menu.$refs["menu-container"].style[q(["transform","webkitTransform","MozTransform","msTransform"],(function(e){return e in document.body.style}))]="translate(".concat(o,", ").concat(a,")")}},render:function(){var e=arguments[0],t=this.instance,n=["vue-treeselect__portal-target",t.wrapperClass],i={zIndex:t.zIndex};return e("div",{class:n,style:i,attrs:{"data-instance-id":t.getInstanceId()}},[e(qe,{ref:"menu"})])},destroyed:function(){this.removeHandlers()}},Je=de({name:"vue-treeselect--menu-portal",created:function(){this.portalTarget=null},mounted:function(){this.setup()},destroyed:function(){this.teardown()},methods:{setup:function(){var e=document.createElement("div");document.body.appendChild(e),this.portalTarget=new Ye.a(function(e){for(var t=1;t