UNPKG

@visactor/react-vtable

Version:

The react version of VTable

1 lines 411 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@visactor/vtable"),require("react")):"function"==typeof define&&define.amd?define(["exports","@visactor/vtable","react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactVTable={},t.VTable,t.React)}(this,(function(t,e,n){"use strict";const i=n.createContext(null);function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}i.displayName="TableContext";var s={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,i,s,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new r(i,s||t,a),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),o.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,s=i.length,a=new Array(s);r<s;r++)a[r]=i[r].fn;return a},o.prototype.listenerCount=function(t){var e=n?n+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,r,s,a){var o=n?n+t:t;if(!this._events[o])return!1;var l,c,u=this._events[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,i),!0;case 4:return u.fn.call(u.context,e,i,r),!0;case 5:return u.fn.call(u.context,e,i,r,s),!0;case 6:return u.fn.call(u.context,e,i,r,s,a),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,i);break;case 4:u[c].fn.call(u[c].context,e,i,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},o.prototype.on=function(t,e,n){return s(this,t,e,n,!1)},o.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},o.prototype.removeListener=function(t,e,i,r){var s=n?n+t:t;if(!this._events[s])return this;if(!e)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==e||r&&!o.once||i&&o.context!==i||a(this,s);else{for(var l=0,c=[],u=o.length;l<u;l++)(o[l].fn!==e||r&&!o[l].once||i&&o[l].context!==i)&&c.push(o[l]);c.length?this._events[s]=1===c.length?c[0]:c:a(this,s)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o}(s);var a=r(s.exports);var o=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var l=t=>"function"==typeof t;var c=t=>null==t;var u=t=>null!=t;var h=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var d=t=>"object"==typeof t&&null!==t;var f=function(t){if(!d(t)||!o(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var p=(t,e=!1)=>{const n=typeof t;return e?"string"===n:"string"===n||o(t,"String")};var g=t=>Array.isArray?Array.isArray(t):o(t,"Array");var m=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=(t,e=!1)=>{const n=typeof t;return e?"number"===n:"number"===n||o(t,"Number")};function y(t,e,n=!1,i=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const r=Object(e),s=[];for(const t in r)s.push(t);let{length:a}=s,o=-1;for(;a--;){const a=s[++o];!u(r[a])||"object"!=typeof r[a]||i&&g(t[a])?x(t,a,r[a]):v(t,e,a,n,i)}}}}function v(t,e,n,i=!1,r=!1){const s=t[n],a=e[n];let o=e[n],l=!0;if(g(a)){if(i)o=[];else if(g(s))o=s;else if(m(s)){o=new Array(s.length);let t=-1;const e=s.length;for(;++t<e;)o[t]=s[t]}}else f(a)?(o=null!=s?s:{},"function"!=typeof s&&"object"==typeof s||(o={})):l=!1;l&&y(o,a,i,r),x(t,n,o)}function x(t,e,n){(void 0!==n&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],n)||void 0===n&&!(e in t))&&(t[e]=n)}function _(t,...e){let n=-1;const i=e.length;for(;++n<i;)y(t,e[n],!0);return t}function S(t,e){if(!t||!f(t))return t;const n={};return Object.keys(t).forEach((i=>{const r=t[i];let s=!1;e.forEach((t=>{(p(t)&&t===i||t instanceof RegExp&&i.match(t))&&(s=!0)})),s||(n[i]=r)})),n}function A(t){return Object.prototype.toString.call(t)}function w(t){return Object.keys(t)}function T(t,e,n){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(A(t)!==A(e))return!1;if(l(t))return!!(null==n?void 0:n.skipFunction);if("object"!=typeof t)return!1;if(g(t)){if(t.length!==e.length)return!1;for(let i=t.length-1;i>=0;i--)if(!T(t[i],e[i],n))return!1;return!0}if(!f(t))return!1;const i=w(t),r=w(e);if(i.length!==r.length)return!1;i.sort(),r.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=r[t])return!1;for(let r=i.length-1;r>=0;r--){const s=i[r];if(!T(t[s],e[s],n))return!1}return!0}const C=(t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const n=t.split(":");if(2===n.length){const t=n[0].trim(),i=n[1].trim();t&&i&&(e[t]=i)}}})),e};var B,k={exports:{}},M={};k.exports=function(){if(B)return M;B=1;var t,e=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen");function g(t){if("object"==typeof t&&null!==t){var p=t.$$typeof;switch(p){case e:switch(t=t.type){case i:case s:case r:case u:case h:return t;default:switch(t=t&&t.$$typeof){case l:case o:case c:case f:case d:case a:return t;default:return p}}case n:return p}}}return t=Symbol.for("react.module.reference"),M.ContextConsumer=o,M.ContextProvider=a,M.Element=e,M.ForwardRef=c,M.Fragment=i,M.Lazy=f,M.Memo=d,M.Portal=n,M.Profiler=s,M.StrictMode=r,M.Suspense=u,M.SuspenseList=h,M.isAsyncMode=function(){return!1},M.isConcurrentMode=function(){return!1},M.isContextConsumer=function(t){return g(t)===o},M.isContextProvider=function(t){return g(t)===a},M.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===e},M.isForwardRef=function(t){return g(t)===c},M.isFragment=function(t){return g(t)===i},M.isLazy=function(t){return g(t)===f},M.isMemo=function(t){return g(t)===d},M.isPortal=function(t){return g(t)===n},M.isProfiler=function(t){return g(t)===s},M.isStrictMode=function(t){return g(t)===r},M.isSuspense=function(t){return g(t)===u},M.isSuspenseList=function(t){return g(t)===h},M.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===s||e===r||e===u||e===h||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===d||e.$$typeof===a||e.$$typeof===o||e.$$typeof===c||e.$$typeof===t||void 0!==e.getModuleId)},M.typeOf=g,M}();var P=k.exports;const E=t=>{let e=[];return n.Children.forEach(t,(t=>{c(t)||(P.isFragment(t)?e=e.concat(E(t.props.children)):e.push(t))})),e},O={...e.TABLE_EVENT_TYPE,...e.PIVOT_TABLE_EVENT_TYPE,...e.PIVOT_CHART_EVENT_TYPE},L={onClickCell:O.CLICK_CELL,onDblClickCell:O.DBLCLICK_CELL,onMouseDownCell:O.MOUSEDOWN_CELL,onMouseUpCell:O.MOUSEUP_CELL,onSelectedCell:O.SELECTED_CELL,onSelectedClear:O.SELECTED_CLEAR,onKeyDown:O.KEYDOWN,onMouseEnterTable:O.MOUSEENTER_TABLE,onMouseLeaveTable:O.MOUSELEAVE_TABLE,onMouseDownTable:O.MOUSEDOWN_TABLE,onMouseMoveCell:O.MOUSEMOVE_CELL,onMouseMoveTable:O.MOUSEMOVE_TABLE,onMouseEnterCell:O.MOUSEENTER_CELL,onMouseLeaveCell:O.MOUSELEAVE_CELL,onContextMenuCell:O.CONTEXTMENU_CELL,onResizeColumn:O.RESIZE_COLUMN,onResizeColumnEnd:O.RESIZE_COLUMN_END,onResizeRow:O.RESIZE_ROW,onResizeRowEnd:O.RESIZE_ROW_END,onChangeHeaderPositionStart:O.CHANGE_HEADER_POSITION_START,onChangeHeaderPosition:O.CHANGE_HEADER_POSITION,onChangeHeaderPositionFail:O.CHANGE_HEADER_POSITION_FAIL,onSortClick:O.SORT_CLICK,onAfterSort:O.AFTER_SORT,onFreezeClick:O.FREEZE_CLICK,onScroll:O.SCROLL,onScrollHorizontalEnd:O.SCROLL_HORIZONTAL_END,onScrollVerticalEnd:O.SCROLL_VERTICAL_END,onDropdownMenuClick:O.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:O.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:O.DRAG_SELECT_END,onCopyData:O.COPY_DATA,onDropdownIconClick:O.DROPDOWN_ICON_CLICK,onDropdownMenuClear:O.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:O.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:O.SHOW_MENU,onHideMenu:O.HIDE_MENU,onIconClick:O.ICON_CLICK,onLegendItemClick:O.LEGEND_ITEM_CLICK,onLegendItemHover:O.LEGEND_ITEM_HOVER,onLegendItemUnHover:O.LEGEND_ITEM_UNHOVER,onLegendChange:O.LEGEND_CHANGE,onMouseEnterAxis:O.MOUSEENTER_AXIS,onMouseLeaveAxis:O.MOUSELEAVE_AXIS,onCheckboxStateChange:O.CHECKBOX_STATE_CHANGE,onRadioStateChange:O.RADIO_STATE_CHANGE,onSwitchStateChange:O.SWITCH_STATE_CHANGE,onAfterRender:O.AFTER_RENDER,onInitialized:O.INITIALIZED,onChangeCellValue:O.CHANGE_CELL_VALUE,onDragFillHandleEnd:O.DRAG_FILL_HANDLE_END,onMousedownFillHandle:O.MOUSEDOWN_FILL_HANDLE,onDblclickFillHandle:O.DBLCLICK_FILL_HANDLE,onPivotSortClick:O.PIVOT_SORT_CLICK,onDrillMenuClick:O.DRILLMENU_CLICK,onVChartEventType:O.VCHART_EVENT_TYPE,onChangCellValue:O.CHANGE_CELL_VALUE,onEmptyTipClick:O.EMPTY_TIP_CLICK,onEmptyTipDblClick:O.EMPTY_TIP_DBLCLICK,onButtonClick:O.BUTTON_CLICK,onBeforeCacheChartImage:O.BEFORE_CACHE_CHART_IMAGE,onPastedData:O.PASTED_DATA},R=Object.keys(L),I=(t,e=L)=>{const n={};return Object.keys(t).forEach((i=>{e[i]&&t[i]&&(n[i]=t[i])})),n},N=(t,e,n,i=L)=>{if(!e&&!n||!t)return!1;const r=n?I(n,i):null,s=e?I(e,i):null;return r&&Object.keys(r).forEach((e=>{s&&s[e]&&s[e]===r[e]||t.off(i[e],n[e])})),s&&Object.keys(s).forEach((e=>{r&&r[e]&&r[e]===s[e]||t.on(i[e],s[e])})),!0};class U{static GenAutoIncrementId(){return U.auto_increment_id++}}U.auto_increment_id=0;class D{constructor(t){this.id=U.GenAutoIncrementId(),this.registry=t}}const z="named",W="inject",F="inversify:tagged",j="inversify:paramtypes";class H{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===z?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var G=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",n=Object.getPrototypeOf(Function),i=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),r=new WeakMap;function s(t,e,n){let s=r.get(t);if(c(s)){if(!n)return;s=new i,r.set(t,s)}let a=s.get(e);if(c(a)){if(!n)return;a=new i,s.set(e,a)}return a}function a(t,e,n){if(o(t,e,n))return!0;const i=g(e);return!u(i)&&a(t,i,n)}function o(t,e,n){const i=s(e,n,!1);return!c(i)&&!!i.has(t)}function l(t,e,n){if(o(t,e,n))return function(t,e,n){const i=s(e,n,!1);if(!c(i))return i.get(t)}(t,e,n);const i=g(e);return u(i)?void 0:l(t,i,n)}function c(t){return void 0===t}function u(t){return null===t}function h(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,n){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const i=3===n?"string":5===n?"number":"default",r=function(t,e){const n=t[e];if(null!=n){if(!p(n))throw new TypeError;return n}}(t,e);if(void 0!==r){const e=r.call(t,i);if(h(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(p(e)){const n=e.call(t);if(!h(n))return n}const n=t.valueOf;if(p(n)){const e=n.call(t);if(!h(e))return e}}else{const e=t.valueOf;if(p(e)){const n=e.call(t);if(!h(n))return n}const n=t.toString;if(p(n)){const e=n.call(t);if(!h(e))return e}}throw new TypeError}(t,"default"===i?"number":i)}function f(t){const e=d(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function p(t){return"function"==typeof t}function g(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===n)return e;if(e!==n)return e;const i=t.prototype,r=i&&Object.getPrototypeOf(i);if(null==r||r===Object.prototype)return e;const s=r.constructor;return"function"!=typeof s||s===t?e:s}t("defineMetadata",(function(t,e,n,i){if(!h(n))throw new TypeError;return r=t,a=e,void s(n,i,!0).set(r,a);var r,a})),t("hasMetadata",(function(t,e,n){if(!h(e))throw new TypeError;return c(n)||(n=f(n)),a(t,e,n)})),t("hasOwnMetadata",(function(t,e,n){if(!h(e))throw new TypeError;return c(n)||(n=f(n)),o(t,e,n)})),t("getMetadata",(function(t,e,n){if(!h(e))throw new TypeError;return c(n)||(n=f(n)),l(t,e,n)}))}((e=t,function(t,n){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n})})),t}({});function V(t,e,n,i){!function(t,e,n,i){const r=[i];let s={};G.hasOwnMetadata(t,e)&&(s=G.getMetadata(t,e));let a=s[n];void 0===a&&(a=[]),a.push(...r),s[n]=a,G.defineMetadata(t,s,e)}(F,t,n.toString(),i)}function $(t){return(e,n,i)=>{V(e,0,i,t)}}const X=(Y=W,t=>(e,n,i)=>$(new H(Y,t))(e,n,i));var Y;function K(){return function(t){return G.defineMetadata(j,null,t),t}}function q(t){return $(new H(z,t))}const Q="Singleton",Z="Transient",J="ConstantValue",tt="DynamicValue",et="Factory",nt="Function",it="Instance",rt="Invalid";class st{constructor(t,e){this.id=U.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=rt,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new st(this.serviceIdentifier,this.scope);return t.activated=t.scope===Q&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class at{getConstructorMetadata(t){return{compilerGeneratedMetadata:G.getMetadata(j,t),userGeneratedMetadata:G.getMetadata(F,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const ot=(lt=z,t=>{const e=e=>{if(null==e)return!1;if(e.key===lt&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const n=e.constructorArgsMetadata;for(let e=0;e<n.length;e++)if(n[e].key===lt&&n[e].value===t)return!0;return!1};return e.metaData=new H(lt,t),e});var lt;class ct{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=Q,this}inTransientScope(){return this._binding.scope=Z,this}whenTargetNamed(t){return this._binding.constraint=ot(t),this}}class ut{constructor(t){this._binding=t}to(t){return this._binding.type=it,this._binding.implementationType=t,new ct(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=tt,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new ct(this._binding)}toConstantValue(t){return this._binding.type=J,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=Q,new ct(this._binding)}toFactory(t){return this._binding.type=et,this._binding.factory=t,this._binding.scope=Q,new ct(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}const ht=Symbol("ContributionProvider");class dt{constructor(t,e){this.serviceIdentifier=t,this.container=e,pt.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function ft(t,e){t(ht).toDynamicValue((({container:t})=>new dt(e,t))).inSingletonScope().whenTargetNamed(e)}class pt{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}pt.store=new Map;class gt{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const n="string"==typeof t?t.trim():t.name;n&&(this.taps=this.taps.filter((t=>!(t.name===n&&(!e||t.fn===e)))))}_parseOptions(t,e,n){let i;if("string"==typeof e)i={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof i.name||""===i.name)throw new Error("Missing name for tap");return i=Object.assign({type:t,fn:n},i),i}_tap(t,e,n){this._insert(this._parseOptions(t,e,n))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let n=0;"number"==typeof t.stage&&(n=t.stage);let i=this.taps.length;for(;i>0;){i--;const t=this.taps[i];this.taps[i+1]=t;const r=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(r>n)){i++;break}}this.taps[i]=t}}class mt extends gt{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const bt=Symbol.for("EnvContribution");const yt=new class{};var vt;!function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(vt||(vt={}));var xt=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var _t=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||xt(t,"Boolean");var St=t=>"function"==typeof t;var At=t=>null==t;var wt=t=>null!=t;var Tt=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var Ct=t=>"object"==typeof t&&null!==t;var Bt=function(t){if(!Ct(t)||!xt(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var kt=(t,e=!1)=>{const n=typeof t;return e?"string"===n:"string"===n||xt(t,"String")};var Mt=t=>Array.isArray?Array.isArray(t):xt(t,"Array");var Pt=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var Et=(t,e=!1)=>{const n=typeof t;return e?"number"===n:"number"===n||xt(t,"Number")};var Ot=t=>Et(t)&&Number.isFinite(t);var Lt=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var Rt=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var It=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const Nt=Object.prototype;var Ut=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Nt)};const Dt=Object.prototype.hasOwnProperty;function zt(t){if(At(t))return!0;if(Pt(t))return!t.length;const e=It(t);if("Map"===e||"Set"===e)return!t.size;if(Ut(t))return!Object.keys(t).length;for(const e in t)if(Dt.call(t,e))return!1;return!0}function Wt(t,e,n=!1,i=!1){if(e){if(t===e)return;if(wt(e)&&"object"==typeof e){const r=Object(e),s=[];for(const t in r)s.push(t);let{length:a}=s,o=-1;for(;a--;){const a=s[++o];!wt(r[a])||"object"!=typeof r[a]||i&&Mt(t[a])?jt(t,a,r[a]):Ft(t,e,a,n,i)}}}}function Ft(t,e,n,i=!1,r=!1){const s=t[n],a=e[n];let o=e[n],l=!0;if(Mt(a)){if(i)o=[];else if(Mt(s))o=s;else if(Pt(s)){o=new Array(s.length);let t=-1;const e=s.length;for(;++t<e;)o[t]=s[t]}}else Bt(a)?(o=null!=s?s:{},"function"!=typeof s&&"object"==typeof s||(o={})):l=!1;l&&Wt(o,a,i,r),jt(t,n,o)}function jt(t,e,n){(void 0!==n&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],n)||void 0===n&&!(e in t))&&(t[e]=n)}function Ht(t,...e){let n=-1;const i=e.length;for(;++n<i;)Wt(t,e[n],!0);return t}function Gt(t,e){if(!Mt(t)||!Mt(e))return!1;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}const Vt="undefined"!=typeof console;function $t(t,e,n){const i=[e].concat([].slice.call(n));Vt&&console[t].apply(console,i)}var Xt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(Xt||(Xt={}));class Yt{static getInstance(t,e){return Yt._instance&&Et(t)?Yt._instance.level(t):Yt._instance||(Yt._instance=new Yt(t,e)),Yt._instance}static setInstance(t){return Yt._instance=t}static setInstanceLevel(t){Yt._instance?Yt._instance.level(t):Yt._instance=new Yt(t)}static clearInstance(){Yt._instance=null}constructor(t=Xt.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=Xt.Info}canLogDebug(){return this._level>=Xt.Debug}canLogError(){return this._level>=Xt.Error}canLogWarn(){return this._level>=Xt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=Xt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):$t(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=Xt.Warn&&$t(this._method||"warn","WARN",t),this}info(...t){return this._level>=Xt.Info&&$t(this._method||"log","INFO",t),this}debug(...t){return this._level>=Xt.Debug&&$t(this._method||"log","DEBUG",t),this}}Yt._instance=null;const Kt=1e-12,qt=Math.PI,Qt=qt/2,Zt=2*qt,Jt=2*Math.PI,te=Math.abs,ee=Math.atan2,ne=Math.cos,ie=Math.max,re=Math.min,se=Math.sin,ae=Math.sqrt,oe=Math.pow;function le(t){return t>=1?Qt:t<=-1?-Qt:Math.asin(t)}class ce{constructor(t=0,e=0,n,i){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=n,this.y1=i}clone(){return new ce(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return Et(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return Et(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class ue{static distancePP(t,e){return ae(oe(t.x-e.x,2)+oe(t.y-e.y,2))}static distanceNN(t,e,n,i){return ae(oe(t-n,2)+oe(e-i,2))}static distancePN(t,e,n){return ae(oe(e-t.x,2)+oe(n-t.y,2))}static pointAtPP(t,e,n){return new ce((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y)}}function he(t){return t*(Math.PI/180)}const de=(t=0)=>{if(t<0)for(;t<-Zt;)t+=Zt;else if(t>0)for(;t>Zt;)t-=Zt;return t};var fe;function pe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ge({x:t,y:e},n,i={x:0,y:0}){return{x:(t-i.x)*Math.cos(n)-(e-i.y)*Math.sin(n)+i.x,y:(t-i.x)*Math.sin(n)+(e-i.y)*Math.cos(n)+i.y}}function me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function be(t,e){const n=e?he(t.angle):t.angle,i=me(t);return[ge({x:t.x1,y:t.y1},n,i),ge({x:t.x2,y:t.y1},n,i),ge({x:t.x2,y:t.y2},n,i),ge({x:t.x1,y:t.y2},n,i)]}function ye(t,e,n,i,r,s){if(s>e&&s>i||s<e&&s<i)return 0;if(i===e)return 0;const a=(s-e)/(i-e);let o=i<e?1:-1;1!==a&&0!==a||(o=i<e?.5:-.5);const l=a*(n-t)+t;return l===r?1/0:l>r?o:0}!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(fe||(fe={}));function ve(t,e,n){const{x1:i,y1:r,x2:s,y2:a}=e;return n.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(n.e,n.f),e):(t.clear(),t.add(n.a*i+n.c*r+n.e,n.b*i+n.d*r+n.f),t.add(n.a*s+n.c*r+n.e,n.b*s+n.d*r+n.f),t.add(n.a*s+n.c*a+n.e,n.b*s+n.d*a+n.f),t.add(n.a*i+n.c*a+n.e,n.b*i+n.d*a+n.f),e)}class xe{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new xe(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,n=0,i=0){return this.x1=t,this.y1=e,this.x2=n,this.y2=i,this}set(t=0,e=0,n=0,i=0){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return Mt(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,n=0){const i=this.rotatedPoints(t,e,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])}scale(t=0,e=0,n=0,i=0){const r=this.scalePoints(t,e,n,i);return this.clear().add(r[0],r[1]).add(r[2],r[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ve(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,n){const{x1:i,y1:r,x2:s,y2:a}=this,o=Math.cos(t),l=Math.sin(t),c=e-e*o+n*l,u=n-e*l-n*o;return[o*i-l*r+c,l*i+o*r+u,o*i-l*a+c,l*i+o*a+u,o*s-l*r+c,l*s+o*r+u,o*s-l*a+c,l*s+o*a+u]}scalePoints(t,e,n,i){const{x1:r,y1:s,x2:a,y2:o}=this;return[t*r+(1-t)*n,e*s+(1-e)*i,t*a+(1-t)*n,e*o+(1-e)*i]}}class _e extends xe{}class Se extends xe{constructor(t,e=0){var n;super(t),t&&(this.angle=null!==(n=t.angle)&&void 0!==n?n:e)}intersects(t){return function(t,e,n=!1){const i=be(t,n),r=be(e,n),s=(t,e)=>[e.x-t.x,e.y-t.y],a=s(me(t),me(e)),o=s(i[0],i[1]),l=s(i[1],i[2]),c=s(r[0],r[1]),u=s(r[1],r[2]),h=n?he(t.angle):t.angle;let d=n?he(90-t.angle):t.angle+Qt;const f=n?he(e.angle):e.angle;let p=n?he(90-e.angle):e.angle+Qt;d>Jt&&(d-=Jt),p>Jt&&(p-=Jt);const g=(t,e,n,i)=>{const r=[Math.cos(e),Math.sin(e)];return t+(pe(r,n)+pe(r,i))/2>pe(r,a)};return g((t.x2-t.x1)/2,h,c,u)&&g((t.y2-t.y1)/2,d,c,u)&&g((e.x2-e.x1)/2,f,o,l)&&g((e.y2-e.y1)/2,p,o,l)}(this,t)}setValue(t=0,e=0,n=0,i=0,r=0){return super.setValue(t,e,n,i),this.angle=r,this}clone(){return new Se(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ge({x:this.x1,y:this.y1},this.angle,t),ge({x:this.x2,y:this.y1},this.angle,t),ge({x:this.x1,y:this.y2},this.angle,t),ge({x:this.x2,y:this.y2},this.angle,t)]}}class Ae{constructor(t=1,e=0,n=0,i=1,r=0,s=0){this.a=t,this.b=e,this.c=n,this.d=i,this.e=r,this.f=s}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,n,i,r,s){return!(this.e!==r||this.f!==s||this.a!==t||this.d!==i||this.b!==e||this.c!==n)}setValue(t,e,n,i,r,s){return this.a=t,this.b=e,this.c=n,this.d=i,this.e=r,this.f=s,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,n=this.c,i=this.d,r=this.e,s=this.f,a=new Ae,o=t*i-e*n;return a.a=i/o,a.b=-e/o,a.c=-n/o,a.d=t/o,a.e=(n*s-i*r)/o,a.f=-(t*s-e*r)/o,a}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.a*e+this.c*n,r=this.b*e+this.d*n,s=this.a*-n+this.c*e,a=this.b*-n+this.d*e;return this.a=i,this.b=r,this.c=s,this.d=a,this}rotateByCenter(t,e,n){const i=Math.cos(t),r=Math.sin(t),s=(1-i)*e+r*n,a=(1-i)*n-r*e,o=i*this.a-r*this.b,l=r*this.a+i*this.b,c=i*this.c-r*this.d,u=r*this.c+i*this.d,h=i*this.e-r*this.f+s,d=r*this.e+i*this.f+a;return this.a=o,this.b=l,this.c=c,this.d=u,this.e=h,this.f=d,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,n,i,r,s){return this.multiply(t,e,n,i,r,s),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:n,d:i,e:r,f:s}=this;return this.a=e,this.b=t,this.c=i,this.d=n,this.e=s,this.f=r,this}multiply(t,e,n,i,r,s){const a=this.a,o=this.b,l=this.c,c=this.d,u=a*t+l*e,h=o*t+c*e,d=a*n+l*i,f=o*n+c*i,p=a*r+l*s+this.e,g=o*r+c*s+this.f;return this.a=u,this.b=h,this.c=d,this.d=f,this.e=p,this.f=g,this}interpolate(t,e){const n=new Ae;return n.a=this.a+(t.a-this.a)*e,n.b=this.b+(t.b-this.b)*e,n.c=this.c+(t.c-this.c)*e,n.d=this.d+(t.d-this.d)*e,n.e=this.e+(t.e-this.e)*e,n.f=this.f+(t.f-this.f)*e,n}transformPoint(t,e){const{a:n,b:i,c:r,d:s,e:a,f:o}=this,l=n*s-i*r,c=s/l,u=-i/l,h=-r/l,d=n/l,f=(r*o-s*a)/l,p=-(n*o-i*a)/l,{x:g,y:m}=t;e.x=g*c+m*h+f,e.y=g*u+m*d+p}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ae(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,n=this.c,i=this.d,r=t*i-e*n,s={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);s.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),s.scaleX=a,s.scaleY=r/a,s.skewX=(t*n+e*i)/r,s.skewY=0}else if(0!==n||0!==i){const a=Math.sqrt(n*n+i*i);s.rotateDeg=Math.PI/2-(i>0?Math.acos(-n/a):-Math.acos(n/a)),s.scaleX=r/a,s.scaleY=a,s.skewX=0,s.skewY=(t*n+e*i)/r}return s.rotateDeg=180*s.rotateDeg/Math.PI,s}}const we=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),Te=Zt-1e-8;class Ce{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,n,i,r,s){if(Math.abs(r-i)>Te)return this.bounds.add(t-n,e-n),void this.bounds.add(t+n,e+n);let a,o,l,c,u=1/0,h=-1/0,d=1/0,f=-1/0;function p(t){l=n*Math.cos(t),c=n*Math.sin(t),l<u&&(u=l),l>h&&(h=l),c<d&&(d=c),c>f&&(f=c)}if(p(i),p(r),r!==i)if((i%=Zt)<0&&(i+=Zt),(r%=Zt)<0&&(r+=Zt),r<i&&(s=!s,a=i,i=r,r=a),s)for(r-=Zt,a=i-i%Qt,o=0;o<4&&a>r;++o,a-=Qt)p(a);else for(a=i-i%Qt+Qt,o=0;o<4&&a<r;++o,a+=Qt)p(a);this.bounds.add(t+u,e+d),this.bounds.add(t+h,e+f)}arcTo(t,e,n,i,r){this.bounds.add(t,e)}bezierCurveTo(t,e,n,i,r,s){this.bounds.add(t,e),this.bounds.add(n,i),this.bounds.add(r,s)}closePath(){}ellipse(){throw new Error("不支持ellipse")}lineTo(t,e){this.bounds.add(t,e)}moveTo(t,e){this.bounds.add(t,e)}quadraticCurveTo(t,e,n,i){this.bounds.add(t,e),this.bounds.add(n,i)}rect(t,e,n,i){this.bounds.add(t,e),this.bounds.add(t+n,e+i)}clear(){this.bounds.clear()}release(...t){}}class Be{constructor(){this._curves=[],this.bounds=new _e}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ke=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Me={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Pe={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ee,Oe,Le,Re,Ie,Ne;var Ue,De,ze,We,Fe,je;function He(t){const e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=l*s,u=-o*a,h=o*s,d=l*a,f=Math.cos(i),p=Math.sin(i),g=Math.cos(r),m=Math.sin(r),b=.5*(r-i),y=Math.sin(.5*b),v=8/3*y*y/Math.sin(b),x=e+f-v*p,_=n+p+v*f,S=e+g,A=n+m,w=S+v*m,T=A-v*g;return[c*x+u*_,h*x+d*_,c*w+u*T,h*w+d*T,c*S+u*A,h*S+d*A]}function Ge(t,e,n,i){const r=function(t,e,n,i,r,s,a,o,l){const c=he(a),u=Math.sin(c),h=Math.cos(c),d=h*(o-t)*.5+u*(l-e)*.5,f=h*(l-e)*.5-u*(o-t)*.5;let p=d*d/((n=Math.abs(n))*n)+f*f/((i=Math.abs(i))*i);p>1&&(p=Math.sqrt(p),n*=p,i*=p);const g=h/n,m=u/n,b=-u/i,y=h/i,v=g*o+m*l,x=b*o+y*l,_=g*t+m*e,S=b*t+y*e;let A=1/((_-v)*(_-v)+(S-x)*(S-x))-.25;A<0&&(A=0);let w=Math.sqrt(A);s===r&&(w=-w);const T=.5*(v+_)-w*(S-x),C=.5*(x+S)+w*(_-v),B=Math.atan2(x-C,v-T);let k=Math.atan2(S-C,_-T)-B;k<0&&1===s?k+=Zt:k>0&&0===s&&(k-=Zt);const M=Math.ceil(Math.abs(k/(Qt+.001))),P=[];for(let t=0;t<M;++t){const e=B+t*k/M,r=B+(t+1)*k/M;P[t]=[T,C,e,r,n,i,u,h]}return P}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,n);for(let e=0;e<r.length;++e){const n=He(r[e]);t.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])}}!function(t){t[t.NONE=0]="NONE",t[t.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",t[t.UPDATE_SHAPE=2]="UPDATE_SHAPE",t[t.CLEAR_SHAPE=253]="CLEAR_SHAPE",t[t.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",t[t.INIT=179]="INIT",t[t.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",t[t.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",t[t.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",t[t.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",t[t.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",t[t.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",t[t.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",t[t.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"}(Ue||(Ue={})),function(t){t[t.GLOBAL=1]="GLOBAL",t[t.LOCAL=16]="LOCAL",t[t.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",t[t.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"}(De||(De={})),function(t){t[t.INIT=0]="INIT",t[t.DEFAULT=1]="DEFAULT",t[t.STATE=2]="STATE",t[t.ANIMATE_BIND=10]="ANIMATE_BIND",t[t.ANIMATE_PLAY=11]="ANIMATE_PLAY",t[t.ANIMATE_START=12]="ANIMATE_START",t[t.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",t[t.ANIMATE_END=14]="ANIMATE_END",t[t.TRANSLATE=20]="TRANSLATE",t[t.TRANSLATE_TO=21]="TRANSLATE_TO",t[t.SCALE=22]="SCALE",t[t.SCALE_TO=23]="SCALE_TO",t[t.ROTATE=24]="ROTATE",t[t.ROTATE_TO=25]="ROTATE_TO"}(ze||(ze={})),function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(We||(We={})),function(t){t[t.CubicBezierCurve=0]="CubicBezierCurve",t[t.QuadraticBezierCurve=1]="QuadraticBezierCurve",t[t.ArcCurve=2]="ArcCurve",t[t.LineCurve=3]="LineCurve",t[t.EllipseCurve=4]="EllipseCurve",t[t.MoveCurve=5]="MoveCurve"}(Fe||(Fe={})),function(t){t[t.beforeFillStroke=0]="beforeFillStroke",t[t.afterFillStroke=1]="afterFillStroke"}(je||(je={}));const Ve=[(t,e,n,i,r,s,a)=>e.arc(t[1]*r+n,t[2]*s+i,t[3]*(r+s)/2,t[4],t[5],t[6],a),(t,e,n,i,r,s,a)=>e.arcTo(t[1]*r+n,t[2]*s+i,t[3]*r+n,t[4]*s+i,t[5]*(r+s)/2,a),(t,e,n,i,r,s,a)=>e.bezierCurveTo(t[1]*r+n,t[2]*s+i,t[3]*r+n,t[4]*s+i,t[5]*r+n,t[6]*s+i,a),(t,e,n,i)=>e.closePath(),(t,e,n,i,r,s)=>e.ellipse(t[1]*r+n,t[2]*s+i,t[3]*r,t[4]*s,t[5],t[6],t[7],t[8]),(t,e,n,i,r,s,a)=>e.lineTo(t[1]*r+n,t[2]*s+i,a),(t,e,n,i,r,s,a)=>e.moveTo(t[1]*r+n,t[2]*s+i,a),(t,e,n,i,r,s,a)=>e.quadraticCurveTo(t[1]*r+n,t[2]*s+i,t[3]*r+n,t[4]*s+i,a),(t,e,n,i,r,s,a)=>e.rect(t[1]*r+n,t[2]*s+i,t[3]*r,t[4]*s,a)];function $e(t,e,n=0,i=0,r=1,s=1,a){for(let o=0;o<t.length;o++){const l=t[o];Ve[l[0]](l,e,n,i,r,s,a)}}class Xe{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Ye(t,e){let n=0;const i=t.length;for(let r=0;r<i;r++){const s=t[r],a=e[r],o=t[(r+1)%i],l=e[(r+1)%i];n+=ue.distanceNN(s,a,o,l)}return n/2}function Ke(t,e,n,i,r){const s=1-r;return s*s*s*t+3*e*r*s*s+3*n*r*r*s+i*r*r*r}function qe(t,e,n,i,r){const s=Ke(t.x,e.x,n.x,i.x,r),a=Ke(t.y,e.y,n.y,i.y,r);return new ce(s,a)}function Qe(t,e,n,i){const r=1-i;return r*r*t+2*r*i*e+i*i*n}function Ze(t,e,n,i){const r=Qe(t.x,e.x,n.x,i),s=Qe(t.y,e.y,n.y,i);return new ce(r,s)}class Je extends Xe{constructor(t,e,n,i){super(),this.type=Fe.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=n,this.p3=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y+this.p3.x+this.p3.y)}getPointAt(t){if(!1!==this.defined)return qe(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,n=this.p2,i=this.p3,Ye([t.x,e.x,n.x,i.x],[t.y,e.y,n.y,i.y])):60;var t,e,n,i}calcProjLength(t){return t===We.ROW?te(this.p0.x-this.p3.x):t===We.COLUMN?te(this.p0.y-this.p3.y):0}getAngleAt(t){const e=ie(t-.01,0),n=re(t+.01,1),i=this.getPointAt(e),r=this.getPointAt(n);return ee(r.y-i.y,r.x-i.x)}draw(t,e,n,i,r,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*r+n),s>=1)t.bezierCurveTo(this.p1.x*i+e,this.p1.y*r+n,this.p2.x*i+e,this.p2.y*r+n,this.p3.x*i+e,this.p3.y*r+n);else if(s>0){const[a]=function(t,e){const{p0:n,p1:i,p2:r,p3:s}=t,a=qe(n,i,r,s,e),o=ue.pointAtPP(n,i,e),l=ue.pointAtPP(i,r,e),c=ue.pointAtPP(r,s,e),u=ue.pointAtPP(o,l,e),h=ue.pointAtPP(l,c,e);return[new Je(n,o,u,a),new Je(a,h,c,s)]}(this,s);t.bezierCurveTo(a.p1.x*i+e,a.p1.y*r+n,a.p2.x*i+e,a.p2.y*r+n,a.p3.x*i+e,a.p3.y*r+n)}}includeX(t){const e=re(this.p0.x,this.p1.x,this.p2.x,this.p3.x),n=ie(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=n}getYAt(t){const e=re(this.p0.x,this.p1.x,this.p2.x,this.p3.x),n=(t-e)/(ie(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(n).y}}class tn extends Xe{constructor(t,e){super(),this.type=Fe.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ue.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=ee(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ue.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===We.ROW?te(this.p0.x-this.p1.x):t===We.COLUMN?te(this.p0.y-this.p1.y):0}draw(t,e,n,i,r,s){if(t.moveTo(this.p0.x*i+e,this.p0.y*r+n),s>=1)t.lineTo(this.p1.x*i+e,this.p1.y*r+n);else if(s>0){const a=this.getPointAt(s);t.lineTo(a.x*i+e,a.y*r+n)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,n=this.p1;this.p0.x>this.p1.x&&(e=this.p1,n=this.p0);const i=(t-e.x)/(n.x-e.x);return e.y+i*(n.y-e.y)}return 1/0}}class en{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,n,i,r,s,a,o){const l=new Je(new ce(this._lastX,this._lastY),new ce(t,e),new ce(n,i),new ce(r,s));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=r,this._lastY=s,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,n,i){const r=this.addLinearCurve(t,e,n,this._lastOriginP,i);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=i}moveTo(t,e,n){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=n,this._startOriginP=n,this}quadraticCurveTo(t,e,n,i){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,n,i,r){const s=new tn(new ce(this._lastX,this._lastY),new ce(t,e));return s.originP1=i,s.originP2=r,s.defined=n,s}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,n;if(t===We.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],n=this.curves[this.curves.length-1],i=null!==(e=n.p3)&&void 0!==e?e:n.p1;return te(t.p0.y-i.y)}if(t===We.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],i=null!==(n=e.p3)&&void 0!==n?n:e.p1;return te(t.p0.x-i.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class nn extends en{bezierCurveTo(t,e,n,i,r,s,a,o){return super.bezierCurveTo(e,t,i,n,s,r,a,o)}lineTo(t,e,n,i){return super.lineTo(e,t,n,i)}moveTo(t,e,n){return super.moveTo(e,t,n)}clear(){return super.clear()}}function rn(t,e,n=1){let i=!1;for(let n=0,r=e.length;n<=r;n++)n>=r===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}function sn(t,e,n){const i=null!=e?e:te(n[n.length-1].x-n[0].x)>te(n[n.length-1].y-n[0].y)?We.ROW:We.COLUMN;return"monotoneY"===t?new nn(t,i):new en(t,i)}class an{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,n,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,n,t);break;case 1:this._point=2;default:this.context.lineTo(e,n,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function on(t,e={}){const{direction:n,startPoint:i}=e;if(t.length<2-Number(!!i))return null;const r=sn("linear",n,t);return function(t,e){rn(t,e,1)}(new an(r,i),t),r}function ln(t,e,n,i,r){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6,i,t.lastPoint1)}class cn{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&ln(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,n,t);break;case 1:this._point=2;break;default:ln(this,e,n,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function un(t,e={}){const{direction:n,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return on(t,e);const r=sn("basis",n,t);return function(t,e){rn(t,e,2)}(new cn(r,i),t),r}function hn(t){return t<0?-1:1}function dn(t,e,n){const i=t._x1-t._x0,r=e-t._x1,s=(t._y1-t._y0)/(i||Number(r<0&&-0)),a=(n-t._y1)/(r||Number(i<0&&-0)),o=(s*r+a*i)/(i+r);return(hn(s)+hn(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function fn(t,e){const n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function pn(t,e,n,i,r){const s=t._x0,a=t._y0,o=t._x1,l=t._y1,c=(o-s)/3;t.context.bezierCurveTo(s+c,a+c*e,o-c,l-c*n,o,l,i,t.lastPoint1)}class gn{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:pn(this,this._t0,fn(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const n=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(n,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(n,i,t);break;case 1:this._point=2;break;case 2:this._point=3,pn(this,fn(this,e=dn(this,n,i)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:pn(this,this._t0,e=dn(this,n,i),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=n,this._y0=this._y1,this._y1=i,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class mn extends gn{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function bn(t,e={}){const{direction:n,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return on(t,e);const r=sn("monotoneX",n,t);return function(t,e){rn(t,e,2)}(new gn(r,i),t),r}function yn(t,e={}){const{direction:n,startPoint:i}=e;if(t.length<2-Number(!!i))return null;if(t.length<3-Number(!!i))return on(t,e);const r=sn("monotoneY",n,t);return function(t,e){rn(t,e,2)}(new mn(r,i),t),r}class vn{constructor(t,e=.5,n){this.context=t,this._t=e,this.startPoint=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&2===this._point&&this.context.lineTo(this._x,this._y,!1!==this._lastDefined,this.lastPoint),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,n,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,n,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,n,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,n,!1!==this._lastDefined&&!1!==t.defined,t);else{const i=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(i,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(i,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(i,n,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=n,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class xn extends vn{lineEnd(){this.context.closePath()}}function _n(t,e,n={}){const{direction:i,startPoint:r}=n;if(t.length<2-Number(!!r))return null;const s=new en("step",null!=i?i:te(t[t.length-1].x-t[0].x)>te(t[t.length-1].y-t[0].y)?We.ROW:We.COLUMN);return Sn(new vn(s,e,r),t),s}function Sn(t,e){return rn(t,e,1)}class An extends an{lineEnd(){this.context.closePath()}}function wn(t,e={}){const{direction:n,startPoint:i}=e;if(t.length<2-Number(!!i))return null;const r=sn("linear",n,t);return function(t,e){rn(t,e,1)}(new An(r,i),t),r}function Tn(t,e,n,i,r){let s=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Kt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,n=3*t._l01_a*(t._l01_a+t._l12_a);s=(s*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/n,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/n}if(t._l23_a>Kt){const i=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,r=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*i+t._x1*t._l23_2a-e*t._l12_2a)/r,l=(l*i+t._y1*t._l23_2a-n*t._l12_2a)/r}t.context.bezierCurveTo(s,a,o,l,t._x2,t._y2,i,t.lastPoint1)}function Cn(t,e){return function(n,i,r={}){const{direction:s,startPoint:a}=r;if(n.length<2-Number(!!a))return null;if(n.length<3-Number(!!a))return on(n,r);const o=sn(t,s,n);return rn(new e(o,i,a),n,2),o}}const Bn=Cn("catmullRom",class{constructor(t,e=.5,n){this.context=t,this.startPoint=n,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:n}=t;if(this._point){const t=this._x2-e,i=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Tn(this,e,n,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=n,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const kn=Cn("catmullRomClosed",class{constructor(t,e=.5,n){this.context=t,this.startPoint=n,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:n}=t;if(this._point){const t=this._x2-e,i=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=n;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=n,t);break;case 2:this._point=3,this._x5=e,this._y5=n;break;default:Tn(this,e,n,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01