vae-of
Version:
Vue2和React快捷集成的工具包,并且适合复杂的集成场景
2 lines (1 loc) • 38 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("vue"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","vue","react-dom"],e):e((t=t||self).vuereact={},t.React,t.Vue,t.ReactDOM)}(this,function(t,n,v,j){var T="default"in n?n.default:n,A=(v=v&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v,"default"in j?j.default:j);function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e,n){e=s(e);var r=t,e=a()?Reflect.construct(e,n||[],s(t).constructor):e.apply(t,n);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");t=r;if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,g(r.key),r)}}function u(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W(){return(W=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)!{}.hasOwnProperty.call(r,n)||(t[n]=r[n])}return t}).apply(null,arguments)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&D(t,e)}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(a=function(){return!!t})()}function f(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(t,e){if(null==t)return{};var n,r=function(t,e){if(null==t)return{};var n,r={};for(n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(t),s=0;s<o.length;s++)n=o[s],e.includes(n)||{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n]);return r}function D(t,e){return(D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function y(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){{var n;if(t)return"string"==typeof t?r(t,e):"Map"===(n="Object"===(n={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t){t=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if("object"!=typeof(n=n.call(t,e||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:t+""}function S(t){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var N={react:{componentWrap:"div",slotWrap:"div",componentWrapAttrs:{__use_react_component_wrap:"",style:{all:"unset"}},slotWrapAttrs:{__use_react_slot_wrap:"",style:{all:"unset"}}},vue:{componentWrapHOC:function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];return function(){var t=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).portals,t=void 0===t?[]:t;return T.createElement("div",n,e,t.map(function(t){var e=t.Portal;return T.createElement(e,{key:t.key})}))}},componentWrapAttrs:{"data-use-vue-component-wrap":"",style:{all:"unset"}},slotWrapAttrs:{"data-use-vue-slot-wrap":"",style:{all:"unset"}}}};function M(t,e,n){t=0<arguments.length&&void 0!==t?t:{react:{},vue:{}},e=1<arguments.length&&void 0!==e?e:N,n=2<arguments.length?n:void 0,t.vue||(t.vue={}),t.react||(t.react={}),e=[e,V(V({},t),{},{react:V(V(V({},e.react),t.react),{},{componentWrapAttrs:V(V({},e.react.componentWrapAttrs),t.react.componentWrapAttrs),slotWrapAttrs:V(V({},e.react.slotWrapAttrs),t.react.slotWrapAttrs)}),vue:V(V(V({},e.vue),t.vue),{},{componentWrapAttrs:V(V({},e.vue.componentWrapAttrs),t.vue.componentWrapAttrs),slotWrapAttrs:V(V({},e.vue.slotWrapAttrs),t.vue.slotWrapAttrs)})})];return n&&e.unshift({}),Object.assign.apply(this,e)}var b={},L=["ref"],e=["style"],U=["key","data-passed-props"],F=["data-passed-props","hashList"],B=["style"],z=["on","$slots","$scopedSlots","children"],q=parseInt(n.version),K=["getElementById","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","querySelector","querySelectorAll"],h={Document:{},Element:{}};function H(a){Object.keys(h).forEach(function(t){K.forEach(function(o){var s=window[t].prototype[o];h[t][o]=s,window[t].prototype[o]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=s.apply(this,e);return r&&r.constructor!==NodeList||r&&r.constructor===NodeList&&0<r.length?r:Element.prototype[o].apply(a,e)}})})}function Y(){Object.keys(h).forEach(function(e){K.forEach(function(t){window[e].prototype[t]=h[e][t]})})}var G=function(){function e(t){return c(this,e),i(this,e,[t])}return p(e,T.Component),u(e,[{key:"render",value:function(){var t=this.props.component,e=this.props.passedProps,e=(e.ref,x(e,L));return T.createElement(t,e,this.props.children)}}])}(),J=function(h,d,m){var t=function(){function f(t){var e;return c(this,f),(e=i(this,f,[t])).state=V(V({},t),d.isSlots?{children:h}:{}),e.setRef=e.setRef.bind(e),e.vueInReactCall=e.vueInReactCall.bind(e),e.vueWrapperRef=m,e}return p(f,T.Component),u(f,[{key:"setRef",value:function(e){e&&(m.reactRef=e,Object.keys(e).forEach(function(t){m[t]||(m[t]=e[t])}),Promise.resolve().then(function(){Object.keys(e).forEach(function(t){m[t]||(m[t]=e[t])})}),(this.setRef.current=e).vueWrapperRef=m)}},{key:"createSlot",value:function(n){var t=d.react.slotWrapAttrs,r=t.style,o=x(t,e);return{inheritAttrs:!1,__fromReactSlot:!0,render:function(t){var e;return 1===(null==(e=n=n instanceof Function?n(this):n)?void 0:e.length)&&null!=(e=n[0])&&e.data&&((e=this.$attrs).key,e=x(e,U),n[0].data.attrs=V(V({},e),n[0].data.attrs)),t(d.react.slotWrap,{attrs:o,style:r},n)}}}},{key:"componentWillUnmount",value:function(){m.reactRef&&(m.reactRef.vueWrapperRef=null,m.reactRef=null)}},{key:"vueInReactCall",value:function(t){var n=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return(2<arguments.length?arguments[2]:void 0)&&t&&t[0]?t.map(function(t,e){return C(n.createSlot(t instanceof Function?t:[t]),V(V(V({},d),r),{},{isSlots:!0,wrapInstance:m})).render({key:(null==t||null==(t=t.data)?void 0:t.key)||e})}):C(this.createSlot(t),V(V(V({},d),r),{},{isSlots:!0,wrapInstance:m})).render()}},{key:"render",value:function(){var t,e,n,r,o=this,s=this.state,a=s["data-passed-props"],i=s.hashList,c=x(s,F),u={},l={};for(e in c)n=e,r=void 0,c.hasOwnProperty(n)&&null!=c[n]&&(c[n].__slot?(c[n].reactSlot?c[n]=c[n].reactSlot:(r=c[n],d.defaultSlotsFormatter?(c[n].__top__=o.vueWrapperRef,c[n]=d.defaultSlotsFormatter(c[n],o.vueInReactCall,i),c[n]instanceof Array?c[n]=y(c[n]):-1<["string","number"].indexOf(S(c[n]))?c[n]=[c[n]]:"object"===S(c[n])&&(c[n]=V({},c[n]))):c[n]=V({},C(o.createSlot(c[n]),V(V({},d),{},{isSlots:!0,wrapInstance:m})).render()),c[n].vueSlot=r),u[n]=c[n]):c[n].__scopedSlot&&(c[n]=c[n](o.createSlot),l[n]=c[n]));null!=(s=c.children)&&s.vueFunction||(t=c.children),u.default=t;var p,a=V(V(V({},a),{$slots:u,$scopedSlots:l}),{},{children:t}),s={};return s.ref=this.setRef,d.isSlots?this.state.children||this.props.children:(p=c,p=V(V({},p=d.defaultPropsFormatter?d.defaultPropsFormatter(c,this.vueInReactCall,i):p),{"data-passed-props":a}),Object.getPrototypeOf(h)!==Function.prototype&&("object"!==S(h)||h.render)||f.catchVueRefs()?T.createElement(h,W({},p,{"data-passed-props":a},s),t||p.children):T.createElement(G,W({passedProps:p,component:h},s),t||p.children))}}],[{key:"catchVueRefs",value:function(){if(m.$parent)for(var t in m.$parent.$refs)if(m.$parent.$refs[t]===m)return!0;return!1}}])}();return l(t,"displayName","useReact_".concat(h.displayName||h.name||"Component")),t};function _(E){var k=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return E.__esModule&&E.default&&(E=E.default),k.isSlots&&(E=E()),k=M(k,void 0,!0),{originReactComponent:E,data:function(){return{portals:[],portalKeyPool:[],maxPortalCount:0}},created:function(){this.cleanVnodeStyleClass(),this.$root.$options.router&&(b.router=this.$root.$options.router),this.$root.$options.router&&(b.store=this.$root.$options.store)},props:["dataPassedProps"],render:function(e){this.slotsInit();var t=k.react.componentWrapAttrs,n=t.style,t=x(t,B);return e(k.react.componentWrap,{ref:"react",attrs:t,style:n},this.portals.map(function(t){return(0,t.Portal)(e,t.key)}))},methods:{pushVuePortal:function(t){var e=this.portalKeyPool.shift()||this.maxPortalCount++;this.portals.push({Portal:t,key:e})},removeVuePortal:function(n){var r,t=this.portals.find(function(t,e){if(t.Portal===n)return r=e,!0});this.portalKeyPool.push(t.key),this.portals.splice(r,1)},slotsInit:function(e){var t,n=this;if(e)return null==(t=e.componentOptions)||null==(t=t.Ctor)||!t.options||null!=(t=e.componentOptions)&&null!=(t=t.Ctor)&&t.options.originReactComponent?(null!=(t=e.data)&&t.scopedSlots&&Object.keys(null==(t=e.data)?void 0:t.scopedSlots).forEach(function(t){if("function"==typeof e.data.scopedSlots[t])try{e.data.scopedSlots[t]()}catch(t){}}),void(e.children||(null==(t=e.componentOptions)?void 0:t.children)||[]).forEach(function(t){n.slotsInit(t)})):void 0;Object.keys(this.$slots).forEach(function(t){(n.$slots[t]||[]).forEach(function(t){n.slotsInit(t)})}),Object.keys(this.$scopedSlots).forEach(function(t){try{n.$scopedSlots[t]()}catch(t){}})},updateLastVnodeData:function(t){return this.lastVnodeData={style:V(V({},this.formatStyle(t.data.style)),this.formatStyle(t.data.staticStyle)),class:Array.from(new Set([].concat(y(this.formatClass(t.data.class)),y(this.formatClass(t.data.staticClass))))).join(" ")},Object.assign(t.data,{staticStyle:null,style:null,staticClass:null,class:null}),t},cleanVnodeStyleClass:function(){var e=this,n=this.$vnode;this.updateLastVnodeData(n),Object.defineProperty(this,"$vnode",{get:function(){return n},set:function(t){return n=t!==n?e.updateLastVnodeData(t):n}})},toCamelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},formatStyle:function(e){var n,r=this;return e?"string"==typeof e?(e=e.trim()).split(/\s*;\s*/).reduce(function(t,e){return e&&2===(e=e.split(/\s*:\s*/)).length&&Object.assign(t,l({},r.toCamelCase(e[0]),e[1])),t},{}):"object"===S(e)?(n={},Object.keys(e).forEach(function(t){n[r.toCamelCase(t)]=e[t]}),n):{}:{}},formatClass:function(e){return e?e instanceof Array?e:"string"==typeof e?(e=e.trim()).split(/\s+/):"object"===S(e)?Object.keys(e).map(function(t){return e[t]||""}):[]:[]},getScopeSlot:function(s,a,e){var i=this;function t(o){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return s.reactFunction?s.reactFunction.apply(this,n):k.defaultSlotsFormatter?((t=s.apply(this,n)).__top__=i,(t=k.defaultSlotsFormatter(t,i.vueInReactCall,a))instanceof Array||-1<S(t).indexOf("string","number")?t=y(t):"object"===S(t)&&(t=V({},t)),t):C(o(s.apply(this,n)),V(V({},k),{},{isSlots:!0,wrapInstance:i})).render()}return k.pureTransformer&&e?t.vueFunction=e:t.vueFunction=s,t}return t.__scopedSlot=!0,t},__syncUpdateProps:function(t){this.reactInstance&&this.reactInstance.setState(t)},mountReactComponent:function(t,e){var n=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=null!=this.$props.dataPassedProps?this.$props.dataPassedProps:{},s=o.on,a=o.$slots,i=o.$scopedSlots,c=o.children,o=x(o,z),u={},l=[],p=null==(p=this.$vnode.context)||null==(p=p.$vnode)||null==(p=p.componentOptions)||null==(p=p.Ctor)||null==(p=p.extendOptions)?void 0:p._scopeId,f=(p&&(u[p]="",l.push(p)),{}),h={};if(!t||null!=e&&e.slot){var d,m=V(V({},a),this.$slots);for(d in m)f[d]=m[d],f[d].__slot=!0;var v,y,g=V(V({},i),this.$scopedSlots);for(v in g)f[v]?this.$scopedSlots[v]&&(this.$scopedSlots[v].__slot=!0):g[v].__slot?(f[v]=g[v](),f[v].__slot=!0):h[v]=this.getScopeSlot(g[v],l,null==(y=this.$vnode)||null==(y=y.data)||null==(y=y.scopedSlots)?void 0:y[v])}var S,b=V(V(V(V({},o),V({},this.$attrs)),!t||null!=e&&e.slot?{$slots:f,$scopedSlots:h,children:c}:{}),{},{on:V(V({},s),this.$listeners)}),_=((!t||null!=e&&e.slot)&&(S=V({},f),c=S.default,delete S.default),this.last=this.last||{},this.last.slot=this.last.slot||{},this.last.listeners=this.last.listeners||{},this.last.attrs=this.last.attrs||{},{slot:function(){n.last.slot=V(V(V({},c?{children:c}:{children:null}),S),h)},listeners:function(){n.last.listeners=b.on},attrs:function(){n.last.attrs=n.$attrs}});if(e&&Object.keys(e).forEach(function(t){return _[t]()}),t){var $=function(){n.reactInstance&&n.reactInstance.setState(function(e){return Object.keys(e).forEach(function(t){k.isSlots&&"children"===t||delete e[t]}),V(V(V(V({},n.cache),!k.isSlots&&n.last.slot),n.last.attrs),R)}),n.cache=null},R=(!this.microTaskUpdate||this.cache||this.$nextTick(function(){$(),n.microTaskUpdate=!1}),this.macroTaskUpdate&&(clearTimeout(this.updateTimer),this.updateTimer=setTimeout(function(){clearTimeout(n.updateTimer),$(),n.macroTaskUpdate=!1})),{});Object.keys(this.last.listeners).forEach(function(t){R["on".concat(t.replace(/^(\w)/,function(t,e){return e.toUpperCase()}))]=n.$listeners[t]}),this.cache=V(V({},this.cache||{}),V(V(V(V(V(V({},o),r),{"data-passed-props":b}),this.lastVnodeData.class?{className:this.lastVnodeData.class}:{}),V({},u)),{},{hashList:l,style:this.lastVnodeData.style})),this.macroTaskUpdate||this.microTaskUpdate||$()}else{_.slot(),_.listeners(),_.attrs();var p=J(E,k,this),w={},P=(Object.keys(b.on).forEach(function(t){w["on".concat(t.replace(/^(\w)/,function(t,e){return e.toUpperCase()}))]=b.on[t]}),T.createElement(p,W({},o,this.$attrs,w,{children:c},S,h,{"data-passed-props":b},this.lastVnodeData.class?{className:this.lastVnodeData.class}:{},u,{hashList:l,style:this.lastVnodeData.style,ref:function(t){return n.reactInstance=t}}))),O=(this.$redux&&this.$redux.store&&this.$redux.ReactReduxContext&&(a=this.$redux.ReactReduxContext,P=T.createElement(a.Provider,{value:{store:this.$redux.store}},P)),this.$refs.react),C=k.wrapInstance;if(C)(C=k.wrapInstance).vueWrapperRef=this;else for(var I=this.$parent;I;){if(I.parentReactWrapperRef){C=I.parentReactWrapperRef;break}if(I.reactWrapperRef){C=I.reactWrapperRef;break}I=I.$parent}C?(this.parentReactWrapperRef=C,this.reactPortal=function(){return j.createPortal(P,O)},C.pushReactPortal(this.reactPortal)):17<q?(void 0!==A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED&&(A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=!0),this.__veauryReactApp__=A.createRoot(O),this.__veauryReactApp__.render(P)):A.render(P,O)}}},mounted:function(){clearTimeout(this.updateTimer),this.mountReactComponent()},beforeDestroy:function(){clearTimeout(this.updateTimer),this.reactPortal?(H(this.$refs.react),this.parentReactWrapperRef&&this.parentReactWrapperRef.removeReactPortal(this.reactPortal)):(H(this.$refs.react),17<q?this.__veauryReactApp__.unmount():A.unmountComponentAtNode(this.$refs.react)),Y()},updated:function(){this.mountReactComponent(!0,{slot:!0})},inheritAttrs:!1,watch:{$attrs:{handler:function(){this.mountReactComponent(!0,{attrs:!0})},deep:!0},$listeners:{handler:function(){this.mountReactComponent(!0,{listeners:!0})},deep:!0},"$props.dataPassedProps":{handler:function(){this.mountReactComponent(!0,{passedProps:!0})},deep:!0}}}}var d={};function Q(t){Object.assign(d.vueInstance.$data,V({},t))}function X(t){return(X="function"==typeof Symbol&&"symbol"===S(Symbol.iterator)?function(t){return S(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":S(t)})(t)}function Z(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var m="undefined"!=typeof window;function tt(n,t){return t.reduce(function(t,e){return n.hasOwnProperty(e)&&(t[e]=n[e]),t},{})}var et={},nt={},rt={},$=new(v.extend({data:function(){return{transports:et,targets:nt,sources:rt,trackInstances:m}},methods:{open:function(t){var e,n,r,o;m&&(e=t.to,r=t.from,n=t.passengers,t=void 0===(t=t.order)?1/0:t,e)&&r&&n&&(n={to:e,from:r,passengers:(r=n,Array.isArray(r)||"object"===X(r)?Object.freeze(r):r),order:t},-1===Object.keys(this.transports).indexOf(e)&&v.set(this.transports,e,[]),r=this.$_getTransportIndex(n),t=this.transports[e].slice(0),-1===r?t.push(n):t[r]=n,this.transports[e]=(o=function(t,e){return t.order-e.order},t.map(function(t,e){return[e,t]}).sort(function(t,e){return o(t[1],e[1])||t[0]-e[0]}).map(function(t){return t[1]})))},close:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=t.to;n&&(t.from||!1!==e)&&this.transports[n]&&(e?this.transports[n]=[]:0<=(e=this.$_getTransportIndex(t))&&((t=this.transports[n].slice(0)).splice(e,1),this.transports[n]=t))},registerTarget:function(t,e,n){m&&(this.trackInstances&&!n&&this.targets[t]&&console.warn("[portal-vue]: Target ".concat(t," already exists")),this.$set(this.targets,t,Object.freeze([e])))},unregisterTarget:function(t){this.$delete(this.targets,t)},registerSource:function(t,e,n){m&&(this.trackInstances&&!n&&this.sources[t]&&console.warn("[portal-vue]: source ".concat(t," already exists")),this.$set(this.sources,t,Object.freeze([e])))},unregisterSource:function(t){this.$delete(this.sources,t)},hasTarget:function(t){return!(!this.targets[t]||!this.targets[t][0])},hasSource:function(t){return!(!this.sources[t]||!this.sources[t][0])},hasContentFor:function(t){return!!this.transports[t]&&!!this.transports[t].length},$_getTransportIndex:function(t){var e,n=t.to,r=t.from;for(e in this.transports[n])if(this.transports[n][e].from===r)return+e;return-1}}}))(et),ot=1,st=v.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(ot++)}},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 t=this;this.$nextTick(function(){$.registerSource(t.name,t)})},mounted:function(){this.disabled||this.sendUpdate()},updated:function(){this.disabled?this.clear():this.sendUpdate()},beforeDestroy:function(){$.unregisterSource(this.name),this.clear()},watch:{to:function(t,e){e&&e!==t&&this.clear(e),this.sendUpdate()}},methods:{clear:function(t){t={from:this.name,to:t||this.to};$.close(t)},normalizeSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},normalizeOwnChildren:function(t){return"function"==typeof t?t(this.slotProps):t},sendUpdate:function(){var t=this.normalizeSlots();t?(t={from:this.name,to:this.to,passengers:Z(t),order:this.order},$.open(t)):this.clear()}},render:function(t){var e=this.$slots.default||this.$scopedSlots.default||[],n=this.tag;return e&&this.disabled?e.length<=1&&this.slim?this.normalizeOwnChildren(e)[0]:t(n,[this.normalizeOwnChildren(e)]):this.slim?t():t(n,{class:{"v-portal":!0},style:{display:"none"},key:"v-portal-placeholder"})}}),at=v.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:$.transports,firstRender:!0}},created:function(){var t=this;this.$nextTick(function(){$.registerTarget(t.name,t)})},watch:{ownTransports:function(){this.$emit("change",0<this.children().length)},name:function(t,e){$.unregisterTarget(e),$.registerTarget(t,this)}},mounted:function(){var t=this;this.transition&&this.$nextTick(function(){t.firstRender=!1})},beforeDestroy:function(){$.unregisterTarget(this.name)},computed:{ownTransports:function(){var t=this.transports[this.name]||[];return this.multiple?t:0===t.length?[]:[t[t.length-1]]},passengers:function(){return function(t,e){var r=1<arguments.length&&void 0!==e?e:{};return t.reduce(function(t,e){var n=e.passengers[0],n="function"==typeof n?n(r):e.passengers;return t.concat(n)},[])}(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 t;return(t=this.slim&&!this.transition)&&1<this.children().length&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),t}},render:function(t){var e=this.noWrapper(),n=this.children(),r=this.transition||this.tag;return e?n[0]:this.slim&&!r?t():t(r,{props:{tag:this.transition&&this.tag?this.tag:void 0},class:{"vue-portal-target":!0}},n)}}),it=0,ct=["disabled","name","order","slim","slotProps","tag","to"],ut=["multiple","transition"],lt=v.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(it++)}},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(){var t,e;"undefined"!=typeof document&&((t=document.querySelector(this.mountTo))?(e=this.$props,$.targets[e.name]?e.bail?console.warn("[portal-vue]: Target ".concat(e.name," is already mounted.\n Aborting because 'bail: true' is set")):this.portalTarget=$.targets[e.name]:((e=e.append)&&(e=document.createElement("string"==typeof e?e:"DIV"),t.appendChild(e),t=e),(e=tt(this.$props,ut)).slim=this.targetSlim,e.tag=this.targetTag,e.slotProps=this.targetSlotProps,e.name=this.to,this.portalTarget=new at({el:t,parent:this.$parent||this,propsData:e}))):console.error("[portal-vue]: Mount Point '".concat(this.mountTo,"' not found in document")))},beforeDestroy:function(){var t,e=this.portalTarget;this.append&&(t=e.$el).parentNode.removeChild(t),e.$destroy()},render:function(t){var e;return this.portalTarget?this.$scopedSlots.manual?(e=this.$scopedSlots.manual({to:this.to}),(e=Array.isArray(e)?e[0]:e)||t()):(e=tt(this.$props,ct),t(st,{props:e,attrs:this.$attrs,on:this.$listeners,scopedSlots:this.$scopedSlots},this.$slots.default)):(console.warn("[portal-vue] Target wasn't mounted"),t())}}),R=new Set(["onClick","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onChange","onInput","onInvalid","onReset","onSubmit","onError","onLoad","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onLoad","onError","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onToggle"]),pt=["history","match","location"],ft=["$model"],ht=["$sync"],dt=["$slots","$scopedSlots","children","on"],mt=["component","on","$slots","$scopedSlots","children","class","style","data-passed-props"],vt=["className","classname"],yt=17<=parseFloat(n.version)?"UNSAFE_":"",w="vae-of-options";function P(t){return"string"==typeof t?v.component(t):t}function gt(t){return"function"==typeof t?t.options:t}var St=function(){function r(t){c(this,r),e=i(this,r,[t]);var e,n=t.history;return n={history:n,match:t.match,location:t.location},d.vueInstance?Q(n):(d.vueInstance=new v({data:V({},n)}),v.prototype.$reactRouter=d.vueInstance.$data),e}return p(r,T.Component),u(r,[{key:"".concat(yt,"componentWillReceiveProps"),value:function(t){Q({history:t.history,match:t.match,location:t.location})}},{key:"render",value:function(){var t=this.props,t=(t.history,x(t,pt));return T.createElement(bt,W({},t,{ref:this.props.forwardRef}))}}])}(),O=T.forwardRef(function(t,e){var n=M(t[w]||{},void 0,!0);return d.withRouter?(O.RouterTargetComponent||(O.RouterTargetComponent=d.withRouter(St)),T.createElement(O.RouterTargetComponent,W({},V(V({},t),{},l({},w,n)),{forwardRef:e}))):T.createElement(bt,W({},V(V({},t),{},l({},w,n)),{ref:e}))}),bt=function(){function n(t){var e;return c(this,n),(e=i(this,n,[t])).state={portals:[]},e.portalKeyPool=[],e.maxPortalCount=0,e.currentVueComponent=P(t.component),e.createVueInstance=e.createVueInstance.bind(e),e.vueComponentContainer=e.createVueComponentContainer(),e}return p(n,T.Component),u(n,[{key:"pushReactPortal",value:function(t){var e=this.state.portals,n=this.portalKeyPool.shift()||this.maxPortalCount++;e.push({Portal:t,key:n}),this.setState({portals:e})}},{key:"removeReactPortal",value:function(n){var r,t=this.state.portals,e=t.find(function(t,e){if(t.Portal===n)return r=e,!0});this.portalKeyPool.push(e.key),t.splice(r,1),this.vueRef&&this.setState({portals:t})}},{key:"createVueComponentContainer",value:function(){var e=this,n={},t=this.props[w];return t.isSlots?(Object.keys(this.props).forEach(function(t){R.has(t)&&"function"==typeof e.props[t]&&(n[t]=e.props[t])}),t.vue.slotWrapAttrs&&(n=V(V({},n),t.vue.slotWrapAttrs))):t.vue.componentWrapAttrs&&(n=V(V({},n),t.vue.componentWrapAttrs)),t.vue.componentWrapHOC(T.createElement("div",{ref:this.createVueInstance,key:null}),n)}},{key:"".concat(yt,"componentWillReceiveProps"),value:function(t){var e,n=this,r=t.component,o=t.children,s=t.$slots,t=x(t,["component",w,"children","$slots"].map(g)),r=P(r);this.currentVueComponent!==r&&this.updateVueComponent(r),this.vueInstance&&(o=this.transferChildren(o),s=this.transferSlots(s),o&&(t.children=o),s&&(t.$slots=s),e=this.doSync(this.doVModel(t)),Object.keys(this.vueInstance.$data.reactProps).forEach(function(t){t in e||"data-passed-props"===t||n.vueInstance.$set(n.vueInstance.$data.reactProps,t,void 0)}),Object.keys(e).forEach(function(t){n.vueInstance.$set(n.vueInstance.$data.reactProps,t,e[t])}))}},{key:"componentWillUnmount",value:function(){this.vuePortal?this.parentVueWrapperRef.removeVuePortal(this.vuePortal):this.vueInstance&&this.vueInstance.$destroy()}},{key:"doVModel",value:function(t){var e,r,o=t.$model,n=x(t,ft);return void 0===o?t:(e=l({},(t=V(V({},{prop:"value",event:"input"}),gt(this.currentVueComponent).model)).prop,o.value),n.on||(n.on={}),n.on[t.event]?(r=n.on[t.event],n.on[t.event]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r.apply(this,e),o.setter&&o.setter.apply(this,e)}):n.on=V(V({},n.on),l({},t.event,o.setter||function(){})),V(V({},n),e))}},{key:"doSync",value:function(t){var s=t.$sync,e=x(t,ht);if(void 0===s)return t;var n,a={};for(n in s)!function(r){if(!s.hasOwnProperty(r)||!s[r]||null==s[r].value||null==s[r].setter)return;a[r]=s[r].value;var o,t="update:"+r;e.on||(e.on={}),e.on[t]?(o=e.on[t],e.on[t]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];o.apply(this,e),s[r].setter&&s[r].setter.apply(this,e)}):e.on=V(V({},e.on),l({},t,s[r].setter||function(){}))}(n);return V(V({},e),a)}},{key:"transferSlots",value:function(n){if(n)return Object.keys(n).forEach(function(t){var e=n[t];n[t]=function(){return e}}),n}},{key:"transferChildren",value:function(t){var e;if(t)return e=t,function(){return e}}},{key:"createVueInstance",value:function(t){var m=this,u=this,e=this.props,n=e.component,r=e["data-passed-props"],r=void 0===r?{}:r,l=e[w],o=e.children,s=e.$slots,e=x(e,["component","data-passed-props",w,"children","$slots"].map(g)),o=this.transferChildren(o),s=this.transferSlots(s),n=(o&&(e.children=o),s&&(e.$slots=s),P(n));function a(t){this.vueInstance||(this.vueInstance=t)}a=a.bind(this);var i=V(V({},this.doSync(this.doVModel(e))),{},{"data-passed-props":r}),c=V(V({},b),{},{data:function(){return{reactProps:i}},created:function(){this.reactWrapperRef=u,a(this)},methods:{getNamespaceSlots:function(s,t){var e,a=this,i=(this.getNamespaceSlots.__namespaceSlots||(this.getNamespaceSlots.__namespaceSlots={}),Object.assign({},t));for(e in i)!function(t){if(!i.hasOwnProperty(t)||!i[t])return;var e,n,r,o;"function"==typeof i[t]&&(i[t]=i[t]()),i[t]=(e=i[t],n=t,e.vueSlot||(null!=(r=a.getNamespaceSlots.__namespaceSlots[t])&&null!=(r=r[0])&&null!=(r=r.child)&&r.reactInstance?(o=a.getNamespaceSlots.__namespaceSlots[t],a.$nextTick(function(){o[0].child.reactInstance.setState({children:e})})):(o=[s(_(function(){return e},V(V({},l),{},{isSlots:!0,wrapInstance:u})),{slot:n})],a.getNamespaceSlots.__namespaceSlots[t]=o),o.reactSlot=e,o))}(e);return i},getScopedSlots:function(i,t){var e,c=this,n=(this.getScopedSlots.__scopeSlots||(this.getScopedSlots.__scopeSlots={}),V({},t));for(e in n)!function(s){if(!n.hasOwnProperty(s))return;var a,t=n[s];n[s]=(a=t,function(){for(var t,e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return a.vueFunction?a.vueFunction.apply(c,r):(null!=(t=c.getScopedSlots.__scopeSlots[s])&&null!=(t=t.child)&&t.reactInstance?(e=c.getScopedSlots.__scopeSlots[s],c.$nextTick(function(){e.child.reactInstance.setState({children:a.apply(c,r)})})):(e=i(_(function(){return a.apply(c,r)},V(V({},l),{},{isSlots:!0,wrapInstance:u}))),c.getScopedSlots.__scopeSlots[s]=e),e)}),n[s].reactFunction=t}(e);return n},getChildren:function(t,e){var n,r;if(null!=e)return(e="function"==typeof e?e():e).vueSlot?e.vueSlot:(null!=(n=this.getChildren.__vnode)&&null!=(n=n[0])&&null!=(n=n.child)&&n.reactInstance?(r=this.getChildren.__vnode,this.$nextTick(function(){r[0].child.reactInstance.setState({children:e})})):(r=[t(_(function(){return e},V(V({},l),{},{isSlots:!0,wrapInstance:u})))],this.getChildren.__vnode=r),r.reactSlot=e,r)}},mounted:function(){u.vueRef=this.$children[0],this.$children[0].reactWrapperRef=u},beforeDestroy:function(){u.vueRef=null,this.$children[0].reactWrapperRef=null},render:function(t){var e=this.$data.reactProps,n=(e.component,e.on),r=e.$slots,o=e.$scopedSlots,s=e.class,s=void 0===s?"":s,a=e.style,a=void 0===a?"":a,i=e["data-passed-props"],c=i.$slots,u=i.$scopedSlots,l=i.children,p=i.on,i=x(i,dt),f=x(e,mt),e=(!function(t,e){if(!t)return;if(e)for(var n in t)t.hasOwnProperty(n)&&e[n]&&delete t[n]}(u,c),this.getScopedSlots(t,V(V({},u),o))),u=this.getChildren(t,this.reactProps.children||l),h=this.getNamespaceSlots(t,V(V({},c),r)),o=(u&&(h.default=u),[u||[]].concat(y(Object.keys(h).map(function(t){if("default"!==t)return h[t]})))),l=V(V({},p),n),d={},c=(Object.keys(f).forEach(function(t){R.has(t)&&"function"==typeof f[t]&&(d[t.replace(/^on/,"").toLowerCase()]=f[t],delete f[t])}),V(V(V({},i),f),{},{"data-passed-props":V(V(V({},i),f),{},{on:l,children:u,$slots:h,$scopedSlots:e})})),r=function(t){var e=[],n={},r=gt(m.currentVueComponent),o=(r.mixins&&r.mixins.forEach(function(t){t.props&&(t.props instanceof Array?e=y(t.props):n=V({},t.props))}),Object.assign({},t)),t=r.props;if(t)if(t instanceof Array)[].concat(y(t),y(e)).forEach(function(t){delete o[t]});else{var s,a=V(V({},t),n);for(s in a)a.hasOwnProperty(s)&&delete o[s]}return o}(V({},c)),p=r.className,n=r.classname,i=x(r,vt);return t("use_vue_wrapper",{props:c,on:l,nativeOn:d,attrs:i,class:s||p||n||"",style:a,scopedSlots:V({},e)},o)},components:{use_vue_wrapper:n}});if(t){var p="__vue_wrapper_container_"+(Math.random()+"").substr(2),f=(t.id=p,l.wrapInstance);if(f)(f=l.wrapInstance).reactWrapperRef=u;else for(var h,d=(this._reactInternals||this._reactInternalFiber).return;d;){if(null!=(h=d.stateNode)&&h.parentVueWrapperRef){f=d.stateNode.parentVueWrapperRef;break}if(null!=(h=d.stateNode)&&h.vueWrapperRef){f=d.stateNode.vueWrapperRef;break}d=d.return}f&&document.getElementById(p)?(this.parentVueWrapperRef=f,this.vuePortal=function(t,e){return t(lt,{props:{mountTo:"#"+p,slim:!0,targetSlim:!0},key:p},[t(Object.assign(c,{router:m._router}))])},f.pushVuePortal(this.vuePortal)):this.vueInstance=new v(V(V({},c),{},{el:t}))}}},{key:"updateVueComponent",value:function(t){this.currentVueComponent=t,this.vueInstance&&(t.__fromReactSlot?Object.assign(this.vueInstance.$options.components.use_vue_wrapper._Ctor[0].options,t):this.vueInstance.$options.components.use_vue_wrapper=t,this.vueInstance.$forceUpdate())}},{key:"render",value:function(){return T.createElement(this.vueComponentContainer,{portals:this.state.portals})}}])}();function C(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return n||console.warn("Component must be passed in applyVueInReact!"),n.__esModule&&n.default&&(n=n.default),T.forwardRef(function(t,e){return T.createElement(O,W({},t,{component:n,ref:e},l({},w,r)))})}var I,E,_t=function(){return u(function t(e){var n=this;if(c(this,t),!e||!e.subscribe||!e.getState)throw Error("incorrect store passed in, please check the function applyRedux's parameter must contains redux store");(this.store=e).subscribe(function(){n._vm.state=e.getState()}),this._vm=new v({data:function(){return{state:e.getState()}}})},[{key:"state",get:function(){return this._vm.state}},{key:"dispatch",get:function(){return this.store.dispatch}}])}();function $t(t){var e=t.store,t=t.ReactReduxContext;return I||(I=new _t(e),t&&(I.ReactReduxContext=t),v.prototype.$redux=I),I}function Rt(t){E=t}var k={};var wt=_,Pt=C,Ot=$t,Ct=Rt;t.REACT_ALL_HANDLERS=R,t.VueContainer=O,t.applyReactInVue=_,t.applyReactRouterInVue=function(t){return d.withRouter||(d.withRouter=t),d.withRouter},t.applyRedux=$t,t.applyVueInReact=C,t.applyVuex=Rt,t.connectVuex=function(t){var e=t.mapStateToProps,r=void 0===e?function(t){}:e,o=void 0===(e=t.mapGettersToProps)?function(t){}:e,s=void 0===(e=t.mapCommitToProps)?function(t){}:e,a=void 0===(e=t.mapDispatchToProps)?function(t){}:e;return function(t){var n=function(){function e(t){if(c(this,e),t=i(this,e,[t]),(E=b.store?b.store:E)&&E.state&&E.subscribe&&E.dispatch&&E.commit)return t.state=V(V({},r(E.state)),o(E.getters)),t;throw Error("[vae-of warn]Error: incorrect store passed in, please check the function applyVuex's parameter must be vuex store")}return p(e,T.Component),u(e,[{key:"componentDidMount",value:function(){var e=this;this.watch=E.watch(function(){return V(V({},r(E.state)),o(E.getters))},function(t){e.setState(t)},{deep:!0})}},{key:"componentWillUnmount",value:function(){this.watch()}},{key:"render",value:function(){return T.createElement(t,W({},this.props,V(V(V({},this.state),s(E.commit)),a(E.dispatch)),{ref:this.props.forwardedRef}))}}])}();return T.forwardRef(function(t,e){return T.createElement(n,W({forwardedRef:e},t))})}},t.lazyReactInVue=function(t,e){return function(){return t().then(function(t){return _(t.default,e)})}},t.lazyVueInReact=function(t,e){return n.lazy(function(){return t().then(function(t){return{default:C(t.default,e)}})})},t.useReactInVue=wt,t.useRedux=Ot,t.useVueInReact=Pt,t.useVuex=Ct,t.vueRootInfo=b,t.withVueRouter=function(t){var n=function(){function e(t){if(c(this,e),t=i(this,e,[t]),!k.instance){if(!b.router)throw Error("Vue router does not exist! You must setting the Vue router in the Vue Instance options first.");k.instance=new v({router:b.router})}return t.state={$vueRouter:k.instance.$router,$vueRoute:k.instance.$route},t}return p(e,T.Component),u(e,[{key:"componentDidMount",value:function(){var t=this;this.subscribe=k.instance.$watch("$route",function(){t.setState({$vueRouter:k.instance.$router,$vueRoute:k.instance.$route})})}},{key:"componentWillUnmount",value:function(){this.subscribe()}},{key:"render",value:function(){return T.createElement(t,W({},this.props,this.state,{ref:this.props.forwardedRef}))}}])}();return T.forwardRef(function(t,e){return T.createElement(n,W({forwardedRef:e},t))})},Object.defineProperty(t,"__esModule",{value:!0})});