UNPKG

@turbox3d/graphic-component-pixi

Version:

Graphic component library based on pixi

2 lines 181 kB
/*! For license information please see index.min.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("THREE"),require("pixi.js")):"function"==typeof define&&define.amd?define(["THREE","pixi.js"],e):"object"==typeof exports?exports["@turbox3d/graphic-component-pixi"]=e(require("THREE"),require("pixi.js")):t.GraphicComponentPixi=e(t.THREE,t.PIXI)}(self,((t,e)=>(()=>{var n={17:(t,e,n)=>{var i=n(756),r=n(489),o=n(965),a=n(95),s=n(551),c=n(213),l=n(587);function u(){"use strict";var e=r(),n=e.m(u),h=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function d(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))}var v={throw:1,return:2,break:3,continue:3};function p(t){var e,n;return function(i){e||(e={stop:function(){return n(i.a,2)},catch:function(){return i.v},abrupt:function(t,e){return n(i.a,v[t],e)},delegateYield:function(t,r,o){return e.resultName=r,n(i.d,l(t),o)},finish:function(t){return n(i.f,t)}},n=function(t,n,r){i.p=e.prev,i.n=e.next;try{return t(n,r)}finally{e.next=i.n}}),e.resultName&&(e[e.resultName]=i.v,e.resultName=void 0),e.sent=i.v,e.next=i.n;try{return t.call(this,e)}finally{i.p=e.prev,i.n=e.next}}}return(t.exports=u=function(){return{wrap:function(t,n,i,r){return e.w(p(t),n,i,r&&r.reverse())},isGeneratorFunction:d,mark:e.m,awrap:function(t,e){return new i(t,e)},AsyncIterator:s,async:function(t,e,n,i,r){return(d(e)?a:o)(p(t),e,n,i,r)},keys:c,values:l}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=u,t.exports.__esModule=!0,t.exports.default=t.exports},47:t=>{"use strict";t.exports=e},95:(t,e,n)=>{var i=n(489),r=n(551);t.exports=function(t,e,n,o,a){return new r(i().w(t,e,n,o),a||Promise)},t.exports.__esModule=!0,t.exports.default=t.exports},213:t=>{t.exports=function(t){var e=Object(t),n=[];for(var i in e)n.unshift(i);return function t(){for(;n.length;)if((i=n.pop())in e)return t.value=i,t.done=!1,t;return t.done=!0,t}},t.exports.__esModule=!0,t.exports.default=t.exports},466:t=>{function e(n,i,r,o){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}t.exports=e=function(t,n,i,r){if(n)a?a(t,n,{value:i,enumerable:!r,configurable:!r,writable:!r}):t[n]=i;else{var o=function(n,i){e(t,n,(function(t){return this._invoke(n,i,t)}))};o("next",0),o("throw",1),o("return",2)}},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,i,r,o)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},489:(t,e,n)=>{var i=n(466);function r(){var e,n,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.toStringTag||"@@toStringTag";function c(t,r,o,a){var s=r&&r.prototype instanceof u?r:u,c=Object.create(s.prototype);return i(c,"_invoke",function(t,i,r){var o,a,s,c=0,u=r||[],h=!1,d={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(t,n){return o=t,a=0,s=e,d.n=n,l}};function v(t,i){for(a=t,s=i,n=0;!h&&c&&!r&&n<u.length;n++){var r,o=u[n],v=d.p,p=o[2];t>3?(r=p===i)&&(a=o[4]||3,s=o[5]===e?o[3]:o[5],o[4]=3,o[5]=e):o[0]<=v&&((r=t<2&&v<o[1])?(a=0,d.v=i,d.n=o[1]):v<p&&(r=t<3||o[0]>i||i>p)&&(o[4]=t,o[5]=i,d.n=p,a=0))}if(r||t>1)return l;throw h=!0,i}return function(r,u,p){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&v(u,p),a=u,s=p;(n=a<2?e:s)||!h;){o||(a?a<3?(a>1&&(d.n=-1),v(a,s)):d.n=s:d.v=s);try{if(c=2,o){if(a||(r="next"),n=o[r]){if(!(n=n.call(o,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=o.return)&&n.call(o),a<2&&(s=TypeError("The iterator does not provide a '"+r+"' method"),a=1);o=e}else if((n=(h=d.n<0)?s:t.call(i,d))!==l)break}catch(t){o=e,a=1,s=t}finally{c=1}}return{value:n,done:h}}}(t,o,a),!0),c}var l={};function u(){}function h(){}function d(){}n=Object.getPrototypeOf;var v=[][a]?n(n([][a]())):(i(n={},a,(function(){return this})),n),p=d.prototype=u.prototype=Object.create(v);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,i(t,s,"GeneratorFunction")),t.prototype=Object.create(p),t}return h.prototype=d,i(p,"constructor",d),i(d,"constructor",h),h.displayName="GeneratorFunction",i(d,s,"GeneratorFunction"),i(p),i(p,s,"Generator"),i(p,a,(function(){return this})),i(p,"toString",(function(){return"[object Generator]"})),(t.exports=r=function(){return{w:c,m:f}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},551:(t,e,n)=>{var i=n(756),r=n(466);t.exports=function t(e,n){function o(t,r,a,s){try{var c=e[t](r),l=c.value;return l instanceof i?n.resolve(l.v).then((function(t){o("next",t,a,s)}),(function(t){o("throw",t,a,s)})):n.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return o("throw",t,a,s)}))}catch(t){s(t)}}var a;this.next||(r(t.prototype),r(t.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),r(this,"_invoke",(function(t,e,i){function r(){return new n((function(e,n){o(t,i,e,n)}))}return a=a?a.then(r,r):r()}),!0)},t.exports.__esModule=!0,t.exports.default=t.exports},587:(t,e,n)=>{var i=n(906).default;t.exports=function(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(i(t)+" is not iterable")},t.exports.__esModule=!0,t.exports.default=t.exports},756:t=>{t.exports=function(t,e){this.v=t,this.k=e},t.exports.__esModule=!0,t.exports.default=t.exports},828:(t,e,n)=>{var i=n(17)();t.exports=i;try{regeneratorRuntime=i}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},858:e=>{"use strict";e.exports=t},906:t=>{function e(n){return t.exports=e="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.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},965:(t,e,n)=>{var i=n(95);t.exports=function(t,e,n,r,o){var a=i(t,e,n,r,o);return a.next().then((function(t){return t.done?t.value:a.next()}))},t.exports.__esModule=!0,t.exports.default=t.exports}},i={};function r(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={exports:{}};return n[t](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t){return e="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},e(t)}function n(t){var n=function(t){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(n)?n:n+""}function i(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,n(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function u(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&&l(t,e)}r.r(o),r.d(o,{AngleDimension:()=>Yn,Arrow2d:()=>$n,Axis2d:()=>Zn,Circle2d:()=>_n,Dimension:()=>jn,DrawUtils:()=>Mn,Gizmo2d:()=>ei,Grid2d:()=>di,Image2d:()=>Jn,Line2d:()=>oi,Placement:()=>On,Polygon:()=>Rn,RadiusDimension:()=>Wn,Rect2d:()=>Sn,Text2d:()=>ii});var h=r(47);function d(t,e,i){return(e=n(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function p(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}function f(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||p(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.")}()}var y="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),g=new Array(36);function m(){for(var t=0,e=0;e<36;e++)if(8===e||13===e||18===e||23===e)g[e]="-";else if(14===e)g[e]="7";else{t<=2&&(t=33554432+16777216*Math.random()|0);var n=15&t;t>>=4,g[e]=y[19===e?3&n|8:n]}return g.join("")}var k=function(){function e(n,i){t(this,e),this.fn=n,this.priority=i}return a(e,null,[{key:"createTask",value:function(t,n){return new e(t,n)}}])}();function x(){return"undefined"!=typeof Symbol}var w=/^\[object (?:Object|Array|Map|Set|WeakMap|WeakSet)\]$/;function T(t){return null!==t&&"object"===e(t)}function C(t){return t&&"function"==typeof t.then}function b(t){if(null===t||"object"!==e(t))return!1;var n=Object.getPrototypeOf(t);return n===Object.prototype||null===n}function M(t,e){return t.indexOf(e)>-1}function E(t,e){var n=t.indexOf(e);n>-1&&t.splice(n,1)}function S(t,e){e.forEach((function(e){t.delete(e)}))}var P,_=Promise.resolve();function D(t){return t?_.then(t):_}function R(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function A(t,e){return function(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}}function O(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(R(t,n))return!0;if("object"!==e(t)||null===t||"object"!==e(n)||null===n)return!1;var r=[],o=[];if(i&&i.length>0){var a=new Set(i);r=Object.keys(t).filter((function(t){return!a.has(t)})),o=Object.keys(n).filter((function(t){return!a.has(t)}))}else r=Object.keys(t),o=Object.keys(n);if(r.length!==o.length)return!1;for(var s=0;s<r.length;s++)if(!n.hasOwnProperty(r[s])||!R(t[r[s]],n[r[s]]))return!1;return!0}function L(){return"undefined"!=typeof window?"browser":"vm"}function z(t){var e,n=L();return"browser"===n&&(e=window[t]),"vm"===n&&(e=r.g[t]),e}!function(t){t[t.UserAction=0]="UserAction",t[t.UpdateState=1]="UpdateState",t[t.RenderReact=2]="RenderReact",t[t.RenderScene=-1]="RenderScene"}(P||(P={}));var I=[],H=!1;function U(){var t=function(t,e){for(var n=t.length,i=0;i<n;i++)for(var r=i+1;r<n;r++){var o=t[i],a=t[r],s=e?e(o):o;(e?e(a):a)<s&&(t[i]=a,t[r]=o)}return t}(I,(function(t){return t.priority}));I=[],t.forEach((function(t){(0,t.fn)()})),H=!1}function B(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:P.UserAction,i=!1;function r(){i=!1,t.apply(void 0,f(e))}var o=function(t,e){var n=1e3/e,i=0;return function(){var e=Date.now();if(e-i>=n){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];t.apply(this,o),i=e}}}((function(){for(var t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];e=o,i||(i=!0,I.push(k.createTask(r,n)),H||(H=!0,D(U)))}),arguments.length>2&&void 0!==arguments[2]?arguments[2]:60);return o}function F(t,e,n,i,r,o,a){try{var s=t[o](a),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(i,r)}function N(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){F(o,i,r,a,s,"next",t)}function s(t){F(o,i,r,a,s,"throw",t)}a(void 0)}))}}var V=r(828),j=r.n(V),G=r(858);function W(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"turbox";return t.includes(";base64,")||!t?t:function(t,e,n){var i=new RegExp("([?&])".concat(e,"=.*?(&|$)"),"i"),r=-1!==t.indexOf("?")?"&":"?";return t.match(i)?t.replace(i,"$1".concat(e,"=").concat(n,"$2")):"".concat(t).concat(r).concat(e,"=").concat(n)}(t,e,"true")}function X(t,e){return Y.apply(this,arguments)}function Y(){return Y=N(j().mark((function t(e,n){var i,r,o,a=arguments;return j().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=a.length>2&&void 0!==a[2]?a[2]:"image/png",r=a.length>3&&void 0!==a[3]?a[3]:1,(o=new Image).setAttribute("crossOrigin","anonymous"),e instanceof HTMLImageElement?o.src=e.src:o.src=e instanceof Blob?URL.createObjectURL(e):W(e),t.abrupt("return",new Promise((function(t){o.onload=function(){e instanceof Blob&&URL.revokeObjectURL(o.src);var a=document.createElement("canvas"),s=a.getContext("2d");a.width=n.end.x-n.start.x,a.height=n.end.y-n.start.y,s.drawImage(o,n.start.x,n.start.y,a.width,a.height,0,0,a.width,a.height),a.toBlob((function(e){if(e){var n=URL.createObjectURL(e),i=new Image;i.onload=function(){URL.revokeObjectURL(n),t({blob:e,element:i,width:a.width,height:a.height})},i.src=n}else t({blob:null,width:0,height:0})}),i,r)}})));case 6:case"end":return t.stop()}}),t)}))),Y.apply(this,arguments)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,r=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}}(t,e)||p(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(t,e){var n={x:t.x-e.x,y:t.y-e.y};if(!(n.x<=0||n.y<=0||n.x>e.width||n.y>e.height))return n}function $(t,e){if(!t)throw new Error("[turbox]: ".concat(e||"An invariant failed, however the error is obfuscated because this is an production build."))}function K(t){throw $(!1,t),"X"}function Q(t){console.warn("[turbox]: ".concat(t))}function J(t){return t&&"object"===e(t)&&"[object RegExp]"!==Object.prototype.toString.call(t)&&"[object Date]"!==Object.prototype.toString.call(t)}function tt(t,e){var n;return e&&!0===e.clone&&J(t)?nt((n=t,Array.isArray(n)?[]:{}),t,e):t}function et(t,e,n){var i=t.slice();return e.forEach((function(e,r){void 0===i[r]?i[r]=tt(e,n):J(e)?i[r]=nt(t[r],e,n):-1===t.indexOf(e)&&i.push(tt(e,n))})),i}function nt(t,e,n){var i=Array.isArray(e),r=(n||{arrayMerge:et}).arrayMerge||et;return i?Array.isArray(t)?r(t,e,n):tt(e,n):function(t,e,n){var i={};return J(t)&&Object.keys(t).forEach((function(e){i[e]=tt(t[e],n)})),Object.keys(e).forEach((function(r){J(e[r])&&t[r]?i[r]=nt(t[r],e[r],n):i[r]=tt(e[r],n)})),i}(t,e,n)}new(function(){return a((function e(){t(this,e),this.listeners={}}),[{key:"on",value:function(t,e){var n=this.listeners[t]||[];n.push(e),this.listeners[t]=n}},{key:"emit",value:function(t){for(var e=this,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var o=this.listeners[t];Array.isArray(o)&&o.forEach((function(t){try{t.apply(e,i)}catch(t){console.error(t)}}))}},{key:"off",value:function(t){this.listeners[t]&&(this.listeners[t]=[])}}])}());function it(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce((function(t,e){return function(){return t(e.apply(void 0,arguments))}}))}Date.now;var rt="@@TURBOX__";function ot(t){return x()?Symbol(t):"".concat(rt).concat(t)}var at,st,ct,lt,ut,ht,dt,vt,pt=ot("namespace"),ft=(ot("reactive-component-name"),ot("unsubscribe-handler"),"".concat(rt,"materialType")),yt="".concat(rt,"empty"),gt=("".concat(rt,"field"),!1),mt={middleware:{logger:gt,diffLogger:!0,effect:!1,perf:gt,skipNestLog:!0,skipNestPerfLog:!0},timeTravel:{isActive:!1,isNeedRecord:!1,maxStepNumber:20,keepActionChain:gt},disableReactive:!1,strictMode:gt,devTool:!1,batchUpdateOnFinish:void 0};!function(t){t.NOT_OBSERVED="notObserved",t.OBSERVED="observed",t.LATEST="latest"}(at||(at={})),(vt=st||(st={})).ARRAY_LENGTH="length",vt.ITERATE="iterate",vt.COMPUTED="computed",(dt=ct||(ct={})).SET="set",dt.MAP_SET="map-set",dt.ADD="add",dt.SET_ADD="set-add",dt.DELETE="delete",dt.MAP_DELETE="map-delete",dt.SET_DELETE="set-delete",(ht=lt||(lt={})).DEFAULT="default",ht.MUTATION="mutation",ht.ACTION="action",ht.UPDATE="update",ht.EFFECT="effect",ht.UNDO="undo",ht.REDO="redo",function(t){t.WORKING="working",t.COMPLETED="completed",t.ABORT="abort"}(ut||(ut={}));var kt=function(){function e(){t(this,e),this.currentHistory=new Map,this.transactionHistories=[],this.cursor=-1}return a(e,[{key:"undoable",get:function(){return this.cursor>=0}},{key:"redoable",get:function(){return this.cursor<this.transactionHistories.length-1}},{key:"onChange",value:function(t,e,n,i){}},{key:"undo",value:function(){var t=this;if(this.undoable){var n=this.transactionHistories[this.cursor];Ot||K("store is not ready, please init first.");var i=n.actionChain[0]||{name:"",displayName:""};Ot.dispatch({name:"".concat(rt,"UNDO_").concat(i.name),displayName:"UNDO_".concat(i.displayName),payload:[],original:function(){e.undoHandler(n.history)},type:lt.UNDO,isInner:!0}),this.cursor-=1,D((function(){t.onChange(t.undoable,t.redoable,"undo")}))}}},{key:"redo",value:function(){var t=this;if(this.redoable){this.cursor+=1;var n=this.transactionHistories[this.cursor];Ot||K("store is not ready, please init first.");var i=n.actionChain[0]||{name:"",displayName:""};Ot.dispatch({name:"".concat(rt,"REDO_").concat(i.name),displayName:"REDO_".concat(i.displayName),payload:[],original:function(){e.redoHandler(n.history)},type:lt.REDO,isInner:!0}),D((function(){t.onChange(t.undoable,t.redoable,"redo")}))}}},{key:"clear",value:function(){var t=this;this.currentHistory=new Map,this.transactionHistories.length=0,this.cursor=-1,D((function(){t.onChange(t.undoable,t.redoable,"clear")}))}}],[{key:"undoable",get:function(){return e.currentTimeTravel&&e.currentTimeTravel.undoable}},{key:"redoable",get:function(){return e.currentTimeTravel&&e.currentTimeTravel.redoable}},{key:"undoHandler",value:function(t){t.forEach((function(t,e){t&&t.forEach((function(t,n){t&&t.beforeUpdate!==t.didUpdate&&(t.type===ct.MAP_SET||t.type===ct.MAP_DELETE?void 0===t.beforeUpdate?e.delete(n):e.set(n,t.beforeUpdate):t.type===ct.SET_ADD?e.delete(n):t.type===ct.SET_DELETE?e.add(n):Array.isArray(e)&&void 0===t.beforeUpdate?delete e[n]:e[n]=t.beforeUpdate)}))}))}},{key:"redoHandler",value:function(t){t.forEach((function(t,e){t&&t.forEach((function(t,n){t&&t.beforeUpdate!==t.didUpdate&&(t.type===ct.MAP_SET?e.set(n,t.didUpdate):t.type===ct.SET_ADD?e.add(n):t.type===ct.SET_DELETE||t.type===ct.MAP_DELETE?e.delete(n):e[n]=t.didUpdate)}))}))}}])}();kt.timeTravels={},kt.processing=!1,kt.switch=function(t){kt.currentTimeTravel=kt.get(t)},kt.create=function(t){var e=new kt;return kt.timeTravels[t]=e,e},kt.get=function(t){return kt.timeTravels[t]},kt.pause=function(){mt.timeTravel.isActive=!1},kt.resume=function(){mt.timeTravel.isActive=!0},kt.undo=function(){kt.currentTimeTravel&&kt.currentTimeTravel.undo()},kt.redo=function(){kt.currentTimeTravel&&kt.currentTimeTravel.redo()},kt.clear=function(){kt.currentTimeTravel&&kt.currentTimeTravel.clear()};var xt,wt={freeze:!1};!function(t){t.storeOnActive="storeOnActive",t.beforeStoreChange="beforeStoreChange",t.afterStoreChange="afterStoreChange",t.asyncAfterStoreChange="asyncAfterStoreChange",t.setProperty="setProperty",t.materialCallStackChange="materialCallStackChange"}(xt||(xt={}));var Tt=new(function(){return a((function e(){t(this,e),this.listeners={}}),[{key:"on",value:function(t,e){var n=this.listeners[t]||[];n.push(e),this.listeners[t]=n}},{key:"emit",value:function(t,e){var n=this;mt.devTool&&window&&window.__TURBOX_DEVTOOL_GLOBAL_HOOKS__&&window.__TURBOX_DEVTOOL_GLOBAL_HOOKS__.emit(t,e);var i=this.listeners[t];Array.isArray(i)&&i.forEach((function(t){try{t.apply(n,[e])}catch(t){K(t)}}))}},{key:"off",value:function(t){this.listeners[t]&&(this.listeners[t]=[])}}])}()),Ct=function(){return a((function e(n,i,r,o,a,s){t(this,e),this.name=n,this.runner=i,this.computed=r,this.lazy=o,this.deps=a,this.immediately=s}),[{key:"dispose",value:function(){void 0!==this.unsubscribeHandler&&this.unsubscribeHandler(),Bt.clear(this)}}])}();function bt(t,e){var n=e&&e.name||t.name||"".concat(rt,"REACTIVE_").concat(m()),i=!(!e||void 0===e.lazy)&&e.lazy,r=e&&e.deps||[],o=!e||void 0===e.immediately||e.immediately,a=!0,s=new Ct(n,(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{if(Bt.start(s),s.deps.length>0){var n=[];s.deps.forEach((function(t){var e=t();n.push(e)})),Bt.end(),!a&&t.call.apply(t,[null].concat(n))}else t.call(null),Bt.end();a&&(a=!1)}catch(t){if(Bt.end(),a&&(a=!1),!e)throw t}}),!(!e||!e.computed),i,r,o),c=function(){s.unsubscribeHandler=Ot.subscribe((function(t){s.runner(t)}),s),s.runner()};return Ot?c():Tt.on(xt.storeOnActive,(function(){c()})),s}function Mt(t,e){return bt(t,e)}function Et(t,n,i,r){var o,a="symbol"!==e(o=n)?o.toString():o.toString()+m(),s=function(){var e=this;t||(e=new Ut),Ot||K("store is not ready, please init first.");for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];var c=Ot.dispatch({name:a,displayName:r.displayName||yt,payload:o,type:lt.MUTATION,domain:e,original:A(i,e),immediately:!!r.immediately,forceSaveHistory:!!r.forceSaveHistory,isNeedRecord:!!r.isNeedRecord});if(C(c))return new Promise((function(t,e){c.then((function(e){t(e)}),(function(t){e(t)}))}));if(c&&c instanceof Error)throw c;return c};return s[ft]=lt.MUTATION,s}function St(){for(var t={immediately:!1,displayName:"",forceSaveHistory:!1,isNeedRecord:!0},e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if("string"==typeof n[0]&&"function"==typeof n[1]){void 0!==n[2]&&(t.displayName=n[2].displayName,t.immediately=n[2].immediately,t.forceSaveHistory=!!n[2].forceSaveHistory,t.isNeedRecord=!!n[2].isNeedRecord);var r=n[0],o=n[1];return o[ft]===lt.MUTATION?o:Et(void 0,r,o,t)}var a=function(e,n,i){var r;if(void 0===i)return Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:function(){return r},set:function(i){r=i[ft]===lt.MUTATION?i:Et(e,n,i,t)}});if(void 0!==i.value){var o=i.value;return o[ft]===lt.MUTATION?i.value=o:i.value=Et(e,n,o,t),i}var a=i.initializer;return i.initializer=function(){$(!!a,"The initializer of the descriptor doesn't exist, please compile it by using babel and correspond decorator plugin.");var i=a&&a.call(this);return i[ft]===lt.MUTATION?i:Et(e,n,i,t)},i};return function(t){return(2===t.length||3===t.length)&&"string"==typeof t[1]}(n)?a.apply(null,n):(t.displayName=n[0]||"",t.immediately=void 0!==n[1]&&n[1],t.forceSaveHistory=void 0!==n[2]&&n[2],t.isNeedRecord=void 0===n[3]||n[3],a)}function Pt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function _t(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Pt(Object(n),!0).forEach((function(e){d(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Dt,Rt=new(function(){return a((function e(){t(this,e),this.stack=[],this.pendingToPopStack=[],this.stackId=0}),[{key:"push",value:function(t){this.stackId+=1;var e=_t(_t({},t),{},{stackId:this.stackId});return this.currentStack=e,this.stack.push(e),mt.devTool&&Tt.emit(xt.materialCallStackChange,{stack:f(this.stack),action:"PUSH",time:Date.now(),currentStack:e}),this.stackId}},{key:"pop",value:function(t){var e;if(0!==this.stack.length){if(this.stack[this.stack.length-1].stackId!==t)this.pendingToPopStack.unshift(t);else{this.currentStack=void 0;var n=this.stack.pop();mt.devTool&&Tt.emit(xt.materialCallStackChange,{stack:f(this.stack),action:"POP",time:Date.now(),currentStack:n})}for(var i=f(this.pendingToPopStack),r=0;r<this.pendingToPopStack.length;r+=1){var o=this.pendingToPopStack[r];if((null===(e=this.stack[this.stack.length-1])||void 0===e?void 0:e.stackId)!==o)break;var a=this.stack.pop();i.splice(r,1),this.currentStack=this.stack[this.stack.length-1],mt.devTool&&Tt.emit(xt.materialCallStackChange,{stack:f(this.stack),action:"POP",time:Date.now(),currentStack:a})}this.pendingToPopStack=i,0===this.pendingToPopStack.length&&(this.currentStack=void 0)}}}])}());function At(t){return t instanceof Ut}!function(t){t.property="property",t.index="index"}(Dt||(Dt={}));var Ot,Lt=new WeakMap,zt=new WeakMap,It=new WeakMap,Ht=[Map,Set,WeakMap,WeakSet],Ut=function(){return a((function e(){var n=this;t(this,e),this.$$turboxProperties={},this.reactorConfigMap={},this.computedProperties={},this.getCollectionHandlerMap=function(t,e){return d(d(d(d(d({get size(){var n=Reflect.getPrototypeOf(t);return Bt.collect(t,st.ITERATE),Reflect.get(n,e,t)},get:function(e){var n=Reflect.getPrototypeOf(t).get;return Bt.collect(t,e),n.call(t,e)},has:function(e){var n=Reflect.getPrototypeOf(t).has;return Bt.collect(t,e),n.call(t,e)},forEach:function(e){var n=Reflect.getPrototypeOf(t).forEach;return Bt.collect(t,st.ITERATE),n.call(t,e)},values:function(){var e=Reflect.getPrototypeOf(t).values;return Bt.collect(t,st.ITERATE),e.call(t)},keys:function(){var e=Reflect.getPrototypeOf(t).keys;return Bt.collect(t,st.ITERATE),e.call(t)},entries:function(){var e=Reflect.getPrototypeOf(t).entries;return Bt.collect(t,st.ITERATE),e.call(t)}},Symbol.iterator,(function(){return t.constructor===Set?n.getCollectionHandlerMap(t,"values").values():t.constructor===Map?n.getCollectionHandlerMap(t,"entries").entries():void 0})),"add",(function(e){var i=Reflect.getPrototypeOf(t),r=i.add,o=i.has,a=It.get(t),s=a[0].value;return o.call(t,e)||(Ft.trigger(t,e,{type:ct.SET_ADD,beforeUpdate:void 0,didUpdate:e},n.reactorConfigMap[s].isNeedRecord,{keyPath:a,domain:n.constructor.name}),Ft.trigger(t,st.ITERATE,{type:ct.SET_ADD},n.reactorConfigMap[s].isNeedRecord)),r.call(t,e)})),"set",(function(e,i){var r=Reflect.getPrototypeOf(t),o=r.set,a=r.get,s=r.has,c=It.get(t),l=c[0].value,u=s.call(t,e),h=a.call(t,e);return i!==h&&Ft.trigger(t,e,{type:ct.MAP_SET,beforeUpdate:h,didUpdate:i},n.reactorConfigMap[l].isNeedRecord,{keyPath:c,domain:n.constructor.name}),u||Ft.trigger(t,st.ITERATE,{type:ct.MAP_SET},n.reactorConfigMap[l].isNeedRecord),o.call(t,e,i)})),"delete",(function(e){var i=Reflect.getPrototypeOf(t),r=It.get(t),o=r[0].value;if(!i.has.call(t,e))return i.delete.call(t,e);if(i.constructor===Map||i.constructor===WeakMap){var a=i.get.call(t,e);Ft.trigger(t,e,{type:ct.MAP_DELETE,beforeUpdate:a},n.reactorConfigMap[o].isNeedRecord,{keyPath:r,domain:n.constructor.name}),Ft.trigger(t,st.ITERATE,{type:ct.MAP_DELETE},n.reactorConfigMap[o].isNeedRecord)}return i.constructor!==Set&&i.constructor!==WeakSet||(Ft.trigger(t,e,{type:ct.SET_DELETE,beforeUpdate:e},n.reactorConfigMap[o].isNeedRecord,{keyPath:r,domain:n.constructor.name}),Ft.trigger(t,st.ITERATE,{type:ct.SET_DELETE},n.reactorConfigMap[o].isNeedRecord)),i.delete.call(t,e)})),"clear",(function(){var e=Reflect.getPrototypeOf(t),i=e.clear;return e.forEach.call(t,(function(e,i){n.getCollectionHandlerMap(t,i).delete(i)})),i.call(t)}))};var i=Object.getPrototypeOf(this).constructor.name||"TURBOX_DOMAIN",r="".concat(i,"_").concat(m());this[pt]=r,this.context=this.initDomainContext()}),[{key:"initDomainContext",value:function(){return{isNeedRecord:mt.timeTravel.isNeedRecord}}},{key:"propertyGet",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,r=t in this.$$turboxProperties,o=n&&!r,a=o?i:this.$$turboxProperties[t];o&&this.propertySet(t,a,e);var s=Object.assign({},{isNeedRecord:this.context.isNeedRecord},e);return this.reactorConfigMap[t]=s,Bt.collect(this,t),T(a)&&!At(a)&&s.deepProxy?this.proxyReactive(a,[{type:Dt.property,value:t}]):a}},{key:"propertySet",value:function(t,e,n){mt.strictMode&&this.illegalAssignmentCheck(this,t);var i=this.$$turboxProperties[t],r=Object.assign({},{isNeedRecord:this.context.isNeedRecord},n);this.reactorConfigMap[t]=r,i!==e&&(this.$$turboxProperties[t]=e,Ft.trigger(this,t,{type:ct.SET,beforeUpdate:i,didUpdate:e},r.isNeedRecord,{keyPath:[{type:Dt.property,value:t}],domain:this.constructor.name}))}},{key:"computedPropertyGet",value:function(t,e,n){var i=this;this.computedProperties[t]||(this.computedProperties[t]={dirty:!0,needReComputed:!1,needTrigger:!1});var r=this.computedProperties[t],o=!(!e||void 0===e.lazy)&&e.lazy;if(r.reaction||(r.reaction=bt((function(){r.dirty=!0,r.needReComputed&&(r.value=r.computeRunner()),r.needTrigger&&Ft.trigger(i,t,{type:ct.SET,beforeUpdate:void 0,didUpdate:void 0},!1)}),{name:t,computed:!0,lazy:o})),!r.computeRunner&&n&&(r.computeRunner=A(n.get,this)),r.dirty){r.needReComputed=!0,r.needTrigger=!1;try{r.reaction.runner()}finally{r.dirty=!1,r.needReComputed=!1,r.needTrigger=!0}}return Bt.collect(this,t),r.value}},{key:"computedPropertySet",value:function(t,e){this.computedProperties[t]||(this.computedProperties[t]={dirty:!0,needReComputed:!1,needTrigger:!1}),this.computedProperties[t].computeRunner||(this.computedProperties[t].computeRunner=A(e,this))}},{key:"$update",value:function(t,e,n,i,r,o){$(b(t),"resetState(...) param type error. Param should be a plain object."),this.dispatch(t,e,n,i,r,o)}},{key:"proxySet",value:function(t,e,n,i){Array.isArray(t)&&t!==this.currentTarget&&(this.currentTarget=t,this.originalArrayLength=t[st.ARRAY_LENGTH]),mt.strictMode&&this.illegalAssignmentCheck(t,e);var r=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e),o=t[e],a=It.get(t)[0].value;return t===Lt.get(i)&&(e!==st.ARRAY_LENGTH&&n===o||(Ft.trigger(t,e,{type:ct.SET,beforeUpdate:e===st.ARRAY_LENGTH?this.originalArrayLength:o,didUpdate:n},this.reactorConfigMap[a].isNeedRecord,{keyPath:[{type:Dt.property,value:e}],domain:this.constructor.name}),e===st.ARRAY_LENGTH&&(this.currentTarget=void 0,this.originalArrayLength=void 0)),r||Ft.trigger(t,e,{type:ct.ADD,beforeUpdate:o,didUpdate:n},this.reactorConfigMap[a].isNeedRecord,{keyPath:[{type:Dt.property,value:e}],domain:this.constructor.name}),Reflect.set(t,e,n,i))}},{key:"proxyGet",value:function(t,e,n){var i=this,r=Reflect.get(t,e,n),o=It.get(t),a=o[0].value;return Bt.collect(t,e),this.reactorConfigMap[a].callback&&!wt.freeze&&(wt.freeze=!0,i.reactorConfigMap[a].callback&&i.reactorConfigMap[a].callback.call(i,t,e),wt.freeze=!1),T(r)&&!At(r)?this.proxyReactive(r,[].concat(f(o),[{type:Array.isArray(t)?Dt.index:Dt.property,value:e}])):r}},{key:"proxyDeleteProperty",value:function(t,e){var n=It.get(t)[0].value,i=t[e];return Ft.trigger(t,e,{type:ct.DELETE,beforeUpdate:i,didUpdate:void 0},this.reactorConfigMap[n].isNeedRecord,{keyPath:[{type:Dt.property,value:e}],domain:this.constructor.name}),Reflect.deleteProperty(t,e)}},{key:"proxyOwnKeys",value:function(t){return Bt.collect(t,st.ITERATE),Reflect.ownKeys(t)}},{key:"proxyReactive",value:function(t,e){var n=this;It.set(t,e);var i,r=zt.get(t);if(void 0!==r)return r;if(Lt.has(t))return t;if(i=t,!w.test(function(t){return Object.prototype.toString.call(t)}(i)))return t;var o=M(Ht,t.constructor)?{get:A(n.collectionProxyHandler,n)}:{get:A(n.proxyGet,n),set:A(n.proxySet,n),ownKeys:A(n.proxyOwnKeys,n),deleteProperty:A(n.proxyDeleteProperty,n)},a=new Proxy(t,o);return Lt.set(a,t),zt.set(t,a),a}},{key:"collectionProxyHandler",value:function(t,e){var n=this.getCollectionHandlerMap(t,e),i=e in t&&n[e]?n:t;return Reflect.get(i,e)}},{key:"illegalAssignmentCheck",value:function(t,e){if(Bt.isObserved(t,e)){var n=Rt.stack.length,i=Rt.stack[n-1]||lt.DEFAULT;$(i.type===lt.MUTATION||i.type===lt.UPDATE||i.type===lt.UNDO||i.type===lt.REDO,"You cannot update value to observed '@reactor property' directly. Please use mutation or $update({}).")}}},{key:"dispatch",value:function(t,e,n,i,r,o){var a=function(){for(var e=Object.keys(t),n=0,i=e.length;n<i;n++){var r=e[n];this[r]=t[r]}};if(void 0===Ot)return a.call(this),void Rt.pop(-1);Ot.dispatch({name:e||"".concat(rt,"UPDATE"),displayName:n||yt,payload:[],type:lt.UPDATE,domain:this,original:A(a,this),forceSaveHistory:i,isNeedRecord:r,immediately:o})}}])}(),Bt=new(function(){return a((function e(){t(this,e),this.dependencyGraph=new Map,this.reactionIdDeps=new Map,this.reactionIdStack=[]}),[{key:"start",value:function(t){this.reactionIdStack.push(t)}},{key:"collect",value:function(t,e){if(!{constructor:!0,$$turboxProperties:!0,context:!0,currentTarget:!0,originalArrayLength:!0,reactorConfigMap:!0,computedProperties:!0,propertyGet:!0,propertySet:!0,proxyDeleteProperty:!0,proxyOwnKeys:!0,proxySet:!0,proxyGet:!0,proxyReactive:!0,$update:!0,illegalAssignmentCheck:!0,dispatch:!0}[e]){var n=this.reactionIdStack.length;if(0!==n){var i=this.reactionIdStack[n-1],r=this.dependencyGraph.get(t);if(void 0!==r){var o=r.get(e);void 0!==o?o.add(i):r.set(e,new Set([i]))}else{var a=new Map([[e,new Set([i])]]);this.dependencyGraph.set(t,a)}var s=this.reactionIdDeps.get(i);if(void 0!==s){var c=s.get(t);void 0!==c?c.set(e,at.LATEST):s.set(t,new Map([[e,at.LATEST]]))}else this.reactionIdDeps.set(i,new Map([[t,new Map([[e,at.LATEST]])]]))}}}},{key:"end",value:function(){var t=this,e=this.reactionIdStack.pop();if(e){var n=this.reactionIdDeps.get(e);n&&n.forEach((function(n,i){n.forEach((function(r,o){if(r===at.OBSERVED){var a=t.dependencyGraph.get(i);if(a){var s=a.get(o);s&&s.delete(e),n.set(o,at.NOT_OBSERVED)}}r===at.LATEST&&n.set(o,at.OBSERVED)}))}))}}},{key:"clear",value:function(t){var e=this,n=this.reactionIdDeps.get(t);n&&(n.forEach((function(n,i){n.forEach((function(n,r){var o=e.dependencyGraph.get(i);if(o){var a=o.get(r);a&&a.delete(t)}}))})),this.reactionIdDeps.delete(t))}},{key:"isObserved",value:function(t,e){var n=this.dependencyGraph.get(t);return void 0!==n&&n.has(e)&&(n.get(e)||new Set).size>0}}])}()),Ft=new(function(){return a((function e(){t(this,e),this.waitTriggerIds=new Set}),[{key:"trigger",value:function(t,e,n){var i,r,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4?arguments[4]:void 0,s=n.type,c=n.beforeUpdate,l=n.didUpdate;if(mt.devTool&&a)try{var u=null!==(i=window&&window.__TURBOX_DEVTOOL_GOLBAL_STRINGIFY__)&&void 0!==i?i:JSON.stringify,h={time:Date.now(),stackId:null===(r=Rt.currentStack)||void 0===r?void 0:r.stackId,domain:a.domain,keyPath:a.keyPath,newValue:u(l),oldValue:u(c),type:s};Tt.emit(xt.setProperty,h),console.log(h)}catch(t){K(t)}var d=s===ct.ADD?st.ITERATE:e;this.collectComponentId(t,d),mt.timeTravel.isActive&&kt.currentTimeTravel&&o&&!kt.processing&&d!==st.ITERATE&&d!==st.COMPUTED&&(Wt.context?this.recordDiff(t,d,n,Wt.context.historyNode.history):this.recordDiff(t,d,n,kt.currentTimeTravel.currentHistory))}},{key:"endBatch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if(e||this.waitTriggerIds.clear(),mt.timeTravel.isActive&&kt.currentTimeTravel&&t){if(e)return e.historyNode.actionChain.length=0,e.historyNode.history.clear(),void D((function(){var t=kt.currentTimeTravel;t&&t.onChange(t.undoable,t.redoable,"clear",e)}));Nt.length=0,kt.currentTimeTravel.currentHistory.clear()}}},{key:"save",value:function(t){if(mt.timeTravel.isActive&&kt.currentTimeTravel&&!Wt.context){var e=kt.currentTimeTravel;t?this.saveHistory(e,t.historyNode.actionChain,t.historyNode.history,t):this.saveHistory(e,Nt,e.currentHistory)}}},{key:"collectComponentId",value:function(t,e){var n=this,i=Bt.dependencyGraph.get(t);if(void 0!==i){var r=i.get(e);void 0!==r&&r.size>0&&r.forEach((function(t){return n.waitTriggerIds.add(t)}))}}},{key:"recordDiff",value:function(t,e,n,i){var r,o=n.type,a=n.beforeUpdate,s=n.didUpdate;if(r=At(t)?t:zt.get(t)){var c=i.get(r);if(void 0!==c){var l=c.get(e);void 0!==l?l.didUpdate=s:c.set(e,{type:o,beforeUpdate:a,didUpdate:s})}else i.set(r,new Map([[e,{type:o,beforeUpdate:a,didUpdate:s}]]))}}},{key:"saveHistory",value:function(t,e,n,i){if(n&&0!==n.size){var r=mt.timeTravel.keepActionChain?e.slice():[],o=new Map(n);t.cursor===t.transactionHistories.length-1?(t.transactionHistories.push({actionChain:r,history:o}),t.cursor+=1):t.cursor<t.transactionHistories.length-1&&(t.transactionHistories=t.transactionHistories.slice(0,t.cursor+1),t.transactionHistories.push({actionChain:r,history:o}),t.cursor+=1),t.transactionHistories.length>mt.timeTravel.maxStepNumber&&(t.transactionHistories.shift(),t.cursor-=1),D((function(){t.onChange(t.undoable,t.redoable,"save",i)}))}}}])}()),Nt=[],Vt=[];function jt(t){if(void 0!==t)return Ot=t(jt);var e,n=new WeakMap,i=0,r=!1,o=function(t,e,i){if(t.length&&!mt.disableReactive){for(var r=[],o=0;o<t.length;o++){var a=t[o],s=n.get(a);s&&r.push(s)}var c=function(t){return function(){for(var e=0;e<r.length;e++){var n=r[e];if(n.idCustomType===t)for(var o=n.listeners,a=0;a<o.length;a++)(0,o[a])(i)}}};e?Vt.forEach((function(t){(0,t.handler)(c(t.idCustomType),(function(){mt.batchUpdateOnFinish&&mt.batchUpdateOnFinish()}))})):c()()}},a=function(t){var e=f(Ft.waitTriggerIds.values()).filter((function(t){return t instanceof Ct&&!t.lazy&&t.computed}));e.length&&(mt.devTool&&console.log("keepAlive computed",e),o(e,!1,t),S(Ft.waitTriggerIds,e))},s=function(t){var e=f(Ft.waitTriggerIds.values()).filter((function(t){return t instanceof Ct&&!t.computed&&t.immediately}));e.length&&(S(Ft.waitTriggerIds,e),mt.devTool&&console.log("immediately reactive",e),o(e,!1,t))},c=[],l=function(){if(!r){r=!0;var t=function(){D((function(){if(i>0)return r=!1,void c.shift();0!==c.length&&e&&e()}))};c.push(t),t()}},u=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];r=!1,e=void 0,c.shift(),Nt.length=0,t&&Ft.endBatch()};return{dispatch:function(t){var n,r,c,h,d=t.payload,v=t.type,p=t.original,y=t.immediately,g=t.isInner,m=void 0!==g&&g,k=t.domain,x=t.name,w=t.forceSaveHistory,T=void 0!==w&&w,b=t.isNeedRecord,M=void 0===b||b;m&&(kt.processing=!0);var E=Rt.push({type:v,method:x,domain:null==k?void 0:k.constructor.name});if(m||v===lt.MUTATION||v===lt.UPDATE){var S;if(i+=1,(m||y&&Ft.waitTriggerIds.size>0)&&e&&e(),void 0===e&&(e=function(){var t=f(Ft.waitTriggerIds.values());if(t.length||T){!m&&M&&Ft.save();var e=t.filter((function(t){return t instanceof Ct&&t.lazy&&t.computed}));mt.devTool&&console.log("lazy computed",e),o(e,!1,m);var n=f(Ft.waitTriggerIds.values()).filter((function(t){return t instanceof Ct&&!t.computed&&!t.immediately})),i=f(Ft.waitTriggerIds.values()).filter((function(t){return!(t instanceof Ct)}));u(),mt.devTool&&console.log("lazy reactive",n),o(n,!1,m),mt.devTool&&console.log("custom view Reactive",i),o(i,!0,m)}else u(!1)}),mt.devTool){var P={domain:null!==(n=null==k?void 0:k.constructor.name)&&void 0!==n?n:"UNKNOWN",method:x,args:d,state:null==k?void 0:k.$$turboxProperties,time:Date.now(),stackId:null===(r=Rt.currentStack)||void 0===r?void 0:r.stackId};Tt.emit(xt.beforeStoreChange,P)}try{S=p.apply(void 0,f(d))}catch(t){return t}if(mt.devTool){var _={domain:null!==(c=null==k?void 0:k.constructor.name)&&void 0!==c?c:"UNKNOWN",method:x,args:d,state:null==k?void 0:k.$$turboxProperties,async:!1,time:Date.now(),stackId:null===(h=Rt.currentStack)||void 0===h?void 0:h.stackId};Tt.emit(xt.afterStoreChange,_)}return C(S)?(Rt.pop(E),new Promise((function(t,n){var r;Promise.resolve().then((function(){r=Rt.push({type:v,method:x,domain:null==k?void 0:k.constructor.name,syncStackId:E})})),S.then((function(n){var o,c;mt.devTool&&Tt.emit(xt.asyncAfterStoreChange,{domain:null!==(o=null==k?void 0:k.constructor.name)&&void 0!==o?o:"UNKNOWN",method:x,args:d,state:null==k?void 0:k.$$turboxProperties,async:!0,time:Date.now(),stackId:null===(c=Rt.currentStack)||void 0===c?void 0:c.stackId}),a(m),s(m),i-=1,y?e&&e():l(),Rt.pop(r),t(n)})).catch((function(t){n(t)}))}))):(a(m),s(m),i-=1,m||y?(e&&e(),kt.processing=!1):l(),Rt.pop(E),S)}},subscribe:function(t,e,i){var r=!0,o=n.get(e);return void 0===o||void 0===o.listeners?n.set(e,{idCustomType:i,listeners:[t]}):M(o.listeners,t)||n.set(e,{idCustomType:i,listeners:o.listeners.concat(t)}),function(){r&&(r=!1,n.has(e)&&n.delete(e))}}}}var Gt=[],Wt=function(){function e(){t(this,e),this.displayName=yt,this.status=ut.WORKING,this.historyNode={actionChain:[],history:new Map}}return a(e,[{key:"execute",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0;if(this.status!==ut.ABORT){e.context=this;var o=(i?St(this.name,t,r):t).apply(void 0,f(n));if(C(o))return o.then((function(){e.context=void 0}),(function(){e.context=void 0}));e.context=void 0}}},{key:"complete",value:function(){this.status!==ut.ABORT&&(this.status=ut.COMPLETED,Ft.save(this),Ft.endBatch(!0,this),E(Gt,this))}},{key:"undo",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Ot||K("store is not ready, please init first.");var n=this.historyNode.actionChain[0]||{name:"",displayName:""};Ot.dispatch({name:"".concat(rt,"UNDO_").concat(n.name),displayName:"UNDO_".concat(n.displayName),payload:[],original:function(){kt.undoHandler(t.historyNode.history)},type:lt.UNDO,isInner:!0}),e||(this.historyNode={actionChain:[],history:new Map},D((function(){var e=kt.currentTimeTravel;e&&e.onChange(e.undoable,e.redoable,"undo",t)})))}},{key:"redo",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Ot||K("store is not ready, please init first.");var n=this.historyNode.actionChain[0]||{name:"",displayName:""};Ot.dispatch({name:"".concat(rt,"REDO_").concat(n.name),displayName:"REDO_".concat(n.displayName),payload:[],original:function(){kt.redoHandler(t.historyNode.history)},type:lt.REDO,isInner:!0}),e||(this.historyNode={actionChain:[],history:new Map},D((function(){var e=kt.currentTimeTravel;e&&e.onChange(e.undoable,e.redoable,"redo",t)})))}},{key:"abort",value:function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.undo(),this.status=ut.ABORT,Ft.endBatch(!0,this),E(Gt,this)}}],[{key:"create",value:function(t,n){var i=new e;return i.name=t,n&&(i.displayName=n),i.historyNode.actionChain.push({name:t,displayName:i.displayName}),Gt.push(i),i}},{key:"abortAll",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];Gt.forEach((function(e){e.abort(t)}))}},{key:"get",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length?1===e.length?Gt.filter((function(t){return t.name===e[0]})):Gt.filter((function(t){return M(e,t.name)})):Gt}}])}();function Xt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Yt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Xt(Object(n),!0).forEach((function(e){d(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var qt=[];function Zt(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Array.isArray(t)?t:[t];e?qt.unshift.apply(qt,f(n)):qt.push.apply(qt,f(n))}function $t(t,e,n,i){var r=t(e);return C(r)?new Promise((function(t,e){r.then((function(e){n&&n(),t(e)})).catch((function(t){i&&i(t.stack||t.message),e(t)}))})):(r&&r instanceof Error?i&&i(r.stack||r.message):n&&n(),r)}const Kt=function(){return function(t){return function(e){var n=e.name,i=e.displayName,r=e.type;return e.isInner||r!==lt.MUTATION&&r!==lt.UPDATE||(Wt.context?Wt.context.historyNode.actionChain.push({name:n,displayName:i}):Nt.push({name:n,displayName:i})),$t(t,e)}}},Qt=function(){return function(t){return function(e){var n=e.name,i=e.displayName,r=e.domain;if(!r||!mt.middleware.logger)return $t(t,e);var o=Rt.stack.length;return mt.middleware.skipNestLog&&1!==o?$t(t,e):mt.middleware.diffLogger?$t(t,e,(function(){if(r){var t=new Map;Wt.context?t=new Map(Wt.context.historyNode.history):kt.currentTimeTravel&&(t=new Map(kt.currentTimeTravel.currentHistory));var e=[];t.forEach((function(t,n){t.forEach((function(t,i){e.push({name:n.constructor.name,target:At(n)?n.$$turboxProperties:n,property:i,before:t.beforeUpdate,after:t.didUpdate})}))})),e.length&&(console.group("%c[TURBOX LOG]: DIFF ".concat(r.constructor.name," ").concat(n," ").concat(i!==yt?i:""),"background: #FF5F0F; color: #fff; font-weight: bold; padding: 3px 5px;"),console.table(e),console.groupEnd())}})):(console.group("%c[TURBOX LOG]: PREV ".concat(r.constructor.name," ").concat(n," ").concat(i!==yt?i:""),"background: #929493; color: #fff; font-weight: bold; padding: 3px 5px;"),console.dir(nt({},r.$$turboxProperties,{clone:!0})),console.groupEnd(),$t(t,e,(function(){r&&(console.group("%c[TURBOX LOG]: NEXT ".concat(r.constructor.name," ").concat(n," ").concat(i!==yt?i:""),"background: #218D41; color: #fff; font-weight: bold; padding: 3px 5px;"),console.dir(nt({},r.$$turboxProperties,{clone:!0})),console.groupEnd())})))}}},Jt=function(){return function(t){return function(e){if(!mt.middleware.perf)return $t(t,e);var n=e.name,i=e.displayName,r=performance.now(),o=Rt.stack.length;return mt.middleware.skipNestPerfLog&&1!==o?$t(t,e):$t(t,e,(function(){var t=performance.now();console.log("%c[TURBOX PERF]: ".concat(n," ").concat(i!==yt?i:""," ").concat((t-r).toFixed(3),"ms"),"background: #FA54FF; color: #fff; font-weight: bold; padding: 3px 5px;")}))}}};var te,ee,ne=!1;function ie(){Ft.endBatch(),kt.clear()}function re(t){if(ie(),$("undefined"!=typeof Proxy&&x(),"Proxy or Symbol is not supported, please add polyfill."),!ne){Zt(Jt),Zt(Kt),Zt(Qt);var e=[function(t){var e=t(),n=function(){K("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getActionChain:function(){return Wt.context?Wt.context.historyNode.actionChain.slice():Nt.slice()},getDependencyGraph:function(){return new Map(Bt.dependencyGraph)},dispatch:function(){return n.apply(void 0,arguments)}},r=qt.map((function(t){return t(i)}));return n=it.apply(void 0,f(r))(e.dispatch),Yt(Yt({},e),{},{dispatch:n})}];jt(it.apply(void 0,e)),Tt.emit(xt.storeOnActive)}if(ne=!0,t){var n=St("".concat(rt,"init"),t,{immediately:!0,displayName:""})();if(C(n))return n.then((function(){ie()}),(function(){ie()}));ie()}}function oe(t){var e=t._vNode;if(e)for(var n=e.parent;n;){if(n&&(n.tag===ee.SCENE||n.tag===ee.MESH))return n.instance;n=n.parent}}function ae(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ae=function(){return!!t})()}re(),function(t){t[t.READY=1]="READY",t[t.UPDATE=2]="UPDATE",t[t.UPDATE_INTERACTIVE=4]="UPDATE_INTERACTIVE",t[t.UPDATE_CUSTOM_PROPS=8]="UPDATE_CUSTOM_PROPS",t[t.FAKE_UPDATE=16]="FAKE_UPDATE",t[t.REMOVE=32]="REMOVE",t[t.CREATE=64]="CREATE"}(te||(te={})),function(t){t[t.COMPONENT=1]="COMPONENT",t[t.SCENE=2]="SCENE",t[t.MESH=3]="MESH"}(ee||(ee={}));var se,ce,le={key:void 0,children:void 0,onClick:void 0,onDBClick:void 0,onRightClick:void 0,onDragStart:void 0,onDragMove:void 0,onDragEnd:void 0,onPinchStart:void 0,onPinch:void 0,onPinchEnd:void 0,onRotateStart:void 0,onRotate:void 0,onRotateEnd:void 0,onPress:void 0,onPressUp:void 0,onHoverIn:void 0,onHoverOut:void 0,clickable:void 0,hoverable:void 0,draggable:void 0,pinchable:void 0,rotatable:void 0,pressable:void 0,id:void 0,type:void 0},ue=function(){return a((function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.props=n}),[{key:"context",get:function(){var t=function(t){var e=t._vNode;if(e)for(var n=e.parent;n;){if(n&&n.tag===ee.SCENE)return n.instance;n=n.parent}}(this);return t&&t.sceneContext||{}}},{key:"forceUpdate",value:function(){this._vNode.update(!0)}},{key:"shouldComponentUpdate",value:function(){return!0}},{key:"shouldComponentInteractiveUpdate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!O({clickable:this.props.clickable,hoverable:this.props.hoverable,draggable:this.props.draggable,pinchable:this.props.pinchable,rotatable:this.props.rotatable,pressable:this.props.pressable},{clickable:t.clickable,hoverable:t.hoverable,draggable:t.draggable,pinchable:t.pinchable,rotatable:t.rotatable,pressable:t.pressable})}},{key:"shouldComponentCustomPropsUpdate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.keys(le);retu