function _typeof2(obj){return _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof2(obj)}var global,factory;global=window,factory=function(exports,Vue){function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_typeof(obj)}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i1&&void 0!==arguments[1]&&arguments[1],to=transport.to,from=transport.from;if(to&&(from||!1!==force)&&this.transports[to])if(force)this.transports[to]=[];else{var index=this.$_getTransportIndex(transport);if(index>=0){var newTransports=this.transports[to].slice(0);newTransports.splice(index,1),this.transports[to]=newTransports}}},registerTarget:function(target,vm,force){inBrowser&&(this.trackInstances&&!force&&this.targets[target]&&console.warn("[portal-vue]: Target ".concat(target," already exists")),this.$set(this.targets,target,Object.freeze([vm])))},unregisterTarget:function(target){this.$delete(this.targets,target)},registerSource:function(source,vm,force){inBrowser&&(this.trackInstances&&!force&&this.sources[source]&&console.warn("[portal-vue]: source ".concat(source," already exists")),this.$set(this.sources,source,Object.freeze([vm])))},unregisterSource:function(source){this.$delete(this.sources,source)},hasTarget:function(to){return!(!this.targets[to]||!this.targets[to][0])},hasSource:function(to){return!(!this.sources[to]||!this.sources[to][0])},hasContentFor:function(to){return!!this.transports[to]&&!!this.transports[to].length},$_getTransportIndex:function(_ref){var to=_ref.to,from=_ref.from;for(var i in this.transports[to])if(this.transports[to][i].from===from)return+i;return-1}}}),wormhole=new Wormhole(transports),_id=1,Portal=Vue.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(_id++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}}},created:function(){var _this=this;this.$nextTick((function(){wormhole.registerSource(_this.name,_this)}))},mounted:function(){this.disabled||this.sendUpdate()},updated:function(){this.disabled?this.clear():this.sendUpdate()},beforeDestroy:function(){wormhole.unregisterSource(this.name),this.clear()},watch:{to:function(newValue,oldValue){oldValue&&oldValue!==newValue&&this.clear(oldValue),this.sendUpdate()}},methods:{clear:function(target){var closer={from:this.name,to:target||this.to};wormhole.close(closer)},normalizeSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},normalizeOwnChildren:function(children){return"function"==typeof children?children(this.slotProps):children},sendUpdate:function(){var slotContent=this.normalizeSlots();if(slotContent){var transport={from:this.name,to:this.to,passengers:_toConsumableArray(slotContent),order:this.order};wormhole.open(transport)}else this.clear()}},render:function(h){var children=this.$slots.default||this.$scopedSlots.default||[],Tag=this.tag;return children&&this.disabled?children.length<=1&&this.slim?this.normalizeOwnChildren(children)[0]:h(Tag,[this.normalizeOwnChildren(children)]):this.slim?h():h(Tag,{class:{"v-portal":!0},style:{display:"none"},key:"v-portal-placeholder"})}}),PortalTarget=Vue.extend({name:"portalTarget",props:{multiple:{type:Boolean,default:!1},name:{type:String,required:!0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},data:function(){return{transports:wormhole.transports,firstRender:!0}},created:function(){var _this=this;this.$nextTick((function(){wormhole.registerTarget(_this.name,_this)}))},watch:{ownTransports:function(){this.$emit("change",this.children().length>0)},name:function(newVal,oldVal){wormhole.unregisterTarget(oldVal),wormhole.registerTarget(newVal,this)}},mounted:function(){var _this2=this;this.transition&&this.$nextTick((function(){_this2.firstRender=!1}))},beforeDestroy:function(){wormhole.unregisterTarget(this.name)},computed:{ownTransports:function(){var transports=this.transports[this.name]||[];return this.multiple?transports:0===transports.length?[]:[transports[transports.length-1]]},passengers:function(){return function(transports){var slotProps=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return transports.reduce((function(passengers,transport){var temp=transport.passengers[0],newPassengers="function"==typeof temp?temp(slotProps):transport.passengers;return passengers.concat(newPassengers)}),[])}(this.ownTransports,this.slotProps)}},methods:{children:function(){return 0!==this.passengers.length?this.passengers:this.$scopedSlots.default?this.$scopedSlots.default(this.slotProps):this.$slots.default||[]},noWrapper:function(){var noWrapper=this.slim&&!this.transition;return noWrapper&&this.children().length>1&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),noWrapper}},render:function(h){var noWrapper=this.noWrapper(),children=this.children(),Tag=this.transition||this.tag;return noWrapper?children[0]:this.slim&&!Tag?h():h(Tag,{props:{tag:this.transition&&this.tag?this.tag:void 0},class:{"vue-portal-target":!0}},children)}}),_id$1=0,portalProps=["disabled","name","order","slim","slotProps","tag","to"],targetProps=["multiple","transition"],MountingPortal=Vue.extend({name:"MountingPortal",inheritAttrs:!1,props:{append:{type:[Boolean,String]},bail:{type:Boolean},mountTo:{type:String,required:!0},disabled:{type:Boolean},name:{type:String,default:function(){return"mounted_"+String(_id$1++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}},multiple:{type:Boolean,default:!1},targetSlim:{type:Boolean},targetSlotProps:{type:Object,default:function(){return{}}},targetTag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},created:function(){if("undefined"!=typeof document){var el=document.querySelector(this.mountTo);if(el){var props=this.$props;if(wormhole.targets[props.name])props.bail?console.warn("[portal-vue]: Target ".concat(props.name," is already mounted.\n Aborting because 'bail: true' is set")):this.portalTarget=wormhole.targets[props.name];else{var append=props.append;if(append){var type="string"==typeof append?append:"DIV",mountEl=document.createElement(type);el.appendChild(mountEl),el=mountEl}var _props=pick(this.$props,targetProps);_props.slim=this.targetSlim,_props.tag=this.targetTag,_props.slotProps=this.targetSlotProps,_props.name=this.to,this.portalTarget=new PortalTarget({el:el,parent:this.$parent||this,propsData:_props})}}else console.error("[portal-vue]: Mount Point '".concat(this.mountTo,"' not found in document"))}},beforeDestroy:function(){var target=this.portalTarget;if(this.append){var el=target.$el;el.parentNode.removeChild(el)}target.$destroy()},render:function(h){if(!this.portalTarget)return console.warn("[portal-vue] Target wasn't mounted"),h();if(!this.$scopedSlots.manual){var props=pick(this.$props,portalProps);return h(Portal,{props:props,attrs:this.$attrs,on:this.$listeners,scopedSlots:this.$scopedSlots},this.$slots.default)}var content=this.$scopedSlots.manual({to:this.to});return Array.isArray(content)&&(content=content[0]),content||h()}});function install(Vue$$1){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Vue$$1.component(options.portalName||"Portal",Portal),Vue$$1.component(options.portalTargetName||"PortalTarget",PortalTarget),Vue$$1.component(options.MountingPortalName||"MountingPortal",MountingPortal)}"undefined"!=typeof window&&window.Vue&&window.Vue===Vue&&window.Vue.use({install:install});var index={install:install};return exports.default=index,exports.Portal=Portal,exports.PortalTarget=PortalTarget,exports.MountingPortal=MountingPortal,exports.Wormhole=wormhole,Object.defineProperty(exports,"__esModule",{value:!0}),exports.default},"object"===("undefined"==typeof exports?"undefined":_typeof2(exports))&&"undefined"!=typeof module?factory(exports,require("./vue")):"function"==typeof define&&define.amd?define("local_treestudyplan/portal-vue",["exports","./vue"],factory):factory(global.PortalVue={},global.Vue); //# sourceMappingURL=portal-vue.min.js.map