@visactor/vrender 0.21.1-alpha.1 → 0.21.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +42 -22
- package/dist/index.js +42 -21
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VRender={})}(this,(function(t){"use strict";class e{static GenAutoIncrementId(){return e.auto_increment_id++}}e.auto_increment_id=0;class i{constructor(t){this.id=e.GenAutoIncrementId(),this.registry=t}}const n="named",r="inject",s="multi_inject",a="inversify:tagged",o="inversify:paramtypes";class h{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===n?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var l=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),n=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),r=new WeakMap;function s(t,e,i){let s=r.get(t);if(l(s)){if(!i)return;s=new n,r.set(t,s)}let a=s.get(e);if(l(a)){if(!i)return;a=new n,s.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const n=g(e);return!c(n)&&a(t,n,i)}function o(t,e,i){const n=s(e,i,!1);return!l(n)&&!!n.has(t)}function h(t,e,i){if(o(t,e,i))return function(t,e,i){const n=s(e,i,!1);if(!l(n))return n.get(t)}(t,e,i);const n=g(e);return c(n)?void 0:h(t,n,i)}function l(t){return void 0===t}function c(t){return null===t}function u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,i){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 n=3===i?"string":5===i?"number":"default",r=function(t,e){const i=t[e];if(null!=i){if(!f(i))throw new TypeError;return i}}(t,e);if(void 0!==r){const e=r.call(t,n);if(u(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(f(e)){const i=e.call(t);if(!u(i))return i}const i=t.valueOf;if(f(i)){const e=i.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(f(e)){const i=e.call(t);if(!u(i))return i}const i=t.toString;if(f(i)){const e=i.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===n?"number":n)}function p(t){const e=d(t,3);return function(t){return"symbol"==typeof t}(e)?e:function(t){return""+t}(e)}function f(t){return"function"==typeof t}function g(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const n=t.prototype,r=n&&Object.getPrototypeOf(n);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,i,n){if(!u(i))throw new TypeError;return function(t,e,i,n){s(i,n,!0).set(t,e)}(t,e,i,n)})),t("hasMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return l(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return l(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return l(i)||(i=p(i)),h(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function c(t,e,i,n){!function(t,e,i,n){const r=[n];let s={};l.hasOwnMetadata(t,e)&&(s=l.getMetadata(t,e));let a=s[i];void 0===a&&(a=[]),a.push(...r),s[i]=a,l.defineMetadata(t,s,e)}(a,t,i.toString(),n)}function u(t){return(e,i,n)=>{c(e,0,n,t)}}function d(t){return e=>(i,n,r)=>u(new h(t,e))(i,n,r)}const p=d(r),f=d(s);function g(){return function(t){return l.defineMetadata(o,null,t),t}}function v(t){return u(new h(n,t))}const m="Singleton",y="Transient",b="ConstantValue",x="DynamicValue",w="Factory",S="Function",A="Instance",T="Invalid";class C{constructor(t,i){this.id=e.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=i,this.type=T,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new C(this.serviceIdentifier,this.scope);return t.activated=t.scope===m&&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 _{getConstructorMetadata(t){return{compilerGeneratedMetadata:l.getMetadata(o,t),userGeneratedMetadata:l.getMetadata(a,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const B=(P=n,t=>{const e=e=>{if(null==e)return!1;if(e.key===P&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;e<i.length;e++)if(i[e].key===P&&i[e].value===t)return!0;return!1};return e.metaData=new h(P,t),e});var P;class R{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=m,this}inTransientScope(){return this._binding.scope=y,this}whenTargetNamed(t){return this._binding.constraint=B(t),this}}class M{constructor(t){this._binding=t}to(t){return this._binding.type=A,this._binding.implementationType=t,new R(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=x,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new R(this._binding)}toConstantValue(t){return this._binding.type=b,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=m,new R(this._binding)}toFactory(t){return this._binding.type=w,this._binding.factory=t,this._binding.scope=m,new R(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}class E{constructor(t){const i=t||{};i.defaultScope=i.defaultScope||y,this.options=i,this.id=e.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new _}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,n,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new C(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),new M(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const n=this.bind(i);return t(n,e),n},i=()=>t=>this.unbind(t),n=()=>t=>this.isBound(t),r=e=>i=>{const n=this.rebind(i);return t(n,e),n};return t=>({bindFunction:e(t),isboundFunction:n(),rebindFunction:r(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),n=Object.keys(i),a=[];for(let t=0;t<n.length;t++){const e=i[t],n={};e.forEach((t=>{n[t.key]=t.value}));const o={inject:n[r],multiInject:n[s]},h=o.inject||o.multiInject,l={serviceIdentifier:h,constructorArgsMetadata:e},c={injectIdentifier:h,metadata:e,bindings:this._bindingDictionary.get(h).filter((t=>t.constraint(l)))};a.push(c)}return a}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case b:case S:e=t.cache;break;case A:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===m&&(t.cache=e,t.activated=!0)}}const k=Symbol("ContributionProvider");class O{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function L(t,e){t(k).toDynamicValue((t=>{let{container:i}=t;return new O(e,i)})).inSingletonScope().whenTargetNamed(e)}function I(t,e){t(k).toDynamicValue((t=>{let{container:i}=t;return new O(e,i)})).whenTargetNamed(e)}class D{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+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>i)){n++;break}}this.taps[n]=t}}class j extends D{call(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.taps.map((t=>t.fn)).forEach((t=>t(...e)))}}const U=Symbol.for("EnvContribution"),W=Symbol.for("VGlobal");var N,G=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},z=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultGlobal=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=e.GenAutoIncrementId(),this.hooks={onSetEnv:new j(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}},t.DefaultGlobal=G([g(),z(0,p(k)),z(0,v(U)),F("design:paramtypes",[Object])],t.DefaultGlobal),t.MeasureModeEnum=void 0,(N=t.MeasureModeEnum||(t.MeasureModeEnum={}))[N.estimate=0]="estimate",N[N.actualBounding=1]="actualBounding",N[N.fontBounding=2]="fontBounding";function H(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var V={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,n,s,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new r(n,s||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,a=new Array(s);r<s;r++)a[r]=n[r].fn;return a},o.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,r,s,a){var o=i?i+t:t;if(!this._events[o])return!1;var h,l,c=this._events[o],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,s),!0;case 6:return c.fn.call(c.context,e,n,r,s,a),!0}for(l=1,h=new Array(u-1);l<u;l++)h[l-1]=arguments[l];c.fn.apply(c.context,h)}else{var d,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),u){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,n);break;case 4:c[l].fn.call(c[l].context,e,n,r);break;default:if(!h)for(d=1,h=new Array(u-1);d<u;d++)h[d-1]=arguments[d];c[l].fn.apply(c[l].context,h)}}return!0},o.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,n,r){var s=i?i+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||n&&o.context!==n||a(this,s);else{for(var h=0,l=[],c=o.length;h<c;h++)(o[h].fn!==e||r&&!o[h].once||n&&o[h].context!==n)&&l.push(o[h]);l.length?this._events[s]=1===l.length?l[0]:l:a(this,s)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o}(V);var Y=H(V.exports);var X=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var $=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||X(t,"Boolean")};var q=t=>"function"==typeof t;var K=t=>null==t;var Z=t=>null!=t;var J=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var Q=t=>"object"==typeof t&&null!==t;var et=function(t){if(!Q(t)||!X(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 it=t=>void 0===t;var nt=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||X(t,"String")};var rt=t=>Array.isArray?Array.isArray(t):X(t,"Array");var st=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var at=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||X(t,"Number")};var ot=t=>at(t)&&Number.isFinite(t);var ht=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var lt=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);const ct=Object.prototype.hasOwnProperty;var ut=(t,e)=>null!=t&&ct.call(t,e);function dt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(Z(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];!Z(r[a])||"object"!=typeof r[a]||n&&rt(t[a])?ft(t,a,r[a]):pt(t,e,a,i,n)}}}}function pt(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=t[i],a=e[i];let o=e[i],h=!0;if(rt(a)){if(n)o=[];else if(rt(s))o=s;else if(st(s)){o=new Array(s.length);let t=-1;const e=s.length;for(;++t<e;)o[t]=s[t]}}else et(a)?(o=null!=s?s:{},"function"!=typeof s&&"object"==typeof s||(o={})):h=!1;h&&dt(o,a,n,r),ft(t,i,o)}function ft(t,e,i){(void 0!==i&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],i)||void 0===i&&!(e in t))&&(t[e]=i)}function gt(t,e){if(!rt(t)||!rt(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const vt="undefined"!=typeof console;function mt(t,e,i){const n=[e].concat([].slice.call(i));vt&&console[t].apply(console,n)}var yt;!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"}(yt||(yt={}));class bt{static getInstance(t,e){return bt._instance&&at(t)?bt._instance.level(t):bt._instance||(bt._instance=new bt(t,e)),bt._instance}static setInstance(t){return bt._instance=t}static setInstanceLevel(t){bt._instance?bt._instance.level(t):bt._instance=new bt(t)}static clearInstance(){bt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt.None,e=arguments.length>1?arguments[1]:void 0;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(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=yt.Info}canLogDebug(){return this._level>=yt.Debug}canLogError(){return this._level>=yt.Error}canLogWarn(){return this._level>=yt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return this._level>=yt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):mt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=yt.Warn&&mt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=yt.Info&&mt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=yt.Debug&&mt(this._method||"log","DEBUG",e),this}}bt._instance=null;const xt=1e-10,wt=1e-10;function St(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:xt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:wt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}var At=function(t,e,i){return t<e?e:t>i?i:t};const Tt=1e-12,Ct=Math.PI,_t=Ct/2,Bt=2*Ct,Pt=2*Math.PI,Rt=Math.abs,Mt=Math.atan2,Et=Math.cos,kt=Math.max,Ot=Math.min,Lt=Math.sin,It=Math.sqrt,Dt=Math.pow;function jt(t){return t>=1?_t:t<=-1?-_t:Math.asin(t)}function Ut(t,e,i,n,r){let s=i,a=n;return"number"==typeof t&&"number"==typeof i&&(s=(1-r)*t+r*i),"number"==typeof e&&"number"==typeof n&&(a=(1-r)*e+r*n),{x:s,y:a}}function Wt(t,e){return t[0]*e[1]-t[1]*e[0]}function Nt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class Gt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Gt(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 at(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return at(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 Ft{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Gt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function zt(t){return t*(Math.PI/180)}const Ht=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function Vt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function Yt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Xt(t,e,i,n){if(!function(t,e,i,n){let r=t[0],s=e[0],a=i[0],o=n[0];return s<r&&([r,s]=[s,r]),o<a&&([o,a]=[a,o]),!(s<a||o<r||(r=t[1],s=e[1],a=i[1],o=n[1],s<r&&([r,s]=[s,r]),o<a&&([o,a]=[a,o]),s<a||o<r))}(t,e,i,n))return!1;const r=[0,0],s=[0,0],a=[0,0];if(Yt(r,e,t),Yt(s,n,i),function(t,e){return Rt(t[0]-e[0])+Rt(t[1]-e[1])<1e-12}(r,s))return!0;Yt(a,i,t);const o=Wt(a,s)/Wt(r,s);return o>=0&&o<=1&&[t[0]+r[0]*o,t[1]+r[1]*o]}var $t;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}($t||($t={}));const qt=(t,e,i)=>{let n=t.x1,r=t.x2,s=t.y1,a=t.y2,o=e.x1,h=e.x2,l=e.y1,c=e.y2;return i&&(n>r&&([n,r]=[r,n]),s>a&&([s,a]=[a,s]),o>h&&([o,h]=[h,o]),l>c&&([l,c]=[c,l])),{x11:n,x12:r,y11:s,y12:a,x21:o,x22:h,y21:l,y22:c}};function Kt(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:n,x12:r,y11:s,y12:a,x21:o,x22:h,y21:l,y22:c}=qt(t,e,!0);return!(n>h||r<o||s>c||a<l)}return!0}function Zt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Jt(t,e){let{x:i,y:n}=t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-r.x)*Math.cos(e)-(n-r.y)*Math.sin(e)+r.x,y:(i-r.x)*Math.sin(e)+(n-r.y)*Math.cos(e)+r.y}}function Qt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function te(t,e){const i=e?zt(t.angle):t.angle,n=Qt(t);return[Jt({x:t.x1,y:t.y1},i,n),Jt({x:t.x2,y:t.y1},i,n),Jt({x:t.x2,y:t.y2},i,n),Jt({x:t.x1,y:t.y2},i,n)]}function ee(t,e,i,n,r,s){if(s>e&&s>n||s<e&&s<n)return 0;if(n===e)return 0;const a=(s-e)/(n-e);let o=n<e?1:-1;1!==a&&0!==a||(o=n<e?.5:-.5);const h=a*(i-t)+t;return h===r?1/0:h>r?o:0}const ie=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function ne(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:r=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(r?r+" ":"")+(s?s+" ":"")+a*i+"px "+(o||"sans-serif")}class re{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),Z(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=Z(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(K(this._canvas)&&(Z(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),K(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&Z(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),K(this._context)&&Z(this._canvas)){const t=this._canvas.getContext("2d");Z(t)&&(t.save(),t.font=ne(this.textSpec),this._contextSaved=!0,this._context=t)}return!K(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:r=n.fontStyle,fontVariant:s=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:h=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:l,textAlign:c=(null!=l?l:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:f}=this._userSpec;let{lineHeight:g=o}=this._userSpec;if(nt(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=o*t}return{fontStyle:r,fontVariant:s,fontFamily:h,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,ellipsis:p,limit:f,lineHeight:g}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(K(t))return{width:0,height:0};if(K(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:s,ellipsis:a,limit:o,lineHeight:h}=this.textSpec;let l;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:s,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:h});l={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(t)}return l}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:r}=this.textSpec;return{width:i.width,height:null!==(e=r)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;i<t.length;i++){const n=t[i];let r=this._measureSpecialChar(n);K(r)&&re.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),K(r)&&["F","W"].includes(ie(n))&&(r=this._measureFullSizeChar()),K(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height),!K(r.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=r.fontBoundingBoxAscent),!K(r.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=r.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let e=0;e<t.length;e++){const r=t[e],s=["F","W"].includes(ie(r))?1:.53;i.width+=s*n}return i.height=null!==(e=r)&&void 0!==e?e:n,i}_measureReduce(t,e){var i;const{fontSize:n,lineHeight:r}=this.textSpec,s={width:0,height:0};if(K(t))return s;if(rt(t)){const a=t.filter(Z).map((t=>t.toString()));return 0===a.length?s:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=r)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(K(this._numberCharSize)){const t=this._standardMethod(re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return K(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(K(this._letterCharSize)){const t=this._standardMethod(re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return Z(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){Z(this._canvas)&&(this._canvas=null),Z(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",re.NUMBERS_CHAR_SET="0123456789",re.FULL_SIZE_CHAR="字";function se(t,e,i){const{x1:n,y1:r,x2:s,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*r+i.e,i.b*n+i.d*r+i.f),t.add(i.a*s+i.c*r+i.e,i.b*s+i.d*r+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class ae{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new ae(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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i<t?(this.x2=t,this.x1=i):(this.x1=t,this.x2=i),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),this}add(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return rt(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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const r=this.scalePoints(t,e,i,n);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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return se(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,i){const{x1:n,y1:r,x2:s,y2:a}=this,o=Math.cos(t),h=Math.sin(t),l=e-e*o+i*h,c=i-e*h-i*o;return[o*n-h*r+l,h*n+o*r+c,o*n-h*a+l,h*n+o*a+c,o*s-h*r+l,h*s+o*r+c,o*s-h*a+l,h*s+o*a+c]}scalePoints(t,e,i,n){const{x1:r,y1:s,x2:a,y2:o}=this;return[t*r+(1-t)*i,e*s+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class oe extends ae{}class he extends ae{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const r=te(t,i),s=te(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Qt(t),h=Qt(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(h.x,h.y,2,2);const l=a(o,h),c=a(r[0],r[1]),u=a(r[1],r[2]),d=a(s[0],s[1]),p=a(s[1],s[2]),f=i?zt(t.angle):t.angle;let g=i?zt(90-t.angle):t.angle+_t;const v=i?zt(e.angle):e.angle;let m=i?zt(90-e.angle):e.angle+_t;g>Pt&&(g-=Pt),m>Pt&&(m-=Pt);const y=(t,e,i,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(Zt(r,i)+Zt(r,n))/2>Zt(r,l)};return y((t.x2-t.x1)/2,f,d,p)&&y((t.y2-t.y1)/2,g,d,p)&&y((e.x2-e.x1)/2,v,c,u)&&y((e.y2-e.y1)/2,m,c,u)}(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,n),this.angle=r,this}}class le{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,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,i,n,r,s){return!(this.e!==r||this.f!==s||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,r,s){return this.a=t,this.b=e,this.c=i,this.d=n,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,i=this.c,n=this.d,r=this.e,s=this.f,a=new le,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*s-n*r)/o,a.f=-(t*s-e*r)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,r=this.b*e+this.d*i,s=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=r,this.c=s,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),r=Math.sin(t),s=(1-n)*e+r*i,a=(1-n)*i-r*e,o=n*this.a-r*this.b,h=r*this.a+n*this.b,l=n*this.c-r*this.d,c=r*this.c+n*this.d,u=n*this.e-r*this.f+s,d=r*this.e+n*this.f+a;return this.a=o,this.b=h,this.c=l,this.d=c,this.e=u,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,i,n,r,s){return this.multiply(t,e,i,n,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:i,d:n,e:r,f:s}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=s,this.f=r,this}multiply(t,e,i,n,r,s){const a=this.a,o=this.b,h=this.c,l=this.d,c=a*t+h*e,u=o*t+l*e,d=a*i+h*n,p=o*i+l*n,f=a*r+h*s+this.e,g=o*r+l*s+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=f,this.f=g,this}interpolate(t,e){const i=new le;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:r,d:s,e:a,f:o}=this,h=i*s-n*r,l=s/h,c=-n/h,u=-r/h,d=i/h,p=(r*o-s*a)/h,f=-(i*o-n*a)/h,{x:g,y:v}=t;e.x=g*l+v*u+p,e.y=g*c+v*d+f}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new le(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,r=t*n-e*i,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*i+e*n)/r,s.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);s.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),s.scaleX=r/a,s.scaleY=a,s.skewX=0,s.skewY=(t*i+e*n)/r}return s.rotateDeg=180*s.rotateDeg/Math.PI,s}}class ce{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<i)return 0;let s=0;const a=e=>{s++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<r)return a(e);let i=0;for(;o-t.timestamp[t.timestamp.length-1-i]<n&&(i++,!(i>=r)););if(i<r)return a(e);for(;o-t.timestamp[0]>n;)t.timestamp.shift()})),s}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function ue(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,r=n*(1-Math.abs(t/60%2-1)),s=i-n/2;let a=0,o=0,h=0;return 0<=t&&t<60?(a=n,o=r,h=0):60<=t&&t<120?(a=r,o=n,h=0):120<=t&&t<180?(a=0,o=n,h=r):180<=t&&t<240?(a=0,o=r,h=n):240<=t&&t<300?(a=r,o=0,h=n):300<=t&&t<360&&(a=n,o=0,h=r),a=Math.round(255*(a+s)),o=Math.round(255*(o+s)),h=Math.round(255*(h+s)),{r:a,g:o,b:h}}function de(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),r=Math.max(t,e,i),s=r-n;let a=0,o=0,h=0;return a=0===s?0:r===t?(e-i)/s%6:r===e?(i-t)/s+2:(t-e)/s+4,a=Math.round(60*a),a<0&&(a+=360),h=(r+n)/2,o=0===s?0:s/(1-Math.abs(2*h-1)),o=+(100*o).toFixed(1),h=+(100*h).toFixed(1),{h:a,s:o,l:h}}const pe=/^#([0-9a-f]{3,8})$/,fe={transparent:4294967040},ge={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ve(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function me(t){return at(t)?new Se(t>>16,t>>8&255,255&t,1):rt(t)?new Se(t[0],t[1],t[2]):new Se(255,255,255)}function ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function be(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const xe=(t,e)=>{const i=pe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Se((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?me(t):8===e?new Se(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class we{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new we(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new we(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof we?t:new we(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(Z(fe[t]))return function(t){return at(t)?new Se(t>>>24,t>>>16&255,t>>>8&255,255&t):rt(t)?new Se(t[0],t[1],t[2],t[3]):new Se(255,255,255,1)}(fe[t]);if(Z(ge[t]))return me(ge[t]);const e=`${t}`.trim().toLowerCase(),i=xe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Se(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Se(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=we.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Se(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,r=de(this.color.r,this.color.g,this.color.b),s=ue(K(t)?r.h:At(t,0,360),K(e)?r.s:e>=0&&e<=1?100*e:e,K(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new Se(s.r,s.g,s.b,n),this}setRGB(t,e,i){return!K(t)&&(this.color.r=t),!K(e)&&(this.color.g=e),!K(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=xe(e,!0);return null!=i?i:this}setColorName(t){const e=ge[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new we(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ye(t.color.r),this.color.g=ye(t.color.g),this.color.b=ye(t.color.b),this}copyLinearToSRGB(t){return this.color.r=be(t.color.r),this.color.g=be(t.color.g),this.color.b=be(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Se{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),Z(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ve(this.r)+ve(this.g)+ve(this.b)+(1===this.opacity?"":ve(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=de(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}const Ae=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),Te=Bt-1e-8;class Ce{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,r,s){if(Math.abs(r-n)>Te)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,h,l,c=1/0,u=-1/0,d=1/0,p=-1/0;function f(t){h=i*Math.cos(t),l=i*Math.sin(t),h<c&&(c=h),h>u&&(u=h),l<d&&(d=l),l>p&&(p=l)}if(f(n),f(r),r!==n)if((n%=Bt)<0&&(n+=Bt),(r%=Bt)<0&&(r+=Bt),r<n&&(s=!s,a=n,n=r,r=a),s)for(r-=Bt,a=n-n%_t,o=0;o<4&&a>r;++o,a-=_t)f(a);else for(a=n-n%_t+_t,o=0;o<4&&a<r;++o,a+=_t)f(a);this.bounds.add(t+c,e+d),this.bounds.add(t+u,e+p)}arcTo(t,e,i,n,r){this.bounds.add(t,e)}bezierCurveTo(t,e,i,n,r,s){this.bounds.add(t,e),this.bounds.add(i,n),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,i,n){this.bounds.add(t,e),this.bounds.add(i,n)}rect(t,e,i,n){this.bounds.add(t,e),this.bounds.add(t+i,e+n)}clear(){this.bounds.clear()}release(){}}class _e{constructor(){this.curves=[],this.bounds=new oe}getCurveLengths(){return this.curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Be=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Pe={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},Re={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Me,Ee,ke,Oe,Le,Ie;function De(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const r=[];for(let t=0,s=e.length;t<s;t++)if(Me=e[t],Ee=Me.slice(1),ke=Me[0],i=[ke],n=Ee.match(Be),null!==n){for(let t=0,e=n.length;t<e;t++)Oe=n[t],Le=parseFloat(Oe),Number.isNaN(Le)||i.push(Le);if(Ie=Pe[ke],i.length-1>Ie){let t,e=ke;for(let n=1,s=i.length;n<s;n+=Ie){t=[e];for(let e=n,r=n+Ie;e<r;e++)t.push(i[e]);r.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else r.push(i)}else r.push(i);return r}var je,Ue,We,Ne,Ge,Fe,ze,He;function Ve(t,e,i,n,r,s,a,o,h){const l=zt(a),c=Math.sin(l),u=Math.cos(l),d=u*(o-t)*.5+c*(h-e)*.5,p=u*(h-e)*.5-c*(o-t)*.5;let f=d*d/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);f>1&&(f=Math.sqrt(f),i*=f,n*=f);const g=u/i,v=c/i,m=-c/n,y=u/n,b=g*o+v*h,x=m*o+y*h,w=g*t+v*e,S=m*t+y*e;let A=1/((w-b)*(w-b)+(S-x)*(S-x))-.25;A<0&&(A=0);let T=Math.sqrt(A);s===r&&(T=-T);const C=.5*(b+w)-T*(S-x),_=.5*(x+S)+T*(w-b),B=Math.atan2(x-_,b-C);let P=Math.atan2(S-_,w-C)-B;P<0&&1===s?P+=Bt:P>0&&0===s&&(P-=Bt);const R=Math.ceil(Math.abs(P/(_t+.001))),M=[];for(let t=0;t<R;++t){const e=B+t*P/R,r=B+(t+1)*P/R;M[t]=[C,_,e,r,i,n,c,u]}return M}function Ye(t){const e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],h=t[7],l=h*s,c=-o*a,u=o*s,d=h*a,p=Math.cos(n),f=Math.sin(n),g=Math.cos(r),v=Math.sin(r),m=.5*(r-n),y=Math.sin(.5*m),b=8/3*y*y/Math.sin(m),x=e+p-b*f,w=i+f+b*p,S=e+g,A=i+v,T=S+b*v,C=A-b*g;return[l*x+c*w,u*x+d*w,l*T+c*C,u*T+d*C,l*S+c*A,u*S+d*A]}function Xe(t,e,i,n){const r=Ve(n[5],n[6],n[0],n[1],n[3],n[4],n[2],e,i);for(let e=0;e<r.length;++e){const i=Ye(r[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}t.UpdateTag=void 0,(je=t.UpdateTag||(t.UpdateTag={}))[je.NONE=0]="NONE",je[je.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",je[je.UPDATE_SHAPE=2]="UPDATE_SHAPE",je[je.CLEAR_SHAPE=253]="CLEAR_SHAPE",je[je.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",je[je.INIT=179]="INIT",je[je.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",je[je.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",je[je.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",je[je.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",je[je.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",je[je.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",je[je.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",je[je.CLEAR_LAYOUT=127]="CLEAR_LAYOUT",t.IContainPointMode=void 0,(Ue=t.IContainPointMode||(t.IContainPointMode={}))[Ue.GLOBAL=1]="GLOBAL",Ue[Ue.LOCAL=16]="LOCAL",Ue[Ue.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",Ue[Ue.LOCAL_ACCURATE=48]="LOCAL_ACCURATE",t.AttributeUpdateType=void 0,(We=t.AttributeUpdateType||(t.AttributeUpdateType={}))[We.INIT=0]="INIT",We[We.DEFAULT=1]="DEFAULT",We[We.STATE=2]="STATE",We[We.ANIMATE_BIND=10]="ANIMATE_BIND",We[We.ANIMATE_PLAY=11]="ANIMATE_PLAY",We[We.ANIMATE_START=12]="ANIMATE_START",We[We.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",We[We.ANIMATE_END=14]="ANIMATE_END",We[We.TRANSLATE=20]="TRANSLATE",We[We.TRANSLATE_TO=21]="TRANSLATE_TO",We[We.SCALE=22]="SCALE",We[We.SCALE_TO=23]="SCALE_TO",We[We.ROTATE=24]="ROTATE",We[We.ROTATE_TO=25]="ROTATE_TO",t.AnimateStatus=void 0,(Ne=t.AnimateStatus||(t.AnimateStatus={}))[Ne.INITIAL=0]="INITIAL",Ne[Ne.RUNNING=1]="RUNNING",Ne[Ne.PAUSED=2]="PAUSED",Ne[Ne.END=3]="END",t.AnimateMode=void 0,(Ge=t.AnimateMode||(t.AnimateMode={}))[Ge.NORMAL=0]="NORMAL",Ge[Ge.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY",t.AnimateStepType=void 0,(Fe=t.AnimateStepType||(t.AnimateStepType={})).wait="wait",Fe.from="from",Fe.to="to",Fe.customAnimate="customAnimate",t.Direction=void 0,function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(t.Direction||(t.Direction={})),t.CurveTypeEnum=void 0,(ze=t.CurveTypeEnum||(t.CurveTypeEnum={}))[ze.CubicBezierCurve=0]="CubicBezierCurve",ze[ze.QuadraticBezierCurve=1]="QuadraticBezierCurve",ze[ze.ArcCurve=2]="ArcCurve",ze[ze.LineCurve=3]="LineCurve",ze[ze.EllipseCurve=4]="EllipseCurve",ze[ze.MoveCurve=5]="MoveCurve",t.BaseRenderContributionTime=void 0,(He=t.BaseRenderContributionTime||(t.BaseRenderContributionTime={}))[He.beforeFillStroke=0]="beforeFillStroke",He[He.afterFillStroke=1]="afterFillStroke";const $e=(t,e,i,n,r,s,a)=>{const o=Math.abs(i-e),h=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,l=(i-e)/h;for(let i=0;i<h;i++){const o=e+l*i,h=e+l*(i+1),c=4*Math.tan(Math.abs(l)/4)/3,u=h<o?-1:1,d=Math.cos(o),p=Math.sin(o),f=Math.cos(h),g=Math.sin(h),v=d*s+n,m=p*a+r,y=f*s+n,b=g*a+r,x=s*c*u,w=a*c*u;t.push(v-x*p,m+w*d,y+x*g,b-w*f,y,b)}},qe=[(t,e,i,n,r,s,a)=>e.arc(t[1]*r+i,t[2]*s+n,t[3]*(r+s)/2,t[4],t[5],t[6],a),(t,e,i,n,r,s,a)=>e.arcTo(t[1]*r+i,t[2]*s+n,t[3]*r+i,t[4]*s+n,t[5]*(r+s)/2,a),(t,e,i,n,r,s,a)=>e.bezierCurveTo(t[1]*r+i,t[2]*s+n,t[3]*r+i,t[4]*s+n,t[5]*r+i,t[6]*s+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,r,s)=>e.ellipse(t[1]*r+i,t[2]*s+n,t[3]*r,t[4]*s,t[5],t[6],t[7],t[8]),(t,e,i,n,r,s,a)=>e.lineTo(t[1]*r+i,t[2]*s+n,a),(t,e,i,n,r,s,a)=>e.moveTo(t[1]*r+i,t[2]*s+n,a),(t,e,i,n,r,s,a)=>e.quadraticCurveTo(t[1]*r+i,t[2]*s+n,t[3]*r+i,t[4]*s+n,a),(t,e,i,n,r,s,a)=>e.rect(t[1]*r+i,t[2]*s+n,t[3]*r,t[4]*s,a)];function Ke(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;o<t.length;o++){const h=t[o];qe[h[0]](h,e,i,n,r,s,a)}}class Ze{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Je(t,e){let i=0;const n=t.length;for(let r=0;r<n;r++){const s=t[r],a=e[r],o=t[(r+1)%n],h=e[(r+1)%n];i+=Ft.distanceNN(s,a,o,h)}return i/2}function Qe(t,e,i,n,r){return Je([t.x,e.x,i.x,n.x],[t.y,e.y,i.y,n.y])}function ti(t,e,i,n,r){const s=1-r;return s*s*s*t+3*e*r*s*s+3*i*r*r*s+n*r*r*r}function ei(t,e,i,n,r){const s=ti(t.x,e.x,i.x,n.x,r),a=ti(t.y,e.y,i.y,n.y,r);return new Gt(s,a)}function ii(t,e){const{p0:i,p1:n,p2:r,p3:s}=t,a=ei(i,n,r,s,e),o=Ft.pointAtPP(i,n,e),h=Ft.pointAtPP(n,r,e),l=Ft.pointAtPP(r,s,e),c=Ft.pointAtPP(o,h,e),u=Ft.pointAtPP(h,l,e);return[new ni(i,o,c,a),new ni(a,u,l,s)]}class ni extends Ze{constructor(e,i,n,r){super(),this.type=t.CurveTypeEnum.CubicBezierCurve,this.p0=e,this.p1=i,this.p2=n,this.p3=r}_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 ei(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?Qe(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(e){return e===t.Direction.ROW?Rt(this.p0.x-this.p3.x):e===t.Direction.COLUMN?Rt(this.p0.y-this.p3.y):0}getAngleAt(t){const e=kt(t-.01,0),i=Ot(t+.01,1),n=this.getPointAt(e),r=this.getPointAt(i);return Mt(r.y-n.y,r.x-n.x)}}function ri(t,e){const{p0:i,p1:n}=t,r=Ft.pointAtPP(i,n,e);return[new si(i,r),new si(r,n)]}class si extends Ze{constructor(e,i){super(),this.type=t.CurveTypeEnum.LineCurve,this.p0=e,this.p1=i}getPointAt(t){if(!1!==this.defined)return Ft.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Mt(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()?Ft.distancePP(this.p0,this.p1):60}calcProjLength(e){return e===t.Direction.ROW?Rt(this.p0.x-this.p1.x):e===t.Direction.COLUMN?Rt(this.p0.y-this.p1.y):0}}class ai{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,i,n,r,s,a,o){const h=new ni(new Gt(this._lastX,this._lastY),new Gt(t,e),new Gt(i,n),new Gt(r,s));h.originP1=this._lastOriginP,h.originP2=o,h.defined=a,this.curves.push(h),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,i,n){const r=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,r){const s=new si(new Gt(this._lastX,this._lastY),new Gt(t,e));return s.originP1=n,s.originP2=r,s.defined=i,s}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(e){var i,n;if(e===t.Direction.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Rt(t.p0.y-n.y)}if(e===t.Direction.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 Rt(t.p0.x-i.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class oi extends ai{bezierCurveTo(t,e,i,n,r,s,a,o){return super.bezierCurveTo(e,t,n,i,s,r,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function hi(t,e){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 li(e,i,n){const r=null!=i?i:Rt(n[n.length-1].x-n[0].x)>Rt(n[n.length-1].y-n[0].y)?t.Direction.ROW:t.Direction.COLUMN;return"monotoneY"===e?new oi(e,r):new ai(e,r)}class ci{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,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ui(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const r=li("linear",i,t);return di(new ci(r,n),t),r}function di(t,e){return hi(t,e)}function pi(t,e,i,n,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+i)/6,n,t.lastPoint1)}class fi{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&&pi(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,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:pi(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function gi(t,e){return hi(t,e)}function vi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return ui(t,e);const r=li("basis",i,t);return gi(new fi(r,n),t),r}function mi(t){return t<0?-1:1}function yi(t,e,i){const n=t._x1-t._x0,r=e-t._x1,s=(t._y1-t._y0)/(n||Number(r<0&&-0)),a=(i-t._y1)/(r||Number(n<0&&-0)),o=(s*r+a*n)/(n+r);return(mi(s)+mi(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function bi(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function xi(t,e,i,n,r){const s=t._x0,a=t._y0,o=t._x1,h=t._y1,l=(o-s)/3;t.context.bezierCurveTo(s+l,a+l*e,o-l,h-l*i,o,h,n,t.lastPoint1)}class wi{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:xi(this,this._t0,bi(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 i=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,xi(this,bi(this,e=yi(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:xi(this,this._t0,e=yi(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Si extends wi{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Ai(t,e){return hi(t,e)}function Ti(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return ui(t,e);const r=li("monotoneX",i,t);return Ai(new wi(r,n),t),r}function Ci(t,e){return hi(t,e)}function _i(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return ui(t,e);const r=li("monotoneY",i,t);return Ci(new Si(r,n),t),r}let Bi=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}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,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Pi(e,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:s}=n;if(e.length<2-Number(!!s))return null;const a=new ai("step",null!=r?r:Rt(e[e.length-1].x-e[0].x)>Rt(e[e.length-1].y-e[0].y)?t.Direction.ROW:t.Direction.COLUMN);return Ri(new Bi(a,i,s),e),a}function Ri(t,e){return hi(t,e)}class Mi extends ci{lineEnd(){this.context.closePath()}}function Ei(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const r=li("linear",i,t);return ki(new Mi(r,n),t),r}function ki(t,e){return hi(t,e)}function Oi(t,e,i,n,r){let s=t._x1,a=t._y1,o=t._x2,h=t._y2;if(t._l01_a>Tt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);s=(s*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Tt){const n=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*n+t._x1*t._l23_2a-e*t._l12_2a)/r,h=(h*n+t._y1*t._l23_2a-i*t._l12_2a)/r}t.context.bezierCurveTo(s,a,o,h,t._x2,t._y2,n,t.lastPoint1)}function Li(t,e){return function(i,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:a}=r;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return ui(i,r);const o=li(t,s,i);return hi(new e(o,n,a),i),o}}const Ii=Li("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,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:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Oi(this,e,i,!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=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Di=Li("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,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:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Oi(this,e,i,!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=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ji(t,e,i){var n,r;switch(e){case"linear":default:return ui(t,i);case"basis":return vi(t,i);case"monotoneX":return Ti(t,i);case"monotoneY":return _i(t,i);case"step":return Pi(t,.5,i);case"stepBefore":return Pi(t,0,i);case"stepAfter":return Pi(t,1,i);case"catmullRom":return Ii(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return Di(t,null!==(r=null==i?void 0:i.curveTension)&&void 0!==r?r:.5,i);case"linearClosed":return Ei(t,i)}}class Ui extends _e{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Ce(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Re.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Re.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([Re.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.commandList.push([Re.C,t,e,i,n,r,s]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,r,s),this}arcTo(t,e,i,n,r){return this.commandList.push([Re.AT,t,e,i,n,r]),this._ctx&&this._ctx.arcTo(t,e,i,n,r),this}ellipse(t,e,i,n,r,s,a,o){return this.commandList.push([Re.E,t,e,i,n,r,s,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,r,s,a,o),this}rect(t,e,i,n){return this.commandList.push([Re.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,r,s){return this.commandList.push([Re.A,t,e,i,n,r,s]),this._ctx&&this._ctx.arc(t,e,i,n,r,s),this}closePath(){return this.commandList.push([Re.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[Re.M]=t=>`M${t[1]} ${t[2]}`,t[Re.L]=t=>`L${t[1]} ${t[2]}`,t[Re.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Re.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Re.A]=t=>{const e=[];$e(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t<e.length;t+=6)i+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return i},t[Re.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Re.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,r){this.clear();const s=De(t);return this._runCommandStrList(s,e,i,n,r),this._updateBounds(),this}fromLine(e){const{points:i,curveType:n,clipRangeByDimension:r}=e.attribute;if(!i)return;const s=ji(i,n);"x"===r?this.direction=t.Direction.ROW:"y"===r?this.direction=t.Direction.COLUMN:"auto"===r&&(this.direction=s.direction),this.curves=s.curves}fromCustomPath2D(t,e,i,n,r){return this.clear(),this._runCommandList(t.commandList,e,i,n,r),this._updateBounds(),this}transform(t,e,i,n){const r=this.commandList;if(!this.transformCbList){const t=[];t[Re.M]=this.moveToTransform,t[Re.L]=this.lineToTransform,t[Re.Q]=this.quadraticCurveToTransform,t[Re.C]=this.bezierCurveToTransform,t[Re.AT]=this.arcToTransform,t[Re.E]=this.ellipseTransform,t[Re.R]=this.rectTransform,t[Re.A]=this.arcTransform,t[Re.Z]=this.closePathTransform,this.transformCbList=t}r.forEach((r=>{this.transformCbList[r[0]](r,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*n+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*(n+r)/2}ellipseTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}rectTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}arcTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*(n+r)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,r,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,u=0,d=0,p=0,f=0;for(let g=0,v=t.length;g<v;++g){switch(e=t[g],1===h&&1===l||(e=Ni(e,h,l)),e[0]){case"l":u+=e[1],d+=e[2],this.lineTo(u+a,d+o);break;case"L":u=e[1],d=e[2],this.lineTo(u+a,d+o);break;case"h":u+=e[1],this.lineTo(u+a,d+o);break;case"H":u=e[1],this.lineTo(u+a,d+o);break;case"v":d+=e[1],this.lineTo(u+a,d+o);break;case"V":d=e[1],this.lineTo(u+a,d+o);break;case"m":u+=e[1],d+=e[2],this.moveTo(u+a,d+o);break;case"M":u=e[1],d=e[2],this.moveTo(u+a,d+o);break;case"c":i=u+e[5],n=d+e[6],p=u+e[3],f=d+e[4],this.bezierCurveTo(u+e[1]+a,d+e[2]+o,p+a,f+o,i+a,n+o),u=i,d=n;break;case"C":u=e[5],d=e[6],p=e[3],f=e[4],this.bezierCurveTo(e[1]+a,e[2]+o,p+a,f+o,u+a,d+o);break;case"s":i=u+e[3],n=d+e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+a,f+o,u+e[1]+a,d+e[2]+o,i+a,n+o),p=u+e[1],f=d+e[2],u=i,d=n;break;case"S":i=e[3],n=e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+a,f+o,e[1]+a,e[2]+o,i+a,n+o),u=i,d=n,p=e[1],f=e[2];break;case"q":i=u+e[3],n=d+e[4],p=u+e[1],f=d+e[2],this.quadraticCurveTo(p+a,f+o,i+a,n+o),u=i,d=n;break;case"Q":i=e[3],n=e[4],this.quadraticCurveTo(e[1]+a,e[2]+o,i+a,n+o),u=i,d=n,p=e[1],f=e[2];break;case"t":i=u+e[1],n=d+e[2],null===c[0].match(/[QqTt]/)?(p=u,f=d):"t"===c[0]?(p=2*u-r,f=2*d-s):"q"===c[0]&&(p=2*u-p,f=2*d-f),r=p,s=f,this.quadraticCurveTo(p+a,f+o,i+a,n+o),u=i,d=n,p=u+e[1],f=d+e[2];break;case"T":i=e[1],n=e[2],p=2*u-p,f=2*d-f,this.quadraticCurveTo(p+a,f+o,i+a,n+o),u=i,d=n;break;case"a":Xe(this,u+a,d+o,[e[1],e[2],e[3],e[4],e[5],e[6]+u+a,e[7]+d+o]),u+=e[6],d+=e[7];break;case"A":Xe(this,u+a,d+o,[e[1],e[2],e[3],e[4],e[5],e[6]+a,e[7]+o]),u=e[6],d=e[7];break;case"z":case"Z":this.closePath()}c=e}}_runCommandList(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==r)for(let s=0,a=t.length;s<a;++s){const a=t[s].slice();switch(a[0]){case Re.L:this.lineToTransform(a,e,i,n,r);break;case Re.M:this.moveToTransform(a,e,i,n,r);break;case Re.C:this.bezierCurveToTransform(a,e,i,n,r);break;case Re.Q:this.quadraticCurveToTransform(a,e,i,n,r);break;case Re.A:this.arcToTransform(a,e,i,n,r);break;case Re.E:this.ellipseTransform(a,e,i,n,r);break;case Re.R:this.rectTransform(a,e,i,n,r);break;case Re.AT:this.arcToTransform(a,e,i,n,r);break;case Re.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Ke(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===t.Direction.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.y-e.p1.y)}if(this.direction===t.Direction.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n<this.curves.length;n++){e=this.curves[n];const r=e.getLength(this.direction);if(i+r>=t)break;i+=r}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Wi=["l",0,0,0,0,0,0,0];function Ni(t,e,i){const n=Wi[0]=t[0];if("a"===n||"A"===n)Wi[1]=e*t[1],Wi[2]=i*t[2],Wi[3]=t[3],Wi[4]=t[4],Wi[5]=t[5],Wi[6]=e*t[6],Wi[7]=i*t[7];else if("h"===n||"H"===n)Wi[1]=e*t[1];else if("v"===n||"V"===n)Wi[1]=i*t[1];else for(let n=1,r=t.length;n<r;++n)Wi[n]=(n%2==1?e:i)*t[n];return Wi}const Gi={alignSelf:"auto"},Fi={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new le},zi={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},Hi={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Vi=Object.assign({outerBorder:Object.assign(Object.assign({},Hi),{distance:0}),innerBorder:Object.assign(Object.assign({},Hi),{distance:0})},Hi),Yi={text:"",maxLineWidth:1/0,maxWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:t.MeasureModeEnum.fontBounding,keepCenterInLine:!1},Xi={pickStrokeBuffer:0},$i=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,blur:0,cursor:null,html:null,react:null},zi),Vi),Gi),Xi),qi={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},Ki={_debug_bounds:!1},Zi=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1},Ki),$i),Fi);const Ji=Object.assign(Object.assign({},Zi),{startAngle:0,endAngle:Pt,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),Qi=Object.assign(Object.assign(Object.assign({},Zi),qi),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),tn=Object.assign(Object.assign({},Zi),{radius:1,startAngle:0,endAngle:Pt}),en=Object.assign(Object.assign({},Zi),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start",baseOpacity:1}),nn=Object.assign(Object.assign({},Zi),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),rn=Object.assign(Object.assign(Object.assign({},Zi),qi),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),sn=Object.assign(Object.assign({},Zi),{path:new Ui,fillStrokeOrder:1,customPath:()=>{bt.getInstance().warn("空函数")}}),an=Object.assign(Object.assign({},Zi),{points:[],cornerRadius:0,closePath:!0}),on=Object.assign(Object.assign({},Zi),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),hn=Object.assign(Object.assign({},Zi),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),ln=Object.assign(Object.assign({},Zi),{symbolType:"circle",size:10,keepDirIn3d:!0}),cn=Object.assign(Object.assign(Object.assign({},Zi),Yi),{strokeBoundsBuffer:0,keepDirIn3d:!0}),un=Object.assign(Object.assign(Object.assign({},Zi),Yi),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),dn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Zi),{fill:!0,cornerRadius:0}),pn=Object.assign(Object.assign({},dn),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class fn{}const gn=new fn,vn=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function n(){return r("linear",t.linearGradient,s)||r("radial",t.radialGradient,o)||r("conic",t.conicGradient,a)}function r(e,n,r){return function(n,s){const a=m(n);if(a){m(t.startCall)||i("Missing (");const n=function(n){const s=r();return s&&(m(t.comma)||i("Missing comma before color stops")),{type:e,orientation:s,colorStops:d(p)}}();return m(t.endCall)||i("Missing )"),n}}(n)}function s(){return v("directional",t.sideOrCorner,1)||v("angular",t.angleValue,1)}function a(){return v("angular",t.fromAngleValue,1)}function o(){let i,n,r=h();return r&&(i=[],i.push(r),n=e,m(t.comma)&&(r=h(),r?i.push(r):e=n)),i}function h(){let t=function(){const t=v("shape",/^(circle)/i,0);return t&&(t.style=g()||l()),t}()||function(){const t=v("shape",/^(ellipse)/i,0);return t&&(t.style=f()||l()),t}();if(t)t.at=c();else{const e=l();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=u();e&&(t={type:"default-radial",at:e})}}return t}function l(){return v("extent-keyword",t.extentKeywords,1)}function c(){if(v("position",/^at/,0)){const t=u();return t||i("Missing positioning value"),t}}function u(){const t={x:f(),y:f()};if(t.x||t.y)return{type:"position",value:t}}function d(e){let n=e();const r=[];if(n)for(r.push(n);m(t.comma);)n=e(),n?r.push(n):i("One extra comma");return r}function p(){const e=v("hex",t.hexColor,1)||v("rgba",t.rgbaColor,1)||v("rgb",t.rgbColor,1)||v("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=f(),e}function f(){return v("%",t.percentageValue,1)||v("position-keyword",t.positionKeywords,1)||g()}function g(){return v("px",t.pixelValue,1)||v("em",t.emValue,1)}function v(t,e,i){const n=m(e);if(n)return{type:t,value:n[i]}}function m(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const n=t.exec(e);return n&&y(n[0].length),n}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(n);return e.length>0&&i("Invalid input not EOF"),t}()}}();class mn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(mn.IsGradientStr(t))try{const e=vn(t)[0];if(e){if("linear"===e.type)return mn.ParseLinear(e);if("radial"===e.type)return mn.ParseRadial(e);if("conic"===e.type)return mn.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=Ct/2,r=parseFloat(e.value)/180*Ct-n;return{gradient:"conical",x:.5,y:.5,startAngle:r,endAngle:r+Pt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=Ct/2;let r="angular"===e.type?parseFloat(e.value)/180*Ct:0;for(;r<0;)r+=Pt;for(;r>=Pt;)r-=Pt;let s=0,a=0,o=0,h=0;return r<n?(s=0,a=1,o=Math.sin(r),h=a-Math.cos(r)):r<Ct?(s=0,a=0,o=Math.cos(r-n),h=Math.sin(r-n)):r<Ct+n?(s=1,a=0,o=s-Math.sin(r-Ct),h=Math.cos(r-Ct)):(s=1,o=s-Math.cos(r-n-Ct),h-=Math.sin(r-n-Ct)),{gradient:"linear",x0:s,y0:a,x1:o,y1:h,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function yn(t,e,i){let n=e;const{a:r,b:s,c:a,d:o}=t.currentMatrix,h=Math.sign(r)*Math.sqrt(r*r+s*s),l=Math.sign(o)*Math.sqrt(a*a+o*o);return h+l===0?0:(n=n/Math.abs(h+l)*2*i,n)}function bn(t,e,i){let n,r,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(rt(e))for(let t=0;t<e.length&&(r=e[t],!r);t++);else r=e;if(r=mn.Parse(r),"string"==typeof r)return r;if(i.AABBBounds&&(!i.attribute||0!==i.attribute.scaleX||0!==i.attribute.scaleY)){const e=i.AABBBounds;let o=e.x2-e.x1,h=e.y2-e.y1,l=e.x1-s,c=e.y1-a;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;o/=t,h/=e,l/=t,c/=e}"linear"===r.gradient?n=function(t,e,i,n,r,s){var a,o,h,l;const c=t.createLinearGradient(i+(null!==(a=e.x0)&&void 0!==a?a:0)*r,n+(null!==(o=e.y0)&&void 0!==o?o:0)*s,i+(null!==(h=e.x1)&&void 0!==h?h:1)*r,n+(null!==(l=e.y1)&&void 0!==l?l:0)*s);return e.stops.forEach((t=>{c.addColorStop(t.offset,t.color)})),c}(t,r,l,c,o,h):"conical"===r.gradient?n=function(t,e,i,n,r,s){var a,o;const h=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*r,n+(null!==(o=e.y)&&void 0!==o?o:0)*s,e.startAngle,e.endAngle);return e.stops.forEach((t=>{h.addColorStop(t.offset,t.color)})),h.GetPattern(r+i,s+n,void 0)}(t,r,l,c,o,h):"radial"===r.gradient&&(n=function(t,e,i,n,r,s){var a,o,h,l,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*r,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*s,Math.max(r,s)*(null!==(h=e.r0)&&void 0!==h?h:0),i+(null!==(l=e.x1)&&void 0!==l?l:.5)*r,n+(null!==(c=e.y1)&&void 0!==c?c:.5)*s,Math.max(r,s)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,r,l,c,o,h))}return n||"orange"}const xn={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},wn=!0,Sn=!1,An=/\w|\(|\)|-/,Tn=/[.?!,;:/,。?!、;:]/,Cn=/\S/,_n=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Bn(t,e,i,n,r){if(!e||e<=0)return 0;const s=gn.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),h=Math.floor(s.measureText(o,i).width),l=t.slice(0,a+1),c=Math.floor(s.measureText(l,i).width);for(;h>e||c<=e;){if(h>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),h=Math.floor(s.measureText(o,i).width),l=t.slice(0,a+1),c=Math.floor(s.measureText(l,i).width)}return r&&(a=Pn(t,a)),a}function Pn(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e;for(;An.test(t[n-1])&&An.test(t[n])||Tn.test(t[n]);)if(n--,n<=0)return i?Rn(t,e):e;return n}function Rn(t,e){let i=e;for(;An.test(t[i-1])&&An.test(t[i])||Tn.test(t[i]);)if(i++,i>=t.length)return i;return i}function Mn(t,e){const i=gn.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var En=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let kn=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,e){let{fontSize:i=cn.fontSize}=e,n=0,r=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:r++;return{width:~~(.8*n*i+r*i),height:i}}measureTextWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,i){return this.context?{left:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:i.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:Yi.fontSize}measureTextPixelADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:Yi.fontSize}measureTextBoundADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:i.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Yi.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Yi.fontSize,{textAlign:n}=t;return"center"===n?{left:i/2,right:i/2}:"right"===n||"end"===n?{left:i,right:0}:{left:0,right:i}}measureTextPixelADscentAndWidth(e,i,n){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(i)),{width:this.estimate(e,i).width});const r=this._measureTextWithoutAlignBaseline(e,i,!0);if(n===t.MeasureModeEnum.actualBounding)return{ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,width:r.width};if(n===t.MeasureModeEnum.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(i)),{width:r.width});if(n===t.MeasureModeEnum.fontBounding){let t=r.fontBoundingBoxAscent,e=r.fontBoundingBoxDescent;if(r.actualBoundingBoxDescent&&e<r.actualBoundingBoxDescent){const i=r.actualBoundingBoxDescent-e;e+=i,t-=i}else if(r.actualBoundingBoxAscent&&t<r.actualBoundingBoxAscent){const i=r.actualBoundingBoxAscent-t;t+=i,e-=i}return{ascent:t,descent:e,width:r.width}}return{ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,width:r.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,n){if(0===t.length)return{verticalList:t,width:0};const{fontSize:r=12}=e;t.forEach((t=>{t.width=0===t.direction?r:this.measureTextWidth(t.text,e)}));const s=[];let a=0,o=0;for(;o<t.length&&a+t[o].width<i;o++)a+=t[o].width,s.push(t[o]);if(t[o]&&t[o].text.length>1){const r=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&r.str!==t[o].text){let i="",n=0;for(let e=0;e<o;e++){const r=t[e];i+=r.text,n+=r.text.length}i+=t[o].text;let s=Pn(i,n+r.str.length);s-=n,s!==r.str.length-1&&(r.str=r.str.substring(0,s),r.width=this.measureTextWidth(r.str,e))}s.push(Object.assign(Object.assign({},t[o]),{text:r.str,width:r.width})),a+=r.width}return{verticalList:s,width:a}}clipText(t,e,i,n,r){if(0===t.length)return{str:"",width:0};let s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};if(s=this.measureTextWidth(t[0],e),s>i)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=Pn(t,a.str.length,r);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,r,s,a){let o;if("start"===s)o=this._clipTextStart(t,e,i,n,r),a&&(o.result=a+o.str);else if("middle"===s){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,r),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,r){if(n===r){bt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${r}`);const i=t.substring(0,r+1);return{str:i,width:this.measureTextWidth(i,e)}}const s=Math.floor((n+r)/2),a=t.substring(0,s+1),o=this.measureTextWidth(a,e);let h;if(o>i){if(a.length<=1)return{str:"",width:0};const r=t.substring(0,s);return h=this.measureTextWidth(r,e),h<=i?{str:r,width:h}:this._clipTextEnd(t,e,i,n,s)}if(o<i){if(s>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,s+2);return h=this.measureTextWidth(n,e),h>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,s,r)}return{str:a,width:o}}_clipTextStart(t,e,i,n,r){const s=Math.ceil((n+r)/2),a=t.substring(s-1,t.length),o=this.measureTextWidth(a,e);let h;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(s,t.length);return h=this.measureTextWidth(n,e),h<=i?{str:n,width:h}:this._clipTextStart(t,e,i,s,t.length)}if(o<i){if(s<=0)return{str:t,width:this.measureTextWidth(t,e)};const r=t.substring(s-2,t.length);return h=this.measureTextWidth(r,e),h>=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,s)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,r,s,a,o){const h=t.substring(0,o),l=this.measureTextWidth(h,e);if(l+a>i)return{left:n,right:r,width:s+a};const c=t.substring(t.length-o,t.length),u=this.measureTextWidth(c,e);return l+u>i?{left:h,right:r,width:l+a}:this._clipTextMiddle(t,e,i,h,c,l,u,o+1)}clipTextWithSuffixVertical(t,e,i,n,r,s){if(""===n)return this.clipTextVertical(t,e,i,r);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,r);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let h;if(i-=o,"start"===s){const s=this.revertVerticalList(t);h=this.clipTextVertical(s,e,i,r);const a=this.revertVerticalList(h.verticalList);a.unshift({text:n,direction:1,width:o}),h.verticalList=a}else if("middle"===s){const s=this.clipTextVertical(t,e,i/2,r),a=this.revertVerticalList(t),l=this.clipTextVertical(a,e,i/2,r);s.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(l.verticalList).forEach((t=>s.verticalList.push(t))),h={verticalList:s.verticalList,width:s.width+l.width}}else h=this.clipTextVertical(t,e,i,r),h.verticalList.push({text:n,direction:1,width:o});return h.width+=o,h}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,r,s){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===n)return this.clipText(t,e,i,r);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const h=this.measureTextWidth(n,e);if(h>i)return{str:"",width:0};if(a&&o+h<=i)return{str:t+n,width:o+h};i-=h;const l=this._clipText(t,e,i,0,t.length-1,s,n);if(r&&l.str!==t){const i=Pn(t,l.str.length);i!==l.str.length&&(l.result=t.substring(0,i),l.width=this.measureTextWidth(l.str,e))}else a&&l.str===t&&(l.result=t+n);return l.str=l.result,l.width+=h,l}};kn=En([g()],kn);var On=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Ln=Symbol.for("TextMeasureContribution");t.DefaultTextMeasureContribution=class extends kn{},t.DefaultTextMeasureContribution=On([g()],t.DefaultTextMeasureContribution);const In=new E,Dn=Symbol.for("CanvasFactory"),jn=Symbol.for("Context2dFactory");function Un(t){return In.getNamed(Dn,gn.global.env)(t)}const Wn=1e-4,Nn=Math.sqrt(3),Gn=1/3;function Fn(t){return t>-er&&t<er}function zn(t){return t>er||t<-er}const Hn=[0,0],Vn=[0,0],Yn=[0,0];function Xn(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function $n(t,e,i,n){const r=1-n;return r*(r*t+2*n*e)+n*n*i}function qn(t,e,i,n,r){const s=1-r;return s*s*(s*t+3*r*e)+r*r*(r*n+3*s*i)}function Kn(t){return(t%=Pt)<0&&(t+=Pt),t}function Zn(t,e,i,n,r,s,a,o,h){if(0===a)return!1;const l=a;return!(h>e+l&&h>n+l&&h>s+l||h<e-l&&h<n-l&&h<s-l||o>t+l&&o>i+l&&o>r+l||o<t-l&&o<i-l&&o<r-l)&&function(t,e,i,n,r,s,a,o,h){let l=0,c=.005,u=1/0;Hn[0]=a,Hn[1]=o;for(let a=0;a<1;a+=.05){Vn[0]=$n(t,i,r,a),Vn[1]=$n(e,n,s,a);const o=Xn(Hn,Vn);o<u&&(l=a,u=o)}u=1/0;for(let a=0;a<32&&!(c<Wn);a++){const a=l-c,o=l+c;Vn[0]=$n(t,i,r,a),Vn[1]=$n(e,n,s,a);const h=Xn(Vn,Hn);if(a>=0&&h<u)l=a,u=h;else{Yn[0]=$n(t,i,r,o),Yn[1]=$n(e,n,s,o);const a=Xn(Yn,Hn);o<=1&&a<u?(l=o,u=a):c*=.5}}return h&&(h[0]=$n(t,i,r,l),h[1]=$n(e,n,s,l)),Math.sqrt(u)}(t,e,i,n,r,s,o,h,null)<=l/2}function Jn(t,e,i,n,r,s,a,o,h,l,c){if(0===h)return!1;const u=h;return!(c>e+u&&c>n+u&&c>s+u&&c>o+u||c<e-u&&c<n-u&&c<s-u&&c<o-u||l>t+u&&l>i+u&&l>r+u&&l>a+u||l<t-u&&l<i-u&&l<r-u&&l<a-u)&&function(t,e,i,n,r,s,a,o,h,l,c){let u,d,p,f,g=0,v=.005,m=1/0;Hn[0]=h,Hn[1]=l;for(let h=0;h<1;h+=.05)Vn[0]=qn(t,i,r,a,h),Vn[1]=qn(e,n,s,o,h),p=Xn(Hn,Vn),p<m&&(g=h,m=p);m=1/0;for(let h=0;h<32&&!(v<Wn);h++)u=g-v,d=g+v,Vn[0]=qn(t,i,r,a,u),Vn[1]=qn(e,n,s,o,u),p=Xn(Vn,Hn),u>=0&&p<m?(g=u,m=p):(Yn[0]=qn(t,i,r,a,d),Yn[1]=qn(e,n,s,o,d),f=Xn(Yn,Hn),d<=1&&f<m?(g=d,m=f):v*=.5);return c&&(c[0]=qn(t,i,r,a,g),c[1]=qn(e,n,s,o,g)),Math.sqrt(m)}(t,e,i,n,r,s,a,o,l,c,null)<=u/2}function Qn(t,e,i,n,r,s,a,o,h){if(0===a)return!1;const l=a;o-=t,h-=e;const c=Math.sqrt(o*o+h*h);if(c-l>i||c+l<i)return!1;if(Math.abs(n-r)%Pt<1e-4)return!0;if(s){const t=n;n=Kn(r),r=Kn(t)}else n=Kn(n),r=Kn(r);n>r&&(r+=Pt);let u=Math.atan2(h,o);return u<0&&(u+=Pt),u>=n&&u<=r||u+Pt>=n&&u+Pt<=r}function tr(t,e,i,n,r,s,a){if(0===r)return!1;const o=r,h=r/2;let l=0,c=t;if(a>e+h&&a>n+h||a<e-h&&a<n-h||s>t+h&&s>i+h||s<t-h&&s<i-h)return!1;if(t===i)return Math.abs(s-t)<=o/2;l=(e-n)/(t-i),c=(t*n-i*e)/(t-i);const u=l*s-a+c;return u*u/(l*l+1)<=o/2*o/2}const er=1e-4;function ir(t,e,i,n,r){const s=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,o=3*e-3*t;let h=0;if(Fn(a)){if(zn(s)){const t=-o/s;t>=0&&t<=1&&(r[h++]=t)}}else{const t=s*s-4*a*o;if(Fn(t))r[0]=-s/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-s+e)/(2*a),n=(-s-e)/(2*a);i>=0&&i<=1&&(r[h++]=i),n>=0&&n<=1&&(r[h++]=n)}}return h}const nr=[-1,-1,-1],rr=[-1,-1];function sr(){const t=rr[0];rr[0]=rr[1],rr[1]=t}function ar(t,e,i,n,r,s,a,o,h,l){if(l>e&&l>n&&l>s&&l>o||l<e&&l<n&&l<s&&l<o)return 0;const c=function(t,e,i,n,r,s){const a=n+3*(e-i)-t,o=3*(i-2*e+t),h=3*(e-t),l=t-r,c=o*o-3*a*h,u=o*h-9*a*l,d=h*h-3*o*l;let p=0;if(Fn(c)&&Fn(u))if(Fn(o))s[0]=0;else{const t=-h/o;t>=0&&t<=1&&(s[p++]=t)}else{const t=u*u-4*c*d;if(Fn(t)){const t=u/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(s[p++]=e),i>=0&&i<=1&&(s[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-u+e),n=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,Gn):Math.pow(i,Gn),n=n<0?-Math.pow(-n,Gn):Math.pow(n,Gn);const r=(-o-(i+n))/(3*a);r>=0&&r<=1&&(s[p++]=r)}else{const t=(2*c*o-3*a*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),r=(-o-2*i*n)/(3*a),h=(-o+i*(n+Nn*Math.sin(e)))/(3*a),l=(-o+i*(n-Nn*Math.sin(e)))/(3*a);r>=0&&r<=1&&(s[p++]=r),h>=0&&h<=1&&(s[p++]=h),l>=0&&l<=1&&(s[p++]=l)}}return p}(e,n,s,o,l,nr);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let l=0;l<c;l++){const c=nr[l],g=0===c||1===c?.5:1;qn(t,i,r,a,c)<h||(d<0&&(d=ir(e,n,s,o,rr),rr[1]<rr[0]&&d>1&&sr(),p=qn(e,n,s,o,rr[0]),d>1&&(f=qn(e,n,s,o,rr[1]))),2===d?c<rr[0]?u+=p<e?g:-g:c<rr[1]?u+=f<p?g:-g:u+=o<f?g:-g:c<rr[0]?u+=p<e?g:-g:u+=o<p?g:-g)}return u}function or(t,e,i,n,r,s,a,o){if(o>e&&o>n&&o>s||o<e&&o<n&&o<s)return 0;const h=function(t,e,i,n,r){const s=t-2*e+i,a=2*(e-t),o=t-n;let h=0;if(Fn(s)){if(zn(a)){const t=-o/a;t>=0&&t<=1&&(r[h++]=t)}}else{const t=a*a-4*s*o;if(Fn(t)){const t=-a/(2*s);t>=0&&t<=1&&(r[h++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*s),n=(-a-e)/(2*s);i>=0&&i<=1&&(r[h++]=i),n>=0&&n<=1&&(r[h++]=n)}}return h}(e,n,s,o,nr);if(0===h)return 0;const l=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,s);if(l>=0&&l<=1){let o=0;const c=$n(e,n,s,l);for(let n=0;n<h;n++){const h=0===nr[n]||1===nr[n]?.5:1;$n(t,i,r,nr[n])<a||(nr[n]<l?o+=c<e?h:-h:o+=s<c?h:-h)}return o}const c=0===nr[0]||1===nr[0]?.5:1;return $n(t,i,r,nr[0])<a?0:s<e?c:-c}function hr(t,e,i,n,r,s,a,o){if((o-=e)>i||o<-i)return 0;const h=Math.sqrt(i*i-o*o);nr[0]=-h,nr[1]=h;const l=Math.abs(n-r);if(l<1e-4)return 0;if(l>=Pt-1e-4){n=0,r=Pt;const e=s?1:-1;return a>=nr[0]+t&&a<=nr[1]+t?e:0}if(n>r){const t=n;n=r,r=t}n<0&&(n+=Pt,r+=Pt);let c=0;for(let e=0;e<2;e++){const i=nr[e];if(i+t>a){let t=Math.atan2(o,i),e=s?1:-1;t<0&&(t=Pt+t),(t>=n&&t<=r||t+Pt>=n&&t+Pt<=r)&&(t>Ct/2&&t<1.5*Ct&&(e=-e),c+=e)}}return c}function lr(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function cr(t,e){let i=lr(t[0]);i<0&&(i+=Pt);const n=i-t[0];let r=t[1];r+=n,!e&&r-i>=Pt?r=i+Pt:e&&i-r>=Pt?r=i-Pt:!e&&i>r?r=i+(Pt-lr(i-r)):e&&i<r&&(r=i-(Pt-lr(r-i))),t[0]=i,t[1]=r}const ur=[0,0];function dr(t,e,i,n,r){const s=t,a=t.length;let o,h,l=0,c=0,u=0,d=0,p=0;for(let t=0;t<a;t++){const a=s[t],f=0===t;a[0]===Re.M&&t>1&&(i||(l+=ee(c,u,d,p,n,r))),f&&(c=a[1],u=a[2],d=c,p=u);const g=a[0],v=a[1],m=a[2],y=a[3],b=a[4],x=a[5],w=a[6];let S=b,A=x;ur[0]=S,ur[1]=A,cr(ur,Boolean(a[6])),S=ur[0],A=ur[1];const T=S,C=A-S,_=!!(1-(a[6]?0:1)),B=(n-v)*y/y+v;switch(g){case Re.M:d=v,p=m,c=d,u=p;break;case Re.L:if(i){if(tr(c,u,v,m,e,n,r))return!0}else l+=ee(c,u,v,m,n,r)||0;c=v,u=m;break;case Re.C:if(i){if(Jn(c,u,v,m,y,b,x,w,e,n,r))return!0}else l+=ar(c,u,v,m,y,b,x,w,n,r)||0;c=x,u=w;break;case Re.Q:if(i){if(Zn(c,u,v,m,y,b,e,n,r))return!0}else l+=or(c,u,v,m,y,b,n,r)||0;c=y,u=b;break;case Re.A:if(o=Math.cos(T)*y+v,h=Math.sin(T)*y+m,f?(d=o,p=h):l+=ee(c,u,o,h,n,r),i){if(Qn(v,m,y,T,T+C,_,e,B,r))return!0}else l+=hr(v,m,y,T,T+C,_,B,r);c=Math.cos(T+C)*y+v,u=Math.sin(T+C)*y+m;break;case Re.R:if(d=c=v,p=u=m,o=d+y,h=p+b,i){if(tr(d,p,o,p,e,n,r)||tr(o,p,o,h,e,n,r)||tr(o,h,d,h,e,n,r)||tr(d,h,d,p,e,n,r))return!0}else l+=ee(o,p,o,h,n,r),l+=ee(d,h,d,p,n,r);break;case Re.Z:if(i){if(tr(c,u,d,p,e,n,r))return!0}else l+=ee(c,u,d,p,n,r);c=d,u=p}}return i||function(t,e){return Math.abs(t-e)<er}(u,p)||(l+=ee(c,u,d,p,n,r)||0),0!==l}class pr{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Un(Object.assign({nativeCanvas:gn.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Un(Object.assign({nativeCanvas:gn.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}const fr=new pr;var gr=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},vr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mr=Symbol.for("VWindow"),yr=Symbol.for("WindowHandlerContribution");t.DefaultWindow=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new j(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(In.getNamed(yr,t.env).configure(this,t),this.actived=!0)},this._uid=e.GenAutoIncrementId(),this.global=gn.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,r,s){this._handler.setViewBoxTransform(t,e,i,n,r,s)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&St(this.width,t.width())&&St(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}},t.DefaultWindow=gr([g(),vr("design:paramtypes",[])],t.DefaultWindow);var br,xr=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},wr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sr=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultGraphicUtil=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=gn.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=fr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const r=this.global.measureTextMethod;this.global.measureTextMethod=i;const s={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Yi.fontSize};return this.global.measureTextMethod=r,s}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new re(Object.assign({defaultFontParams:{fontFamily:Yi.fontFamily,fontSize:Yi.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+re.ALPHABET_CHAR_SET+re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=In.get(mr),r=t.AABBBounds,s=r.width(),a=r.height(),o=-r.x1,h=-r.y1;n.create({viewBox:{x1:o,y1:h,x2:r.x2,y2:r.y2},width:s,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const l=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=l;const c=n.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}},t.DefaultGraphicUtil=xr([g(),Sr(0,p(k)),Sr(0,v(Ln)),wr("design:paramtypes",[Object])],t.DefaultGraphicUtil),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(br||(br={}));const Ar=new le;t.DefaultTransformUtil=class{constructor(){this.matrix=new le}init(t){return this.mode=br.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=br.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Ar.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:r}=i;this.outTargetMatrix.translate(n,r),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-r)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Ar.a,Ar.b,Ar.c,Ar.d,Ar.e,Ar.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Ar.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Ar.a,Ar.b,Ar.c,Ar.d,Ar.e,Ar.f),this}scale(t,e,i){return this.mode===br.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===br.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Ar.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Ar.a,Ar.b,Ar.c,Ar.d,Ar.e,Ar.f),this}translate(t,e){return this.mode===br.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===br.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}},t.DefaultTransformUtil=xr([g(),wr("design:paramtypes",[])],t.DefaultTransformUtil);const Tr={arc:Ji,area:Qi,circle:tn,line:rn,path:sn,symbol:ln,text:cn,rect:on,polygon:an,richtext:un,richtextIcon:pn,image:dn,group:en,glyph:nn},Cr=Object.keys(Tr);function _r(){return{arc:Object.assign({},Tr.arc),area:Object.assign({},Tr.area),circle:Object.assign({},Tr.circle),line:Object.assign({},Tr.line),path:Object.assign({},Tr.path),symbol:Object.assign({},Tr.symbol),text:Object.assign({},Tr.text),rect:Object.assign({},Tr.rect),polygon:Object.assign({},Tr.polygon),richtext:Object.assign({},Tr.richtext),richtextIcon:Object.assign({},Tr.richtextIcon),image:Object.assign({},Tr.image),group:Object.assign({},Tr.group),glyph:Object.assign({},Tr.glyph)}}function Br(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Pr=_r();class Rr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Cr.forEach((t=>{this._defaultTheme[t]=Object.create(Pr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,bt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Cr.forEach((n=>{const r=Object.create(Pr[n]);t&&t[n]&&Br(r,t[n]),i[n]&&Br(r,i[n]),e[n]&&Br(r,e[n]),this.combinedTheme[n]=r})),e.common&&Cr.forEach((t=>{Br(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Mr=new Rr;function Er(t,e){return t.glyphHost?Er(t.glyphHost):e?(t.isContainer,e):kr(t)||t.attachedThemeGraphic&&Er(t.attachedThemeGraphic)||Mr.getTheme()}function kr(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Mr.getTheme()}return null}var Or=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{h(n.next(t))}catch(t){s(t)}}function o(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}h((n=n.apply(t,e||[])).next())}))};class Lr extends Y{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=e.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Or(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&bt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t<e;t++){if(!i)return null;t>0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<t;i++){if(!e._next)return null;e=e._next}return e}at(t){return this.getChildAt(t)}containNode(t){if(!this._idMap)return!1;if(this._idMap.has(t._uid))return!0;let e=this._firstChild;for(;e;){if(e.containNode(t))return!0;e=e._next}return!1}getRootNode(){let t=this.parent;for(;null==t?void 0:t.parent;)t=t.parent;return t||this}hasChildNodes(){return null!==this._firstChild}addChild(t){return this.appendChild(t)}add(t){return this.appendChild(t)}getChildren(){const t=[];let e=this._firstChild;for(;e;)t.push(e),e=e._next;return t}isChildOf(t){return!!this.parent&&this.parent._uid===t._uid}isParentOf(t){return t.isChildOf(this)}isDescendantsOf(t){let e=this.parent;if(!e)return!1;do{if(e._uid===t._uid)return!0;e=e.parent}while(null!==e);return!1}isAncestorsOf(t){return t.isDescendantsOf(this)}getAncestor(t){throw new Error("暂不支持")}setAllDescendantsProps(t,e){let i=this._firstChild;for(;i;)i[t]=e,i.setAllDescendantsProps(t,e),i=i._next}setCount(t){this._count+=t;let e=this.parent;if(e)do{e._count+=t,e=e.parent}while(null!==e)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const n=$(i,!0)&&i||J(i)&&i.capture,r=J(i)&&i.once,s=q(e)?void 0:e;return t=n?`${t}capture`:t,e=q(e)?e:e.handleEvent,r?super.once(t,e,s):super.on(t,e,s),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const n=$(i,!0)&&i||J(i)&&i.capture,r=q(e)?void 0:e;t=n?`${t}capture`:t,e=q(e)?e:e.handleEvent;const s=J(i)&&i.once;return super.off(t,e,r,s),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return J(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return super.emit(t.type,t,...i),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class Ir{get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get x(){return this.canvas.x}get y(){return this.canvas.y}get canvasX(){return this.canvas.x}get canvasY(){return this.canvas.y}get viewX(){return this.viewport.x}get viewY(){return this.viewport.y}constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Ir.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=this.pickParams.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&q(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&q(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class Dr extends Ir{constructor(){super(...arguments),this.client={x:0,y:0},this.movement={x:0,y:0},this.offset={x:0,y:0},this.global={x:0,y:0},this.screen={x:0,y:0}}get clientX(){return this.client.x}get clientY(){return this.client.y}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,n,r,s,a,o,h,l,c,u,d,p,f){throw new Error("Method not implemented.")}}class jr extends Dr{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}clone(){var t,e,i;const n=new jr(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const r=this.composedDetailPath();return n.detailPath=r&&r.slice(),n.type=this.type,n}}class Ur extends Dr{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const n=new Ur(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const r=this.composedDetailPath();return n.detailPath=r&&r.slice(),n.type=this.type,n}}Ur.DOM_DELTA_PIXEL=0,Ur.DOM_DELTA_LINE=1,Ur.DOM_DELTA_PAGE=2;class Wr extends Ir{constructor(t,e){super(),this.type=t,this.detail=e}}const Nr="object"==typeof performance&&performance.now?performance:Date;function Gr(t){return"mouse"===t||"pen"===t}class Fr{constructor(t,e){this.dispatch=new Y,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof jr))return void bt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Gr(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof jr))return void bt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(t,t.type,e),s=Gr(r.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==r.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),s&&this.dispatchEvent(i,"mouseout"),!r.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!r.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),s&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==r.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(r,e);this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==r.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(r,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(r,"pointermove"),"touch"===r.pointerType&&this.dispatchEvent(r,"touchmove"),s&&(this.dispatchEvent(r,"mousemove"),this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=r.composedPath(),this.freeEvent(r)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof jr))return void bt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(t.pointerId),s=this.createPointerEvent(t,t.type,e),a=Gr(s.pointerType);this.dispatchEvent(s,"pointerover"),a&&this.dispatchEvent(s,"mouseover"),"mouse"===s.pointerType&&(this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(s,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;r.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof jr))return void bt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Gr(t.pointerType),n=this.findMountedTarget(i.overTargets),r=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(r),e&&this.dispatchEvent(r,"mouseout");const s=this.createPointerEvent(t,"pointerleave",n||void 0);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),e&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;i.overTargets=[],this.freeEvent(r),this.freeEvent(s)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof jr))return void bt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=Nr.now(),r=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if(Gr(r.pointerType)){const t=2===r.button;this.dispatchEvent(r,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),a=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=a;if(a&&!r.composedPath().includes(a)){let e=a;for(;e&&!r.composedPath().includes(e);){if(r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType)this.notifyTarget(r,"touchendoutside");else if(Gr(r.pointerType)){const t=2===r.button;this.notifyTarget(r,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(r,"click");e.target=o,e.path=[],e.detailPath=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=s.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,Gr(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(r)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof jr))return void bt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),r=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType?this.notifyTarget(r,"touchendoutside"):Gr(r.pointerType)&&this.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(r)},this.onWheel=(t,e)=>{if(!(t instanceof Ur))return void bt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,r,s,a,o;if(!this.rootTarget)return;const h=this.mappingTable[t.type];let l;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(s=null===(r=this._prePointTargetCache)||void 0===r?void 0:r[c])||void 0===s?void 0:s.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?l=this._prePointTargetCache[c]:(l=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:l,stageRenderCount:null!==(o=null==l?void 0:l.stage.renderCount)&&void 0!==o?o:-1})),h)for(let e=0,i=h.length;e<i;e++)h[e].fn(t,l);else bt.getInstance().warn(`[EventManager]: Event mapping not defined for ${t.type}`)}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let n=0,r=i.length-1;n<r;n++)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){var n,r;const s=this.allocateEvent(jr);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i||this.pickTarget(null!==(n=s.viewX)&&void 0!==n?n:s.global.x,null!==(r=s.viewY)&&void 0!==r?r:s.global.y,s),"string"==typeof e&&(s.type=e),s}createWheelEvent(t,e){var i,n;const r=this.allocateEvent(Ur);return this.copyWheelData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=e||this.pickTarget(null!==(i=r.viewX)&&void 0!==i?i:r.global.x,null!==(n=r.viewY)&&void 0!==n?n:r.global.y,r),r}clonePointerEvent(t,e){const i=this.allocateEvent(jr);i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice();const n=t.composedDetailPath();return i.detailPath=n&&n.slice(),i.type=null!=e?e:i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof jr&&e instanceof jr&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Dr&&e instanceof Dr&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.shiftKey=t.shiftKey,e.metaKey=t.metaKey,["client","movement","canvas","screen","global","offset","viewport"].forEach((i=>{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Nr.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].once&&t.currentTarget.removeEventListener(e,i[n].fn,{once:!0}),i[n].fn.call(i[n].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const i=t.currentTarget._events["*"];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,t,e)}pickTarget(t,e,i){let n;const r=this.rootTarget.pick(t,e);return n=r&&r.graphic?r.graphic:r&&r.group?r.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=r.params),n}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}}const zr={dispatchEvent(t){var e;if(!(t instanceof Ir))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new Wr(t,e))}},Hr={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class Vr{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t<i;t++){const i=e[t],n=this.bootstrapEvent(this.rootPointerEvent,i);this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerMove=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerUp=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t<n;t++){const n=this.bootstrapEvent(this.rootPointerEvent,i[t]);n.type+=e,this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerOverOut=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onWheel=t=>{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:r,autoPreventDefault:s=!1,clickInterval:a,supportsTouchEvents:o=r.supportsTouchEvents,supportsPointerEvents:h=r.supportsPointerEvents}=t;this.manager=new Fr(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=r,this.supportsPointerEvents=h,this.supportsTouchEvents=o,this.supportsMouseEvents=r.supportsMouseEvents,this.applyStyles=r.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.rootPointerEvent=new jr,this.rootWheelEvent=new Ur,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const r=this.cursorStyles[t];r?"string"==typeof r&&i?n.style.cursor=r:"function"==typeof r?r(t):"object"==typeof r&&i&&Object.assign(n.style,r):i&&nt(t)&&!ut(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let r=0,s=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};r=e.clientX||0,s=e.clientY||0}else r=t.clientX||0,s=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:r-a.left,y:s-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i<n;i++){const n=t.changedTouches[i];it(n.button)&&(n.button=0),it(n.buttons)&&(n.buttons=1),it(n.isPrimary)&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),it(n.width)&&(n.width=n.radiusX||1),it(n.height)&&(n.height=n.radiusY||1),it(n.tiltX)&&(n.tiltX=0),it(n.tiltY)&&(n.tiltY=0),it(n.pointerType)&&(n.pointerType="touch"),it(n.pointerId)&&(n.pointerId=n.identifier||0),it(n.pressure)&&(n.pressure=n.force||.5),it(n.twist)&&(n.twist=0),it(n.tangentialPressure)&&(n.tangentialPressure=0),it(n.layerX)&&(n.layerX=n.offsetX=n.clientX),it(n.layerY)&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const i=t;it(i.isPrimary)&&(i.isPrimary=!0),it(i.width)&&(i.width=1),it(i.height)&&(i.height=1),it(i.tiltX)&&(i.tiltX=0),it(i.tiltY)&&(i.tiltY=0),it(i.pointerType)&&(i.pointerType="mouse"),it(i.pointerId)&&(i.pointerId=1),it(i.pressure)&&(i.pressure=.5),it(i.twist)&&(i.twist=0),it(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;const{x:i,y:n}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=n,e.global.x=i,e.global.y=n,e.offset.x=i,e.offset.y=n;const{x:r,y:s}=this.mapToViewportPoint(e);return e.viewport.x=r,e.viewport.y=s,e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:i,y:n}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=n,t.global.x=i,t.global.y=n,t.offset.x=i,t.offset.y=n;const{x:r,y:s}=this.mapToViewportPoint(t);return t.viewport.x=r,t.viewport.y=s,t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Hr[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Nr.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null}isEventOutsideOfTargetViewPort(t){if(this.isEventOutsideOfTargetElement(t))return!0;if(this.domElement.getViewBox){const e=this.mapToViewportPoint(this.mapToCanvasPoint(t)),i=this.domElement.getViewBox(),n=i.width(),r=i.height();return!(e.x<n&&e.y<r&&e.x>0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var Yr;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Yr||(Yr={}));class Xr{static Avaliable(){return!!gn.global.getRequestAnimationFrame()}avaliable(){return Xr.Avaliable()}tick(t,e){gn.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class $r{static Avaliable(){return!0}avaliable(){return $r.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class qr extends Y{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(),this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(),i||t.tick(this.interval,this.handleTick))},this._handlerTick=()=>{const t=this.tickerHandler.getTime();let e=0;this.lastFrameTime>=0&&(e=t-this.lastFrameTime),this.lastFrameTime=t,this.status===Yr.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(e)})),this.emit("afterTick"))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=Yr.INITIAL,gn.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),gn.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:Xr},{mode:"timeout",cons:$r}];for(let e=0;e<t.length;e++)if(t[e].cons.Avaliable()){this.mode=t[e].mode;break}return null}setupTickHandler(){let t;switch(this._mode){case"raf":t=new Xr;break;case"timeout":t=new $r;break;default:bt.getInstance().warn("非法的计时器模式"),t=new Xr}return!!t.avaliable()&&(this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0)}setInterval(t){this.interval=t}getInterval(){return this.interval}setFPS(t){this.setInterval(1e3/t)}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Yr.INITIAL&&(this.status=Yr.PAUSE,!0)}resume(){return this.status!==Yr.INITIAL&&(this.status=Yr.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===Yr.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Yr.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=Yr.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Yr.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Yr.RUNNING&&this._handlerTick()}}class Kr{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Kr.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class Zr{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-Zr.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Zr.bounceIn(2*t):.5*Zr.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Pt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Pt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Pt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Pt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Pt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Pt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Pt/e)*.5+1}}}Zr.quadIn=Zr.getPowIn(2),Zr.quadOut=Zr.getPowOut(2),Zr.quadInOut=Zr.getPowInOut(2),Zr.cubicIn=Zr.getPowIn(3),Zr.cubicOut=Zr.getPowOut(3),Zr.cubicInOut=Zr.getPowInOut(3),Zr.quartIn=Zr.getPowIn(4),Zr.quartOut=Zr.getPowOut(4),Zr.quartInOut=Zr.getPowInOut(4),Zr.quintIn=Zr.getPowIn(5),Zr.quintOut=Zr.getPowOut(5),Zr.quintInOut=Zr.getPowInOut(5),Zr.backIn=Zr.getBackIn(1.7),Zr.backOut=Zr.getBackOut(1.7),Zr.backInOut=Zr.getBackInOut(1.7),Zr.elasticIn=Zr.getElasticIn(1,.3),Zr.elasticOut=Zr.getElasticOut(1,.3),Zr.elasticInOut=Zr.getElasticInOut(1,.3*1.5);class Jr{constructor(){this.id=e.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(e){if(this.paused)return;let i=this.animateHead;for(this.animateCount=0;i;)i.status===t.AnimateStatus.END?this.removeAnimate(i):i.status===t.AnimateStatus.RUNNING||i.status===t.AnimateStatus.INITIAL?(this.animateCount++,i.advance(e)):i.status===t.AnimateStatus.PAUSED&&this.animateCount++,i=i.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const Qr=new Jr;class ts{constructor(t,e,i,n,r){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=r,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class es extends ts{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class is{constructor(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.GenAutoIncrementId(),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qr,r=arguments.length>2?arguments[2]:void 0;this.id=i,this.timeline=n,this.status=t.AnimateStatus.INITIAL,this.tailAnimate=new ns(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=r}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=kt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){is.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:is.mode;e&&i&t.AnimateMode.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:t.AttributeUpdateType.ANIMATE_PLAY})}runCb(t){const e=new es((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,r,s){const a=is.interpolateMap.get(t)||is.interpolateMap.get("");return!!a&&a(t,e,i,n,r,s)}pause(){this.status===t.AnimateStatus.RUNNING&&(this.status=t.AnimateStatus.PAUSED)}resume(){this.status===t.AnimateStatus.PAUSED&&(this.status=t.AnimateStatus.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new ns(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(e){if(this._duringTime<this._startTime){if(this._duringTime+e*this.timeScale<this._startTime)return void(this._duringTime+=e*this.timeScale);e=this._duringTime+e*this.timeScale-this._startTime,this._duringTime=this._startTime}this.status===t.AnimateStatus.INITIAL&&(this.status=t.AnimateStatus.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(Math.max(this.rawPosition,0)+e*this.timeScale)&&this.status===t.AnimateStatus.RUNNING&&(this.status=t.AnimateStatus.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,r=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const s=t>=r;if(s&&(t=r),t===n)return s;for(let n=0;n<this.subAnimates.length&&(e=this.subAnimates[n],!(i+e.totalDuration>=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),s}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=t.AnimateStatus.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}is.mode=t.AnimateMode.NORMAL,is.interpolateMap=new Map;class ns{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new rs(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(e){let i=e.duration;(null==i||i<0)&&(i=0);const n=e.easing,r="string"==typeof n?Zr[n]:n,s=this._addStep(i,null,r);return s.type=t.AnimateStepType.customAnimate,this._appendProps(e.getEndProps(),s,!1),this._appendCustomAnimate(e,s),this}to(e,i,n,r){(null==i||i<0)&&(i=0);const s="string"==typeof n?Zr[n]:n,a=this._addStep(i,null,s);return a.type=t.AnimateStepType.to,this._appendProps(e,a,!!r&&r.tempProps),a.propKeys||(a.propKeys=Object.keys(a.props)),r&&r.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(a.propKeys)})),this}from(e,i,n,r){this.to(e,0,n,r);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,i,n,r),this.stepTail.type=t.AnimateStepType.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(e){if(e>0){const i=this._addStep(+e,null);i.type=t.AnimateStepType.wait,i.prev.customAnimate?i.props=i.prev.customAnimate.getEndProps():i.props=i.prev.props,this.target.onAddStep&&this.target.onAddStep(i)}return this}_addStep(t,e,i){const n=new rs(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const r=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===r[t]&&(r[t]=n.props[t])}))),e.propKeys=Object.keys(e.props),n=n.prev;const s=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(r)),e.propKeys.forEach((t=>{if(void 0===s[t]){const e=this.animate.getStartProps();s[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,r=this.rawPosition;let s,a,o=!1;const h=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t<h)return this.rawPosition=t,!1;if(t-=h,i<=0&&(o=!0,i<0))return o;if(s=Math.floor(t/i),a=t-s*i,o=t>=n*i+i,o&&(a=i,s=n,t=a*s+i),t===r)return o;const l=!this.reversed!=!(this.bounce&&s%2);return l&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+h,this.updatePosition(o,l),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,r=this.duration;if(this.target&&i){let s=i.next;for(;s&&s.position<=n;)i=s,s=i.next;let a=t?0===r?1:n/r:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return bt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class rs{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const ss={duration:200,easing:"cubicOut"},as={duration:1e3,easing:"quadInOut"};var os;t.Edge=void 0,(os=t.Edge||(t.Edge={}))[os.Top=1]="Top",os[os.Right=2]="Right",os[os.Bottom=4]="Bottom",os[os.Left=8]="Left",os[os.ALL=15]="ALL";const hs=[!1,!1,!1,!1],ls=t=>{var e;let i=!0;if($(t,!0)){for(let n=0;n<4;n++)hs[n]=t,i&&(i=!(null!==(e=hs[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)hs[e]=!!t[e],i&&(i=!!hs[e]);else hs[0]=!1,hs[1]=!1,hs[2]=!1,hs[3]=!1;return{isFullStroke:i,stroke:hs}},cs=[0,0,0,0],us=t=>t?rt(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(cs[0]=t[0],cs[2]=t[0],cs[1]=t[1],cs[3]=t[1],cs):t:t:0,ds=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],ps=[1,2,3,0,1,2,3,0];function fs(t,e,i,n){for(;t>=Pt;)t-=Pt;for(;t<0;)t+=Pt;for(;t>e;)e+=Pt;ds[0].x=i,ds[1].y=i,ds[2].x=-i,ds[3].y=-i;const r=Math.ceil(t/_t)%4,s=Math.ceil(e/_t)%4;if(n.add(Et(t)*i,Lt(t)*i),n.add(Et(e)*i,Lt(e)*i),r!==s||e-t>Ct){let t=!1;for(let e=0;e<ps.length;e++)if(t||r!==ps[e]){if(t&&s===ps[e])break;if(t){const t=ds[ps[e]];n.add(t.x,t.y)}}else{t=!0;const e=ds[r];n.add(e.x,e.y)}}}function gs(t,e){return t.x===e.x&&t.y===e.y&&t.x1===e.x1&&t.y1===e.y1&&t.defined===e.defined}function vs(t,e,i){const{x:n,y:r}=Ut(t.x,t.y,e.x,e.y,i),{x:s,y:a}=Ut(t.x1,t.y1,e.x1,e.y1,i),o=new Gt(n,r,s,a);return o.defined=e.defined,o}function ms(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let n=[];if(t.length>e.length){n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<e.length;r++)n[r]=vs(t[r],e[r],i)}else{n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<t.length;r++)n[r]=vs(t[r],e[r],i)}return n}const ys=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],bs=t=>ys.includes(t);function xs(t,e){if(rt(t)){let i;for(let n=0;n<t.length&&void 0===i;n++)i=t[n][e];return i}return t[e]}class ws{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ws.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}ws.TimeOut=1e3/60;const Ss=new ws,As=(t,e)=>nt(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Ts=(t,e)=>{const i=As(t,e);return isNaN(i)?i:Math.max(e,i)};var Cs;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Cs||(Cs={}));class _s extends ts{constructor(t,e,i,n,r){super(null,null,i,n,r),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==r?void 0:r.group,this._clipGraphic=null==r?void 0:r.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:t.AttributeUpdateType.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:t.AttributeUpdateType.ANIMATE_END})}onUpdate(e,i,n){if(!this._clipGraphic)return;const r={};Object.keys(this.clipFromAttribute).forEach((t=>{r[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*i})),this._clipGraphic.setAttributes(r,!1,{type:t.AttributeUpdateType.ANIMATE_UPDATE,animationState:{ratio:i,end:e}})}}function Bs(t,e,i,n,r,s){const a=(e-t)*r+t,o=(i-e)*r+e,h=(n-i)*r+i,l=(o-a)*r+a,c=(h-o)*r+o,u=(c-l)*r+l;s[0]=t,s[1]=a,s[2]=l,s[3]=u,s[4]=u,s[5]=c,s[6]=h,s[7]=n}function Ps(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const r=[],s=[],a=i<n?t:e,o=Math.min(i,n),h=Math.abs(n-i)/6,l=(o-2)/6,c=Math.ceil(h/l),u=[a[0],a[1]];let d=h;for(let t=2;t<o;t+=6){let e=a[t-2],i=a[t-1],n=a[t],o=a[t+1],h=a[t+2],l=a[t+3];const p=a[t+4],f=a[t+5];if(d<=0){u.push(n,o,h,l,p,f);continue}const g=Math.min(d,c)+1;for(let t=1;t<=g;t++){const a=t/g;Bs(e,n,h,p,a,r),Bs(i,o,l,f,a,s),e=r[3],i=s[3],u.push(r[1],s[1],r[2],s[2],e,i),n=r[5],o=s[5],h=r[6],l=s[6]}d-=g-1}return a===t?[u,e]:[t,u]}function Rs(t,e){const i=t||e,n=i.length,r=i[n-2],s=i[n-1],a=[];for(let t=0;t<e.length;t+=2)a[t]=r,a[t+1]=s;return a}function Ms(t){const e=[],i=t.length;for(let n=0;n<i;n+=2)e[n]=t[i-n-2],e[n+1]=t[i-n-1];return e}function Es(t){let e=0,i=0,n=0;const r=t.length;for(let s=0,a=r-2;s<r;a=s,s+=2){const r=t[a],o=t[a+1],h=t[s],l=t[s+1],c=r*l-h*o;e+=c,i+=(r+h)*c,n+=(o+l)*c}return 0===e?[t[0]||0,t[1]||0,0]:[i/e/3,n/e/3,e]}function ks(t,e,i,n){const r=(t.length-2)/6;let s=1/0,a=0;const o=t.length,h=o-2;for(let l=0;l<r;l++){const r=6*l;let c=0;for(let s=0;s<o;s+=2){const a=0===s?r:(r+s-2)%h+2,o=t[a]-i[0],l=t[a+1]-i[1],u=e[s]-n[0]-o,d=e[s+1]-n[1]-l;c+=u*u+d*d}c<s&&(s=c,a=l)}return a}function Os(t,e,i,n){const r=[];let s;for(let a=0;a<t.length;a++){let o=t[a];const h=e[a],l=Es(o),c=Es(h);null==s&&(s=l[2]<0!=c[2]<0);const u=[],d=[];let p=0,f=1/0;const g=[],v=o.length;s&&(o=Ms(o));const m=6*ks(o,h,l,c),y=v-2;for(let t=0;t<y;t+=2){const e=(m+t)%y+2;u[t+2]=o[e]-l[0],u[t+3]=o[e+1]-l[1]}if(u[0]=o[m]-l[0],u[1]=o[m+1]-l[1],i>0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e<o.length;e+=2){const r=u[e],s=u[e+1],a=h[e]-c[0],o=h[e+1]-c[1],l=a*i-o*t,d=a*t+o*i;g[e]=l,g[e+1]=d;const p=l-r,f=d-s;n+=p*p+f*f}if(n<f){f=n,p=e;for(let t=0;t<g.length;t++)d[t]=g[t]}}}else for(let t=0;t<v;t+=2)d[t]=h[t]-c[0],d[t+1]=h[t+1]-c[1];r.push({from:u,to:d,fromCp:l,toCp:c,rotation:-p})}return r}function Ls(t,e){let i,n;const r=[],s=[];for(let a=0;a<Math.max(t.length,e.length);a++){const o=t[a],h=e[a];let l,c;o?h?([l,c]=Ps(o,h),i=l,n=c):(c=Rs(n,o),l=o):(l=Rs(i,h),c=h),r.push(l),s.push(c)}return[r,s]}const Is=(t,e,i,n,r)=>{St(e,n)&&St(i,r)||t.push(e,i,n,r,n,r)};function Ds(t){const e=t.commandList,i=[];let n,r=0,s=0,a=0,o=0;const h=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let l,c,u,d;for(let t=0,i=e.length;t<i;t++){const i=e[t],p=0===t;switch(p&&(a=r=i[1],o=s=i[2],[Re.L,Re.C,Re.Q].includes(i[0])&&(n=[a,o])),i[0]){case Re.M:r=a=i[1],s=o=i[2],h(a,o);break;case Re.L:l=i[1],c=i[2],Is(n,r,s,l,c),r=l,s=c;break;case Re.C:n.push(i[1],i[2],i[3],i[4],r=i[5],s=i[6]);break;case Re.Q:l=i[1],c=i[2],u=i[3],d=i[4],n.push(r+2/3*(l-r),s+2/3*(c-s),u+2/3*(l-u),d+2/3*(c-d),u,d),r=u,s=d;break;case Re.A:{const t=i[1],e=i[2],u=i[3],d=u,f=i[4],g=i[5],v=!!i[6];l=Math.cos(f)*u+t,c=Math.sin(f)*u+e,p?(a=l,o=c,h(a,o)):Is(n,r,s,l,c),r=Math.cos(g)*u+t,s=Math.sin(g)*u+e;const m=(v?-1:1)*Math.PI/2;for(let i=f;v?i>g:i<g;i+=m){const r=v?Math.max(i+m,g):Math.min(i+m,g);$e(n,i,r,t,e,u,d)}break}case Re.E:{const t=i[1],e=i[2],u=i[3],d=i[4],f=i[5],g=i[6],v=i[7]+g,m=!!i[8],y=!St(f,0),b=Math.cos(f),x=Math.sin(f);let w=Math.cos(g)*u,S=Math.sin(g)*d;y?(l=w*b-S*x+t,c=w*x+S*b+e):(l=w+t,c=S+e),p?(a=l,o=c,h(a,o)):Is(n,r,s,l,c),w=Math.cos(v)*u,S=Math.sin(v)*d,y?(r=w*b-S*x+t,s=w*x+S*b+e):(r=w+t,s=S+e);const A=(m?-1:1)*Math.PI/2;for(let i=g;m?i>v:i<v;i+=A){const r=m?Math.max(i+A,v):Math.min(i+A,v);if($e(n,i,r,t,e,u,d),y){const i=n.length;for(let r=i-6;r<=i-1;r+=2)w=n[r],S=n[r+1],n[r]=(w-t)*b-(S-e)*x+t,n[r+1]=(w-t)*x+(S-e)*b+e}}break}case Re.R:a=r=i[1],o=s=i[2],l=a+i[3],c=o+i[4],h(l,o),Is(n,l,o,l,c),Is(n,l,c,a,c),Is(n,a,c,a,o),Is(n,a,o,l,o);break;case Re.AT:{const t=i[1],e=i[2],h=i[3],l=i[4],c=i[5],u=Ft.distancePP({x:r,y:s},{x:t,y:e}),d=Ft.distancePP({x:h,y:l},{x:t,y:e}),p=((r-t)*(h-t)+(s-e)*(l-e))/(u*d),f=c/Math.sin(p/2),g=(r+h-2*t)/2,v=(s+l-2*e)/2,m=Ft.distancePP({x:g,y:v},{x:0,y:0}),y=t+f*g/m,b=h+f*v/m,x=Math.sqrt(f*f-c*c);a=t+x*(r-t)/u,o=e+x*(s-e)/u,Is(n,r,s,a,o),r=t+x*(h-t)/d,s=e+x*(l-e)/d;const w=Vt({x:y,y:b},{x:a,y:o}),S=Vt({x:y,y:b},{x:r,y:s});$e(n,w,S,y,b,c,c);break}case Re.Z:n&&Is(n,r,s,a,o),r=a,s=o}}return n&&n.length>2&&i.push(n),i}function js(t,e){for(let i=0;i<t.length;i++){const n=t[i];for(let t=0;t<n.length;t+=2){const i=n[t],r=n[t+1],s={x:i,y:r};e.transformPoint({x:i,y:r},s),n[t]=s.x,n[t+1]=s.y}}}function Us(t){const e=new Ui;for(let i=0;i<t.length;i++){const n=t[i];if(n.length>2){e.moveTo(n[0],n[1]);for(let t=2;t<n.length;t+=6)e.bezierCurveTo(n[t],n[t+1],n[t+2],n[t+3],n[t+4],n[t+5])}}return e}const Ws=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=K(t.width)?t.x1-t.x:t.width,i=K(t.height)?t.y1-t.y:t.height,n=0,r=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(r=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:r,width:e,height:i}};function Ns(t,e,i){const n=t/e;let r,s;t>=e?(s=Math.ceil(Math.sqrt(i*n)),r=Math.floor(i/s),0===r&&(r=1,s=i)):(r=Math.ceil(Math.sqrt(i/n)),s=Math.floor(i/r),0===s&&(s=1,r=i));const a=[];for(let t=0;t<r;t++)a.push(s);const o=i-r*s;if(o>0)for(let t=0;t<o;t+=s)t+s<o?a.push(s):a.push(o-t);return a}const Gs=(t,e)=>{const{width:i,height:n}=Ws(t.attribute),r=Ns(i,n,e),s=[],a=n/r.length;for(let t=0,e=r.length;t<e;t++){const e=r[t],n=i/e;for(let i=0;i<e;i++)s.push({x:0+i*n,y:0+t*a,width:n,height:a})}return s},Fs=(t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,r=i.endAngle,s=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-r),h=Math.abs(a-s),l=Ns(o*(s+a)/2,h,e),c=[],u=h/l.length,d=a>=s?1:-1,p=r>=n?1:-1;for(let t=0,e=l.length;t<e;t++){const e=l[t],i=o/e;for(let r=0;r<e;r++)c.push({innerRadius:a-u*t*d,outerRadius:a-u*(t+1)*d,startAngle:n+i*r*p,endAngle:n+i*(r+1)*p})}return c},zs=(t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),r=t.getComputedAttribute("radius"),s=Math.abs(i-n),a=Ns(s*r,r,e),o=[],h=s/a[0],l=r/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t<e;t++)for(let e=0,n=a[t];e<n;e++)o.push({innerRadius:l*t,outerRadius:l*(t+1),startAngle:i+h*e*c,endAngle:i+h*(e+1)*c});return o},Hs=(t,e)=>{const i=t.filter((t=>!1!==t.defined&&at(t.x)&&at(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let r=0,s=0;for(;r<e;)n.push(i[Math.floor(s)]),s+=t,r++;return n}const r=e-i.length,s=1/(r/(i.length-1)+1);let a=0;for(let e=0,i=t.length;e<i;e++)if(n.push(t[e]),e<i-1){let i=s;const o=t[e].x,h=t[e].y,l=t[e+1].x,c=t[e+1].y;for(;i<1&&a<r;)n.push({x:o+(l-o)*i,y:h+(c-h)*i}),i+=s,a+=1}return n},Vs=(t,e)=>{var i,n;const r=t.attribute;let s=r.points;const a=r.segments;s||(s=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=s.filter((t=>!1!==t.defined&&at(t.x)&&at(t.y)));if(!o.length)return[];const h=[];o.forEach((t=>{h.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];h.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const l=[];return Ks(s,e,l),l},Ys=(t,e)=>{const i=t.attribute,n=i.points;if(n)return Hs(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Hs(t,e)}return[]};const Xs=t=>t.map((t=>({x:t.x,y:t.y}))),$s=(t,e,i)=>{const n=t.length,r=[];for(let o=0;o<n;o++){const h=t[o],l=o===n-1?t[0]:t[o+1],c=Xt([e.x,e.y],[i.x,i.y],[h.x,h.y],[l.x,l.y]);c&&"boolean"!=typeof c&&r.push({dot:(s=[c[0]-e.x,c[1]-e.x],a=[i.x-e.x,i.y-e.x],s[0]*a[1]-s[1]*a[0]),point:{x:c[0],y:c[1]},edgeIndex:o})}var s,a;if(r.length<2)return[Xs(t),Xs(t)];r.sort(((t,e)=>t.dot-e.dot));let o=r[0],h=r[r.length-1];o.edgeIndex>h.edgeIndex&&([o,h]=[h,o]);const l=o.point,c=h.point,u=[{x:l.x,y:l.y}];for(let e=o.edgeIndex+1;e<=h.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=h.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];d.push({x:i.x,y:i.y})}return d.push({x:l.x,y:l.y}),[u,d]},qs=t=>{const e=new ae;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return $s(t,{x:n,y:e.y1},{x:n,y:e.y2})}const r=e.y1+n/2;return $s(t,{x:e.x1,y:r},{x:e.x2,y:r})},Ks=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),r=qs(t);Ks(r[0],n,i),Ks(r[1],e-n,i)}},Zs=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:Xs(i)}];const n=[];return Ks(i,e,n),n},Js=(t,e)=>{const i=Ds(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],r=Math.floor(i.length/e);for(let s=0;s<e;s++){const a=i.slice(s*r,s===e-1?n:(s+1)*r);t.push({path:Us(a)})}return t}const r=[],s=Math.floor(e/n);let a=e;for(let t=0;t<n;t++){const e=[];for(let n=2,r=i[t].length;n<r;n+=2)e.push({x:i[0][n],y:i[0][n+1]});Ks(e,t===n-1?a:s,r),a-=s}return r};var Qs;t.ColorType=void 0,(Qs=t.ColorType||(t.ColorType={}))[Qs.Color255=0]="Color255",Qs[Qs.Color1=1]="Color1";class ta{static Get(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.ColorType.Color1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(i===t.ColorType.Color1){const t=ta.store1[e];if(t)return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n;const i=we.parseColorString(e);if(i){const t=[i.r/255,i.g/255,i.b/255,i.opacity];ta.store1[e]=t,ta.store255[e]=[i.r,i.g,i.b,i.opacity],n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3]}return n}const r=ta.store255[e];if(r)return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n;const s=we.parseColorString(e);return s&&(ta.store1[e]=[s.r/255,s.g/255,s.b/255,s.opacity],ta.store255[e]=[s.r,s.g,s.b,s.opacity],n[0]=s.r,n[1]=s.g,n[2]=s.b,n[3]=s.opacity),n}static Set(e,i,n){if(i===t.ColorType.Color1){if(ta.store1[e])return;ta.store1[e]=n,ta.store255[e]=[Math.floor(255*n[0]),Math.floor(255*n[1]),Math.floor(255*n[2]),Math.floor(255*n[3])]}else{if(ta.store255[e])return;ta.store255[e]=n,ta.store1[e]=[n[0]/255,n[1]/255,n[2]/255,n[3]]}}}function ea(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&at(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function ia(t,e,i,n,r){return Array.isArray(t)&&!at(t[0])||Array.isArray(e)&&!at(e[0])?new Array(4).fill(0).map(((r,s)=>na(rt(t)?t[s]:t,rt(e)?e[s]:e,i,n))):na(t,e,i,n,r)}function na(e,i,n,r,s){if(!e||!i)return e&&ea(e)||i&&ea(i)||!1;let a,o,h=!1,l=!1;if(Array.isArray(e)?a=e:"string"==typeof e?a=ta.Get(e,t.ColorType.Color255):h=!0,Array.isArray(i)?o=i:"string"==typeof i?o=ta.Get(i,t.ColorType.Color255):l=!0,h!==l){const t=h?e:i,a=h?i:e,o=Object.assign(Object.assign({},t),{stops:t.stops.map((t=>Object.assign(Object.assign({},t),{color:ea(a)})))});return h?ia(t,o,n,r,s):ia(o,t,n,r,s)}if(h){if(e.gradient===i.gradient){const t=e,r=i,s=t.stops,a=r.stops;if(s.length!==a.length)return!1;if("linear"===t.gradient)return ra(t,r,n);if("radial"===t.gradient)return sa(t,r,n);if("conical"===t.gradient)return aa(t,r,n)}return!1}return s&&s(a,o),ea(oa(a,o,n),r)}function ra(t,e,i){const n=t.stops,r=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:ca(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}function sa(t,e,i){const n=t.stops,r=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:ca(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}function aa(t,e,i){const n=t.stops,r=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:ca(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}function oa(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}ta.store255={},ta.store1={};const ha=[0,0,0,0],la=[0,0,0,0];function ca(e,i,n){return ta.Get(e,t.ColorType.Color255,ha),ta.Get(i,t.ColorType.Color255,la),`rgba(${Math.round(ha[0]+(la[0]-ha[0])*n)},${Math.round(ha[1]+(la[1]-ha[1])*n)},${Math.round(ha[2]+(la[2]-ha[2])*n)},${ha[3]+(la[3]-ha[3])*n})`}const ua=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=ia(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},da=(t,e,i)=>{const n=[],r=[];e.clear();for(let s=0;s<t.length;s++){const a=t[s],o=a.from,h=a.to,l=a.rotation*i,c=a.fromCp,u=a.toCp,d=Math.sin(l),p=Math.cos(l);r[0]=c[0]+(u[0]-c[0])*i,r[1]=c[1]+(u[1]-c[1])*i;for(let t=0;t<o.length;t+=2){const e=o[t],s=o[t+1],a=e*(1-i)+h[t]*i,l=s*(1-i)+h[t+1]*i;n[t]=a*p-l*d+r[0],n[t+1]=a*d+l*p+r[1]}let f=n[0],g=n[1];e.moveTo(f,g);for(let t=2;t<o.length;t+=6){const i=n[t],r=n[t+1],s=n[t+2],a=n[t+3],o=n[t+4],h=n[t+5];f===i&&g===r&&s===o&&a===h?e.lineTo(o,h):e.bezierCurveTo(i,r,s,a,o,h),f=o,g=h}}},pa=(t,e,i)=>{const n=t?Ds(t):[],r=Ds(e);i&&n&&(i.fromTransform&&js(n,i.fromTransform.clone().getInverse()),js(n,i.toTransfrom));const[s,a]=Ls(n,r);return t?Os(s,a,10,Math.PI):a.map(((t,e)=>({from:s[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},fa=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ga=(e,i)=>{if(!e||!i)return null;const n=[];let r=!1;return Object.keys(e).forEach((s=>{if(!fa.includes(s))return;const a=i[s];K(a)||K(e[s])||a===e[s]||("fill"===s||"stroke"===s?n.push({from:"string"==typeof e[s]?ta.Get(e[s],t.ColorType.Color255):e[s],to:"string"==typeof a?ta.Get(a,t.ColorType.Color255):a,key:s}):n.push({from:e[s],to:a,key:s}),r=!0)})),r?n:null};class va extends ts{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,r="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;da(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&ua(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ma=(t,e,i,n)=>{var r,s,a;if(t&&(!t.valid||!t.toCustomPath))return __DEV__&&console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return __DEV__&&console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const h=pa(null===(r=null==t?void 0:t.toCustomPath)||void 0===r?void 0:r.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),l=ga(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new va({morphingData:h,otherAttrs:l},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:as.duration,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:as.easing)),c};class ya extends ts{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;da(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&ua(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ba=t=>{const e={};return Object.keys(t).forEach((i=>{bs(i)||(e[i]=t[i])})),e},xa=(t,e,i)=>{const n=ba(t.attribute),r=t.attachShadow();if(e.length)r.setTheme({[e[0].type]:n}),e.forEach((t=>{t.setAttributes({pickable:!1}),r.appendChild(t)}));else{const s=t.AABBBounds,a=s.width(),o=s.height();r.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=gn.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});r.appendChild(i),e.push(i)}))}},wa=(t,e,i)=>{const n=[],r=i?null:ba(t.attribute),s=t.toCustomPath();for(let t=0;t<e;t++){const t={path:(new Ui).fromCustomPath2D(s)};n.push(gn.graphicService.creator.path(i?t:Object.assign({},r,t)))}return i&&xa(t,n,e),n},Sa=(t,e,i)=>{const n=[],r=i?null:ba(t.attribute);if("rect"===t.type)Gs(t,e).forEach((t=>{n.push(gn.graphicService.creator.rect(i?t:Object.assign({},r,t)))}));else if("arc"===t.type)Fs(t,e).forEach((t=>{n.push(gn.graphicService.creator.arc(i?t:Object.assign({},r,t)))}));else if("circle"===t.type)zs(t,e).forEach((t=>{n.push(gn.graphicService.creator.arc(i?t:Object.assign({},r,t)))}));else if("line"===t.type){const s=Ys(t,e),a={size:10,symbolType:"circle"};s.forEach((t=>{n.push(gn.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},r,t,a)))}))}else"polygon"===t.type?Zs(t,e).forEach((t=>{n.push(gn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))})):"area"===t.type?Vs(t,e).forEach((t=>{n.push(gn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))})):"path"===t.type&&Js(t,e).forEach((t=>{"path"in t?n.push(gn.graphicService.creator.path(i?t:Object.assign({},r,t))):n.push(gn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))}));return i&&xa(t,n,e),n};class Aa{static GetImage(t,e){var i;const n=Aa.cache.get(t);n?"fail"===n.loadState?gn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Aa.loadImage(t,e)}static GetSvg(t,e){var i;let n=Aa.cache.get(t);n?"fail"===n.loadState?gn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Aa.cache.set(t,n),n.dataPromise=gn.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))})),n.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Aa.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Aa.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=gn.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=gn.global.loadBlob(t):"json"===e&&(i.dataPromise=gn.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Aa.isLoading&&Aa.toLoadAueue.length){Aa.isLoading=!0;const t=Aa.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,r={type:"image",loadState:"init"};if(Aa.cache.set(i,r),r.dataPromise=gn.global.loadImage(i),r.dataPromise){r.waitingMark=n;const t=r.dataPromise.then((t=>{var e;r.loadState=(null==t?void 0:t.data)?"success":"fail",r.data=null==t?void 0:t.data,null===(e=r.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(r.loadState="success",r.data=t.data,e.imageLoadSuccess(i,t.data)):(r.loadState="fail",e.imageLoadFail(i))})),r.waitingMark&&(r.waitingMark=[])}));e.push(t)}else r.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Aa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Aa.loading()})).catch((t=>{console.error(t),Aa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Aa.loading()}))}}),0)}static loadImage(t,e){const i=Ta(t,Aa.toLoadAueue);if(-1!==i)return Aa.toLoadAueue[i].marks.push(e),void Aa.loading();Aa.toLoadAueue.push({url:t,marks:[e]}),Aa.loading()}static improveImageLoading(t){const e=Ta(t,Aa.toLoadAueue);if(-1!==e){const t=Aa.toLoadAueue.splice(e,1);Aa.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ta(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}Aa.cache=new Map,Aa.isLoading=!1,Aa.toLoadAueue=[],Aa.onLoadSuccessCb=[];const Ca=new le,_a=new oe,Ba=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Pa=["x","y"],Ra=["scaleX","scaleY"],Ma=["angle"],Ea=new Gt,ka={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Oa extends Lr{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(Oa.prototype,n,Object.getOwnPropertyDescriptor(t,n))}}get AABBBounds(){return this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode)}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var i;super(),this._AABBBounds=new oe,this._updateTag=t.UpdateTag.INIT,this.attribute=e,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,e.background?this.loadImage(null!==(i=e.background.background)&&void 0!==i?i:e.background,!0):e.shadowGraphic&&this.setShadowGraphic(e.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,n;const{dx:r=t.dx,dy:s=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Ea.x=r+(null!==(i=t.scrollX)&&void 0!==i?i:0),Ea.y=s+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Ea.x=r,Ea.y=s;return Ea}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;gn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return gn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new he),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,n=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:r=e.boundsPadding}=i,s=us(r);return s&&n.expand(s),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Ce(t);return Ke(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new le),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&gn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)&&gn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&t.UpdateTag.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&t.UpdateTag.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=t.UpdateTag.CLEAR_SHAPE}containsPoint(e,i,n,r){if(!r)return!1;if(n===t.IContainPointMode.GLOBAL){const t=new Gt(e,i);this.parent&&this.parent.globalTransMatrix.transformPoint(t,t),e=t.x,i=t.y}return r.containsPoint(this,{x:e,y:i})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e<n.length;e++){const i=n[e];this.attribute[i]=t[i]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(n)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,n){var r;const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);s?this._setAttributes(s,i,n):K(null===(r=this.normalAttrs)||void 0===r?void 0:r[t])?(this.attribute[t]=e,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n)):this.normalAttrs[t]=e,"background"===t?this.loadImage(e,!0):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ba;for(let i=0;i<e.length;i++){const n=e[i];if(-1!==t.indexOf(n))return!0}return!1}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ba;for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(e){const i={type:t.AttributeUpdateType.INIT};e=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(e,this.attribute,null,i)||e,this.attribute=e,e.background?this.loadImage(e.background,!0):e.shadowGraphic&&this.setShadowGraphic(e.shadowGraphic),this._updateTag=t.UpdateTag.INIT,this.valid=this.isValid(),this.onAttributeUpdate(i)}translate(e,i){var n,r;if(0===e&&0===i)return this;const s={type:t.AttributeUpdateType.TRANSLATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:e,y:i},this.attribute,Pa,s);a&&(e=a.x,i=a.y,delete a.x,delete a.y,this._setAttributes(a));const o=this.attribute,h=o.postMatrix;return h?gn.transformUtil.fromMatrix(h,h).translate(e,i):(o.x=(null!==(n=o.x)&&void 0!==n?n:Fi.x)+e,o.y=(null!==(r=o.y)&&void 0!==r?r:Fi.y)+i),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}translateTo(e,i){const n=this.attribute;if(n.x===e&&n.y===i)return this;const r={type:t.AttributeUpdateType.TRANSLATE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:e,y:i},this.attribute,Pa,r);return s?(this._setAttributes(s,!1,r),this):(n.x=e,n.y=i,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}scale(e,i,n){var r,s;if(1===e&&1===i)return this;const a={type:t.AttributeUpdateType.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:e,scaleY:i,scaleCenter:n},this.attribute,Ra,a);o&&(e=o.scaleX,i=o.scaleY,delete o.scaleX,delete o.scaleY,this._setAttributes(o));const h=this.attribute;if(n){let{postMatrix:t}=this.attribute;t||(t=new le,h.postMatrix=t),gn.transformUtil.fromMatrix(t,t).scale(e,i,n)}else h.scaleX=(null!==(r=h.scaleX)&&void 0!==r?r:Fi.scaleX)*e,h.scaleY=(null!==(s=h.scaleY)&&void 0!==s?s:Fi.scaleY)*i;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(a),this}scaleTo(e,i){const n=this.attribute;if(n.scaleX===e&&n.scaleY===i)return this;const r={type:t.AttributeUpdateType.SCALE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:e,scaleY:i},this.attribute,Ra,r);return s?(this._setAttributes(s,!1,r),this):(n.scaleX=e,n.scaleY=i,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}rotate(e,i){var n;if(0===e)return this;const r={type:t.AttributeUpdateType.ROTATE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:e,rotateCenter:i},this.attribute,Ma,r);s&&(delete s.angle,this._setAttributes(s,!1,r));const a=this.attribute;if(i){let{postMatrix:t}=this.attribute;t||(t=new le,a.postMatrix=t),gn.transformUtil.fromMatrix(t,t).rotate(e,i)}else a.angle=(null!==(n=a.angle)&&void 0!==n?n:Fi.angle)+e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}rotateTo(e){const i=this.attribute;if(i.angle===e)return this;const n={type:t.AttributeUpdateType.ROTATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(e,this.attribute,Ma,n);return r?(this._setAttributes(r,!1,n),this):(i.angle=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}skewTo(t,e){return this}animate(t){this.animates||(this.animates=new Map);const e=new is(null==t?void 0:t.id,this.stage&&this.stage.getTimeline(),null==t?void 0:t.slience);if(e.bind(this),t){const{onStart:i,onFrame:n,onEnd:r,onRemove:s}=t;null!=i&&e.onStart(i),null!=n&&e.onFrame(n),null!=r&&e.onEnd(r),null!=s&&e.onRemove(s),e.interpolateFunc=t.interpolate}return this.animates.set(e.id,e),e.onRemove((()=>{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(gn.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!K(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(e,i,n,r){var s,a,o,h;if(n){const n=Object.keys(e),l=this.getNoWorkAnimateAttr(),c={};let u;n.forEach((t=>{l[t]?(u||(u={}),u[t]=e[t]):c[t]=r&&void 0===e[t]?this.getDefaultAttribute(t):e[t]}));const d=this.animate({slience:!0});d.stateNames=i,d.to(c,null!==(a=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==a?a:ss.duration,null!==(h=null===(o=this.stateAnimateConfig)||void 0===o?void 0:o.easing)&&void 0!==h?h:ss.easing),u&&this.setAttributes(u,!1,{type:t.AttributeUpdateType.STATE})}else this.stopStateAnimates(),this.setAttributes(e,!1,{type:t.AttributeUpdateType.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();ut(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const r=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(r,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const r=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];r&&Object.assign(n,r)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=t.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=t.UpdateTag.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=t.UpdateTag.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&t.UpdateTag.UPDATE_SHAPE_AND_BOUNDS)===t.UpdateTag.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=t.UpdateTag.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=t.UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=t.UpdateTag.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=t.UpdateTag.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=t.UpdateTag.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=t.UpdateTag.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=t.UpdateTag.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&t.UpdateTag.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],n=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:n}=this.attribute;return _a.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(_a),this.setAttributes({scaleX:t,scaleY:i,angle:n}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,r=n();i[0]=r.x1+(r.x2-r.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,r=n();i[1]=r.y1+(r.y2-r.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=Fi.x,y:e=Fi.y,scaleX:i=Fi.scaleX,scaleY:n=Fi.scaleY,angle:r=Fi.angle,scaleCenter:s,anchor:a,postMatrix:o}=this.attribute;let h=[0,0];const l={};if(a&&(h=this.getAnchor(a,l)),!s||1===i&&1===n)!function(t,e,i,n,r,s,a,o){const h=e.a,l=e.b,c=e.c,u=e.d,d=e.e,p=e.f,f=Et(a),g=Lt(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,b=m-n,x=h*f+c*g,w=l*f+u*g,S=c*f-h*g,A=u*f-l*g;t.a=r*x,t.b=r*w,t.c=s*S,t.d=s*A,t.e=d+h*v+c*m-x*y-S*b,t.f=p+l*v+u*m-w*y-A*b}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,r,a&&h);else{const a=this._transMatrix;a.reset(),a.translate(h[0],h[1]),a.rotate(r),a.translate(-h[0],-h[1]),a.translate(t,e),h=this.getAnchor(s,l),gn.transformUtil.fromMatrix(a,a).scale(i,n,{x:h[0],y:h[1]})}const c=this.getOffsetXY(Fi);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ca.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),gn.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(e){e&&this.setAttributes(e,!1,{type:t.AttributeUpdateType.ANIMATE_END})}onStep(e,i,n,r,s){const a={};if(n.customAnimate)n.customAnimate.update(s,r,a);else{const t=n.props,o=n.parsedProps,h=n.propKeys;this.stepInterpolate(e,i,a,n,r,s,t,void 0,o,h)}this.setAttributes(a,!1,{type:t.AttributeUpdateType.ANIMATE_UPDATE,animationState:{ratio:r,end:s,step:n,isFirstFrameOfStep:e.getLastStep()!==n}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,r,s,a,o,h,l){l||(l=Object.keys(a),n.propKeys=l),s?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):l.forEach((s=>{var l;if(!e.validAttr(s))return;const c=a[s],u=null!==(l=o&&o[s])&&void 0!==l?l:t.getLastPropByName(s,n);if(null==c||null==u||c===u)return void(i[s]=c);let d;d=e.interpolateFunc&&e.interpolateFunc(s,r,u,c,i),d||(d=e.customInterpolate(s,r,u,c,this,i),d||this.defaultInterpolate(c,u,s,i,h,r)||this._interpolate(s,r,u,c,i))})),n.parsedProps=h}defaultInterpolate(t,e,i,n,r,s){if(Number.isFinite(t))return n[i]=e+(t-e)*s,!0;if("fill"===i){r||(r={});const a=r.fillColorArray,o=ia(e,null!=a?a:t,s,!1,((t,e)=>{r.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){r||(r={});const a=r.strokeColorArray,o=ia(e,null!=a?a:t,s,!1,((t,e)=>{r.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){r||(r={});const a=r.shadowColorArray,o=ia(e,null!=a?a:t,s,!0,((t,e)=>{r.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,r){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:gn.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return nt(t,!0)?this.pathProxy=(new Ui).fromString(t):this.pathProxy=new Ui,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",t.startsWith("<svg")?(Aa.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(ht(t)||t.includes("/")||lt(t))&&(Aa.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):J(t)?(n.state="success",n.data=t,this.backgroundImg=this.backgroundImg||e):n.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const n=this.resources.get(t);n&&(n.state="success",n.data=e,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="fail",e&&e())}_stopAnimates(t){t&&t.forEach((t=>{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",gn.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const r=new Wr(t,e);r.bubbles=!1,r.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(r)}}}Oa.mixin(zr);class La{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Ia(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r+e.length-1}function Da(t,e,i){const n=function(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",r="";for(let s=e;s<t.length;s++){let e=t[s];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===n[0]){if(!n[1])return{data:r,index:s};if(t[s+1]===n[1])return{data:r,index:s}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!n)return;let r=n.data;const s=n.index,a=r.search(/\s/);let o=r,h=!0;-1!==a&&(o=r.substr(0,a).replace(/\s\s*$/,""),r=r.substr(a+1));const l=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),h=o!==n.data.substr(t+1))}return{tagName:o,tagExp:r,closeIndex:s,attrExpPresent:h,rawTagName:l}}const ja=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Ua{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;"string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const r=function(t,e){const i=[];let n=e.exec(t);for(;n;){const r=[];r.startIndex=e.lastIndex-n[0].length;const s=n.length;for(let t=0;t<s;t++)r.push(n[t]);i.push(r),n=e.exec(t)}return i}(t,ja),s=r.length;for(let t=0;t<s;t++){const e=r[t][1],i=r[t][4];e&&(n[e]=void 0===i||(isNaN(i)?i:Number(i)))}return n}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new La("!xml");let i=e,n="",r="";for(let s=0;s<t.length;s++)if("<"===t[s])if("/"===t[s+1]){const e=Ia(t,">",s,"Closing Tag is not closed."),a=r.lastIndexOf(".");r=r.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",s=e}else if("?"===t[s+1])s=Da(t,s,!1,"?>").closeIndex+1;else if("!--"===t.substr(s+1,3))s=Ia(t,"--\x3e",s+4,"Comment is not closed.");else{const a=Da(t,s,!1);let o=a.tagName,h=a.tagExp;const l=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(r+=r?"."+o:o),h.length>0&&h.lastIndexOf("/")===h.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),h=o):h=h.substr(0,h.length-1);const t=new La(o);o!==h&&l&&(t[":@"]=this.buildAttributesMap(h,r,o)),this.addChild(i,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new La(o);this.tagsNodeStack.push(i),o!==h&&l&&(t[":@"]=this.buildAttributesMap(h,r,o)),this.addChild(i,t,r),i=t}n="",s=c}else n+=t[s];return e.child}}function Wa(t,e){return Na(t)}function Na(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=Ga(r);if(void 0!==s&&r[s]){const t=Na(r[s]);n=t,Object.keys(n).length,r[":@"]&&Fa(t,r[":@"]),void 0!==i[s]&&i.hasOwnProperty(s)?(Array.isArray(i[s])||(i[s]=[i[s]]),i[s].push(t)):i[s]=t}}var n;return i}function Ga(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function Fa(t,e,i){if(e){const i=Object.keys(e),n=i.length;for(let r=0;r<n;r++){const n=i[r];t[n]=e[n]}}}class za{constructor(t){this.options=Object.assign({},za.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Wa(new Ua(this.options).parseXml(t),this.options)}}function Ha(t){return t.startsWith("<svg")||t.startsWith("<?xml")}function Va(t){return t.startsWith("<")}za.defaultOptions={};var Ya=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{h(n.next(t))}catch(t){s(t)}}function o(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}h((n=n.apply(t,e||[])).next())}))};function Xa(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let $a=0;function qa(){return $a++}var Ka;function Za(e){const i=[];let n=0,r="";for(let s=0;s<e.length;s++)to(e[s])?n?r+=e[s]:(n=1,r=e[s]):(n&&(i.push({text:r,direction:t.TextDirection.VERTICAL}),r="",n=0),i.push({text:e[s],direction:t.TextDirection.HORIZONTAL}));return r&&i.push({text:r,direction:t.TextDirection.VERTICAL}),i}t.TextDirection=void 0,(Ka=t.TextDirection||(t.TextDirection={}))[Ka.HORIZONTAL=0]="HORIZONTAL",Ka[Ka.VERTICAL=1]="VERTICAL";const Ja=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>Ja.set(t,!0)));const Qa=new Map;function to(t){if(Ja.has(t))return!0;if(Qa.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function eo(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e<i.length;e++)e>1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>Qa.set(t,!0)));const io=qa(),no=qa(),ro=qa(),so=qa(),ao=qa(),oo=qa(),ho=qa(),lo=qa(),co=qa(),uo=qa(),po=qa(),fo=qa(),go=qa(),vo=qa(),mo=qa(),yo=qa(),bo=Symbol.for("GraphicService"),xo=Symbol.for("GraphicCreator"),wo={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},So=Object.keys(wo),Ao={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},To=Object.keys(Ao);var Co;t.GroupUpdateAABBBoundsMode=void 0,(Co=t.GroupUpdateAABBBoundsMode||(t.GroupUpdateAABBBoundsMode={}))[Co.LESS_GROUP=0]="LESS_GROUP",Co[Co.MORE_GROUP=1]="MORE_GROUP";class _o extends Oa{constructor(e){super(e),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=oo,this._childUpdateTag=t.UpdateTag.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Rr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Rr)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(e,i,n){if(n===t.IContainPointMode.GLOBAL){const t=new Gt(e,i);return this.parent&&this.parent.globalTransMatrix.transformPoint(t,t),this.AABBBounds.contains(t.x,t.y)}return this.AABBBounds.contains(e,i)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&t.UpdateTag.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;gn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),gn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=Fi.x,y:e=Fi.y,dx:i=Fi.dx,dy:n=Fi.dy,scaleX:r=Fi.scaleX,scaleY:s=Fi.scaleY,angle:a=Fi.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==r||1!==s||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Er(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:r,height:s,path:a,clip:o=e.clip,display:h}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=s&&i.set(0,0,Math.max(0,r),Math.max(0,s)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),gn.graphicService.updateTempAABBBounds(i),gn.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=t.UpdateTag.CLEAR_BOUNDS,this._childUpdateTag&=t.UpdateTag.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=t.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&t.UpdateTag.UPDATE_BOUNDS||(this._childUpdateTag|=t.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),gn.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),gn.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,gn.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{gn.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),gn.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&t.UpdateTag.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=gn.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new _o(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return _o.NOWORK_ANIMATE_ATTR}}function Bo(t){return new _o(t)}_o.NOWORK_ANIMATE_ATTR=ka;class Po extends _o{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(r=n.zIndex)&&void 0!==r?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new Rr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{gn.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{gn.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Ro=Symbol.for("TransformUtil"),Mo=Symbol.for("GraphicUtil"),Eo=Symbol.for("LayerService"),ko=Symbol.for("StaticLayerHandlerContribution"),Oo=Symbol.for("DynamicLayerHandlerContribution"),Lo=Symbol.for("VirtualLayerHandlerContribution");var Io,Do=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},jo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.DefaultLayerService=Io=class{static GenerateLayerId(){return`${Io.idprefix}_${Io.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=gn.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?In.get(ko):"dynamic"===t?In.get(Oo):In.get(Lo),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const r=this.getLayerHandler(n),s=new Po(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Io.GenerateLayerId(),layerHandler:r})),a=this.layerMap.get(t)||[];return a.push(s),this.layerMap.set(t,a),this.staticLayerCountInEnv--,s}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}},t.DefaultLayerService.idprefix="visactor_layer",t.DefaultLayerService.prefix_count=0,t.DefaultLayerService=Io=Do([g(),jo("design:paramtypes",[])],t.DefaultLayerService);var Uo=new i((e=>{e(W).to(t.DefaultGlobal).inSingletonScope(),e(mr).to(t.DefaultWindow),e(Mo).to(t.DefaultGraphicUtil).inSingletonScope(),e(Ro).to(t.DefaultTransformUtil).inSingletonScope(),e(Eo).to(t.DefaultLayerService).inSingletonScope()}));function Wo(t,e){return!(!t&&!e)}function No(t,e){let i;return i=rt(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Go(t,e,i){return i&&t*e>0}function Fo(t,e,i,n,r){return r&&t*e>0&&0!==i&&0!==n}function zo(t,e){return t*e>0}function Ho(t,e,i,n){return t*e>0&&0!==i&&0!==n}function Vo(t,e,i,n,r,s,a,o){if(!t.pathProxy)return!1;const h=Er(t,null==s?void 0:s.theme)[t.type.replace("3d","")],{fill:l=h.fill,stroke:c=h.stroke,opacity:u=h.opacity,fillOpacity:d=h.fillOpacity,lineWidth:p=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:g=h.visible,x:v=h.x,y:m=h.y}=t.attribute,y=Go(u,d,l),b=zo(u,f),x=Wo(l),w=No(c,p);if(!g)return!0;if(!x&&!w)return!0;if(!(y||b||a||o))return!0;e.beginPath();return Ke(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),w&&(o?o(e,t.attribute,h):b&&(e.setStrokeStyle(t,t.attribute,i-v,n-m,h),e.stroke())),x&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i-v,n-m,h),e.fill())),!0}function Yo(t,e,i,n,r,s,a,o){const h=i-t,l=n-e,c=a-r,u=o-s;let d=u*h-c*l;return d*d<Tt?[]:(d=(c*(e-s)-u*(t-r))/d,[t+d*h,e+d*l])}function Xo(t,e,i,n,r,s,a){const o=t-i,h=e-n,l=(a?s:-s)/Math.sqrt(o*o+h*h),c=l*h,u=-l*o,d=t+c,p=e+u,f=i+c,g=n+u,v=(d+f)/2,m=(p+g)/2,y=f-d,b=g-p,x=y*y+b*b,w=r-s,S=d*g-f*p,A=(b<0?-1:1)*Math.sqrt(Math.max(0,w*w*x-S*S));let T=(S*b-y*A)/x,C=(-S*y-b*A)/x;const _=(S*b+y*A)/x,B=(-S*y+b*A)/x,P=T-v,R=C-m,M=_-v,E=B-m;return P*P+R*R>M*M+E*E&&(T=_,C=B),{cx:T,cy:C,x01:-c,y01:-u,x11:T*(r/w-1),y11:C*(r/w-1)}}function $o(t,e,i,n,r){const s=Rt(i-e),a=t.getParsedCornerRadius(),o=rt(a),{outerDeltaAngle:h,innerDeltaAngle:l,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),f=o?a[0]:a,g=o?a[1]:a,v=o?a[2]:a,m=o?a[3]:a,y=Math.max(g,f),b=Math.max(v,m);let x=y,w=b;const S=r*Et(c),A=r*Lt(c),T=n*Et(d),C=n*Lt(d);let _,B,P,R;if((b>Tt||y>Tt)&&(_=r*Et(u),B=r*Lt(u),P=n*Et(p),R=n*Lt(p),s<Ct)){const t=Yo(S,A,P,R,_,B,T,C);if(t){const e=S-t[0],i=A-t[1],s=_-t[0],a=B-t[1],o=1/Lt(function(t){return t>1?0:t<-1?Ct:Math.acos(t)}((e*s+i*a)/(It(e*e+i*i)*It(s*s+a*a)))/2),h=It(t[0]*t[0]+t[1]*t[1]);w=Ot(b,(n-h)/(o-1)),x=Ot(y,(r-h)/(o+1))}}return{outerDeltaAngle:h,xors:S,yors:A,xirs:P,yirs:R,xore:_,yore:B,xire:T,yire:C,limitedOcr:x,limitedIcr:w,outerCornerRadiusStart:f,outerCornerRadiusEnd:g,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:l,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:m,innerCornerRadiusEnd:v}}function qo(t,e,i,n,r,s,a){const{startAngle:o,endAngle:h}=t.getParsedAngle(),l=Rt(h-o),c=h>o;let u=!1;if(r<s){const t=r;r=s,s=t}if(r<=Tt)e.moveTo(i,n);else if(l>=Pt-Tt)e.moveTo(i+r*Et(o),n+r*Lt(o)),e.arc(i,n,r,o,h,!c),s>Tt&&(e.moveTo(i+s*Et(h),n+s*Lt(h)),e.arc(i,n,s,h,o,c));else{const{outerDeltaAngle:l,xors:d,yors:p,xirs:f,yirs:g,limitedOcr:v,outerCornerRadiusStart:m,outerCornerRadiusEnd:y,maxOuterCornerRadius:b,xore:x,yore:w,xire:S,yire:A,outerStartAngle:T,outerEndAngle:C,limitedIcr:_,innerDeltaAngle:B,innerEndAngle:P,innerStartAngle:R,innerCornerRadiusStart:M,innerCornerRadiusEnd:E,maxInnerCornerRadius:k}=$o(t,o,h,s,r);if(l<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,n+p),u=!0;else if(v>Tt){const t=Ot(m,v),s=Ot(y,v),o=Xo(f,g,d,p,r,t,Number(c)),h=Xo(x,w,S,A,r,s,Number(c));v<b&&t===s?!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),e.arc(i+o.cx,n+o.cy,v,Mt(o.y01,o.x01),Mt(h.y01,h.x01),!c)):e.moveTo(i+o.cx+v*Et(Mt(h.y01,h.x01)),n+o.cy+v*Lt(Mt(h.y01,h.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),t>0&&e.arc(i+o.cx,n+o.cy,t,Mt(o.y01,o.x01),Mt(o.y11,o.x11),!c),e.arc(i,n,r,Mt(o.cy+o.y11,o.cx+o.x11),Mt(h.cy+h.y11,h.cx+h.x11),!c),s>0&&e.arc(i+h.cx,n+h.cy,s,Mt(h.y11,h.x11),Mt(h.y01,h.x01),!c)):s>0?e.moveTo(i+h.cx+s*Et(Mt(h.y01,h.x01)),n+h.cy+s*Lt(Mt(h.y01,h.x01))):e.moveTo(i+x,n+r*Lt(C))}else!a||a[0]?(e.moveTo(i+d,n+p),e.arc(i,n,r,T,C,!c)):e.moveTo(i+r*Et(C),n+r*Lt(C));if(!(s>Tt)||B<.001)!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),u=!0;else if(_>Tt){const t=Ot(M,_),r=Ot(E,_),o=Xo(S,A,x,w,s,-r,Number(c)),h=Xo(d,p,f,g,s,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),_<k&&t===r){const t=Mt(h.y01,h.x01);!a||a[2]?e.arc(i+o.cx,n+o.cy,_,Mt(o.y01,o.x01),t,!c):e.moveTo(i+o.cx+Et(t),n+o.cy+Lt(t))}else!a||a[2]?(r>0&&e.arc(i+o.cx,n+o.cy,r,Mt(o.y01,o.x01),Mt(o.y11,o.x11),!c),e.arc(i,n,s,Mt(o.cy+o.y11,o.cx+o.x11),Mt(h.cy+h.y11,h.cx+h.x11),c),t>0&&e.arc(i+h.cx,n+h.cy,t,Mt(h.y11,h.x11),Mt(h.y01,h.x01),!c)):t>0?e.moveTo(i+h.cx+t*Et(Mt(h.y01,h.x01)),n+h.cy+t*Lt(Mt(h.y01,h.x01))):e.moveTo(i+f,n+g)}else!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),!a||a[2]?e.arc(i,n,s,P,R,c):e.moveTo(i+s*Et(R),n+s*Lt(R))}return a?a[3]&&e.lineTo(i+r*Et(o),n+r*Lt(o)):e.closePath(),u}class Ko{static GetCanvas(){try{return Ko.canvas||(Ko.canvas=gn.global.createCanvas({})),Ko.canvas}catch(t){return null}}static GetCtx(){if(!Ko.ctx){const t=Ko.GetCanvas();Ko.ctx=t.getContext("2d")}return Ko.ctx}}class Zo extends ce{static getInstance(){return Zo._instance||(Zo._instance=new Zo),Zo._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Ko.GetCanvas(),n=Ko.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const r=n.createLinearGradient(0,0,e,0);t.forEach((t=>{r.addColorStop(t[0],t[1])})),n.fillStyle=r,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${n}`;r.forEach((t=>a+=t.join())),a+=s;let o=this.dataMap.get(a);return o||(o={data:new Zo(r,s),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Jo{static GetSize(t){for(let e=0;e<Jo.ImageSize.length;e++)if(Jo.ImageSize[e]>=t)return Jo.ImageSize[e];return t}static Get(t,e,i,n,r,s,a){const o=Jo.GenKey(t,e,i,n,r),h=Jo.cache[o];if(!h||0===h.length)return null;for(let t=0;t<h.length;t++)if(h[t].width>=s&&h[t].height>=a)return h[t].pattern;return null}static Set(t,e,i,n,r,s,a,o){const h=Jo.GenKey(t,e,i,n,r);Jo.cache[h]?Jo.cache[h].push({width:a,height:o,pattern:s}):Jo.cache[h]=[{width:a,height:o,pattern:s}]}static GenKey(t,e,i,n,r){return`${e},${i},${n},${r},${t.join()}`}}function Qo(t,e,i,n){const{stops:r,startAngle:s,endAngle:a}=n;for(;i<0;)i+=Pt;for(;i>Pt;)i-=Pt;if(i<s)return r[0].color;if(i>a)return r[0].color;let o,h,l=(i-s)/(a-s);for(let t=0;t<r.length;t++)if(r[t].offset>=l){o=r[t-1],h=r[t];break}return l=(l-o.offset)/(h.offset-o.offset),ia(o.color,h.color,l,!1)}function th(t,e,i,n,r,s,a,o,h){const l=Math.floor(180*r/Math.PI),c=Ko.GetCanvas(),u=Ko.GetCtx();if(!u)return null;const d=Jo.GetSize(o),p=Jo.GetSize(h);let f=Jo.Get(e,i,n,s,a,d,p);if(f)return f;const g=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(n,2),Math.pow(d-i,2)+Math.pow(n,2)),Math.max(Math.pow(d-i,2)+Math.pow(p-n,2),Math.pow(i,2)+Math.pow(p-n,2)))),v=l+1,m=r/Math.max(1,v-1),y=Zo.getInstance().GetOrCreate(i,n,d,p,e,v),b=2*Math.PI*g/360;c.width=d,c.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d,p),u.translate(i,n),u.rotate(s);for(let t=0,e=v-1;t<e&&!(s+t*m>a);t++){const e=y.getColor(t);u.beginPath(),u.rotate(m),u.moveTo(0,0),u.lineTo(g,-2*b),u.lineTo(g,0),u.fillStyle=e,u.closePath(),u.fill()}const x=u.getImageData(0,0,d,p);return c.width=x.width,c.height=x.height,u.putImageData(x,0,0),f=t.createPattern(c,"no-repeat"),f&&Jo.Set(e,i,n,s,a,f,d,p),f}Jo.cache={},Jo.ImageSize=[20,40,80,160,320,640,1280,2560];const eh=Symbol.for("ArcRenderContribution"),ih=Symbol.for("AreaRenderContribution"),nh=Symbol.for("CircleRenderContribution"),rh=Symbol.for("GroupRenderContribution"),sh=Symbol.for("ImageRenderContribution"),ah=Symbol.for("PathRenderContribution"),oh=Symbol.for("PolygonRenderContribution"),hh=Symbol.for("RectRenderContribution"),lh=Symbol.for("SymbolRenderContribution"),ch=Symbol.for("TextRenderContribution"),uh=Symbol.for("CommonRenderContribution"),dh=Symbol.for("InteractiveSubRenderContribution");function ph(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function fh(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function gh(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Ae(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const r=Ae(n);K(t[n])||(e[r]=i(t[n]))})),Z(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&nt(t.fill)&&(e.color=t.fill),e}function vh(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function mh(t,e,i){const n=Math.sin(i),r=Math.cos(i),s=e[4],a=e[5],o=e[6],h=e[7],l=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*r+l*n,t[5]=a*r+c*n,t[6]=o*r+u*n,t[7]=h*r+d*n,t[8]=l*r-s*n,t[9]=c*r-a*n,t[10]=u*r-o*n,t[11]=d*r-h*n,t}function yh(t,e,i){const n=Math.sin(i),r=Math.cos(i),s=e[0],a=e[1],o=e[2],h=e[3],l=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r-l*n,t[1]=a*r-c*n,t[2]=o*r-u*n,t[3]=h*r-d*n,t[8]=s*n+l*r,t[9]=a*n+c*r,t[10]=o*n+u*r,t[11]=h*n+d*r,t}function bh(t,e,i){const n=Math.sin(i),r=Math.cos(i),s=e[0],a=e[1],o=e[2],h=e[3],l=e[4],c=e[5],u=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r+l*n,t[1]=a*r+c*n,t[2]=o*r+u*n,t[3]=h*r+d*n,t[4]=l*r-s*n,t[5]=c*r-a*n,t[6]=u*r-o*n,t[7]=d*r-h*n,t}function xh(t,e,i){const n=i[0],r=i[1],s=i[2];let a,o,h,l,c,u,d,p,f,g,v,m;return e===t?(t[12]=e[0]*n+e[4]*r+e[8]*s+e[12],t[13]=e[1]*n+e[5]*r+e[9]*s+e[13],t[14]=e[2]*n+e[6]*r+e[10]*s+e[14],t[15]=e[3]*n+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],h=e[2],l=e[3],c=e[4],u=e[5],d=e[6],p=e[7],f=e[8],g=e[9],v=e[10],m=e[11],t[0]=a,t[1]=o,t[2]=h,t[3]=l,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=f,t[9]=g,t[10]=v,t[11]=m,t[12]=a*n+c*r+f*s+e[12],t[13]=o*n+u*r+g*s+e[13],t[14]=h*n+d*r+v*s+e[14],t[15]=l*n+p*r+m*s+e[15]),t}function wh(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Sh(t,e,i){const n=i[0],r=i[1],s=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Ah(t,e,i){const n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],h=e[5],l=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],v=e[13],m=e[14],y=e[15];let b=i[0],x=i[1],w=i[2],S=i[3];return t[0]=b*n+x*o+w*u+S*g,t[1]=b*r+x*h+w*d+S*v,t[2]=b*s+x*l+w*p+S*m,t[3]=b*a+x*c+w*f+S*y,b=i[4],x=i[5],w=i[6],S=i[7],t[4]=b*n+x*o+w*u+S*g,t[5]=b*r+x*h+w*d+S*v,t[6]=b*s+x*l+w*p+S*m,t[7]=b*a+x*c+w*f+S*y,b=i[8],x=i[9],w=i[10],S=i[11],t[8]=b*n+x*o+w*u+S*g,t[9]=b*r+x*h+w*d+S*v,t[10]=b*s+x*l+w*p+S*m,t[11]=b*a+x*c+w*f+S*y,b=i[12],x=i[13],w=i[14],S=i[15],t[12]=b*n+x*o+w*u+S*g,t[13]=b*r+x*h+w*d+S*v,t[14]=b*s+x*l+w*p+S*m,t[15]=b*a+x*c+w*f+S*y,t}function Th(t,e,i,n){let r,s,a,o,h,l,c,u,d,p;const f=e[0],g=e[1],v=e[2],m=n[0],y=n[1],b=n[2],x=i[0],w=i[1],S=i[2];return Math.abs(f-x)<Tt&&Math.abs(g-w)<Tt&&Math.abs(v-S)<Tt?vh(t):(c=f-x,u=g-w,d=v-S,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,r=y*d-b*u,s=b*c-m*d,a=m*u-y*c,p=Math.hypot(r,s,a),p?(p=1/p,r*=p,s*=p,a*=p):(r=0,s=0,a=0),o=u*a-d*s,h=d*r-c*a,l=c*s-u*r,p=Math.hypot(o,h,l),p?(p=1/p,o*=p,h*=p,l*=p):(o=0,h=0,l=0),t[0]=r,t[1]=o,t[2]=c,t[3]=0,t[4]=s,t[5]=h,t[6]=u,t[7]=0,t[8]=a,t[9]=l,t[10]=d,t[11]=0,t[12]=-(r*f+s*g+a*v),t[13]=-(o*f+h*g+l*v),t[14]=-(c*f+u*g+d*v),t[15]=1,t)}function Ch(t,e,i,n,r,s,a){const o=1/(e-i),h=1/(n-r),l=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+i)*o,t[13]=(r+n)*h,t[14]=(a+s)*l,t[15]=1,t}function _h(t,e,i){const n=e[0],r=e[1],s=e[2];let a=i[3]*n+i[7]*r+i[11]*s+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*r+i[8]*s+i[12])/a,t[1]=(i[1]*n+i[5]*r+i[9]*s+i[13])/a,t[2]=(i[2]*n+i[6]*r+i[10]*s+i[14])/a,t}const Bh=Symbol.for("MatrixAllocate"),Ph=Symbol.for("Mat4Allocate");function Rh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class Mh{constructor(){this.pools=[]}allocate(t,e,i,n,r,s){if(!this.pools.length)return new le(t,e,i,n,r,s);const a=this.pools.pop();return a.a=t,a.b=e,a.c=i,a.d=n,a.e=r,a.f=s,a}allocateByObj(t){if(!this.pools.length)return new le(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}class Eh{constructor(){this.pools=[]}static identity(t){return vh(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Eh.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}const kh=new Mh,Oh=new Eh;var Lh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dh=function(t,e){return function(i,n){e(i,n,t)}};function jh(t,e,i){var n;const{x:r=i.x,y:s=i.y,z:a=i.z,dx:o=i.dx,dy:h=i.dy,dz:l=i.dz,scaleX:c=i.scaleX,scaleY:u=i.scaleY,scaleZ:d=i.scaleZ,alpha:p=i.alpha,beta:f=i.beta,angle:g=i.angle,anchor3d:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(vh(t),xh(t,t,[r+o,s+h,a+l]),xh(t,t,[y[0],y[1],y[2]]),mh(t,t,f),yh(t,t,p),xh(t,t,[-y[0],-y[1],y[2]]),Sh(t,t,[c,u,d]),g){const i=Oh.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}xh(i,i,[n[0],n[1],0]),bh(i,i,g),xh(i,i,[-n[0],-n[1],0]),Ah(t,t,i)}}function Uh(t){const{alpha:e,beta:i}=t.attribute;return e||i}t.DefaultGraphicService=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new j(["graphic"]),onSetStage:new j(["graphic","stage"]),onRemove:new j(["graphic"]),onRelease:new j(["graphic"]),onAddIncremental:new j(["graphic","group","stage"]),onClearIncremental:new j(["graphic","group","stage"]),beforeUpdateAABBBounds:new j(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new j(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new j(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new oe,this.tempAABBBounds2=new oe}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,r){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,r)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new Ce(t);return Ke(i.commandList,n,0,0),!0}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:r,textBaseline:s}=t;if(null!=t.forceBoundsHeight){const e=at(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=fh(s,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=at(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=ph(r,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,r){if(!e.empty()){const{scaleX:r=i.scaleX,scaleY:s=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:h=i.lineWidth,pickStrokeBuffer:l=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&h){Xa(u,(h+l)/Math.abs(r+s),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Xa(u,o/Math.abs(r+s)*2,!1,c+1),u.translate(n,a),e.union(u)}}if(this.combindShadowAABBBounds(e,r),e.empty())return;let s=!0;const a=r.transMatrix;r&&r.isContainer&&(s=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),s&&se(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:r=e.visible}=t;return!(!n.valid||!r)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),gn.graphicService.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}},t.DefaultGraphicService=Lh([g(),Dh(0,p(xo)),Ih("design:paramtypes",[Object])],t.DefaultGraphicService);const Wh={x:0,y:0,z:0,lastModelMatrix:null};class Nh{init(e){e&&(this._renderContribitions=e.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((e=>e.time===t.BaseRenderContributionTime.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((e=>e.time===t.BaseRenderContributionTime.afterFillStroke)))}beforeRenderStep(t,e,i,n,r,s,a,o,h,l,c,u,d){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,r,s,a,o,h,l,c,u,d)}))}afterRenderStep(t,e,i,n,r,s,a,o,h,l,c,u,d){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,r,s,a,o,h,l,c,u,d)}))}valid(t,e,i,n){const{fill:r=e.fill,background:s,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:h=e.fillOpacity,lineWidth:l=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=Go(o,h,r),p=zo(o,c),f=Wo(r,s),g=No(a,l);return!(!t.valid||!u)&&!(!f&&!g)&&!!(d||p||i||n||s)&&{fVisible:d,sVisible:p,doFill:f,doStroke:g}}transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:r=e.x,y:s=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:h=e.scaleY,angle:l=e.angle,postMatrix:c}=t.attribute,u=i.modelMatrix,d=i.camera;Wh.x=r,Wh.y=s,Wh.z=a,Wh.lastModelMatrix=u;const p=d&&(n||Uh(t)),f=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===h&&0===l&&!c;if(p){const n=Oh.allocate(),r=Oh.allocate();jh(r,t,e),Ah(n,u||n,r),Wh.x=0,Wh.y=0,Wh.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Oh.free(r)}if(f&&!u){const n=t.getOffsetXY(e);Wh.x+=n.x,Wh.y+=n.y,Wh.z=a,i.setTransformForCurrent()}else if(p)Wh.x=0,Wh.y=0,Wh.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const n=t.getOffsetXY(e);Wh.x+=n.x,Wh.y+=n.y,this.transformWithoutTranslate(i,Wh.x,Wh.y,Wh.z,o,h,l)}else i.transformFromMatrix(t.transMatrix,!0),Wh.x=0,Wh.y=0,Wh.z=0;return Wh}transformUseContext2d(t,e,i,n){const r=n.camera;if(this.camera=r,r){const e=t.AABBBounds,r=e.x2-e.x1,s=e.y2-e.y1,a=n.project(0,0,i),o=n.project(r,0,i),h=n.project(r,s,i),l={x:0,y:0},c={x:r,y:0},u={x:r,y:s};n.camera=null;const d=1/(l.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*l.y),p=-(l.y*(h.x-o.x)-c.y*h.x+u.y*o.x+(c.y-u.y)*a.x)*d,f=(c.y*h.y+l.y*(o.y-h.y)-u.y*o.y+(u.y-c.y)*a.y)*d,g=(l.x*(h.x-o.x)-c.x*h.x+u.x*o.x+(c.x-u.x)*a.x)*d,v=-(c.x*h.y+l.x*(o.y-h.y)-u.x*o.y+(u.x-c.x)*a.y)*d,m=(l.x*(u.y*o.x-c.y*h.x)+l.y*(c.x*h.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(l.x*(u.y*o.y-c.y*h.y)+l.y*(c.x*h.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;n.setTransform(p,f,g,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,r,s,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(r,s,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,r){const{context:s}=n;if(!s)return;const{renderable:a}=t.attribute;if(!1===a)return;s.highPerformanceSave();const o=this.transform(t,e,s,i),{x:h,y:l,z:c,lastModelMatrix:u}=o;this.z=c,Vo(t,s,h,l,0,r)||(this.drawShape(t,s,h,l,n,r),this.z=0,s.modelMatrix!==u&&Oh.free(s.modelMatrix),s.modelMatrix=u),s.highPerformanceRestore()}}var Gh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Fh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zh=function(t,e){return function(i,n){e(i,n,t)}};class Hh{constructor(){this.time=t.BaseRenderContributionTime.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u,d){var p;const{background:f,backgroundOpacity:g=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:h.backgroundOpacity),opacity:v=h.opacity,backgroundMode:m=h.backgroundMode,backgroundFit:y=h.backgroundFit}=t.attribute;if(f)if(t.backgroundImg&&t.resources){const r=t.resources.get(f);if("success"!==r.state||!r.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Er(t.parent).group,{scrollX:n=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,r)}e.clip();const s=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,h),e.globalAlpha=g*v,this.doDrawImage(e,r.data,s,m,y),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,h),e.globalAlpha=g*v,e.fillStyle=f,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n,r){if("no-repeat"===n)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=i.width(),a=i.height();let o=s,h=a;if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,r=e.height;"repeat-x"===n?(o=i*(a/r),h=a):"repeat-y"===n&&(h=r*(s/i),o=s);const l=t.dpr,c=fr.allocate({width:o,height:h,dpr:l}),u=c.getContext("2d");u&&(u.inuse=!0,u.clearMatrix(),u.setTransformForCurrent(!0),u.clearRect(0,0,o,h),u.drawImage(e,0,0,o,h),e=c.nativeCanvas),fr.free(c)}const l=t.dpr,c=t.createPattern(e,n);c.setTransform&&c.setTransform(new DOMMatrix([1/l,0,0,1/l,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,s,a),t.translate(-i.x1,-i.y1)}}}const Vh=new Hh;t.DefaultBaseInteractiveRenderContribution=class{constructor(e){this.subRenderContribitions=e,this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,r,s,a,o,h,l,c,u,d)}))}},t.DefaultBaseInteractiveRenderContribution=Gh([g(),zh(0,p(k)),zh(0,v(dh)),Fh("design:paramtypes",[Object])],t.DefaultBaseInteractiveRenderContribution);class Yh{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,r){const s=(t-2*e)/2,a=n.dpr,o=fr.allocate({width:t,height:t,dpr:a}),h=o.getContext("2d");if(!h)return null;h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,t,t),r(s,h);const l=n.createPattern(o.nativeCanvas,"repeat");return l.setTransform&&l.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),fr.free(o),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Pt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const r=t/2,s=r;n.fillStyle=i,n.moveTo(r,s-e),n.lineTo(e+r,s),n.lineTo(r,s+e),n.lineTo(r-e,s),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const r=e,s=r;n.fillStyle=i,n.fillRect(r,s,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,r)=>{const s=e;r.fillStyle=i,r.fillRect(s,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,r)=>{const s=e;r.fillStyle=i,r.fillRect(0,s,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const r=t/2,s=-r;n.moveTo(r,s),n.lineTo(r+t,s+t),n.moveTo(-r,-s),n.lineTo(-r+t,-s+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const r=t/2,s=r;n.moveTo(t+r,s),n.lineTo(r,s+t),n.moveTo(t-r,-s),n.lineTo(-r,-s+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const r=e,s=r;n.fillStyle=i,n.fillRect(r,s,t,t),n.fillRect(r+t,s+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,r,s,a,o,h,l,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=h.texture,textureColor:f=h.textureColor,textureSize:g=h.textureSize,texturePadding:v=h.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,h,f,g,v)}drawTexture(t,e,i,n,r,s,a,o,h){let l=this.textureMap.get(t);if(!l)switch(t){case"circle":l=this.createCirclePattern(o,h,a,i);break;case"diamond":l=this.createDiamondPattern(o,h,a,i);break;case"rect":l=this.createRectPattern(o,h,a,i);break;case"vertical-line":l=this.createVerticalLinePattern(o,h,a,i);break;case"horizontal-line":l=this.createHorizontalLinePattern(o,h,a,i);break;case"bias-lr":l=this.createBiasLRLinePattern(o,h,a,i);break;case"bias-rl":l=this.createBiasRLLinePattern(o,h,a,i);break;case"grid":l=this.createGridPattern(o,h,a,i)}l&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,r,s),i.fillStyle=l,i.fill(),i.highPerformanceRestore())}}const Xh=new Yh;class $h{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{innerPadding:v=h.innerPadding,outerPadding:m=h.outerPadding,startAngle:y=h.startAngle,endAngle:b=h.endAngle,opacity:x=h.opacity,x:w=h.x,y:S=h.y,scaleX:A=h.scaleX,scaleY:T=h.scaleY,keepStrokeScale:C=h.keepStrokeScale}=t.attribute;let{innerRadius:_=h.innerRadius,outerRadius:B=h.outerRadius}=t.attribute;B+=m,_-=v;const P=(r,s)=>{const a=!(!r||!r.stroke),{distance:o=h[s].distance}=r,l=C?o:yn(e,o,e.dpr),c=o/B,d="outerBorder"===s?1:-1;if(t.setAttributes({outerRadius:B+d*l,innerRadius:_-d*l,startAngle:y-d*c,endAngle:b+d*c}),e.beginPath(),qo(t,e,i,n,B+d*l,_-d*l),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),u)u(e,r,h[s]);else if(a){const a=h[s].opacity;h[s].opacity=x,e.setStrokeStyle(t,r,(w-i)/A,(S-n)/T,h[s]),h[s].opacity=a,e.stroke()}};f&&P(d,"outerBorder"),g&&P(p,"innerBorder"),t.setAttributes({outerRadius:B,innerRadius:_,startAngle:y,endAngle:b})}}const qh=new $h,Kh=Xh,Zh=Vh;class Jh{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{radius:v=h.radius,startAngle:m=h.startAngle,endAngle:y=h.endAngle,opacity:b=h.opacity,x:x=h.x,y:w=h.y,scaleX:S=h.scaleX,scaleY:A=h.scaleY,keepStrokeScale:T=h.keepStrokeScale}=t.attribute,C=(r,s)=>{const a=!(!r||!r.stroke),{distance:o=h[s].distance}=r,l=T?o:yn(e,o,e.dpr),c="outerBorder"===s?1:-1;if(e.beginPath(),e.arc(i,n,v+c*l,m,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),u)u(e,r,h[s]);else if(a){const a=h[s].opacity;h[s].opacity=b,e.setStrokeStyle(t,r,(x-i)/S,(w-n)/A,h[s]),h[s].opacity=a,e.stroke()}};f&&C(d,"outerBorder"),g&&C(p,"innerBorder")}}const Qh=new Jh,tl=Xh,el=Vh;class il extends Hh{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){const{background:d,backgroundMode:p=h.backgroundMode,backgroundFit:f=h.backgroundFit}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(d);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;this.doDrawImage(e,i.data,n,p,f),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}}const nl=new il,rl=Ct/2;function sl(t,e,i,n,r,s,a){let o;if(n<0&&(e+=n,n=-n),r<0&&(i+=r,r=-r),at(s,!0))o=[s=Rt(s),s,s,s];else if(Array.isArray(s)){const t=s;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Rt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Rt(t[0]),i=Rt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Rt(o[0]),o[1]=Rt(o[1]),o[2]=Rt(o[2]),o[3]=Rt(o[3])}}else o=[0,0,0,0];if(n<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,n,r);const[h,l,c,u]=[[e,i],[e+n,i],[e+n,i+r],[e,i+r]],d=Math.min(n/2,r/2),p=[Math.min(d,o[0]),Math.min(d,o[1]),Math.min(d,o[2]),Math.min(d,o[3])],f=[h[0]+p[0],h[1]],g=[h[0],h[1]+p[0]],v=[l[0]-p[1],l[1]],m=[l[0],l[1]+p[1]],y=[c[0]-p[2],c[1]],b=[c[0],c[1]-p[2]],x=[u[0]+p[3],u[1]],w=[u[0],u[1]-p[3]];if(t.moveTo(f[0],f[1]),a&&a[0]?a[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!gt(v,m)){a&&a[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+p[1];t.arc(e,i,p[1],-rl,0,!1)}if(a&&a[1]?a[1](m[0],m[1],b[0],b[1]):t.lineTo(b[0],b[1]),!gt(y,b)){const e=b[0]-p[2],i=b[1];a&&a[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[2],0,rl,!1)}if(a&&a[2]?a[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!gt(x,w)){const e=x[0],i=x[1]-p[3];a&&a[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,p[3],rl,Ct,!1)}if(a&&a[3]?a[3](w[0],w[1],g[0],g[1]):t.lineTo(g[0],g[1]),!gt(f,g)){const e=f[0],i=f[1]+p[0];a&&a[3]&&t.moveTo(g[0],g[1]),t.arc(e,i,p[0],Ct,Ct+rl,!1)}return!a&&t.closePath(),t}var al=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};class ol{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{cornerRadius:v=h.cornerRadius,opacity:m=h.opacity,x:y=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:w=h.scaleY,x1:S,y1:A,keepStrokeScale:T=h.keepStrokeScale}=t.attribute;let{width:C,height:_}=t.attribute;C=(null!=C?C:S-i)||0,_=(null!=_?_:A-n)||0;const B=(r,s)=>{const a=!(!r||!r.stroke),o="outerBorder"===s?-1:1,{distance:l=h[s].distance}=r,c=T?l:yn(e,l,e.dpr),d=i+o*c,p=n+o*c,f=2*c;if(0===v||rt(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*f,_-o*f)):(e.beginPath(),sl(e,d,p,C-o*f,_-o*f,v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),u)u(e,r,h[s]);else if(a){const a=h[s].opacity;h[s].opacity=m,e.setStrokeStyle(t,r,(y-i)/x,(b-n)/w,h[s]),h[s].opacity=a,e.stroke()}};f&&B(d,"outerBorder"),g&&B(p,"innerBorder")}}t.SplitRectBeforeRenderContribution=class{constructor(){this.time=t.BaseRenderContributionTime.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u,d){const{stroke:p=h.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}},t.SplitRectBeforeRenderContribution=al([g()],t.SplitRectBeforeRenderContribution),t.SplitRectAfterRenderContribution=class{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){const{x1:d,y1:p,x:f=h.x,y:g=h.y,stroke:v=h.stroke,cornerRadius:m=h.cornerRadius}=t.attribute;let{width:y,height:b}=t.attribute;if(y=(null!=y?y:d-f)||0,b=(null!=b?b:p-g)||0,Array.isArray(v)&&v.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,h),!(0===m||rt(m)&&m.every((t=>0===t)))){let r,s=0;return sl(e,i,n,y,b,m,new Array(4).fill(0).map(((a,o)=>(a,l,c,u)=>{v[o]&&(s===o-1&&v[o]===r||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:v[o]}),i,n,h),e.beginPath(),e.moveTo(a,l),r=v[o]),s=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),v[0]?e.lineTo(i+y,n):e.moveTo(i+y,n),v[1]?e.lineTo(i+y,n+b):e.moveTo(i+y,n+b),v[2]?e.lineTo(i,n+b):e.moveTo(i,n+b),v[3]){const t=v[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}},t.SplitRectAfterRenderContribution=al([g()],t.SplitRectAfterRenderContribution);const hl=new ol,ll=Xh,cl=Vh;class ul extends Hh{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){const{background:d,backgroundMode:p=h.backgroundMode,backgroundFit:f=h.backgroundFit}=t.attribute;if(d)if(t.backgroundImg){const i=t.resources.get(d);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Er(t.parent).group,{scrollX:n=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,r)}const n=t.AABBBounds;this.doDrawImage(e,i.data,n,p,f),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(J(d)){const{stroke:i,fill:n,lineWidth:r=1,cornerRadius:s=0,expandX:a=0,expandY:o=0}=d;if(!i&&!n)return;e.beginPath();const{x:h,y:l,width:c,height:u}=function(t){const e=us(t.attribute.boundsPadding),i=t.AABBBounds;let n=i.x1,r=i.y1,s=i.width(),a=i.height();return at(e)?(n+=e,r+=e,s-=2*e,a-=2*e):(n+=e[3],r+=e[0],s-=e[1]+e[3],a-=e[0]+e[2]),{x:n,y:r,width:s,height:a}}(t);s?sl(e,h-a,l-o,c+2*a,u+2*o,s):e.rect(h-a,l-o,c+2*a,u+2*o),e.globalAlpha=1,n&&(e.fillStyle=n,e.fill()),i&&r>0&&(e.lineWidth=r,e.strokeStyle=i,e.stroke())}else{e.beginPath();const r=t.AABBBounds;e.rect(i,n,r.width(),r.height()),e.fillStyle=d,e.globalAlpha=1,e.fill()}}}class dl extends ol{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){return super.drawShape(t,e,i,n,r,s,a,o,h,l,c,u)}}const pl=new dl,fl=new ul;class gl{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:f}=t.attribute,g=p&&!1!==p.visible,v=f&&!1!==f.visible;if(!g&&!v)return;const{size:m=h.size,opacity:y=h.opacity,x:b=h.x,y:x=h.y,scaleX:w=h.scaleX,scaleY:S=h.scaleY,keepStrokeScale:A=h.keepStrokeScale}=t.attribute,T=(r,s)=>{const a=!(!r||!r.stroke),{distance:o=h[s].distance}=r,l=A?o:yn(e,o,e.dpr),c="outerBorder"===s?1:-1;if(e.beginPath(),!1===d.drawOffset(e,m,i,n,c*l)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),u)u(e,r,h[s]);else if(a){const a=h[s].opacity;h[s].opacity=y,e.setStrokeStyle(t,r,(b-i)/w,(x-n)/S,h[s]),h[s].opacity=a,e.stroke()}};g&&T(p,"outerBorder"),v&&T(f,"innerBorder")}}const vl=new gl,ml=Xh,yl=Vh;class bl extends Yh{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.afterFillStroke}drawShape(t,e,i,n,r,s,a,o,h,l,c,u,d){var p,f,g,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:xs(h,"texture")),textureColor:b=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:xs(h,"textureColor")),textureSize:x=(null!==(g=t.attribute.textureSize)&&void 0!==g?g:xs(h,"textureSize")),texturePadding:w=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:xs(h,"texturePadding"))}=m;y&&this.drawTexture(y,t,e,i,n,h,b,x,w)}}var xl=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},wl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasArcRender=class extends Nh{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=io,this.builtinContributions=[qh,Zh,Kh],this.init(t)}drawArcTailCapPath(t,e,i,n,r,s,a,o){const h=o-a,l=t.getParsedAngle(),c=l.startAngle;let u=l.endAngle;u=o;const d=u>c;let p=!1;if(r<s){const t=r;r=s,s=t}const{outerDeltaAngle:f,xors:g,yors:v,xirs:m,yirs:y,limitedOcr:b,outerCornerRadiusStart:x,outerCornerRadiusEnd:w,maxOuterCornerRadius:S,xore:A,yore:T,xire:C,yire:_,limitedIcr:B,innerDeltaAngle:P,innerStartAngle:R,innerCornerRadiusStart:M,innerCornerRadiusEnd:E,maxInnerCornerRadius:k}=$o(t,c,u,s,r);if(b>Tt){const t=Ot(x,b),s=Ot(w,b),a=Xo(m,y,g,v,r,t,Number(d)),o=Xo(A,T,C,_,r,s,Number(d));if(b<S&&t===s)e.moveTo(i+a.cx+a.x01,n+a.cy+a.y01),e.arc(i+a.cx,n+a.cy,b,Mt(a.y01,a.x01),Mt(o.y01,o.x01),!d);else{const t=u-h-.03,a=Mt(o.y11,o.x11);e.arc(i,n,r,t,a,!d),s>0&&e.arc(i+o.cx,n+o.cy,s,Mt(o.y11,o.x11),Mt(o.y01,o.x01),!d)}}else e.moveTo(i+g,n+v);if(!(s>Tt)||P<.001)e.lineTo(i+C,n+_),p=!0;else if(B>Tt){const t=Ot(M,B),r=Ot(E,B),a=Xo(C,_,A,T,s,-r,Number(d)),o=Xo(g,v,m,y,s,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),B<k&&t===r){const t=Mt(o.y01,o.x01);e.arc(i+a.cx,n+a.cy,B,Mt(a.y01,a.x01),t,!d)}else{r>0&&e.arc(i+a.cx,n+a.cy,r,Mt(a.y01,a.x01),Mt(a.y11,a.x11),!d);const t=Mt(a.cy+a.y11,a.cx+a.x11),o=u-h-.03;e.arc(i,n,s,t,o,d)}}else e.lineTo(i+s*Et(R),n+s*Lt(R));return p}drawShape(t,e,i,n,r,s,a,o){const h=Er(t,null==s?void 0:s.theme).arc,{fill:l=h.fill,stroke:c=h.stroke,x:u=h.x,y:d=h.y,fillStrokeOrder:p=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:g,sVisible:v,doFill:m,doStroke:y}=f,{outerPadding:b=h.outerPadding,innerPadding:x=h.innerPadding,cap:w=h.cap,forceShowCap:S=h.forceShowCap}=t.attribute;let{outerRadius:A=h.outerRadius,innerRadius:T=h.innerRadius}=t.attribute;A+=b,T-=x;let C=0;const _=($(w)&&w||w[0])&&"conical"===l.gradient;if(_){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Rt(n-i)<Pt-Tt&&(C=e||0,l.startAngle-=C,l.endAngle-=C)}let B=!1;const{isFullStroke:P,stroke:R}=ls(c);if(m||P){e.beginPath(),qo(t,e,i,n,A,T),B=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,m,y,g,v,h,r,a,o);const s=()=>{m&&(a?a(e,t.attribute,h):g&&(e.setCommonStyle(t,t.attribute,u-i,d-n,h),e.fill()))},l=()=>{y&&P&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,h),e.stroke()))};p?(l(),s()):(s(),l())}if(!P&&y&&(e.beginPath(),qo(t,e,i,n,A,T,R),B||this.beforeRenderStep(t,e,i,n,m,y,g,v,h,r,a,o),o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),($(w)&&w||w[1])&&S){const{startAngle:s,endAngle:l}=t.getParsedAngle();if(Rt(l-s)>=Pt-Tt){e.beginPath();const s=Math.abs(A-T)/2/A,{endAngle:l=h.endAngle,fill:c=h.fill}=t.attribute,u=l;this.drawArcTailCapPath(t,e,i,n,A,T,u,u+s),B||this.beforeRenderStep(t,e,i,n,m,y,g,v,h,r,a,o);const d=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))};(()=>{if(m){const r=c;if("conical"===r.gradient){const s=Qo(0,0,l,r);a||Go&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=s,e.fill())}}})(),d()}}this.afterRenderStep(t,e,i,n,m,y,g,v,h,r,a,o),_&&(l.startAngle+=C,l.endAngle+=C)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).arc;this._draw(t,r,!1,i,n)}},t.DefaultCanvasArcRender=xl([g(),Sl(0,p(k)),Sl(0,v(eh)),wl("design:paramtypes",[Object])],t.DefaultCanvasArcRender);var Al=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Tl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cl=function(t,e){return function(i,n){e(i,n,t)}};function _l(t,e,i,n){if(!e.p1)return;const{offsetX:r=0,offsetY:s=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(r+e.p1.x,s+e.p1.y,r+e.p2.x,s+e.p2.y,r+e.p3.x,s+e.p3.y,a):t.lineTo(r+e.p1.x,s+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ii(e,i);t.bezierCurveTo(r+n.p1.x,s+n.p1.y,r+n.p2.x,s+n.p2.y,r+n.p3.x,s+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(r+n.x,s+n.y,a)}}function Bl(t,e,i,n,r,s,a){var o;let h=e.p0,l=n;if(i&&i.originP1===i.originP2&&(h=i.p0),e.defined)n||(t.lineTo(h.x+r,h.y+s,a),l=!n);else{const{originP1:i,originP2:c}=e;let u;if(i&&!1!==i.defined?u=h:i&&!1!==c.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){l=!n;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+r,o+s,a)}else u&&(l=!n,t.lineTo(u.x+r,u.y+s,a))}return l}function Pl(e,i,n,r,s){const{offsetX:a=0,offsetY:o=0,offsetZ:h=0,mode:l="none",drawConnect:c=!1}=s||{};if(c&&"none"===l)return;if(!i)return;let u=!0;const{curves:d}=i;if(n>=1){if(c){let t,i=!0;d.forEach(((n,r)=>{n.originP1!==n.originP2?(i=Bl(e,n,t,i,a,o,h),t=n):t=n}))}else d.forEach((t=>{t.defined?(u&&e.moveTo(t.p0.x+a,t.p0.y+o,h),_l(e,t,1,s),u=!1):u=!0}));return}if(n<=0)return;let p;"x"===r?p=t.Direction.ROW:"y"===r?p=t.Direction.COLUMN:"auto"===r&&(p=i.direction);const f=n*i.tryUpdateLength(p);let g=0,v=!0,m=null;for(let t=0,i=d.length;t<i;t++){const i=d[t],n=i.getLength(p),r=(f-g)/n;if(g+=n,r<0)break;if(c){if(i.originP1===i.originP2){m=i;continue}v=Bl(e,i,m,v,a,o,h),m=i}else{if(!i.defined){u=!0;continue}u&&e.moveTo(i.p0.x+a,i.p0.y+o,h),_l(e,i,Ot(r,1),s),u=!1}}}function Rl(t,e,i,n){const{offsetX:r=0,offsetY:s=0}=n||{},a=e?e.points[e.points.length-1]:i.points[0];t.moveTo(a.x+r,a.y+s),i.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+r,e.y+s):t.moveTo(e.x+r,e.y+s)}))}function Ml(t,e,i,n){const{offsetX:r=0,offsetY:s=0}=n||{},{points:a}=i,o=[];for(let t=0;t<a.length;t++)a[t].defined;o.push(a),o.forEach(((i,n)=>{var a,o,h,l;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+r,c.y+s),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+r,e.y+s):t.moveTo(e.x+r,e.y+s)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(h=c.x1)&&void 0!==h?h:c.x,null!==(l=c.y1)&&void 0!==l?l:c.y),t.closePath()}))}t.DefaultCanvasCircleRender=class extends Nh{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=so,this.builtinContributions=[Qh,el,tl],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const h=Er(t,null==s?void 0:s.theme).circle,{radius:l=h.radius,startAngle:c=h.startAngle,endAngle:u=h.endAngle,x:d=h.x,y:p=h.y,fillStrokeOrder:f=h.fillStrokeOrder}=t.attribute,g=this.valid(t,h,a,o);if(!g)return;const{fVisible:v,sVisible:m,doFill:y,doStroke:b}=g;e.beginPath(),e.arc(i,n,l,c,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,y,b,v,m,h,r,a,o);const x=()=>{y&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,p-n,h),e.fill()))},w=()=>{b&&(o?o(e,t.attribute,h):m&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,h),e.stroke()))};f?(w(),x()):(x(),w()),this.afterRenderStep(t,e,i,n,y,b,v,m,h,r,a,o)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).circle;this._draw(t,r,!1,i,n)}},t.DefaultCanvasCircleRender=Al([g(),Cl(0,p(k)),Cl(0,v(nh)),Tl("design:paramtypes",[Object])],t.DefaultCanvasCircleRender);var El=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};function kl(e,i,n,r){var s;const{drawConnect:a=!1,mode:o="none"}=r||{};if(a&&"none"===o)return;const{top:h,bottom:l}=i;if(h.curves.length!==l.curves.length)return;if(n>=1){const t=[],i=[];let n=!0;if(a){let n,s,a=!0;const o=h.curves.length;h.curves.forEach(((h,c)=>{const u=l.curves[o-c-1];let d=h,p=u;if(h.originP1===h.originP2)return n=h,void(s=u);if(n&&n.originP1===n.originP2&&(d=n,p=s),h.defined)a||(t.push(d),i.push(p),Ol(e,t,i,r),t.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:s}=h;let o,l;n&&!1!==n.defined?(o=d,l=p):n&&!1!==s.defined&&(o=h,l=u),a?(a=!a,t.push(o||h),i.push(l||u)):o&&(a=!a,t.push(o||h),i.push(l||u),Ol(e,t,i,r),t.length=0,i.length=0)}n=h})),Ol(e,t,i,r)}else{for(let s=0,a=h.curves.length;s<a;s++){const o=h.curves[s];n!==o.defined?(n?(Ll(e,t,i,r),t.length=0,i.length=0):(t.push(o),i.push(l.curves[a-s-1])),n=!n):n&&(t.push(o),i.push(l.curves[a-s-1]))}Ll(e,t,i,r)}return}if(n<=0)return;let{direction:c}=r||{};const{curves:u}=h,d=null!==(s=u[u.length-1].p3)&&void 0!==s?s:u[u.length-1].p1,p=Rt(d.x-u[0].p0.x),f=Rt(d.y-u[0].p0.y);c=null!=c?c:p>f?t.Direction.ROW:t.Direction.COLUMN,Number.isFinite(p)||(c=t.Direction.COLUMN),Number.isFinite(f)||(c=t.Direction.ROW);const g=n*(c===t.Direction.ROW?p:f);let v=0,m=!0;const y=[],b=[];let x,w,S=!0;for(let t=0,i=h.curves.length;t<i;t++){const n=h.curves[t],s=n.getLength(c),o=(g-v)/s;if(o<0)break;if(v+=s,a){const s=l.curves[i-t-1];let a=n,o=s;if(n.originP1===n.originP2){x=n,w=s;continue}if(x&&x.originP1===x.originP2&&(a=x,o=w),n.defined)S||(y.push(a),b.push(o),Ol(e,y,b,r),y.length=0,b.length=0,S=!S);else{const{originP1:t,originP2:i}=n;let h,l;t&&!1!==t.defined?(h=a,l=o):t&&!1!==i.defined&&(h=n,l=s),S?(S=!S,y.push(h||n),b.push(l||s)):h&&(S=!S,y.push(h||n),b.push(l||s),Ol(e,y,b,r),y.length=0,b.length=0)}x=n}else{let s=null,a=null;m!==n.defined?(m?(Ll(e,y,b,r),y.length=0,b.length=0):(s=n,a=l.curves[i-t-1]),m=!m):m&&(s=n,a=l.curves[i-t-1]),s&&a&&(o<1&&(s=s.p2&&s.p3?ii(s,o)[0]:ri(s,o)[0],a=a.p2&&a.p3?ii(a,1-o)[1]:ri(a,1-o)[1]),s.defined=m,a.defined=m,y.push(s),b.push(a)),s=null,a=null}}a?Ol(e,y,b,r):Ll(e,y,b,r)}function Ol(t,e,i,n){if(e.length<2)return;const{offsetX:r=0,offsetY:s=0,offsetZ:a=0,mode:o}=n||{};let h=e[0];t.moveTo(h.p0.x+r,h.p0.y+s,a),h=e[e.length-1];let l=h.p3||h.p1;t.lineTo(l.x+r,l.y+s,a),h=i[i.length-1],t.lineTo(h.p0.x+r,h.p0.y+s,a),h=i[0],l=h.p3||h.p1,t.lineTo(l.x+r,l.y+s,a),t.closePath()}function Ll(t,e,i,n){const{offsetX:r=0,offsetY:s=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+r,e.p0.y+s,a),_l(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const h=i[e];h.defined?(o&&t.lineTo(h.p0.x+r,h.p0.y+s,a),_l(t,h,1,n),o=!1):o=!0}t.closePath()}t.DefaultCanvasLineRender=class extends Nh{constructor(){super(...arguments),this.numberType=lo}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).line;this._draw(t,r,!1,i,n)}drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,f){var g,v,m,y,b;if(!e)return;t.beginPath();const x=null!==(g=this.z)&&void 0!==g?g:0;Pl(t.camera?t:t.nativeContext,e,h,l,{offsetX:c,offsetY:u,offsetZ:x}),d.cache&&!rt(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:w=0,x:S=0}=a;!1!==i&&(p?p(t,a,o):r&&(t.setCommonStyle(d,a,w-c,S-u,o),t.fill())),!1!==n&&(f?f(t,a,o):s&&(t.setStrokeStyle(d,a,w-c,S-u,o),t.stroke()));let{connectedType:A,connectedX:T,connectedY:C,connectedStyle:_}=a;if(rt(o)?(A=null!==(v=null!=A?A:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,T=null!==(m=null!=T?T:o[0].connectedX)&&void 0!==m?m:o[1].connectedX,C=null!==(y=null!=C?C:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,_=null!==(b=null!=_?_:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,T=null!=T?T:o.connectedX,C=null!=C?C:o.connectedY,_=null!=_?_:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Pl(t.camera?t:t.nativeContext,e,h,l,{offsetX:c,offsetY:u,offsetZ:x,drawConnect:!0,mode:A,zeroX:T,zeroY:C});const g=[];rt(o)?o.forEach((t=>g.push(t))):g.push(o),g.push(a),!1!==i&&(p?p(t,a,o):r&&(t.setCommonStyle(d,_,w-c,S-u,g),t.fill())),!1!==n&&(f?f(t,a,o):s&&(t.setStrokeStyle(d,_,w-c,S-u,g),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,n,r,s,a,o,h,l,c,u,d){var p;e.beginPath();const f=null!==(p=this.z)&&void 0!==p?p:0,{points:g}=t.attribute,v=g[0];e.moveTo(v.x+a,v.y+o,f);for(let t=1;t<g.length;t++){const i=g[t];e.lineTo(i.x+a,i.y+o,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h);const{x:m=0,x:y=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,h):r&&(e.setCommonStyle(t,t.attribute,m-a,y-o,h),e.fill())),!1!==n&&(d?d(e,t.attribute,h):s&&(e.setStrokeStyle(t,t.attribute,m-a,y-o,h),e.stroke()))}drawShape(t,e,i,n,r,s,a,o){const h=Er(t,null==s?void 0:s.theme).line,{fill:l=h.fill,stroke:c=h.stroke,fillOpacity:u=h.fillOpacity,strokeOpacity:d=h.strokeOpacity,segments:p,points:f,closePath:g,curveTension:v=h.curveTension}=t.attribute;if(!this.valid(t,h,a,o))return;let{curveType:m=h.curveType}=t.attribute;g&&"linear"===m&&(m="linearClosed");const{clipRange:y=h.clipRange,clipRangeByDimension:b=h.clipRangeByDimension}=t.attribute;if(1===y&&!p&&!f.some((t=>!1===t.defined))&&"linear"===m)return this.drawLinearLineHighPerformance(t,e,!!l,!!c,u,d,i,n,h,r,s,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=ji(t.points,m,{startPoint:e,curveTension:v});return n=r,r})).filter((t=>!!t)),"linearClosed"===m){let e;for(let i=0;i<t.cache.length;i++){const n=t.cache[i];for(let t=0;t<n.curves.length;t++)if(n.curves[t].defined){e=n.curves[t].p0;break}if(e)break}t.cache[t.cache.length-1]&&t.cache[t.cache.length-1].lineTo(e.x,e.y,!0)}}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=ji(n,m,{curveTension:v})}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===y){let s=!1;t.cache.forEach(((p,f)=>{s||(s=this.drawSegmentItem(e,p,!!l,!!c,u,d,r[f],[h,t.attribute],y,b,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*s;let f=0,g=!1;t.cache.forEach(((s,v)=>{if(g)return;const m=s.getLength(),y=(p-f)/m;f+=m,y>0&&(g=this.drawSegmentItem(e,s,!!l,!!c,u,d,r[v],[h,t.attribute],Ot(y,1),b,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!l,!!c,u,d,t.attribute,h,y,b,i,n,t,a,o)}},t.DefaultCanvasLineRender=El([g()],t.DefaultCanvasLineRender);const Il=new bl,Dl=Vh;var jl=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Ul=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasAreaRender=class extends Nh{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=ro,this.builtinContributions=[Il,Dl],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,r,s,a,o,h,l,c,u,d){var p,f,g;const{points:v}=t.attribute;if(v.length<2)return;e.beginPath();const m=null!==(p=this.z)&&void 0!==p?p:0,y=v[0];e.moveTo(y.x+a,y.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}for(let t=v.length-1;t>=0;t--){const i=v[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(g=i.y1)&&void 0!==g?g:i.y)+o,m)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,a,o,!!r,!1,i,!1,h,l,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,h):r&&(e.setCommonStyle(t,t.attribute,b-a,x-o,h),e.fill())),this.afterRenderStep(t,e,a,o,!!r,!1,i,!1,h,l,u,null,{attribute:t.attribute}),(()=>{var i,r;if(n){const{stroke:n=h&&h.stroke}=t.attribute;if(rt(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(y.x+a,y.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}}else if(n[2]){const t=v[v.length-1];e.moveTo(t.x+a,t.y+o,m);for(let t=v.length-2;t>=0;t--){const n=v[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(r=n.y1)&&void 0!==r?r:n.y)+o,m)}}d?d(e,t.attribute,h):(e.setStrokeStyle(t,t.attribute,b-a,x-o,h),e.stroke())}})()}drawShape(t,e,i,n,r,s,a,o){var h,l,c,u,d,p;const f=Er(t,null==s?void 0:s.theme).area,{fill:g=f.fill,stroke:v=f.stroke,fillOpacity:m=f.fillOpacity,z:y=f.z,strokeOpacity:b=f.strokeOpacity,curveTension:x=f.curveTension}=t.attribute,w=this.valid(t,f,a,o);if(!w)return;const{doFill:S}=w,A=w.doStroke&&w.sVisible,{clipRange:T=f.clipRange,closePath:C,points:_,segments:B}=t.attribute;let{curveType:P=f.curveType}=t.attribute;if(C&&"linear"===P&&(P="linearClosed"),1===T&&!B&&!_.some((t=>!1===t.defined))&&"linear"===P)return this.drawLinearAreaHighPerformance(t,e,!!g,A,m,b,i,n,f,r,s,a,o);if(t.shouldUpdateShape()){if(B&&B.length){let e,i;const n=B.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const r=ji(t.points,P,{startPoint:e,curveTension:x});return i=r,r})).filter((t=>!!t));let r;const s=[];for(let t=B.length-1;t>=0;t--){const e=B[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(h=e[t].x1)&&void 0!==h?h:e[t].x,y:null!==(l=e[t].y1)&&void 0!==l?l:e[t].y});if(0!==t){const e=B[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(u=n.y1)&&void 0!==u?u:n.y})}i.length>1&&(r=ji(i,"stepBefore"===P?"stepAfter":"stepAfter"===P?"stepBefore":P,{curveTension:x}),s.unshift(r))}t.cacheArea=s.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!_||!_.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=_,i=[];for(let t=_.length-1;t>=0;t--)i.push({x:null!==(d=_[t].x1)&&void 0!==d?d:_[t].x,y:null!==(p=_[t].y1)&&void 0!==p?p:_[t].y});const n=ji(e,P,{curveTension:x}),r=ji(i,"stepBefore"===P?"stepAfter":"stepAfter"===P?"stepBefore":P,{curveTension:x});t.cacheArea={top:n,bottom:r}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const s=t.attribute.segments.filter((t=>t.points.length));if(1===s[0].points.length&&s.shift(),1===T){let h=!1;t.cacheArea.forEach(((l,c)=>{h||(h=this.drawSegmentItem(e,l,S,m,A,b,s[c],[f,t.attribute],T,i,n,y,t,r,a,o))}))}else{const h=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=T*h;let c=0,u=!1;t.cacheArea.forEach(((h,d)=>{if(u)return;const p=h.top.getLength(),g=(l-c)/p;c+=p,g>0&&(u=this.drawSegmentItem(e,h,S,m,A,b,s[d],[f,t.attribute],Ot(g,1),i,n,y,t,r,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,m,A,b,t.attribute,f,T,i,n,y,t,r,a,o)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).area;this._draw(t,r,!1,i,n)}drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,f,g){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,!1,f,g),v=v||this._drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,!0,f,g),v}_drawSegmentItem(e,i,n,r,s,a,o,h,l,c,u,d,p,f,g,v,m){var y,b,x,w;if(!(i&&i.top&&i.bottom&&i.top.curves&&i.top.curves.length&&i.bottom.curves&&i.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:T,connectedStyle:C}=o;const _=[];if(g&&(rt(h)?(S=null!==(y=null!=S?S:h[0].connectedType)&&void 0!==y?y:h[1].connectedType,A=null!==(b=null!=A?A:h[0].connectedX)&&void 0!==b?b:h[1].connectedX,T=null!==(x=null!=T?T:h[0].connectedY)&&void 0!==x?x:h[1].connectedY,C=null!==(w=null!=C?C:h[0].connectedStyle)&&void 0!==w?w:h[1].connectedStyle):(S=null!=S?S:h.connectedType,A=null!=A?A:h.connectedX,T=null!=T?T:h.connectedY,C=null!=C?C:h.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),rt(h)?h.forEach((t=>_.push(t))):_.push(h),_.push(o)),g&&"none"===S)return!1;e.beginPath();const{points:B,segments:P}=p.attribute;let R,M,E=t.Direction.ROW;if(P){const t=P[P.length-1];M=P[0].points[0],R=t.points[t.points.length-1]}else M=B[0],R=B[B.length-1];const k=Rt(R.x-M.x),O=Rt(R.y-M.y);E=null==R.x1?t.Direction.ROW:null==R.y1?t.Direction.COLUMN:Number.isFinite(k+O)?k>O?t.Direction.ROW:t.Direction.COLUMN:t.Direction.ROW,kl(e.camera?e:e.nativeContext,i,l,{offsetX:c,offsetY:u,offsetZ:d,direction:E,drawConnect:g,mode:S,zeroX:A,zeroY:T}),this.beforeRenderStep(p,e,c,u,!!r,!1,n,!1,h,f,v,null,{attribute:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(p,o,h);const{x:L=0,x:I=0}=o;return!1!==n&&(v?v(e,o,h):r&&(e.setCommonStyle(p,g?C:o,L-c,I-u,g?_:h),e.fill())),this.afterRenderStep(p,e,c,u,!!r,!1,n,!1,h,f,v,null,{attribute:o}),(()=>{if(!1!==s)if(m)m(e,o,h);else{const{stroke:n=h&&h[1]&&h[1].stroke}=o;rt(n)&&(n[0]||n[2])&&!1===n[1]&&(e.beginPath(),Pl(e.camera?e:e.nativeContext,n[0]?i.top:i.bottom,l,E===t.Direction.ROW?"x":"y",{offsetX:c,offsetY:u,offsetZ:d,drawConnect:g,mode:S,zeroX:A,zeroY:T})),e.setStrokeStyle(p,g?C:o,L-c,I-u,g?_:h),e.stroke()}})(),!1}},t.DefaultCanvasAreaRender=jl([g(),Wl(0,p(k)),Wl(0,v(ih)),Ul("design:paramtypes",[Object])],t.DefaultCanvasAreaRender);const Nl=Xh,Gl=Vh;var Fl=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},zl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasPathRender=class extends Nh{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=co,this.builtinContributions=[Gl,Nl],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var h,l,c;const u=null!==(h=this.tempTheme)&&void 0!==h?h:Er(t,null==s?void 0:s.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:f=u.fillStrokeOrder}=t.attribute,g=null!==(l=this.z)&&void 0!==l?l:0,v=this.valid(t,u,a,o);if(!v)return;const{fVisible:m,sVisible:y,doFill:b,doStroke:x}=v;if(e.beginPath(),t.pathShape)Ke(t.pathShape.commandList,e,i,n,1,1,g);else{Ke((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,n,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,b,x,m,y,u,r,a,o);const w=()=>{x&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,u),e.stroke()))},S=()=>{b&&(a?a(e,t.attribute,u):m&&(e.setCommonStyle(t,t.attribute,d-i,p-n,u),e.fill()))};f?(w(),S()):(S(),w()),this.afterRenderStep(t,e,i,n,b,x,m,y,u,r,a,o)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).path;this.tempTheme=r,this._draw(t,r,!1,i,n),this.tempTheme=null}},t.DefaultCanvasPathRender=Fl([g(),Hl(0,p(k)),Hl(0,v(ah)),zl("design:paramtypes",[Object])],t.DefaultCanvasPathRender);var Vl=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Yl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasRectRender=class extends Nh{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=fo,this.builtinContributions=[hl,cl,ll],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var h;const l=null!==(h=this.tempTheme)&&void 0!==h?h:Er(t,null==s?void 0:s.theme).rect,{fill:c=l.fill,background:u,stroke:d=l.stroke,cornerRadius:p=l.cornerRadius,opacity:f=l.opacity,fillOpacity:g=l.fillOpacity,lineWidth:v=l.lineWidth,strokeOpacity:m=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:w=l.x,y:S=l.y,fillStrokeOrder:A=l.fillStrokeOrder}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:b-w)||0,C=(null!=C?C:x-S)||0;const _=Fo(f,g,T,C,c),B=Ho(f,m,T,C),P=Wo(c,u),R=No(d,v);if(!t.valid||!y)return;if(!P&&!R)return;if(!(_||B||a||o||u))return;0===p||rt(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,n,T,C)):(e.beginPath(),sl(e,i,n,T,C,p));const M={doFill:P,doStroke:R};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,P,R,_,B,l,r,a,o,M);const E=()=>{M.doFill&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,w-i,S-n,l),e.fill()))},k=()=>{M.doStroke&&(o?o(e,t.attribute,l):B&&(e.setStrokeStyle(t,t.attribute,w-i,S-n,l),e.stroke()))};A?(k(),E()):(E(),k()),this.afterRenderStep(t,e,i,n,P,R,_,B,l,r,a,o)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).rect;this.tempTheme=r,this._draw(t,r,!1,i,n),this.tempTheme=null}},t.DefaultCanvasRectRender=Vl([g(),Xl(0,p(k)),Xl(0,v(hh)),Yl("design:paramtypes",[Object])],t.DefaultCanvasRectRender);var $l=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ql=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasSymbolRender=class extends Nh{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=mo,this.builtinContributions=[vl,yl,ml],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var h;const l=Er(t,null==s?void 0:s.theme).symbol,{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:f=l.scaleY,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:m,sVisible:y,doFill:b,doStroke:x}=v,w=t.getParsedPath();if(!w)return;const{keepDirIn3d:S=l.keepDirIn3d}=t.attribute,A=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();const T=(r,s)=>{var h,c,v;if(t._parsedPath.svgCache){const e=Object.assign({},s);e.fill=null!==(h=s.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=s.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=s.stroke)&&void 0!==v?v:t.attribute.stroke,s=e}const m=()=>{s.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,s,u-i,d-n,l),e.fill()))},y=()=>{s.stroke&&(o?o(e,t.attribute,l):(e.setStrokeStyle(t,s,(u-i)/p,(d-n)/f,l),e.stroke()))};g?(y(),m()):(m(),y())};if(S&&e.camera&&e.project){const t=e.project(i,n,A),r=e.camera;e.camera=null,!1===w.draw(e,rt(c)?[c[0]*p,c[1]*f]:c*p,t.x,t.y,void 0,T)&&e.closePath(),e.camera=r}else!1===w.draw(e,c,i,n,A,T)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,b,x,m,y,l,r,a,o);const C=()=>{b&&!w.isSvg&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-n,l),e.fill()))},_=()=>{x&&!w.isSvg&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,(u-i)/p,(d-n)/f,l),e.stroke()))};g?(_(),C()):(C(),_()),this.afterRenderStep(t,e,i,n,b,x,m,y,l,r,a,o)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).symbol;this._draw(t,r,!1,i,n)}},t.DefaultCanvasSymbolRender=$l([g(),Kl(0,p(k)),Kl(0,v(lh)),ql("design:paramtypes",[Object])],t.DefaultCanvasSymbolRender);const Zl=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new oe)}allocate(t,e,i,n){if(!this.pools.length)return(new oe).setValue(t,e,i,n);const r=this.pools.pop();return r.x1=t,r.y1=e,r.x2=i,r.y2=n,r}allocateByObj(t){if(!this.pools.length)return new oe(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const Jl=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let Ql,tc;function ec(t){return Ql||(Ql=Jl.CreateGraphic("text",{})),Ql.initAttributes(t),Ql.AABBBounds}const ic=new class extends Hh{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,n,r,s,a,o,h,l,c,u){var d,p,f,g,v,m,y,b,x,w;const{backgroundMode:S=h.backgroundMode,backgroundFit:A=h.backgroundFit}=t.attribute;let T,{background:C}=t.attribute;if(!C)return;const _=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let B;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const P=J(C)&&C.background,R=t.transMatrix.onlyTranslate();if(P){const e=t.AABBBounds,i=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),n=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(g=C.dy)&&void 0!==g?g:0),r=null!==(v=C.width)&&void 0!==v?v:e.width(),s=null!==(m=C.height)&&void 0!==m?m:e.height();if(B=Zl.allocate(i,n,i+r,n+s),C=C.background,!R){const t=B.width(),e=B.height();B.set((null!==(y=C.x)&&void 0!==y?y:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(x=C.y)&&void 0!==x?x:0)+(null!==(w=C.dy)&&void 0!==w?w:0),t,e)}}else B=t.AABBBounds,R||(B=ec(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const r=t.resources.get(C);if("success"!==r.state||!r.data)return void _();e.highPerformanceSave(),R&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,h),this.doDrawImage(e,r.data,B,S,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:r}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C,r?(sl(e,B.x1,B.y1,B.width(),B.height(),r),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}P&&Zl.free(B),_()}};var nc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},rc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sc=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasTextRender=class extends Nh{constructor(t){super(),this.textRenderContribitions=t,this.numberType=yo,this.builtinContributions=[ic],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var h,l,c;const u=Er(t,null==s?void 0:s.theme).text,{text:d,underline:p=u.underline,lineThrough:f=u.lineThrough,keepDirIn3d:g=u.keepDirIn3d,direction:v=u.direction,fontSize:m=u.fontSize,verticalMode:y=u.verticalMode,x:b=u.x,y:x=u.y}=t.attribute,w=null!==(h=Ts(t.attribute.lineHeight,m))&&void 0!==h?h:m,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:T,doFill:C,doStroke:_}=S,B=!g,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,C,_,A,T,u,r,a,o),B&&this.transformUseContext2d(t,u,P,e);const R=(r,s,h,l)=>{let c=i+s;const d=n+h;if(l){e.highPerformanceSave(),c+=m;const t=kh.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),kh.free(t)}_&&(o?o(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,u),e.strokeText(r,c,d,P))),C&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,b-i,x-n,u),e.fillText(r,c,d,P))),l&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,P),"horizontal"===v){const{multilineLayout:r}=t;if(!r)return void e.highPerformanceRestore();const{xOffset:s,yOffset:h}=r.bbox;_&&(o?o(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,u),r.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+s+i,(t.topOffset||0)+h+n,P)})))),C&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,b-i,x-n,u),r.lines.forEach((r=>{e.fillText(r.str,(r.leftOffset||0)+s+i,(r.topOffset||0)+h+n,P),this.drawUnderLine(p,f,t,(r.leftOffset||0)+s+i,(r.topOffset||0)+h+n,r.descent,(r.descent-r.ascent)/2,P,u,e,{width:r.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:n=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(l=t.getBaselineMapAlign()[n])&&void 0!==l?l:"left",n=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const r=t.cache,{verticalList:s}=r;e.textAlign="left",e.textBaseline="top";const a=w*s.length;let o=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=kt(e,o)}));let h=0,d=0;"bottom"===n?d=-a:"middle"===n&&(d=-a/2),"center"===i?h-=o/2:"right"===i&&(h-=o),s.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),r=o-n;let s=h;"center"===i?s+=r/2:"right"===i&&(s+=r),t.forEach((t=>{const{text:i,width:n,direction:r}=t;R(i,a-(e+1)*w+d,s,r),s+=n}))}))}B&&this.restoreTransformUseContext2d(t,u,P,e),this.afterRenderStep(t,e,i,n,C,_,A,T,u,r,a,o)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).text,{keepDirIn3d:s=r.keepDirIn3d}=t.attribute,a=!s;this._draw(t,r,a,i,n)}drawUnderLine(t,e,i,n,r,s,a,o,h,l,c){if(e+t<=0)return;const{textAlign:u=h.textAlign,fill:d=h.fill,opacity:p=h.opacity,underlineOffset:f=h.underlineOffset,underlineDash:g=h.underlineDash,fillOpacity:v=h.fillOpacity}=i.attribute,m=!K(c),y=m?c.width:i.clipedWidth,b=m?0:ph(u,y),x={lineWidth:0,stroke:d,opacity:p,strokeOpacity:v};if(t){x.lineWidth=t,l.setStrokeStyle(i,x,n,r,h),g&&l.setLineDash(g),l.beginPath();const e=r+s+f;l.moveTo(n+b,e,o),l.lineTo(n+b+y,e,o),l.stroke()}if(e){x.lineWidth=e,l.setStrokeStyle(i,x,n,r,h),l.beginPath();const t=r+a;l.moveTo(n+b,t,o),l.lineTo(n+b+y,t,o),l.stroke()}}},t.DefaultCanvasTextRender=nc([g(),sc(0,p(k)),sc(0,v(ch)),rc("design:paramtypes",[Object])],t.DefaultCanvasTextRender);var ac=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};function oc(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let r=1;r<e.length;r++)t.lineTo(e[r].x+i,e[r].y+n)}function hc(t,e){return Math.sqrt(t*t+e*e)}function lc(t,e,i,n,r){const s=e/i;return{x:t.x-n*s,y:t.y-r*s}}t.AbstractGraphicRender=class{},t.AbstractGraphicRender=ac([g()],t.AbstractGraphicRender);const cc=Xh,uc=Vh;var dc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fc=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasPolygonRender=class extends Nh{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=uo,this.builtinContributions=[uc,cc],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const h=Er(t,null==s?void 0:s.theme).polygon,{points:l=h.points,cornerRadius:c=h.cornerRadius,x:u=h.x,y:d=h.y,closePath:p=h.closePath,fillStrokeOrder:f=h.fillStrokeOrder}=t.attribute,g=this.valid(t,h,a,o);if(!g)return;const{fVisible:v,sVisible:m,doFill:y,doStroke:b}=g;e.beginPath(),c<=0||rt(c)&&c.every((t=>0===t))?oc(e.camera?e:e.nativeContext,l,i,n):function(t,e,i,n,r){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void oc(t,e,i,n);let o=0,h=e.length-1;s||(o+=1,h-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let s=o;s<=h;s++){const o=e[0===s?h:(s-1)%e.length],l=e[s%e.length],c=e[(s+1)%e.length],u=l.x-o.x,d=l.y-o.y,p=l.x-c.x,f=l.y-c.y,g=(Math.atan2(d,u)-Math.atan2(f,p))/2,v=Math.abs(Math.tan(g));let m=Array.isArray(r)?null!==(a=r[s%e.length])&&void 0!==a?a:0:r,y=m/v;const b=hc(u,d),x=hc(p,f),w=Math.min(b,x);y>w&&(y=w,m=w*v);const S=lc(l,y,b,u,d),A=lc(l,y,x,p,f),T=2*l.x-S.x-A.x,C=2*l.y-S.y-A.y,_=hc(T,C),B=lc(l,hc(y,m),_,T,C);let P=Math.atan2(S.y-B.y,S.x-B.x);const R=Math.atan2(A.y-B.y,A.x-B.x);let M=R-P;M<0&&(P=R,M=-M),M>Math.PI&&(M-=Math.PI),0===s?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),M&&t.arcTo(l.x+i,l.y+n,A.x+i,A.y+n,m),t.lineTo(A.x+i,A.y+n)}s||t.lineTo(e[h+1].x+i,e[h+1].y+n)}(e.camera?e:e.nativeContext,l,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,y,b,v,m,h,r,a,o);const x=()=>{y&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,u-i,d-n,h),e.fill()))},w=()=>{b&&(o?o(e,t.attribute,h):m&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,h),e.stroke()))};f?(w(),x()):(x(),w()),this.afterRenderStep(t,e,i,n,y,b,v,m,h,r,a,o)}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).polygon;this._draw(t,r,!1,i,n)}},t.DefaultCanvasPolygonRender=dc([g(),fc(0,p(k)),fc(0,v(oh)),pc("design:paramtypes",[Object])],t.DefaultCanvasPolygonRender);var gc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},vc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mc=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasGroupRender=class{constructor(t){this.groupRenderContribitions=t,this.numberType=oo}drawShape(e,i,n,r,s,a,o,h){const l=Er(e,null==a?void 0:a.theme).group,{fill:c=l.fill,background:u,stroke:d=l.stroke,opacity:p=l.opacity,width:f=l.width,height:g=l.height,clip:v=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:b=l.cornerRadius,path:x=l.path,lineWidth:w=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,x:T=l.x,y:C=l.y}=e.attribute,_=Fo(p,m,f,g,c),B=Ho(p,y,f,g),P=Wo(c,u),R=No(d,w);if(!e.valid||!S)return;if(!v){if(!P&&!R)return;if(!(_||B||o||h||u))return}if(x&&x.length&&s.drawContribution){const t=i.disableFill,e=i.disableStroke,n=i.disableBeginPath;i.disableFill=!0,i.disableStroke=!0,i.disableBeginPath=!0,x.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,a)})),i.disableFill=t,i.disableStroke=e,i.disableBeginPath=n}else 0===b||rt(b)&&b.every((t=>0===t))?(i.beginPath(),i.rect(n,r,f,g)):(i.beginPath(),sl(i,n,r,f,g,b));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(nl));const M={doFill:P,doStroke:R};this._groupRenderContribitions.forEach((a=>{a.time===t.BaseRenderContributionTime.beforeFillStroke&&a.drawShape(e,i,n,r,P,R,_,B,l,s,o,h,M)})),v&&i.clip(),i.setShadowBlendStyle&&i.setShadowBlendStyle(e,e.attribute,l);const E=()=>{M.doFill&&(o?o(i,e.attribute,l):_&&(i.setCommonStyle(e,e.attribute,T-n,C-r,l),i.fill()))},k=()=>{M.doStroke&&(h?h(i,e.attribute,l):B&&(i.setStrokeStyle(e,e.attribute,T-n,C-r,l),i.stroke()))};A?(k(),E()):(E(),k()),this._groupRenderContribitions.forEach((a=>{a.time===t.BaseRenderContributionTime.afterFillStroke&&a.drawShape(e,i,n,r,P,R,_,B,l,s,o,h)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;const{clip:s,baseOpacity:a=1}=t.attribute;s?r.save():r.highPerformanceSave();const o=r.baseGlobalAlpha;r.baseGlobalAlpha*=a;const h=Er(t,null==n?void 0:n.theme).group,l=r.modelMatrix;if(r.camera){const e=Oh.allocate(),i=Oh.allocate();jh(i,t,h),Ah(e,l||e,i),r.modelMatrix=e,Oh.free(i),r.setTransform(1,0,0,1,0,0,!0)}else r.transformFromMatrix(t.transMatrix,!0);r.beginPath(),n.skipDraw?this.drawShape(t,r,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,r,0,0,i);const{scrollX:c=h.scrollX,scrollY:u=h.scrollY}=t.attribute;let d;(c||u)&&r.translate(c,u),n&&n.drawingCb&&(d=n.drawingCb()),r.modelMatrix!==l&&Oh.free(r.modelMatrix),r.modelMatrix=l,r.baseGlobalAlpha=o,d&&d.then?d.then((()=>{s?r.restore():r.highPerformanceRestore()})):s?r.restore():r.highPerformanceRestore()}},t.DefaultCanvasGroupRender=gc([g(),mc(0,p(k)),mc(0,v(rh)),vc("design:paramtypes",[Object])],t.DefaultCanvasGroupRender);var yc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,n){e(i,n,t)}};const wc=["","repeat-x","repeat-y","repeat"];t.DefaultCanvasImageRender=class extends Nh{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=ho,this.builtinContributions=[pl,fl],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const h=Er(t).image,{width:l=h.width,height:c=h.height,repeatX:u=h.repeatX,repeatY:d=h.repeatY,x:p=h.x,y:f=h.y,cornerRadius:g=h.cornerRadius,fillStrokeOrder:v=h.fillStrokeOrder,image:m}=t.attribute,y=this.valid(t,h,a);if(!y)return;const{fVisible:b,sVisible:x,doFill:w,doStroke:S}=y;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,h),this.beforeRenderStep(t,e,i,n,w,!1,b,!1,h,r,a);const A=()=>{if(w)if(a)a(e,t.attribute,h);else if(b){if(!m||!t.resources)return;const r=t.resources.get(m);if("success"!==r.state)return;let s=!1;0===g||rt(g)&&g.every((t=>0===t))||(e.beginPath(),sl(e,i,n,l,c,g),e.save(),e.clip(),s=!0),e.setCommonStyle(t,t.attribute,i,n,h);let a=0;if("repeat"===u&&(a|=1),"repeat"===d&&(a|=2),a){const t=e.createPattern(r.data,wc[a]);e.fillStyle=t,e.translate(i,n,!0),e.fillRect(0,0,l,c),e.translate(-i,-n,!0)}else e.drawImage(r.data,i,n,l,c);s&&e.restore()}},T=()=>{S&&(o?o(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,p-i,f-n,h),e.stroke()))};v?(T(),A()):(A(),T()),this.afterRenderStep(t,e,i,n,w,!1,b,!1,h,r,a)}draw(t,e,i){const{image:n}=t.attribute;if(!n||!t.resources)return;const r=t.resources.get(n);if("loading"===r.state&&nt(n))return void Aa.improveImageLoading(n);if("success"!==r.state)return;const{context:s}=e.drawParams;if(!s)return;const a=Er(t).image;this._draw(t,a,!1,i)}},t.DefaultCanvasImageRender=yc([g(),xc(0,p(k)),xc(0,v(sh)),bc("design:paramtypes",[Object])],t.DefaultCanvasImageRender);const Sc=Symbol.for("IncrementalDrawContribution"),Ac=Symbol.for("ArcRender"),Tc=Symbol.for("Arc3dRender"),Cc=Symbol.for("AreaRender"),_c=Symbol.for("CircleRender"),Bc=Symbol.for("GraphicRender"),Pc=Symbol.for("GroupRender"),Rc=Symbol.for("LineRender"),Mc=Symbol.for("PathRender"),Ec=Symbol.for("PolygonRender"),kc=Symbol.for("RectRender"),Oc=Symbol.for("Rect3DRender"),Lc=Symbol.for("SymbolRender"),Ic=Symbol.for("TextRender"),Dc=Symbol.for("RichTextRender"),jc=Symbol.for("Pyramid3dRender"),Uc=Symbol.for("GlyphRender"),Wc=Symbol.for("ImageRender"),Nc=Symbol.for("RenderSelector"),Gc=Symbol.for("DrawContribution"),Fc=(t,e,i,n)=>{let r,s=!1,a=!1;if(e.forEachChildren((t=>(s=t.numberType===no,!s))),e.forEachChildren((t=>(a=!!t.findFace,!a))),s){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,n,r,s;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(s=null!==(r=e.attribute.startAngle)&&void 0!==r?r:0+e.attribute.endAngle)&&void 0!==s?s:0)/2;for(;a<0;)a+=Pt;for(;o<0;)o+=Pt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",r=i(s,a),r&&r.graphic||(n.hack_pieFace="inside",r=i(s,a)),r&&r.graphic||(n.hack_pieFace="top",r=i(s,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),r=i(s,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else r=i(s,a);return r};var zc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Hc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Vc=Symbol.for("DrawItemInterceptor"),Yc=new oe,Xc=new oe;class $c{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,r),!1}beforeDrawItem(t,e,i,n,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.shadowRoot)return!1;const{context:s}=i;s.highPerformanceSave();const a=t.parent.globalTransMatrix,o=t.stage.window.getViewBoxTransform().clone().multiply(a.a,a.b,a.c,a.d,a.e,a.f);if(t.parent&&s.setTransformFromMatrix(o,!0),n.dirtyBounds&&n.backupDirtyBounds){Yc.copy(n.dirtyBounds),Xc.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,kh.allocate(1,0,0,1,0,0)),s.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(Yc),n.backupDirtyBounds.copy(Xc)),!0}}class qc{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.attribute._debug_bounds)return!1;const{context:s}=i;s.highPerformanceSave(),t.parent&&s.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&s.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(s,t),s.strokeRect(a.x1,a.y1,a.width(),a.height()),s.highPerformanceRestore(),!0}}t.CommonDrawItemInterceptorContribution=class{constructor(){this.order=1,this.interceptors=[new $c,new Zc,new Kc,new qc]}afterDrawItem(t,e,i,n,r){for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].afterDrawItem&&this.interceptors[s].afterDrawItem(t,e,i,n,r))return!0;return!1}beforeDrawItem(t,e,i,n,r){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].beforeDrawItem&&this.interceptors[s].beforeDrawItem(t,e,i,n,r))return!0;return!1}},t.CommonDrawItemInterceptorContribution=zc([g(),Hc("design:paramtypes",[])],t.CommonDrawItemInterceptorContribution);class Kc{constructor(){this.order=1}beforeDrawItem(t,e,i,n,r){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,n,r):this.beforeSetInteractive(t,e,i,n,r))}beforeSetInteractive(t,e,i,n,r){let s=t.interactiveGraphic;if(t.attribute.globalZIndex){s||(s=t.clone(),t.interactiveGraphic=s,s.baseGraphic=t),s.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(s),!0}if(s){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(s),t.interactiveGraphic=null,s.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,n,r){const s=t.baseGraphic;let a=!!s.stage,o=s.parent;for(;a&&o&&o.stage!==o;)a=!!o.stage,o=o.parent;if(!a){const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(s){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(s.parent.globalTransMatrix,!0),s.isContainer?n.renderGroup(s,i,s.parent.globalTransMatrix):n.renderItem(s,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=Jl.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class Zc{constructor(){this.order=1}beforeDrawItem(t,e,i,n,r){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:s,stage:a}=e.drawParams;s.canvas,s.save(),this.initCanvasCtx(s),s.camera=a.camera;const o=s.currentMatrix;o.a/=s.dpr,o.b/=s.dpr,o.c/=s.dpr,o.d/=s.dpr,o.e/=s.dpr,o.f/=s.dpr;const h=Oh.allocate();wh(h,o);const l=s.modelMatrix;if(l){if(h){const t=Oh.allocate();s.modelMatrix=Ah(t,l,h)}}else s.modelMatrix=h;return s.setTransform(1,0,0,1,0,0,!0),t.isContainer?Fc(s,t,((e,r)=>n.renderGroup(t,i,t.parent.globalTransMatrix,!e&&r)),i):n.renderItem(t,i),s.camera=null,s.restore(),s.modelMatrix!==l&&Oh.free(s.modelMatrix),s.modelMatrix=l,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Jc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Qc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tu=function(t,e){return function(i,n){e(i,n,t)}};const eu=Symbol.for("RenderService"),iu=Symbol.for("BeforeRenderConstribution");t.DefaultRenderService=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}},t.DefaultRenderService=Jc([g(),tu(0,p(Gc)),Qc("design:paramtypes",[Object])],t.DefaultRenderService);var nu=new i((e=>{e(eu).to(t.DefaultRenderService)}));const ru=Symbol.for("GraphicPicker"),su=Symbol.for("PickerService"),au=Symbol.for("BoundsPicker"),ou=Symbol.for("GlobalPickerService"),hu=(t,e,i)=>{const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i},lu=["radius","startAngle","endAngle",...Ba];class cu extends Oa{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=so}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Er(this).circle}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=gn.graphicService.updateTempAABBBounds(i);return hu(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2),gn.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:s=e.radius}=t;return r-n>Pt-Tt?i.set(-s,-s,s,s):fs(n,r,s,i),i}needUpdateTags(t){return super.needUpdateTags(t,lu)}needUpdateTag(t){return super.needUpdateTag(t,lu)}toCustomPath(){var t,e,i;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),s=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new Ui;return o.arc(0,0,r,s,a),o}clone(){return new cu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cu.NOWORK_ANIMATE_ATTR}}function uu(t){return new cu(t)}cu.NOWORK_ANIMATE_ATTR=ka;class du{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(e,i,n,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0;const{lineWidth:h,suffixPosition:l="end",measureMode:c=t.MeasureModeEnum.actualBounding,keepCenterInLine:u=!1}=null!=o?o:{};e=e.map((t=>t.toString()));const d=[],p=[0,0];if("number"==typeof h&&h!==1/0){let t;for(let i=0,n=e.length;i<n;i++){const n=this.textMeasure.measureTextPixelADscentAndWidth(e[i],this.textOptions,c);let r=e[i].toString();if(n.width>h){const n=this.textMeasure.clipTextWithSuffix(e[i],this.textOptions,h,s,a,l);r=n.str,t=n.width}else t=n.width;d.push({str:r,width:t,ascent:n.ascent,descent:n.descent,keepCenterInLine:u})}p[0]=h}else{let t,i,n=0;for(let r=0,s=e.length;r<s;r++){i=e[r];const s=this.textMeasure.measureTextPixelADscentAndWidth(e[r],this.textOptions,c);t=s.width,n=Math.max(n,t),d.push({str:i,width:t,ascent:s.ascent,descent:s.descent,keepCenterInLine:u})}p[0]=n}p[1]=d.length*r,p[0]=d.reduce(((t,e)=>Math.max(t,e.width)),0);const f={xOffset:0,yOffset:0,width:p[0],height:p[1]};return this.LayoutBBox(f,i,n,d),this.layoutWithBBox(f,d,i,n,r)}layoutWithBBox(t,e,i,n,r){const s=[0,0],a=e.length*r;"top"===n||("middle"===n?s[1]=(t.height-a)/2:"bottom"===n&&(s[1]=t.height-a));for(let a=0;a<e.length;a++)this.lineOffset(t,e[a],i,n,r,s);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:r,textAlign:i,textBaseline:n}}lineOffset(t,e,i,n,r,s){if("left"===i||"start"===i?e.leftOffset=0:"center"===i?e.leftOffset=(t.width-e.width)/2:"right"!==i&&"end"!==i||(e.leftOffset=t.width-e.width),e.topOffset=r/2+(e.ascent-e.descent)/2+s[1],!e.keepCenterInLine){const t=0,i=e.ascent+e.descent+t;if(i<r-t&&("bottom"===n?e.topOffset+=(r-i)/2:"top"===n&&(e.topOffset-=(r-i)/2)),"alphabetic"===n){const t=r/(e.ascent+e.descent);e.topOffset=r/2+(e.ascent-e.descent)/2*t+s[1]}}return s[1]+=r,e}}const pu=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Ba];class fu extends Oa{get font(){const t=this.getGraphicTheme();return this._font||(this._font=ne(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=this.getGraphicTheme(),n=this.getMaxWidth(i);return Number.isFinite(n)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:i.text).toString()}get clipedWidth(){return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){var t,e;const i=this.getGraphicTheme(),n=this.attribute,r=this.getMaxWidth(i);if(!Number.isFinite(r))return!1;const{text:s}=this.attribute;if(this.tryUpdateAABBBounds(),null===(e=null===(t=this.cache)||void 0===t?void 0:t.layoutData)||void 0===e?void 0:e.lines){let t="";return this.cache.layoutData.lines.forEach((e=>{t+=e.str})),(Array.isArray(s)?s.join(""):s)!==t}return"vertical"===n.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=yo,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return rt(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Er(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new fu({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:s}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=Jt(a,i,{x:r,y:s});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:r}=gn.graphicService.updateTempAABBBounds(i),{scaleX:s=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:h=e.strokeBoundsBuffer}=t;if(o){Xa(r,o/Math.abs(s+a),!0,h),i.union(r)}return gn.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||gn.graphicService.updateHTMLTextAABBBounds(t,e,i),se(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,r="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),r}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=i.fontFamily,textAlign:s=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:h=i.fontWeight,ellipsis:l=i.ellipsis,maxLineWidth:c,stroke:u=i.stroke,wrap:d=i.wrap,measureMode:p=i.measureMode,lineWidth:f=i.lineWidth,whiteSpace:g=i.whiteSpace,suffixPosition:v=i.suffixPosition,ignoreBuf:m=i.ignoreBuf,keepCenterInLine:y=i.keepCenterInLine}=n,b=m?0:this.guessLineHeightBuf(o),x=this.getLineHeight(n,i,b);if("normal"===g||d)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const w=gn.graphicUtil.textMeasure,S=new du(r,{fontSize:o,fontWeight:h,fontFamily:r,lineHeight:x},w).GetLayoutByLines(t,s,a,x,!0===l?i.ellipsis:l||void 0,!1,{lineWidth:c,suffixPosition:v,measureMode:p,keepCenterInLine:y}),{bbox:A}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n;const r=this.getGraphicTheme(),{fontFamily:s=r.fontFamily,textAlign:a=r.textAlign,textBaseline:o=r.textBaseline,fontSize:h=r.fontSize,ellipsis:l=r.ellipsis,maxLineWidth:c,stroke:u=r.stroke,lineWidth:d=r.lineWidth,wordBreak:p=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:g=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:m=r.suffixPosition,heightLimit:y=0,lineClamp:b,keepCenterInLine:x=r.keepCenterInLine}=this.attribute,w=g?0:this.guessLineHeightBuf(h),S=this.getLineHeight(this.attribute,r,w);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(d/2),this._AABBBounds}const A=gn.graphicUtil.textMeasure,T={fontSize:h,fontWeight:f,fontFamily:s,lineHeight:S},C=new du(s,T,A),_=rt(t)?t.map((t=>t.toString())):[t.toString()],B=[],P=[0,0];let R=1/0;if(y>0&&(R=Math.max(Math.floor(y/S),1)),b&&(R=Math.min(R,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t<_.length;t++){const e=_[t];let r=!0;if(t===R-1){const i=A.clipTextWithSuffix(e,T,c,l,!1,m,t!==_.length-1),n=A.measureTextPixelADscentAndWidth(i.str,T,v);B.push({str:i.str,width:i.width,ascent:n.ascent,descent:n.descent,keepCenterInLine:x});break}const s=A.clipText(e,T,c,"break-all"!==p,"keep-all"===p);if(""!==e&&""===s.str||s.wordBreaked){if(l){const t=A.clipTextWithSuffix(e,T,c,l,!1,m);s.str=null!==(i=t.str)&&void 0!==i?i:"",s.width=null!==(n=t.width)&&void 0!==n?n:0}else s.str="",s.width=0;r=!1}const a=A.measureTextPixelADscentAndWidth(s.str,T,v);B.push({str:s.str,width:s.width,ascent:a.ascent,descent:a.descent,keepCenterInLine:x});let o=s.str.length;if(!s.wordBreaked||""!==e&&""===s.str||(r=!0,o=s.wordBreaked),s.str.length===e.length);else if(r){let i=e.substring(o);"keep-all"===p&&(i=i.replace(/^\s+/g,"")),_.splice(t+1,0,i)}}let t=0;B.forEach((e=>{t=Math.max(t,e.width)})),P[0]=t}else{let t,e,i=0;for(let n=0,r=_.length;n<r;n++){if(n===R-1){const t=A.clipTextWithSuffix(_[n],T,c,l,!1,m),e=A.measureTextPixelADscentAndWidth(t.str,T,v);B.push({str:t.str,width:t.width,ascent:e.ascent,descent:e.descent,keepCenterInLine:x}),i=Math.max(i,t.width);break}e=_[n],t=A.measureTextWidth(e,T),i=Math.max(i,t);const r=A.measureTextPixelADscentAndWidth(e,T,v);B.push({str:e,width:t,ascent:r.ascent,descent:r.descent,keepCenterInLine:x})}P[0]=i}P[1]=B.length*S;const M={xOffset:0,yOffset:0,width:P[0],height:P[1]};C.LayoutBBox(M,a,o,B);const E=C.layoutWithBBox(M,B,a,o,S);return this.cache.layoutData=E,this.clearUpdateShapeTag(),this._AABBBounds.set(M.xOffset,M.yOffset,M.xOffset+M.width,M.yOffset+M.height),u&&this._AABBBounds.expand(d/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,n;const r=this.getGraphicTheme(),s=gn.graphicUtil.textMeasure;let a;const o=this.attribute,{maxLineWidth:h=r.maxLineWidth,ellipsis:l=r.ellipsis,fontFamily:c=r.fontFamily,fontSize:u=r.fontSize,fontWeight:d=r.fontWeight,stroke:p=r.stroke,lineWidth:f=r.lineWidth,verticalMode:g=r.verticalMode,suffixPosition:v=r.suffixPosition}=o,m=this.getLineHeight(o,r,0);let{textAlign:y=r.textAlign,textBaseline:b=r.textBaseline}=o;if(!g){const t=y;y=null!==(i=fu.baselineMapAlign[b])&&void 0!==i?i:"left",b=null!==(n=fu.alignMapBaseline[t])&&void 0!==n?n:"top"}if(a=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const t=ph(y,a),e=this.cache.verticalList.length*m,i=fh(b,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const x=e.map((t=>Za(t.toString())));x.forEach(((e,i)=>{if(Number.isFinite(h))if(l){const t=!0===l?r.ellipsis:l,n=s.clipTextWithSuffixVertical(e,{fontSize:u,fontWeight:d,fontFamily:c},h,t,!1,v);x[i]=n.verticalList,a=n.width}else{const t=s.clipTextVertical(e,{fontSize:u,fontWeight:d,fontFamily:c},h,!1);x[i]=t.verticalList,a=t.width}else a=0,e.forEach((e=>{const i=e.direction===t.TextDirection.HORIZONTAL?u:s.measureTextWidth(e.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=i,e.width=i}))})),this.cache.verticalList=x,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const w=ph(y,a),S=this.cache.verticalList.length*m,A=fh(b,S,u);return this._AABBBounds.set(A,w,A+S,w+a),p&&this._AABBBounds.expand(f/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=Ts(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pu;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pu;return super.needUpdateTag(t,e)}clone(){return new fu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fu.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return fu.baselineMapAlign}getAlignMapBaseline(){return fu.alignMapBaseline}}function gu(t){return new fu(t)}fu.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},ka),fu.baselineMapAlign={top:"left",bottom:"right",middle:"center"},fu.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const vu=["heightLimit","lineClamp"];class mu extends fu{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return rt(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n,r;const s=this.getGraphicTheme(),{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:h=s.textBaseline,fontSize:l=s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:u,stroke:d=s.stroke,lineWidth:p=s.lineWidth,wordBreak:f=s.wordBreak,fontWeight:g=s.fontWeight,ignoreBuf:v=s.ignoreBuf,heightLimit:m=0,suffixPosition:y=s.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Ts(this.attribute.lineHeight,this.attribute.fontSize||s.fontSize))&&void 0!==e?e:this.attribute.fontSize||s.fontSize,w=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const S=gn.graphicUtil.textMeasure,A=new du(a,{fontSize:l,fontWeight:g,fontFamily:a},S),T=t.map((t=>t.toString())),C=[],_=[0,0];let B=1/0;if(m>0&&(B=Math.max(Math.floor(m/x),1)),b&&(B=Math.min(B,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t<T.length;t++){const e=T[t];let i=!0;if(t===B-1){const t=A.textMeasure.clipTextWithSuffix(e,A.textOptions,u,c,!1,y);C.push({str:t.str,width:t.width,ascent:0,descent:0,keepCenterInLine:!1});break}const s=A.textMeasure.clipText(e,A.textOptions,u,"break-word"===f);if(""!==e&&""===s.str){if(c){const t=A.textMeasure.clipTextWithSuffix(e,A.textOptions,u,c,!1,y);s.str=null!==(n=t.str)&&void 0!==n?n:"",s.width=null!==(r=t.width)&&void 0!==r?r:0}else s.str="",s.width=0;i=!1}if(C.push({str:s.str,width:s.width,ascent:0,descent:0,keepCenterInLine:!1}),s.str.length===e.length);else if(i){const i=e.substring(s.str.length);T.splice(t+1,0,i)}}let t=0;C.forEach((e=>{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,r=T.length;n<r;n++){if(n===B-1){const t=A.textMeasure.clipTextWithSuffix(T[n],A.textOptions,u,c,!1,y);C.push({str:t.str,width:t.width,ascent:0,descent:0,keepCenterInLine:!1}),i=Math.max(i,t.width);break}e=T[n],t=A.textMeasure.measureTextWidth(e,A.textOptions,"break-word"===f),i=Math.max(i,t),C.push({str:e,width:t,ascent:0,descent:0,keepCenterInLine:!1})}_[0]=i}_[1]=C.length*(x+w);const P={xOffset:0,yOffset:0,width:_[0],height:_[1]};A.LayoutBBox(P,o,h);const R=A.layoutWithBBox(P,C,o,h,x);return this.cache.layoutData=R,this.clearUpdateShapeTag(),this._AABBBounds.set(P.xOffset,P.yOffset,P.xOffset+P.width,P.yOffset+P.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<vu.length;e++){const i=vu[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<vu.length;e++)if(t===vu[e])return!0;return super.needUpdateTag(t)}getNoWorkAnimateAttr(){return mu.NOWORK_ANIMATE_ATTR}}function yu(t){return new mu(t)}class bu{bounds(t,e){if(at(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return at(t)?t:Math.min(t[0],t[1])}}function xu(t,e,i,n,r){return r?t.arc(i,n,e,0,Bt,!1,r):t.arc(i,n,e,0,Bt),!1}var wu=new class extends bu{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,r){return xu(t,this.parseSize(e)/2,i,n,r)}drawOffset(t,e,i,n,r,s){return xu(t,this.parseSize(e)/2+r,i,n,s)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} a ${r},${r} 0 1,0 ${2*r},0 a ${r},${r} 0 1,0 -${2*r},0`}};var Su=new class extends bu{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,r){return function(t,e,i,n,r){return t.moveTo(-3*e+i,-e+n,r),t.lineTo(-e+i,-e+n,r),t.lineTo(-e+i,-3*e+n,r),t.lineTo(e+i,-3*e+n,r),t.lineTo(e+i,-e+n,r),t.lineTo(3*e+i,-e+n,r),t.lineTo(3*e+i,e+n,r),t.lineTo(e+i,e+n,r),t.lineTo(e+i,3*e+n,r),t.lineTo(-e+i,3*e+n,r),t.lineTo(-e+i,e+n,r),t.lineTo(-3*e+i,e+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,r)}drawOffset(t,e,i,n,r,s){return function(t,e,i,n,r,s){return t.moveTo(-3*e+i-r,-e+n-r,s),t.lineTo(-e+i-r,-e+n-r,s),t.lineTo(-e+i-r,-3*e+n-r,s),t.lineTo(e+i+r,-3*e+n-r,s),t.lineTo(e+i+r,-e+n-r,s),t.lineTo(3*e+i+r,-e+n-r,s),t.lineTo(3*e+i+r,e+n+r,s),t.lineTo(e+i+r,e+n+r,s),t.lineTo(e+i+r,3*e+n+r,s),t.lineTo(-e+i-r,3*e+n+r,s),t.lineTo(-e+i-r,e+n+r,s),t.lineTo(-3*e+i-r,e+n+r,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,r,s)}};function Au(t,e,i,n,r){return t.moveTo(i,n-e,r),t.lineTo(e+i,n,r),t.lineTo(i,n+e,r),t.lineTo(i-e,n,r),t.closePath(),!0}var Tu=new class extends bu{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,r){return Au(t,this.parseSize(e)/2,i,n,r)}drawFitDir(t,e,i,n,r){return Au(t,this.parseSize(e)/2,i,n,r)}drawOffset(t,e,i,n,r,s){return Au(t,this.parseSize(e)/2+r,i,n,s)}};function Cu(t,e,i,n){const r=2*e;return t.rect(i-e,n-e,r,r),!1}var _u=new class extends bu{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return Cu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Cu(t,this.parseSize(e)/2+r,i,n)}};function Bu(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*r,e+n+r),t.lineTo(i-e-2*r,e+n+r),t.lineTo(i,n-e-2*r),t.closePath(),!0}class Pu extends bu{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return Bu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Bu(t,this.parseSize(e)/2,i,n,r)}}var Ru=new Pu;var Mu=new class extends Pu{constructor(){super(...arguments),this.type="triangle"}};const Eu=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),ku=Math.sin(Bt/10)*Eu,Ou=-Math.cos(Bt/10)*Eu;function Lu(t,e,i,n){const r=ku*e,s=Ou*e;t.moveTo(i,-e+n),t.lineTo(r+i,s+n);for(let a=1;a<5;++a){const o=Bt*a/5,h=Math.cos(o),l=Math.sin(o);t.lineTo(l*e+i,-h*e+n),t.lineTo(h*r-l*s+i,l*r+h*s+n)}return t.closePath(),!0}var Iu=new class extends bu{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return Lu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Lu(t,this.parseSize(e)/2+r,i,n)}};const Du=It(3);function ju(t,e,i,n){const r=e,s=r/Du,a=s/5,o=e;return t.moveTo(0+i,-r+n),t.lineTo(s/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-s/2+i,n),t.closePath(),!0}var Uu=new class extends bu{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return ju(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return ju(t,this.parseSize(e)/2+r,i,n)}};function Wu(t,e,i,n){const r=2*e;return t.moveTo(i,-e+n),t.lineTo(r/3/2+i,e+n),t.lineTo(-r/3/2+i,e+n),t.closePath(),!0}var Nu=new class extends bu{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return Wu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Wu(t,this.parseSize(e)/2+r,i,n)}};function Gu(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var Fu=new class extends bu{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return Gu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Gu(t,this.parseSize(e)/2+r,i,n)}};const zu=-.5,Hu=It(3)/2,Vu=1/It(12);function Yu(t,e,i,n){const r=e/2,s=e*Vu,a=r,o=e*Vu+e,h=-a,l=o;return t.moveTo(r+i,s+n),t.lineTo(a+i,o+n),t.lineTo(h+i,l+n),t.lineTo(zu*r-Hu*s+i,Hu*r+zu*s+n),t.lineTo(zu*a-Hu*o+i,Hu*a+zu*o+n),t.lineTo(zu*h-Hu*l+i,Hu*h+zu*l+n),t.lineTo(zu*r+Hu*s+i,zu*s-Hu*r+n),t.lineTo(zu*a+Hu*o+i,zu*o-Hu*a+n),t.lineTo(zu*h+Hu*l+i,zu*l-Hu*h+n),t.closePath(),!1}var Xu=new class extends bu{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Yu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Yu(t,this.parseSize(e)/2+r,i,n)}};function $u(t,e,i,n,r){return t.moveTo(-e+i-2*r,n),t.lineTo(e+i+r,e+n+2*r),t.lineTo(e+i+r,n-e-2*r),t.closePath(),!0}var qu=new class extends bu{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return $u(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,r){return $u(t,this.parseSize(e)/2,i,n,r)}};function Ku(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-r,e+n+2*r),t.lineTo(e+i+2*r,n),t.lineTo(i-e-r,n-e-2*r),t.closePath(),!0}var Zu=new class extends bu{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return Ku(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Ku(t,this.parseSize(e)/2,i,n,r)}};function Ju(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*r,n-e-r),t.lineTo(i+e+2*r,n-e-r),t.lineTo(i,n+e+2*r),t.closePath(),!0}var Qu=new class extends bu{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return Ju(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Ju(t,this.parseSize(e)/2,i,n,r)}};const td=It(3);function ed(t,e,i,n){const r=e*td;return t.moveTo(i,n+-r/3*2),t.lineTo(e+i,n+r),t.lineTo(i-e,n+r),t.closePath(),!0}var id=new class extends bu{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return ed(t,this.parseSize(e)/2/td,i,n)}drawOffset(t,e,i,n,r){return ed(t,this.parseSize(e)/2/td+r,i,n)}};function nd(t,e,i,n){const r=2*e;return t.moveTo(e+i,n-r),t.lineTo(i-e,n),t.lineTo(e+i,r+n),!0}var rd=new class extends bu{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return nd(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return nd(t,this.parseSize(e)/4+r,i,n)}};function sd(t,e,i,n){const r=2*e;return t.moveTo(i-e,n-r),t.lineTo(i+e,n),t.lineTo(i-e,r+n),!0}var ad=new class extends bu{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return sd(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return sd(t,this.parseSize(e)/4+r,i,n)}};function od(t,e,i,n){const r=2*e;return t.moveTo(i-r,n+e),t.lineTo(i,n-e),t.lineTo(i+r,n+e),!0}var hd=new class extends bu{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return od(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return od(t,this.parseSize(e)/4+r,i,n)}};function ld(t,e,i,n){const r=2*e;return t.moveTo(i-r,n-e),t.lineTo(i,n+e),t.lineTo(i+r,n-e),!0}var cd=new class extends bu{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return ld(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return ld(t,this.parseSize(e)/4+r,i,n)}};function ud(t,e,i,n,r){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var dd=new class extends bu{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,r){return ud(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r,s){return ud(t,this.parseSize(e)/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e}, ${i-r} L ${e},${i+r}`}};function pd(t,e,i,n,r){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var fd=new class extends bu{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,r){return pd(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r,s){return pd(t,this.parseSize(e)/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} L ${e+r},${i}`}};function gd(t,e,i,n,r){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var vd=new class extends bu{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,r){return gd(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r,s){return gd(t,this.parseSize(e)/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}};function md(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function yd(t,e,i,n){const r=e,s=e/2;return t.rect(i-r/2,n-s/2,r,s),!1}var bd=new class extends bu{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return at(e)?yd(t,e,i,n):md(t,e,i,n)}drawOffset(t,e,i,n,r){return at(e)?yd(t,e+2*r,i,n):md(t,[e[0]+2*r,e[1]+2*r],i,n)}};const xd=new oe;class wd{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,rt(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,r,s,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),Ke(r.path.commandList,t,i,n,e,e),a&&a(r.path,r.attribute)})),!1):(Ke(this.path.commandList,t,i,n,e+r,e+r),!1)}draw(t,e,i,n,r,s){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,r,s)}parseSize(t){return at(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:n}=i;xd.x1=n.bounds.x1*t,xd.y1=n.bounds.y1*t,xd.x2=n.bounds.x2*t,xd.y2=n.bounds.y2*t,e.union(xd)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Sd=[wu,Su,Tu,_u,id,Mu,Iu,Uu,Nu,Fu,Xu,qu,Zu,Ru,Qu,rd,ad,hd,cd,bd,dd,fd,vd],Ad={};Sd.forEach((t=>{Ad[t.type]=t}));const Td={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},Cd=new oe,_d=["symbolType","size",...Ba];let Bd=class t extends Oa{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=mo}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return rt(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,n=Ad[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;if(i=Td[i]||i,!0===Ha(i)){const e=new za,{svg:n}=e.parse(i);if(!n)return null;const r=rt(n.path)?n.path:[n.path];Cd.clear();const s=[];r.forEach((t=>{const e=(new Ui).fromString(t.d),i={};To.forEach((e=>{t[e]&&(i[Ao[e]]=t[e])})),s.push({path:e,attribute:i}),Cd.union(e.bounds)}));const a=Cd.width(),o=Cd.height(),h=1/kt(a,o);return s.forEach((t=>t.path.transform(0,0,h,h))),this._parsedPath=new wd(i,s,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}const r=(new Ui).fromString(i),s=r.bounds.width(),a=r.bounds.height(),o=1/kt(s,a);return r.transform(0,0,o,o),this._parsedPath=new wd(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Er(this).symbol}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=gn.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:s=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;Xa(i,a+(r+o)/2,!0,s)}})(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2);const{lineJoin:a=e.lineJoin}=t;return gn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(rt(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:n=e.size}=t;return this.getParsedPath().bounds(n,i),i}needUpdateTags(t){return super.needUpdateTags(t,_d)}needUpdateTag(t){return super.needUpdateTag(t,_d)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=rt(e)?e:[e,e];return t.path?(new Ui).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ui).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Pd(t){return new Bd(t)}Bd.userSymbolMap={},Bd.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},ka);const Rd=["segments","points","curveType","curveTension",...Ba];let Md=class t extends Oa{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=lo}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,r){"points"===t&&(r.points=ms(i,n,e))}getGraphicTheme(){return Er(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),gn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return gn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:r=e.points,connectedType:s}=t,a=i;return r.forEach((t=>{!1===t.defined&&"zero"!==s&&"connect"!==s||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:r=e.segments,connectedType:s}=t,a=i;return r.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==s&&"connect"!==s||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Rd)}needUpdateTag(t){return super.needUpdateTag(t,Rd)}toCustomPath(){const t=this.attribute,e=new Ui,i=t.segments,n=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ed(t){return new Md(t)}Md.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ka);const kd=["width","x1","y1","height","cornerRadius",...Ba];class Od extends Oa{constructor(t){super(t),this.type="rect",this.numberType=fo}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Er(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:r,y1:s,x:a,y:o}=t;e=null!=e?e:r-a,n=null!=n?n:s-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:r}=gn.graphicService.updateTempAABBBounds(i);return hu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),gn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,kd)}needUpdateTag(t){return super.needUpdateTag(t,kd)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:r}=Ws(t),s=new Ui;return s.moveTo(e,i),s.rect(e,i,n,r),s}clone(){return new Od(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Od.NOWORK_ANIMATE_ATTR}}function Ld(t){return new Od(t)}Od.NOWORK_ANIMATE_ATTR=ka;const Id=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class Dd extends Od{constructor(t){super(t),this.type="rect3d",this.numberType=go}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:n,x:r,y:s,length:a=Ot(e.width,e.height)}=this.attribute;let{width:o,height:h}=this.attribute;o=null!=o?o:i-r,h=null!=h?h:n-s;for(let e=0;e<Id.length;e++){const i=Id[e];t.vertices.push([i[0]*o,i[1]*h,i[2]*a])}return t.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),t.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),t.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),t.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),t.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),t.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),t.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],t}getNoWorkAnimateAttr(){return Dd.NOWORK_ANIMATE_ATTR}}function jd(t){return new Dd(t)}Dd.NOWORK_ANIMATE_ATTR=ka;class Ud extends Oa{constructor(t){super(t),this.type="glyph",this.numberType=ao,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Er(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const n={},r=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const s=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];s&&(Object.assign(n,s.attributes),(null===(i=s.subAttributes)||void 0===i?void 0:i.length)&&r.forEach(((t,e)=>{Object.assign(t,s.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(r[n]),i.applyStateAttrs(r[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Ud(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Ud.NOWORK_ANIMATE_ATTR}}function Wd(t){return new Ud(t)}Ud.NOWORK_ANIMATE_ATTR=ka;class Nd{constructor(t,e,i,n,r,s,a,o,h,l,c,u,d,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=r,this.wordBreak=s,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=h,this.layoutDirection=l,this.directionKey=xn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),r=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let s=this.isHeightMax?Math.min(this.height,n):this.height||n||0;s=Math.min(s,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-s/2;break;case"bottom":a=-s}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-r:"center"===this.globalAlign&&(o=-r/2);let h=this[this.directionKey.height];this.singleLine&&(h=this.lines[0].height+1);let l=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=h&&0!==h)for(let i=0;i<this.lines.length;i++){const{top:n,height:r}=this.lines[i];if(n+r<this[this.directionKey.top]||n+r>this[this.directionKey.top]+h)return l;let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+h&&(s=!0,l=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((h-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;i<this.lines.length;i++)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else if("bottom"===this.verticalDirection&&"vertical"!==this.layoutDirection)for(let i=0;i<this.lines.length;i++){const{top:n,height:r}=this.lines[i],s=h-this.lines[i].top-this.lines[i].height;if(0===h)this.lines[i].draw(t,!1,o,s+a,this.ellipsis,e);else{if(s+r>this[this.directionKey.top]+h||s<this[this.directionKey.top])return l;{let n=!1;this.ellipsis&&this.lines[i+1]&&s-this.lines[i+1].height<this[this.directionKey.top]&&(n=!0,l=!0),this.lines[i].draw(t,n,o,s+a,this.ellipsis,e)}}}else{"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&this.singleLine&&this.isWidthMax&&(o+=this.lines[0].height+1);for(let i=0;i<this.lines.length;i++){"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&(o-=this.lines[i].height+this.lines[i].top);const{top:n,height:r}=this.lines[i];if(0===h)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e);else{if(n+r<this[this.directionKey.top]||n+r>this[this.directionKey.top]+h)return l;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+h&&(n=!0,l=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return l}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;i<this.lines.length;i++){const n=this.lines[i];n.actualWidth>t&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let r=this[this.directionKey.height];if(this.singleLine&&(r=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=r&&0!==r)for(let i=0;i<this.lines.length;i++){const{top:n,height:s}=this.lines[i];if(n+s<this[this.directionKey.top]||n+s>this[this.directionKey.top]+r);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+r){const n=!0===this.ellipsis?"...":this.ellipsis||"",r=this.lines[i].getWidthWithEllips(n);r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((r-this.actualHeight)/2);for(let i=0;i<this.lines.length;i++)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;i<this.lines.length;i++){const{top:n,height:s}=this.lines[i],a=r-this.lines[i].top-this.lines[i].height;if(0===r)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+s>this[this.directionKey.top]+r||a<this[this.directionKey.top]);else if(this.ellipsis&&this.lines[i+1]&&a-this.lines[i+1].height<this[this.directionKey.top]){const n=!0===this.ellipsis?"...":this.ellipsis||"",r=this.lines[i].getWidthWithEllips(n);r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;i<this.lines.length;i++){const{top:n,height:s}=this.lines[i];if(0===r)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+s<this[this.directionKey.top]||n+s>this[this.directionKey.top]+r);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+r){const n=!0===this.ellipsis?"...":this.ellipsis||"",r=this.lines[i].getWidthWithEllips(n);r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Gd{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=Ts(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof n?n>this.fontSize?n:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:r,height:s,descent:a,width:o}=Mn(t,i);let h=0,l=0,c=0;this.height>s&&(h=(this.height-s)/2,l=Math.ceil(h),c=Math.floor(h)),"top"===this.textBaseline?(this.ascent=h,this.descent=s-h):"bottom"===this.textBaseline?(this.ascent=s-h,this.descent=h):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=r+l,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Mn(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,r){let s=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)s=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)s+=this.ellipsisStr,"right"!==r&&"end"!==r||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Bn(s,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,s.length-1);if(s=s.slice(0,t),s+=this.ellipsisStr,"right"===r||"end"===r){const{width:e}=Mn(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:h=1}=this.character;this.character.stroke&&h&&t.strokeText(s,a,e),this.character.fill&&t.fillText(s,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Bn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=Mn(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const Fd=["width","height","image",...Ba];class zd extends Oa{constructor(t){super(t),this.type="image",this.numberType=ho,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return Er(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:n=e.width,height:r=e.height}=t;i.set(0,0,n,r)}const{tb1:n,tb2:r}=gn.graphicService.updateTempAABBBounds(i);return hu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),gn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return dn[t]}needUpdateTags(t){return super.needUpdateTags(t,Fd)}needUpdateTag(t){return super.needUpdateTag(t,Fd)}clone(){return new zd(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zd.NOWORK_ANIMATE_ATTR}}function Hd(t){return new zd(t)}zd.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},ka);class Vd extends zd{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=us(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(rt(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=us(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=dn.width,height:e=dn.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,r=(i-t)/2,s=(n-e)/2;return this._AABBBounds.expand([0,2*r,2*s,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yd{constructor(t,e,i,n,r,s,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=r,this.top=i-n,this.paragraphs=s.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Vd?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=xn[this.direction],this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Gd){const e=Cn.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let r=this.left,s=0;this.actualWidth<t&&!e&&("right"===this.textAlign||"end"===this.textAlign?r=t-this.actualWidth:"center"===this.textAlign?r=(t-this.actualWidth)/2:"justify"===this.textAlign&&(this.paragraphs.length<2?r=(t-this.actualWidth)/2:s=(t-this.actualWidth)/(this.paragraphs.length-1))),this.paragraphs.map((function(t){t instanceof Vd?(t["_"+i.x]=r,r+=t[i.width]+s,t["_"+i.y]="top"===t.attribute.textBaseline?0:"bottom"===t.attribute.textBaseline?n-t.height:(n-t.height)/2):(t[i.left]=r,r+=t[i.width]+s)}))}draw(t,e,i,n,r,s){if(r&&(e||this.paragraphs.some((t=>t.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const n=this.paragraphs[e];if(n.overflow)t=t&&""===n.text;else if(t){i=!0;break}}let n=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Vd)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const s=!0===r?"...":r||"";i.ellipsisStr=s;const{width:a}=Mn(s,i.character),o=a||0;if(o<=this.blankWidth+n){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+n+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+n;break}i.ellipsis="hide",n+=i.width}}this.paragraphs.forEach(((e,r)=>{if(e instanceof Vd)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sn;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,_n(t,e)})(t,e.character),function(t,e,i){const n=e&&e.fill||wn;if(!n)return void(t.globalAlpha=0);const{fillOpacity:r=1,opacity:s=1}=e;t.globalAlpha=r*s,t.fillStyle=i?bn(t,n,{AABBBounds:i}):n,_n(t,e)}(t,e.character,a),e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof Vd)break;const{width:r}=Mn(t,n.character),s=r||0;if(s<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=s;break}if(s<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=s,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Vd?t.width:t.getWidthWithEllips(this.direction)})),i}}class Xd{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=xn[this.direction]}store(t){if(t instanceof Vd){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Yd(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Vd?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,n=Math.ceil(i/t[this.directionKey.width]*t.length)||0,r=Bn(t.text,i,t.character,n,"break-word"===this.frame.wordBreak);if(0!==r){const[i,n]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new Gd(i,t.newLine,t.character),new Gd(n,!0,t.character)]}(t,r);this.store(i),e?this.send():this.deal(n)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const $d=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize",...Ba];class qd extends Oa{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=vo,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const n=this._frameCache.icons.get(t[i]);this.updateHoverIconState(n)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:un.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:un.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:un.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:un.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:un.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:un.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:un.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:un.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Er(this).richtext}updateAABBBounds(t,e,i){const{width:n=e.width,height:r=e.height,maxWidth:s=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:h=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let h=n||e||0,l=r||o||0;l="number"==typeof a&&l>a?a:l||0,h="number"==typeof s&&h>s?s:h||0,i.set(0,0,h,l)}let l=0;switch(h){case"top":l=0;break;case"middle":l=-i.height()/2;break;case"bottom":l=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,l),gn.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||gn.graphicService.updateHTMLTextAABBBounds(t,e,i),gn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,$d)}needUpdateTag(t){return super.needUpdateTag(t,$d)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e<t.lines.length;e++){const i=t.lines[e];for(let t=0;t<i.paragraphs.length;t++){const e=i.paragraphs[t];if(e.overflow&&""!==e.text)return!0}}return!1}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:n,fontFamily:r,fontStyle:s,fontWeight:a,lineWidth:o,opacity:h,fillOpacity:l,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:n,fontFamily:r,fontStyle:s,fontWeight:a,lineWidth:o,opacity:h,fillOpacity:l,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:n,maxHeight:r,width:s,height:a,ellipsis:o,wordBreak:h,verticalDirection:l,textAlign:c,textBaseline:u,layoutDirection:d,singleLine:p,disableAutoWrapLine:f}=this.attribute,g=[],v=null!=t?t:i;for(let t=0;t<v.length;t++)if("image"in v[t]){const e=this.combinedStyleToCharacter(v[t]);e.lineWidth=void 0;const i=e.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(e.id);if(i)g.push(i);else{const t=new Vd(e);t.successCallback=()=>{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,g.push(t)}}else{const e=this.combinedStyleToCharacter(v[t]);if(at(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i<t.length;i++)g.push(new Gd(t[i],0!==i,e))}else e.text&&g.push(new Gd(e.text,!1,e))}const m="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0,b="number"==typeof s&&Number.isFinite(s)&&s>0&&(!m||s<=n),x="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=r),w=new Nd(0,0,(b?s:m?n:0)||0,(x?a:y?r:0)||0,o,h,l,c,u,d||"horizontal",!b&&m,!x&&y,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),S=new Xd(w);if(f){let t=0,e=!1;for(let i=0;i<g.length;i++){const n=g[i];e?(n.overflow=!0,n.left=1/0,n.top=1/0,!n.newLine&&w.lines[w.lines.length-1].paragraphs.push(n)):S.deal(n,!0),w.lines.length!==t&&(t=w.lines.length,S.lineBuffer.length=0,n.overflow=!0,n.left=1e3,n.top=1e3,w.lines[w.lines.length-1].paragraphs.push(n),e=!0),n.newLine&&(e=!1,S.lineWidth=0),S.send()}}else for(let t=0;t<g.length;t++)S.deal(g[t]);if(S.send(),!("horizontal"===w.layoutDirection?b:x)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?m:y)&&(e=Math.min(e,"horizontal"===w.layoutDirection?n:r)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}this._frameCache=w}clone(){return new qd(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,n,r,s;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(r=this.stage)||void 0===r||r.setCursor(),null===(s=this.stage)||void 0===s||s.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let r;return e.icons.forEach(((e,s)=>{var a,o;const h=e.AABBBounds.clone();h.translate(e._marginArray[3],e._marginArray[0]),h.containsPoint({x:t.x-i,y:t.y-n})&&(r=e,r.globalX=(null!==(a=r.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],r.globalY=(null!==(o=r.attribute.y)&&void 0!==o?o:0)+n+e._marginArray[0])})),r}getNoWorkAnimateAttr(){return qd.NOWORK_ANIMATE_ATTR}}function Kd(t){return new qd(t)}qd.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},ka);const Zd=["path","customPath",...Ba];class Jd extends Oa{constructor(t){super(t),this.type="path",this.numberType=co}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ui?e.path:(K(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ui?this.cache:t.path)}getGraphicTheme(){return Er(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:n,tb2:r}=gn.graphicService.updateTempAABBBounds(i);hu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:s=e.lineJoin}=t;return gn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;nt(t.path,!0)?this.cache=(new Ui).fromString(t.path):t.customPath&&(this.cache=new Ui,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zd)}needUpdateTag(t){return super.needUpdateTag(t,Zd)}toCustomPath(){return(new Ui).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jd(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jd.NOWORK_ANIMATE_ATTR}}function Qd(t){return new Jd(t)}Jd.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},ka);const tp=["segments","points","curveType","curveTension",...Ba];class ep extends Oa{constructor(t){super(t),this.type="area",this.numberType=ro}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Er(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),gn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return gn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:r=e.points}=t,s=i;return r.forEach((t=>{var e,i;s.add(t.x,t.y),s.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),s}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:r=e.segments}=t,s=i;return r.forEach((t=>{t.points.forEach((t=>{var e,i;s.add(t.x,t.y),s.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),s}_interpolate(t,e,i,n,r){"points"===t&&(r.points=ms(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,tp)}needUpdateTag(t){return super.needUpdateTag(t,tp)}toCustomPath(){const t=new Ui,e=this.attribute,i=e.segments,n=e=>{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var r,s;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(r=e.x1)&&void 0!==r?r:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new ep(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ep.NOWORK_ANIMATE_ATTR}}function ip(t){return new ep(t)}ep.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ka);const np=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ba];class rp extends Oa{constructor(t){super(t),this.type="arc",this.numberType=io}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:r=t.outerRadius,innerRadius:s=t.innerRadius}=this.attribute;if(r+=n,s-=i,0===e||"0%"===e)return 0;const a=Math.abs(r-s),o=t=>Math.min(at(t,!0)?t:a*parseFloat(t)/100,a/2);if(rt(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,r=i-e>=0?1:-1,s=i-e;if(e=Ht(e),i=e+s,n&&Rt(s)<Pt-Tt){let s=1,a=1;n.length&&(s=Number(n[0]),a=Number(n[1]));let{outerRadius:o=t.outerRadius,innerRadius:h=t.innerRadius}=this.attribute;const{outerPadding:l=t.outerPadding,innerPadding:c=t.innerPadding}=this.attribute;o+=l,h-=c;const u=Math.abs(o-h)/2,d=u/o;if(u>Tt&&o>Tt)return{startAngle:e-r*d*s,endAngle:i+r*d*a,sc:r*d*s,ec:r*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:n=i.innerPadding,outerPadding:r=i.outerPadding,padAngle:s=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=r,o-=n;const{padRadius:h=It(a*a+o*o)}=this.attribute,l=Rt(e-t);let c=t,u=e,d=t,p=e;const f=s/2;let g=l,v=l;if(f>Tt&&h>Tt){const i=e>t?1:-1;let n=jt(Number(h)/o*Lt(f)),r=jt(Number(h)/a*Lt(f));return(g-=2*n)>Tt?(n*=i,d+=n,p-=n):(g=0,d=p=(t+e)/2),(v-=2*r)>Tt?(r*=i,c+=r,u-=r):(v=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:g,outerDeltaAngle:v}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:g,outerDeltaAngle:v}}getGraphicTheme(){return Er(this).arc}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=gn.graphicService.updateTempAABBBounds(i);hu(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2);const{lineJoin:a=e.lineJoin}=t;return gn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:s=e.outerPadding,innerPadding:a=e.innerPadding}=t;return n+=s,r-=a,n<r&&(n=r),i.set(-n,-n,n,n),i}updateArcAABBBoundsAccurate(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:s=e.outerPadding,innerPadding:a=e.innerPadding}=t;if(n+=s,r-=a,n<r){const t=n;n=r,r=t}let{endAngle:o=e.endAngle,startAngle:h=e.startAngle}=t;if(h>o){const t=h;h=o,o=t}return n<=Tt?i.set(0,0,0,0):Math.abs(o-h)>Pt-Tt?i.set(-n,-n,n,n):(fs(h,o,n,i),fs(h,o,r,i)),i}needUpdateTags(t){return super.needUpdateTags(t,np)}needUpdateTag(t){return super.needUpdateTag(t,np)}toCustomPath(){var t,e,i,n;const r=this.attribute,{startAngle:s,endAngle:a}=this.getParsedAngle();let o=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(n=r.outerPadding)&&void 0!==n?n:0);const l=Rt(a-s),c=a>s;if(h<o){const t=h;h=o,o=t}const u=new Ui;if(h<=Tt)u.moveTo(0,0);else if(l>=Pt-Tt)u.moveTo(0+h*Et(s),0+h*Lt(s)),u.arc(0,0,h,s,a,!c),o>Tt&&(u.moveTo(0+o*Et(a),0+o*Lt(a)),u.arc(0,0,o,a,s,c));else{const t=h*Et(s),e=h*Lt(s),i=o*Et(a),n=o*Lt(a);u.moveTo(0+t,0+e),u.arc(0,0,h,s,a,!c),u.lineTo(0+i,0+n),u.arc(0,0,o,a,s,c),u.closePath()}return u}clone(){return new rp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rp.NOWORK_ANIMATE_ATTR}}function sp(t){return new rp(t)}rp.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ka);class ap extends rp{constructor(t){super(t),this.type="arc3d",this.numberType=no}updateAABBBounds(t,e,i){const n=this.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:s=0}=t,a=r+s;return i.setValue(-a,-a,a,a),gn.graphicService.updateTempAABBBounds(i),gn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return ap.NOWORK_ANIMATE_ATTR}}function op(t){return new ap(t)}ap.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ka);const hp=["points","cornerRadius",...Ba];class lp extends Oa{constructor(t){super(t),this.type="polygon",this.numberType=uo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Er(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),gn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return gn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,r){"points"===t&&(r.points=ms(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,hp)}needUpdateTag(t){return super.needUpdateTag(t,hp)}toCustomPath(){const t=this.attribute.points,e=new Ui;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new lp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lp.NOWORK_ANIMATE_ATTR}}function cp(t){return new lp(t)}lp.NOWORK_ANIMATE_ATTR=ka;class up extends lp{constructor(t){super(t),this.type="pyramid3d",this.numberType=po}updateAABBBounds(t,e,i){const n=this.stage;return n&&n.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)})),gn.graphicService.updateTempAABBBounds(i),gn.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],r=e.x-n.x;return 0===r?0:(e.y-n.y)/r})),i=t.map((t=>({p:t,d:0})));let n=!1,r=0;for(let t=0;t<e.length-1;t++){for(let s=t+1;s<e.length;s++){if(e[t]===e[s]){n=!0;const e=Ft.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,r=kt(r,e);const a=Ft.distancePP(i[s].p,i[s+1].p);i[s].d=a,i[s+1].d=a,r=kt(r,a)}if(n)break}if(n)break}for(let e=t.length-1;e>=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e<t.length;e++){const n=(r-i[e+t.length].d)/2;i[e].d+=n,i[e+t.length].d+=n}const s={polygons:[],vertices:[],edges:[]};return i.forEach((t=>{s.vertices.push([t.p.x,t.p.y,t.d])})),s.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),s.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),s.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),s.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),s.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),s.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),s.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],s}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return up.NOWORK_ANIMATE_ATTR}}function dp(t){return new up(t)}up.NOWORK_ANIMATE_ATTR=ka;class pp extends _o{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function fp(t){return new pp(t)}var gp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const vp=Symbol.for("PickItemInterceptor");t.ShadowRootPickItemInterceptorContribution=class{constructor(){this.order=1}afterPickItem(t,e,i,n,r){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,r):null}beforePickItem(t,e,i,n,r){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,r):null}_pickItem(t,e,i,n,r){var s;if(!t.shadowRoot)return null;const{parentMatrix:a}=r||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const h=null===(s=Er(t))||void 0===s?void 0:s[t.type],{shadowPickMode:l=(null==h?void 0:h.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=kh.allocateByObj(a),d=new Gt(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===l&&(p.graphic=p.group),p}},t.ShadowRootPickItemInterceptorContribution=gp([g()],t.ShadowRootPickItemInterceptorContribution),t.InteractivePickItemInterceptorContribution=class{constructor(){this.order=1}beforePickItem(t,e,i,n,r){const s=t.baseGraphic;if(s&&s.parent){const t=new Gt(i.x,i.y),r=e.pickContext;r.highPerformanceSave();const a=s.parent.globalTransMatrix;a.transformPoint(t,t);const o=s.isContainer?e.pickGroup(s,t.clone(),a,n):e.pickItem(s,t.clone(),a,n);return r.highPerformanceRestore(),o}return null}},t.InteractivePickItemInterceptorContribution=gp([g()],t.InteractivePickItemInterceptorContribution),t.Canvas3DPickItemInterceptor=class{constructor(){this.order=1}beforePickItem(t,e,i,n,r){if(!t.in3dMode||n.in3dInterceptor)return null;const s=e.pickContext,a=t.stage;if(!s||!a)return null;if(n.in3dInterceptor=!0,s.save(),this.initCanvasCtx(s),s.camera=a.camera,t.isContainer){const a=Fc(s,t,(()=>e.pickGroup(t,i,r.parentMatrix,n)),n);return s.camera=null,n.in3dInterceptor=!1,s.restore(),a}return s.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}},t.Canvas3DPickItemInterceptor=gp([g()],t.Canvas3DPickItemInterceptor);var mp=new i(((e,i,n)=>{n(su)||(e(ou).toSelf(),e(su).toService(ou)),e(t.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(),e(vp).toService(t.Canvas3DPickItemInterceptor),e(t.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(),e(vp).toService(t.ShadowRootPickItemInterceptorContribution),e(t.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(),e(vp).toService(t.InteractivePickItemInterceptorContribution),L(e,vp)})),yp=new i((e=>{e(bo).to(t.DefaultGraphicService).inSingletonScope(),e(xo).toConstantValue(Jl)}));const bp=Symbol.for("AutoEnablePlugins"),xp=Symbol.for("PluginService");var wp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Sp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ap=function(t,e){return function(i,n){e(i,n,t)}};let Tp=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&In.isBound(bp)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Tp=wp([g(),Ap(0,p(k)),Ap(0,v(bp)),Sp("design:paramtypes",[Object])],Tp);var Cp=new i((t=>{t(xp).to(Tp),I(t,bp)})),_p=new i((t=>{L(t,U)})),Bp=new i((e=>{e(Ln).to(t.DefaultTextMeasureContribution).inSingletonScope(),L(e,Ln)})),Pp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Rp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Mp=class{constructor(){this.type="static",this.offscreen=!1,this.global=gn.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,r=Un({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const r=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:r},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Mp=Pp([g(),Rp("design:paramtypes",[])],Mp);var Ep=new i((t=>{t(Mp).toSelf(),t(ko).toService(Mp)}));var kp=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{h(n.next(t))}catch(t){s(t)}}function o(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}h((n=n.apply(t,e||[])).next())}))};function Op(t,e,i){const n={},r=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],r.push(i))}),i),r.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:r}}function Lp(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=!1;if(r)s=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:r=e}=t.attribute;if(0===n)i=r;else if(i!==r)return s=!0,!0;return!1}),n)}if(s){const{childMap:s,zIdxArray:a}=Op(t,e,n);let o=!1;for(let t=0;t<a.length&&!o;t++){const e=s[a[t]];r&&e.sort(((t,e)=>{var i,r;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(r=t.attribute.z)&&void 0!==r?r:0))}));for(let t=0;t<e.length;t++)if(i(e[t],t)){o=!0;break}}}else t.forEachChildren(i,n)}function Ip(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return kp(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function Dp(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return r=!0,!0;return!1}),n);let s=null,a=!1;if(r){const{childMap:r,zIdxArray:o}=Op(t,i,n);let h=!1;for(let t=0;t<o.length&&!h;t++){const i=r[o[t]];for(let t=0;t<i.length;t++){if(a){h=!0,s=i[t];break}i[t]._uid!==e||(a=!0)}}}else t.forEachChildren((t=>a?(s=t,!0):(t._uid===e&&(a=!0),!1)),n);return s}var jp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Up=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wp=function(t,e){return function(i,n){e(i,n,t)}};let Np=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ae,this.backupDirtyBounds=new ae,this.global=gn.global,this.layerService=gn.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,viewBox:r,transMatrix:s}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:r,y11:s,y12:a,x21:o,x22:h,y21:l,y22:c}=qt(t,e,i);return n>=h||r<=o||s>=c||a<=l?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(s,l),x2:Math.min(r,h),y2:Math.min(a,c)}}(a,n.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(s.a,s.b,s.c,s.d,s.e,s.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(r.x1,r.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Zi.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Zi.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,kh.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Dp(e,i,Zi.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Kt(t.AABBBounds,this.dirtyBounds,!1))return;let r,s=i;if(this.useDirtyBounds){r=Zl.allocateByObj(this.dirtyBounds);const e=t.transMatrix;s=kh.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;n?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,s):this.renderItem(t,e))})):Lp(t,Zi.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,s):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(r),Zl.free(r),kh.free(s))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:r}=i;let s=r.get(t._uid);s||(s={layer:this.layerService.createLayer(n),zIndex:r.size,group:t},r.set(t._uid,s));const a=s.layer.getNativeHandler().getContext(),o=s.drawContribution||In.get(Sc);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:s.layer,context:a,startAtId:t._uid,break:!1})),s.drawContribution=o;const h=this._findNextGraphic(t);if(h)if(h.isContainer&&h.incremental)this._increaseRender(h,e);else{let t=r.get(h._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:r.size},r.set(h._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:h._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const r=this.InterceptorContributions[n];if(r.beforeDrawItem&&r.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const n=this.getRenderContribution(t);if(!n)return;let r,s=!1;if(t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;if(s=!(!e&&!i),s){r=this.dirtyBounds.clone();const n=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(n),this.dirtyBounds.translate(-e,-i)}}if(this.useDirtyBounds&&!t.isContainer&&!Kt(t.AABBBounds,this.dirtyBounds,!1))return void(s&&this.dirtyBounds.copy(r));const a=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=a),a?t.isContainer&&n.draw(t,this.currentRenderService,e,i):n.draw(t,this.currentRenderService,e,i),s&&this.dirtyBounds.copy(r),this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const n=this.InterceptorContributions[i];if(n.afterDrawItem&&n.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return bt.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let i;if(e.attribute.renderStyle){const n=this.styleRenderMap.get(e.attribute.renderStyle);i=n&&n.get(t)}return i||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var n,r;const{clear:s,viewBox:a}=i,o=a.width(),h=a.height();if(s){e.clearRect(0,0,o,h);const i=null===(n=t.drawParams)||void 0===n?void 0:n.stage;if(i&&(e.globalAlpha=null!==(r=i.attribute.opacity)&&void 0!==r?r:1),i&&i.backgroundImg&&i.resources){const t=i.resources.get(s);t&&"success"===t.state&&t.data&&e.drawImage(t.data,0,0,o,h)}else e.fillStyle=bn(e,s,{AABBBounds:{x1:0,y1:0,x2:0+o,y2:0+h}},0,0),e.fillRect(0,0,o,h)}}afterDraw(t,e){}};Np=jp([g(),Wp(0,f(Bc)),Wp(1,p(k)),Wp(1,v(Vc)),Up("design:paramtypes",[Array,Object])],Np);var Gp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Fp=class extends t.DefaultCanvasLineRender{constructor(){super(...arguments),this.numberType=lo}drawShape(t,e,i,n,r,s,a,o){if(t.incremental&&r.multiGraphicOptions){const{startAtIdx:e,length:s}=r.multiGraphicOptions,{segments:h=[]}=t.attribute;if(e>h.length)return;const l=Er(t).line,{fill:c=l.fill,stroke:u=l.stroke,opacity:d=l.opacity,fillOpacity:p=l.fillOpacity,strokeOpacity:f=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:v=l.visible}=t.attribute,m=Go(d,p,c),y=zo(d,f),b=Wo(c),x=No(u,g);if(!t.valid||!v)return;if(!b&&!x)return;if(!(m||y||a||o))return;const{context:w}=r;for(let r=e;r<e+s;r++)this.drawIncreaseSegment(t,w,h[r-1],h[r],t.attribute.segments[r],[l,t.attribute],i,n)}else super.drawShape(t,e,i,n,r,s,a,o)}drawIncreaseSegment(t,e,i,n,r,s,a,o){n&&(e.beginPath(),Rl(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,r,s),e.setStrokeStyle(t,r,a,o,s),e.stroke())}};Fp=Gp([g()],Fp);var zp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Hp=class extends t.DefaultCanvasAreaRender{constructor(){super(...arguments),this.numberType=ro}drawShape(t,e,i,n,r,s,a){if(t.incremental&&r.multiGraphicOptions){const{startAtIdx:s,length:o}=r.multiGraphicOptions,{segments:h=[]}=t.attribute;if(s>h.length)return;const l=Er(t).area,{fill:c=l.fill,fillOpacity:u=l.fillOpacity,opacity:d=l.opacity,visible:p=l.visible}=t.attribute,f=Go(d,u,c),g=Wo(c);if(!t.valid||!p)return;if(!g)return;if(!f&&!a)return;for(let r=s;r<s+o;r++)this.drawIncreaseSegment(t,e,h[r-1],h[r],t.attribute.segments[r],[l,t.attribute],i,n)}else super.drawShape(t,e,i,n,r,s,a)}drawIncreaseSegment(t,e,i,n,r,s,a,o){n&&(e.beginPath(),Ml(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,r,s),e.setCommonStyle(t,r,a,o,s),e.fill())}};Hp=zp([g()],Hp);var Vp,Yp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Xp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$p=function(t,e){return function(i,n){e(i,n,t)}},qp=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{h(n.next(t))}catch(t){s(t)}}function o(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}h((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Vp||(Vp={}));let Kp=class extends Np{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Vp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new j([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return qp(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,viewBox:r}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(r.x1,r.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Zi.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Zi.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return qp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return qp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>qp(this,void 0,void 0,(function*(){if(2!==t.count)yield Ip(t,Zi.zIndex,((i,n)=>{if(this.status===Vp.STOP)return!0;if(i.isContainer)return!1;if(n<this.currentIdx)return!1;const r=this.currFrameStartAt+t.incremental;return n<r&&(this.currentIdx=n+1,this.renderItem(i,e)),n===r-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const n=t.getChildAt(0);if(n.incremental&&n.attribute.segments)for(n.incrementalAt||(n.incrementalAt=0);n.incrementalAt<n.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:n.incrementalAt,length:n.incremental},this.renderItem(n,e),n.incrementalAt+=n.incremental,yield this.waitToNextFrame();else this.renderItem(n,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return qp(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return qp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return qp(this,void 0,void 0,(function*(){this.rendering&&(this.status=Vp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Vp.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return qp(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>qp(this,void 0,void 0,(function*(){yield Ip(t,Zi.zIndex,(t=>qp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Kp=Yp([g(),$p(0,f(Bc)),$p(1,p(Fp)),$p(2,p(Hp)),$p(3,p(k)),$p(3,v(Vc)),Xp("design:paramtypes",[Array,Object,Object,Object])],Kp);var Zp=new i((e=>{e(Hh).toSelf().inSingletonScope(),e(Yh).toSelf().inSingletonScope(),e(Gc).to(Np),e(Sc).to(Kp),e(Pc).to(t.DefaultCanvasGroupRender).inSingletonScope(),e(Bc).toService(Pc),L(e,rh),e(t.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(),L(e,dh),L(e,Bc),e(t.CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(),e(Vc).toService(t.CommonDrawItemInterceptorContribution),L(e,Vc)}));function Jp(){Jp.__loaded||(Jp.__loaded=!0,In.load(Uo),In.load(yp),In.load(nu),In.load(mp),In.load(Cp),function(t){t.load(_p),t.load(Bp),t.load(Ep)}(In),function(t){t.load(Zp)}(In))}Jp.__loaded=!1,Jp();const Qp=In.get(W);gn.global=Qp;const tf=In.get(Mo);gn.graphicUtil=tf;const ef=In.get(Ro);gn.transformUtil=ef;const nf=In.get(bo);gn.graphicService=nf;const rf=In.get(Eo);gn.layerService=rf;class sf{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,gn.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),gn.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),gn.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));gn.graphicService.hooks.onAttributeUpdate.taps=e(gn.graphicService.hooks.onAttributeUpdate.taps),gn.graphicService.hooks.onSetStage.taps=e(gn.graphicService.hooks.onSetStage.taps),gn.graphicService.hooks.onRemove.taps=e(gn.graphicService.hooks.onRemove.taps)}}class af{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=gn.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=gn.global.getRequestAnimationFrame();this.rafId=t((()=>{gn.global.devicePixelRatio!==this.dpr&&(this.dpr=gn.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=gn.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class of{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,gn.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),gn.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){gn.graphicService.hooks.onAddIncremental.taps=gn.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.onClearIncremental.taps=gn.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,gn.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const hf=new oe;class lf{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),gn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(hf.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(hf,t.parent&&t.parent.globalTransMatrix)))})),gn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,r)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!r||e.dirty(n.globalAABBBounds))})),gn.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),gn.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){gn.graphicService.hooks.beforeUpdateAABBBounds.taps=gn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.afterUpdateAABBBounds.taps=gn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.clearAABBBounds.taps=gn.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.onRemove.taps=gn.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const cf=new qr;let uf;function df(){if(null==uf)try{const t=document.createElement("canvas"),e=t.getContext("2d");uf=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),uf&&(uf=!!document.createElement)}catch(t){uf=!1}}function pf(){df();const t=gn.global&&gn.global.env;return t?"browser"===t:uf}function ff(){df();const t=gn.global&&gn.global.env;return t?"node"===t:!uf}cf.addTimeline(Qr),cf.setFPS(60);class gf{static registerPlugin(t,e){gf._pluginClasses[t]=e}static getPlugin(t){return gf._pluginClasses[t]}}gf._pluginClasses={};const vf="white";class mf extends _o{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:vf}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{var t;this.tickedBeforeRender=!0,"performance"===(null===(t=this.params.optimize)||void 0===t?void 0:t.tickRenderMode)||"rendering"!==this.state&&this.render()},this.params=t,this.theme=new Rr,this.hooks={beforeRender:new j(["stage"]),afterRender:new j(["stage"])},this.global=gn.global,!this.global.env&&pf()&&this.global.setEnv("browser"),this.window=In.get(mr),this.renderService=In.get(eu),this.pluginService=In.get(xp),this.layerService=In.get(Eo),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:vf,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||cf,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new Jr,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&nt(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.ticker.on("afterTick",this.afterTickCb)}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Vr(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:r=0,camera:s,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:r,camera:s,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,r,s,a;this.option3d=t;const o=this.get3dOptions(t),{light:h,center:l,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:f}=o,{dir:g=[1,1,-1],color:v="white",ambient:m}=h,y=(null!==(e=l.x)&&void 0!==e?e:this.width/2)+(null!==(i=l.dx)&&void 0!==i?i:0),b=(null!==(n=l.y)&&void 0!==n?n:this.height/2)+(null!==(r=l.dy)&&void 0!==r?r:0),x=[y,b,(null!==(s=l.z)&&void 0!==s?s:0)+(null!==(a=l.dz)&&void 0!==a?a:0)];let w=0,S=0,A=0;c||(w=Math.sin(u)+y,S=Math.sin(d)+b,A=Math.cos(u)*Math.cos(d)*1);const T=gf.getPlugin("DirectionalLight");T&&(this.light=new T(g,v,m));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:f,viewParams:{pos:[w,S,A],center:x,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=gf.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=gf.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new sf))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new af))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new of))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ae;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new lf,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=gf.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=gf.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=gf.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.tickedBeforeRender||this.ticker.trySyncTickStatus(),this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e<t.length;e++){let n=t[e];"virtual"===n.layerMode&&(n=n.getNativeHandler().mainHandler.layer),i.includes(n)||i.push(n)}i.forEach((t=>{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,n,r){let s=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(s=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===r&&(s=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),s&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Gt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.ticker.removeListener("afterTick",this.afterTickCb),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=In.get(mr),i=t?-t.x1:0,n=t?-t.y1:0,r=t?t.x2:this.viewWidth,s=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:n,x2:r,y2:s},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=In.get(su)),this.pickerService}}var yf=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xf=new le(1,0,0,1,0,0),wf={x:0,y:0};t.EmptyContext2d=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new le(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new le(1,0,0,1,0,0),this.path=new Ui,this._clearMatrix=new le(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return kh.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(kh.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(kh.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*r,o*s),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,r,s),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,r,s){this.path.arc(t,e,i,n,r,s)}arcTo(t,e,i,n,r){this.path.arcTo(t,e,i,n,r)}bezierCurveTo(t,e,i,n,r,s){this.path.bezierCurveTo(t,e,i,n,r,s)}closePath(){this.path.closePath()}ellipse(t,e,i,n,r,s,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,r,s){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},wf),function(t,e,i){return dr(t,0,!1,e,i)}(this.path.commandList,wf.x,wf.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},wf);const i=yn(this,this.lineWidth,this.dpr);return function(t,e,i,n){return dr(t,e,!0,i,n)}(this.path.commandList,i,wf.x,wf.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,r){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,r){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(xf,t,e)}setClearMatrix(t,e,i,n,r,s){this._clearMatrix.setValue(t,e,i,n,r,s)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>kh.free(t))),this.stack.length=0}},t.EmptyContext2d=yf([g(),bf("design:paramtypes",[Object,Number])],t.EmptyContext2d);const Sf={WIDTH:500,HEIGHT:500,DPR:1};class Af{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Sf.WIDTH,height:r=Sf.HEIGHT,dpr:s=Sf.DPR,x:a,y:o,id:h,canvasControled:l=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*s,this._pixelHeight=r*s,this._visiable=!1!==t.visiable,this.controled=l,this._displayWidth=n,this._displayHeight=r,this._dpr=s,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:h,h&&(i.id=h),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}Af.env="browser";var Tf=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};t.BaseEnvContribution=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new oe}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}},t.BaseEnvContribution=Tf([g()],t.BaseEnvContribution);var Cf=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},_f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.BaseWindowHandlerContribution=class{constructor(){this._uid=e.GenAutoIncrementId(),this.viewBox=new oe,this.modelMatrix=new le(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,r,s){this.modelMatrix.setValue(t,e,i,n,r,s)}getViewBoxTransform(){return this.modelMatrix}},t.BaseWindowHandlerContribution=Cf([g(),_f("design:paramtypes",[])],t.BaseWindowHandlerContribution);class Bf{constructor(e,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=e,this.color=i,this.colorRgb=ta.Get(i,t.ColorType.Color1),this.ambient=n;const r=It(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);this.formatedDir=[e[0]/r,e[1]/r,e[2]/r]}computeColor(e,i){const n=this.formatedDir,r=Ot(kt((e[0]*n[0]+e[1]*n[1]+e[2]*n[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=nt(i)?ta.Get(i,t.ColorType.Color1):i;const a=this.colorRgb;return`rgb(${a[0]*s[0]*r}, ${a[1]*s[1]*r}, ${a[2]*s[2]*r})`}}const Pf=()=>{gf.registerPlugin("DirectionalLight",Bf)};class Rf{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=Oh.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Oh.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return Th(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Oh.allocate()),this._vp=Ah(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Oh.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Oh.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return Ch(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=Oh.allocate()),this._vp=Ah(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:n}=this._params;return(null!=e?e:n-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const n=[0,0,0];return _h(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:r}=this._params.viewParams;_h(n,[t,e,i],this._viewMatrixCached),t=n[0],e=n[1],i=n[2];const s=this.getProjectionScale(i);return{x:t*s+r[0],y:e*s+r[1]}}}const Mf=()=>{gf.registerPlugin("OrthoCamera",Rf)};var Ef=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},kf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Of=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultPickService=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=gn.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const r=i.bounds.width(),s=i.bounds.height();if(!(new oe).setValue(0,0,r,s).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new le(1,0,0,1,0,0);let o;for(let r=t.length-1;r>=0&&(n=t[r].isContainer?this.pickGroup(t[r],e,a,i):this.pickItem(t[r],e,a,i),!n.graphic);r--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n.graphic){let t=n.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(n.params={shadowTarget:n.graphic},n.graphic=t.shadowHost)}return n}containsPoint(t,e,i){var n;return!!(null===(n=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===n?void 0:n.graphic)}pickGroup(t,e,i,n){let r={group:null,graphic:null};if(!1===t.attribute.visibleAll)return r;const s=n.pickContext,a=s.modelMatrix;if(s.camera){const e=t.transMatrix,i=Oh.allocate();if(wh(i,e),a){if(i){const t=Oh.allocate();s.modelMatrix=Ah(t,a,i),Oh.free(i)}}else wh(i,t.globalTransMatrix),s.modelMatrix=i}if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const o=this.InterceptorContributions[r];if(o.beforePickItem){const r=o.beforePickItem(t,this,e,n,{parentMatrix:i});if(r)return s.modelMatrix!==a&&Oh.free(s.modelMatrix),s.modelMatrix=a,r}}const o=t.transMatrix,h=kh.allocateByObj(i),l=new Gt(e.x,e.y);h.transformPoint(l,l);const c=t.AABBBounds.containsPoint(l);if(!c&&!t.stage.camera)return r;const u=this.pickItem(t,l.clone(),i,n);u&&u.graphic&&(r.graphic=u.graphic,r.params=u.params);const d=!1!==t.attribute.pickable&&c;return h.multiply(o.a,o.b,o.c,o.d,o.e,o.f),!1===t.attribute.childrenPickable||u&&u.graphic||Lp(t,Zi.zIndex,(s=>{if(s.isContainer){const i=new Gt(e.x,e.y),a=Er(t).group,{scrollX:o=a.scrollX,scrollY:l=a.scrollY}=t.attribute;i.x-=o,i.y-=l,r=this.pickGroup(s,i,h,n)}else{const a=new Gt(e.x,e.y);h.transformPoint(a,a);const o=Er(t).group,{scrollX:l=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=l,a.y-=c;const u=this.pickItem(s,a,i,n);u&&u.graphic&&(r.graphic=u.graphic,r.params=u.params)}return!!r.graphic||!!r.group}),!0,!!s.camera),s.modelMatrix!==a&&Oh.free(s.modelMatrix),s.modelMatrix=a,r.graphic||r.group||!d||t.stage.camera||(r.group=t),kh.free(h),r}selectPicker(t){return this.pickerMap.get(t.numberType)||null}},t.DefaultPickService=Ef([g(),Of(0,p(k)),Of(0,v(vp)),kf("design:paramtypes",[Object])],t.DefaultPickService);var Lf=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},If=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function Df(t,e){let i=0;for(i=0;i<t.length;i++){const n=t[i];if(n.text&&"\n"===n.text||e--,e<0)break}return i}t.DefaultGlobalPickerService=class{constructor(){this.global=gn.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const r=new le(1,0,0,1,0,0);let s;for(let a=0;a<t.length;a++){if(t[a].isContainer)n=this.pickGroup(t[a],e,r,i);else{const s=this.pickItem(t[a],e,r,i);s&&(n.graphic=s.graphic,n.params=s.params)}if(n.graphic)break;s||(s=n.group)}if(n.graphic||(n.group=s),n.graphic){let t=n.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(n.params={shadowTarget:n.graphic},n.graphic=t.shadowHost)}return n}containsPoint(t,e,i){return!!this.pickItem(t,e,null,i)}pickGroup(t,e,i,n){let r={group:null,graphic:null};if(!1===t.attribute.visibleAll)return r;const s=t.transMatrix,a=new Gt(e.x,e.y);i.transformPoint(a,a);const o=t.AABBBounds.containsPoint(a);if(!o)return r;const h=!1!==t.attribute.pickable&&o;return i.multiply(s.a,s.b,s.c,s.d,s.e,s.f),!1!==t.attribute.childrenPickable&&t.forEachChildren((t=>{if(t.isContainer)r=this.pickGroup(t,e,i,n);else{const s=new Gt(e.x,e.y);i.transformPoint(s,s);const a=this.pickItem(t,s,i,n);a&&(r.graphic=a.graphic,r.params=a.params)}return!!r.graphic||!!r.group})),r.graphic||r.group||!h||(r.group=t),r}pickItem(t,e,i,n){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}},t.DefaultGlobalPickerService=Lf([g(),If("design:paramtypes",[])],t.DefaultGlobalPickerService);class jf{constructor(t){this.handleKeyDown=t=>{"Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"})},this.handleCompositionStart=()=>{const{textConfig:t=[]}=this.currRt.attribute,e=Df(t,this.cursorIndex),i=t[e];t.splice(e+1,0,Object.assign(Object.assign({},i),{text:""})),this.isComposing=!0},this.handleCompositionEnd=()=>{this.isComposing=!1;const{textConfig:t=[]}=this.currRt.attribute,e=Df(t,this.cursorIndex+1),i=t[e];t.splice(e,1);const n=i.text,r=Array.from(n.toString());for(let n=0;n<r.length;n++)t.splice(n+e,0,Object.assign(Object.assign({},i),{text:r[n]}));this.currRt.setAttributes({textConfig:t}),this.onChangeCbList.forEach((t=>{t(n,this.isComposing,this.cursorIndex+r.length,this.currRt,"right")}))},this.handleInput=t=>{if(!this.currRt)return;let e=t.data;"Backspace"===t.type||e||(e="\n");const{textConfig:i=[]}=this.currRt.attribute;let n=this.selectionStartCursorIdx,r=this.cursorIndex;n>r&&([n,r]=[r,n]),this.selectionStartCursorIdx=n,this.cursorIndex=n,n=Df(i,n);const s=this.selectionStartCursorIdx-n;r=Df(i,r);const a=i[n+(this.isComposing?1:0)];let o=a;"Backspace"!==t.type||this.isComposing?(n!==r&&i.splice(n+1,r-n),this.isComposing||(o=Object.assign(Object.assign({},a),{text:""}),n+=1,i.splice(n,0,o)),o.text=e):n!==r?i.splice(n+1,r-n):(i.splice(n,1),n-=1),this.currRt.setAttributes({textConfig:i}),this.isComposing?this.onInputCbList.forEach((t=>{t(e,this.isComposing,n+s,this.currRt,"\n"===e?"left":"right")})):this.onChangeCbList.forEach((t=>{t(e,this.isComposing,n+s,this.currRt,"\n"===e?"left":"right")}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.onInputCbList=[],this.onChangeCbList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),window.addEventListener("keydown",this.handleKeyDown)}moveTo(t,e,i,n,r){this.textAreaDom.style.left=`${t}px`,this.textAreaDom.style.top=`${e}px`,setTimeout((()=>{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=n,this.selectionStartCursorIdx=r}release(){this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),window.removeEventListener("keydown",this.handleKeyDown)}}class Uf{constructor(t,e,i,n,r){this.curCursorIdx=n,this.selectionStartCursorIdx=i,this.cacheCurCursorIdx=e,this.cacheSelectionStartCursorIdx=t,this.rt=r}hasFormat(t){return null!=this.getFormat(t)}getFormat(t){if(!this.rt)return null;const e=this.rt.attribute.textConfig,i=e[this.selectionStartCursorIdx+1][t];if(null==i)return null;for(let n=this.selectionStartCursorIdx+2;n<=this.curCursorIdx;n++)if(i!==e[n][t])return null;return i}getAllFormat(t){if(!this.rt)return[];const e=this.rt.attribute.textConfig,i=e[this.selectionStartCursorIdx+1][t],n=new Set;n.add(i);for(let i=this.selectionStartCursorIdx+2;i<=this.curCursorIdx;i++){const r=e[i];n.add(r[t])}return Array.from(n.values())}}const Wf="FORMAT_TEXT_COMMAND";class Nf{constructor(){this.pools=[]}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}class Gf extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.rect(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.rect(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Ff=new Gf;class zf extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.arc(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.arc(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Hf=new zf;class Vf extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.area(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.area(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Yf=new Vf;class Xf extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.circle(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.circle(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const $f=new Xf;class qf extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.line(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.line(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Kf=new qf;class Zf extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.path(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.path(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Jf=new Zf;class Qf extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.symbol(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.symbol(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const tg=new Qf;class eg extends Nf{allocate(t){if(!this.pools.length)return gn.graphicService.creator.text(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return gn.graphicService.creator.text(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const ig=new eg;class ng{constructor(){this.map={text:ig,symbol:tg}}gc(t){t.isContainer?t.forEachChildren((t=>this.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const rg=new ng;let sg=!1;const ag=new i((e=>{sg||(sg=!0,e(t.DefaultCanvasArcRender).toSelf().inSingletonScope(),e(Ac).to(t.DefaultCanvasArcRender).inSingletonScope(),e(Bc).toService(Ac),e(eh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,eh))}));let og=!1;const hg=new i((e=>{og||(og=!0,e(t.DefaultCanvasRectRender).toSelf().inSingletonScope(),e(kc).to(t.DefaultCanvasRectRender).inSingletonScope(),e(Bc).toService(kc),e(t.SplitRectAfterRenderContribution).toSelf(),e(t.SplitRectBeforeRenderContribution).toSelf(),e(hh).toService(t.SplitRectAfterRenderContribution),e(hh).toService(t.SplitRectBeforeRenderContribution),e(hh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,hh))}));let lg=!1;const cg=new i((e=>{lg||(lg=!0,e(t.DefaultCanvasLineRender).toSelf().inSingletonScope(),e(Fp).toSelf().inSingletonScope(),e(Rc).to(t.DefaultCanvasLineRender).inSingletonScope(),e(Bc).toService(Rc))}));let ug=!1;const dg=new i((e=>{ug||(ug=!0,e(t.DefaultCanvasAreaRender).toSelf().inSingletonScope(),e(Cc).to(t.DefaultCanvasAreaRender).inSingletonScope(),e(Bc).toService(Cc),e(ih).toService(t.DefaultBaseInteractiveRenderContribution),L(e,ih),e(Hp).toSelf().inSingletonScope())}));let pg=!1;const fg=new i((e=>{pg||(pg=!0,e(t.DefaultCanvasSymbolRender).toSelf().inSingletonScope(),e(Lc).to(t.DefaultCanvasSymbolRender).inSingletonScope(),e(Bc).toService(Lc),e(lh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,lh))}));let gg=!1;const vg=new i((e=>{gg||(gg=!0,e(t.DefaultCanvasCircleRender).toSelf().inSingletonScope(),e(_c).to(t.DefaultCanvasCircleRender).inSingletonScope(),e(Bc).toService(_c),e(nh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,nh))}));let mg=!1;const yg=new i((e=>{mg||(mg=!0,e(Ic).to(t.DefaultCanvasTextRender).inSingletonScope(),e(Bc).toService(Ic),e(ch).toService(t.DefaultBaseInteractiveRenderContribution),L(e,ch))}));let bg=!1;const xg=new i((e=>{bg||(bg=!0,e(t.DefaultCanvasPathRender).toSelf().inSingletonScope(),e(Mc).to(t.DefaultCanvasPathRender).inSingletonScope(),e(Bc).toService(Mc),e(ah).toService(t.DefaultBaseInteractiveRenderContribution),L(e,ah))}));let wg=!1;const Sg=new i((e=>{wg||(wg=!0,e(Ec).to(t.DefaultCanvasPolygonRender).inSingletonScope(),e(Bc).toService(Ec),e(oh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,oh))}));var Ag=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Tg=class{constructor(){this.numberType=ao}drawShape(t,e,i,n,r,s,a,o){r.drawContribution&&t.getSubGraphic().forEach((t=>{const h=r.drawContribution.getRenderContribution(t);h&&h.drawShape&&h.drawShape(t,e,i,n,r,s,a,o)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;if(r.highPerformanceSave(),!i.drawContribution)return;const s=Er(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:s})})),r.highPerformanceRestore()}};Tg=Ag([g()],Tg);let Cg=!1;const _g=new i((t=>{Cg||(Cg=!0,t(Uc).to(Tg).inSingletonScope(),t(Bc).toService(Uc))}));var Bg=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Pg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Rg=class extends Nh{constructor(){super(),this.numberType=vo,this.builtinContributions=[ic],this.init()}drawShape(t,e,i,n,r){const s=Er(t).richtext,{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity,fillOpacity:h=s.fillOpacity,visible:l=s.visible}=t.attribute;if(!t.valid||!l)return;const c=Go(o,h,!0),u=Go(o,a,!0);c&&(e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,u,c,u,s,r),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,u,c,u,s,r))}drawIcon(t,e,i,n,r){var s;const a=Er(t).richtextIcon,{width:o=a.width,height:h=a.height,opacity:l=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:f=a.backgroundStrokeOpacity,backgroundRadius:g=a.backgroundRadius,margin:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=h}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,r=(y-h)/2;0===g?(e.beginPath(),e.rect(i-t,n-r,m,y)):(e.beginPath(),sl(e,i-t,n-r,m,y,g)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=f,e.strokeStyle=p,e.stroke())}const b=c&&(null===(s=null==t?void 0:t.resources)||void 0===s?void 0:s.get(c));b&&"success"===b.state&&(e.globalAlpha=l,e.drawImage(b.data,i,n,o,h))}draw(t,e,i){const n=Er(t).richtext;this._draw(t,n,!1,i)}};Rg=Bg([g(),Pg("design:paramtypes",[])],Rg);let Mg=!1;const Eg=new i((t=>{Mg||(Mg=!0,t(Dc).to(Rg).inSingletonScope(),t(Bc).toService(Dc))}));let kg=!1;const Og=new i((e=>{kg||(kg=!0,e(Wc).to(t.DefaultCanvasImageRender).inSingletonScope(),e(Bc).toService(Wc),e(sh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,sh))}));class Lg extends Nh{stroke(t,e,i,n,r){const s=n.vertices;n.edges.forEach((n=>{const a=s[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},h=s[n[1]],l={x:t+h[0],y:e+h[1],z:i+h[2]};r.beginPath(),r.moveTo(o.x,o.y,o.z),r.lineTo(l.x,l.y,l.z),r.stroke()}))}fill(e,i,n,r,s,a,o,h,l,c,u){const d=ta.Get(a,t.ColorType.Color255),p=r.vertices,f=p.map((t=>o.view(t[0],t[1],t[2])[2])),g=[];r.polygons.forEach(((t,e)=>{if(s&&!s[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,n=f[i[0]],r=f[i[1]],a=f[i[2]],o=f[i[3]];t.ave_z=n+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((t=>{const{polygon:r,normal:s}=t.polygon,f=p[r[0]],g=p[r[1]],v=p[r[2]],m=p[r[3]],y={x:e+f[0],y:i+f[1],z:n+f[2]},b={x:e+g[0],y:i+g[1],z:n+g[2]},x={x:e+v[0],y:i+v[1],z:n+v[2]},w={x:e+m[0],y:i+m[1],z:n+m[2]};o.beginPath(),o.moveTo(y.x,y.y,y.z),o.lineTo(b.x,b.y,b.z),o.lineTo(x.x,x.y,x.z),o.lineTo(w.x,w.y,w.z),o.closePath(),u?u(o,l&&l.attribute,c):(o.fillStyle=h?h.computeColor(s,d):a,o.fill())}))}}var Ig=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Dg=class extends Lg{constructor(){super(...arguments),this.type="rect3d",this.numberType=go}drawShape(t,e,i,n,r,s,a,o){var h;const l=Er(t,null==s?void 0:s.theme).rect,{fill:c=l.fill,stroke:u=l.stroke,x1:d,y1:p,x:f,y:g,opacity:v=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:b=l.strokeOpacity,visible:x=l.visible}=t.attribute;let{width:w,height:S}=t.attribute;w=(null!=w?w:d-f)||0,S=(null!=S?S:p-g)||0;const A=null!==(h=this.z)&&void 0!==h?h:0,T=Fo(v,m,w,S,c),C=Ho(v,b,w,S),_=Wo(c),B=No(u,y);if(!t.valid||!x)return;if(!_&&!B)return;if(!(T||C||a||o))return;const{light:P}=r.stage||{},R=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,l);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,n,A,R,null,r,e,P,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,l),this.stroke(i,n,A,R,e))}draw(t,e,i){const n=Er(t).rect;this._draw(t,n,!1,i)}};Dg=Ig([g()],Dg);let jg=!1;const Ug=new i((t=>{jg||(jg=!0,t(Oc).to(Dg).inSingletonScope(),t(Bc).toService(Oc))}));var Wg=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Ng=class extends Nh{constructor(){super(...arguments),this.numberType=no}drawShape(e,i,n,r,s,a,o,h){var l;const c=Er(e,null==a?void 0:a.theme).arc,{fill:u=c.fill}=e.attribute,d=this.valid(e,c,o,h);if(!d)return;const{fVisible:p,sVisible:f,doFill:g,doStroke:v}=d,m=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:y=c.outerPadding,innerPadding:b=c.innerPadding,height:x=10}=e.attribute;let{outerRadius:w=c.outerRadius,innerRadius:S=c.innerRadius}=e.attribute;w+=y,S-=b;const A=ta.Get(u,t.ColorType.Color255),{light:T}=s.stage||{},C=s.hack_pieFace,_={top:m,bottom:m+x},B={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(i.beginPath(),function(t,e,i,n,r,s,a){const{startAngle:o,endAngle:h}=t.getParsedAngle(),l=Rt(h-o),c=h>o;let u=!1;if(s<a){const t=s;s=a,a=t}if(s<=Tt)e.moveTo(i,n,r);else if(l>=Pt-Tt)e.moveTo(i+s*Et(o),n+s*Lt(o),r),e.arc(i,n,s,o,h,!c,r),a>Tt&&(e.moveTo(i+a*Et(h),n+a*Lt(h),r),e.arc(i,n,a,h,o,c,r));else{const{outerDeltaAngle:l,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:f,innerEndAngle:g,innerStartAngle:v}=t.getParsePadAngle(o,h),m=s*Et(p),y=s*Lt(p),b=a*Et(g),x=a*Lt(g);l<.001?u=!0:(e.moveTo(i+m,n+y,r),e.arc(i,n,s,p,f,!c,r)),!(a>Tt)||d<.001?(e.lineTo(i+b,n+x,r),u=!0):(e.lineTo(i+b,n+x,r),e.arc(i,n,a,g,v,c,r))}e.closePath()}(e,i,n,r,_[C],w,S),i.setShadowBlendStyle&&i.setShadowBlendStyle(e,e.attribute,c),g&&(o?o(i,e.attribute,c):p&&(i.setCommonStyle(e,e.attribute,n,r,c),i.fillStyle=T?T.computeColor(B[C],A):u,i.fill())),v&&(h?h(i,e.attribute,c):f&&(i.setStrokeStyle(e,e.attribute,n,r,c),i.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(i.save(),i.beginPath(),i.arc(n,r,S,0,Pt,!0,_.top),i.clip()),i.beginPath(),function(t,e,i,n,r,s,a,o){const{startAngle:h,endAngle:l}=t.getParsedAngle(),c=Rt(l-h),u=l>h;let d=!1;if(a<=Tt)e.moveTo(i,n,r);else if(c>=Pt-Tt)e.moveTo(i+a*Et(h),n+a*Lt(h),r),e.arc(i,n,a,h,l,!u,r),e.lineTo(i+a*Et(l),n+a*Lt(l),s),e.arc(i,n,a,l,h,u,s);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(h,l),f=a*Et(c),g=a*Lt(c),v=a*Et(p),m=a*Lt(p);t<.001?d=!0:(e.moveTo(i+f,n+g,r),e.arc(i,n,a,c,p,!u,r),e.lineTo(i+v,n+m,s),e.arc(i,n,a,p,c,u,s))}e.closePath()}(e,i,n,r,_.top,_.bottom,"outside"===C?w:S,((t,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:r,outerStartAngle:s,outerEndAngle:a,innerEndAngle:o,innerStartAngle:h}=e.getParsePadAngle(t,i);return"outside"===C?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:s}:{innerouterDeltaAngle:r,innerouterEndAngle:o,innerouterStartAngle:h}})),i.setShadowBlendStyle&&i.setShadowBlendStyle(e,e.attribute,c),g&&(o?o(i,e.attribute,c):p&&(i.setCommonStyle(e,e.attribute,n,r,c),i.fillStyle=T?T.computeColor(B[C],A):u,i.fill())),v&&(h?h(i,e.attribute,c):f&&(i.setStrokeStyle(e,e.attribute,n,r,c),i.stroke())),"inside"===C&&i.restore())}draw(t,e,i,n){const r=Er(t,null==n?void 0:n.theme).arc;this._draw(t,r,!1,i,n)}};Ng=Wg([g()],Ng);let Gg=!1;const Fg=new i((t=>{Gg||(Gg=!0,t(Tc).to(Ng).inSingletonScope(),t(Bc).toService(Tc))}));var zg=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Hg=class extends Lg{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=po}drawShape(t,e,i,n,r,s,a,o){var h;const l=Er(t,null==s?void 0:s.theme).polygon,{fill:c=l.fill,stroke:u=l.stroke,face:d=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(h=this.z)&&void 0!==h?h:0;if(!this.valid(t,l,a,o))return;const{light:f}=r.stage||{},g=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,l);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,n,p,g,d,r,e,f,t,l,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,l),this.stroke(i,n,p,g,e))}draw(t,e,i){const n=Er(t).polygon;this._draw(t,n,!1,i)}};Hg=zg([g()],Hg);let Vg=!1;const Yg=new i((t=>{Vg||(Vg=!0,t(jc).to(Hg).inSingletonScope(),t(Bc).toService(jc))}));function Xg(){Jl.RegisterGraphicCreator("arc",sp)}function $g(){Jl.RegisterGraphicCreator("arc3d",op)}function qg(){Jl.RegisterGraphicCreator("area",ip)}function Kg(){Jl.RegisterGraphicCreator("circle",uu)}function Zg(){Jl.RegisterGraphicCreator("glyph",Wd)}function Jg(){Jl.RegisterGraphicCreator("group",Bo)}function Qg(){Jl.RegisterGraphicCreator("image",Hd)}function tv(){Jl.RegisterGraphicCreator("line",Ed)}function ev(){Jl.RegisterGraphicCreator("path",Qd)}function iv(){Jl.RegisterGraphicCreator("polygon",cp)}function nv(){Jl.RegisterGraphicCreator("pyramid3d",dp)}function rv(){Jl.RegisterGraphicCreator("rect",Ld)}function sv(){Jl.RegisterGraphicCreator("rect3d",jd)}function av(){Jl.RegisterGraphicCreator("richtext",Kd)}function ov(){Jl.RegisterGraphicCreator("symbol",Pd)}function hv(){Jl.RegisterGraphicCreator("text",gu)}function lv(){Jl.RegisterGraphicCreator("shadowRoot",fp)}function cv(){Jl.RegisterGraphicCreator("wrapText",yu)}class uv{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.onRemove.unTap(this.key),gn.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?gn.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:gn.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return gh("text"===t.type&&t.attribute?t.attribute:Er(t).text)}getTransformOfText(t){const e=Er(t).text,{textAlign:i=e.textAlign,textBaseline:n=e.textBaseline}=t.attribute,r=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:s,scaleX:a,scaleY:o}=r,h={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},l={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${h[i]},${h[n]}) rotate(${s}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${l[i]} ${l[n]}`}}updateStyleOfWrapContainer(t,e,i,n,r){const{pointerEvents:s}=r;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===s?"all":s||"none",i.style.position||(i.style.position="absolute",n.style.position="relative");let o=0,h=0;const l=t.globalAABBBounds;let c=r.anchorType;if(K(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||l.empty()){const e=t.globalTransMatrix;o=e.e,h=e.f}else{const t=((t,e)=>{const{x1:i,x2:n,y1:r,y2:s}=t,a=Math.abs(n-i),o=Math.abs(s-r);let h=(i+n)/2,l=(r+s)/2,c=0,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return h+=c*a,l+=u*o,{x:h,y:l}})(l,c);o=t.x,h=t.y}const u=gn.global.getElementTopLeft(n,!1),d=e.window.getTopLeft(!1),p=e.viewBox,f=o+d.left-u.left+p.x1,g=h+d.top-u.top+p.y1;if(a.left=`${f}px`,a.top=`${g}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),q(r.style)){const e=r.style({top:g,left:f,width:l.width(),height:l.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else J(r.style)?a=Object.assign(Object.assign({},a),r.style):nt(r.style)&&r.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),n=i[1].trim();e&&n&&(t[e]=n)}}})),t}(r.style)));gn.global.updateDom(i,{width:r.width,height:r.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===gn.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Zi.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Zi.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&gn.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const{dom:r,container:s}=i;if(!r)return;const a=K(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&s&&s!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof r?this.htmlMap[a].wrapContainer.innerHTML=r:r!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(r));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,s);t&&("string"==typeof r?t.innerHTML=r:t.appendChild(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:s,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:h}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,n,o,h,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===gn.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const dv=()=>{gf.registerPlugin("HtmlAttributePlugin",uv)};class pv extends uv{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:n}=this.htmlMap[t];e?gn.global.getRequestAnimationFrame()((()=>{e.unmount()})):n&&n(),i&&gn.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const r=n.params.ReactDOM,{element:s,container:a}=i;if(!s||!r||!r.createRoot&&!r.render)return;const o=K(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])r.createRoot?this.htmlMap[o].root.render(s):r.render(s,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t)if(this.htmlMap||(this.htmlMap={}),r.createRoot){const i=r.createRoot(t);i.render(s),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else r.render(s,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{r.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:h,nativeContainer:l}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,n,h,l,i),this.htmlMap[o].renderId=this.renderId}}const fv=()=>{gf.registerPlugin("ReactAttributePlugin",pv)};class gv{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=t.page.x-this.pageX,s=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=r/100,o=s/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const vv=()=>{gf.registerPlugin("ViewTransform3dPlugin",gv)},mv=new oe;class yv{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=e.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new oe}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const n=Er(i).group,{display:r=n.display}=i.attribute;if("flex"!==r)return;const{flexDirection:s=n.flexDirection,flexWrap:a=n.flexWrap,alignItems:o=n.alignItems,clip:h=n.clip}=i.attribute,{alignContent:l=(null!=o?o:n.alignContent)}=i.attribute;let{width:c,height:u,justifyContent:d=n.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==u){let t=0,e=0,i=0;if(p.forEach((n=>{const r=this.getAABBBounds(n);r.empty()||("column"===s||"column-reverse"===s?(e+=r.height(),t=Math.max(t,r.width())):(t+=r.width(),e=Math.max(e,r.height())),i+=r.x1,i+=r.y1,i+=r.x2,i+=r.y2)})),!isFinite(i))return;c=t,u=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=u:u=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const f={main:{len:c,field:"x"},cross:{len:u,field:"y"}},g=f.main,v=f.cross;"column"!==s&&"column-reverse"!==s||(g.len=u,v.len=c,g.field="y",v.field="x"),"row-reverse"!==s&&"column-reverse"!==s||("flex-start"===d?d="flex-end":"flex-end"===d?d="flex-start":p.reverse());let m=0,y=0;const b=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===g.field?e.width():e.height(),n="x"===v.field?e.width():e.height();b.push({mainLen:i,crossLen:n}),m+=i,y=Math.max(y,n)}));const x=[];if(m>g.len&&"wrap"===a){let t=0,e=0;b.forEach(((i,n)=>{let{mainLen:r,crossLen:s}=i;t+r>g.len?0===t?(x.push({idx:n,mainLen:t+r,crossLen:s}),t=0,e=0):(x.push({idx:n-1,mainLen:t,crossLen:e}),t=r,e=s):(t+=r,e=Math.max(e,s))})),x.push({idx:b.length-1,mainLen:t,crossLen:e})}else x.push({idx:b.length-1,mainLen:m,crossLen:y});let w=0;if(x.forEach((t=>{this.layoutMain(i,p,d,g,b,w,t),w=t.idx+1})),y=x.reduce(((t,e)=>t+e.crossLen),0),1===x.length){const t={"flex-start":0,"flex-end":v.len,center:v.len/2};this.layoutCross(p,o,v,t,b,x[0],0)}else if("flex-start"===l){w=0;let t=0;x.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",v,n,b,x[i],w),w=e.idx+1,t+=e.crossLen}))}else if("center"===l){w=0;let t=Math.max(0,(v.len-y)/2);x.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",v,n,b,x[i],w),w=e.idx+1,t+=e.crossLen}))}else if("space-around"===l){w=0;const t=Math.max(0,(v.len-y)/x.length/2);let e=t;x.forEach(((i,n)=>{const r={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",v,r,b,x[n],w),w=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===l){w=0;const t=Math.max(0,(v.len-y)/(2*x.length-2));let e=0;x.forEach(((i,n)=>{const r={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",v,r,b,x[n],w),w=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);h||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,n,r,s,a){if("flex-start"===i){let t=0;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}else if("flex-end"===i){let t=n.len;for(let i=a.idx;i>=s;i--){t-=r[i].mainLen;const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`]))}}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}else{const t=a.idx-s+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=s;t<=a.idx;t++){const s=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(s,e[t].attribute[n.field],a[`${n.field}1`])),o+=r[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}else{const t=a.idx-s+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=s;t<=a.idx;t++){const s=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(s,e[t].attribute[n.field],a[`${n.field}1`])),o+=r[t].mainLen+2*i}}else if("center"===i){let t=(n.len-a.mainLen)/2;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}}layoutCross(t,e,i,n,r,s,a){var o;for(let h=a;h<=s.idx;h++){const s=t[h];let{alignSelf:a}=s.attribute;a&&"auto"!==a||(a=e);const l=this.getAABBBounds(s),c=null!==(o=n[a])&&void 0!==o?o:n["flex-start"];"flex-end"===a?!l.empty()&&(s.attribute[i.field]=this.updateChildPos(c-r[h].crossLen+(i.field,0),s.attribute[i.field],l[`${i.field}1`])):"center"===a?!l.empty()&&(s.attribute[i.field]=this.updateChildPos(c-r[h].crossLen/2+(i.field,0),s.attribute[i.field],l[`${i.field}1`])):!l.empty()&&(s.attribute[i.field]=this.updateChildPos(c+(i.field,0),s.attribute[i.field],l[`${i.field}1`]))}}activate(t){this.pluginService=t,gn.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),gn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&mv.copy(n)})),gn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,r)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(mv.equals(i)||this.tryLayout(t,!1))})),gn.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){gn.graphicService.hooks.onAttributeUpdate.taps=gn.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.beforeUpdateAABBBounds.taps=gn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.afterUpdateAABBBounds.taps=gn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),gn.graphicService.hooks.onSetStage.taps=gn.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const bv=()=>{gf.registerPlugin("FlexLayoutPlugin",yv)};function xv(t,e,i){if(t&&t.length){const[n,r]=e,s=Math.PI/180*i,a=Math.cos(s),o=Math.sin(s);t.forEach((t=>{const[e,i]=t;t[0]=(e-n)*a-(i-r)*o+n,t[1]=(e-n)*o+(i-r)*a+r}))}}function wv(t){const e=t[0],i=t[1];return Math.sqrt(Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2))}function Sv(t,e){const i=e.hachureAngle+90;let n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.max(n,.1);const r=[0,0];if(i)for(const e of t)xv(e,r,i);const s=function(t,e){const i=[];for(const e of t){const t=[...e];t[0].join(",")!==t[t.length-1].join(",")&&t.push([t[0][0],t[0][1]]),t.length>2&&i.push(t)}const n=[];e=Math.max(e,.1);const r=[];for(const t of i)for(let e=0;e<t.length-1;e++){const i=t[e],n=t[e+1];if(i[1]!==n[1]){const t=Math.min(i[1],n[1]);r.push({ymin:t,ymax:Math.max(i[1],n[1]),x:t===i[1]?i[0]:n[0],islope:(n[0]-i[0])/(n[1]-i[1])})}}if(r.sort(((t,e)=>t.ymin<e.ymin?-1:t.ymin>e.ymin?1:t.x<e.x?-1:t.x>e.x?1:t.ymax===e.ymax?0:(t.ymax-e.ymax)/Math.abs(t.ymax-e.ymax))),!r.length)return n;let s=[],a=r[0].ymin;for(;s.length||r.length;){if(r.length){let t=-1;for(let e=0;e<r.length&&!(r[e].ymin>a);e++)t=e;r.splice(0,t+1).forEach((t=>{s.push({s:a,edge:t})}))}if(s=s.filter((t=>!(t.edge.ymax<=a))),s.sort(((t,e)=>t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x))),s.length>1)for(let t=0;t<s.length;t+=2){const e=t+1;if(e>=s.length)break;const i=s[t].edge,r=s[e].edge;n.push([[Math.round(i.x),a],[Math.round(r.x),a]])}a+=e,s.forEach((t=>{t.edge.x=t.edge.x+e*t.edge.islope}))}return n}(t,n);if(i){for(const e of t)xv(e,r,-i);!function(t,e,i){const n=[];t.forEach((t=>n.push(...t))),xv(n,e,i)}(s,r,-i)}return s}class Av{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){const i=Sv(t,e);return{type:"fillSketch",ops:this.renderLines(i,e)}}renderLines(t,e){const i=[];for(const n of t)i.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],e));return i}}class Tv extends Av{fillPolygons(t,e){let i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);const n=Sv(t,Object.assign({},e,{hachureGap:i})),r=Math.PI/180*e.hachureAngle,s=[],a=.5*i*Math.cos(r),o=.5*i*Math.sin(r);for(const[t,e]of n)wv([t,e])&&s.push([[t[0]-a,t[1]+o],[...e]],[[t[0]+a,t[1]-o],[...e]]);return{type:"fillSketch",ops:this.renderLines(s,e)}}}class Cv extends Av{fillPolygons(t,e){const i=this._fillPolygons(t,e),n=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),r=this._fillPolygons(t,n);return i.ops=i.ops.concat(r.ops),i}}class _v{constructor(t){this.helper=t}fillPolygons(t,e){const i=Sv(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(i,e)}dotsOnLines(t,e){const i=[];let n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.max(n,.1);let r=e.fillWeight;r<0&&(r=e.strokeWidth/2);const s=n/4;for(const a of t){const t=wv(a),o=t/n,h=Math.ceil(o)-1,l=t-h*n,c=(a[0][0]+a[1][0])/2-n/4,u=Math.min(a[0][1],a[1][1]);for(let t=0;t<h;t++){const a=u+l+t*n,o=c-s+2*Math.random()*s,h=a-s+2*Math.random()*s,d=this.helper.ellipse(o,h,r,r,e);i.push(...d.ops)}}return{type:"fillSketch",ops:i}}}class Bv{constructor(t){this.helper=t}fillPolygons(t,e){const i=Sv(t,e);return{type:"fillSketch",ops:this.dashedLine(i,e)}}dashedLine(t,e){const i=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,n=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,r=[];return t.forEach((t=>{const s=wv(t),a=Math.floor(s/(i+n)),o=(s+n-a*(i+n))/2;let h=t[0],l=t[1];h[0]>l[0]&&(h=t[1],l=t[0]);const c=Math.atan((l[1]-h[1])/(l[0]-h[0]));for(let t=0;t<a;t++){const s=t*(i+n),a=s+i,l=[h[0]+s*Math.cos(c)+o*Math.cos(c),h[1]+s*Math.sin(c)+o*Math.sin(c)],u=[h[0]+a*Math.cos(c)+o*Math.cos(c),h[1]+a*Math.sin(c)+o*Math.sin(c)];r.push(...this.helper.doubleLineOps(l[0],l[1],u[0],u[1],e))}})),r}}class Pv{constructor(t){this.helper=t}fillPolygons(t,e){const i=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,n=e.zigzagOffset<0?i:e.zigzagOffset,r=Sv(t,e=Object.assign({},e,{hachureGap:i+n}));return{type:"fillSketch",ops:this.zigzagLines(r,n,e)}}zigzagLines(t,e,i){const n=[];return t.forEach((t=>{const r=wv(t),s=Math.round(r/(2*e));let a=t[0],o=t[1];a[0]>o[0]&&(a=t[1],o=t[0]);const h=Math.atan((o[1]-a[1])/(o[0]-a[0]));for(let t=0;t<s;t++){const r=2*t*e,s=2*(t+1)*e,o=Math.sqrt(2*Math.pow(e,2)),l=[a[0]+r*Math.cos(h),a[1]+r*Math.sin(h)],c=[a[0]+s*Math.cos(h),a[1]+s*Math.sin(h)],u=[l[0]+o*Math.cos(h+Math.PI/4),l[1]+o*Math.sin(h+Math.PI/4)];n.push(...this.helper.doubleLineOps(l[0],l[1],u[0],u[1],i),...this.helper.doubleLineOps(u[0],u[1],c[0],c[1],i))}})),n}}const Rv={};class Mv{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const Ev={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function kv(t,e){return t.type===e}function Ov(t){const e=[],i=function(t){const e=new Array;for(;""!==t;)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:0,text:RegExp.$1},t=t.substr(RegExp.$1.length);else{if(!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];e[e.length]={type:1,text:`${parseFloat(RegExp.$1)}`},t=t.substr(RegExp.$1.length)}return e[e.length]={type:2,text:""},e}(t);let n="BOD",r=0,s=i[r];for(;!kv(s,2);){let a=0;const o=[];if("BOD"===n){if("M"!==s.text&&"m"!==s.text)return Ov("M0,0"+t);r++,a=Ev[s.text],n=s.text}else kv(s,1)?a=Ev[n]:(r++,a=Ev[s.text],n=s.text);if(!(r+a<i.length))throw new Error("Path data ended short");for(let t=r;t<r+a;t++){const e=i[t];if(!kv(e,1))throw new Error("Param not a number: "+n+","+e.text);o[o.length]=+e.text}if("number"!=typeof Ev[n])throw new Error("Bad segment: "+n);{const t={key:n,data:o};e.push(t),r+=a,s=i[r],"M"===n&&(n="L"),"m"===n&&(n="l")}}return e}function Lv(t){let e=0,i=0,n=0,r=0;const s=[];for(const{key:a,data:o}of t)switch(a){case"M":s.push({key:"M",data:[...o]}),[e,i]=o,[n,r]=o;break;case"m":e+=o[0],i+=o[1],s.push({key:"M",data:[e,i]}),n=e,r=i;break;case"L":s.push({key:"L",data:[...o]}),[e,i]=o;break;case"l":e+=o[0],i+=o[1],s.push({key:"L",data:[e,i]});break;case"C":s.push({key:"C",data:[...o]}),e=o[4],i=o[5];break;case"c":{const t=o.map(((t,n)=>n%2?t+i:t+e));s.push({key:"C",data:t}),e=t[4],i=t[5];break}case"Q":s.push({key:"Q",data:[...o]}),e=o[2],i=o[3];break;case"q":{const t=o.map(((t,n)=>n%2?t+i:t+e));s.push({key:"Q",data:t}),e=t[2],i=t[3];break}case"A":s.push({key:"A",data:[...o]}),e=o[5],i=o[6];break;case"a":e+=o[5],i+=o[6],s.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,i]});break;case"H":s.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],s.push({key:"H",data:[e]});break;case"V":s.push({key:"V",data:[...o]}),i=o[0];break;case"v":i+=o[0],s.push({key:"V",data:[i]});break;case"S":s.push({key:"S",data:[...o]}),e=o[2],i=o[3];break;case"s":{const t=o.map(((t,n)=>n%2?t+i:t+e));s.push({key:"S",data:t}),e=t[2],i=t[3];break}case"T":s.push({key:"T",data:[...o]}),e=o[0],i=o[1];break;case"t":e+=o[0],i+=o[1],s.push({key:"T",data:[e,i]});break;case"Z":case"z":s.push({key:"Z",data:[]}),e=n,i=r}return s}function Iv(t){const e=[];let i="",n=0,r=0,s=0,a=0,o=0,h=0;for(const{key:l,data:c}of t){switch(l){case"M":e.push({key:"M",data:[...c]}),[n,r]=c,[s,a]=c;break;case"C":e.push({key:"C",data:[...c]}),n=c[4],r=c[5],o=c[2],h=c[3];break;case"L":e.push({key:"L",data:[...c]}),[n,r]=c;break;case"H":n=c[0],e.push({key:"L",data:[n,r]});break;case"V":r=c[0],e.push({key:"L",data:[n,r]});break;case"S":{let t=0,s=0;"C"===i||"S"===i?(t=n+(n-o),s=r+(r-h)):(t=n,s=r),e.push({key:"C",data:[t,s,...c]}),o=c[0],h=c[1],n=c[2],r=c[3];break}case"T":{const[t,s]=c;let a=0,l=0;"Q"===i||"T"===i?(a=n+(n-o),l=r+(r-h)):(a=n,l=r);const u=n+2*(a-n)/3,d=r+2*(l-r)/3,p=t+2*(a-t)/3,f=s+2*(l-s)/3;e.push({key:"C",data:[u,d,p,f,t,s]}),o=a,h=l,n=t,r=s;break}case"Q":{const[t,i,s,a]=c,l=n+2*(t-n)/3,u=r+2*(i-r)/3,d=s+2*(t-s)/3,p=a+2*(i-a)/3;e.push({key:"C",data:[l,u,d,p,s,a]}),o=t,h=i,n=s,r=a;break}case"A":{const t=Math.abs(c[0]),i=Math.abs(c[1]),s=c[2],a=c[3],o=c[4],h=c[5],l=c[6];0===t||0===i?(e.push({key:"C",data:[n,r,h,l,h,l]}),n=h,r=l):n===h&&r===l||(jv(n,r,h,l,t,i,s,a,o).forEach((function(t){e.push({key:"C",data:t})})),n=h,r=l);break}case"Z":e.push({key:"Z",data:[]}),n=s,r=a}i=l}return e}function Dv(t,e,i){return[t*Math.cos(i)-e*Math.sin(i),t*Math.sin(i)+e*Math.cos(i)]}function jv(t,e,i,n,r,s,a,o,h,l){const c=(u=a,Math.PI*u/180);var u;let d=[],p=0,f=0,g=0,v=0;if(l)[p,f,g,v]=l;else{[t,e]=Dv(t,e,-c),[i,n]=Dv(i,n,-c);const a=(t-i)/2,l=(e-n)/2;let u=a*a/(r*r)+l*l/(s*s);u>1&&(u=Math.sqrt(u),r*=u,s*=u);const d=r*r,m=s*s,y=d*m-d*l*l-m*a*a,b=d*l*l+m*a*a,x=(o===h?-1:1)*Math.sqrt(Math.abs(y/b));g=x*r*l/s+(t+i)/2,v=x*-s*a/r+(e+n)/2,p=Math.asin(parseFloat(((e-v)/s).toFixed(9))),f=Math.asin(parseFloat(((n-v)/s).toFixed(9))),t<g&&(p=Math.PI-p),i<g&&(f=Math.PI-f),p<0&&(p=2*Math.PI+p),f<0&&(f=2*Math.PI+f),h&&p>f&&(p-=2*Math.PI),!h&&f>p&&(f-=2*Math.PI)}let m=f-p;if(Math.abs(m)>120*Math.PI/180){const t=f,e=i,o=n;f=h&&f>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,d=jv(i=g+r*Math.cos(f),n=v+s*Math.sin(f),e,o,r,s,a,0,h,[f,t,g,v])}m=f-p;const y=Math.cos(p),b=Math.sin(p),x=Math.cos(f),w=Math.sin(f),S=Math.tan(m/4),A=4/3*r*S,T=4/3*s*S,C=[t,e],_=[t+A*b,e-T*y],B=[i+A*w,n-T*x],P=[i,n];if(_[0]=2*C[0]-_[0],_[1]=2*C[1]-_[1],l)return[_,B,P].concat(d);{d=[_,B,P].concat(d);const t=[];for(let e=0;e<d.length;e+=3){const i=Dv(d[e][0],d[e][1],c),n=Dv(d[e+1][0],d[e+1][1],c),r=Dv(d[e+2][0],d[e+2][1],c);t.push([i[0],i[1],n[0],n[1],r[0],r[1]])}return t}}const Uv={randOffset:function(t,e){return $v(t,e)},randOffsetWithRange:function(t,e,i){return Xv(t,e,i)},ellipse:function(t,e,i,n,r){return Fv(t,e,r,Gv(i,n,r)).opset},doubleLineOps:function(t,e,i,n,r){return qv(t,e,i,n,r,!0)}};function Wv(t,e,i,n,r){return{type:"path",ops:qv(t,e,i,n,r)}}function Nv(t,e,i){const n=(t||[]).length;if(n>2){const r=[];for(let e=0;e<n-1;e++)r.push(...qv(t[e][0],t[e][1],t[e+1][0],t[e+1][1],i));return e&&r.push(...qv(t[n-1][0],t[n-1][1],t[0][0],t[0][1],i)),{type:"path",ops:r}}return 2===n?Wv(t[0][0],t[0][1],t[1][0],t[1][1],i):{type:"path",ops:[]}}function Gv(t,e,i){const n=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),r=Math.ceil(Math.max(i.curveStepCount,i.curveStepCount/Math.sqrt(200)*n)),s=2*Math.PI/r;let a=Math.abs(t/2),o=Math.abs(e/2);const h=1-i.curveFitting;return a+=$v(a*h,i),o+=$v(o*h,i),{increment:s,rx:a,ry:o}}function Fv(t,e,i,n){const[r,s]=Qv(n.increment,t,e,n.rx,n.ry,1,n.increment*Xv(.1,Xv(.4,1,i),i),i);let a=Jv(r,null,i);if(!i.disableMultiStroke&&0!==i.roughness){const[r]=Qv(n.increment,t,e,n.rx,n.ry,1.5,0,i),s=Jv(r,null,i);a=a.concat(s)}return{estimatedPoints:s,opset:{type:"path",ops:a}}}function zv(t,e,i,n,r,s,a,o,h){const l=t,c=e;let u=Math.abs(i/2),d=Math.abs(n/2);u+=$v(.01*u,h),d+=$v(.01*d,h);let p=r,f=s;for(;p<0;)p+=2*Math.PI,f+=2*Math.PI;f-p>2*Math.PI&&(p=0,f=2*Math.PI);const g=2*Math.PI/h.curveStepCount,v=Math.min(g/2,(f-p)/2),m=tm(v,l,c,u,d,p,f,1,h);if(!h.disableMultiStroke){const t=tm(v,l,c,u,d,p,f,1.5,h);m.push(...t)}return a&&(o?m.push(...qv(l,c,l+u*Math.cos(p),c+d*Math.sin(p),h),...qv(l,c,l+u*Math.cos(f),c+d*Math.sin(f),h)):m.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+u*Math.cos(p),c+d*Math.sin(p)]})),{type:"path",ops:m}}function Hv(t,e){const i=[];for(const n of t)if(n.length){const t=e.maxRandomnessOffset||0,r=n.length;if(r>2){i.push({op:"move",data:[n[0][0]+$v(t,e),n[0][1]+$v(t,e)]});for(let s=1;s<r;s++)i.push({op:"lineTo",data:[n[s][0]+$v(t,e),n[s][1]+$v(t,e)]})}}return{type:"fillPath",ops:i}}function Vv(t,e){return function(t,e){let i=t.fillStyle||"hachure";if(!Rv[i])switch(i){case"zigzag":Rv[i]||(Rv[i]=new Tv(e));break;case"cross-hatch":Rv[i]||(Rv[i]=new Cv(e));break;case"dots":Rv[i]||(Rv[i]=new _v(e));break;case"dashed":Rv[i]||(Rv[i]=new Bv(e));break;case"zigzag-line":Rv[i]||(Rv[i]=new Pv(e));break;default:i="hachure",Rv[i]||(Rv[i]=new Av(e))}return Rv[i]}(e,Uv).fillPolygons(t,e)}function Yv(t){return t.randomizer||(t.randomizer=new Mv(t.seed||0)),t.randomizer.next()}function Xv(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return i.roughness*n*(Yv(i)*(e-t)+t)}function $v(t,e){return Xv(-t,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function qv(t,e,i,n,r){const s=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?r.disableMultiStrokeFill:r.disableMultiStroke,a=Kv(t,e,i,n,r,!0,!1);if(s)return a;const o=Kv(t,e,i,n,r,!0,!0);return a.concat(o)}function Kv(t,e,i,n,r,s,a){const o=Math.pow(t-i,2)+Math.pow(e-n,2),h=Math.sqrt(o);let l=1;l=h<200?1:h>500?.4:-.0016668*h+1.233334;let c=r.maxRandomnessOffset||0;c*c*100>o&&(c=h/10);const u=c/2,d=.2+.2*Yv(r);let p=r.bowing*r.maxRandomnessOffset*(n-e)/200,f=r.bowing*r.maxRandomnessOffset*(t-i)/200;p=$v(p,r,l),f=$v(f,r,l);const g=[],v=()=>$v(u,r,l),m=()=>$v(c,r,l),y=r.preserveVertices;return s&&(a?g.push({op:"move",data:[t+(y?0:v()),e+(y?0:v())]}):g.push({op:"move",data:[t+(y?0:$v(c,r,l)),e+(y?0:$v(c,r,l))]})),a?g.push({op:"bcurveTo",data:[p+t+(i-t)*d+v(),f+e+(n-e)*d+v(),p+t+2*(i-t)*d+v(),f+e+2*(n-e)*d+v(),i+(y?0:v()),n+(y?0:v())]}):g.push({op:"bcurveTo",data:[p+t+(i-t)*d+m(),f+e+(n-e)*d+m(),p+t+2*(i-t)*d+m(),f+e+2*(n-e)*d+m(),i+(y?0:m()),n+(y?0:m())]}),g}function Zv(t,e,i){const n=[];n.push([t[0][0]+$v(e,i),t[0][1]+$v(e,i)]),n.push([t[0][0]+$v(e,i),t[0][1]+$v(e,i)]);for(let r=1;r<t.length;r++)n.push([t[r][0]+$v(e,i),t[r][1]+$v(e,i)]),r===t.length-1&&n.push([t[r][0]+$v(e,i),t[r][1]+$v(e,i)]);return Jv(n,null,i)}function Jv(t,e,i){const n=t.length,r=[];if(n>3){const s=[],a=1-i.curveTightness;r.push({op:"move",data:[t[1][0],t[1][1]]});for(let e=1;e+2<n;e++){const i=t[e];s[0]=[i[0],i[1]],s[1]=[i[0]+(a*t[e+1][0]-a*t[e-1][0])/6,i[1]+(a*t[e+1][1]-a*t[e-1][1])/6],s[2]=[t[e+1][0]+(a*t[e][0]-a*t[e+2][0])/6,t[e+1][1]+(a*t[e][1]-a*t[e+2][1])/6],s[3]=[t[e+1][0],t[e+1][1]],r.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}if(e&&2===e.length){const t=i.maxRandomnessOffset;r.push({op:"lineTo",data:[e[0]+$v(t,i),e[1]+$v(t,i)]})}}else 3===n?(r.push({op:"move",data:[t[1][0],t[1][1]]}),r.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):2===n&&r.push(...qv(t[0][0],t[0][1],t[1][0],t[1][1],i));return r}function Qv(t,e,i,n,r,s,a,o){const h=[],l=[];if(0===o.roughness){t/=4,l.push([e+n*Math.cos(-t),i+r*Math.sin(-t)]);for(let s=0;s<=2*Math.PI;s+=t){const t=[e+n*Math.cos(s),i+r*Math.sin(s)];h.push(t),l.push(t)}l.push([e+n*Math.cos(0),i+r*Math.sin(0)]),l.push([e+n*Math.cos(t),i+r*Math.sin(t)])}else{const c=$v(.5,o)-Math.PI/2;l.push([$v(s,o)+e+.9*n*Math.cos(c-t),$v(s,o)+i+.9*r*Math.sin(c-t)]);const u=2*Math.PI+c-.01;for(let a=c;a<u;a+=t){const t=[$v(s,o)+e+n*Math.cos(a),$v(s,o)+i+r*Math.sin(a)];h.push(t),l.push(t)}l.push([$v(s,o)+e+n*Math.cos(c+2*Math.PI+.5*a),$v(s,o)+i+r*Math.sin(c+2*Math.PI+.5*a)]),l.push([$v(s,o)+e+.98*n*Math.cos(c+a),$v(s,o)+i+.98*r*Math.sin(c+a)]),l.push([$v(s,o)+e+.9*n*Math.cos(c+.5*a),$v(s,o)+i+.9*r*Math.sin(c+.5*a)])}return[l,h]}function tm(t,e,i,n,r,s,a,o,h){const l=s+$v(.1,h),c=[];c.push([$v(o,h)+e+.9*n*Math.cos(l-t),$v(o,h)+i+.9*r*Math.sin(l-t)]);for(let s=l;s<=a;s+=t)c.push([$v(o,h)+e+n*Math.cos(s),$v(o,h)+i+r*Math.sin(s)]);return c.push([e+n*Math.cos(a),i+r*Math.sin(a)]),c.push([e+n*Math.cos(a),i+r*Math.sin(a)]),Jv(c,null,h)}function em(t,e,i,n,r,s,a,o){const h=[],l=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3];let c=[0,0];const u=o.disableMultiStroke?1:2,d=o.preserveVertices;for(let p=0;p<u;p++)0===p?h.push({op:"move",data:[a[0],a[1]]}):h.push({op:"move",data:[a[0]+(d?0:$v(l[0],o)),a[1]+(d?0:$v(l[0],o))]}),c=d?[r,s]:[r+$v(l[p],o),s+$v(l[p],o)],h.push({op:"bcurveTo",data:[t+$v(l[p],o),e+$v(l[p],o),i+$v(l[p],o),n+$v(l[p],o),c[0],c[1]]});return h}function im(t){return[...t]}function nm(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function rm(t,e,i){const n=nm(e,i);if(0===n)return nm(t,e);let r=((t[0]-e[0])*(i[0]-e[0])+(t[1]-e[1])*(i[1]-e[1]))/n;return r=Math.max(0,Math.min(1,r)),nm(t,sm(e,i,r))}function sm(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i]}function am(t,e,i,n){const r=n||[];if(function(t,e){const i=t[e+0],n=t[e+1],r=t[e+2],s=t[e+3];let a=3*n[0]-2*i[0]-s[0];a*=a;let o=3*n[1]-2*i[1]-s[1];o*=o;let h=3*r[0]-2*s[0]-i[0];h*=h;let l=3*r[1]-2*s[1]-i[1];return l*=l,a<h&&(a=h),o<l&&(o=l),a+o}(t,e)<i){const i=t[e+0];r.length?(s=r[r.length-1],a=i,Math.sqrt(nm(s,a))>1&&r.push(i)):r.push(i),r.push(t[e+3])}else{const n=.5,s=t[e+0],a=t[e+1],o=t[e+2],h=t[e+3],l=sm(s,a,n),c=sm(a,o,n),u=sm(o,h,n),d=sm(l,c,n),p=sm(c,u,n),f=sm(d,p,n);am([s,l,d,f],0,i,r),am([f,p,u,h],0,i,r)}var s,a;return r}function om(t,e){return hm(t,0,t.length,e)}function hm(t,e,i,n,r){const s=r||[],a=t[e],o=t[i-1];let h=0,l=1;for(let n=e+1;n<i-1;++n){const e=rm(t[n],a,o);e>h&&(h=e,l=n)}return Math.sqrt(h)>n?(hm(t,e,l+1,n,s),hm(t,l,i,n,s)):(s.length||s.push(a),s.push(o)),s}function lm(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15,i=arguments.length>2?arguments[2]:void 0;const n=[],r=(t.length-1)/3;for(let i=0;i<r;i++)am(t,3*i,e,n);return i&&i>0?hm(n,0,n.length,i):n}const cm="none";class um{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,e,i){return{shape:t,sets:e||[],options:i||this.defaultOptions}}line(t,e,i,n,r){const s=this._o(r);return this._d("line",[Wv(t,e,i,n,s)],s)}rectangle(t,e,i,n,r){const s=this._o(r),a=[],o=function(t,e,i,n,r){return function(t,e){return Nv(t,!0,e)}([[t,e],[t+i,e],[t+i,e+n],[t,e+n]],r)}(t,e,i,n,s);if(s.fill){const r=[[t,e],[t+i,e],[t+i,e+n],[t,e+n]];"solid"===s.fillStyle?a.push(Hv([r],s)):a.push(Vv([r],s))}return s.stroke!==cm&&a.push(o),this._d("rectangle",a,s)}ellipse(t,e,i,n,r){const s=this._o(r),a=[],o=Gv(i,n,s),h=Fv(t,e,s,o);if(s.fill)if("solid"===s.fillStyle){const i=Fv(t,e,s,o).opset;i.type="fillPath",a.push(i)}else a.push(Vv([h.estimatedPoints],s));return s.stroke!==cm&&a.push(h.opset),this._d("ellipse",a,s)}circle(t,e,i,n){const r=this.ellipse(t,e,i,i,n);return r.shape="circle",r}linearPath(t,e){const i=this._o(e);return this._d("linearPath",[Nv(t,!1,i)],i)}arc(t,e,i,n,r,s){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0;const h=this._o(o),l=[],c=zv(t,e,i,n,r,s,a,!0,h);if(a&&h.fill)if("solid"===h.fillStyle){const a=Object.assign({},h);a.disableMultiStroke=!0;const o=zv(t,e,i,n,r,s,!0,!1,a);o.type="fillPath",l.push(o)}else l.push(function(t,e,i,n,r,s,a){const o=t,h=e;let l=Math.abs(i/2),c=Math.abs(n/2);l+=$v(.01*l,a),c+=$v(.01*c,a);let u=r,d=s;for(;u<0;)u+=2*Math.PI,d+=2*Math.PI;d-u>2*Math.PI&&(u=0,d=2*Math.PI);const p=(d-u)/a.curveStepCount,f=[];for(let t=u;t<=d;t+=p)f.push([o+l*Math.cos(t),h+c*Math.sin(t)]);return f.push([o+l*Math.cos(d),h+c*Math.sin(d)]),f.push([o,h]),Vv([f],a)}(t,e,i,n,r,s,h));return h.stroke!==cm&&l.push(c),this._d("arc",l,h)}curve(t,e){const i=this._o(e),n=[],r=function(t,e){let i=Zv(t,1*(1+.2*e.roughness),e);if(!e.disableMultiStroke){const n=Zv(t,1.5*(1+.22*e.roughness),function(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}(e));i=i.concat(n)}return{type:"path",ops:i}}(t,i);if(i.fill&&i.fill!==cm&&t.length>=3){const e=lm(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=t.length;if(i<3)throw new Error("A curve must have at least three points.");const n=[];if(3===i)n.push(im(t[0]),im(t[1]),im(t[2]),im(t[2]));else{const i=[];i.push(t[0],t[0]);for(let e=1;e<t.length;e++)i.push(t[e]),e===t.length-1&&i.push(t[e]);const r=[],s=1-e;n.push(im(i[0]));for(let t=1;t+2<i.length;t++){const e=i[t];r[0]=[e[0],e[1]],r[1]=[e[0]+(s*i[t+1][0]-s*i[t-1][0])/6,e[1]+(s*i[t+1][1]-s*i[t-1][1])/6],r[2]=[i[t+1][0]+(s*i[t][0]-s*i[t+2][0])/6,i[t+1][1]+(s*i[t][1]-s*i[t+2][1])/6],r[3]=[i[t+1][0],i[t+1][1]],n.push(r[1],r[2],r[3])}}return n}(t),10,(1+i.roughness)/2);"solid"===i.fillStyle?n.push(Hv([e],i)):n.push(Vv([e],i))}return i.stroke!==cm&&n.push(r),this._d("curve",n,i)}polygon(t,e){const i=this._o(e),n=[],r=Nv(t,!0,i);return i.fill&&("solid"===i.fillStyle?n.push(Hv([t],i)):n.push(Vv([t],i))),i.stroke!==cm&&n.push(r),this._d("polygon",n,i)}path(t,e){const i=this._o(e),n=[];if(!t)return this._d("path",n,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const r=i.fill&&"transparent"!==i.fill&&i.fill!==cm,s=i.stroke!==cm,a=!!(i.simplification&&i.simplification<1),o=function(t,e,i){const n=Iv(Lv(Ov(t))),r=[];let s=[],a=[0,0],o=[];const h=()=>{o.length>=4&&s.push(...lm(o,1)),o=[]},l=()=>{h(),s.length&&(r.push(s),s=[])};for(const{key:t,data:e}of n)switch(t){case"M":l(),a=[e[0],e[1]],s.push(a);break;case"L":h(),s.push([e[0],e[1]]);break;case"C":if(!o.length){const t=s.length?s[s.length-1]:a;o.push([t[0],t[1]])}o.push([e[0],e[1]]),o.push([e[2],e[3]]),o.push([e[4],e[5]]);break;case"Z":h(),s.push([a[0],a[1]])}if(l(),!i)return r;const c=[];for(const t of r){const e=om(t,i);e.length&&c.push(e)}return c}(t,0,a?4-4*i.simplification:(1+i.roughness)/2);return r&&("solid"===i.fillStyle?n.push(Hv(o,i)):n.push(Vv(o,i))),s&&(a?o.forEach((t=>{n.push(Nv(t,!1,i))})):n.push(function(t,e){const i=Iv(Lv(Ov(t))),n=[];let r=[0,0],s=[0,0];for(const{key:t,data:a}of i)switch(t){case"M":{const t=1*(e.maxRandomnessOffset||0),i=e.preserveVertices;n.push({op:"move",data:a.map((n=>n+(i?0:$v(t,e))))}),s=[a[0],a[1]],r=[a[0],a[1]];break}case"L":n.push(...qv(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[t,i,r,o,h,l]=a;n.push(...em(t,i,r,o,h,l,s,e)),s=[h,l];break}case"Z":n.push(...qv(s[0],s[1],r[0],r[1],e)),s=[r[0],r[1]]}return{type:"path",ops:n}}(t,i))),this._d("path",n,i)}opsToPath(t,e){let i="";for(const n of t.ops){const t="number"==typeof e&&e>=0?n.data.map((t=>+t.toFixed(e))):n.data;switch(n.op){case"move":i+=`M${t[0]} ${t[1]} `;break;case"bcurveTo":i+=`C${t[0]} ${t[1]}, ${t[2]} ${t[3]}, ${t[4]} ${t[5]} `;break;case"lineTo":i+=`L${t[0]} ${t[1]} `}}return i.trim()}toPaths(t){const e=t.sets||[],i=t.options||this.defaultOptions,n=[];for(const t of e){let e=null;switch(t.type){case"path":e={d:this.opsToPath(t),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:cm};break;case"fillPath":e={d:this.opsToPath(t),stroke:cm,strokeWidth:0,fill:i.fill||cm};break;case"fillSketch":e=this.fillSketch(t,i)}e&&n.push(e)}return n}fillSketch(t,e){let i=e.fillWeight;return i<0&&(i=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||cm,strokeWidth:i,fill:cm}}}class dm{constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new um(e)}draw(t){const e=t.sets||[],i=t.options||this.getDefaultOptions(),n=this.ctx,r=t.options.fixedDecimalPlaceDigits;for(const s of e)switch(s.type){case"path":n.save(),n.strokeStyle="none"===i.stroke?"transparent":i.stroke,n.lineWidth=i.strokeWidth,i.strokeLineDash&&n.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(n.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(n,s,r),n.restore();break;case"fillPath":{n.save(),n.fillStyle=i.fill||"";const e="curve"===t.shape||"polygon"===t.shape||"path"===t.shape?"evenodd":"nonzero";this._drawToContext(n,s,r,e),n.restore();break}case"fillSketch":this.fillSketch(n,s,i)}}fillSketch(t,e,i){let n=i.fillWeight;n<0&&(n=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=n,this._drawToContext(t,e,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"nonzero";t.beginPath();for(const n of e.ops){const e="number"==typeof i&&i>=0?n.data.map((t=>+t.toFixed(i))):n.data;switch(n.op){case"move":t.moveTo(e[0],e[1]);break;case"bcurveTo":t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]);break;case"lineTo":t.lineTo(e[0],e[1])}}"fillPath"===e.type?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,e,i,n,r){const s=this.gen.line(t,e,i,n,r);return this.draw(s),s}rectangle(t,e,i,n,r){const s=this.gen.rectangle(t,e,i,n,r);return this.draw(s),s}ellipse(t,e,i,n,r){const s=this.gen.ellipse(t,e,i,n,r);return this.draw(s),s}circle(t,e,i,n){const r=this.gen.circle(t,e,i,n);return this.draw(r),r}linearPath(t,e){const i=this.gen.linearPath(t,e);return this.draw(i),i}polygon(t,e){const i=this.gen.polygon(t,e);return this.draw(i),i}arc(t,e,i,n,r,s){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0;const h=this.gen.arc(t,e,i,n,r,s,a,o);return this.draw(h),h}curve(t,e){const i=this.gen.curve(t,e);return this.draw(i),i}path(t,e){const i=this.gen.path(t,e);return this.draw(i),i}}var pm=(t,e)=>new dm(t,e);const fm={maxRandomnessOffset:3,roughness:1,bowing:1,curveFitting:.95,curveTightness:void 0,curveStepCount:9,fillStyle:"hachure",fillWeight:void 0,hachureAngle:60,hachureGap:6,simplification:0,dashOffset:void 0,dashGap:void 0,zigzagOffset:void 0,seed:1,fillLineDash:void 0,fillLineDashOffset:void 0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!0,fixedDecimalPlaceDigits:void 0};class gm{drawShape(t,e,i,n,r,s,a,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,i,n,r,s,a,o)}}var vm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},mm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ym=function(t,e){return function(i,n){e(i,n,t)}};let bm=class extends gm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="arc",this.numberType=io}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=pm(s);r.highPerformanceSave();const o=t.getGraphicTheme();let{x:h=o.x,y:l=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=o.dx,dy:i=o.dy}=t.attribute;h+=e,l+=i,r.setTransformForCurrent()}else h=0,l=0,r.transformFromMatrix(t.transMatrix,!0);const c=new Ui,{fill:u=o.fill,stroke:d=o.stroke,lineWidth:p=o.lineWidth,outerRadius:f=o.outerRadius,innerRadius:g=o.innerRadius,maxRandomnessOffset:v=fm.maxRandomnessOffset,roughness:m=fm.roughness,bowing:y=fm.bowing,curveFitting:b=fm.curveFitting,curveTightness:x=fm.curveTightness,curveStepCount:w=fm.curveStepCount,fillStyle:S=fm.fillStyle,fillWeight:A=fm.fillWeight,hachureAngle:T=fm.hachureAngle,hachureGap:C=fm.hachureGap,simplification:_=fm.simplification,dashOffset:B=fm.dashOffset,dashGap:P=fm.dashGap,zigzagOffset:R=fm.zigzagOffset,seed:M=fm.seed,fillLineDash:E=fm.fillLineDash,fillLineDashOffset:k=fm.fillLineDashOffset,disableMultiStroke:O=fm.disableMultiStroke,disableMultiStrokeFill:L=fm.disableMultiStrokeFill,preserveVertices:I=fm.preserveVertices,fixedDecimalPlaceDigits:D=fm.fixedDecimalPlaceDigits}=t.attribute;qo(t,c,h,l,f,g),a.path(c.toString(),{fill:u||void 0,stroke:d||void 0,strokeWidth:p,maxRandomnessOffset:v,roughness:m,bowing:y,curveFitting:b,curveTightness:x,curveStepCount:w,fillStyle:S,fillWeight:A,hachureAngle:T,hachureGap:C,simplification:_,dashOffset:B,dashGap:P,zigzagOffset:R,seed:M,fillLineDash:E,fillLineDashOffset:k,disableMultiStroke:O,disableMultiStrokeFill:L,preserveVertices:I,fixedDecimalPlaceDigits:D}),r.highPerformanceRestore()}};bm=vm([g(),ym(0,p(t.DefaultCanvasArcRender)),mm("design:paramtypes",[Object])],bm);var xm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let wm=class extends t.DefaultCanvasAreaRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,f){if(f)return super.drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,f);t.highPerformanceSave();const g=t.canvas.nativeCanvas,v=pm(g,{}),m=new Ui;kl(m,e,h,{offsetX:l,offsetY:c});const{maxRandomnessOffset:y=fm.maxRandomnessOffset,roughness:b=fm.roughness,bowing:x=fm.bowing,curveFitting:w=fm.curveFitting,curveTightness:S=fm.curveTightness,curveStepCount:A=fm.curveStepCount,fillStyle:T=fm.fillStyle,fillWeight:C=fm.fillWeight,hachureAngle:_=fm.hachureAngle,hachureGap:B=fm.hachureGap,simplification:P=fm.simplification,dashOffset:R=fm.dashOffset,dashGap:M=fm.dashGap,zigzagOffset:E=fm.zigzagOffset,seed:k=fm.seed,fillLineDash:O=fm.fillLineDash,fillLineDashOffset:L=fm.fillLineDashOffset,disableMultiStroke:I=fm.disableMultiStroke,disableMultiStrokeFill:D=fm.disableMultiStrokeFill,preserveVertices:j=fm.preserveVertices,fixedDecimalPlaceDigits:U=fm.fixedDecimalPlaceDigits}=a;let{fill:W,stroke:N,lineWidth:G}=a;return Array.isArray(o)?o.forEach((t=>{W=null!=W?W:t.fill,N=null!=N?N:t.stroke,G=null!=G?G:t.lineWidth})):(W=null!=W?W:o.fill,N=null!=N?N:o.stroke,G=null!=G?G:o.lineWidth),v.path(m.toString(),{fill:i?W:void 0,strokeWidth:G,maxRandomnessOffset:y,roughness:b,bowing:x,curveFitting:w,curveTightness:S,curveStepCount:A,fillStyle:T,fillWeight:C,hachureAngle:_,hachureGap:B,simplification:P,dashOffset:R,dashGap:M,zigzagOffset:E,seed:k,fillLineDash:O,fillLineDashOffset:L,disableMultiStroke:I,disableMultiStrokeFill:D,preserveVertices:j,fixedDecimalPlaceDigits:U}),t.highPerformanceRestore(),!1}};wm=xm([g()],wm);var Sm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tm=function(t,e){return function(i,n){e(i,n,t)}};let Cm=class extends gm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="circle",this.numberType=so}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=pm(s,{}),o=t.getGraphicTheme();let{x:h=o.x,y:l=o.y}=t.attribute;t.transMatrix.onlyTranslate()?r.onlyTranslate()||r.clearMatrix():(h=0,l=0,r.transformFromMatrix(t.transMatrix,!0));const{radius:c=o.radius,fill:u=o.fill,stroke:d=o.stroke,lineWidth:p=o.lineWidth}=t.attribute;a.circle(h,l,c,{fill:u||void 0,stroke:d||void 0,strokeWidth:p,fillStyle:"zigzag",roughness:.5})}};Cm=Sm([g(),Tm(0,p(t.DefaultCanvasCircleRender)),Am("design:paramtypes",[Object])],Cm);var _m=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Bm=class extends t.DefaultCanvasLineRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,f){if(p||f)return super.drawSegmentItem(t,e,i,n,r,s,a,o,h,l,c,u,d,p,f);t.highPerformanceSave();const g=t.canvas.nativeCanvas,v=pm(g,{}),m=new Ui;Pl(t.camera?t:t.nativeContext,e,h,l,{offsetX:c,offsetY:u});const{maxRandomnessOffset:y=fm.maxRandomnessOffset,roughness:b=fm.roughness,bowing:x=fm.bowing,curveFitting:w=fm.curveFitting,curveTightness:S=fm.curveTightness,curveStepCount:A=fm.curveStepCount,fillStyle:T=fm.fillStyle,fillWeight:C=fm.fillWeight,hachureAngle:_=fm.hachureAngle,hachureGap:B=fm.hachureGap,simplification:P=fm.simplification,dashOffset:R=fm.dashOffset,dashGap:M=fm.dashGap,zigzagOffset:E=fm.zigzagOffset,seed:k=fm.seed,fillLineDash:O=fm.fillLineDash,fillLineDashOffset:L=fm.fillLineDashOffset,disableMultiStroke:I=fm.disableMultiStroke,disableMultiStrokeFill:D=fm.disableMultiStrokeFill,preserveVertices:j=fm.preserveVertices,fixedDecimalPlaceDigits:U=fm.fixedDecimalPlaceDigits}=a;let{fill:W,stroke:N,lineWidth:G}=a;return Array.isArray(o)?o.forEach((t=>{W=null!=W?W:t.fill,N=null!=N?N:t.stroke,G=null!=G?G:t.lineWidth})):(W=null!=W?W:o.fill,N=null!=N?N:o.stroke,G=null!=G?G:o.lineWidth),v.path(m.toString(),{fill:i?W:void 0,stroke:n?N:void 0,strokeWidth:G,maxRandomnessOffset:y,roughness:b,bowing:x,curveFitting:w,curveTightness:S,curveStepCount:A,fillStyle:T,fillWeight:C,hachureAngle:_,hachureGap:B,simplification:P,dashOffset:R,dashGap:M,zigzagOffset:E,seed:k,fillLineDash:O,fillLineDashOffset:L,disableMultiStroke:I,disableMultiStrokeFill:D,preserveVertices:j,fixedDecimalPlaceDigits:U}),t.highPerformanceRestore(),!1}};Bm=_m([g()],Bm);var Pm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mm=function(t,e){return function(i,n){e(i,n,t)}};let Em=class extends gm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="path",this.numberType=co}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=pm(s,{});r.highPerformanceSave();const o=t.getGraphicTheme();r.transformFromMatrix(t.transMatrix,!0);const{fill:h=o.fill,stroke:l=o.stroke,lineWidth:c=o.lineWidth,path:u=o.path,maxRandomnessOffset:d=fm.maxRandomnessOffset,roughness:p=fm.roughness,bowing:f=fm.bowing,curveFitting:g=fm.curveFitting,curveTightness:v=fm.curveTightness,curveStepCount:m=fm.curveStepCount,fillStyle:y=fm.fillStyle,fillWeight:b=fm.fillWeight,hachureAngle:x=fm.hachureAngle,hachureGap:w=fm.hachureGap,simplification:S=fm.simplification,dashOffset:A=fm.dashOffset,dashGap:T=fm.dashGap,zigzagOffset:C=fm.zigzagOffset,seed:_=fm.seed,fillLineDash:B=fm.fillLineDash,fillLineDashOffset:P=fm.fillLineDashOffset,disableMultiStroke:R=fm.disableMultiStroke,disableMultiStrokeFill:M=fm.disableMultiStrokeFill,preserveVertices:E=fm.preserveVertices,fixedDecimalPlaceDigits:k=fm.fixedDecimalPlaceDigits}=t.attribute;"string"==typeof u&&a.path(u,{fill:h||void 0,stroke:l||void 0,strokeWidth:c,maxRandomnessOffset:d,roughness:p,bowing:f,curveFitting:g,curveTightness:v,curveStepCount:m,fillStyle:y,fillWeight:b,hachureAngle:x,hachureGap:w,simplification:S,dashOffset:A,dashGap:T,zigzagOffset:C,seed:_,fillLineDash:B,fillLineDashOffset:P,disableMultiStroke:R,disableMultiStrokeFill:M,preserveVertices:E,fixedDecimalPlaceDigits:k}),r.highPerformanceRestore()}};Em=Pm([g(),Mm(0,p(t.DefaultCanvasPathRender)),Rm("design:paramtypes",[Object])],Em);var km=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lm=function(t,e){return function(i,n){e(i,n,t)}};let Im=class extends gm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="rect",this.numberType=fo}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=pm(s);r.highPerformanceSave();const o=t.getGraphicTheme();let{x:h=o.x,y:l=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=o.dx,dy:i=o.dy}=t.attribute;h+=e,l+=i,r.setTransformForCurrent()}else h=0,l=0,r.transformFromMatrix(t.transMatrix,!0);const{fill:c=o.fill,stroke:u=o.stroke,fillColor:d=o.fill,strokeColor:p=o.stroke,x1:f,y1:g,lineWidth:v=o.lineWidth,maxRandomnessOffset:m=fm.maxRandomnessOffset,roughness:y=fm.roughness,bowing:b=fm.bowing,curveFitting:x=fm.curveFitting,curveTightness:w=fm.curveTightness,curveStepCount:S=fm.curveStepCount,fillStyle:A=fm.fillStyle,fillWeight:T=fm.fillWeight,hachureAngle:C=fm.hachureAngle,hachureGap:_=fm.hachureGap,simplification:B=fm.simplification,dashOffset:P=fm.dashOffset,dashGap:R=fm.dashGap,zigzagOffset:M=fm.zigzagOffset,seed:E=fm.seed,fillLineDash:k=fm.fillLineDash,fillLineDashOffset:O=fm.fillLineDashOffset,disableMultiStroke:L=fm.disableMultiStroke,disableMultiStrokeFill:I=fm.disableMultiStrokeFill,preserveVertices:D=fm.preserveVertices,fixedDecimalPlaceDigits:j=fm.fixedDecimalPlaceDigits}=t.attribute;let{width:U=o.width,height:W=o.height}=t.attribute;U=(null!=U?U:f-h)||0,W=(null!=W?W:g-l)||0,a.rectangle(h,l,U,W,{fill:c?d:void 0,stroke:u?p:void 0,strokeWidth:v,maxRandomnessOffset:m,roughness:y,bowing:b,curveFitting:x,curveTightness:w,curveStepCount:S,fillStyle:A,fillWeight:T,hachureAngle:C,hachureGap:_,simplification:B,dashOffset:P,dashGap:R,zigzagOffset:M,seed:E,fillLineDash:k,fillLineDashOffset:O,disableMultiStroke:L,disableMultiStrokeFill:I,preserveVertices:D,fixedDecimalPlaceDigits:j}),r.highPerformanceRestore()}};Im=km([g(),Lm(0,p(t.DefaultCanvasRectRender)),Om("design:paramtypes",[Object])],Im);var Dm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},jm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,n){e(i,n,t)}};let Wm=class extends Nh{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=mo,this.style="rough"}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=pm(s);r.highPerformanceSave();const o=t.getGraphicTheme(),h=this.transform(t,o,r),{x:l,y:c,z:u,lastModelMatrix:d}=h,p=t.getParsedPath();if(!p)return;const{fill:f=o.fill,stroke:g=o.stroke,fillColor:v=o.fill,strokeColor:m=o.stroke,size:y=o.size,lineWidth:b=o.lineWidth,maxRandomnessOffset:x=fm.maxRandomnessOffset,roughness:w=fm.roughness,bowing:S=fm.bowing,curveFitting:A=fm.curveFitting,curveTightness:T=fm.curveTightness,curveStepCount:C=fm.curveStepCount,fillStyle:_=fm.fillStyle,fillWeight:B=fm.fillWeight,hachureAngle:P=fm.hachureAngle,hachureGap:R=fm.hachureGap,simplification:M=fm.simplification,dashOffset:E=fm.dashOffset,dashGap:k=fm.dashGap,zigzagOffset:O=fm.zigzagOffset,seed:L=fm.seed,fillLineDash:I=fm.fillLineDash,fillLineDashOffset:D=fm.fillLineDashOffset,disableMultiStroke:j=fm.disableMultiStroke,disableMultiStrokeFill:U=fm.disableMultiStrokeFill,preserveVertices:W=fm.preserveVertices,fixedDecimalPlaceDigits:N=fm.fixedDecimalPlaceDigits}=t.attribute;let G="";if(p.drawToSvgPath)G=p.drawToSvgPath(y,l,c);else{const t=new Ui;p.draw(t,y,l,c)&&t.closePath(),G=t.toString()}a.path(G,{fill:f?v:void 0,stroke:g?m:void 0,strokeWidth:b,maxRandomnessOffset:x,roughness:w,bowing:S,curveFitting:A,curveTightness:T,curveStepCount:C,fillStyle:_,fillWeight:B,hachureAngle:P,hachureGap:R,simplification:M,dashOffset:E,dashGap:k,zigzagOffset:O,seed:L,fillLineDash:I,fillLineDashOffset:D,disableMultiStroke:j,disableMultiStrokeFill:U,preserveVertices:W,fixedDecimalPlaceDigits:N}),r.highPerformanceRestore()}drawShape(t,e,i,n,r,s,a,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,i,n,r,s,a,o)}};Wm=Dm([g(),Um(0,p(t.DefaultCanvasSymbolRender)),jm("design:paramtypes",[Object])],Wm);var Nm=new i((t=>{t(Cm).toSelf().inSingletonScope(),t(Bc).to(Cm),t(Im).toSelf().inSingletonScope(),t(Bc).to(Im),t(Em).toSelf().inSingletonScope(),t(Bc).to(Em),t(Wm).toSelf().inSingletonScope(),t(Bc).to(Wm),t(Bm).toSelf().inSingletonScope(),t(Bc).to(Bm),t(wm).toSelf().inSingletonScope(),t(Bc).to(wm),t(bm).toSelf().inSingletonScope(),t(Bc).to(bm)}));const Gm=Symbol.for("MathPickerContribution"),Fm=Symbol.for("MathArcPicker"),zm=Symbol.for("MathAreaPicker"),Hm=Symbol.for("MathCirclePicker"),Vm=Symbol.for("MathImagePicker"),Ym=Symbol.for("MathLinePicker"),Xm=Symbol.for("MathPathPicker"),$m=Symbol.for("MathRectPicker"),qm=Symbol.for("MathSymbolPicker"),Km=Symbol.for("MathTextPicker"),Zm=Symbol.for("MathPolygonPicker"),Jm=Symbol.for("MathGlyphPicker"),Qm=Symbol.for("CanvasArcPicker"),ty=Symbol.for("CanvasArc3dPicker"),ey=Symbol.for("CanvasAreaPicker"),iy=Symbol.for("CanvasCirclePicker"),ny=Symbol.for("CanvasImagePicker"),ry=Symbol.for("CanvasLinePicker"),sy=Symbol.for("CanvasPathPicker"),ay=Symbol.for("CanvasRectPicker"),oy=Symbol.for("CanvasRect3dPicker"),hy=Symbol.for("CanvasSymbolPicker"),ly=Symbol.for("CanvasTextPicker"),cy=Symbol.for("CanvasPolygonPicker"),uy=Symbol.for("CanvasPyramid3dPicker"),dy=Symbol.for("CanvasRichTextPicker"),py=Symbol.for("CanvasGlyphPicker"),fy=Symbol.for("CanvasGroupPicker"),gy=Symbol.for("CanvasPickerContribution"),vy={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerUpOutside:"pointerupoutside",onPointerTap:"pointertap",onPointerOver:"pointerover",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerOut:"pointerout",onMouseDown:"mousedown",onMouseUp:"mouseup",onMouseUpOutside:"mouseupoutside",onMouseMove:"mousemove",onMouseOver:"mouseover",onMouseOut:"mouseout",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onPinch:"pinch",onPinchStart:"pinchstart",onPinchEnd:"pinchend",onPan:"pan",onPanStart:"panstart",onPanEnd:"panend",onDrag:"drag",onDragStart:"dragstart",onDragEnter:"dragenter",onDragLeave:"dragleave",onDragOver:"dragover",onDragEnd:"dragend",onRightDown:"rightdown",onRightUp:"rightup",onRightUpOutside:"rightupoutside",onTouchStart:"touchstart",onTouchEnd:"touchend",onTouchEndOutside:"touchendoutside",onTouchMove:"touchmove",onTouchCancel:"touchcancel",onPress:"press",onPressUp:"pressup",onPressEnd:"pressend",onSwipe:"swipe",onDrop:"drop",onWeel:"wheel",onClick:"click",onDblClick:"dblclick"},my=Object.keys(vy);function yy(t){return Jl.richtext(t?t.attribute:{})}yy.Text=function(t){return Object.assign({type:"rich/text"},t)},yy.Image=function(t){return Object.assign({type:"rich/image"},t)};var by=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i};function xy(t,e){if(rt(t))return t.forEach((t=>xy(t,e)));e.push(t)}const wy=_o;function Sy(t){if(!t||!t.$$typeof)return t;const e=t.type,{attribute:i,children:n,stateProxy:r,id:s,name:a}=t.props,o=e({attribute:i}),h=function(t,e,i){let n,r=!1;switch(t.type){case"richtext":break;case"rich/text":n=t.attribute||{},i&&(n.text=i),t.attribute=n;break;case"rich/image":n=t.attribute||{};break;default:r=!0}return r?Object.keys(e).forEach((i=>{const n=vy[i];n&&t.on(n,e[i])})):"richtext"===t.type&&(t.attribute.textConfig=i.map((t=>Sy(t))).filter((t=>t))),n}(o,t.props,n);return h||(r&&(o.stateProxy=r),o.id=s,o.name=a,Ay(n,o),o)}function Ay(t,e){rt(t)?t.forEach((t=>{if(rt(t))Ay(t,e);else{const i=Sy(t);i&&i.type&&e.add(i)}})):t&&e.add(Sy(t))}const Ty=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},Cy=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};var _y=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},By=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Py=[0,0,0];let Ry=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},zi),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Vi),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Yi),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new le(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new le(1,0,0,1,0,0),this._clearMatrix=new le(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&bt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new le(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return kh.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(kh.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(kh.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*r,o*s),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,r,s),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,r,s,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,r,s,a,o)=>{if(o)for(;i>e;)i-=Pt;else for(;i<e;)i+=Pt;const h=Ct/3*(i>e?1:-1);let l=e,c=l;for(;c!==i;){c=h>0?Math.min(c+h,i):Math.max(c+h,i);const e=Math.abs(c-l),o=4*Math.tan(e/4)/3,u=c<l?-1:1,d=Math.cos(l),p=Math.sin(l),f=Math.cos(c),g=Math.sin(c),v=d*s+n,m=p*a+r,y=f*s+n,b=g*a+r,x=s*o*u,w=a*o*u;t.push([v-x*p,m+w*d,y+x*g,b-w*f,y,b]),l=c}})(o,n,r,t,e,i,i,s);for(let t=0;t<o.length;++t){const e=o[t];this.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5],a)}}else this.nativeContext.arc(t,e,Math.max(0,i),n,r,s)}arcTo(t,e,i,n,r){this.nativeContext.arcTo(t,e,i,n,r)}bezierCurveTo(t,e,i,n,r,s,a){if(a=a||0,this.camera){let o=a,h=a;this.modelMatrix&&(_h(Py,[t,e,a],this.modelMatrix),t=Py[0],e=Py[1],o=Py[2],_h(Py,[i,n,a],this.modelMatrix),i=Py[0],n=Py[1],h=Py[2],_h(Py,[r,s,a],this.modelMatrix),r=Py[0],s=Py[1],a=Py[2]);let l=this.camera.vp(r,s,a);r=l.x,s=l.y,l=this.camera.vp(t,e,o),t=l.x,e=l.y,l=this.camera.vp(i,n,h),i=l.x,n=l.y}this.nativeContext.bezierCurveTo(t,e,i,n,r,s)}closePath(){this.nativeContext.closePath()}ellipse(t,e,i,n,r,s,a,o){null==o?this.nativeContext.ellipse(t,e,i,n,r,s,a):this.nativeContext.ellipse(t,e,i,n,r,s,a,o)}lineTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(_h(Py,[t,e,i],this.modelMatrix),t=Py[0],e=Py[1],i=Py[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.lineTo(t,e)}moveTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(_h(Py,[t,e,i],this.modelMatrix),t=Py[0],e=Py[1],i=Py[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.moveTo(t,e)}quadraticCurveTo(t,e,i,n,r){if(r=r||0,this.camera){let s=r;this.modelMatrix&&(_h(Py,[t,e,r],this.modelMatrix),t=Py[0],e=Py[1],s=Py[2],_h(Py,[i,n,r],this.modelMatrix),i=Py[0],n=Py[1],r=Py[2]);let a=this.camera.vp(i,n,r);i=a.x,n=a.y,a=this.camera.vp(t,e,s),t=a.x,e=a.y}this.nativeContext.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n,r){r=r||0,this.camera?(this.moveTo(t,e,r),this.lineTo(t+i,e,r),this.lineTo(t+i,e+n,r),this.lineTo(t,e+n,r),this.closePath()):this.nativeContext.rect(t,e,i,n)}createImageData(){const t=arguments;return 2===t.length?this.nativeContext.createImageData(t[0],t[1]):1===t.length?this.nativeContext.createImageData(t[0]):null}createLinearGradient(t,e,i,n){return isFinite(t+e+i+n)||(t=0,e=0,i=0,n=0),this.nativeContext.createLinearGradient(t,e,i,n)}createPattern(t,e){return 0===t.width||0===t.height?null:this.nativeContext.createPattern(t,e)}createRadialGradient(t,e,i,n,r,s){return this.nativeContext.createRadialGradient(t,e,i,n,r,s)}createConicGradient(t,e,i,n){let r,s=!1;const a=this;return{stops:[],addColorStop(t,e){this.stops.push([t,e]),s=!0},GetPattern(o,h,l){return s&&(l||(l=n-i),r=th(a,this.stops,t,e,l,i,n,o,h),s=!1),r}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(_h(Py,[t,e,i],this.modelMatrix),t=Py[0],e=Py[1],i=Py[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(_h(Py,[t,e,i],this.modelMatrix),t=Py[0],e=Py[1],i=Py[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(_h(Py,[e,i,n],this.modelMatrix),e=Py[0],i=Py[1],n=Py[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gn.global.measureTextMethod;var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=gn.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const r=null!==(i=this.fontFamily)&&void 0!==i?i:Yi.fontFamily,s=null!==(n=this.fontSize)&&void 0!==n?n:Yi.fontSize;return this.mathTextMeasure.textSpec.fontFamily===r&&this.mathTextMeasure.textSpec.fontSize===s||(this.mathTextMeasure.textSpec.fontFamily=r,this.mathTextMeasure.textSpec.fontSize=s,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(_h(Py,[e,i,n],this.modelMatrix),e=Py[0],i=Py[1],n=Py[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,r){if(Array.isArray(r)){if(r.length<=1)return this._setCommonStyle(t,e,i,n,r[0]);const s=Object.create(r[0]);return r.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setCommonStyle(t,e,i,n,s)}return this._setCommonStyle(t,e,i,n,r)}_setCommonStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.fillAttributes);const{fillOpacity:a=r.fillOpacity,opacity:o=r.opacity,fill:h=r.fill}=e;s.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(s.fillStyle=bn(this,h,t,i,n))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:r=i.opacity,shadowBlur:s=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:h=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;r<=1e-12||(s||o||h?(n.shadowBlur=s*this.dpr,n.shadowColor=a,n.shadowOffsetX=o*this.dpr,n.shadowOffsetY=h*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),l?(n.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),c?(n.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,n,r){if(Array.isArray(r)){if(r.length<=1)return this._setStrokeStyle(t,e,i,n,r[0]);const s=Object.create(r[0]);return r.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setStrokeStyle(t,e,i,n,s)}return this._setStrokeStyle(t,e,i,n,r)}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(s.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=r.lineWidth,stroke:o=r.stroke,lineJoin:h=r.lineJoin,lineDash:l=r.lineDash,lineCap:c=r.lineCap,miterLimit:u=r.miterLimit,keepStrokeScale:d=r.keepStrokeScale}=e;s.lineWidth=d?a:yn(this,a,this.dpr),s.strokeStyle=bn(this,o,t,i,n),s.lineJoin=h,l&&s.setLineDash(l),s.lineCap=c,s.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:r=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ne(t,e,r&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:s=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=s,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,r;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=ne(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,s.textBaseline=null!==(r=t.textBaseline)&&void 0!==r?r:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,r,s){this._clearMatrix.setValue(t,e,i,n,r,s)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>kh.free(t))),this.stack.length=0}};Ry.env="browser",Ry=_y([g(),By("design:paramtypes",[Object,Number])],Ry);var My=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ky=class extends Af{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=gn.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Ry(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:r=this._x,y:s=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,r,s,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,r){this.controled&&(t.style.width=`${n}px`,t.style.height=`${r}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Oy(t,e){return new i((i=>{i(Dn).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(jn).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}ky.env="browser",ky=My([g(),Ey("design:paramtypes",[Object])],ky);const Ly=Oy(ky,Ry);var Iy=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Dy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jy=function(t,e){return function(i,n){e(i,n,t)}};let Uy=class extends t.DefaultPickService{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=fr.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const s=this.InterceptorContributions[r];if(s.beforePickItem){const r=s.beforePickItem(t,this,e,n,{parentMatrix:i});if(r)return r}}const r=this.pickerMap.get(t.numberType);if(!r)return null;const s=r.contains(t,e,n),a=s?t:null,o={graphic:a,params:s};if(a)return o;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const s=this.InterceptorContributions[r];if(s.afterPickItem){const r=s.afterPickItem(t,this,e,n,{parentMatrix:i});if(r)return r}}return o}};Uy=Iy([g(),jy(0,p(k)),jy(0,v(gy)),jy(1,p(Gc)),jy(2,p(k)),jy(2,v(vp)),Dy("design:paramtypes",[Object,Object,Object])],Uy);var Wy=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Ny=class{constructor(){this.type="group",this.numberType=oo}contains(t,e,i){return!1}};Ny=Wy([g()],Ny);const Gy=new i(((t,e,i,n)=>{Gy.__vloaded||(Gy.__vloaded=!0,t(fy).to(Ny).inSingletonScope(),t(gy).toService(fy),L(t,gy))}));Gy.__vloaded=!1;var Fy=Gy;const zy=new i(((t,e,i,n)=>{i(Uy)||t(Uy).toSelf().inSingletonScope(),i(su)?n(su).toService(Uy):t(su).toService(Uy)}));function Hy(t){t.load(Fy),t.load(zy)}var Vy,Yy=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Xy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $y=Vy=class extends t.BaseWindowHandlerContribution{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Vy.idprefix}_${Vy.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=gn.global,this.viewBox=new oe,this.modelMatrix=new le(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Vy.GenerateCanvasId(),canvasControled:!0};this.canvas=new ky(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,r=t.height}let s=t.dpr;null==s&&(s=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new ky({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};$y.env="browser",$y.idprefix="visactor_window",$y.prefix_count=0,$y=Vy=Yy([g(),Xy("design:paramtypes",[])],$y);const qy=new i((t=>{t($y).toSelf(),t(yr).toDynamicValue((t=>t.container.get($y))).whenTargetNamed($y.env)}));var Ky=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Zy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Jy{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function Qy(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}t.BrowserEnvContribution=class extends t.BaseEnvContribution{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,n;let r=0,s=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};r=e.clientX||0,s=e.clientY||0,a=r,o=s}else r=t.clientX||0,s=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=r,i=s,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let h,l;return o&&(h=a.width/o.offsetWidth,l=a.height/o.offsetHeight),{x:(t-a.left)/(ot(h)?h:1),y:(i-a.top)/(ot(l)?l:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Jy(t)}return new oe}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:r}=e;return r&&(nt(r)?t.setAttribute("style",r):Object.keys(r).forEach((e=>{t.style[e]=r[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=nt(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return Qy(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Qy(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var i,n;const r=document.createElement("canvas");t.id&&(r.id=null!==(i=t.id)&&void 0!==i?i:e.GenAutoIncrementId().toString());const s=null!==(n=t.dpr)&&void 0!==n?n:window.devicePixelRatio;return t.width&&t.height&&(r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.width=t.width*s,r.height=t.height*s),r}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,r=t.offsetParent;for(;null!==r;)i+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{top:i,left:n}}},t.BrowserEnvContribution=Ky([g(),Zy("design:paramtypes",[])],t.BrowserEnvContribution);const tb=new i((e=>{tb.isBrowserBound||(tb.isBrowserBound=!0,e(t.BrowserEnvContribution).toSelf().inSingletonScope(),e(U).toService(t.BrowserEnvContribution))}));function eb(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];eb.__loaded||(eb.__loaded=!0,t.load(tb),t.load(Ly),t.load(qy),e&&Hy(t))}tb.isBrowserBound=!1,eb.__loaded=!1;var ib=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let nb=class extends Ry{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,n){return new Promise(((r,s)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){r(t)}})}catch(t){s(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};nb.env="feishu",nb=ib([g()],nb);var rb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},sb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ab=class extends Af{constructor(t){super(t)}init(){this._context=new nb(this,this._dpr)}release(){}};ab.env="feishu",ab=rb([g(),sb("design:paramtypes",[Object])],ab);const ob=Oy(ab,nb);var hb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},lb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cb=function(t,e){return function(i,n){e(i,n,t)}};let ub=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new ab(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new ab({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};ub.env="feishu",ub=hb([g(),cb(0,p(W)),lb("design:paramtypes",[Object])],ub);const db=new i((t=>{t(ub).toSelf(),t(yr).toDynamicValue((t=>t.container.get(ub))).whenTargetNamed(ub.env)}));var pb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},fb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gb=function(t,e){return function(i,n){e(i,n,t)}};let vb=class extends t.DefaultPickService{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(e,i){this.pickContext=new t.EmptyContext2d(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const r=this.pickerMap.get(t.numberType);if(!r)return null;const s=r.contains(t,e,n),a=s?t:null;return a?{graphic:a,params:s}:null}};vb=pb([g(),gb(0,p(k)),gb(0,v(Gm)),gb(1,p(k)),gb(1,v(vp)),fb("design:paramtypes",[Object,Object])],vb);const mb=new i((t=>{mb.__vloaded||(mb.__vloaded=!0,L(t,Gm))}));mb.__vloaded=!1;var yb=mb;class bb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getGraphicTheme();n.highPerformanceSave();let{x:s=r.x,y:a=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);s+=e.x,a+=e.y,n.setTransformForCurrent()}else s=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,s,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,r)=>{if(o)return!0;const s=i.lineWidth||r.lineWidth,a=i.pickStrokeBuffer||r.pickStrokeBuffer,h=i.keepStrokeScale||r.keepStrokeScale;return n.lineWidth=h?s+a:yn(n,s+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}}var xb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sb=function(t,e){return function(i,n){e(i,n,t)}};let Ab=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=io}};Ab=xb([g(),Sb(0,p(Ac)),wb("design:paramtypes",[Object])],Ab);let Tb=!1;const Cb=new i(((t,e,i,n)=>{Tb||(Tb=!0,t(Fm).to(Ab).inSingletonScope(),t(Gm).toService(Fm))}));var _b=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pb=function(t,e){return function(i,n){e(i,n,t)}};let Rb=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ro}};Rb=_b([g(),Pb(0,p(Cc)),Bb("design:paramtypes",[Object])],Rb);let Mb=!1;const Eb=new i(((t,e,i,n)=>{Mb||(Mb=!0,t(zm).to(Rb).inSingletonScope(),t(Gm).toService(zm))}));var kb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lb=function(t,e){return function(i,n){e(i,n,t)}};let Ib=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=so}};Ib=kb([g(),Lb(0,p(_c)),Ob("design:paramtypes",[Object])],Ib);let Db=!1;const jb=new i(((t,e,i,n)=>{Db||(Db=!0,t(Hm).to(Ib).inSingletonScope(),t(Gm).toService(Hm))}));class Ub{constructor(){this.type="glyph",this.numberType=ao}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=null==i?void 0:i.pickerService;if(r){let n=!1;return t.getSubGraphic().forEach((t=>{if(n)return;const s=r.pickItem(t,e,null,i);n=!(!s||!s.graphic)})),n}return!1}}var Wb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Nb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gb=function(t,e){return function(i,n){e(i,n,t)}};let Fb=class extends Ub{constructor(t){super(),this.canvasRenderer=t}};Fb=Wb([g(),Gb(0,p(Uc)),Nb("design:paramtypes",[Object])],Fb);let zb=!1;const Hb=new i(((t,e,i,n)=>{zb||(zb=!0,t(Jm).to(Fb).inSingletonScope(),t(Fb).toService(Jm))}));var Vb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Yb=class{constructor(){this.type="image",this.numberType=ho}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Yb=Vb([g()],Yb);let Xb=!1;const $b=new i(((t,e,i,n)=>{Xb||(Xb=!0,t(Vm).to(Yb).inSingletonScope(),t(Yb).toService(Vm))}));var qb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zb=function(t,e){return function(i,n){e(i,n,t)}};let Jb=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=lo}};Jb=qb([g(),Zb(0,p(Rc)),Kb("design:paramtypes",[Object])],Jb);let Qb=!1;const tx=new i(((t,e,i,n)=>{Qb||(Qb=!0,t(Ym).to(Jb).inSingletonScope(),t(Gm).toService(Ym))}));var ex=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ix=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nx=function(t,e){return function(i,n){e(i,n,t)}};let rx=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=uo}};rx=ex([g(),nx(0,p(Ec)),ix("design:paramtypes",[Object])],rx);let sx=!1;const ax=new i(((t,e,i,n)=>{sx||(sx=!0,t(Zm).to(rx).inSingletonScope(),t(Gm).toService(Zm))}));var ox=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lx=function(t,e){return function(i,n){e(i,n,t)}};let cx=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=co}};cx=ox([g(),lx(0,p(Mc)),hx("design:paramtypes",[Object])],cx);let ux=!1;const dx=new i(((t,e,i,n)=>{ux||(ux=!0,t(Xm).to(cx).inSingletonScope(),t(Gm).toService(Xm))})),px=new oe;class fx{constructor(){this.type="rect",this.numberType=fo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getGraphicTheme(),{cornerRadius:s=r.cornerRadius}=t.attribute;let{x:a=r.x,y:o=r.y}=t.attribute;n.highPerformanceSave();let h=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,h=!1,n.transformFromMatrix(t.transMatrix,!0);let l=!0;if(!h||t.shadowRoot||at(s,!0)&&0!==s||rt(s)&&s.some((t=>0!==t)))l=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!l||(l=t.isPointInPath(e.x,e.y),l)),((t,i,r)=>{if(l)return!0;const s=i.lineWidth||r.lineWidth,a=i.pickStrokeBuffer||r.pickStrokeBuffer,o=i.keepStrokeScale||r.keepStrokeScale;return n.lineWidth=o?s+a:yn(n,s+a,n.dpr),l=t.isPointInStroke(e.x,e.y),l}));else{const{fill:i=r.fill,stroke:n=r.stroke,lineWidth:s=r.lineWidth}=t.attribute;if(i)l=!0;else if(n){const i=t.AABBBounds;px.setValue(i.x1,i.y1,i.x2,i.y2),px.expand(-s/2),l=!px.containsPoint(e)}}return n.highPerformanceRestore(),l}}var gx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mx=function(t,e){return function(i,n){e(i,n,t)}};let yx=class extends fx{constructor(t){super(),this.canvasRenderer=t}};yx=gx([g(),mx(0,p(kc)),vx("design:paramtypes",[Object])],yx);let bx=!1;const xx=new i(((t,e,i,n)=>{bx||(bx=!0,t($m).to(yx).inSingletonScope(),t(Gm).toService($m))}));let Sx=!1;const Ax=new i(((t,e,i,n)=>{Sx||(Sx=!0,t(Vm).to(Yb).inSingletonScope(),t(Yb).toService(Vm))}));var Tx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_x=function(t,e){return function(i,n){e(i,n,t)}};let Bx=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=mo}};Bx=Tx([g(),_x(0,p(Lc)),Cx("design:paramtypes",[Object])],Bx);let Px=!1;const Rx=new i(((t,e,i,n)=>{Px||(Px=!0,t(qm).to(Bx).inSingletonScope(),t(Gm).toService(qm))}));var Mx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Ex=class{constructor(){this.type="text",this.numberType=yo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Ex=Mx([g()],Ex);let kx=!1;const Ox=new i(((t,e,i,n)=>{kx||(kx=!0,t(Km).to(Ex).inSingletonScope(),t(Gm).toService(Km))})),Lx=new i(((t,e,i,n)=>{i(vb)||t(vb).toSelf().inSingletonScope(),i(su)?n(su).toService(vb):t(su).toService(vb)}));function Ix(t){t.load(yb),t.load(Lx),t.load(Cb),t.load(Eb),t.load(jb),t.load(Hb),t.load($b),t.load(tx),t.load(ax),t.load(dx),t.load(xx),t.load(Ax),t.load(Rx),t.load(Ox)}class Dx{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,n,r,s){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=r,this.id=s,t.id=s,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class jx{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,n,r,s){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=r,this.id=s,t.id=s,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var Ux=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Nx=class extends t.BaseEnvContribution{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,r,s){const a=null!=s?s:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,s)=>{const o=tt.createCanvasContext(e),h=new Dx(o.canvas||{},o,a,t.width,t.height,e);o.canvas=h,i.set(e,h),s>=n&&r.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Ss.call(t)}}getCancelAnimationFrame(){return t=>{Ss.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Nx=Ux([g(),Wx("design:paramtypes",[])],Nx);const Gx=new i((t=>{Gx.isFeishuBound||(Gx.isFeishuBound=!0,t(Nx).toSelf().inSingletonScope(),t(U).toService(Nx))}));function Fx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Fx.__loaded||(Fx.__loaded=!0,t.load(Gx),t.load(ob),t.load(db),e&&Ix(t))}Gx.isFeishuBound=!1,Fx.__loaded=!1;var zx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Hx=class extends Ry{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:h=r.lineWidth,stroke:l=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit,keepStrokeScale:f=r.keepStrokeScale}=e;s.globalAlpha=a*o*this.baseGlobalAlpha,s.lineWidth=f?h:yn(this,h,this.dpr),s.strokeStyle=bn(this,l,t,i,n),s.lineJoin=c,0===u[0]&&0===u[1]||u&&s.setLineDash(u),s.lineCap=d,s.miterLimit=p}}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gn.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,gn.global.devicePixelRatio),super.measureText(t,e)}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}};Hx.env="lynx",Hx=zx([g()],Hx);var Vx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xx=class extends Af{constructor(t){super(t)}init(){this._context=new Hx(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(){}};Xx.env="lynx",Xx=Vx([g(),Yx("design:paramtypes",[Object])],Xx);var $x=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,n){e(i,n,t)}};let Zx=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Xx(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new Xx({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Zx.env="lynx",Zx=$x([g(),Kx(0,p(W)),qx("design:paramtypes",[Object])],Zx);const Jx=new i((t=>{t(Zx).toSelf(),t(yr).toDynamicValue((t=>t.container.get(Zx))).whenTargetNamed(Zx.env)})),Qx=Oy(Xx,Hx);var tw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ew=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let iw=!1;try{iw=!!lynx.createCanvasNG}catch(t){}let nw=class extends t.BaseEnvContribution{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,r,s,a){const o=null!=a?a:SystemInfo.pixelRatio;if(e.forEach(((e,a)=>{let h;s?h=lynx.createOffscreenCanvas():(h=iw?lynx.createCanvasNG(e):lynx.createCanvas(e),iw&&h.attachToCanvasView(e)),h.width=t.width*o,h.height=t.height*o;const l=h.getContext("2d"),c=new jx(h,l,o,t.width,t.height,e);i.set(e,c),a>n&&r.push(c)})),!r.length&&lynx.createOffscreenCanvas){const e=lynx.createOffscreenCanvas();e.width=t.width*o,e.height=t.height*o;const n=e.getContext("2d"),s=Math.random().toString(),a=new jx(e,n,o,t.width,t.height,s);i.set(s,a),r.push(a)}}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,!!e.offscreen,e.pixelRatio))}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return Ss.call(t)}}getCancelAnimationFrame(){return t=>{Ss.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};nw=tw([g(),ew("design:paramtypes",[])],nw);const rw=new i((t=>{rw.isLynxBound||(rw.isLynxBound=!0,t(nw).toSelf().inSingletonScope(),t(U).toService(nw))}));function sw(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];sw.__loaded||(sw.__loaded=!0,t.load(rw),t.load(Qx),t.load(Jx),e&&Ix(t))}rw.isLynxBound=!1,sw.__loaded=!1;var aw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ow=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hw=class extends Ry{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new le(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};hw.env="node",hw=aw([g(),ow("design:paramtypes",[Object,Number])],hw);var lw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},cw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uw=class extends Af{constructor(t){super(t)}init(){this._context=new hw(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&q(this._nativeCanvas.release)&&this._nativeCanvas.release()}};uw.env="node",uw=lw([g(),cw("design:paramtypes",[Object])],uw);const dw=Oy(uw,hw);var pw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},fw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gw=function(t,e){return function(i,n){e(i,n,t)}};let vw=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new uw(n)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new uw({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};vw.env="node",vw=pw([g(),gw(0,p(W)),fw("design:paramtypes",[Object])],vw);const mw=new i((t=>{t(vw).toSelf(),t(yr).toDynamicValue((t=>t.container.get(vw))).whenTargetNamed(vw.env)}));var yw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let bw=class extends t.BaseEnvContribution{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Ss.call(t)}}getCancelAnimationFrame(){return t=>{Ss.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};bw=yw([g()],bw);const xw=new i((t=>{xw.isNodeBound||(xw.isNodeBound=!0,t(bw).toSelf().inSingletonScope(),t(U).toService(bw))}));function ww(t){ww.__loaded||(ww.__loaded=!0,t.load(xw),t.load(dw),t.load(mw))}xw.isNodeBound=!1,ww.__loaded=!1;var Sw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Aw=class extends Ry{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.fillAttributes);const{fillOpacity:a=r.fillOpacity,opacity:o=r.opacity,fill:h=r.fill}=e;a>1e-12&&o>1e-12&&(s.setGlobalAlpha(a*o),s.setFillStyle(bn(this,h,t,i,n)))}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:h=r.lineWidth,stroke:l=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit,keepStrokeScale:f=r.keepStrokeScale}=e;s.setGlobalAlpha(a*o),s.setLineWidth(f?h:yn(this,h,this.dpr)),s.setStrokeStyle(bn(this,l,t,i,n)),s.setLineJoin(c),u&&s.setLineDash(u),s.setLineCap(d),s.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=ne(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ne(t,e),r.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),r.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}getImageData(t,e,i,n){const r=this.nativeContext,s=r.taro;if(r&&s)return!r.getImageData&&s.canvasGetImageData?new Promise(((r,a)=>{try{s.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:n,success(t){r(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,n,r,s){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,n,r,s)}};Aw.env="taro",Aw=Sw([g()],Aw);var Tw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Cw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let _w=class extends Af{constructor(t){super(t)}init(){this._context=new Aw(this,this._dpr)}release(){}};_w.env="taro",_w=Tw([g(),Cw("design:paramtypes",[Object])],_w);const Bw=Oy(_w,Aw);var Pw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Rw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mw=function(t,e){return function(i,n){e(i,n,t)}};let Ew=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new _w(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new _w({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Ew.env="taro",Ew=Pw([g(),Mw(0,p(W)),Rw("design:paramtypes",[Object])],Ew);const kw=new i((t=>{t(Ew).toSelf(),t(yr).toDynamicValue((t=>t.container.get(Ew))).whenTargetNamed(Ew.env)}));var Ow=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Lw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Iw=class extends t.BaseEnvContribution{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e){var i,n,r,s,a,o,h;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,r=this.canvasMap,s=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,h=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t),l=new Dx(n.canvas||{},n,h,i.width,i.height,t);return n.canvas=l,r.set(t,l),e>=s&&a.push(l),l})),this.taro=e.taro,this.pixelRatio=e.pixelRatio)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),r=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:r,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};Iw=Ow([g(),Lw("design:paramtypes",[])],Iw);const Dw=new i((t=>{Dw.isTaroBound||(Dw.isTaroBound=!0,t(Iw).toSelf().inSingletonScope(),t(U).toService(Iw))}));function jw(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];jw.__loaded||(jw.__loaded=!0,t.load(Dw),t.load(Bw),t.load(kw),e&&Ix(t))}Dw.isTaroBound=!1,jw.__loaded=!1;var Uw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Ww=class extends Ry{draw(){}createPattern(t,e){return null}};Ww.env="wx",Ww=Uw([g()],Ww);var Nw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Gw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fw=class extends Af{constructor(t){super(t)}init(){this._context=new Ww(this,this._dpr)}release(){}};Fw.env="wx",Fw=Nw([g(),Gw("design:paramtypes",[Object])],Fw);const zw=Oy(Fw,Ww);var Hw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Vw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yw=function(t,e){return function(i,n){e(i,n,t)}};let Xw=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Fw(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new Fw({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,r;const{type:s}=t;return!!this.eventManager.cache[s]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[s].listener&&this.eventManager.cache[s].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Xw.env="wx",Xw=Hw([g(),Yw(0,p(W)),Vw("design:paramtypes",[Object])],Xw);const $w=new i((t=>{t(Xw).toSelf(),t(yr).toDynamicValue((t=>t.container.get(Xw))).whenTargetNamed(Xw.env)}));var qw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Kw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zw=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{h(n.next(t))}catch(t){s(t)}}function o(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}h((n=n.apply(t,e||[])).next())}))};let Jw=class extends t.BaseEnvContribution{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,r,s){return Zw(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a<e.length;a++){const o=e[a];yield new Promise((e=>{let h=wx.createSelectorQuery();s&&(h=h.in(s)),h.select(`#${o}`).fields({node:!0,size:!0}).exec((s=>{if(!s[0])return;const h=s[0].node,l=s[0].width,c=s[0].height;h.width=l*t,h.height=c*t,i.set(o,h),a>=n&&r.push(h),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Ss.call(t)}}getCancelAnimationFrame(){return t=>{Ss.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Jw=qw([g(),Kw("design:paramtypes",[])],Jw);const Qw=new i((t=>{Qw._isWxBound||(Qw._isWxBound=!0,t(Jw).toSelf().inSingletonScope(),t(U).toService(Jw))}));function tS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];tS.__loaded||(tS.__loaded=!0,t.load(Qw),t.load(zw),t.load($w),e&&Ix(t))}function eS(t){iS(t)}function iS(t){iS.__loaded||(iS.__loaded=!0,eb(t,!1),Fx(t,!1),sw(t,!1),ww(t),jw(t,!1),tS(t,!1),Hy(t),Qp.hooks.onSetEnv.tap("loadMathPicker",((e,i)=>{"browser"!==i&&Ix(t)})))}Qw._isWxBound=!1,tS.__loaded=!1,iS.__loaded=!1;var nS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let rS=class extends nb{};rS.env="tt",rS=nS([g()],rS);var sS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let oS=class extends Af{constructor(t){super(t)}init(){this._context=new rS(this,this._dpr)}release(){}};oS.env="tt",oS=sS([g(),aS("design:paramtypes",[Object])],oS);const hS=Oy(oS,rS);var lS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uS=function(t,e){return function(i,n){e(i,n,t)}};let dS=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="tt",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new oS(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new oS({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};dS.env="tt",dS=lS([g(),uS(0,p(W)),cS("design:paramtypes",[Object])],dS);const pS=new i((t=>{t(dS).toSelf(),t(yr).toDynamicValue((t=>t.container.get(dS))).whenTargetNamed(dS.env)}));var fS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vS=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{h(n.next(t))}catch(t){s(t)}}function o(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}h((n=n.apply(t,e||[])).next())}))};let mS=class extends t.BaseEnvContribution{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,r,s){return vS(this,void 0,void 0,(function*(){const t=tt.getSystemInfoSync().pixelRatio;for(let a=0;a<e.length;a++){const o=e[a];yield new Promise((e=>{let h=tt.createSelectorQuery();s&&(h=h.in(s)),h.select(`#${o}`).node().exec((s=>{const h=s[0].node,l=h.width,c=h.height;h.width=l*t,h.height=c*t,i.set(o,h),a>=n&&r.push(h),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Ss.call(t)}}getCancelAnimationFrame(){return t=>{Ss.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};mS=fS([g(),gS("design:paramtypes",[])],mS);const yS=new i((t=>{yS.isTTBound||(yS.isTTBound=!0,t(mS).toSelf().inSingletonScope(),t(U).toService(mS))}));function bS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];bS.__loaded||(bS.__loaded=!0,t.load(yS),t.load(hS),t.load(pS),e&&Ix(t))}yS.isTTBound=!1,bS.__loaded=!1;var xS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let wS=class extends Ry{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:h=r.lineWidth,stroke:l=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit,keepStrokeScale:f=r.keepStrokeScale}=e;s.globalAlpha=a*o*this.baseGlobalAlpha,s.lineWidth=f?h:yn(this,h,this.dpr),s.strokeStyle=bn(this,l,t,i,n),s.lineJoin=c,0===u[0]&&0===u[1]||u&&s.setLineDash(u),s.lineCap=d,s.miterLimit=p}}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gn.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,gn.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:r=e.scaleIn3d}=t;let s="";s=t.font?t.font:ne(t,e,r&&this.camera&&this.camera.getProjectionScale(i)),n.font=(s||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,r;const s=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:ne(t,e,this.camera&&this.camera.getProjectionScale(i)),s.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:h=e.fontSize}=t;this.fontFamily=o,this.fontSize=h,s.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,s.textBaseline=null!==(r=t.textBaseline)&&void 0!==r?r:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}};wS.env="harmony",wS=xS([g()],wS);var SS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},AS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TS=class extends Af{constructor(t){super(t)}init(){this._context=new wS(this,this._dpr)}resize(t,e){}release(){}};TS.env="harmony",TS=SS([g(),AS("design:paramtypes",[Object])],TS);var CS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},_S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BS=function(t,e){return function(i,n){e(i,n,t)}};class PS{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let RS=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new PS}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new TS(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}this.canvas=new TS({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};RS.env="harmony",RS=CS([g(),BS(0,p(W)),_S("design:paramtypes",[Object])],RS);const MS=new i((t=>{t(RS).toSelf(),t(yr).toDynamicValue((t=>t.container.get(RS))).whenTargetNamed(RS.env)})),ES=Oy(TS,wS);var kS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},OS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let LS=class extends t.BaseEnvContribution{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new ws(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const n=new OffscreenCanvas(t,e),r=n.getContext("2d");return new Dx({width:t,height:e,context:r,_c:n,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>r},r,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(){}};LS=kS([g(),OS("design:paramtypes",[])],LS);const IS=new i((t=>{IS.isHarmonyBound||(IS.isHarmonyBound=!0,t(LS).toSelf().inSingletonScope(),t(U).toService(LS))}));function DS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];DS.__loaded||(DS.__loaded=!0,t.load(IS),t.load(ES),t.load(MS),e&&Ix(t))}IS.isHarmonyBound=!1,DS.__loaded=!1;var jS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},US=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WS=function(t,e){return function(i,n){e(i,n,t)}};let NS=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=io}};NS=jS([g(),WS(0,p(Ac)),US("design:paramtypes",[Object])],NS);let GS=!1;const FS=new i(((t,e,i,n)=>{GS||(GS=!0,t(Qm).to(NS).inSingletonScope(),t(gy).toService(Qm))}));var zS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},HS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VS=function(t,e){return function(i,n){e(i,n,t)}};let YS=class extends fx{constructor(t){super(),this.canvasRenderer=t}};YS=zS([g(),VS(0,p(kc)),HS("design:paramtypes",[Object])],YS);let XS=!1;const $S=new i(((t,e,i,n)=>{XS||(XS=!0,t(ay).to(YS).inSingletonScope(),t(gy).toService(ay))}));class qS extends Nh{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const r=t.getGraphicTheme(),s=this.transform(t,r,n),{x:a,y:o,z:h,lastModelMatrix:l}=s;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const r=e.lineWidth||i.lineWidth,s=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?r+s:yn(n,r+s,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==l&&Oh.free(n.modelMatrix),n.modelMatrix=l,n.highPerformanceRestore(),u}}var KS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ZS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JS=function(t,e){return function(i,n){e(i,n,t)}};let QS=class extends qS{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=lo}};QS=KS([g(),JS(0,p(Rc)),ZS("design:paramtypes",[Object])],QS);let tA=!1;const eA=new i(((t,e,i,n)=>{tA||(tA=!0,t(ry).to(QS).inSingletonScope(),t(gy).toService(ry))}));var iA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},nA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rA=function(t,e){return function(i,n){e(i,n,t)}};let sA=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ro}};sA=iA([g(),rA(0,p(Cc)),nA("design:paramtypes",[Object])],sA);let aA=!1;const oA=new i(((t,e,i,n)=>{aA||(aA=!0,t(ey).to(sA).inSingletonScope(),t(gy).toService(ey))}));class hA extends Nh{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getGraphicTheme();n.highPerformanceSave();const s=this.transform(t,r,n),{x:a,y:o,z:h,lastModelMatrix:l}=s;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==l&&Oh.free(n.modelMatrix),n.modelMatrix=l,n.highPerformanceRestore(),u}}var lA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},cA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,n){e(i,n,t)}};let dA=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=mo}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(r.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=t.getGraphicTheme(),a=this.transform(t,s,n),{x:o,y:h,z:l,lastModelMatrix:c}=a;let u=e;if(n.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,o,h,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const r=e.lineWidth||i.lineWidth,s=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?r+s:yn(n,r+s,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Oh.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}};dA=lA([g(),uA(0,p(Lc)),cA("design:paramtypes",[Object])],dA);let pA=!1;const fA=new i(((t,e,i,n)=>{pA||(pA=!0,t(hy).to(dA).inSingletonScope(),t(gy).toService(hy))}));var gA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},vA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,n){e(i,n,t)}};let yA=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=so}};yA=gA([g(),mA(0,p(_c)),vA("design:paramtypes",[Object])],yA);let bA=!1;const xA=new i(((t,e,i,n)=>{bA||(bA=!0,t(iy).to(yA).inSingletonScope(),t(gy).toService(iy))}));var wA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},SA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AA=function(t,e){return function(i,n){e(i,n,t)}};let TA=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=yo}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.AABBBounds;if(!n.camera)return!!r.containsPoint(e);n.highPerformanceSave();const s=t.getGraphicTheme(),{keepDirIn3d:a=s.keepDirIn3d}=t.attribute,o=!a,h=this.transform(t,s,n,o),{x:l,y:c,z:u,lastModelMatrix:d}=h;this.canvasRenderer.z=u;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let f=!1;return this.canvasRenderer.drawShape(t,n,l,c,{},null,((e,i,n)=>{if(f)return!0;const{fontSize:r=s.fontSize,textBaseline:a=s.textBaseline,textAlign:o=s.textAlign}=t.attribute,h=t.AABBBounds,d=h.height(),g=h.width(),v=fh(a,d,r),m=ph(o,g);return e.rect(m+l,v+c,g,d,u),f=e.isPointInPath(p.x,p.y),f}),((t,e,i)=>f)),this.canvasRenderer.z=0,n.modelMatrix!==d&&Oh.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),f}};TA=wA([g(),AA(0,p(Ic)),SA("design:paramtypes",[Object])],TA);let CA=!1;const _A=new i(((t,e,i,n)=>{CA||(CA=!0,t(ly).to(TA).inSingletonScope(),t(gy).toService(ly))}));var BA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},PA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RA=function(t,e){return function(i,n){e(i,n,t)}};let MA=class extends qS{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=co}};MA=BA([g(),RA(0,p(Mc)),PA("design:paramtypes",[Object])],MA);let EA=!1;const kA=new i(((t,e,i,n)=>{EA||(EA=!0,t(sy).to(MA).inSingletonScope(),t(gy).toService(sy))}));var OA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},LA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IA=function(t,e){return function(i,n){e(i,n,t)}};let DA=class extends bb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=uo}};DA=OA([g(),IA(0,p(Ec)),LA("design:paramtypes",[Object])],DA);let jA=!1;const UA=new i(((t,e,i,n)=>{jA||(jA=!0,t(cy).to(DA).inSingletonScope(),t(gy).toService(cy))}));var WA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},NA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GA=function(t,e){return function(i,n){e(i,n,t)}};let FA=class extends Ub{constructor(t){super(),this.canvasRenderer=t}};FA=WA([g(),GA(0,p(Uc)),NA("design:paramtypes",[Object])],FA);let zA=!1;const HA=new i(((t,e,i,n)=>{zA||(zA=!0,t(py).to(FA).inSingletonScope(),t(gy).toService(py))}));var VA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},YA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,n){e(i,n,t)}};let $A=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=vo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};$A=VA([g(),XA(0,p(Dc)),YA("design:paramtypes",[Object])],$A);let qA=!1;const KA=new i(((t,e,i,n)=>{qA||(qA=!0,t(dy).to($A).inSingletonScope(),t(gy).toService(dy))}));var ZA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let JA=class{constructor(){this.type="image",this.numberType=ho}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};JA=ZA([g()],JA);let QA=!1;const tT=new i(((t,e,i,n)=>{QA||(QA=!0,t(ny).to(JA).inSingletonScope(),t(gy).toService(ny))}));var eT=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},iT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nT=function(t,e){return function(i,n){e(i,n,t)}};let rT=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=go,this.themeType="rect"}};rT=eT([g(),nT(0,p(Oc)),iT("design:paramtypes",[Object])],rT);let sT=!1;const aT=new i(((t,e,i,n)=>{sT||(sT=!0,t(oy).to(rT).inSingletonScope(),t(gy).toService(oy))}));var oT=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},hT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lT=function(t,e){return function(i,n){e(i,n,t)}};let cT=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=no,this.themeType="arc"}};cT=oT([g(),lT(0,p(Tc)),hT("design:paramtypes",[Object])],cT);let uT=!1;const dT=new i(((t,e,i,n)=>{uT||(uT=!0,t(ty).to(cT).inSingletonScope(),t(gy).toService(ty))}));var pT=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},fT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gT=function(t,e){return function(i,n){e(i,n,t)}};let vT=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=po,this.themeType="polygon"}};vT=pT([g(),gT(0,p(jc)),fT("design:paramtypes",[Object])],vT);let mT=!1;const yT=new i(((t,e,i,n)=>{mT||(mT=!0,t(uy).to(vT).inSingletonScope(),t(gy).toService(uy))})),bT=pf();function xT(){xT.__loaded||(xT.__loaded=!0,Xg(),In.load(ag),In.load(bT?FS:Cb))}xT.__loaded=!1;const wT=xT;function ST(){ST.__loaded||(ST.__loaded=!0,$g(),Pf(),Mf(),In.load(Fg),In.load(dT))}ST.__loaded=!1;const AT=ST;function TT(){TT.__loaded||(TT.__loaded=!0,qg(),In.load(dg),In.load(bT?oA:Eb))}TT.__loaded=!1;const CT=TT;function _T(){_T.__loaded||(_T.__loaded=!0,Kg(),In.load(vg),In.load(bT?xA:jb))}_T.__loaded=!1;const BT=_T;function PT(){PT.__loaded||(PT.__loaded=!0,Zg(),In.load(_g),In.load(bT?HA:Hb))}PT.__loaded=!1;const RT=PT;function MT(){MT.__loaded||(MT.__loaded=!0,Jg())}MT.__loaded=!1;const ET=MT;function kT(){kT.__loaded||(kT.__loaded=!0,Qg(),In.load(Og),In.load(bT?tT:$b))}kT.__loaded=!1;const OT=kT;function LT(){LT.__loaded||(LT.__loaded=!0,tv(),In.load(cg),In.load(bT?eA:tx))}LT.__loaded=!1;const IT=LT;function DT(){DT.__loaded||(DT.__loaded=!0,ev(),In.load(xg),In.load(bT?kA:dx))}DT.__loaded=!1;const jT=DT;function UT(){UT.__loaded||(UT.__loaded=!0,iv(),In.load(Sg),In.load(bT?UA:ax))}UT.__loaded=!1;const WT=UT;function NT(){NT.__loaded||(NT.__loaded=!0,nv(),Pf(),Mf(),In.load(Yg),In.load(yT))}NT.__loaded=!1;const GT=NT;function FT(){FT.__loaded||(FT.__loaded=!0,rv(),In.load(hg),In.load(bT?$S:xx))}FT.__loaded=!1;const zT=FT;function HT(){HT.__loaded||(HT.__loaded=!0,sv(),In.load(Ug),In.load(aT))}HT.__loaded=!1;const VT=HT;function YT(){YT.__loaded||(YT.__loaded=!0,av(),In.load(Eg),In.load(bT?KA:Ax))}YT.__loaded=!1;const XT=YT;function $T(){$T.__loaded||($T.__loaded=!0,lv())}$T.__loaded=!1;const qT=$T;function KT(){KT.__loaded||(KT.__loaded=!0,ov(),In.load(fg),In.load(bT?fA:Rx))}KT.__loaded=!1;const ZT=KT;function JT(){JT.__loaded||(JT.__loaded=!0,hv(),In.load(yg),In.load(bT?_A:Ox))}JT.__loaded=!1;const QT=JT;function tC(){tC.__loaded||(tC.__loaded=!0,cv())}tC.__loaded=!1;const eC=tC,iC=Nm;Jp(),pf()?eb(In):ff()&&ww(In),wT(),AT(),CT(),BT(),RT(),ET(),OT(),IT(),jT(),WT(),GT(),zT(),VT(),XT(),qT(),ZT(),QT(),eC(),bv(),vv(),dv(),fv(),Pf(),Mf(),t.ACustomAnimate=ts,t.ARC3D_NUMBER_TYPE=no,t.ARC_NUMBER_TYPE=io,t.AREA_NUMBER_TYPE=ro,t.Animate=is,t.AnimateGroup=class extends ts{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const r=n.easing,s="string"==typeof r?Zr[r]:r;e=s(e),n.onUpdate(t,e,i)})),this.updating=!1)}},t.AnimateGroup1=class extends ts{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const r=n.easing,s="string"==typeof r?Zr[r]:r;e=s(e),n.onUpdate(t,e,i)})),this.updating=!1)}},t.Application=fn,t.Arc=rp,t.Arc3d=ap,t.Arc3dRender=Tc,t.ArcRender=Ac,t.ArcRenderContribution=eh,t.Area=ep,t.AreaRender=Cc,t.AreaRenderContribution=ih,t.AttributeAnimate=class extends ts{constructor(t,e,i){super({},t,e,i)}getEndProps(){return this.to}onBind(){Object.keys(this.to).forEach((t=>{this.from[t]=this.target.getComputedAttribute(t)}))}onEnd(){}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this.to,this.from)}},t.AutoEnablePlugins=bp,t.BaseCanvas=Af,t.BaseRender=Nh,t.Basis=fi,t.BeforeRenderConstribution=iu,t.BoundsContext=Ce,t.BoundsPicker=au,t.CIRCLE_NUMBER_TYPE=so,t.Canvas3DDrawItemInterceptor=Zc,t.CanvasArc3dPicker=ty,t.CanvasArcPicker=Qm,t.CanvasAreaPicker=ey,t.CanvasCirclePicker=iy,t.CanvasFactory=Dn,t.CanvasGlyphPicker=py,t.CanvasGroupPicker=fy,t.CanvasImagePicker=ny,t.CanvasLinePicker=ry,t.CanvasPathPicker=sy,t.CanvasPickerContribution=gy,t.CanvasPolygonPicker=cy,t.CanvasPyramid3dPicker=uy,t.CanvasRect3dPicker=oy,t.CanvasRectPicker=ay,t.CanvasRichTextPicker=dy,t.CanvasSymbolPicker=hy,t.CanvasTextLayout=du,t.CanvasTextPicker=ly,t.CbAnimate=es,t.Circle=cu,t.CircleRender=_c,t.CircleRenderContribution=nh,t.ClipAngleAnimate=class extends _s{constructor(t,e,i,n,r){var s,a,o,h,l,c,u,d,p,f,g,v;const m=null!==(a=null===(s=null==r?void 0:r.group)||void 0===s?void 0:s.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,b=null!==(h=m.height)&&void 0!==h?h:0,x=null!==(l=null==r?void 0:r.animationType)&&void 0!==l?l:"in",w=null!==(c=null==r?void 0:r.startAngle)&&void 0!==c?c:0,S=null!==(u=null==r?void 0:r.orient)&&void 0!==u?u:"clockwise";let A=0,T=0;"anticlockwise"===S?(T="in"===x?w+2*Math.PI:w,T=w+2*Math.PI):(A=w,T="out"===x?w+2*Math.PI:w);const C=gn.graphicService.creator.arc({x:null!==(p=null===(d=null==r?void 0:r.center)||void 0===d?void 0:d.x)&&void 0!==p?p:y/2,y:null!==(g=null===(f=null==r?void 0:r.center)||void 0===f?void 0:f.y)&&void 0!==g?g:b/2,outerRadius:null!==(v=null==r?void 0:r.radius)&&void 0!==v?v:(y+b)/2,innerRadius:0,startAngle:A,endAngle:T,fill:!0});let _,B;"anticlockwise"===S?(_={startAngle:w+2*Math.PI},B={startAngle:w}):(_={endAngle:w},B={endAngle:w+2*Math.PI}),super("in"===x?_:B,"in"===x?B:_,i,n,{group:null==r?void 0:r.group,clipGraphic:C})}},t.ClipDirectionAnimate=class extends _s{constructor(t,e,i,n,r){var s,a,o,h,l,c,u,d,p;const f=null!==(a=null===(s=null==r?void 0:r.group)||void 0===s?void 0:s.attribute)&&void 0!==a?a:{},g=null!==(h=null!==(o=null==r?void 0:r.width)&&void 0!==o?o:f.width)&&void 0!==h?h:0,v=null!==(c=null!==(l=null==r?void 0:r.height)&&void 0!==l?l:f.height)&&void 0!==c?c:0,m=null!==(u=null==r?void 0:r.animationType)&&void 0!==u?u:"in",y=null!==(d=null==r?void 0:r.direction)&&void 0!==d?d:"x",b=null!==(p=null==r?void 0:r.orient)&&void 0!==p?p:"positive",x=gn.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:g,height:"in"===m&&"y"===y?0:v,fill:!0});let w={},S={};"y"===y?"negative"===b?(w={y:v,height:0},S={y:0,height:v}):(w={height:0},S={height:v}):"negative"===b?(w={x:g,width:0},S={x:0,width:g}):(w={width:0},S={width:g}),super("in"===m?w:S,"in"===m?S:w,i,n,{group:null==r?void 0:r.group,clipGraphic:x})}},t.ClipGraphicAnimate=_s,t.ClipRadiusAnimate=class extends _s{constructor(t,e,i,n,r){var s,a,o,h,l,c,u,d,p,f,g;const v=null!==(a=null===(s=null==r?void 0:r.group)||void 0===s?void 0:s.attribute)&&void 0!==a?a:{},m=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(h=v.height)&&void 0!==h?h:0,b=null!==(l=null==r?void 0:r.animationType)&&void 0!==l?l:"in",x=null!==(c=null==r?void 0:r.startRadius)&&void 0!==c?c:0,w=null!==(u=null==r?void 0:r.endRadius)&&void 0!==u?u:Math.sqrt((m/2)**2+(y/2)**2),S=gn.graphicService.creator.arc({x:null!==(p=null===(d=null==r?void 0:r.center)||void 0===d?void 0:d.x)&&void 0!==p?p:m/2,y:null!==(g=null===(f=null==r?void 0:r.center)||void 0===f?void 0:f.y)&&void 0!==g?g:y/2,outerRadius:"out"===b?w:x,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:!0}),A={outerRadius:x},T={outerRadius:w};super("in"===b?A:T,"in"===b?T:A,i,n,{group:null==r?void 0:r.group,clipGraphic:S})}},t.ColorInterpolate=Zo,t.ColorStore=ta,t.CommonRenderContribution=uh,t.Container=E,t.ContainerModule=i,t.Context2dFactory=jn,t.ContributionProvider=k,t.CurveContext=class{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.curves.push(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new si(new Gt(this._lastX,this._lastY),new Gt(t,e))}quadraticCurveTo(t,e,i,n){throw new Error("CurveContext不支持调用quadraticCurveTo")}bezierCurveTo(t,e,i,n,r,s){const a=new ni(new Gt(this._lastX,this._lastY),new Gt(t,e),new Gt(i,n),new Gt(r,s));this.path.curves.push(a),this._lastX=r,this._lastY=s}arcTo(t,e,i,n,r){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,r,s,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,r,s){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}},t.CustomEvent=Wr,t.CustomPath2D=Ui,t.CustomSymbolClass=wd,t.DebugDrawItemInterceptorContribution=qc,t.DefaultArcAllocate=zf,t.DefaultArcAttribute=Ji,t.DefaultArcRenderContribution=$h,t.DefaultAreaAllocate=Vf,t.DefaultAreaAttribute=Qi,t.DefaultAreaTextureRenderContribution=bl,t.DefaultAttribute=Zi,t.DefaultBaseBackgroundRenderContribution=Hh,t.DefaultBaseTextureRenderContribution=Yh,t.DefaultCanvasAllocate=pr,t.DefaultCircleAllocate=Xf,t.DefaultCircleAttribute=tn,t.DefaultCircleRenderContribution=Jh,t.DefaultConnectAttribute=qi,t.DefaultDebugAttribute=Ki,t.DefaultFillStyle=zi,t.DefaultGlyphAttribute=nn,t.DefaultGraphicAllocate=Nf,t.DefaultGraphicMemoryManager=ng,t.DefaultGroupAttribute=en,t.DefaultGroupBackgroundRenderContribution=il,t.DefaultImageAttribute=dn,t.DefaultImageBackgroundRenderContribution=ul,t.DefaultImageRenderContribution=dl,t.DefaultLayout=Gi,t.DefaultLineAllocate=qf,t.DefaultLineAttribute=rn,t.DefaultMat4Allocate=Eh,t.DefaultMatrixAllocate=Mh,t.DefaultMorphingAnimateConfig=as,t.DefaultPathAllocate=Zf,t.DefaultPathAttribute=sn,t.DefaultPickStyle=Xi,t.DefaultPolygonAttribute=an,t.DefaultRect3dAttribute=hn,t.DefaultRectAllocate=Gf,t.DefaultRectAttribute=on,t.DefaultRectRenderContribution=ol,t.DefaultRichTextAttribute=un,t.DefaultRichTextIconAttribute=pn,t.DefaultStateAnimateConfig=ss,t.DefaultStrokeStyle=Vi,t.DefaultStyle=$i,t.DefaultSymbolAllocate=Qf,t.DefaultSymbolAttribute=ln,t.DefaultSymbolRenderContribution=gl,t.DefaultTextAllocate=eg,t.DefaultTextAttribute=cn,t.DefaultTextStyle=Yi,t.DefaultTicker=qr,t.DefaultTimeline=Jr,t.DefaultTransform=Fi,t.DirectionalLight=Bf,t.DragNDrop=class{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let r,s=!1;function a(t){if(s||(t.type="dragstart",null==e||e.dispatchEvent(t),s=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.attribute.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,r!==n&&(r&&(t.type="dragleave",t.target=r,r.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),r=n,r&&(t.type="dragover",t.target=r,r.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){s&&(r&&(t.type="drop",t.target=r,r.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),s=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}},t.DrawContribution=Gc,t.DrawItemInterceptor=Vc,t.DynamicLayerHandlerContribution=Oo,t.EnvContribution=U,t.EventManager=Fr,t.EventSystem=Vr,t.EventTarget=zr,t.FORMAT_ELEMENT_COMMAND="FORMAT_ELEMENT_COMMAND",t.FORMAT_TEXT_COMMAND=Wf,t.Factory=gf,t.FadeInPlus=class extends ts{constructor(t,e,i,n,r){super(t,e,i,n,r);const{direction:s=Cs.LEFT_TO_RIGHT,fill:a=!0,stroke:o=!0}=r||{};this.direction=s,this.fill=a,this.stroke=o,this.fillGradient={gradient:"linear",stops:[]},this.strokeGradient={gradient:"linear",stops:[]}}getEndProps(){return{fill:this.toFill,stroke:this.toStroke}}onBind(){this.toFill=this.target.getComputedAttribute("fill"),this.toStroke=this.target.getComputedAttribute("stroke")}onEnd(){}onUpdate(t,e,i){if(this.toFill&&this.toStroke)switch(this.direction){case Cs.RIGHT_TO_LEFT:this.rightToLeft(t,e,i);break;case Cs.TOP_TO_BOTTOM:this.topToBottom(t,e,i);break;case Cs.BOTTOM_TO_TOP:this.bottomToTop(t,e,i);break;case Cs.STROKE:this.strokePath(t,e,i);break;default:this.leftToRight(t,e,i)}}leftToRight(t,e,i){if(this.fill){const t=this.toFill;this.fillGradient.x0=0,this.fillGradient.y0=0,this.fillGradient.x1=1,this.fillGradient.y1=0,this.fillGradient.stops=[{offset:0,color:t},{offset:e,color:t},{offset:Math.min(1,2*e),color:"transparent"}],i.fill=this.fillGradient}if(this.stroke){const t=this.toStroke;this.strokeGradient.x0=0,this.strokeGradient.y0=0,this.strokeGradient.x1=1,this.strokeGradient.y1=0,this.strokeGradient.stops=[{offset:0,color:t},{offset:e,color:t},{offset:Math.min(1,6*e),color:"transparent"}],i.stroke=this.strokeGradient}}strokePath(t,e,i){if(this.fill){const t=this.toFill;this.fillGradient.x0=0,this.fillGradient.y0=0,this.fillGradient.x1=1,this.fillGradient.y1=0,this.fillGradient.stops=[{offset:0,color:t},{offset:e,color:t},{offset:Math.min(1,2*e),color:"transparent"}],i.fill=this.fillGradient}if(this.stroke){const t=300,n=e*t;i.lineDash=[n,t-n]}}rightToLeft(t,e,i){}topToBottom(t,e,i){}bottomToTop(t,e,i){}},t.FederatedEvent=Ir,t.FederatedMouseEvent=Dr,t.FederatedPointerEvent=jr,t.FederatedWheelEvent=Ur,t.FlexLayoutPlugin=yv,t.Fragment=wy,t.GLYPH_NUMBER_TYPE=ao,t.GRAPHIC_UPDATE_TAG_KEY=Ba,t.GROUP_NUMBER_TYPE=oo,t.Generator=e,t.Gesture=class extends Y{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,r,s,a,o,h,l,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=Nr.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t<e.length;t++){const{x:n,y:r}=e[t],s={x:n,y:r};i[t]=s}if(1!==i.length)this.startDistance=Cy(i[0],i[1]),this.center=(t=>{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,r=0;for(;r<e;)i+=t[r].x,n+=t[r].y,r++;return{x:Math.round(i/e),y:Math.round(n/e)}})([i[0],i[1]]);else{const t=e[0];this.pressTimeout=setTimeout((()=>{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:r,y:s,pointerId:a}=n;for(let t=0,e=i.length;t<e;t++)if(a===i[t].pointerId){i[t]=n;break}const o={x:r,y:s},h=i.map((t=>({x:t.x,y:t.y}))),l=Nr.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=l,this.lastMovePoint=o,1===e.length){const t=e[0],i=r-t.x,a=s-t.y,l=this.direction||Ty(t,o);this.direction=l;const c=this.getEventType(o);return n.direction=l,n.deltaX=i,n.deltaY=a,n.points=h,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,u=Cy(h[0],h[1]);n.scale=u/c,n.center=this.center,n.points=h,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,r=i.map((t=>({x:t.x,y:t.y})));if(e.points=r,this.triggerEndEvent(e),1===i.length){const i=Nr.now(),r=this.lastMoveTime;if(i-r<100){const t=r-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],r=this.lastMovePoint||n[0],s=Cy(i,r),a=s/t;if(a>this.config.swipe.velocity&&s>this.config.swipe.threshold)return e.velocity=a,e.direction=Ty(i,r),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime<this.config.press.time&&(i-this.lastTapTime<this.config.tap.interval&&t.target===this.lastTapTarget?this.tapCount++:this.tapCount=1,this.lastTapTime=i,this.lastTapTarget=t.target,1===this.tapCount?this.triggerEvent("tap",e):2===this.tapCount&&(this.triggerEvent("doubletap",e),this.tapCount=0))}for(let t=0,r=i.length;t<r;t++)if(i[t].pointerId===e.pointerId){i.splice(t,1),n.splice(t,1);break}this.reset(),i.length>0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(s=null===(r=null==e?void 0:e.press)||void 0===r?void 0:r.threshold)&&void 0!==s?s:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(l=null===(h=null==e?void 0:e.swipe)||void 0===h?void 0:h.velocity)&&void 0!==l?l:.3},tap:{interval:null!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if("press"===e)return e;let r;return r=Nr.now()-i>this.config.press.time&&Cy(n[0],t)<this.config.press.threshold?"press":"pan",this.eventType=r,r}enable(t){this.processEvent[t]=!0}isProcess(t){return this.processEvent[t]}pushEvent(t,e){const{emitThrottles:i}=this,n={type:t,ev:e};for(let e=0,r=i.length;e<r;e++)if(i[e].type===t)return void i.splice(e,1,n);i.push(n)}clearPressTimeout(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=null)}reset(){this.clearPressTimeout(),this.startTime=0,this.startDistance=0,this.direction=null,this.eventType=null,this.prevMoveTime=0,this.prevMovePoint=null,this.lastMoveTime=0,this.lastMovePoint=null}triggerEvent(t,e){this.pushEvent(t,e);const{throttleTimer:i,emitThrottles:n}=this;i||(this.throttleTimer=gn.global.getRequestAnimationFrame()((()=>{gn.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=n.length;t<e;t++){const{type:e,ev:i}=n[t];this.emitEvent(e,i)}this.emitThrottles.length=0})))}triggerStartEvent(t,e){this.isProcess(t)||(this.enable(t),this.triggerEvent(`${t}start`,e))}triggerEndEvent(t){const e=this.processEvent;Object.keys(e).forEach((i=>{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,r=i.length;n<r&&!e.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,e,t);this.emit(t,e)}},t.GlobalPickerService=ou,t.Glyph=Ud,t.GlyphRender=Uc,t.Graphic=Oa,t.GraphicAnimate=class extends ts{constructor(t,e,i,n,r){super(t,e,i,n,r),this.graphic=null==r?void 0:r.graphic}onUpdate(t,e,i){this.graphic&&Object.keys(this.from).forEach((t=>{i[t]=this.from[t]+(this.to[t]-this.from[t])*e}))}},t.GraphicCreator=xo,t.GraphicPicker=ru,t.GraphicRender=Bc,t.GraphicService=bo,t.GraphicUtil=Mo,t.Group=_o,t.GroupFadeIn=class extends ts{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}},t.GroupFadeOut=class extends ts{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}},t.GroupRender=Pc,t.GroupRenderContribution=rh,t.HtmlAttributePlugin=uv,t.IMAGE_NUMBER_TYPE=ho,t.Image=zd,t.ImageRender=Wc,t.ImageRenderContribution=sh,t.IncreaseCount=class extends ts{constructor(t,e,i,n,r){super(t,e,i,n,r)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,r,s,a,o;this.fromNumber=at(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=at(null===(n=this.to)||void 0===n?void 0:n.text)?null===(r=this.to)||void 0===r?void 0:r.text:Number.parseFloat(null===(s=this.to)||void 0===s?void 0:s.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Nt(this.fromNumber),Nt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}},t.IncrementalDrawContribution=Sc,t.InputText=class extends ts{constructor(){super(...arguments),this.fromText="",this.toText=""}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n;if(this.fromText=null!==(e=null===(t=this.from)||void 0===t?void 0:t.text)&&void 0!==e?e:"",this.toText=null!==(n=null===(i=this.to)||void 0===i?void 0:i.text)&&void 0!==n?n:"",!this.toText||rt(this.toText))this.valid=!1;else{this.toText=this.toText.toString();const t=this.target.attachShadow(),e=gn.graphicService.creator.line({x:0,y:0,points:[{x:0,y:0},{x:0,y:this.target.getComputedAttribute("fontSize")}],stroke:"black",lineWidth:1});t.add(e)}}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){var n;if(!1===this.valid)return;const r=this.fromText.length,s=this.toText.length,a=Math.ceil(r+(s-r)*e);i.text=this.toText.substr(0,a);const o=null===(n=this.target.shadowRoot)||void 0===n?void 0:n.at(0),h=this.target.clipedWidth+2;o.setAttribute("x",h)}},t.InteractiveDrawItemInterceptorContribution=Kc,t.InteractiveSubRenderContribution=dh,t.LINE_NUMBER_TYPE=lo,t.Layer=Po,t.LayerService=Eo,t.Line=Md,t.LineRender=Rc,t.Linear=ci,t.LinearClosed=Mi,t.ManualTickHandler=Kr,t.ManualTicker=class extends qr{set mode(t){this.setupTickHandler()}get mode(){return this._mode}initHandler(){return this.mode="manual",null}setupTickHandler(){const t=new Kr;return this._mode="manual",this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}tickAt(t){this.tickerHandler.tick(t-Math.max(this.lastFrameTime,0),(t=>{this.handleTick(t,{once:!0})}))}ifCanStop(){return!1}},t.Mat4Allocate=Ph,t.MathArcPicker=Fm,t.MathAreaPicker=zm,t.MathCirclePicker=Hm,t.MathGlyphPicker=Jm,t.MathImagePicker=Vm,t.MathLinePicker=Ym,t.MathPathPicker=Xm,t.MathPickerContribution=Gm,t.MathPolygonPicker=Zm,t.MathRectPicker=$m,t.MathSymbolPicker=qm,t.MathTextPicker=Km,t.MatrixAllocate=Bh,t.Meteor=class extends ts{get lastPos(){return this.posList[this.posList.length-1]}constructor(t,e,i,n){super(null,null,e,i,n),this.size=t,this.posList=[]}onBind(){const e=this.target.attachShadow();this.root=e;for(let i=0;i<this.size;i++){const n=this.target.clone(),r=Math.min((this.size-i)/this.size*3,1),s=Math.min(.2+.7/this.size);n.setAttributes({x:0,y:0,dx:0,dy:0,scaleX:r,scaleY:r,opacity:s},!1,{type:t.AttributeUpdateType.ANIMATE_BIND}),e.add(n)}}onUpdate(t,e,i){if(t)return this.target.detachShadow(),void(this.posList.length=0);const n=this.target.getComputedAttribute("x"),r=this.target.getComputedAttribute("y"),s=new Gt(n,r);this.posList.length?(this.target.shadowRoot.forEachChildren(((t,e)=>{const i=this.posList[Math.max(this.posList.length-e-1,0)];t.setAttributes({x:i.x-n,y:i.y-r},!1)})),this.posList.push(s)):this.posList.push(s)}},t.MonotoneX=wi,t.MonotoneY=Si,t.MorphingPath=va,t.MotionPath=class extends ts{constructor(t,e,i,n,r){var s;super(t,e,i,n,r),r&&(this.pathLength=r.path.getLength(),this.path=r.path,this.distance=r.distance,this.to=r.distance*this.pathLength,this.initAngle=null!==(s=r.initAngle)&&void 0!==s?s:0,this.changeAngle=!!r.changeAngle,this.cb=r.cb)}onUpdate(t,e,i){const n=this.to*e,{pos:r,angle:s}=this.path.getAttrAt(n);i.x=r.x,i.y=r.y,this.changeAngle&&(i.angle=s+this.initAngle),this.cb&&this.cb(this.from,this.to,e,this.target)}},t.MultiToOneMorphingPath=ya,t.NOWORK_ANIMATE_ATTR=ka,t.Node=Lr,t.OrthoCamera=Rf,t.PATH_NUMBER_TYPE=co,t.POLYGON_NUMBER_TYPE=uo,t.PURE_STYLE_KEY=["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],t.PYRAMID3D_NUMBER_TYPE=po,t.Path=Jd,t.PathRender=Mc,t.PathRenderContribution=ah,t.PickItemInterceptor=vp,t.PickerService=su,t.PluginService=xp,t.Polygon=lp,t.PolygonRender=Ec,t.PolygonRenderContribution=oh,t.Pyramid3d=up,t.Pyramid3dRender=jc,t.RAFTickHandler=Xr,t.REACT_TO_CANOPUS_EVENTS=vy,t.REACT_TO_CANOPUS_EVENTS_LIST=my,t.RECT3D_NUMBER_TYPE=go,t.RECT_NUMBER_TYPE=fo,t.RICHTEXT_NUMBER_TYPE=vo,t.RafBasedSTO=ws,t.ReactAttributePlugin=pv,t.Rect=Od,t.Rect3DRender=Oc,t.Rect3d=Dd,t.RectRender=kc,t.RectRenderContribution=hh,t.ReflectSegContext=oi,t.RenderSelector=Nc,t.RenderService=eu,t.ResourceLoader=Aa,t.RichText=qd,t.RichTextEditPlugin=class{constructor(){this.name="RichTextEditPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.editing=!1,this.pointerDown=!1,this.handleInput=(t,e,i,n,r)=>{const s=this.getPointByColumnIdx(i,n,r);this.hideSelection(),this.setCursor(s.x,s.y1,s.y2),this.updateCbs.forEach((t=>t("input",this)))},this.handleChange=(t,e,i,n,r)=>{const s=this.getPointByColumnIdx(i,n,r);this.curCursorIdx=i,this.selectionStartCursorIdx=i,this.setCursorAndTextArea(s.x,s.y1,s.y2,n),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleMove=t=>{this.isRichtext(t)&&(this.currRt=t.target,this.handleEnter(t),t.target.once("pointerleave",this.handleLeave),this.showSelection(t))},this.handlePointerDown=t=>{this.editing?this.onFocus(t):this.deFocus(t),this.applyUpdate(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleEnter=t=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=t=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.commandCbs=new Map,this.commandCbs.set(Wf,[this.formatTextCommandCb]),this.updateCbs=[]}getSelection(){return this.selectionStartCursorIdx&&this.curCursorIdx&&this.selectionStartCursorIdx!==this.curCursorIdx&&this.currRt?new Uf(this.selectionStartCursorIdx,this.curCursorIdx,Df(this.currRt.attribute.textConfig,this.selectionStartCursorIdx),Df(this.currRt.attribute.textConfig,this.curCursorIdx),this.currRt):null}formatTextCommandCb(t,e){const i=e.currRt;if(!i)return;const n=e.getSelection();if(!n)return;const{selectionStartCursorIdx:r,curCursorIdx:s}=n,a=i.attribute.textConfig.slice(r+1,s+1);"bold"===t?a.forEach((t=>t.fontWeight="bold")):"italic"===t?a.forEach((t=>t.fontStyle="italic")):"underline"===t?a.forEach((t=>t.underline=!0)):"lineThrough"===t?a.forEach((t=>t.lineThrough=!0)):J(t)&&a.forEach((e=>function(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)dt(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}(e,t))),i.setAttributes(i.attribute)}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}activate(t){this.pluginService=t,this.editModule=new jf,t.stage.on("pointermove",this.handleMove),t.stage.on("pointerdown",this.handlePointerDown),t.stage.on("pointerup",this.handlePointerUp),t.stage.on("pointerleave",this.handlePointerUp),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange)}showSelection(t){const e=t.target.getFrameCache();if(e&&this.editBg&&this.pointerDown){let i=this.lastPoint,n=this.getEventPosition(t),r=this.getLineByPoint(e,n);const s=this.getColumnByLinePoint(r,n),a=r.top,o=r.top+r.height;let h=s.left+s.width,l=this.getColumnIndex(e,s);n.x<s.left+s.width/2&&(h=s.left,l-=1),n.x=h,n.y=(a+o)/2;let c=this.getLineByPoint(e,i);if((i.y>n.y||i.y===n.y&&i.x>n.x)&&([i,n]=[n,i],[r,c]=[c,r]),this.editBg.removeAllChild(),c===r){const t=this.getColumnByLinePoint(c,i);this.editBg.setAttributes({x:i.x,y:c.top,width:n.x-i.x,height:t.height,fill:"#336df4",fillOpacity:.2})}else{this.editBg.setAttributes({x:0,y:c.top,width:0,height:0});const t=e.lines.findIndex((t=>t===c)),s=e.lines.findIndex((t=>t===r));let a=0;for(let r=t;r<=s;r++){const o=e.lines[r];if(r===t){const t=o.paragraphs[o.paragraphs.length-1];this.editBg.add(Ld({x:i.x,y:a,width:t.left+t.width-i.x,height:o.height,fill:"#336df4",fillOpacity:.2}))}else if(r===s){const t=o.paragraphs[0];this.editBg.add(Ld({x:t.left,y:a,width:n.x-t.left,height:o.height,fill:"#336df4",fillOpacity:.2}))}else{const t=o.paragraphs[0],e=o.paragraphs[o.paragraphs.length-1];this.editBg.add(Ld({x:t.left,y:a,width:e.left+e.width-t.left,height:o.height,fill:"#336df4",fillOpacity:.2}))}a+=o.height}}this.curCursorIdx=l,this.setCursorAndTextArea(h,a+2,o-2,t.target),this.applyUpdate(),this.updateCbs.forEach((t=>t("selection",this)))}}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}isRichtext(t){return!(!t.target||"richtext"!==t.target.type||!t.target.attribute.editable)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};return t.target.globalTransMatrix.transformPoint(e,i),i}getLineByPoint(t,e){let i=t.lines[0];for(let n=0;n<t.lines.length&&!(i.top<=e.y&&i.top+i.height>=e.y);n++)i=t.lines[n+1];return i}getColumnByLinePoint(t,e){let i=t.paragraphs[0];for(let n=0;n<t.paragraphs.length&&!(i.left<=e.x&&i.left+i.width>=e.x);n++)i=t.paragraphs[n];return i}onFocus(t){this.deFocus(t);const e=t.target;this.tryUpdateRichtext(e);const i=e.attachShadow();i.setAttributes({shadowRootIdx:-1});const n=e.getFrameCache();if(!n)return;if(!this.editLine){const t=Ed({x:0,y:0,lineWidth:1,stroke:"black"});t.animate().to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0),this.editLine=t;const e=Bo({x:0,y:0,width:0,height:0});this.editBg=e,i.add(this.editLine),i.add(this.editBg)}const r=this.getEventPosition(t),s=this.getLineByPoint(n,r);if(s){const t=this.getColumnByLinePoint(s,r);if(!t)return;let i=s.top,a=s.top+s.height,o=t.left+t.width;i+=2,a-=2;let h=this.getColumnIndex(n,t);r.x<t.left+t.width/2&&(o=t.left,h-=1),this.lastPoint={x:o,y:(i+a)/2},this.curCursorIdx=h,this.selectionStartCursorIdx=h,this.setCursorAndTextArea(o,i,a,e)}}getPointByColumnIdx(t,e,i){const n=e.getFrameCache(),{lineInfo:r,columnInfo:s}=this.getColumnByIndex(n,t);let a=r.top,o=r.top+r.height;return a+=2,o-=2,{x:s.left+("left"===i?0:s.width),y1:a,y2:o}}getColumnIndex(t,e){let i=-1;for(let n=0;n<t.lines.length;n++){const r=t.lines[n];for(let t=0;t<r.paragraphs.length;t++)if(i++,e===r.paragraphs[t])return i}return-1}getColumnByIndex(t,e){let i=-1;for(let n=0;n<t.lines.length;n++){const r=t.lines[n];for(let t=0;t<r.paragraphs.length;t++){const n=r.paragraphs[t];if(i++,i===e)return{lineInfo:r,columnInfo:n}}}return null}setCursorAndTextArea(t,e,i,n){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]});const r={x:0,y:0};n.globalTransMatrix.getInverse().transformPoint({x:t,y:e},r);const{left:s,top:a}=this.pluginService.stage.window.getBoundingClientRect();r.x+=s,r.y+=a,this.editModule.moveTo(r.x,r.y,n,this.curCursorIdx,this.selectionStartCursorIdx)}setCursor(t,e,i){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]})}applyUpdate(){this.pluginService.stage.renderNextFrame()}deFocus(t){const e=this.currRt;e&&(e.detachShadow(),this.currRt=null,this.editLine&&(this.editLine.parent.removeChild(this.editLine),this.editLine.release(),this.editLine=null,this.editBg.parent.removeChild(this.editBg),this.editBg.release(),this.editBg=null))}splitText(t){return Array.from(t)}tryUpdateRichtext(t){if(!t.getFrameCache().lines.every((t=>t.paragraphs.every((t=>!(t.text&&nt(t.text)&&this.splitText(t.text).length>1)))))){const e=[];t.attribute.textConfig.forEach((t=>{const i=this.splitText(t.text.toString());if(nt(t.text)&&i.length>1)for(let n=0;n<i.length;n++){const r=i[n];e.push(Object.assign(Object.assign({},t),{text:r}))}else e.push(t)})),t.setAttributes({textConfig:e}),t.doUpdateFrameCache(e)}}onSelect(){}deactivate(t){t.stage.off("pointermove",this.handleMove),t.stage.off("pointerdown",this.handlePointerDown),t.stage.off("pointerup",this.handlePointerUp),t.stage.off("pointerleave",this.handlePointerUp)}release(){this.editModule.release()}},t.RichTextRender=Dc,t.RotateBySphereAnimate=class extends ts{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),r=this.target.getComputedAttribute("z"),s=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(s));r-t.z<0&&(a=Pt-a),this.theta=a,this.phi=s}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:r,cb:s}="function"==typeof this.params?this.params():this.params,a=2*Math.PI*e,o=this.theta+a,h=this.phi,l=r*Math.sin(h)*Math.cos(o)+n.x,c=r*Math.cos(h)+n.y,u=r*Math.sin(h)*Math.sin(o)+n.z;for(i.x=l,i.y=c,i.z=u,i.alpha=o+Ct/2;i.alpha>Pt;)i.alpha-=Pt;i.alpha=Pt-i.alpha,i.zIndex=-1e4*i.z,s&&s(i)}},t.SVG_ATTRIBUTE_MAP=wo,t.SVG_ATTRIBUTE_MAP_KEYS=So,t.SVG_PARSE_ATTRIBUTE_MAP=Ao,t.SVG_PARSE_ATTRIBUTE_MAP_KEYS=To,t.SYMBOL_NUMBER_TYPE=mo,t.SegContext=ai,t.ShadowRoot=pp,t.ShadowRootDrawItemInterceptorContribution=$c,t.Stage=mf,t.StaticLayerHandlerContribution=ko,t.Step=Bi,t.StreamLight=class extends ts{constructor(t,e,i,n,r){super(t,e,i,n,r)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),n=gn.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=n,n.pathProxy=new Ui,i.add(n)}onStartRect(){var t,e,i;const n=this.target.attachShadow(),r=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,s=r?"height":"width",a=r?"width":"height",o=this.target.AABBBounds[s](),h=r?0:this.target.AABBBounds.y1,l=gn.graphicService.creator.rect(Object.assign(Object.assign({[s]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:h,[a]:0}));this.rect=l,n.add(l)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(e,i,n){var r,s,a,o,h,l,c,u,d,p,f,g,v,m,y,b;const x=null===(s=null===(r=this.params)||void 0===r?void 0:r.isHorizontal)||void 0===s||s,w=this.target.attribute;if(x){const n=null!==(o=null!==(a=w.width)&&void 0!==a?a:Math.abs(w.x1-w.x))&&void 0!==o?o:250,r=null!==(l=null===(h=this.params)||void 0===h?void 0:h.streamLength)&&void 0!==l?l:n,s=null!==(d=null===(u=null===(c=this.params)||void 0===c?void 0:c.attribute)||void 0===u?void 0:u.width)&&void 0!==d?d:60,p=-s,f=p+(r-p)*i,g=Math.max(f,0),v=Math.min(Math.min(f+s,s),r-f),m=v+g>n?Math.max(n-g,0):v;this.rect.setAttributes({x:g,width:m,dx:Math.min(w.x1-w.x,0)},!1,{type:t.AttributeUpdateType.ANIMATE_PLAY,animationState:{ratio:i,end:e}})}else{const n=null!==(f=null!==(p=w.height)&&void 0!==p?p:Math.abs(w.y1-w.y))&&void 0!==f?f:250,r=null!==(v=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==v?v:n,s=null!==(b=null===(y=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===y?void 0:y.height)&&void 0!==b?b:60,a=n-(r+s)*i;let o=Math.min(a,n);const h=Math.min(n-a,s);let l;o<=0?(l=Math.max(o+h,0),o=0):l=h,this.rect.setAttributes({y:o,height:l,dy:Math.min(w.y1-w.y,0)},!1,{type:t.AttributeUpdateType.ANIMATE_PLAY,animationState:{ratio:i,end:e}})}}onUpdateLineOrArea(t,e,i){const n=this.line||this.area;if(!n)return;const r=n.pathProxy,s=this.target;s.cache||s.cacheArea?this._onUpdateLineOrAreaWithCache(r,s,t,e,i):this._onUpdateLineWithoutCache(r,s,t,e,i);const a=s.attribute;n.setAttributes(Object.assign({stroke:a.stroke},n.attribute)),n.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,n,r){var s,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const r=i.reduce(((t,e)=>t+e.getLength()),0),s=[];return i.forEach((t=>{t.curves.forEach((t=>s.push(t)))})),this._updateCurves(t,s,r,n)}if("area"===e.type&&(null===(a=null===(s=e.cacheArea)||void 0===s?void 0:s.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,r=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,r,n)}}_updateCurves(t,e,i,n){var r,s;const a=i*n,o=Math.min(null!==(s=a+(null===(r=this.params)||void 0===r?void 0:r.streamLength))&&void 0!==s?s:10,i);let h=0,l=!1;for(let i=0;i<e.length;i++)if(!1!==e[i].defined){const n=e[i],r=n.getLength(),s=1-(h+r-a)/r;let c,u=1-(h+r-o)/r;if(h<a&&h+r>a)if(l=!0,n.p2&&n.p3){const[e,i]=ii(n,s);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=n.getPointAt(s);t.moveTo(e.x,e.y)}if(h<o&&h+r>o){if(n.p2&&n.p3){c&&(u=(o-a)/c.getLength());const[e]=ii(c||n,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=n.getPointAt(u);t.lineTo(e.x,e.y)}break}if(l)if(n.p2&&n.p3){const e=c||n;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(n.p1.x,n.p1.y);h+=r}}_onUpdateLineWithoutCache(t,e,i,n,r){var s,a;const{points:o,curveType:h}=e.attribute;if(!o||o.length<2||"linear"!==h)return;let l=0;for(let t=1;t<o.length;t++)l+=Ft.distancePP(o[t],o[t-1]);const c=l*n,u=Math.min(null!==(a=c+(null===(s=this.params)||void 0===s?void 0:s.streamLength))&&void 0!==a?a:10,l),d=[];let p=0;for(let t=1;t<o.length;t++){const e=Ft.distancePP(o[t],o[t-1]);if(p<c&&p+e>c&&d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),p<u&&p+e>u){d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;e<d.length;e++)t.lineTo(d[e].x,d[e].y)}}},t.SubAnimate=ns,t.Symbol=Bd,t.SymbolRender=Lc,t.SymbolRenderContribution=lh,t.TEXT_NUMBER_TYPE=yo,t.TagPointsUpdate=class extends ts{constructor(t,e,i,n,r){var s,a;super(t,e,i,n,r),this.newPointAnimateType=null!==(s=null==r?void 0:r.newPointAnimateType)&&void 0!==s?s:"grow",this.clipRangeByDimension=null!==(a=null==r?void 0:r.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var n,r;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(r=null===(n=t.points)||void 0===n?void 0:n.length)&&void 0!==r?r:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let n,r,s=1/0,a=-1/0;for(let t=0;t<this.toPoints.length;t+=1)if(i.has(this.toPoints[t].context)){s=t,n=i.get(this.toPoints[t].context);break}for(let t=this.toPoints.length-1;t>=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,r=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[a][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),ot(this.clipRange)?this.clipRange=At(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const h=i.get(t.context);return h?(o=h,[h,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:e<s&&n?[n,t]:e>a&&r?[r,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Gt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onFirstRun(){const t=this.target.attribute.clipRange;ot(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const n=vs(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));i.clipRange=this.clipRange+(1-this.clipRange)*e}if(this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const n=t+this.segmentsCache[i],r=this.points.slice(t,n);return t=n,Object.assign(Object.assign({},e),{points:r})}))}else i.points=this.points}},t.Text=fu,t.TextMeasureContribution=Ln,t.TextRender=Ic,t.TextRenderContribution=ch,t.Theme=Rr,t.TimeOutTickHandler=$r,t.TransformUtil=Ro,t.VArc=function(t){return Jl.arc(t?t.attribute:{})},t.VArc3d=function(t){return Jl.arc3d(t?t.attribute:{})},t.VArea=function(t){return Jl.area(t?t.attribute:{})},t.VCircle=function(t){return Jl.circle(t?t.attribute:{})},t.VGlobal=W,t.VGlyph=function(t){return Jl.glyph(t?t.attribute:{})},t.VGroup=function(t){return Jl.group(t?t.attribute:{})},t.VImage=function(t){return Jl.image(t?t.attribute:{})},t.VLine=function(t){return Jl.line(t?t.attribute:{})},t.VPath=function(t){return Jl.path(t?t.attribute:{})},t.VPolygon=function(t){return Jl.polygon(t?t.attribute:{})},t.VPyramid3d=function(t){return Jl.pyramid3d(t?t.attribute:{})},t.VRect=function(t){return Jl.rect(t?t.attribute:{})},t.VRect3d=function(t){return Jl.rect3d(t?t.attribute:{})},t.VRichText=yy,t.VSymbol=function(t){return Jl.symbol(t?t.attribute:{})},t.VText=function(t){return Jl.text(t?t.attribute:{})},t.VWindow=mr,t.ViewTransform3dPlugin=gv,t.VirtualLayerHandlerContribution=Lo,t.WILDCARD="*",t.WindowHandlerContribution=yr,t.WrapText=mu,t.XMLParser=za,t._calculateLineHeight=As,t._interpolateColor=na,t._registerArc=xT,t.addArcToBezierPath=$e,t.addAttributeToPrototype=function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},t.alignBezierCurves=Ls,t.alignSubpath=Ps,t.application=gn,t.applyTransformOnBezierCurves=js,t.arc3dCanvasPickModule=dT,t.arc3dModule=Fg,t.arcCanvasPickModule=FS,t.arcMathPickModule=Cb,t.arcModule=ag,t.areaCanvasPickModule=oA,t.areaMathPickModule=Eb,t.areaModule=dg,t.bezier=Ye,t.bezierCurversToPath=Us,t.binarySplitPolygon=qs,t.bindContributionProvider=L,t.bindContributionProviderNoSingletonScope=I,t.boundStroke=Xa,t.browserEnvModule=tb,t.builtInSymbolStrMap=Td,t.builtinSymbols=Sd,t.builtinSymbolsMap=Ad,t.calcLineCache=ji,t.calculateArcCornerRadius=$o,t.calculateLineHeight=Ts,t.canvasAllocate=fr,t.centroidOfSubpath=Es,t.circleBounds=fs,t.circleCanvasPickModule=xA,t.circleMathPickModule=jb,t.circleModule=vg,t.clock=Nr,t.cloneGraphic=wa,t.colorEqual=function(t,e){const i=we.parseColorString(t),n=we.parseColorString(e);return!(!i||!n)&&i.r===n.r&&i.g===n.g&&i.b===n.b&&i.opacity===n.opacity},t.colorStringInterpolationToStr=ca,t.container=In,t.cornerTangents=Xo,t.createArc=sp,t.createArc3d=op,t.createArea=ip,t.createCircle=uu,t.createColor=bn,t.createConicalGradient=th,t.createGlyph=Wd,t.createGroup=Bo,t.createImage=Hd,t.createImageElement=Qy,t.createLine=Ed,t.createMat4=Rh,t.createPath=Qd,t.createPolygon=cp,t.createPyramid3d=dp,t.createRect=Ld,t.createRect3d=jd,t.createRectPath=sl,t.createRichText=Kd,t.createShadowRoot=fp,t.createStage=function(t){return new mf(t)},t.createSymbol=Pd,t.createText=gu,t.createWrapText=yu,t.cubicCalc=ti,t.cubicLength=Qe,t.cubicPointAt=ei,t.cubicSubdivide=Bs,t.decodeReactDom=Sy,t.defaultArcAllocate=Hf,t.defaultArcBackgroundRenderContribution=Zh,t.defaultArcRenderContribution=qh,t.defaultArcTextureRenderContribution=Kh,t.defaultAreaAllocate=Yf,t.defaultBaseBackgroundRenderContribution=Vh,t.defaultBaseTextureRenderContribution=Xh,t.defaultCircleAllocate=$f,t.defaultCircleBackgroundRenderContribution=el,t.defaultCircleRenderContribution=Qh,t.defaultCircleTextureRenderContribution=tl,t.defaultGraphicMemoryManager=rg,t.defaultGroupBackgroundRenderContribution=nl,t.defaultImageBackgroundRenderContribution=fl,t.defaultImageRenderContribution=pl,t.defaultLineAllocate=Kf,t.defaultPathAllocate=Jf,t.defaultRectAllocate=Ff,t.defaultRectBackgroundRenderContribution=cl,t.defaultRectRenderContribution=hl,t.defaultRectTextureRenderContribution=ll,t.defaultSymbolAllocate=tg,t.defaultSymbolBackgroundRenderContribution=yl,t.defaultSymbolRenderContribution=vl,t.defaultSymbolTextureRenderContribution=ml,t.defaultTextAllocate=ig,t.defaultTicker=cf,t.defaultTimeline=Qr,t.drawArc=Xe,t.drawArcPath=qo,t.drawAreaSegments=kl,t.drawIncrementalAreaSegments=Ml,t.drawIncrementalSegments=Rl,t.drawPathProxy=Vo,t.drawSegments=Pl,t.enumCommandMap=Re,t.feishuEnvModule=Gx,t.fillVisible=Go,t.findBestMorphingRotation=Os,t.findNextGraphic=Dp,t.flatten_simplify=function(t,e,i){return t.length<=10||i?t:function(t,e){let i,n,r=t[0].x,s=t[0].y;const a=[t[0]];for(let o=1,h=t.length;o<h;o++)i=t[o].x-r,n=t[o].y-s,i*i+n*n>e&&(r=t[o].x,s=t[o].y,a.push(t[o]));return t[t.length-1].x===r&&t[t.length-1].y===s||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)},t.foreach=Lp,t.foreachAsync=Ip,t.genBasisSegments=vi,t.genBasisTypeSegments=gi,t.genLinearClosedSegments=Ei,t.genLinearClosedTypeSegments=ki,t.genLinearSegments=ui,t.genLinearTypeSegments=di,t.genMonotoneXSegments=Ti,t.genMonotoneXTypeSegments=Ai,t.genMonotoneYSegments=_i,t.genMonotoneYTypeSegments=Ci,t.genNumberType=qa,t.genStepSegments=Pi,t.genStepTypeSegments=Ri,t.getAttributeFromDefaultAttrList=xs,t.getConicGradientAt=Qo,t.getCurrentEnv=function(){return pf()?"browser":"node"},t.getExtraModelMatrix=function(t,e,i){const{alpha:n,beta:r}=i.attribute;if(!n&&!r)return null;const{anchor3d:s=i.attribute.anchor}=i.attribute,a=[0,0];if(s){if("string"==typeof s[0]){const t=parseFloat(s[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=s[0];if("string"==typeof s[1]){const t=parseFloat(s[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=s[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=ph(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Oh.allocate();return xh(o,o,[a[0],a[1],0]),r&&mh(o,o,r),n&&yh(o,o,n),xh(o,o,[-a[0],-a[1],0]),o},t.getModelMatrix=jh,t.getRichTextBounds=function(t){return tc||(tc=Jl.CreateGraphic("richtext",{})),tc.setAttributes(t),tc.AABBBounds},t.getScaledStroke=yn,t.getTextBounds=ec,t.getTheme=Er,t.getThemeFromGroup=kr,t.globalTheme=Mr,t.glyphCanvasPickModule=HA,t.glyphMathPickModule=Hb,t.glyphModule=_g,t.graphicCreator=Jl,t.graphicService=nf,t.graphicUtil=tf,t.harmonyEnvModule=IS,t.identityMat4=vh,t.imageCanvasPickModule=tT,t.imageMathPickModule=$b,t.imageModule=Og,t.incrementalAddTo=function(t,e){t.incrementalAppendChild(e)},t.initAllEnv=function(){eS(In)},t.initBrowserEnv=function(){eb(In)},t.initFeishuEnv=function(){Fx(In)},t.initHarmonyEnv=function(){DS(In)},t.initLynxEnv=function(){sw(In)},t.initNodeEnv=function(){ww(In)},t.initTTEnv=function(){bS(In)},t.initTaroEnv=function(){jw(In)},t.initWxEnv=function(){tS(In)},t.inject=p,t.injectable=g,t.interpolateColor=ia,t.interpolateGradientConicalColor=aa,t.interpolateGradientLinearColor=ra,t.interpolateGradientRadialColor=sa,t.interpolatePureColorArray=oa,t.intersect=Yo,t.isBrowserEnv=pf,t.isNodeEnv=ff,t.isSvg=Ha,t.isTransformKey=bs,t.isXML=Va,t.jsx=function(t,e){const i=e||{},{key:n,name:r,id:s,attribute:a,stateProxy:o}=i,h=by(i,["key","name","id","attribute","stateProxy"]);let l=t;nt(t)&&(l=Jl[t]);const c=[];for(var u=arguments.length,d=new Array(u>2?u-2:0),p=2;p<u;p++)d[p-2]=arguments[p];d.length&&xy(1===d.length?d[0]:d,c);const f="Group"===l.name?new l(a):l(e);return function(t,e,i){let n,r=!1;switch(t.type){case"richtext":case"rich/image":break;case"rich/text":n=t.attribute||{},e[0]&&(n.text=e[0]);break;default:r=!0}r?(e.forEach((e=>{e&&t.add(e)})),Object.keys(i).forEach((e=>{const n=vy[e];n&&t.on(n,i[e])}))):"richtext"===t.type&&(t.attribute.textConfig=e.map((t=>t.attribute)).filter((t=>t)))}(f,c,h),o&&(f.stateProxy=o),f},t.layerService=rf,t.lineCanvasPickModule=eA,t.lineMathPickModule=tx,t.lineModule=cg,t.loadAllEnv=eS,t.loadAllModule=iS,t.loadBrowserEnv=eb,t.loadFeishuEnv=Fx,t.loadHarmonyEnv=DS,t.loadLynxEnv=sw,t.loadNodeEnv=ww,t.loadTTEnv=bS,t.loadTaroEnv=jw,t.loadWxEnv=tS,t.lookAt=Th,t.lynxEnvModule=rw,t.mat3Tomat4=wh,t.mat4Allocate=Oh,t.matrixAllocate=kh,t.morphPath=ma,t.multiInject=f,t.multiToOneMorph=(e,i,n)=>{var r,s,a;const o=e.filter((t=>t.toCustomPath&&t.valid));o.length||__DEV__&&console.error(e," is not validate"),i.valid&&i.toCustomPath||__DEV__&&console.error(i," is not validate");const h=("clone"===(null==n?void 0:n.splitPath)?wa:null!==(r=null==n?void 0:n.splitPath)&&void 0!==r?r:Sa)(i,o.length,!0),l=i.attribute;i.setAttribute("visible",!1);const c=o.map(((t,e)=>pa(t.toCustomPath(),h[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:h[e].globalTransMatrix}))),u=o.map(((t,e)=>ga(t.attribute,l)));if(null==n?void 0:n.individualDelay){const r=n.onEnd;let s=o.length;const a=()=>{s--,0===s&&(i.setAttributes({visible:!0,ratio:null},!1,{type:t.AttributeUpdateType.ANIMATE_END}),i.detachShadow(),r&&r())};h.forEach(((t,i)=>{var r,s,h;const l=(null!==(r=n.delay)&&void 0!==r?r:0)+n.individualDelay(i,o.length,e[i],t),d=t.animate(Object.assign({},n,{onEnd:a}));d.wait(l),d.play(new va({morphingData:c[i],saveOnEnd:!0,otherAttrs:u[i]},null!==(s=n.duration)&&void 0!==s?s:as.duration,null!==(h=n.easing)&&void 0!==h?h:as.easing))}))}else{const e=null==n?void 0:n.onEnd,r=n?Object.assign({},n):{};r.onEnd=()=>{i.setAttribute("visible",!0,!1,{type:t.AttributeUpdateType.ANIMATE_END}),i.detachShadow(),e&&e()};const o=i.animate(r);(null==n?void 0:n.delay)&&o.wait(n.delay),o.play(new ya({morphingData:c,otherAttrs:u},null!==(s=null==n?void 0:n.duration)&&void 0!==s?s:as.duration,null!==(a=null==n?void 0:n.easing)&&void 0!==a?a:as.easing))}},t.multiplyMat4Mat3=function(t,e,i){const n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],h=e[5],l=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],v=e[13],m=e[14],y=e[15];let b=i.a,x=i.b,w=0,S=0;return t[0]=b*n+x*o+w*u+S*g,t[1]=b*r+x*h+w*d+S*v,t[2]=b*s+x*l+w*p+S*m,t[3]=b*a+x*c+w*f+S*y,b=i.c,x=i.d,w=0,S=0,t[4]=b*n+x*o+w*u+S*g,t[5]=b*r+x*h+w*d+S*v,t[6]=b*s+x*l+w*p+S*m,t[7]=b*a+x*c+w*f+S*y,b=0,x=0,w=1,S=0,t[8]=b*n+x*o+w*u+S*g,t[9]=b*r+x*h+w*d+S*v,t[10]=b*s+x*l+w*p+S*m,t[11]=b*a+x*c+w*f+S*y,b=i.e,x=i.f,w=0,S=1,t[12]=b*n+x*o+w*u+S*g,t[13]=b*r+x*h+w*d+S*v,t[14]=b*s+x*l+w*p+S*m,t[15]=b*a+x*c+w*f+S*y,t},t.multiplyMat4Mat4=Ah,t.named=v,t.newThemeObj=_r,t.nodeEnvModule=xw,t.oneToMultiMorph=(t,e,i)=>{var n;const r=e.filter((t=>t&&t.toCustomPath&&t.valid));r.length||__DEV__&&console.error(r," is not validate"),t.valid&&t.toCustomPath||__DEV__&&console.error(t," is not validate");const s=("clone"===(null==i?void 0:i.splitPath)?wa:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:Sa)(t,r.length,!1),a=null==i?void 0:i.onEnd;let o=r.length;const h=()=>{o--,0===o&&a&&a()};r.forEach(((e,n)=>{var a;const o=s[n],l=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,r.length,o,e):0);ma(o,e,Object.assign({},i,{onEnd:h,delay:l}),t.globalTransMatrix)}))},t.ortho=Ch,t.parsePadding=us,t.parseStroke=ls,t.parseSvgPath=De,t.pathCanvasPickModule=kA,t.pathMathPickModule=dx,t.pathModule=xg,t.pathToBezierCurves=Ds,t.point=pi,t.pointEqual=gs,t.pointInterpolation=vs,t.pointInterpolationHighPerformance=function(t,e,i,n){const{x:r,y:s}=Ut(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Ut(t.x1,t.y1,e.x1,e.y1,i);return n.x=r,n.y=s,n.x1=a,n.y1=o,n.defined=e.defined,n},t.pointsEqual=function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>gs(t,e[i]))):!Number.isNaN(t.x+t.y)&&gs(t,e))},t.pointsInterpolation=ms,t.polygonCanvasPickModule=UA,t.polygonMathPickModule=ax,t.polygonModule=Sg,t.preLoadAllModule=Jp,t.pyramid3dCanvasPickModule=yT,t.pyramid3dModule=Yg,t.rafBasedSto=Ss,t.rect3dCanvasPickModule=aT,t.rect3dModule=Ug,t.rectCanvasPickModule=$S,t.rectFillVisible=Fo,t.rectMathPickModule=xx,t.rectModule=hg,t.rectStrokeVisible=Ho,t.recursiveCallBinarySplit=Ks,t.registerArc=wT,t.registerArc3d=AT,t.registerArc3dGraphic=$g,t.registerArcGraphic=Xg,t.registerArea=CT,t.registerAreaGraphic=qg,t.registerCircle=BT,t.registerCircleGraphic=Kg,t.registerDirectionalLight=Pf,t.registerFlexLayoutPlugin=bv,t.registerGlyph=RT,t.registerGlyphGraphic=Zg,t.registerGroup=ET,t.registerGroupGraphic=Jg,t.registerHtmlAttributePlugin=dv,t.registerImage=OT,t.registerImageGraphic=Qg,t.registerLine=IT,t.registerLineGraphic=tv,t.registerOrthoCamera=Mf,t.registerPath=jT,t.registerPathGraphic=ev,t.registerPolygon=WT,t.registerPolygonGraphic=iv,t.registerPyramid3d=GT,t.registerPyramid3dGraphic=nv,t.registerReactAttributePlugin=fv,t.registerRect=zT,t.registerRect3d=VT,t.registerRect3dGraphic=sv,t.registerRectGraphic=rv,t.registerRichtext=XT,t.registerRichtextGraphic=av,t.registerShadowRoot=qT,t.registerShadowRootGraphic=lv,t.registerSymbol=ZT,t.registerSymbolGraphic=ov,t.registerText=QT,t.registerTextGraphic=hv,t.registerViewTransform3dPlugin=vv,t.registerWrapText=eC,t.registerWrapTextGraphic=cv,t.renderCommandList=Ke,t.rewriteProto=function(t,e){Object.setPrototypeOf(t,e)},t.richTextMathPickModule=Ax,t.richtextCanvasPickModule=KA,t.richtextModule=Eg,t.rotateX=mh,t.rotateY=yh,t.rotateZ=bh,t.roughModule=iC,t.runFill=Wo,t.runStroke=No,t.scaleMat4=Sh,t.segments=Ve,t.shouldUseMat4=Uh,t.snapLength=Je,t.splitArc=Fs,t.splitArea=Vs,t.splitCircle=zs,t.splitGraphic=Sa,t.splitLine=Ys,t.splitPath=Js,t.splitPolygon=Zs,t.splitRect=Gs,t.splitToGrids=Ns,t.strCommandMap=["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],t.strokeVisible=zo,t.symbolCanvasPickModule=fA,t.symbolMathPickModule=Rx,t.symbolModule=fg,t.taroEnvModule=Dw,t.textAttributesToStyle=gh,t.textCanvasPickModule=_A,t.textDrawOffsetX=ph,t.textDrawOffsetY=function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},t.textLayoutOffsetY=fh,t.textMathPickModule=Ox,t.textModule=yg,t.transformKeys=ys,t.transformMat4=_h,t.transformUtil=ef,t.translate=xh,t.ttEnvModule=yS,t.version="0.21.1-alpha.1",t.verticalLayout=Za,t.vglobal=Qp,t.waitForAllSubLayers=function(t){return Ya(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{gn.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))},t.wrapCanvas=Un,t.wrapContext=function(t,e){return In.getNamed(jn,gn.global.env)(t,e)},t.wxEnvModule=Qw,t.xul=function(t){const e=rt(t)?t[0]:t,i=[];if(!e)return i;if(!0===Va(e)){const t=(new za).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};eo(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};eo(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VRender={})}(this,(function(t){"use strict";class e{static GenAutoIncrementId(){return e.auto_increment_id++}}e.auto_increment_id=0;class i{constructor(t){this.id=e.GenAutoIncrementId(),this.registry=t}}const n="named",r="inject",s="multi_inject",a="inversify:tagged",o="inversify:paramtypes";class l{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===n?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var h=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),n=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),r=new WeakMap;function s(t,e,i){let s=r.get(t);if(h(s)){if(!i)return;s=new n,r.set(t,s)}let a=s.get(e);if(h(a)){if(!i)return;a=new n,s.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const n=g(e);return!c(n)&&a(t,n,i)}function o(t,e,i){const n=s(e,i,!1);return!h(n)&&!!n.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const n=s(e,i,!1);if(!h(n))return n.get(t)}(t,e,i);const n=g(e);return c(n)?void 0:l(t,n,i)}function h(t){return void 0===t}function c(t){return null===t}function u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,i){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 n=3===i?"string":5===i?"number":"default",r=function(t,e){const i=t[e];if(null!=i){if(!f(i))throw new TypeError;return i}}(t,e);if(void 0!==r){const e=r.call(t,n);if(u(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(f(e)){const i=e.call(t);if(!u(i))return i}const i=t.valueOf;if(f(i)){const e=i.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(f(e)){const i=e.call(t);if(!u(i))return i}const i=t.toString;if(f(i)){const e=i.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===n?"number":n)}function p(t){const e=d(t,3);return function(t){return"symbol"==typeof t}(e)?e:function(t){return""+t}(e)}function f(t){return"function"==typeof t}function g(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const n=t.prototype,r=n&&Object.getPrototypeOf(n);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,i,n){if(!u(i))throw new TypeError;return function(t,e,i,n){s(i,n,!0).set(t,e)}(t,e,i,n)})),t("hasMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function c(t,e,i,n){!function(t,e,i,n){const r=[n];let s={};h.hasOwnMetadata(t,e)&&(s=h.getMetadata(t,e));let a=s[i];void 0===a&&(a=[]),a.push(...r),s[i]=a,h.defineMetadata(t,s,e)}(a,t,i.toString(),n)}function u(t){return(e,i,n)=>{c(e,0,n,t)}}function d(t){return e=>(i,n,r)=>u(new l(t,e))(i,n,r)}const p=d(r),f=d(s);function g(){return function(t){return h.defineMetadata(o,null,t),t}}function v(t){return u(new l(n,t))}const m="Singleton",y="Transient",b="ConstantValue",x="DynamicValue",w="Factory",S="Function",A="Instance",T="Invalid";class C{constructor(t,i){this.id=e.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=i,this.type=T,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new C(this.serviceIdentifier,this.scope);return t.activated=t.scope===m&&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 _{getConstructorMetadata(t){return{compilerGeneratedMetadata:h.getMetadata(o,t),userGeneratedMetadata:h.getMetadata(a,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const B=(P=n,t=>{const e=e=>{if(null==e)return!1;if(e.key===P&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;e<i.length;e++)if(i[e].key===P&&i[e].value===t)return!0;return!1};return e.metaData=new l(P,t),e});var P;class R{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=m,this}inTransientScope(){return this._binding.scope=y,this}whenTargetNamed(t){return this._binding.constraint=B(t),this}}class M{constructor(t){this._binding=t}to(t){return this._binding.type=A,this._binding.implementationType=t,new R(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=x,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new R(this._binding)}toConstantValue(t){return this._binding.type=b,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=m,new R(this._binding)}toFactory(t){return this._binding.type=w,this._binding.factory=t,this._binding.scope=m,new R(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}class E{constructor(t){const i=t||{};i.defaultScope=i.defaultScope||y,this.options=i,this.id=e.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new _}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const n=this._getNotAllArgs(t,!1,e,i);return this._get(n)}getNamed(t,e){return this.getTagged(t,n,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new C(t,e),n=this._bindingDictionary.get(t)||[];return n.push(i),this._bindingDictionary.set(t,n),new M(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const n=this.bind(i);return t(n,e),n},i=()=>t=>this.unbind(t),n=()=>t=>this.isBound(t),r=e=>i=>{const n=this.rebind(i);return t(n,e),n};return t=>({bindFunction:e(t),isboundFunction:n(),rebindFunction:r(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,n){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:n}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),n=Object.keys(i),a=[];for(let t=0;t<n.length;t++){const e=i[t],n={};e.forEach((t=>{n[t.key]=t.value}));const o={inject:n[r],multiInject:n[s]},l=o.inject||o.multiInject,h={serviceIdentifier:l,constructorArgsMetadata:e},c={injectIdentifier:l,metadata:e,bindings:this._bindingDictionary.get(l).filter((t=>t.constraint(h)))};a.push(c)}return a}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case b:case S:e=t.cache;break;case A:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===m&&(t.cache=e,t.activated=!0)}}const k=Symbol("ContributionProvider");class O{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function L(t,e){t(k).toDynamicValue((t=>{let{container:i}=t;return new O(e,i)})).inSingletonScope().whenTargetNamed(e)}function I(t,e){t(k).toDynamicValue((t=>{let{container:i}=t;return new O(e,i)})).whenTargetNamed(e)}class D{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+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>i)){n++;break}}this.taps[n]=t}}class j extends D{call(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this.taps.map((t=>t.fn)).forEach((t=>t(...e)))}}const U=Symbol.for("EnvContribution"),W=Symbol.for("VGlobal"),N="PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";var G,F=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},H=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultGlobal=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=e.GenAutoIncrementId(),this.hooks={onSetEnv:new j(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}},t.DefaultGlobal=F([g(),H(0,p(k)),H(0,v(U)),z("design:paramtypes",[Object])],t.DefaultGlobal),t.MeasureModeEnum=void 0,(G=t.MeasureModeEnum||(t.MeasureModeEnum={}))[G.estimate=0]="estimate",G[G.actualBounding=1]="actualBounding",G[G.fontBounding=2]="fontBounding";function V(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,n,s,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new r(n,s||t,a),l=i?i+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 n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,a=new Array(s);r<s;r++)a[r]=n[r].fn;return a},o.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,r,s,a){var o=i?i+t:t;if(!this._events[o])return!1;var l,h,c=this._events[o],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,s),!0;case 6:return c.fn.call(c.context,e,n,r,s,a),!0}for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var d,p=c.length;for(h=0;h<p;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),u){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,n);break;case 4:c[h].fn.call(c[h].context,e,n,r);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c[h].fn.apply(c[h].context,l)}}return!0},o.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,n,r){var s=i?i+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||n&&o.context!==n||a(this,s);else{for(var l=0,h=[],c=o.length;l<c;l++)(o[l].fn!==e||r&&!o[l].once||n&&o[l].context!==n)&&h.push(o[l]);h.length?this._events[s]=1===h.length?h[0]:h:a(this,s)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o}(Y);var X=V(Y.exports);var $=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var q=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||$(t,"Boolean")};var K=t=>"function"==typeof t;var Z=t=>null==t;var J=t=>null!=t;var Q=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var et=t=>"object"==typeof t&&null!==t;var it=function(t){if(!et(t)||!$(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 nt=t=>void 0===t;var rt=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||$(t,"String")};var st=t=>Array.isArray?Array.isArray(t):$(t,"Array");var at=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var ot=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||$(t,"Number")};var lt=t=>ot(t)&&Number.isFinite(t);var ht=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var ct=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);const ut=Object.prototype.hasOwnProperty;var dt=(t,e)=>null!=t&&ut.call(t,e);function pt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(J(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];!J(r[a])||"object"!=typeof r[a]||n&&st(t[a])?gt(t,a,r[a]):ft(t,e,a,i,n)}}}}function ft(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=t[i],a=e[i];let o=e[i],l=!0;if(st(a)){if(n)o=[];else if(st(s))o=s;else if(at(s)){o=new Array(s.length);let t=-1;const e=s.length;for(;++t<e;)o[t]=s[t]}}else it(a)?(o=null!=s?s:{},"function"!=typeof s&&"object"==typeof s||(o={})):l=!1;l&&pt(o,a,n,r),gt(t,i,o)}function gt(t,e,i){(void 0!==i&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],i)||void 0===i&&!(e in t))&&(t[e]=i)}function vt(t,e){if(!st(t)||!st(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const mt="undefined"!=typeof console;function yt(t,e,i){const n=[e].concat([].slice.call(i));mt&&console[t].apply(console,n)}var bt;!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"}(bt||(bt={}));class xt{static getInstance(t,e){return xt._instance&&ot(t)?xt._instance.level(t):xt._instance||(xt._instance=new xt(t,e)),xt._instance}static setInstance(t){return xt._instance=t}static setInstanceLevel(t){xt._instance?xt._instance.level(t):xt._instance=new xt(t)}static clearInstance(){xt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:bt.None,e=arguments.length>1?arguments[1]:void 0;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(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._onErrorHandler.forEach((t=>t(...e)))}canLogInfo(){return this._level>=bt.Info}canLogDebug(){return this._level>=bt.Debug}canLogError(){return this._level>=bt.Error}canLogWarn(){return this._level>=bt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return this._level>=bt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):yt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=bt.Warn&&yt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=bt.Info&&yt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._level>=bt.Debug&&yt(this._method||"log","DEBUG",e),this}}xt._instance=null;const wt=1e-10,St=1e-10;function At(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:wt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:St)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}var Tt=function(t,e,i){return t<e?e:t>i?i:t};const Ct=1e-12,_t=Math.PI,Bt=_t/2,Pt=2*_t,Rt=2*Math.PI,Mt=Math.abs,Et=Math.atan2,kt=Math.cos,Ot=Math.max,Lt=Math.min,It=Math.sin,Dt=Math.sqrt,jt=Math.pow;function Ut(t){return t>=1?Bt:t<=-1?-Bt:Math.asin(t)}function Wt(t,e,i,n,r){let s=i,a=n;return"number"==typeof t&&"number"==typeof i&&(s=(1-r)*t+r*i),"number"==typeof e&&"number"==typeof n&&(a=(1-r)*e+r*n),{x:s,y:a}}function Nt(t,e){return t[0]*e[1]-t[1]*e[0]}function Gt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class Ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ft(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 ot(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return ot(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 zt{static distancePP(t,e){return Dt(jt(t.x-e.x,2)+jt(t.y-e.y,2))}static distanceNN(t,e,i,n){return Dt(jt(t-i,2)+jt(e-n,2))}static distancePN(t,e,i){return Dt(jt(e-t.x,2)+jt(i-t.y,2))}static pointAtPP(t,e,i){return new Ft((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Ht(t){return t*(Math.PI/180)}const Vt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Pt;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function Yt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function Xt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function $t(t,e,i,n){if(!function(t,e,i,n){let r=t[0],s=e[0],a=i[0],o=n[0];return s<r&&([r,s]=[s,r]),o<a&&([o,a]=[a,o]),!(s<a||o<r||(r=t[1],s=e[1],a=i[1],o=n[1],s<r&&([r,s]=[s,r]),o<a&&([o,a]=[a,o]),s<a||o<r))}(t,e,i,n))return!1;const r=[0,0],s=[0,0],a=[0,0];if(Xt(r,e,t),Xt(s,n,i),function(t,e){return Mt(t[0]-e[0])+Mt(t[1]-e[1])<1e-12}(r,s))return!0;Xt(a,i,t);const o=Nt(a,s)/Nt(r,s);return o>=0&&o<=1&&[t[0]+r[0]*o,t[1]+r[1]*o]}var qt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(qt||(qt={}));const Kt=(t,e,i)=>{let n=t.x1,r=t.x2,s=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(n>r&&([n,r]=[r,n]),s>a&&([s,a]=[a,s]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:n,x12:r,y11:s,y12:a,x21:o,x22:l,y21:h,y22:c}};function Zt(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:n,x12:r,y11:s,y12:a,x21:o,x22:l,y21:h,y22:c}=Kt(t,e,!0);return!(n>l||r<o||s>c||a<h)}return!0}function Jt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Qt(t,e){let{x:i,y:n}=t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-r.x)*Math.cos(e)-(n-r.y)*Math.sin(e)+r.x,y:(i-r.x)*Math.sin(e)+(n-r.y)*Math.cos(e)+r.y}}function te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ee(t,e){const i=e?Ht(t.angle):t.angle,n=te(t);return[Qt({x:t.x1,y:t.y1},i,n),Qt({x:t.x2,y:t.y1},i,n),Qt({x:t.x2,y:t.y2},i,n),Qt({x:t.x1,y:t.y2},i,n)]}function ie(t,e,i,n,r,s){if(s>e&&s>n||s<e&&s<n)return 0;if(n===e)return 0;const a=(s-e)/(n-e);let o=n<e?1:-1;1!==a&&0!==a||(o=n<e?.5:-.5);const l=a*(i-t)+t;return l===r?1/0:l>r?o:0}const ne=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};function re(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:r=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(r?r+" ":"")+(s?s+" ":"")+a*i+"px "+(o||"sans-serif")}class se{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),J(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=J(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(Z(this._canvas)&&(J(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),Z(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&J(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),Z(this._context)&&J(this._canvas)){const t=this._canvas.getContext("2d");J(t)&&(t.save(),t.font=re(this.textSpec),this._contextSaved=!0,this._context=t)}return!Z(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:r=n.fontStyle,fontVariant:s=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:u,textBaseline:d=(null!=u?u:"middle"),ellipsis:p,limit:f}=this._userSpec;let{lineHeight:g=o}=this._userSpec;if(rt(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=o*t}return{fontStyle:r,fontVariant:s,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,ellipsis:p,limit:f,lineHeight:g}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(Z(t))return{width:0,height:0};if(Z(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:s,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:r,textBaseline:s,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:n,lineHeight:r}=this.textSpec;return{width:i.width,height:null!==(e=r)&&void 0!==e?e:n,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;i<t.length;i++){const n=t[i];let r=this._measureSpecialChar(n);Z(r)&&se.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),Z(r)&&["F","W"].includes(ne(n))&&(r=this._measureFullSizeChar()),Z(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height),!Z(r.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=r.fontBoundingBoxAscent),!Z(r.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=r.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let e=0;e<t.length;e++){const r=t[e],s=["F","W"].includes(ne(r))?1:.53;i.width+=s*n}return i.height=null!==(e=r)&&void 0!==e?e:n,i}_measureReduce(t,e){var i;const{fontSize:n,lineHeight:r}=this.textSpec,s={width:0,height:0};if(Z(t))return s;if(st(t)){const a=t.filter(J).map((t=>t.toString()));return 0===a.length?s:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=r)&&void 0!==i?i:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(Z(this._numberCharSize)){const t=this._standardMethod(se.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/se.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return Z(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(se.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(Z(this._letterCharSize)){const t=this._standardMethod(se.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/se.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return J(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){J(this._canvas)&&(this._canvas=null),J(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}se.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",se.NUMBERS_CHAR_SET="0123456789",se.FULL_SIZE_CHAR="字";function ae(t,e,i){const{x1:n,y1:r,x2:s,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*r+i.e,i.b*n+i.d*r+i.f),t.add(i.a*s+i.c*r+i.e,i.b*s+i.d*r+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class oe{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new oe(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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i<t?(this.x2=t,this.x1=i):(this.x1=t,this.x2=i),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),this}add(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return st(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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const r=this.scalePoints(t,e,i,n);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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ae(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,i){const{x1:n,y1:r,x2:s,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*n-l*r+h,l*n+o*r+c,o*n-l*a+h,l*n+o*a+c,o*s-l*r+h,l*s+o*r+c,o*s-l*a+h,l*s+o*a+c]}scalePoints(t,e,i,n){const{x1:r,y1:s,x2:a,y2:o}=this;return[t*r+(1-t)*i,e*s+(1-e)*n,t*a+(1-t)*i,e*o+(1-e)*n]}}class le extends oe{}class he extends oe{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const r=ee(t,i),s=ee(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=te(t),l=te(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(r[0],r[1]),u=a(r[1],r[2]),d=a(s[0],s[1]),p=a(s[1],s[2]),f=i?Ht(t.angle):t.angle;let g=i?Ht(90-t.angle):t.angle+Bt;const v=i?Ht(e.angle):e.angle;let m=i?Ht(90-e.angle):e.angle+Bt;g>Rt&&(g-=Rt),m>Rt&&(m-=Rt);const y=(t,e,i,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(Jt(r,i)+Jt(r,n))/2>Jt(r,h)};return y((t.x2-t.x1)/2,f,d,p)&&y((t.y2-t.y1)/2,g,d,p)&&y((e.x2-e.x1)/2,v,c,u)&&y((e.y2-e.y1)/2,m,c,u)}(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,n),this.angle=r,this}}class ce{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,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,i,n,r,s){return!(this.e!==r||this.f!==s||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,r,s){return this.a=t,this.b=e,this.c=i,this.d=n,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,i=this.c,n=this.d,r=this.e,s=this.f,a=new ce,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*s-n*r)/o,a.f=-(t*s-e*r)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,r=this.b*e+this.d*i,s=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=r,this.c=s,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),r=Math.sin(t),s=(1-n)*e+r*i,a=(1-n)*i-r*e,o=n*this.a-r*this.b,l=r*this.a+n*this.b,h=n*this.c-r*this.d,c=r*this.c+n*this.d,u=n*this.e-r*this.f+s,d=r*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,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,i,n,r,s){return this.multiply(t,e,i,n,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:i,d:n,e:r,f:s}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=s,this.f=r,this}multiply(t,e,i,n,r,s){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,u=o*t+h*e,d=a*i+l*n,p=o*i+h*n,f=a*r+l*s+this.e,g=o*r+h*s+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=f,this.f=g,this}interpolate(t,e){const i=new ce;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:r,d:s,e:a,f:o}=this,l=i*s-n*r,h=s/l,c=-n/l,u=-r/l,d=i/l,p=(r*o-s*a)/l,f=-(i*o-n*a)/l,{x:g,y:v}=t;e.x=g*h+v*u+p,e.y=g*c+v*d+f}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ce(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,n=this.d,r=t*n-e*i,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*i+e*n)/r,s.skewY=0}else if(0!==i||0!==n){const a=Math.sqrt(i*i+n*n);s.rotateDeg=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),s.scaleX=r/a,s.scaleY=a,s.skewX=0,s.skewY=(t*i+e*n)/r}return s.rotateDeg=180*s.rotateDeg/Math.PI,s}}class ue{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<i)return 0;let s=0;const a=e=>{s++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<r)return a(e);let i=0;for(;o-t.timestamp[t.timestamp.length-1-i]<n&&(i++,!(i>=r)););if(i<r)return a(e);for(;o-t.timestamp[0]>n;)t.timestamp.shift()})),s}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>i;)t.timestamp.shift()}}function de(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,r=n*(1-Math.abs(t/60%2-1)),s=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=r,l=0):60<=t&&t<120?(a=r,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=r):180<=t&&t<240?(a=0,o=r,l=n):240<=t&&t<300?(a=r,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=r),a=Math.round(255*(a+s)),o=Math.round(255*(o+s)),l=Math.round(255*(l+s)),{r:a,g:o,b:l}}function pe(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),r=Math.max(t,e,i),s=r-n;let a=0,o=0,l=0;return a=0===s?0:r===t?(e-i)/s%6:r===e?(i-t)/s+2:(t-e)/s+4,a=Math.round(60*a),a<0&&(a+=360),l=(r+n)/2,o=0===s?0:s/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const fe=/^#([0-9a-f]{3,8})$/,ge={transparent:4294967040},ve={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function me(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ye(t){return ot(t)?new Ae(t>>16,t>>8&255,255&t,1):st(t)?new Ae(t[0],t[1],t[2]):new Ae(255,255,255)}function be(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const we=(t,e)=>{const i=fe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Ae((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ye(t):8===e?new Ae(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Se{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Se(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Se(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Se?t:new Se(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(J(ge[t]))return function(t){return ot(t)?new Ae(t>>>24,t>>>16&255,t>>>8&255,255&t):st(t)?new Ae(t[0],t[1],t[2],t[3]):new Ae(255,255,255,1)}(ge[t]);if(J(ve[t]))return ye(ve[t]);const e=`${t}`.trim().toLowerCase(),i=we(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Ae(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=de(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Ae(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Se.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Ae(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:i,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,r=pe(this.color.r,this.color.g,this.color.b),s=de(Z(t)?r.h:Tt(t,0,360),Z(e)?r.s:e>=0&&e<=1?100*e:e,Z(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new Ae(s.r,s.g,s.b,n),this}setRGB(t,e,i){return!Z(t)&&(this.color.r=t),!Z(e)&&(this.color.g=e),!Z(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=we(e,!0);return null!=i?i:this}setColorName(t){const e=ve[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new Se(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=be(t.color.r),this.color.g=be(t.color.g),this.color.b=be(t.color.b),this}copyLinearToSRGB(t){return this.color.r=xe(t.color.r),this.color.g=xe(t.color.g),this.color.b=xe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Ae{constructor(t,e,i,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+i)?255:Math.max(0,Math.min(255,+i)),J(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${me(this.r)+me(this.g)+me(this.b)+(1===this.opacity?"":me(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=pe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}const Te=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),Ce=Pt-1e-8;class _e{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,r,s){if(Math.abs(r-n)>Ce)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function f(t){l=i*Math.cos(t),h=i*Math.sin(t),l<c&&(c=l),l>u&&(u=l),h<d&&(d=h),h>p&&(p=h)}if(f(n),f(r),r!==n)if((n%=Pt)<0&&(n+=Pt),(r%=Pt)<0&&(r+=Pt),r<n&&(s=!s,a=n,n=r,r=a),s)for(r-=Pt,a=n-n%Bt,o=0;o<4&&a>r;++o,a-=Bt)f(a);else for(a=n-n%Bt+Bt,o=0;o<4&&a<r;++o,a+=Bt)f(a);this.bounds.add(t+c,e+d),this.bounds.add(t+u,e+p)}arcTo(t,e,i,n,r){this.bounds.add(t,e)}bezierCurveTo(t,e,i,n,r,s){this.bounds.add(t,e),this.bounds.add(i,n),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,i,n){this.bounds.add(t,e),this.bounds.add(i,n)}rect(t,e,i,n){this.bounds.add(t,e),this.bounds.add(t+i,e+n)}clear(){this.bounds.clear()}release(){}}class Be{constructor(){this.curves=[],this.bounds=new le}getCurveLengths(){return this.curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Pe=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Re={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},Me={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ee,ke,Oe,Le,Ie,De;function je(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const r=[];for(let t=0,s=e.length;t<s;t++)if(Ee=e[t],ke=Ee.slice(1),Oe=Ee[0],i=[Oe],n=ke.match(Pe),null!==n){for(let t=0,e=n.length;t<e;t++)Le=n[t],Ie=parseFloat(Le),Number.isNaN(Ie)||i.push(Ie);if(De=Re[Oe],i.length-1>De){let t,e=Oe;for(let n=1,s=i.length;n<s;n+=De){t=[e];for(let e=n,r=n+De;e<r;e++)t.push(i[e]);r.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else r.push(i)}else r.push(i);return r}var Ue,We,Ne,Ge,Fe,ze,He,Ve;function Ye(t,e,i,n,r,s,a,o,l){const h=Ht(a),c=Math.sin(h),u=Math.cos(h),d=u*(o-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(o-t)*.5;let f=d*d/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);f>1&&(f=Math.sqrt(f),i*=f,n*=f);const g=u/i,v=c/i,m=-c/n,y=u/n,b=g*o+v*l,x=m*o+y*l,w=g*t+v*e,S=m*t+y*e;let A=1/((w-b)*(w-b)+(S-x)*(S-x))-.25;A<0&&(A=0);let T=Math.sqrt(A);s===r&&(T=-T);const C=.5*(b+w)-T*(S-x),_=.5*(x+S)+T*(w-b),B=Math.atan2(x-_,b-C);let P=Math.atan2(S-_,w-C)-B;P<0&&1===s?P+=Pt:P>0&&0===s&&(P-=Pt);const R=Math.ceil(Math.abs(P/(Bt+.001))),M=[];for(let t=0;t<R;++t){const e=B+t*P/R,r=B+(t+1)*P/R;M[t]=[C,_,e,r,i,n,c,u]}return M}function Xe(t){const e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=l*s,c=-o*a,u=o*s,d=l*a,p=Math.cos(n),f=Math.sin(n),g=Math.cos(r),v=Math.sin(r),m=.5*(r-n),y=Math.sin(.5*m),b=8/3*y*y/Math.sin(m),x=e+p-b*f,w=i+f+b*p,S=e+g,A=i+v,T=S+b*v,C=A-b*g;return[h*x+c*w,u*x+d*w,h*T+c*C,u*T+d*C,h*S+c*A,u*S+d*A]}function $e(t,e,i,n){const r=Ye(n[5],n[6],n[0],n[1],n[3],n[4],n[2],e,i);for(let e=0;e<r.length;++e){const i=Xe(r[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}t.UpdateTag=void 0,(Ue=t.UpdateTag||(t.UpdateTag={}))[Ue.NONE=0]="NONE",Ue[Ue.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",Ue[Ue.UPDATE_SHAPE=2]="UPDATE_SHAPE",Ue[Ue.CLEAR_SHAPE=253]="CLEAR_SHAPE",Ue[Ue.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",Ue[Ue.INIT=179]="INIT",Ue[Ue.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",Ue[Ue.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",Ue[Ue.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",Ue[Ue.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",Ue[Ue.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",Ue[Ue.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",Ue[Ue.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",Ue[Ue.CLEAR_LAYOUT=127]="CLEAR_LAYOUT",t.IContainPointMode=void 0,(We=t.IContainPointMode||(t.IContainPointMode={}))[We.GLOBAL=1]="GLOBAL",We[We.LOCAL=16]="LOCAL",We[We.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",We[We.LOCAL_ACCURATE=48]="LOCAL_ACCURATE",t.AttributeUpdateType=void 0,(Ne=t.AttributeUpdateType||(t.AttributeUpdateType={}))[Ne.INIT=0]="INIT",Ne[Ne.DEFAULT=1]="DEFAULT",Ne[Ne.STATE=2]="STATE",Ne[Ne.ANIMATE_BIND=10]="ANIMATE_BIND",Ne[Ne.ANIMATE_PLAY=11]="ANIMATE_PLAY",Ne[Ne.ANIMATE_START=12]="ANIMATE_START",Ne[Ne.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",Ne[Ne.ANIMATE_END=14]="ANIMATE_END",Ne[Ne.TRANSLATE=20]="TRANSLATE",Ne[Ne.TRANSLATE_TO=21]="TRANSLATE_TO",Ne[Ne.SCALE=22]="SCALE",Ne[Ne.SCALE_TO=23]="SCALE_TO",Ne[Ne.ROTATE=24]="ROTATE",Ne[Ne.ROTATE_TO=25]="ROTATE_TO",t.AnimateStatus=void 0,(Ge=t.AnimateStatus||(t.AnimateStatus={}))[Ge.INITIAL=0]="INITIAL",Ge[Ge.RUNNING=1]="RUNNING",Ge[Ge.PAUSED=2]="PAUSED",Ge[Ge.END=3]="END",t.AnimateMode=void 0,(Fe=t.AnimateMode||(t.AnimateMode={}))[Fe.NORMAL=0]="NORMAL",Fe[Fe.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY",t.AnimateStepType=void 0,(ze=t.AnimateStepType||(t.AnimateStepType={})).wait="wait",ze.from="from",ze.to="to",ze.customAnimate="customAnimate",t.Direction=void 0,function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(t.Direction||(t.Direction={})),t.CurveTypeEnum=void 0,(He=t.CurveTypeEnum||(t.CurveTypeEnum={}))[He.CubicBezierCurve=0]="CubicBezierCurve",He[He.QuadraticBezierCurve=1]="QuadraticBezierCurve",He[He.ArcCurve=2]="ArcCurve",He[He.LineCurve=3]="LineCurve",He[He.EllipseCurve=4]="EllipseCurve",He[He.MoveCurve=5]="MoveCurve",t.BaseRenderContributionTime=void 0,(Ve=t.BaseRenderContributionTime||(t.BaseRenderContributionTime={}))[Ve.beforeFillStroke=0]="beforeFillStroke",Ve[Ve.afterFillStroke=1]="afterFillStroke";const qe=(t,e,i,n,r,s,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i<l;i++){const o=e+h*i,l=e+h*(i+1),c=4*Math.tan(Math.abs(h)/4)/3,u=l<o?-1:1,d=Math.cos(o),p=Math.sin(o),f=Math.cos(l),g=Math.sin(l),v=d*s+n,m=p*a+r,y=f*s+n,b=g*a+r,x=s*c*u,w=a*c*u;t.push(v-x*p,m+w*d,y+x*g,b-w*f,y,b)}},Ke=[(t,e,i,n,r,s,a)=>e.arc(t[1]*r+i,t[2]*s+n,t[3]*(r+s)/2,t[4],t[5],t[6],a),(t,e,i,n,r,s,a)=>e.arcTo(t[1]*r+i,t[2]*s+n,t[3]*r+i,t[4]*s+n,t[5]*(r+s)/2,a),(t,e,i,n,r,s,a)=>e.bezierCurveTo(t[1]*r+i,t[2]*s+n,t[3]*r+i,t[4]*s+n,t[5]*r+i,t[6]*s+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,r,s)=>e.ellipse(t[1]*r+i,t[2]*s+n,t[3]*r,t[4]*s,t[5],t[6],t[7],t[8]),(t,e,i,n,r,s,a)=>e.lineTo(t[1]*r+i,t[2]*s+n,a),(t,e,i,n,r,s,a)=>e.moveTo(t[1]*r+i,t[2]*s+n,a),(t,e,i,n,r,s,a)=>e.quadraticCurveTo(t[1]*r+i,t[2]*s+n,t[3]*r+i,t[4]*s+n,a),(t,e,i,n,r,s,a)=>e.rect(t[1]*r+i,t[2]*s+n,t[3]*r,t[4]*s,a)];function Ze(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;o<t.length;o++){const l=t[o];Ke[l[0]](l,e,i,n,r,s,a)}}class Je{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Qe(t,e){let i=0;const n=t.length;for(let r=0;r<n;r++){const s=t[r],a=e[r],o=t[(r+1)%n],l=e[(r+1)%n];i+=zt.distanceNN(s,a,o,l)}return i/2}function ti(t,e,i,n,r){return Qe([t.x,e.x,i.x,n.x],[t.y,e.y,i.y,n.y])}function ei(t,e,i,n,r){const s=1-r;return s*s*s*t+3*e*r*s*s+3*i*r*r*s+n*r*r*r}function ii(t,e,i,n,r){const s=ei(t.x,e.x,i.x,n.x,r),a=ei(t.y,e.y,i.y,n.y,r);return new Ft(s,a)}function ni(t,e){const{p0:i,p1:n,p2:r,p3:s}=t,a=ii(i,n,r,s,e),o=zt.pointAtPP(i,n,e),l=zt.pointAtPP(n,r,e),h=zt.pointAtPP(r,s,e),c=zt.pointAtPP(o,l,e),u=zt.pointAtPP(l,h,e);return[new ri(i,o,c,a),new ri(a,u,h,s)]}class ri extends Je{constructor(e,i,n,r){super(),this.type=t.CurveTypeEnum.CubicBezierCurve,this.p0=e,this.p1=i,this.p2=n,this.p3=r}_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 ii(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?ti(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(e){return e===t.Direction.ROW?Mt(this.p0.x-this.p3.x):e===t.Direction.COLUMN?Mt(this.p0.y-this.p3.y):0}getAngleAt(t){const e=Ot(t-.01,0),i=Lt(t+.01,1),n=this.getPointAt(e),r=this.getPointAt(i);return Et(r.y-n.y,r.x-n.x)}}function si(t,e){const{p0:i,p1:n}=t,r=zt.pointAtPP(i,n,e);return[new ai(i,r),new ai(r,n)]}class ai extends Je{constructor(e,i){super(),this.type=t.CurveTypeEnum.LineCurve,this.p0=e,this.p1=i}getPointAt(t){if(!1!==this.defined)return zt.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Et(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()?zt.distancePP(this.p0,this.p1):60}calcProjLength(e){return e===t.Direction.ROW?Mt(this.p0.x-this.p1.x):e===t.Direction.COLUMN?Mt(this.p0.y-this.p1.y):0}}class oi{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,i,n,r,s,a,o){const l=new ri(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(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,i,n){const r=this.addLinearCurve(t,e,i,this._lastOriginP,n);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=n}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,n){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,n,r){const s=new ai(new Ft(this._lastX,this._lastY),new Ft(t,e));return s.originP1=n,s.originP2=r,s.defined=i,s}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(e){var i,n;if(e===t.Direction.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],n=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Mt(t.p0.y-n.y)}if(e===t.Direction.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 Mt(t.p0.x-i.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class li extends oi{bezierCurveTo(t,e,i,n,r,s,a,o){return super.bezierCurveTo(e,t,n,i,s,r,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function hi(t,e){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 ci(e,i,n){const r=null!=i?i:Mt(n[n.length-1].x-n[0].x)>Mt(n[n.length-1].y-n[0].y)?t.Direction.ROW:t.Direction.COLUMN;return"monotoneY"===e?new li(e,r):new oi(e,r)}class ui{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,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function di(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const r=ci("linear",i,t);return pi(new ui(r,n),t),r}function pi(t,e){return hi(t,e)}function fi(t,e,i,n,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+i)/6,n,t.lastPoint1)}class gi{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&&fi(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,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:fi(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function vi(t,e){return hi(t,e)}function mi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return di(t,e);const r=ci("basis",i,t);return vi(new gi(r,n),t),r}function yi(t){return t<0?-1:1}function bi(t,e,i){const n=t._x1-t._x0,r=e-t._x1,s=(t._y1-t._y0)/(n||Number(r<0&&-0)),a=(i-t._y1)/(r||Number(n<0&&-0)),o=(s*r+a*n)/(n+r);return(yi(s)+yi(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function xi(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function wi(t,e,i,n,r){const s=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-s)/3;t.context.bezierCurveTo(s+h,a+h*e,o-h,l-h*i,o,l,n,t.lastPoint1)}class Si{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:wi(this,this._t0,xi(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 i=t.x,n=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,wi(this,xi(this,e=bi(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:wi(this,this._t0,e=bi(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Ai extends Si{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Ti(t,e){return hi(t,e)}function Ci(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return di(t,e);const r=ci("monotoneX",i,t);return Ti(new Si(r,n),t),r}function _i(t,e){return hi(t,e)}function Bi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return di(t,e);const r=ci("monotoneY",i,t);return _i(new Ai(r,n),t),r}let Pi=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}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,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Ri(e,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:s}=n;if(e.length<2-Number(!!s))return null;const a=new oi("step",null!=r?r:Mt(e[e.length-1].x-e[0].x)>Mt(e[e.length-1].y-e[0].y)?t.Direction.ROW:t.Direction.COLUMN);return Mi(new Pi(a,i,s),e),a}function Mi(t,e){return hi(t,e)}class Ei extends ui{lineEnd(){this.context.closePath()}}function ki(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const r=ci("linear",i,t);return Oi(new Ei(r,n),t),r}function Oi(t,e){return hi(t,e)}function Li(t,e,i,n,r){let s=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);s=(s*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const n=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*n+t._x1*t._l23_2a-e*t._l12_2a)/r,l=(l*n+t._y1*t._l23_2a-i*t._l12_2a)/r}t.context.bezierCurveTo(s,a,o,l,t._x2,t._y2,n,t.lastPoint1)}function Ii(t,e){return function(i,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:a}=r;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return di(i,r);const o=ci(t,s,i);return hi(new e(o,n,a),i),o}}const Di=Ii("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,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:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Li(this,e,i,!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=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ji=Ii("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,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:i}=t;if(this._point){const t=this._x2-e,n=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Li(this,e,i,!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=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function Ui(t,e,i){var n,r;switch(e){case"linear":default:return di(t,i);case"basis":return mi(t,i);case"monotoneX":return Ci(t,i);case"monotoneY":return Bi(t,i);case"step":return Ri(t,.5,i);case"stepBefore":return Ri(t,0,i);case"stepAfter":return Ri(t,1,i);case"catmullRom":return Di(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return ji(t,null!==(r=null==i?void 0:i.curveTension)&&void 0!==r?r:.5,i);case"linearClosed":return ki(t,i)}}class Wi extends Be{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new _e(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Me.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Me.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([Me.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.commandList.push([Me.C,t,e,i,n,r,s]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,r,s),this}arcTo(t,e,i,n,r){return this.commandList.push([Me.AT,t,e,i,n,r]),this._ctx&&this._ctx.arcTo(t,e,i,n,r),this}ellipse(t,e,i,n,r,s,a,o){return this.commandList.push([Me.E,t,e,i,n,r,s,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,r,s,a,o),this}rect(t,e,i,n){return this.commandList.push([Me.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,r,s){return this.commandList.push([Me.A,t,e,i,n,r,s]),this._ctx&&this._ctx.arc(t,e,i,n,r,s),this}closePath(){return this.commandList.push([Me.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[Me.M]=t=>`M${t[1]} ${t[2]}`,t[Me.L]=t=>`L${t[1]} ${t[2]}`,t[Me.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Me.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Me.A]=t=>{const e=[];qe(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t<e.length;t+=6)i+=`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`;return i},t[Me.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Me.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,r){this.clear();const s=je(t);return this._runCommandStrList(s,e,i,n,r),this._updateBounds(),this}fromLine(e){const{points:i,curveType:n,clipRangeByDimension:r}=e.attribute;if(!i)return;const s=Ui(i,n);"x"===r?this.direction=t.Direction.ROW:"y"===r?this.direction=t.Direction.COLUMN:"auto"===r&&(this.direction=s.direction),this.curves=s.curves}fromCustomPath2D(t,e,i,n,r){return this.clear(),this._runCommandList(t.commandList,e,i,n,r),this._updateBounds(),this}transform(t,e,i,n){const r=this.commandList;if(!this.transformCbList){const t=[];t[Me.M]=this.moveToTransform,t[Me.L]=this.lineToTransform,t[Me.Q]=this.quadraticCurveToTransform,t[Me.C]=this.bezierCurveToTransform,t[Me.AT]=this.arcToTransform,t[Me.E]=this.ellipseTransform,t[Me.R]=this.rectTransform,t[Me.A]=this.arcTransform,t[Me.Z]=this.closePathTransform,this.transformCbList=t}r.forEach((r=>{this.transformCbList[r[0]](r,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*n+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n+e,t[4]=t[4]*r+i,t[5]=t[5]*(n+r)/2}ellipseTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}rectTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*n,t[4]=t[4]*r}arcTransform(t,e,i,n,r){t[1]=t[1]*n+e,t[2]=t[2]*r+i,t[3]=t[3]*(n+r)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,r,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,u=0,d=0,p=0,f=0;for(let g=0,v=t.length;g<v;++g){switch(e=t[g],1===l&&1===h||(e=Gi(e,l,h)),e[0]){case"l":u+=e[1],d+=e[2],this.lineTo(u+a,d+o);break;case"L":u=e[1],d=e[2],this.lineTo(u+a,d+o);break;case"h":u+=e[1],this.lineTo(u+a,d+o);break;case"H":u=e[1],this.lineTo(u+a,d+o);break;case"v":d+=e[1],this.lineTo(u+a,d+o);break;case"V":d=e[1],this.lineTo(u+a,d+o);break;case"m":u+=e[1],d+=e[2],this.moveTo(u+a,d+o);break;case"M":u=e[1],d=e[2],this.moveTo(u+a,d+o);break;case"c":i=u+e[5],n=d+e[6],p=u+e[3],f=d+e[4],this.bezierCurveTo(u+e[1]+a,d+e[2]+o,p+a,f+o,i+a,n+o),u=i,d=n;break;case"C":u=e[5],d=e[6],p=e[3],f=e[4],this.bezierCurveTo(e[1]+a,e[2]+o,p+a,f+o,u+a,d+o);break;case"s":i=u+e[3],n=d+e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+a,f+o,u+e[1]+a,d+e[2]+o,i+a,n+o),p=u+e[1],f=d+e[2],u=i,d=n;break;case"S":i=e[3],n=e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+a,f+o,e[1]+a,e[2]+o,i+a,n+o),u=i,d=n,p=e[1],f=e[2];break;case"q":i=u+e[3],n=d+e[4],p=u+e[1],f=d+e[2],this.quadraticCurveTo(p+a,f+o,i+a,n+o),u=i,d=n;break;case"Q":i=e[3],n=e[4],this.quadraticCurveTo(e[1]+a,e[2]+o,i+a,n+o),u=i,d=n,p=e[1],f=e[2];break;case"t":i=u+e[1],n=d+e[2],null===c[0].match(/[QqTt]/)?(p=u,f=d):"t"===c[0]?(p=2*u-r,f=2*d-s):"q"===c[0]&&(p=2*u-p,f=2*d-f),r=p,s=f,this.quadraticCurveTo(p+a,f+o,i+a,n+o),u=i,d=n,p=u+e[1],f=d+e[2];break;case"T":i=e[1],n=e[2],p=2*u-p,f=2*d-f,this.quadraticCurveTo(p+a,f+o,i+a,n+o),u=i,d=n;break;case"a":$e(this,u+a,d+o,[e[1],e[2],e[3],e[4],e[5],e[6]+u+a,e[7]+d+o]),u+=e[6],d+=e[7];break;case"A":$e(this,u+a,d+o,[e[1],e[2],e[3],e[4],e[5],e[6]+a,e[7]+o]),u=e[6],d=e[7];break;case"z":case"Z":this.closePath()}c=e}}_runCommandList(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==r)for(let s=0,a=t.length;s<a;++s){const a=t[s].slice();switch(a[0]){case Me.L:this.lineToTransform(a,e,i,n,r);break;case Me.M:this.moveToTransform(a,e,i,n,r);break;case Me.C:this.bezierCurveToTransform(a,e,i,n,r);break;case Me.Q:this.quadraticCurveToTransform(a,e,i,n,r);break;case Me.A:this.arcToTransform(a,e,i,n,r);break;case Me.E:this.ellipseTransform(a,e,i,n,r);break;case Me.R:this.rectTransform(a,e,i,n,r);break;case Me.AT:this.arcToTransform(a,e,i,n,r);break;case Me.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Ze(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===t.Direction.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Mt(t.p0.y-e.p1.y)}if(this.direction===t.Direction.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Mt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n<this.curves.length;n++){e=this.curves[n];const r=e.getLength(this.direction);if(i+r>=t)break;i+=r}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Ni=["l",0,0,0,0,0,0,0];function Gi(t,e,i){const n=Ni[0]=t[0];if("a"===n||"A"===n)Ni[1]=e*t[1],Ni[2]=i*t[2],Ni[3]=t[3],Ni[4]=t[4],Ni[5]=t[5],Ni[6]=e*t[6],Ni[7]=i*t[7];else if("h"===n||"H"===n)Ni[1]=e*t[1];else if("v"===n||"V"===n)Ni[1]=i*t[1];else for(let n=1,r=t.length;n<r;++n)Ni[n]=(n%2==1?e:i)*t[n];return Ni}const Fi={alignSelf:"auto"},zi={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new ce},Hi={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},Vi={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Yi=Object.assign({outerBorder:Object.assign(Object.assign({},Vi),{distance:0}),innerBorder:Object.assign(Object.assign({},Vi),{distance:0})},Vi),Xi={text:"",maxLineWidth:1/0,maxWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:"PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0,measureMode:t.MeasureModeEnum.fontBounding,keepCenterInLine:!1},$i={pickStrokeBuffer:0},qi=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,blur:0,cursor:null,html:null,react:null},Hi),Yi),Fi),$i),Ki={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},Zi={_debug_bounds:!1},Ji=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic",keepStrokeScale:!1},Zi),qi),zi);const Qi=Object.assign(Object.assign({},Ji),{startAngle:0,endAngle:Rt,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),tn=Object.assign(Object.assign(Object.assign({},Ji),Ki),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),en=Object.assign(Object.assign({},Ji),{radius:1,startAngle:0,endAngle:Rt}),nn=Object.assign(Object.assign({},Ji),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start",baseOpacity:1}),rn=Object.assign(Object.assign({},Ji),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),sn=Object.assign(Object.assign(Object.assign({},Ji),Ki),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),an=Object.assign(Object.assign({},Ji),{path:new Wi,fillStrokeOrder:1,customPath:()=>{xt.getInstance().warn("空函数")}}),on=Object.assign(Object.assign({},Ji),{points:[],cornerRadius:0,closePath:!0}),ln=Object.assign(Object.assign({},Ji),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),hn=Object.assign(Object.assign({},Ji),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),cn=Object.assign(Object.assign({},Ji),{symbolType:"circle",size:10,keepDirIn3d:!0}),un=Object.assign(Object.assign(Object.assign({},Ji),Xi),{strokeBoundsBuffer:0,keepDirIn3d:!0}),dn=Object.assign(Object.assign(Object.assign({},Ji),Xi),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),pn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Ji),{fill:!0,cornerRadius:0}),fn=Object.assign(Object.assign({},pn),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class gn{}const vn=new gn,mn=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function n(){return r("linear",t.linearGradient,s)||r("radial",t.radialGradient,o)||r("conic",t.conicGradient,a)}function r(e,n,r){return function(n,s){const a=m(n);if(a){m(t.startCall)||i("Missing (");const n=function(n){const s=r();return s&&(m(t.comma)||i("Missing comma before color stops")),{type:e,orientation:s,colorStops:d(p)}}();return m(t.endCall)||i("Missing )"),n}}(n)}function s(){return v("directional",t.sideOrCorner,1)||v("angular",t.angleValue,1)}function a(){return v("angular",t.fromAngleValue,1)}function o(){let i,n,r=l();return r&&(i=[],i.push(r),n=e,m(t.comma)&&(r=l(),r?i.push(r):e=n)),i}function l(){let t=function(){const t=v("shape",/^(circle)/i,0);return t&&(t.style=g()||h()),t}()||function(){const t=v("shape",/^(ellipse)/i,0);return t&&(t.style=f()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=u();e&&(t={type:"default-radial",at:e})}}return t}function h(){return v("extent-keyword",t.extentKeywords,1)}function c(){if(v("position",/^at/,0)){const t=u();return t||i("Missing positioning value"),t}}function u(){const t={x:f(),y:f()};if(t.x||t.y)return{type:"position",value:t}}function d(e){let n=e();const r=[];if(n)for(r.push(n);m(t.comma);)n=e(),n?r.push(n):i("One extra comma");return r}function p(){const e=v("hex",t.hexColor,1)||v("rgba",t.rgbaColor,1)||v("rgb",t.rgbColor,1)||v("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=f(),e}function f(){return v("%",t.percentageValue,1)||v("position-keyword",t.positionKeywords,1)||g()}function g(){return v("px",t.pixelValue,1)||v("em",t.emValue,1)}function v(t,e,i){const n=m(e);if(n)return{type:t,value:n[i]}}function m(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const n=t.exec(e);return n&&y(n[0].length),n}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(n);return e.length>0&&i("Invalid input not EOF"),t}()}}();class yn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(yn.IsGradientStr(t))try{const e=mn(t)[0];if(e){if("linear"===e.type)return yn.ParseLinear(e);if("radial"===e.type)return yn.ParseRadial(e);if("conic"===e.type)return yn.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=_t/2,r=parseFloat(e.value)/180*_t-n;return{gradient:"conical",x:.5,y:.5,startAngle:r,endAngle:r+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,n=_t/2;let r="angular"===e.type?parseFloat(e.value)/180*_t:0;for(;r<0;)r+=Rt;for(;r>=Rt;)r-=Rt;let s=0,a=0,o=0,l=0;return r<n?(s=0,a=1,o=Math.sin(r),l=a-Math.cos(r)):r<_t?(s=0,a=0,o=Math.cos(r-n),l=Math.sin(r-n)):r<_t+n?(s=1,a=0,o=s-Math.sin(r-_t),l=Math.cos(r-_t)):(s=1,o=s-Math.cos(r-n-_t),l-=Math.sin(r-n-_t)),{gradient:"linear",x0:s,y0:a,x1:o,y1:l,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function bn(t,e,i){let n=e;const{a:r,b:s,c:a,d:o}=t.currentMatrix,l=Math.sign(r)*Math.sqrt(r*r+s*s),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function xn(t,e,i){let n,r,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(st(e))for(let t=0;t<e.length&&(r=e[t],!r);t++);else r=e;if(r=yn.Parse(r),"string"==typeof r)return r;if(i.AABBBounds&&(!i.attribute||0!==i.attribute.scaleX||0!==i.attribute.scaleY)){const e=i.AABBBounds;let o=e.x2-e.x1,l=e.y2-e.y1,h=e.x1-s,c=e.y1-a;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;o/=t,l/=e,h/=t,c/=e}"linear"===r.gradient?n=function(t,e,i,n,r,s){var a,o,l,h;const c=t.createLinearGradient(i+(null!==(a=e.x0)&&void 0!==a?a:0)*r,n+(null!==(o=e.y0)&&void 0!==o?o:0)*s,i+(null!==(l=e.x1)&&void 0!==l?l:1)*r,n+(null!==(h=e.y1)&&void 0!==h?h:0)*s);return e.stops.forEach((t=>{c.addColorStop(t.offset,t.color)})),c}(t,r,h,c,o,l):"conical"===r.gradient?n=function(t,e,i,n,r,s){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*r,n+(null!==(o=e.y)&&void 0!==o?o:0)*s,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(r+i,s+n,void 0)}(t,r,h,c,o,l):"radial"===r.gradient&&(n=function(t,e,i,n,r,s){var a,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*r,n+(null!==(o=e.y0)&&void 0!==o?o:.5)*s,Math.max(r,s)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*r,n+(null!==(c=e.y1)&&void 0!==c?c:.5)*s,Math.max(r,s)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,r,h,c,o,l))}return n||"orange"}const wn={horizontal:{width:"width",height:"height",left:"left",top:"top",x:"x",y:"y",bottom:"bottom"},vertical:{width:"height",height:"width",left:"top",top:"left",x:"y",y:"x",bottom:"right"}},Sn=!0,An=!1,Tn=/\w|\(|\)|-/,Cn=/[.?!,;:/,。?!、;:]/,_n=/\S/,Bn=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Pn(t,e,i,n,r){if(!e||e<=0)return 0;const s=vn.graphicUtil.textMeasure;let a=n,o=t.slice(0,a),l=Math.floor(s.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(s.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(s.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(s.measureText(h,i).width)}return r&&(a=Rn(t,a)),a}function Rn(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e;for(;Tn.test(t[n-1])&&Tn.test(t[n])||Cn.test(t[n]);)if(n--,n<=0)return i?Mn(t,e):e;return n}function Mn(t,e){let i=e;for(;Tn.test(t[i-1])&&Tn.test(t[i])||Cn.test(t[i]);)if(i++,i>=t.length)return i;return i}function En(t,e){const i=vn.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var kn=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let On=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const n=this.context.measureText(t);return i?this.compatibleMetrics(n,e):n}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){const{ascent:i,descent:n}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=n,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=n}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){const{left:i,right:n}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=n}return t}estimate(t,e){let{fontSize:i=un.fontSize}=e,n=0,r=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:r++;return{width:~~(.8*n*i+r*i),height:i}}measureTextWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsWidth(t,e,i){return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e)).width:this.estimate(t,e).width}measureTextBoundsLeftRight(t,e,i){return this.context?{left:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxLeft,right:i.actualBoundingBoxRight}:this.measureTextBoundLeftRightEstimate(e)}measureTextPixelHeight(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:Xi.fontSize}measureTextPixelADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundHieght(t,e,i){var n;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)):null!==(n=e.fontSize)&&void 0!==n?n:Xi.fontSize}measureTextBoundADscent(t,e,i){return this.context?{ascent:(i=null!=i?i:this._measureTextWithAlignBaseline(t,e,!0)).fontBoundingBoxAscent,descent:i.fontBoundingBoxDescent}:this.measureTextBoundADscentEstimate(e)}measureTextBoundADscentEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Xi.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:Xi.fontSize,{textAlign:n}=t;return"center"===n?{left:i/2,right:i/2}:"right"===n||"end"===n?{left:i,right:0}:{left:0,right:i}}measureTextPixelADscentAndWidth(e,i,n){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(i)),{width:this.estimate(e,i).width});const r=this._measureTextWithoutAlignBaseline(e,i,!0);if(n===t.MeasureModeEnum.actualBounding)return{ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,width:r.width};if(n===t.MeasureModeEnum.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(i)),{width:r.width});if(n===t.MeasureModeEnum.fontBounding){let t=r.fontBoundingBoxAscent,e=r.fontBoundingBoxDescent;if(r.actualBoundingBoxDescent&&e<r.actualBoundingBoxDescent){const i=r.actualBoundingBoxDescent-e;e+=i,t-=i}else if(r.actualBoundingBoxAscent&&t<r.actualBoundingBoxAscent){const i=r.actualBoundingBoxAscent-t;t+=i,e-=i}return{ascent:t,descent:e,width:r.width}}return{ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,width:r.width}}measureText(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t)):this.estimate(t,e)}clipTextVertical(t,e,i,n){if(0===t.length)return{verticalList:t,width:0};const{fontSize:r=12}=e;t.forEach((t=>{t.width=0===t.direction?r:this.measureTextWidth(t.text,e)}));const s=[];let a=0,o=0;for(;o<t.length&&a+t[o].width<i;o++)a+=t[o].width,s.push(t[o]);if(t[o]&&t[o].text.length>1){const r=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(n&&r.str!==t[o].text){let i="",n=0;for(let e=0;e<o;e++){const r=t[e];i+=r.text,n+=r.text.length}i+=t[o].text;let s=Rn(i,n+r.str.length);s-=n,s!==r.str.length-1&&(r.str=r.str.substring(0,s),r.width=this.measureTextWidth(r.str,e))}s.push(Object.assign(Object.assign({},t[o]),{text:r.str,width:r.width})),a+=r.width}return{verticalList:s,width:a}}clipText(t,e,i,n,r){if(0===t.length)return{str:"",width:0};let s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};if(s=this.measureTextWidth(t[0],e),s>i)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(n&&a.str!==t){let i=Rn(t,a.str.length,r);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,n,r,s,a){let o;if("start"===s)o=this._clipTextStart(t,e,i,n,r),a&&(o.result=a+o.str);else if("middle"===s){const n=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:n.width,result:n.left+a+n.right}}else o=this._clipTextEnd(t,e,i,n,r),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,n,r){if(n===r){xt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${n}, ${r}`);const i=t.substring(0,r+1);return{str:i,width:this.measureTextWidth(i,e)}}const s=Math.floor((n+r)/2),a=t.substring(0,s+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const r=t.substring(0,s);return l=this.measureTextWidth(r,e),l<=i?{str:r,width:l}:this._clipTextEnd(t,e,i,n,s)}if(o<i){if(s>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,s+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,s,r)}return{str:a,width:o}}_clipTextStart(t,e,i,n,r){const s=Math.ceil((n+r)/2),a=t.substring(s-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(s,t.length);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextStart(t,e,i,s,t.length)}if(o<i){if(s<=0)return{str:t,width:this.measureTextWidth(t,e)};const r=t.substring(s-2,t.length);return l=this.measureTextWidth(r,e),l>=i?{str:a,width:o}:this._clipTextStart(t,e,i,n,s)}return{str:a,width:o}}_clipTextMiddle(t,e,i,n,r,s,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:n,right:r,width:s+a};const c=t.substring(t.length-o,t.length),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:r,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,o+1)}clipTextWithSuffixVertical(t,e,i,n,r,s){if(""===n)return this.clipTextVertical(t,e,i,r);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,r);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(n,e);if(o>i)return a;let l;if(i-=o,"start"===s){const s=this.revertVerticalList(t);l=this.clipTextVertical(s,e,i,r);const a=this.revertVerticalList(l.verticalList);a.unshift({text:n,direction:1,width:o}),l.verticalList=a}else if("middle"===s){const s=this.clipTextVertical(t,e,i/2,r),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,r);s.verticalList.push({text:n,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>s.verticalList.push(t))),l={verticalList:s.verticalList,width:s.width+h.width}}else l=this.clipTextVertical(t,e,i,r),l.verticalList.push({text:n,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,n,r,s){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===n)return this.clipText(t,e,i,r);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(n,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+n,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,s,n);if(r&&h.str!==t){const i=Rn(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+n);return h.str=h.result,h.width+=l,h}};On=kn([g()],On);var Ln=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const In=Symbol.for("TextMeasureContribution");t.DefaultTextMeasureContribution=class extends On{},t.DefaultTextMeasureContribution=Ln([g()],t.DefaultTextMeasureContribution);const Dn=new E,jn=Symbol.for("CanvasFactory"),Un=Symbol.for("Context2dFactory");function Wn(t){return Dn.getNamed(jn,vn.global.env)(t)}const Nn=1e-4,Gn=Math.sqrt(3),Fn=1/3;function zn(t){return t>-ir&&t<ir}function Hn(t){return t>ir||t<-ir}const Vn=[0,0],Yn=[0,0],Xn=[0,0];function $n(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function qn(t,e,i,n){const r=1-n;return r*(r*t+2*n*e)+n*n*i}function Kn(t,e,i,n,r){const s=1-r;return s*s*(s*t+3*r*e)+r*r*(r*n+3*s*i)}function Zn(t){return(t%=Rt)<0&&(t+=Rt),t}function Jn(t,e,i,n,r,s,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>s+h||l<e-h&&l<n-h&&l<s-h||o>t+h&&o>i+h&&o>r+h||o<t-h&&o<i-h&&o<r-h)&&function(t,e,i,n,r,s,a,o,l){let h=0,c=.005,u=1/0;Vn[0]=a,Vn[1]=o;for(let a=0;a<1;a+=.05){Yn[0]=qn(t,i,r,a),Yn[1]=qn(e,n,s,a);const o=$n(Vn,Yn);o<u&&(h=a,u=o)}u=1/0;for(let a=0;a<32&&!(c<Nn);a++){const a=h-c,o=h+c;Yn[0]=qn(t,i,r,a),Yn[1]=qn(e,n,s,a);const l=$n(Yn,Vn);if(a>=0&&l<u)h=a,u=l;else{Xn[0]=qn(t,i,r,o),Xn[1]=qn(e,n,s,o);const a=$n(Xn,Vn);o<=1&&a<u?(h=o,u=a):c*=.5}}return l&&(l[0]=qn(t,i,r,h),l[1]=qn(e,n,s,h)),Math.sqrt(u)}(t,e,i,n,r,s,o,l,null)<=h/2}function Qn(t,e,i,n,r,s,a,o,l,h,c){if(0===l)return!1;const u=l;return!(c>e+u&&c>n+u&&c>s+u&&c>o+u||c<e-u&&c<n-u&&c<s-u&&c<o-u||h>t+u&&h>i+u&&h>r+u&&h>a+u||h<t-u&&h<i-u&&h<r-u&&h<a-u)&&function(t,e,i,n,r,s,a,o,l,h,c){let u,d,p,f,g=0,v=.005,m=1/0;Vn[0]=l,Vn[1]=h;for(let l=0;l<1;l+=.05)Yn[0]=Kn(t,i,r,a,l),Yn[1]=Kn(e,n,s,o,l),p=$n(Vn,Yn),p<m&&(g=l,m=p);m=1/0;for(let l=0;l<32&&!(v<Nn);l++)u=g-v,d=g+v,Yn[0]=Kn(t,i,r,a,u),Yn[1]=Kn(e,n,s,o,u),p=$n(Yn,Vn),u>=0&&p<m?(g=u,m=p):(Xn[0]=Kn(t,i,r,a,d),Xn[1]=Kn(e,n,s,o,d),f=$n(Xn,Vn),d<=1&&f<m?(g=d,m=f):v*=.5);return c&&(c[0]=Kn(t,i,r,a,g),c[1]=Kn(e,n,s,o,g)),Math.sqrt(m)}(t,e,i,n,r,s,a,o,h,c,null)<=u/2}function tr(t,e,i,n,r,s,a,o,l){if(0===a)return!1;const h=a;o-=t,l-=e;const c=Math.sqrt(o*o+l*l);if(c-h>i||c+h<i)return!1;if(Math.abs(n-r)%Rt<1e-4)return!0;if(s){const t=n;n=Zn(r),r=Zn(t)}else n=Zn(n),r=Zn(r);n>r&&(r+=Rt);let u=Math.atan2(l,o);return u<0&&(u+=Rt),u>=n&&u<=r||u+Rt>=n&&u+Rt<=r}function er(t,e,i,n,r,s,a){if(0===r)return!1;const o=r,l=r/2;let h=0,c=t;if(a>e+l&&a>n+l||a<e-l&&a<n-l||s>t+l&&s>i+l||s<t-l&&s<i-l)return!1;if(t===i)return Math.abs(s-t)<=o/2;h=(e-n)/(t-i),c=(t*n-i*e)/(t-i);const u=h*s-a+c;return u*u/(h*h+1)<=o/2*o/2}const ir=1e-4;function nr(t,e,i,n,r){const s=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,o=3*e-3*t;let l=0;if(zn(a)){if(Hn(s)){const t=-o/s;t>=0&&t<=1&&(r[l++]=t)}}else{const t=s*s-4*a*o;if(zn(t))r[0]=-s/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-s+e)/(2*a),n=(-s-e)/(2*a);i>=0&&i<=1&&(r[l++]=i),n>=0&&n<=1&&(r[l++]=n)}}return l}const rr=[-1,-1,-1],sr=[-1,-1];function ar(){const t=sr[0];sr[0]=sr[1],sr[1]=t}function or(t,e,i,n,r,s,a,o,l,h){if(h>e&&h>n&&h>s&&h>o||h<e&&h<n&&h<s&&h<o)return 0;const c=function(t,e,i,n,r,s){const a=n+3*(e-i)-t,o=3*(i-2*e+t),l=3*(e-t),h=t-r,c=o*o-3*a*l,u=o*l-9*a*h,d=l*l-3*o*h;let p=0;if(zn(c)&&zn(u))if(zn(o))s[0]=0;else{const t=-l/o;t>=0&&t<=1&&(s[p++]=t)}else{const t=u*u-4*c*d;if(zn(t)){const t=u/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(s[p++]=e),i>=0&&i<=1&&(s[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-u+e),n=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,Fn):Math.pow(i,Fn),n=n<0?-Math.pow(-n,Fn):Math.pow(n,Fn);const r=(-o-(i+n))/(3*a);r>=0&&r<=1&&(s[p++]=r)}else{const t=(2*c*o-3*a*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),r=(-o-2*i*n)/(3*a),l=(-o+i*(n+Gn*Math.sin(e)))/(3*a),h=(-o+i*(n-Gn*Math.sin(e)))/(3*a);r>=0&&r<=1&&(s[p++]=r),l>=0&&l<=1&&(s[p++]=l),h>=0&&h<=1&&(s[p++]=h)}}return p}(e,n,s,o,h,rr);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let h=0;h<c;h++){const c=rr[h],g=0===c||1===c?.5:1;Kn(t,i,r,a,c)<l||(d<0&&(d=nr(e,n,s,o,sr),sr[1]<sr[0]&&d>1&&ar(),p=Kn(e,n,s,o,sr[0]),d>1&&(f=Kn(e,n,s,o,sr[1]))),2===d?c<sr[0]?u+=p<e?g:-g:c<sr[1]?u+=f<p?g:-g:u+=o<f?g:-g:c<sr[0]?u+=p<e?g:-g:u+=o<p?g:-g)}return u}function lr(t,e,i,n,r,s,a,o){if(o>e&&o>n&&o>s||o<e&&o<n&&o<s)return 0;const l=function(t,e,i,n,r){const s=t-2*e+i,a=2*(e-t),o=t-n;let l=0;if(zn(s)){if(Hn(a)){const t=-o/a;t>=0&&t<=1&&(r[l++]=t)}}else{const t=a*a-4*s*o;if(zn(t)){const t=-a/(2*s);t>=0&&t<=1&&(r[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*s),n=(-a-e)/(2*s);i>=0&&i<=1&&(r[l++]=i),n>=0&&n<=1&&(r[l++]=n)}}return l}(e,n,s,o,rr);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,s);if(h>=0&&h<=1){let o=0;const c=qn(e,n,s,h);for(let n=0;n<l;n++){const l=0===rr[n]||1===rr[n]?.5:1;qn(t,i,r,rr[n])<a||(rr[n]<h?o+=c<e?l:-l:o+=s<c?l:-l)}return o}const c=0===rr[0]||1===rr[0]?.5:1;return qn(t,i,r,rr[0])<a?0:s<e?c:-c}function hr(t,e,i,n,r,s,a,o){if((o-=e)>i||o<-i)return 0;const l=Math.sqrt(i*i-o*o);rr[0]=-l,rr[1]=l;const h=Math.abs(n-r);if(h<1e-4)return 0;if(h>=Rt-1e-4){n=0,r=Rt;const e=s?1:-1;return a>=rr[0]+t&&a<=rr[1]+t?e:0}if(n>r){const t=n;n=r,r=t}n<0&&(n+=Rt,r+=Rt);let c=0;for(let e=0;e<2;e++){const i=rr[e];if(i+t>a){let t=Math.atan2(o,i),e=s?1:-1;t<0&&(t=Rt+t),(t>=n&&t<=r||t+Rt>=n&&t+Rt<=r)&&(t>_t/2&&t<1.5*_t&&(e=-e),c+=e)}}return c}function cr(t){return Math.round(t/_t*1e8)/1e8%2*_t}function ur(t,e){let i=cr(t[0]);i<0&&(i+=Rt);const n=i-t[0];let r=t[1];r+=n,!e&&r-i>=Rt?r=i+Rt:e&&i-r>=Rt?r=i-Rt:!e&&i>r?r=i+(Rt-cr(i-r)):e&&i<r&&(r=i-(Rt-cr(r-i))),t[0]=i,t[1]=r}const dr=[0,0];function pr(t,e,i,n,r){const s=t,a=t.length;let o,l,h=0,c=0,u=0,d=0,p=0;for(let t=0;t<a;t++){const a=s[t],f=0===t;a[0]===Me.M&&t>1&&(i||(h+=ie(c,u,d,p,n,r))),f&&(c=a[1],u=a[2],d=c,p=u);const g=a[0],v=a[1],m=a[2],y=a[3],b=a[4],x=a[5],w=a[6];let S=b,A=x;dr[0]=S,dr[1]=A,ur(dr,Boolean(a[6])),S=dr[0],A=dr[1];const T=S,C=A-S,_=!!(1-(a[6]?0:1)),B=(n-v)*y/y+v;switch(g){case Me.M:d=v,p=m,c=d,u=p;break;case Me.L:if(i){if(er(c,u,v,m,e,n,r))return!0}else h+=ie(c,u,v,m,n,r)||0;c=v,u=m;break;case Me.C:if(i){if(Qn(c,u,v,m,y,b,x,w,e,n,r))return!0}else h+=or(c,u,v,m,y,b,x,w,n,r)||0;c=x,u=w;break;case Me.Q:if(i){if(Jn(c,u,v,m,y,b,e,n,r))return!0}else h+=lr(c,u,v,m,y,b,n,r)||0;c=y,u=b;break;case Me.A:if(o=Math.cos(T)*y+v,l=Math.sin(T)*y+m,f?(d=o,p=l):h+=ie(c,u,o,l,n,r),i){if(tr(v,m,y,T,T+C,_,e,B,r))return!0}else h+=hr(v,m,y,T,T+C,_,B,r);c=Math.cos(T+C)*y+v,u=Math.sin(T+C)*y+m;break;case Me.R:if(d=c=v,p=u=m,o=d+y,l=p+b,i){if(er(d,p,o,p,e,n,r)||er(o,p,o,l,e,n,r)||er(o,l,d,l,e,n,r)||er(d,l,d,p,e,n,r))return!0}else h+=ie(o,p,o,l,n,r),h+=ie(d,l,d,p,n,r);break;case Me.Z:if(i){if(er(c,u,d,p,e,n,r))return!0}else h+=ie(c,u,d,p,n,r);c=d,u=p}}return i||function(t,e){return Math.abs(t-e)<ir}(u,p)||(h+=ie(c,u,d,p,n,r)||0),0!==h}class fr{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Wn(Object.assign({nativeCanvas:vn.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Wn(Object.assign({nativeCanvas:vn.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}const gr=new fr;var vr=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},mr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const yr=Symbol.for("VWindow"),br=Symbol.for("WindowHandlerContribution");t.DefaultWindow=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new j(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Dn.getNamed(br,t.env).configure(this,t),this.actived=!0)},this._uid=e.GenAutoIncrementId(),this.global=vn.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const n=this._handler.getWH();this._width=n.width,this._height=n.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,n,r,s){this._handler.setViewBoxTransform(t,e,i,n,r,s)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),n={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},n),n.x-=i.x1,n.y-=i.y1,n}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&At(this.width,t.width())&&At(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}},t.DefaultWindow=vr([g(),mr("design:paramtypes",[])],t.DefaultWindow);var xr,wr=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Sr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ar=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultGraphicUtil=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=vn.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=gr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const r=this.global.measureTextMethod;this.global.measureTextMethod=i;const s={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Xi.fontSize};return this.global.measureTextMethod=r,s}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new se(Object.assign({defaultFontParams:{fontFamily:Xi.fontFamily,fontSize:Xi.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+se.ALPHABET_CHAR_SET+se.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=Dn.get(yr),r=t.AABBBounds,s=r.width(),a=r.height(),o=-r.x1,l=-r.y1;n.create({viewBox:{x1:o,y1:l,x2:r.x2,y2:r.y2},width:s,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(n,[t],{transMatrix:n.getViewBoxTransform(),viewBox:n.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=n.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}},t.DefaultGraphicUtil=wr([g(),Ar(0,p(k)),Ar(0,v(In)),Sr("design:paramtypes",[Object])],t.DefaultGraphicUtil),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(xr||(xr={}));const Tr=new ce;t.DefaultTransformUtil=class{constructor(){this.matrix=new ce}init(t){return this.mode=xr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=xr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Tr.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:r}=i;this.outTargetMatrix.translate(n,r),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-r)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Tr.a,Tr.b,Tr.c,Tr.d,Tr.e,Tr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Tr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:n}=e;this.outTargetMatrix.translate(i,n),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-n)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Tr.a,Tr.b,Tr.c,Tr.d,Tr.e,Tr.f),this}scale(t,e,i){return this.mode===xr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===xr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Tr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Tr.a,Tr.b,Tr.c,Tr.d,Tr.e,Tr.f),this}translate(t,e){return this.mode===xr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===xr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}},t.DefaultTransformUtil=wr([g(),Sr("design:paramtypes",[])],t.DefaultTransformUtil);const Cr={arc:Qi,area:tn,circle:en,line:sn,path:an,symbol:cn,text:un,rect:ln,polygon:on,richtext:dn,richtextIcon:fn,image:pn,group:nn,glyph:rn},_r=Object.keys(Cr);function Br(){return{arc:Object.assign({},Cr.arc),area:Object.assign({},Cr.area),circle:Object.assign({},Cr.circle),line:Object.assign({},Cr.line),path:Object.assign({},Cr.path),symbol:Object.assign({},Cr.symbol),text:Object.assign({},Cr.text),rect:Object.assign({},Cr.rect),polygon:Object.assign({},Cr.polygon),richtext:Object.assign({},Cr.richtext),richtextIcon:Object.assign({},Cr.richtextIcon),image:Object.assign({},Cr.image),group:Object.assign({},Cr.group),glyph:Object.assign({},Cr.glyph)}}function Pr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Rr=Br();class Mr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},_r.forEach((t=>{this._defaultTheme[t]=Object.create(Rr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0)}this.userTheme?this.doCombine(n&&n.theme.combinedTheme):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,xt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;_r.forEach((n=>{const r=Object.create(Rr[n]);t&&t[n]&&Pr(r,t[n]),i[n]&&Pr(r,i[n]),e[n]&&Pr(r,e[n]),this.combinedTheme[n]=r})),e.common&&_r.forEach((t=>{Pr(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Er=new Mr;function kr(t,e){return t.glyphHost?kr(t.glyphHost):e?(t.isContainer,e):Or(t)||t.attachedThemeGraphic&&kr(t.attachedThemeGraphic)||Er.getTheme()}function Or(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Er.getTheme()}return null}var Lr=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class Ir extends X{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=e.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Lr(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&xt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t<e;t++){if(!i)return null;t>0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<t;i++){if(!e._next)return null;e=e._next}return e}at(t){return this.getChildAt(t)}containNode(t){if(!this._idMap)return!1;if(this._idMap.has(t._uid))return!0;let e=this._firstChild;for(;e;){if(e.containNode(t))return!0;e=e._next}return!1}getRootNode(){let t=this.parent;for(;null==t?void 0:t.parent;)t=t.parent;return t||this}hasChildNodes(){return null!==this._firstChild}addChild(t){return this.appendChild(t)}add(t){return this.appendChild(t)}getChildren(){const t=[];let e=this._firstChild;for(;e;)t.push(e),e=e._next;return t}isChildOf(t){return!!this.parent&&this.parent._uid===t._uid}isParentOf(t){return t.isChildOf(this)}isDescendantsOf(t){let e=this.parent;if(!e)return!1;do{if(e._uid===t._uid)return!0;e=e.parent}while(null!==e);return!1}isAncestorsOf(t){return t.isDescendantsOf(this)}getAncestor(t){throw new Error("暂不支持")}setAllDescendantsProps(t,e){let i=this._firstChild;for(;i;)i[t]=e,i.setAllDescendantsProps(t,e),i=i._next}setCount(t){this._count+=t;let e=this.parent;if(e)do{e._count+=t,e=e.parent}while(null!==e)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const n=q(i,!0)&&i||Q(i)&&i.capture,r=Q(i)&&i.once,s=K(e)?void 0:e;return t=n?`${t}capture`:t,e=K(e)?e:e.handleEvent,r?super.once(t,e,s):super.on(t,e,s),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const n=q(i,!0)&&i||Q(i)&&i.capture,r=K(e)?void 0:e;t=n?`${t}capture`:t,e=K(e)?e:e.handleEvent;const s=Q(i)&&i.once;return super.off(t,e,r,s),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return Q(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return super.emit(t.type,t,...i),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class Dr{get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get x(){return this.canvas.x}get y(){return this.canvas.y}get canvasX(){return this.canvas.x}get canvasY(){return this.canvas.y}get viewX(){return this.viewport.x}get viewY(){return this.viewport.y}constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Dr.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=this.pickParams.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch(t){this.nativeEvent.preventDefault&&K(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch(t){this.nativeEvent.stopPropagation&&K(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class jr extends Dr{constructor(){super(...arguments),this.client={x:0,y:0},this.movement={x:0,y:0},this.offset={x:0,y:0},this.global={x:0,y:0},this.screen={x:0,y:0}}get clientX(){return this.client.x}get clientY(){return this.client.y}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,n,r,s,a,o,l,h,c,u,d,p,f){throw new Error("Method not implemented.")}}class Ur extends jr{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}clone(){var t,e,i;const n=new Ur(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const r=this.composedDetailPath();return n.detailPath=r&&r.slice(),n.type=this.type,n}}class Wr extends jr{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const n=new Wr(this.manager);n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.detailPath=[],n.target=null,n.nativeEvent=this.nativeEvent,n.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,n),null===(e=this.manager)||void 0===e||e.copyMouseData(this,n),null===(i=this.manager)||void 0===i||i.copyData(this,n),n.target=this.target,n.path=this.composedPath().slice();const r=this.composedDetailPath();return n.detailPath=r&&r.slice(),n.type=this.type,n}}Wr.DOM_DELTA_PIXEL=0,Wr.DOM_DELTA_LINE=1,Wr.DOM_DELTA_PAGE=2;class Nr extends Dr{constructor(t,e){super(),this.type=t,this.detail=e}}const Gr="object"==typeof performance&&performance.now?performance:Date;function Fr(t){return"mouse"===t||"pen"===t}class zr{constructor(t,e){this.dispatch=new X,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof Ur))return void xt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Fr(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,n;if(!(t instanceof Ur))return void xt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(t,t.type,e),s=Fr(r.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==r.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),s&&this.dispatchEvent(i,"mouseout"),!r.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!r.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),s&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==r.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(r,e);this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==r.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(r,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let n=o;for(;n&&n!==this.rootTarget;)i.add(n),n=n.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(r,"pointermove"),"touch"===r.pointerType&&this.dispatchEvent(r,"touchmove"),s&&(this.dispatchEvent(r,"mousemove"),this.cursorTarget=r.target,this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=r.composedPath(),this.freeEvent(r)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof Ur))return void xt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(t.pointerId),s=this.createPointerEvent(t,t.type,e),a=Fr(s.pointerType);this.dispatchEvent(s,"pointerover"),a&&this.dispatchEvent(s,"mouseover"),"mouse"===s.pointerType&&(this.cursorTarget=s.target,this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(s,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;r.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Ur))return void xt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Fr(t.pointerType),n=this.findMountedTarget(i.overTargets),r=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(r),e&&this.dispatchEvent(r,"mouseout");const s=this.createPointerEvent(t,"pointerleave",n||void 0);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),e&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;i.overTargets=[],this.freeEvent(r),this.freeEvent(s)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Ur))return void xt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=Gr.now(),r=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if(Fr(r.pointerType)){const t=2===r.button;this.dispatchEvent(r,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),a=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=a;if(a&&!r.composedPath().includes(a)){let e=a;for(;e&&!r.composedPath().includes(e);){if(r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType)this.notifyTarget(r,"touchendoutside");else if(Fr(r.pointerType)){const t=2===r.button;this.notifyTarget(r,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(r,"click");e.target=o,e.path=[],e.detailPath=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:n});const a=s.clicksByButton[t.button];a.target===e.target&&n-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=n,e.detail=a.clickCount,Fr(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(r)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Ur))return void xt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),r=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType?this.notifyTarget(r,"touchendoutside"):Fr(r.pointerType)&&this.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(r)},this.onWheel=(t,e)=>{if(!(t instanceof Wr))return void xt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,n,r,s,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===n?void 0:n.stage)&&(null===(s=null===(r=this._prePointTargetCache)||void 0===r?void 0:r[c])||void 0===s?void 0:s.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e<i;e++)l[e].fn(t,h);else xt.getInstance().warn(`[EventManager]: Event mapping not defined for ${t.type}`)}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let n=0,r=i.length-1;n<r;n++)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){var n,r;const s=this.allocateEvent(Ur);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i||this.pickTarget(null!==(n=s.viewX)&&void 0!==n?n:s.global.x,null!==(r=s.viewY)&&void 0!==r?r:s.global.y,s),"string"==typeof e&&(s.type=e),s}createWheelEvent(t,e){var i,n;const r=this.allocateEvent(Wr);return this.copyWheelData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=e||this.pickTarget(null!==(i=r.viewX)&&void 0!==i?i:r.global.x,null!==(n=r.viewY)&&void 0!==n?n:r.global.y,r),r}clonePointerEvent(t,e){const i=this.allocateEvent(Ur);i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice();const n=t.composedDetailPath();return i.detailPath=n&&n.slice(),i.type=null!=e?e:i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ur&&e instanceof Ur&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof jr&&e instanceof jr&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.shiftKey=t.shiftKey,e.metaKey=t.metaKey,["client","movement","canvas","screen","global","offset","viewport"].forEach((i=>{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Gr.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].once&&t.currentTarget.removeEventListener(e,i[n].fn,{once:!0}),i[n].fn.call(i[n].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const i=t.currentTarget._events["*"];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let n=0,r=i.length;n<r&&!t.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,t,e)}pickTarget(t,e,i){let n;const r=this.rootTarget.pick(t,e);return n=r&&r.graphic?r.graphic:r&&r.group?r.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=r.params),n}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}}const Hr={dispatchEvent(t){var e;if(!(t instanceof Dr))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.detailPath&&(t.detailPath=[]),t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new Nr(t,e))}},Vr={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class Yr{constructor(t){this.resolution=1,this.onPointerDown=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t<i;t++){const i=e[t],n=this.bootstrapEvent(this.rootPointerEvent,i);this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerMove=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerUp=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=i.length;t<n;t++){const n=this.bootstrapEvent(this.rootPointerEvent,i[t]);n.type+=e,this.manager.mapEvent(n)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerOverOut=t=>{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){const i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.manager.mapEvent(i)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onWheel=t=>{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:n,global:r,autoPreventDefault:s=!1,clickInterval:a,supportsTouchEvents:o=r.supportsTouchEvents,supportsPointerEvents:l=r.supportsPointerEvents}=t;this.manager=new zr(n,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=r,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=r.supportsMouseEvents,this.applyStyles=r.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.rootPointerEvent=new Ur,this.rootWheelEvent=new Wr,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:n}=this;if(this.currentCursor===t)return;this.currentCursor=t;const r=this.cursorStyles[t];r?"string"==typeof r&&i?n.style.cursor=r:"function"==typeof r?r(t):"object"==typeof r&&i&&Object.assign(n.style,r):i&&rt(t)&&!dt(this.cursorStyles,t)&&(n.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const n=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(n)return n;let r=0,s=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};r=e.clientX||0,s=e.clientY||0}else r=t.clientX||0,s=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:r-a.left,y:s-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i<n;i++){const n=t.changedTouches[i];nt(n.button)&&(n.button=0),nt(n.buttons)&&(n.buttons=1),nt(n.isPrimary)&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),nt(n.width)&&(n.width=n.radiusX||1),nt(n.height)&&(n.height=n.radiusY||1),nt(n.tiltX)&&(n.tiltX=0),nt(n.tiltY)&&(n.tiltY=0),nt(n.pointerType)&&(n.pointerType="touch"),nt(n.pointerId)&&(n.pointerId=n.identifier||0),nt(n.pressure)&&(n.pressure=n.force||.5),nt(n.twist)&&(n.twist=0),nt(n.tangentialPressure)&&(n.tangentialPressure=0),nt(n.layerX)&&(n.layerX=n.offsetX=n.clientX),nt(n.layerY)&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const i=t;nt(i.isPrimary)&&(i.isPrimary=!0),nt(i.width)&&(i.width=1),nt(i.height)&&(i.height=1),nt(i.tiltX)&&(i.tiltX=0),nt(i.tiltY)&&(i.tiltY=0),nt(i.pointerType)&&(i.pointerType="mouse"),nt(i.pointerId)&&(i.pointerId=1),nt(i.pressure)&&(i.pressure=.5),nt(i.twist)&&(i.twist=0),nt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;const{x:i,y:n}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=n,e.global.x=i,e.global.y=n,e.offset.x=i,e.offset.y=n;const{x:r,y:s}=this.mapToViewportPoint(e);return e.viewport.x=r,e.viewport.y=s,e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:i,y:n}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=n,t.global.x=i,t.global.y=n,t.offset.x=i,t.offset.y=n;const{x:r,y:s}=this.mapToViewportPoint(t);return t.viewport.x=r,t.viewport.y=s,t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Vr[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Gr.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null}isEventOutsideOfTargetViewPort(t){if(this.isEventOutsideOfTargetElement(t))return!0;if(this.domElement.getViewBox){const e=this.mapToViewportPoint(this.mapToCanvasPoint(t)),i=this.domElement.getViewBox(),n=i.width(),r=i.height();return!(e.x<n&&e.y<r&&e.x>0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var Xr;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Xr||(Xr={}));class $r{static Avaliable(){return!!vn.global.getRequestAnimationFrame()}avaliable(){return $r.Avaliable()}tick(t,e){vn.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class qr{static Avaliable(){return!0}avaliable(){return qr.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class Kr extends X{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(),this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(),i||t.tick(this.interval,this.handleTick))},this._handlerTick=()=>{const t=this.tickerHandler.getTime();let e=0;this.lastFrameTime>=0&&(e=t-this.lastFrameTime),this.lastFrameTime=t,this.status===Xr.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(e)})),this.emit("afterTick"))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=Xr.INITIAL,vn.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),vn.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:$r},{mode:"timeout",cons:qr}];for(let e=0;e<t.length;e++)if(t[e].cons.Avaliable()){this.mode=t[e].mode;break}return null}setupTickHandler(){let t;switch(this._mode){case"raf":t=new $r;break;case"timeout":t=new qr;break;default:xt.getInstance().warn("非法的计时器模式"),t=new $r}return!!t.avaliable()&&(this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0)}setInterval(t){this.interval=t}getInterval(){return this.interval}setFPS(t){this.setInterval(1e3/t)}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Xr.INITIAL&&(this.status=Xr.PAUSE,!0)}resume(){return this.status!==Xr.INITIAL&&(this.status=Xr.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===Xr.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Xr.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=Xr.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Xr.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Xr.RUNNING&&this._handlerTick()}}class Zr{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Zr.Avaliable()}tick(t,e){this.time=Math.max(0,t+this.time),e(this,{once:!0})}tickTo(t,e){this.time=Math.max(0,t),e(this,{once:!0})}release(){this.timerId>0&&(this.timerId=-1)}getTime(){return this.time}}class Jr{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-Jr.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Jr.bounceIn(2*t):.5*Jr.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Rt/e)*.5+1}}}Jr.quadIn=Jr.getPowIn(2),Jr.quadOut=Jr.getPowOut(2),Jr.quadInOut=Jr.getPowInOut(2),Jr.cubicIn=Jr.getPowIn(3),Jr.cubicOut=Jr.getPowOut(3),Jr.cubicInOut=Jr.getPowInOut(3),Jr.quartIn=Jr.getPowIn(4),Jr.quartOut=Jr.getPowOut(4),Jr.quartInOut=Jr.getPowInOut(4),Jr.quintIn=Jr.getPowIn(5),Jr.quintOut=Jr.getPowOut(5),Jr.quintInOut=Jr.getPowInOut(5),Jr.backIn=Jr.getBackIn(1.7),Jr.backOut=Jr.getBackOut(1.7),Jr.backInOut=Jr.getBackInOut(1.7),Jr.elasticIn=Jr.getElasticIn(1,.3),Jr.elasticOut=Jr.getElasticOut(1,.3),Jr.elasticInOut=Jr.getElasticInOut(1,.3*1.5);class Qr{constructor(){this.id=e.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(e){if(this.paused)return;let i=this.animateHead;for(this.animateCount=0;i;)i.status===t.AnimateStatus.END?this.removeAnimate(i):i.status===t.AnimateStatus.RUNNING||i.status===t.AnimateStatus.INITIAL?(this.animateCount++,i.advance(e)):i.status===t.AnimateStatus.PAUSED&&this.animateCount++,i=i.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const ts=new Qr;class es{constructor(t,e,i,n,r){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=r,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class is extends es{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class ns{constructor(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.GenAutoIncrementId(),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ts,r=arguments.length>2?arguments[2]:void 0;this.id=i,this.timeline=n,this.status=t.AnimateStatus.INITIAL,this.tailAnimate=new rs(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=r}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Ot(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){ns.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ns.mode;e&&i&t.AnimateMode.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:t.AttributeUpdateType.ANIMATE_PLAY})}runCb(t){const e=new is((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,r,s){const a=ns.interpolateMap.get(t)||ns.interpolateMap.get("");return!!a&&a(t,e,i,n,r,s)}pause(){this.status===t.AnimateStatus.RUNNING&&(this.status=t.AnimateStatus.PAUSED)}resume(){this.status===t.AnimateStatus.PAUSED&&(this.status=t.AnimateStatus.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new rs(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(e){if(this._duringTime<this._startTime){if(this._duringTime+e*this.timeScale<this._startTime)return void(this._duringTime+=e*this.timeScale);e=this._duringTime+e*this.timeScale-this._startTime,this._duringTime=this._startTime}this.status===t.AnimateStatus.INITIAL&&(this.status=t.AnimateStatus.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(Math.max(this.rawPosition,0)+e*this.timeScale)&&this.status===t.AnimateStatus.RUNNING&&(this.status=t.AnimateStatus.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,r=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const s=t>=r;if(s&&(t=r),t===n)return s;for(let n=0;n<this.subAnimates.length&&(e=this.subAnimates[n],!(i+e.totalDuration>=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),s}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=t.AnimateStatus.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}ns.mode=t.AnimateMode.NORMAL,ns.interpolateMap=new Map;class rs{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new ss(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(e){let i=e.duration;(null==i||i<0)&&(i=0);const n=e.easing,r="string"==typeof n?Jr[n]:n,s=this._addStep(i,null,r);return s.type=t.AnimateStepType.customAnimate,this._appendProps(e.getEndProps(),s,!1),this._appendCustomAnimate(e,s),this}to(e,i,n,r){(null==i||i<0)&&(i=0);const s="string"==typeof n?Jr[n]:n,a=this._addStep(i,null,s);return a.type=t.AnimateStepType.to,this._appendProps(e,a,!!r&&r.tempProps),a.propKeys||(a.propKeys=Object.keys(a.props)),r&&r.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(a.propKeys)})),this}from(e,i,n,r){this.to(e,0,n,r);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,i,n,r),this.stepTail.type=t.AnimateStepType.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(e){if(e>0){const i=this._addStep(+e,null);i.type=t.AnimateStepType.wait,i.prev.customAnimate?i.props=i.prev.customAnimate.getEndProps():i.props=i.prev.props,this.target.onAddStep&&this.target.onAddStep(i)}return this}_addStep(t,e,i){const n=new ss(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const r=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===r[t]&&(r[t]=n.props[t])}))),e.propKeys=Object.keys(e.props),n=n.prev;const s=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(r)),e.propKeys.forEach((t=>{if(void 0===s[t]){const e=this.animate.getStartProps();s[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,r=this.rawPosition;let s,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t<l)return this.rawPosition=t,!1;if(t-=l,i<=0&&(o=!0,i<0))return o;if(s=Math.floor(t/i),a=t-s*i,o=t>=n*i+i,o&&(a=i,s=n,t=a*s+i),t===r)return o;const h=!this.reversed!=!(this.bounce&&s%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,r=this.duration;if(this.target&&i){let s=i.next;for(;s&&s.position<=n;)i=s,s=i.next;let a=t?0===r?1:n/r:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return xt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class ss{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const as={duration:200,easing:"cubicOut"},os={duration:1e3,easing:"quadInOut"};var ls;t.Edge=void 0,(ls=t.Edge||(t.Edge={}))[ls.Top=1]="Top",ls[ls.Right=2]="Right",ls[ls.Bottom=4]="Bottom",ls[ls.Left=8]="Left",ls[ls.ALL=15]="ALL";const hs=[!1,!1,!1,!1],cs=t=>{var e;let i=!0;if(q(t,!0)){for(let n=0;n<4;n++)hs[n]=t,i&&(i=!(null!==(e=hs[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)hs[e]=!!t[e],i&&(i=!!hs[e]);else hs[0]=!1,hs[1]=!1,hs[2]=!1,hs[3]=!1;return{isFullStroke:i,stroke:hs}},us=[0,0,0,0],ds=t=>t?st(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(us[0]=t[0],us[2]=t[0],us[1]=t[1],us[3]=t[1],us):t:t:0,ps=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],fs=[1,2,3,0,1,2,3,0];function gs(t,e,i,n){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;ps[0].x=i,ps[1].y=i,ps[2].x=-i,ps[3].y=-i;const r=Math.ceil(t/Bt)%4,s=Math.ceil(e/Bt)%4;if(n.add(kt(t)*i,It(t)*i),n.add(kt(e)*i,It(e)*i),r!==s||e-t>_t){let t=!1;for(let e=0;e<fs.length;e++)if(t||r!==fs[e]){if(t&&s===fs[e])break;if(t){const t=ps[fs[e]];n.add(t.x,t.y)}}else{t=!0;const e=ps[r];n.add(e.x,e.y)}}}function vs(t,e){return t.x===e.x&&t.y===e.y&&t.x1===e.x1&&t.y1===e.y1&&t.defined===e.defined}function ms(t,e,i){const{x:n,y:r}=Wt(t.x,t.y,e.x,e.y,i),{x:s,y:a}=Wt(t.x1,t.y1,e.x1,e.y1,i),o=new Ft(n,r,s,a);return o.defined=e.defined,o}function ys(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let n=[];if(t.length>e.length){n=e.map((t=>{const e=new Ft(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<e.length;r++)n[r]=ms(t[r],e[r],i)}else{n=e.map((t=>{const e=new Ft(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<t.length;r++)n[r]=ms(t[r],e[r],i)}return n}const bs=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],xs=t=>bs.includes(t);function ws(t,e){if(st(t)){let i;for(let n=0;n<t.length&&void 0===i;n++)i=t[n][e];return i}return t[e]}class Ss{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ss.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Ss.TimeOut=1e3/60;const As=new Ss,Ts=(t,e)=>rt(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,Cs=(t,e)=>{const i=Ts(t,e);return isNaN(i)?i:Math.max(e,i)};var _s;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(_s||(_s={}));class Bs extends es{constructor(t,e,i,n,r){super(null,null,i,n,r),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==r?void 0:r.group,this._clipGraphic=null==r?void 0:r.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:t.AttributeUpdateType.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:t.AttributeUpdateType.ANIMATE_END})}onUpdate(e,i,n){if(!this._clipGraphic)return;const r={};Object.keys(this.clipFromAttribute).forEach((t=>{r[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*i})),this._clipGraphic.setAttributes(r,!1,{type:t.AttributeUpdateType.ANIMATE_UPDATE,animationState:{ratio:i,end:e}})}}function Ps(t,e,i,n,r,s){const a=(e-t)*r+t,o=(i-e)*r+e,l=(n-i)*r+i,h=(o-a)*r+a,c=(l-o)*r+o,u=(c-h)*r+h;s[0]=t,s[1]=a,s[2]=h,s[3]=u,s[4]=u,s[5]=c,s[6]=l,s[7]=n}function Rs(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const r=[],s=[],a=i<n?t:e,o=Math.min(i,n),l=Math.abs(n-i)/6,h=(o-2)/6,c=Math.ceil(l/h),u=[a[0],a[1]];let d=l;for(let t=2;t<o;t+=6){let e=a[t-2],i=a[t-1],n=a[t],o=a[t+1],l=a[t+2],h=a[t+3];const p=a[t+4],f=a[t+5];if(d<=0){u.push(n,o,l,h,p,f);continue}const g=Math.min(d,c)+1;for(let t=1;t<=g;t++){const a=t/g;Ps(e,n,l,p,a,r),Ps(i,o,h,f,a,s),e=r[3],i=s[3],u.push(r[1],s[1],r[2],s[2],e,i),n=r[5],o=s[5],l=r[6],h=s[6]}d-=g-1}return a===t?[u,e]:[t,u]}function Ms(t,e){const i=t||e,n=i.length,r=i[n-2],s=i[n-1],a=[];for(let t=0;t<e.length;t+=2)a[t]=r,a[t+1]=s;return a}function Es(t){const e=[],i=t.length;for(let n=0;n<i;n+=2)e[n]=t[i-n-2],e[n+1]=t[i-n-1];return e}function ks(t){let e=0,i=0,n=0;const r=t.length;for(let s=0,a=r-2;s<r;a=s,s+=2){const r=t[a],o=t[a+1],l=t[s],h=t[s+1],c=r*h-l*o;e+=c,i+=(r+l)*c,n+=(o+h)*c}return 0===e?[t[0]||0,t[1]||0,0]:[i/e/3,n/e/3,e]}function Os(t,e,i,n){const r=(t.length-2)/6;let s=1/0,a=0;const o=t.length,l=o-2;for(let h=0;h<r;h++){const r=6*h;let c=0;for(let s=0;s<o;s+=2){const a=0===s?r:(r+s-2)%l+2,o=t[a]-i[0],h=t[a+1]-i[1],u=e[s]-n[0]-o,d=e[s+1]-n[1]-h;c+=u*u+d*d}c<s&&(s=c,a=h)}return a}function Ls(t,e,i,n){const r=[];let s;for(let a=0;a<t.length;a++){let o=t[a];const l=e[a],h=ks(o),c=ks(l);null==s&&(s=h[2]<0!=c[2]<0);const u=[],d=[];let p=0,f=1/0;const g=[],v=o.length;s&&(o=Es(o));const m=6*Os(o,l,h,c),y=v-2;for(let t=0;t<y;t+=2){const e=(m+t)%y+2;u[t+2]=o[e]-h[0],u[t+3]=o[e+1]-h[1]}if(u[0]=o[m]-h[0],u[1]=o[m+1]-h[1],i>0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e<o.length;e+=2){const r=u[e],s=u[e+1],a=l[e]-c[0],o=l[e+1]-c[1],h=a*i-o*t,d=a*t+o*i;g[e]=h,g[e+1]=d;const p=h-r,f=d-s;n+=p*p+f*f}if(n<f){f=n,p=e;for(let t=0;t<g.length;t++)d[t]=g[t]}}}else for(let t=0;t<v;t+=2)d[t]=l[t]-c[0],d[t+1]=l[t+1]-c[1];r.push({from:u,to:d,fromCp:h,toCp:c,rotation:-p})}return r}function Is(t,e){let i,n;const r=[],s=[];for(let a=0;a<Math.max(t.length,e.length);a++){const o=t[a],l=e[a];let h,c;o?l?([h,c]=Rs(o,l),i=h,n=c):(c=Ms(n,o),h=o):(h=Ms(i,l),c=l),r.push(h),s.push(c)}return[r,s]}const Ds=(t,e,i,n,r)=>{At(e,n)&&At(i,r)||t.push(e,i,n,r,n,r)};function js(t){const e=t.commandList,i=[];let n,r=0,s=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,u,d;for(let t=0,i=e.length;t<i;t++){const i=e[t],p=0===t;switch(p&&(a=r=i[1],o=s=i[2],[Me.L,Me.C,Me.Q].includes(i[0])&&(n=[a,o])),i[0]){case Me.M:r=a=i[1],s=o=i[2],l(a,o);break;case Me.L:h=i[1],c=i[2],Ds(n,r,s,h,c),r=h,s=c;break;case Me.C:n.push(i[1],i[2],i[3],i[4],r=i[5],s=i[6]);break;case Me.Q:h=i[1],c=i[2],u=i[3],d=i[4],n.push(r+2/3*(h-r),s+2/3*(c-s),u+2/3*(h-u),d+2/3*(c-d),u,d),r=u,s=d;break;case Me.A:{const t=i[1],e=i[2],u=i[3],d=u,f=i[4],g=i[5],v=!!i[6];h=Math.cos(f)*u+t,c=Math.sin(f)*u+e,p?(a=h,o=c,l(a,o)):Ds(n,r,s,h,c),r=Math.cos(g)*u+t,s=Math.sin(g)*u+e;const m=(v?-1:1)*Math.PI/2;for(let i=f;v?i>g:i<g;i+=m){const r=v?Math.max(i+m,g):Math.min(i+m,g);qe(n,i,r,t,e,u,d)}break}case Me.E:{const t=i[1],e=i[2],u=i[3],d=i[4],f=i[5],g=i[6],v=i[7]+g,m=!!i[8],y=!At(f,0),b=Math.cos(f),x=Math.sin(f);let w=Math.cos(g)*u,S=Math.sin(g)*d;y?(h=w*b-S*x+t,c=w*x+S*b+e):(h=w+t,c=S+e),p?(a=h,o=c,l(a,o)):Ds(n,r,s,h,c),w=Math.cos(v)*u,S=Math.sin(v)*d,y?(r=w*b-S*x+t,s=w*x+S*b+e):(r=w+t,s=S+e);const A=(m?-1:1)*Math.PI/2;for(let i=g;m?i>v:i<v;i+=A){const r=m?Math.max(i+A,v):Math.min(i+A,v);if(qe(n,i,r,t,e,u,d),y){const i=n.length;for(let r=i-6;r<=i-1;r+=2)w=n[r],S=n[r+1],n[r]=(w-t)*b-(S-e)*x+t,n[r+1]=(w-t)*x+(S-e)*b+e}}break}case Me.R:a=r=i[1],o=s=i[2],h=a+i[3],c=o+i[4],l(h,o),Ds(n,h,o,h,c),Ds(n,h,c,a,c),Ds(n,a,c,a,o),Ds(n,a,o,h,o);break;case Me.AT:{const t=i[1],e=i[2],l=i[3],h=i[4],c=i[5],u=zt.distancePP({x:r,y:s},{x:t,y:e}),d=zt.distancePP({x:l,y:h},{x:t,y:e}),p=((r-t)*(l-t)+(s-e)*(h-e))/(u*d),f=c/Math.sin(p/2),g=(r+l-2*t)/2,v=(s+h-2*e)/2,m=zt.distancePP({x:g,y:v},{x:0,y:0}),y=t+f*g/m,b=l+f*v/m,x=Math.sqrt(f*f-c*c);a=t+x*(r-t)/u,o=e+x*(s-e)/u,Ds(n,r,s,a,o),r=t+x*(l-t)/d,s=e+x*(h-e)/d;const w=Yt({x:y,y:b},{x:a,y:o}),S=Yt({x:y,y:b},{x:r,y:s});qe(n,w,S,y,b,c,c);break}case Me.Z:n&&Ds(n,r,s,a,o),r=a,s=o}}return n&&n.length>2&&i.push(n),i}function Us(t,e){for(let i=0;i<t.length;i++){const n=t[i];for(let t=0;t<n.length;t+=2){const i=n[t],r=n[t+1],s={x:i,y:r};e.transformPoint({x:i,y:r},s),n[t]=s.x,n[t+1]=s.y}}}function Ws(t){const e=new Wi;for(let i=0;i<t.length;i++){const n=t[i];if(n.length>2){e.moveTo(n[0],n[1]);for(let t=2;t<n.length;t+=6)e.bezierCurveTo(n[t],n[t+1],n[t+2],n[t+3],n[t+4],n[t+5])}}return e}const Ns=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=Z(t.width)?t.x1-t.x:t.width,i=Z(t.height)?t.y1-t.y:t.height,n=0,r=0;return e<0?(n=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(r=i,i=-i):Number.isNaN(i)&&(i=0),{x:n,y:r,width:e,height:i}};function Gs(t,e,i){const n=t/e;let r,s;t>=e?(s=Math.ceil(Math.sqrt(i*n)),r=Math.floor(i/s),0===r&&(r=1,s=i)):(r=Math.ceil(Math.sqrt(i/n)),s=Math.floor(i/r),0===s&&(s=1,r=i));const a=[];for(let t=0;t<r;t++)a.push(s);const o=i-r*s;if(o>0)for(let t=0;t<o;t+=s)t+s<o?a.push(s):a.push(o-t);return a}const Fs=(t,e)=>{const{width:i,height:n}=Ns(t.attribute),r=Gs(i,n,e),s=[],a=n/r.length;for(let t=0,e=r.length;t<e;t++){const e=r[t],n=i/e;for(let i=0;i<e;i++)s.push({x:0+i*n,y:0+t*a,width:n,height:a})}return s},zs=(t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,r=i.endAngle,s=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-r),l=Math.abs(a-s),h=Gs(o*(s+a)/2,l,e),c=[],u=l/h.length,d=a>=s?1:-1,p=r>=n?1:-1;for(let t=0,e=h.length;t<e;t++){const e=h[t],i=o/e;for(let r=0;r<e;r++)c.push({innerRadius:a-u*t*d,outerRadius:a-u*(t+1)*d,startAngle:n+i*r*p,endAngle:n+i*(r+1)*p})}return c},Hs=(t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),r=t.getComputedAttribute("radius"),s=Math.abs(i-n),a=Gs(s*r,r,e),o=[],l=s/a[0],h=r/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t<e;t++)for(let e=0,n=a[t];e<n;e++)o.push({innerRadius:h*t,outerRadius:h*(t+1),startAngle:i+l*e*c,endAngle:i+l*(e+1)*c});return o},Vs=(t,e)=>{const i=t.filter((t=>!1!==t.defined&&ot(t.x)&&ot(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let r=0,s=0;for(;r<e;)n.push(i[Math.floor(s)]),s+=t,r++;return n}const r=e-i.length,s=1/(r/(i.length-1)+1);let a=0;for(let e=0,i=t.length;e<i;e++)if(n.push(t[e]),e<i-1){let i=s;const o=t[e].x,l=t[e].y,h=t[e+1].x,c=t[e+1].y;for(;i<1&&a<r;)n.push({x:o+(h-o)*i,y:l+(c-l)*i}),i+=s,a+=1}return n},Ys=(t,e)=>{var i,n;const r=t.attribute;let s=r.points;const a=r.segments;s||(s=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=s.filter((t=>!1!==t.defined&&ot(t.x)&&ot(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return Zs(s,e,h),h},Xs=(t,e)=>{const i=t.attribute,n=i.points;if(n)return Vs(n,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Vs(t,e)}return[]};const $s=t=>t.map((t=>({x:t.x,y:t.y}))),qs=(t,e,i)=>{const n=t.length,r=[];for(let o=0;o<n;o++){const l=t[o],h=o===n-1?t[0]:t[o+1],c=$t([e.x,e.y],[i.x,i.y],[l.x,l.y],[h.x,h.y]);c&&"boolean"!=typeof c&&r.push({dot:(s=[c[0]-e.x,c[1]-e.x],a=[i.x-e.x,i.y-e.x],s[0]*a[1]-s[1]*a[0]),point:{x:c[0],y:c[1]},edgeIndex:o})}var s,a;if(r.length<2)return[$s(t),$s(t)];r.sort(((t,e)=>t.dot-e.dot));let o=r[0],l=r[r.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},Ks=t=>{const e=new oe;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return qs(t,{x:n,y:e.y1},{x:n,y:e.y2})}const r=e.y1+n/2;return qs(t,{x:e.x1,y:r},{x:e.x2,y:r})},Zs=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),r=Ks(t);Zs(r[0],n,i),Zs(r[1],e-n,i)}},Js=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:$s(i)}];const n=[];return Zs(i,e,n),n},Qs=(t,e)=>{const i=js(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],r=Math.floor(i.length/e);for(let s=0;s<e;s++){const a=i.slice(s*r,s===e-1?n:(s+1)*r);t.push({path:Ws(a)})}return t}const r=[],s=Math.floor(e/n);let a=e;for(let t=0;t<n;t++){const e=[];for(let n=2,r=i[t].length;n<r;n+=2)e.push({x:i[0][n],y:i[0][n+1]});Zs(e,t===n-1?a:s,r),a-=s}return r};var ta;t.ColorType=void 0,(ta=t.ColorType||(t.ColorType={}))[ta.Color255=0]="Color255",ta[ta.Color1=1]="Color1";class ea{static Get(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.ColorType.Color1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(i===t.ColorType.Color1){const t=ea.store1[e];if(t)return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n;const i=Se.parseColorString(e);if(i){const t=[i.r/255,i.g/255,i.b/255,i.opacity];ea.store1[e]=t,ea.store255[e]=[i.r,i.g,i.b,i.opacity],n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3]}return n}const r=ea.store255[e];if(r)return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n;const s=Se.parseColorString(e);return s&&(ea.store1[e]=[s.r/255,s.g/255,s.b/255,s.opacity],ea.store255[e]=[s.r,s.g,s.b,s.opacity],n[0]=s.r,n[1]=s.g,n[2]=s.b,n[3]=s.opacity),n}static Set(e,i,n){if(i===t.ColorType.Color1){if(ea.store1[e])return;ea.store1[e]=n,ea.store255[e]=[Math.floor(255*n[0]),Math.floor(255*n[1]),Math.floor(255*n[2]),Math.floor(255*n[3])]}else{if(ea.store255[e])return;ea.store255[e]=n,ea.store1[e]=[n[0]/255,n[1]/255,n[2]/255,n[3]]}}}function ia(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&ot(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function na(t,e,i,n,r){return Array.isArray(t)&&!ot(t[0])||Array.isArray(e)&&!ot(e[0])?new Array(4).fill(0).map(((r,s)=>ra(st(t)?t[s]:t,st(e)?e[s]:e,i,n))):ra(t,e,i,n,r)}function ra(e,i,n,r,s){if(!e||!i)return e&&ia(e)||i&&ia(i)||!1;let a,o,l=!1,h=!1;if(Array.isArray(e)?a=e:"string"==typeof e?a=ea.Get(e,t.ColorType.Color255):l=!0,Array.isArray(i)?o=i:"string"==typeof i?o=ea.Get(i,t.ColorType.Color255):h=!0,l!==h){const t=l?e:i,a=l?i:e,o=Object.assign(Object.assign({},t),{stops:t.stops.map((t=>Object.assign(Object.assign({},t),{color:ia(a)})))});return l?na(t,o,n,r,s):na(o,t,n,r,s)}if(l){if(e.gradient===i.gradient){const t=e,r=i,s=t.stops,a=r.stops;if(s.length!==a.length)return!1;if("linear"===t.gradient)return sa(t,r,n);if("radial"===t.gradient)return aa(t,r,n);if("conical"===t.gradient)return oa(t,r,n)}return!1}return s&&s(a,o),ia(la(a,o,n),r)}function sa(t,e,i){const n=t.stops,r=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:ua(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}function aa(t,e,i){const n=t.stops,r=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:ua(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}function oa(t,e,i){const n=t.stops,r=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:ua(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}function la(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}ea.store255={},ea.store1={};const ha=[0,0,0,0],ca=[0,0,0,0];function ua(e,i,n){return ea.Get(e,t.ColorType.Color255,ha),ea.Get(i,t.ColorType.Color255,ca),`rgba(${Math.round(ha[0]+(ca[0]-ha[0])*n)},${Math.round(ha[1]+(ca[1]-ha[1])*n)},${Math.round(ha[2]+(ca[2]-ha[2])*n)},${ha[3]+(ca[3]-ha[3])*n})`}const da=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const n=na(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},pa=(t,e,i)=>{const n=[],r=[];e.clear();for(let s=0;s<t.length;s++){const a=t[s],o=a.from,l=a.to,h=a.rotation*i,c=a.fromCp,u=a.toCp,d=Math.sin(h),p=Math.cos(h);r[0]=c[0]+(u[0]-c[0])*i,r[1]=c[1]+(u[1]-c[1])*i;for(let t=0;t<o.length;t+=2){const e=o[t],s=o[t+1],a=e*(1-i)+l[t]*i,h=s*(1-i)+l[t+1]*i;n[t]=a*p-h*d+r[0],n[t+1]=a*d+h*p+r[1]}let f=n[0],g=n[1];e.moveTo(f,g);for(let t=2;t<o.length;t+=6){const i=n[t],r=n[t+1],s=n[t+2],a=n[t+3],o=n[t+4],l=n[t+5];f===i&&g===r&&s===o&&a===l?e.lineTo(o,l):e.bezierCurveTo(i,r,s,a,o,l),f=o,g=l}}},fa=(t,e,i)=>{const n=t?js(t):[],r=js(e);i&&n&&(i.fromTransform&&Us(n,i.fromTransform.clone().getInverse()),Us(n,i.toTransfrom));const[s,a]=Is(n,r);return t?Ls(s,a,10,Math.PI):a.map(((t,e)=>({from:s[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},ga=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],va=(e,i)=>{if(!e||!i)return null;const n=[];let r=!1;return Object.keys(e).forEach((s=>{if(!ga.includes(s))return;const a=i[s];Z(a)||Z(e[s])||a===e[s]||("fill"===s||"stroke"===s?n.push({from:"string"==typeof e[s]?ea.Get(e[s],t.ColorType.Color255):e[s],to:"string"==typeof a?ea.Get(a,t.ColorType.Color255):a,key:s}):n.push({from:e[s],to:a,key:s}),r=!0)})),r?n:null};class ma extends es{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,r="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;pa(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&da(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ya=(t,e,i,n)=>{var r,s,a;if(t&&(!t.valid||!t.toCustomPath))return __DEV__&&console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return __DEV__&&console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=fa(null===(r=null==t?void 0:t.toCustomPath)||void 0===r?void 0:r.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=va(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new ma({morphingData:l,otherAttrs:h},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:os.duration,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:os.easing)),c};class ba extends es{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;pa(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&da(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const xa=t=>{const e={};return Object.keys(t).forEach((i=>{xs(i)||(e[i]=t[i])})),e},wa=(t,e,i)=>{const n=xa(t.attribute),r=t.attachShadow();if(e.length)r.setTheme({[e[0].type]:n}),e.forEach((t=>{t.setAttributes({pickable:!1}),r.appendChild(t)}));else{const s=t.AABBBounds,a=s.width(),o=s.height();r.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=vn.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});r.appendChild(i),e.push(i)}))}},Sa=(t,e,i)=>{const n=[],r=i?null:xa(t.attribute),s=t.toCustomPath();for(let t=0;t<e;t++){const t={path:(new Wi).fromCustomPath2D(s)};n.push(vn.graphicService.creator.path(i?t:Object.assign({},r,t)))}return i&&wa(t,n,e),n},Aa=(t,e,i)=>{const n=[],r=i?null:xa(t.attribute);if("rect"===t.type)Fs(t,e).forEach((t=>{n.push(vn.graphicService.creator.rect(i?t:Object.assign({},r,t)))}));else if("arc"===t.type)zs(t,e).forEach((t=>{n.push(vn.graphicService.creator.arc(i?t:Object.assign({},r,t)))}));else if("circle"===t.type)Hs(t,e).forEach((t=>{n.push(vn.graphicService.creator.arc(i?t:Object.assign({},r,t)))}));else if("line"===t.type){const s=Xs(t,e),a={size:10,symbolType:"circle"};s.forEach((t=>{n.push(vn.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},r,t,a)))}))}else"polygon"===t.type?Js(t,e).forEach((t=>{n.push(vn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))})):"area"===t.type?Ys(t,e).forEach((t=>{n.push(vn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))})):"path"===t.type&&Qs(t,e).forEach((t=>{"path"in t?n.push(vn.graphicService.creator.path(i?t:Object.assign({},r,t))):n.push(vn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))}));return i&&wa(t,n,e),n};class Ta{static GetImage(t,e){var i;const n=Ta.cache.get(t);n?"fail"===n.loadState?vn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):Ta.loadImage(t,e)}static GetSvg(t,e){var i;let n=Ta.cache.get(t);n?"fail"===n.loadState?vn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,n.data):(n={type:"image",loadState:"init"},Ta.cache.set(t,n),n.dataPromise=vn.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,r)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))})),n.waitingMark&&(n.waitingMark=[])}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Ta.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Ta.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=vn.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=vn.global.loadBlob(t):"json"===e&&(i.dataPromise=vn.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Ta.isLoading&&Ta.toLoadAueue.length){Ta.isLoading=!0;const t=Ta.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,r={type:"image",loadState:"init"};if(Ta.cache.set(i,r),r.dataPromise=vn.global.loadImage(i),r.dataPromise){r.waitingMark=n;const t=r.dataPromise.then((t=>{var e;r.loadState=(null==t?void 0:t.data)?"success":"fail",r.data=null==t?void 0:t.data,null===(e=r.waitingMark)||void 0===e||e.map(((e,n)=>{(null==t?void 0:t.data)?(r.loadState="success",r.data=t.data,e.imageLoadSuccess(i,t.data)):(r.loadState="fail",e.imageLoadFail(i))})),r.waitingMark&&(r.waitingMark=[])}));e.push(t)}else r.loadState="fail",n.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Ta.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ta.loading()})).catch((t=>{console.error(t),Ta.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ta.loading()}))}}),0)}static loadImage(t,e){const i=Ca(t,Ta.toLoadAueue);if(-1!==i)return Ta.toLoadAueue[i].marks.push(e),void Ta.loading();Ta.toLoadAueue.push({url:t,marks:[e]}),Ta.loading()}static improveImageLoading(t){const e=Ca(t,Ta.toLoadAueue);if(-1!==e){const t=Ta.toLoadAueue.splice(e,1);Ta.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Ca(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}Ta.cache=new Map,Ta.isLoading=!1,Ta.toLoadAueue=[],Ta.onLoadSuccessCb=[];const _a=new ce,Ba=new le,Pa=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Ra=["x","y"],Ma=["scaleX","scaleY"],Ea=["angle"],ka=new Ft,Oa={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class La extends Ir{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(La.prototype,n,Object.getOwnPropertyDescriptor(t,n))}}get AABBBounds(){return this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode)}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var i;super(),this._AABBBounds=new le,this._updateTag=t.UpdateTag.INIT,this.attribute=e,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,e.background?this.loadImage(null!==(i=e.background.background)&&void 0!==i?i:e.background,!0):e.shadowGraphic&&this.setShadowGraphic(e.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,n;const{dx:r=t.dx,dy:s=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;ka.x=r+(null!==(i=t.scrollX)&&void 0!==i?i:0),ka.y=s+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else ka.x=r,ka.y=s;return ka}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;vn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return vn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new he),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,n=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:r=e.boundsPadding}=i,s=ds(r);return s&&n.expand(s),this.clearUpdateBoundTag(),n}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new _e(t);return Ze(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ce),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&vn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)&&vn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&t.UpdateTag.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&t.UpdateTag.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=t.UpdateTag.CLEAR_SHAPE}containsPoint(e,i,n,r){if(!r)return!1;if(n===t.IContainPointMode.GLOBAL){const t=new Ft(e,i);this.parent&&this.parent.globalTransMatrix.transformPoint(t,t),e=t.x,i=t.y}return r.containsPoint(this,{x:e,y:i})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e<n.length;e++){const i=n[e];this.attribute[i]=t[i]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(n)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,n){var r;const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,n);s?this._setAttributes(s,i,n):Z(null===(r=this.normalAttrs)||void 0===r?void 0:r[t])?(this.attribute[t]=e,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n)):this.normalAttrs[t]=e,"background"===t?this.loadImage(e,!0):"shadowGraphic"===t&&this.setShadowGraphic(e)}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pa;for(let i=0;i<e.length;i++){const n=e[i];if(-1!==t.indexOf(n))return!0}return!1}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pa;for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(e){const i={type:t.AttributeUpdateType.INIT};e=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(e,this.attribute,null,i)||e,this.attribute=e,e.background?this.loadImage(e.background,!0):e.shadowGraphic&&this.setShadowGraphic(e.shadowGraphic),this._updateTag=t.UpdateTag.INIT,this.valid=this.isValid(),this.onAttributeUpdate(i)}translate(e,i){var n,r;if(0===e&&0===i)return this;const s={type:t.AttributeUpdateType.TRANSLATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:e,y:i},this.attribute,Ra,s);a&&(e=a.x,i=a.y,delete a.x,delete a.y,this._setAttributes(a));const o=this.attribute,l=o.postMatrix;return l?vn.transformUtil.fromMatrix(l,l).translate(e,i):(o.x=(null!==(n=o.x)&&void 0!==n?n:zi.x)+e,o.y=(null!==(r=o.y)&&void 0!==r?r:zi.y)+i),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}translateTo(e,i){const n=this.attribute;if(n.x===e&&n.y===i)return this;const r={type:t.AttributeUpdateType.TRANSLATE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:e,y:i},this.attribute,Ra,r);return s?(this._setAttributes(s,!1,r),this):(n.x=e,n.y=i,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}scale(e,i,n){var r,s;if(1===e&&1===i)return this;const a={type:t.AttributeUpdateType.SCALE},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:e,scaleY:i,scaleCenter:n},this.attribute,Ma,a);o&&(e=o.scaleX,i=o.scaleY,delete o.scaleX,delete o.scaleY,this._setAttributes(o));const l=this.attribute;if(n){let{postMatrix:t}=this.attribute;t||(t=new ce,l.postMatrix=t),vn.transformUtil.fromMatrix(t,t).scale(e,i,n)}else l.scaleX=(null!==(r=l.scaleX)&&void 0!==r?r:zi.scaleX)*e,l.scaleY=(null!==(s=l.scaleY)&&void 0!==s?s:zi.scaleY)*i;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(a),this}scaleTo(e,i){const n=this.attribute;if(n.scaleX===e&&n.scaleY===i)return this;const r={type:t.AttributeUpdateType.SCALE_TO},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:e,scaleY:i},this.attribute,Ma,r);return s?(this._setAttributes(s,!1,r),this):(n.scaleX=e,n.scaleY=i,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}rotate(e,i){var n;if(0===e)return this;const r={type:t.AttributeUpdateType.ROTATE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:e,rotateCenter:i},this.attribute,Ea,r);s&&(delete s.angle,this._setAttributes(s,!1,r));const a=this.attribute;if(i){let{postMatrix:t}=this.attribute;t||(t=new ce,a.postMatrix=t),vn.transformUtil.fromMatrix(t,t).rotate(e,i)}else a.angle=(null!==(n=a.angle)&&void 0!==n?n:zi.angle)+e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}rotateTo(e){const i=this.attribute;if(i.angle===e)return this;const n={type:t.AttributeUpdateType.ROTATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(e,this.attribute,Ea,n);return r?(this._setAttributes(r,!1,n),this):(i.angle=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this)}skewTo(t,e){return this}animate(t){this.animates||(this.animates=new Map);const e=new ns(null==t?void 0:t.id,this.stage&&this.stage.getTimeline(),null==t?void 0:t.slience);if(e.bind(this),t){const{onStart:i,onFrame:n,onEnd:r,onRemove:s}=t;null!=i&&e.onStart(i),null!=n&&e.onFrame(n),null!=r&&e.onEnd(r),null!=s&&e.onRemove(s),e.interpolateFunc=t.interpolate}return this.animates.set(e.id,e),e.onRemove((()=>{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(vn.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!Z(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(e,i,n,r){var s,a,o,l;if(n){const n=Object.keys(e),h=this.getNoWorkAnimateAttr(),c={};let u;n.forEach((t=>{h[t]?(u||(u={}),u[t]=e[t]):c[t]=r&&void 0===e[t]?this.getDefaultAttribute(t):e[t]}));const d=this.animate({slience:!0});d.stateNames=i,d.to(c,null!==(a=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==a?a:as.duration,null!==(l=null===(o=this.stateAnimateConfig)||void 0===o?void 0:o.easing)&&void 0!==l?l:as.easing),u&&this.setAttributes(u,!1,{type:t.AttributeUpdateType.STATE})}else this.stopStateAnimates(),this.setAttributes(e,!1,{type:t.AttributeUpdateType.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();dt(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const r=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(r,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const r=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];r&&Object.assign(n,r)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=t.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=t.UpdateTag.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=t.UpdateTag.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&t.UpdateTag.UPDATE_SHAPE_AND_BOUNDS)===t.UpdateTag.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=t.UpdateTag.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=t.UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=t.UpdateTag.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=t.UpdateTag.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=t.UpdateTag.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=t.UpdateTag.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=t.UpdateTag.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&t.UpdateTag.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],n=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:n}=this.attribute;return Ba.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Ba),this.setAttributes({scaleX:t,scaleY:i,angle:n}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,r=n();i[0]=r.x1+(r.x2-r.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,r=n();i[1]=r.y1+(r.y2-r.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=zi.x,y:e=zi.y,scaleX:i=zi.scaleX,scaleY:n=zi.scaleY,angle:r=zi.angle,scaleCenter:s,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!s||1===i&&1===n)!function(t,e,i,n,r,s,a,o){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,f=kt(a),g=It(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,b=m-n,x=l*f+c*g,w=h*f+u*g,S=c*f-l*g,A=u*f-h*g;t.a=r*x,t.b=r*w,t.c=s*S,t.d=s*A,t.e=d+l*v+c*m-x*y-S*b,t.f=p+h*v+u*m-w*y-A*b}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,r,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(r),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(s,h),vn.transformUtil.fromMatrix(a,a).scale(i,n,{x:l[0],y:l[1]})}const c=this.getOffsetXY(zi);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=_a.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),vn.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(e){e&&this.setAttributes(e,!1,{type:t.AttributeUpdateType.ANIMATE_END})}onStep(e,i,n,r,s){const a={};if(n.customAnimate)n.customAnimate.update(s,r,a);else{const t=n.props,o=n.parsedProps,l=n.propKeys;this.stepInterpolate(e,i,a,n,r,s,t,void 0,o,l)}this.setAttributes(a,!1,{type:t.AttributeUpdateType.ANIMATE_UPDATE,animationState:{ratio:r,end:s,step:n,isFirstFrameOfStep:e.getLastStep()!==n}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,r,s,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),s?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((s=>{var h;if(!e.validAttr(s))return;const c=a[s],u=null!==(h=o&&o[s])&&void 0!==h?h:t.getLastPropByName(s,n);if(null==c||null==u||c===u)return void(i[s]=c);let d;d=e.interpolateFunc&&e.interpolateFunc(s,r,u,c,i),d||(d=e.customInterpolate(s,r,u,c,this,i),d||this.defaultInterpolate(c,u,s,i,l,r)||this._interpolate(s,r,u,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,r,s){if(Number.isFinite(t))return n[i]=e+(t-e)*s,!0;if("fill"===i){r||(r={});const a=r.fillColorArray,o=na(e,null!=a?a:t,s,!1,((t,e)=>{r.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){r||(r={});const a=r.strokeColorArray,o=na(e,null!=a?a:t,s,!1,((t,e)=>{r.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){r||(r={});const a=r.shadowColorArray,o=na(e,null!=a?a:t,s,!0,((t,e)=>{r.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,r){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:vn.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return rt(t,!0)?this.pathProxy=(new Wi).fromString(t):this.pathProxy=new Wi,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",t.startsWith("<svg")?(Ta.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(ht(t)||t.includes("/")||ct(t))&&(Ta.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):Q(t)?(n.state="success",n.data=t,this.backgroundImg=this.backgroundImg||e):n.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const n=this.resources.get(t);n&&(n.state="success",n.data=e,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="fail",e&&e())}_stopAnimates(t){t&&t.forEach((t=>{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",vn.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const r=new Nr(t,e);r.bubbles=!1,r.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(r)}}}La.mixin(Hr);class Ia{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function Da(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r+e.length-1}function ja(t,e,i){const n=function(t,e){let i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",r="";for(let s=e;s<t.length;s++){let e=t[s];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===n[0]){if(!n[1])return{data:r,index:s};if(t[s+1]===n[1])return{data:r,index:s}}else"\t"===e&&(e=" ");r+=e}}(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!n)return;let r=n.data;const s=n.index,a=r.search(/\s/);let o=r,l=!0;-1!==a&&(o=r.substr(0,a).replace(/\s\s*$/,""),r=r.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==n.data.substr(t+1))}return{tagName:o,tagExp:r,closeIndex:s,attrExpPresent:l,rawTagName:h}}const Ua=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Wa{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const n=e.tagname;"string"==typeof n?(e.tagname=n,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const n={};if(!t)return;const r=function(t,e){const i=[];let n=e.exec(t);for(;n;){const r=[];r.startIndex=e.lastIndex-n[0].length;const s=n.length;for(let t=0;t<s;t++)r.push(n[t]);i.push(r),n=e.exec(t)}return i}(t,Ua),s=r.length;for(let t=0;t<s;t++){const e=r[t][1],i=r[t][4];e&&(n[e]=void 0===i||(isNaN(i)?i:Number(i)))}return n}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new Ia("!xml");let i=e,n="",r="";for(let s=0;s<t.length;s++)if("<"===t[s])if("/"===t[s+1]){const e=Da(t,">",s,"Closing Tag is not closed."),a=r.lastIndexOf(".");r=r.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&n&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=n),n="",s=e}else if("?"===t[s+1])s=ja(t,s,!1,"?>").closeIndex+1;else if("!--"===t.substr(s+1,3))s=Da(t,"--\x3e",s+4,"Comment is not closed.");else{const a=ja(t,s,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(r+=r?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),r=r.substr(0,r.length-1),l=o):l=l.substr(0,l.length-1);const t=new Ia(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new Ia(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,r,o)),this.addChild(i,t,r),i=t}n="",s=c}else n+=t[s];return e.child}}function Na(t,e){return Ga(t)}function Ga(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=Fa(r);if(void 0!==s&&r[s]){const t=Ga(r[s]);n=t,Object.keys(n).length,r[":@"]&&za(t,r[":@"]),void 0!==i[s]&&i.hasOwnProperty(s)?(Array.isArray(i[s])||(i[s]=[i[s]]),i[s].push(t)):i[s]=t}}var n;return i}function Fa(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function za(t,e,i){if(e){const i=Object.keys(e),n=i.length;for(let r=0;r<n;r++){const n=i[r];t[n]=e[n]}}}class Ha{constructor(t){this.options=Object.assign({},Ha.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Na(new Wa(this.options).parseXml(t),this.options)}}function Va(t){return t.startsWith("<svg")||t.startsWith("<?xml")}function Ya(t){return t.startsWith("<")}Ha.defaultOptions={};var Xa=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function $a(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let qa=0;function Ka(){return qa++}var Za;function Ja(e){const i=[];let n=0,r="";for(let s=0;s<e.length;s++)eo(e[s])?n?r+=e[s]:(n=1,r=e[s]):(n&&(i.push({text:r,direction:t.TextDirection.VERTICAL}),r="",n=0),i.push({text:e[s],direction:t.TextDirection.HORIZONTAL}));return r&&i.push({text:r,direction:t.TextDirection.VERTICAL}),i}t.TextDirection=void 0,(Za=t.TextDirection||(t.TextDirection={}))[Za.HORIZONTAL=0]="HORIZONTAL",Za[Za.VERTICAL=1]="VERTICAL";const Qa=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>Qa.set(t,!0)));const to=new Map;function eo(t){if(Qa.has(t))return!0;if(to.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function io(t,e){const i=t.attribute;i&&i.split(";").forEach((t=>{if(!t)return;const i=t.split(":");if(2===i.length){const t=parseFloat(i[1]);e[i[0].trim()]=isFinite(t)?t:i[1].trim()}else{let t="";for(let e=1;e<i.length;e++)e>1&&(t+=":"),t+=i[e].trim();e[i[0].trim()]=t}}))}[""].forEach((t=>to.set(t,!0)));const no=Ka(),ro=Ka(),so=Ka(),ao=Ka(),oo=Ka(),lo=Ka(),ho=Ka(),co=Ka(),uo=Ka(),po=Ka(),fo=Ka(),go=Ka(),vo=Ka(),mo=Ka(),yo=Ka(),bo=Ka(),xo=Symbol.for("GraphicService"),wo=Symbol.for("GraphicCreator"),So={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},Ao=Object.keys(So),To={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},Co=Object.keys(To);var _o;t.GroupUpdateAABBBoundsMode=void 0,(_o=t.GroupUpdateAABBBoundsMode||(t.GroupUpdateAABBBoundsMode={}))[_o.LESS_GROUP=0]="LESS_GROUP",_o[_o.MORE_GROUP=1]="MORE_GROUP";class Bo extends La{constructor(e){super(e),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=lo,this._childUpdateTag=t.UpdateTag.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Mr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Mr)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(e,i,n){if(n===t.IContainPointMode.GLOBAL){const t=new Ft(e,i);return this.parent&&this.parent.globalTransMatrix.transformPoint(t,t),this.AABBBounds.contains(t.x,t.y)}return this.AABBBounds.contains(e,i)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&t.UpdateTag.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;vn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),vn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=zi.x,y:e=zi.y,dx:i=zi.dx,dy:n=zi.dy,scaleX:r=zi.scaleX,scaleY:s=zi.scaleY,angle:a=zi.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==n||1!==r||1!==s||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return kr(this).group}updateAABBBounds(t,e,i){const n=i;i=i.clone();const{width:r,height:s,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=r&&null!=s&&i.set(0,0,Math.max(0,r),Math.max(0,s)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:n=0}=t;i.translate(e,n)}return vn.graphicService.updateTempAABBBounds(i),vn.graphicService.transformAABBBounds(t,i,e,!1,this),n.copy(i),n}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=t.UpdateTag.CLEAR_BOUNDS,this._childUpdateTag&=t.UpdateTag.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=t.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&t.UpdateTag.UPDATE_BOUNDS||(this._childUpdateTag|=t.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),vn.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),vn.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,vn.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{vn.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),vn.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&t.UpdateTag.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=vn.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Bo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bo.NOWORK_ANIMATE_ATTR}}function Po(t){return new Bo(t)}Bo.NOWORK_ANIMATE_ATTR=Oa;class Ro extends Bo{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,n){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=n.layerHandler,this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(r=n.zIndex)&&void 0!==r?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new Mr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{vn.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{vn.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Mo=Symbol.for("TransformUtil"),Eo=Symbol.for("GraphicUtil"),ko=Symbol.for("LayerService"),Oo=Symbol.for("StaticLayerHandlerContribution"),Lo=Symbol.for("DynamicLayerHandlerContribution"),Io=Symbol.for("VirtualLayerHandlerContribution");var Do,jo=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Uo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.DefaultLayerService=Do=class{static GenerateLayerId(){return`${Do.idprefix}_${Do.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=vn.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Dn.get(Oo):"dynamic"===t?Dn.get(Lo):Dn.get(Io),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let n=this.getRecommendedLayerType(e.layerMode);n=e.main||e.canvasId?"static":n;const r=this.getLayerHandler(n),s=new Ro(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Do.GenerateLayerId(),layerHandler:r})),a=this.layerMap.get(t)||[];return a.push(s),this.layerMap.set(t,a),this.staticLayerCountInEnv--,s}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}},t.DefaultLayerService.idprefix="visactor_layer",t.DefaultLayerService.prefix_count=0,t.DefaultLayerService=Do=jo([g(),Uo("design:paramtypes",[])],t.DefaultLayerService);var Wo=new i((e=>{e(W).to(t.DefaultGlobal).inSingletonScope(),e(yr).to(t.DefaultWindow),e(Eo).to(t.DefaultGraphicUtil).inSingletonScope(),e(Mo).to(t.DefaultTransformUtil).inSingletonScope(),e(ko).to(t.DefaultLayerService).inSingletonScope()}));function No(t,e){return!(!t&&!e)}function Go(t,e){let i;return i=st(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Fo(t,e,i){return i&&t*e>0}function zo(t,e,i,n,r){return r&&t*e>0&&0!==i&&0!==n}function Ho(t,e){return t*e>0}function Vo(t,e,i,n){return t*e>0&&0!==i&&0!==n}function Yo(t,e,i,n,r,s,a,o){if(!t.pathProxy)return!1;const l=kr(t,null==s?void 0:s.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:f=l.strokeOpacity,visible:g=l.visible,x:v=l.x,y:m=l.y}=t.attribute,y=Fo(u,d,h),b=Ho(u,f),x=No(h),w=Go(c,p);if(!g)return!0;if(!x&&!w)return!0;if(!(y||b||a||o))return!0;e.beginPath();return Ze(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),w&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,i-v,n-m,l),e.stroke())),x&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-v,n-m,l),e.fill())),!0}function Xo(t,e,i,n,r,s,a,o){const l=i-t,h=n-e,c=a-r,u=o-s;let d=u*l-c*h;return d*d<Ct?[]:(d=(c*(e-s)-u*(t-r))/d,[t+d*l,e+d*h])}function $o(t,e,i,n,r,s,a){const o=t-i,l=e-n,h=(a?s:-s)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,f=i+c,g=n+u,v=(d+f)/2,m=(p+g)/2,y=f-d,b=g-p,x=y*y+b*b,w=r-s,S=d*g-f*p,A=(b<0?-1:1)*Math.sqrt(Math.max(0,w*w*x-S*S));let T=(S*b-y*A)/x,C=(-S*y-b*A)/x;const _=(S*b+y*A)/x,B=(-S*y+b*A)/x,P=T-v,R=C-m,M=_-v,E=B-m;return P*P+R*R>M*M+E*E&&(T=_,C=B),{cx:T,cy:C,x01:-c,y01:-u,x11:T*(r/w-1),y11:C*(r/w-1)}}function qo(t,e,i,n,r){const s=Mt(i-e),a=t.getParsedCornerRadius(),o=st(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),f=o?a[0]:a,g=o?a[1]:a,v=o?a[2]:a,m=o?a[3]:a,y=Math.max(g,f),b=Math.max(v,m);let x=y,w=b;const S=r*kt(c),A=r*It(c),T=n*kt(d),C=n*It(d);let _,B,P,R;if((b>Ct||y>Ct)&&(_=r*kt(u),B=r*It(u),P=n*kt(p),R=n*It(p),s<_t)){const t=Xo(S,A,P,R,_,B,T,C);if(t){const e=S-t[0],i=A-t[1],s=_-t[0],a=B-t[1],o=1/It(function(t){return t>1?0:t<-1?_t:Math.acos(t)}((e*s+i*a)/(Dt(e*e+i*i)*Dt(s*s+a*a)))/2),l=Dt(t[0]*t[0]+t[1]*t[1]);w=Lt(b,(n-l)/(o-1)),x=Lt(y,(r-l)/(o+1))}}return{outerDeltaAngle:l,xors:S,yors:A,xirs:P,yirs:R,xore:_,yore:B,xire:T,yire:C,limitedOcr:x,limitedIcr:w,outerCornerRadiusStart:f,outerCornerRadiusEnd:g,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:m,innerCornerRadiusEnd:v}}function Ko(t,e,i,n,r,s,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Mt(l-o),c=l>o;let u=!1;if(r<s){const t=r;r=s,s=t}if(r<=Ct)e.moveTo(i,n);else if(h>=Rt-Ct)e.moveTo(i+r*kt(o),n+r*It(o)),e.arc(i,n,r,o,l,!c),s>Ct&&(e.moveTo(i+s*kt(l),n+s*It(l)),e.arc(i,n,s,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:f,yirs:g,limitedOcr:v,outerCornerRadiusStart:m,outerCornerRadiusEnd:y,maxOuterCornerRadius:b,xore:x,yore:w,xire:S,yire:A,outerStartAngle:T,outerEndAngle:C,limitedIcr:_,innerDeltaAngle:B,innerEndAngle:P,innerStartAngle:R,innerCornerRadiusStart:M,innerCornerRadiusEnd:E,maxInnerCornerRadius:k}=qo(t,o,l,s,r);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,n+p),u=!0;else if(v>Ct){const t=Lt(m,v),s=Lt(y,v),o=$o(f,g,d,p,r,t,Number(c)),l=$o(x,w,S,A,r,s,Number(c));v<b&&t===s?!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),e.arc(i+o.cx,n+o.cy,v,Et(o.y01,o.x01),Et(l.y01,l.x01),!c)):e.moveTo(i+o.cx+v*kt(Et(l.y01,l.x01)),n+o.cy+v*It(Et(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),t>0&&e.arc(i+o.cx,n+o.cy,t,Et(o.y01,o.x01),Et(o.y11,o.x11),!c),e.arc(i,n,r,Et(o.cy+o.y11,o.cx+o.x11),Et(l.cy+l.y11,l.cx+l.x11),!c),s>0&&e.arc(i+l.cx,n+l.cy,s,Et(l.y11,l.x11),Et(l.y01,l.x01),!c)):s>0?e.moveTo(i+l.cx+s*kt(Et(l.y01,l.x01)),n+l.cy+s*It(Et(l.y01,l.x01))):e.moveTo(i+x,n+r*It(C))}else!a||a[0]?(e.moveTo(i+d,n+p),e.arc(i,n,r,T,C,!c)):e.moveTo(i+r*kt(C),n+r*It(C));if(!(s>Ct)||B<.001)!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),u=!0;else if(_>Ct){const t=Lt(M,_),r=Lt(E,_),o=$o(S,A,x,w,s,-r,Number(c)),l=$o(d,p,f,g,s,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),_<k&&t===r){const t=Et(l.y01,l.x01);!a||a[2]?e.arc(i+o.cx,n+o.cy,_,Et(o.y01,o.x01),t,!c):e.moveTo(i+o.cx+kt(t),n+o.cy+It(t))}else!a||a[2]?(r>0&&e.arc(i+o.cx,n+o.cy,r,Et(o.y01,o.x01),Et(o.y11,o.x11),!c),e.arc(i,n,s,Et(o.cy+o.y11,o.cx+o.x11),Et(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Et(l.y11,l.x11),Et(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*kt(Et(l.y01,l.x01)),n+l.cy+t*It(Et(l.y01,l.x01))):e.moveTo(i+f,n+g)}else!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),!a||a[2]?e.arc(i,n,s,P,R,c):e.moveTo(i+s*kt(R),n+s*It(R))}return a?a[3]&&e.lineTo(i+r*kt(o),n+r*It(o)):e.closePath(),u}class Zo{static GetCanvas(){try{return Zo.canvas||(Zo.canvas=vn.global.createCanvas({})),Zo.canvas}catch(t){return null}}static GetCtx(){if(!Zo.ctx){const t=Zo.GetCanvas();Zo.ctx=t.getContext("2d")}return Zo.ctx}}class Jo extends ue{static getInstance(){return Jo._instance||(Jo._instance=new Jo),Jo._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Zo.GetCanvas(),n=Zo.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const r=n.createLinearGradient(0,0,e,0);t.forEach((t=>{r.addColorStop(t[0],t[1])})),n.fillStyle=r,n.fillRect(0,0,e,1),this.rgbaSet=n.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${n}`;r.forEach((t=>a+=t.join())),a+=s;let o=this.dataMap.get(a);return o||(o={data:new Jo(r,s),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Qo{static GetSize(t){for(let e=0;e<Qo.ImageSize.length;e++)if(Qo.ImageSize[e]>=t)return Qo.ImageSize[e];return t}static Get(t,e,i,n,r,s,a){const o=Qo.GenKey(t,e,i,n,r),l=Qo.cache[o];if(!l||0===l.length)return null;for(let t=0;t<l.length;t++)if(l[t].width>=s&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,n,r,s,a,o){const l=Qo.GenKey(t,e,i,n,r);Qo.cache[l]?Qo.cache[l].push({width:a,height:o,pattern:s}):Qo.cache[l]=[{width:a,height:o,pattern:s}]}static GenKey(t,e,i,n,r){return`${e},${i},${n},${r},${t.join()}`}}function tl(t,e,i,n){const{stops:r,startAngle:s,endAngle:a}=n;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(i<s)return r[0].color;if(i>a)return r[0].color;let o,l,h=(i-s)/(a-s);for(let t=0;t<r.length;t++)if(r[t].offset>=h){o=r[t-1],l=r[t];break}return h=(h-o.offset)/(l.offset-o.offset),na(o.color,l.color,h,!1)}function el(t,e,i,n,r,s,a,o,l){const h=Math.floor(180*r/Math.PI),c=Zo.GetCanvas(),u=Zo.GetCtx();if(!u)return null;const d=Qo.GetSize(o),p=Qo.GetSize(l);let f=Qo.Get(e,i,n,s,a,d,p);if(f)return f;const g=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(n,2),Math.pow(d-i,2)+Math.pow(n,2)),Math.max(Math.pow(d-i,2)+Math.pow(p-n,2),Math.pow(i,2)+Math.pow(p-n,2)))),v=h+1,m=r/Math.max(1,v-1),y=Jo.getInstance().GetOrCreate(i,n,d,p,e,v),b=2*Math.PI*g/360;c.width=d,c.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d,p),u.translate(i,n),u.rotate(s);for(let t=0,e=v-1;t<e&&!(s+t*m>a);t++){const e=y.getColor(t);u.beginPath(),u.rotate(m),u.moveTo(0,0),u.lineTo(g,-2*b),u.lineTo(g,0),u.fillStyle=e,u.closePath(),u.fill()}const x=u.getImageData(0,0,d,p);return c.width=x.width,c.height=x.height,u.putImageData(x,0,0),f=t.createPattern(c,"no-repeat"),f&&Qo.Set(e,i,n,s,a,f,d,p),f}Qo.cache={},Qo.ImageSize=[20,40,80,160,320,640,1280,2560];const il=Symbol.for("ArcRenderContribution"),nl=Symbol.for("AreaRenderContribution"),rl=Symbol.for("CircleRenderContribution"),sl=Symbol.for("GroupRenderContribution"),al=Symbol.for("ImageRenderContribution"),ol=Symbol.for("PathRenderContribution"),ll=Symbol.for("PolygonRenderContribution"),hl=Symbol.for("RectRenderContribution"),cl=Symbol.for("SymbolRenderContribution"),ul=Symbol.for("TextRenderContribution"),dl=Symbol.for("CommonRenderContribution"),pl=Symbol.for("InteractiveSubRenderContribution");function fl(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function gl(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function vl(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Te(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const r=Te(n);Z(t[n])||(e[r]=i(t[n]))})),J(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&rt(t.fill)&&(e.color=t.fill),e}function ml(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function yl(t,e,i){const n=Math.sin(i),r=Math.cos(i),s=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*r+h*n,t[5]=a*r+c*n,t[6]=o*r+u*n,t[7]=l*r+d*n,t[8]=h*r-s*n,t[9]=c*r-a*n,t[10]=u*r-o*n,t[11]=d*r-l*n,t}function bl(t,e,i){const n=Math.sin(i),r=Math.cos(i),s=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],u=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r-h*n,t[1]=a*r-c*n,t[2]=o*r-u*n,t[3]=l*r-d*n,t[8]=s*n+h*r,t[9]=a*n+c*r,t[10]=o*n+u*r,t[11]=l*n+d*r,t}function xl(t,e,i){const n=Math.sin(i),r=Math.cos(i),s=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r+h*n,t[1]=a*r+c*n,t[2]=o*r+u*n,t[3]=l*r+d*n,t[4]=h*r-s*n,t[5]=c*r-a*n,t[6]=u*r-o*n,t[7]=d*r-l*n,t}function wl(t,e,i){const n=i[0],r=i[1],s=i[2];let a,o,l,h,c,u,d,p,f,g,v,m;return e===t?(t[12]=e[0]*n+e[4]*r+e[8]*s+e[12],t[13]=e[1]*n+e[5]*r+e[9]*s+e[13],t[14]=e[2]*n+e[6]*r+e[10]*s+e[14],t[15]=e[3]*n+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],u=e[5],d=e[6],p=e[7],f=e[8],g=e[9],v=e[10],m=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=u,t[6]=d,t[7]=p,t[8]=f,t[9]=g,t[10]=v,t[11]=m,t[12]=a*n+c*r+f*s+e[12],t[13]=o*n+u*r+g*s+e[13],t[14]=l*n+d*r+v*s+e[14],t[15]=h*n+p*r+m*s+e[15]),t}function Sl(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Al(t,e,i){const n=i[0],r=i[1],s=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Tl(t,e,i){const n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],v=e[13],m=e[14],y=e[15];let b=i[0],x=i[1],w=i[2],S=i[3];return t[0]=b*n+x*o+w*u+S*g,t[1]=b*r+x*l+w*d+S*v,t[2]=b*s+x*h+w*p+S*m,t[3]=b*a+x*c+w*f+S*y,b=i[4],x=i[5],w=i[6],S=i[7],t[4]=b*n+x*o+w*u+S*g,t[5]=b*r+x*l+w*d+S*v,t[6]=b*s+x*h+w*p+S*m,t[7]=b*a+x*c+w*f+S*y,b=i[8],x=i[9],w=i[10],S=i[11],t[8]=b*n+x*o+w*u+S*g,t[9]=b*r+x*l+w*d+S*v,t[10]=b*s+x*h+w*p+S*m,t[11]=b*a+x*c+w*f+S*y,b=i[12],x=i[13],w=i[14],S=i[15],t[12]=b*n+x*o+w*u+S*g,t[13]=b*r+x*l+w*d+S*v,t[14]=b*s+x*h+w*p+S*m,t[15]=b*a+x*c+w*f+S*y,t}function Cl(t,e,i,n){let r,s,a,o,l,h,c,u,d,p;const f=e[0],g=e[1],v=e[2],m=n[0],y=n[1],b=n[2],x=i[0],w=i[1],S=i[2];return Math.abs(f-x)<Ct&&Math.abs(g-w)<Ct&&Math.abs(v-S)<Ct?ml(t):(c=f-x,u=g-w,d=v-S,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,r=y*d-b*u,s=b*c-m*d,a=m*u-y*c,p=Math.hypot(r,s,a),p?(p=1/p,r*=p,s*=p,a*=p):(r=0,s=0,a=0),o=u*a-d*s,l=d*r-c*a,h=c*s-u*r,p=Math.hypot(o,l,h),p?(p=1/p,o*=p,l*=p,h*=p):(o=0,l=0,h=0),t[0]=r,t[1]=o,t[2]=c,t[3]=0,t[4]=s,t[5]=l,t[6]=u,t[7]=0,t[8]=a,t[9]=h,t[10]=d,t[11]=0,t[12]=-(r*f+s*g+a*v),t[13]=-(o*f+l*g+h*v),t[14]=-(c*f+u*g+d*v),t[15]=1,t)}function _l(t,e,i,n,r,s,a){const o=1/(e-i),l=1/(n-r),h=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+i)*o,t[13]=(r+n)*l,t[14]=(a+s)*h,t[15]=1,t}function Bl(t,e,i){const n=e[0],r=e[1],s=e[2];let a=i[3]*n+i[7]*r+i[11]*s+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*r+i[8]*s+i[12])/a,t[1]=(i[1]*n+i[5]*r+i[9]*s+i[13])/a,t[2]=(i[2]*n+i[6]*r+i[10]*s+i[14])/a,t}const Pl=Symbol.for("MatrixAllocate"),Rl=Symbol.for("Mat4Allocate");function Ml(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class El{constructor(){this.pools=[]}allocate(t,e,i,n,r,s){if(!this.pools.length)return new ce(t,e,i,n,r,s);const a=this.pools.pop();return a.a=t,a.b=e,a.c=i,a.d=n,a.e=r,a.f=s,a}allocateByObj(t){if(!this.pools.length)return new ce(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}class kl{constructor(){this.pools=[]}static identity(t){return ml(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return kl.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}const Ol=new El,Ll=new kl;var Il=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Dl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jl=function(t,e){return function(i,n){e(i,n,t)}};function Ul(t,e,i){var n;const{x:r=i.x,y:s=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:u=i.scaleY,scaleZ:d=i.scaleZ,alpha:p=i.alpha,beta:f=i.beta,angle:g=i.angle,anchor3d:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(ml(t),wl(t,t,[r+o,s+l,a+h]),wl(t,t,[y[0],y[1],y[2]]),yl(t,t,f),bl(t,t,p),wl(t,t,[-y[0],-y[1],y[2]]),Al(t,t,[c,u,d]),g){const i=Ll.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}wl(i,i,[n[0],n[1],0]),xl(i,i,g),wl(i,i,[-n[0],-n[1],0]),Tl(t,t,i)}}function Wl(t){const{alpha:e,beta:i}=t.attribute;return e||i}t.DefaultGraphicService=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new j(["graphic"]),onSetStage:new j(["graphic","stage"]),onRemove:new j(["graphic"]),onRelease:new j(["graphic"]),onAddIncremental:new j(["graphic","group","stage"]),onClearIncremental:new j(["graphic","group","stage"]),beforeUpdateAABBBounds:new j(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new j(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new j(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new le,this.tempAABBBounds2=new le}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,r){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,r)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new _e(t);return Ze(i.commandList,n,0,0),!0}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:r,textBaseline:s}=t;if(null!=t.forceBoundsHeight){const e=ot(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=gl(s,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=ot(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=fl(r,e);i.set(n,i.y1,n+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,r){if(!e.empty()){const{scaleX:r=i.scaleX,scaleY:s=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){$a(u,(l+h)/Math.abs(r+s),n,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;$a(u,o/Math.abs(r+s)*2,!1,c+1),u.translate(n,a),e.union(u)}}if(this.combindShadowAABBBounds(e,r),e.empty())return;let s=!0;const a=r.transMatrix;r&&r.isContainer&&(s=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),s&&ae(e,e,a)}validCheck(t,e,i,n){if(!n)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(n.shadowRoot||n.isContainer)return!0;const{visible:r=e.visible}=t;return!(!n.valid||!r)||(i.empty()||(n.parent&&i.transformWithMatrix(n.parent.globalTransMatrix),vn.graphicService.clearAABBBounds(n,n.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}},t.DefaultGraphicService=Il([g(),jl(0,p(wo)),Dl("design:paramtypes",[Object])],t.DefaultGraphicService);const Nl={x:0,y:0,z:0,lastModelMatrix:null};class Gl{init(e){e&&(this._renderContribitions=e.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((e=>e.time===t.BaseRenderContributionTime.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((e=>e.time===t.BaseRenderContributionTime.afterFillStroke)))}beforeRenderStep(t,e,i,n,r,s,a,o,l,h,c,u,d){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,r,s,a,o,l,h,c,u,d)}))}afterRenderStep(t,e,i,n,r,s,a,o,l,h,c,u,d){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,n,r,s,a,o,l,h,c,u,d)}))}valid(t,e,i,n){const{fill:r=e.fill,background:s,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:u=e.visible}=t.attribute,d=Fo(o,l,r),p=Ho(o,c),f=No(r,s),g=Go(a,h);return!(!t.valid||!u)&&!(!f&&!g)&&!!(d||p||i||n||s)&&{fVisible:d,sVisible:p,doFill:f,doStroke:g}}transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:r=e.x,y:s=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=i.modelMatrix,d=i.camera;Nl.x=r,Nl.y=s,Nl.z=a,Nl.lastModelMatrix=u;const p=d&&(n||Wl(t)),f=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const n=Ll.allocate(),r=Ll.allocate();Ul(r,t,e),Tl(n,u||n,r),Nl.x=0,Nl.y=0,Nl.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Ll.free(r)}if(f&&!u){const n=t.getOffsetXY(e);Nl.x+=n.x,Nl.y+=n.y,Nl.z=a,i.setTransformForCurrent()}else if(p)Nl.x=0,Nl.y=0,Nl.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const n=t.getOffsetXY(e);Nl.x+=n.x,Nl.y+=n.y,this.transformWithoutTranslate(i,Nl.x,Nl.y,Nl.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Nl.x=0,Nl.y=0,Nl.z=0;return Nl}transformUseContext2d(t,e,i,n){const r=n.camera;if(this.camera=r,r){const e=t.AABBBounds,r=e.x2-e.x1,s=e.y2-e.y1,a=n.project(0,0,i),o=n.project(r,0,i),l=n.project(r,s,i),h={x:0,y:0},c={x:r,y:0},u={x:r,y:s};n.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,f=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,g=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,v=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,m=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;n.setTransform(p,f,g,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,r,s,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(r,s,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,n,r){const{context:s}=n;if(!s)return;const{renderable:a}=t.attribute;if(!1===a)return;s.highPerformanceSave();const o=this.transform(t,e,s,i),{x:l,y:h,z:c,lastModelMatrix:u}=o;this.z=c,Yo(t,s,l,h,0,r)||(this.drawShape(t,s,l,h,n,r),this.z=0,s.modelMatrix!==u&&Ll.free(s.modelMatrix),s.modelMatrix=u),s.highPerformanceRestore()}}var Fl=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},zl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hl=function(t,e){return function(i,n){e(i,n,t)}};class Vl{constructor(){this.time=t.BaseRenderContributionTime.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u,d){var p;const{background:f,backgroundOpacity:g=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:v=l.opacity,backgroundMode:m=l.backgroundMode,backgroundFit:y=l.backgroundFit}=t.attribute;if(f)if(t.backgroundImg&&t.resources){const r=t.resources.get(f);if("success"!==r.state||!r.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=kr(t.parent).group,{scrollX:n=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,r)}e.clip();const s=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=g*v,this.doDrawImage(e,r.data,s,m,y),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.globalAlpha=g*v,e.fillStyle=f,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,n,r){if("no-repeat"===n)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=i.width(),a=i.height();let o=s,l=a;if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,r=e.height;"repeat-x"===n?(o=i*(a/r),l=a):"repeat-y"===n&&(l=r*(s/i),o=s);const h=t.dpr,c=gr.allocate({width:o,height:l,dpr:h}),u=c.getContext("2d");u&&(u.inuse=!0,u.clearMatrix(),u.setTransformForCurrent(!0),u.clearRect(0,0,o,l),u.drawImage(e,0,0,o,l),e=c.nativeCanvas),gr.free(c)}const h=t.dpr,c=t.createPattern(e,n);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,s,a),t.translate(-i.x1,-i.y1)}}}const Yl=new Vl;t.DefaultBaseInteractiveRenderContribution=class{constructor(e){this.subRenderContribitions=e,this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,r,s,a,o,l,h,c,u,d)}))}},t.DefaultBaseInteractiveRenderContribution=Fl([g(),Hl(0,p(k)),Hl(0,v(pl)),zl("design:paramtypes",[Object])],t.DefaultBaseInteractiveRenderContribution);class Xl{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,r){const s=(t-2*e)/2,a=n.dpr,o=gr.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),r(s,l);const h=n.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),gr.free(o),h}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const r=t/2,s=r;n.fillStyle=i,n.moveTo(r,s-e),n.lineTo(e+r,s),n.lineTo(r,s+e),n.lineTo(r-e,s),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const r=e,s=r;n.fillStyle=i,n.fillRect(r,s,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,r)=>{const s=e;r.fillStyle=i,r.fillRect(s,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,r)=>{const s=e;r.fillStyle=i,r.fillRect(0,s,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const r=t/2,s=-r;n.moveTo(r,s),n.lineTo(r+t,s+t),n.moveTo(-r,-s),n.lineTo(-r+t,-s+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const r=t/2,s=r;n.moveTo(t+r,s),n.lineTo(r,s+t),n.moveTo(t-r,-s),n.lineTo(-r,-s+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const r=e,s=r;n.fillStyle=i,n.fillRect(r,s,t,t),n.fillRect(r+t,s+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,r,s,a,o,l,h,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:f=l.textureColor,textureSize:g=l.textureSize,texturePadding:v=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,n,l,f,g,v)}drawTexture(t,e,i,n,r,s,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,n,r,s),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const $l=new Xl;class ql{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{innerPadding:v=l.innerPadding,outerPadding:m=l.outerPadding,startAngle:y=l.startAngle,endAngle:b=l.endAngle,opacity:x=l.opacity,x:w=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:T=l.scaleY,keepStrokeScale:C=l.keepStrokeScale}=t.attribute;let{innerRadius:_=l.innerRadius,outerRadius:B=l.outerRadius}=t.attribute;B+=m,_-=v;const P=(r,s)=>{const a=!(!r||!r.stroke),{distance:o=l[s].distance}=r,h=C?o:bn(e,o,e.dpr),c=o/B,d="outerBorder"===s?1:-1;if(t.setAttributes({outerRadius:B+d*h,innerRadius:_-d*h,startAngle:y-d*c,endAngle:b+d*c}),e.beginPath(),Ko(t,e,i,n,B+d*h,_-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,r,l[s]);else if(a){const a=l[s].opacity;l[s].opacity=x,e.setStrokeStyle(t,r,(w-i)/A,(S-n)/T,l[s]),l[s].opacity=a,e.stroke()}};f&&P(d,"outerBorder"),g&&P(p,"innerBorder"),t.setAttributes({outerRadius:B,innerRadius:_,startAngle:y,endAngle:b})}}const Kl=new ql,Zl=$l,Jl=Yl;class Ql{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{radius:v=l.radius,startAngle:m=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:w=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:T=l.keepStrokeScale}=t.attribute,C=(r,s)=>{const a=!(!r||!r.stroke),{distance:o=l[s].distance}=r,h=T?o:bn(e,o,e.dpr),c="outerBorder"===s?1:-1;if(e.beginPath(),e.arc(i,n,v+c*h,m,y),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,r,l[s]);else if(a){const a=l[s].opacity;l[s].opacity=b,e.setStrokeStyle(t,r,(x-i)/S,(w-n)/A,l[s]),l[s].opacity=a,e.stroke()}};f&&C(d,"outerBorder"),g&&C(p,"innerBorder")}}const th=new Ql,eh=$l,ih=Yl;class nh extends Vl{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(d);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;this.doDrawImage(e,i.data,n,p,f),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}}const rh=new nh,sh=_t/2;function ah(t,e,i,n,r,s,a){let o;if(n<0&&(e+=n,n=-n),r<0&&(i+=r,r=-r),ot(s,!0))o=[s=Mt(s),s,s,s];else if(Array.isArray(s)){const t=s;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Mt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Mt(t[0]),i=Mt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Mt(o[0]),o[1]=Mt(o[1]),o[2]=Mt(o[2]),o[3]=Mt(o[3])}}else o=[0,0,0,0];if(n<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,n,r);const[l,h,c,u]=[[e,i],[e+n,i],[e+n,i+r],[e,i+r]],d=Math.min(n/2,r/2),p=[Math.min(d,o[0]),Math.min(d,o[1]),Math.min(d,o[2]),Math.min(d,o[3])],f=[l[0]+p[0],l[1]],g=[l[0],l[1]+p[0]],v=[h[0]-p[1],h[1]],m=[h[0],h[1]+p[1]],y=[c[0]-p[2],c[1]],b=[c[0],c[1]-p[2]],x=[u[0]+p[3],u[1]],w=[u[0],u[1]-p[3]];if(t.moveTo(f[0],f[1]),a&&a[0]?a[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!vt(v,m)){a&&a[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+p[1];t.arc(e,i,p[1],-sh,0,!1)}if(a&&a[1]?a[1](m[0],m[1],b[0],b[1]):t.lineTo(b[0],b[1]),!vt(y,b)){const e=b[0]-p[2],i=b[1];a&&a[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[2],0,sh,!1)}if(a&&a[2]?a[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!vt(x,w)){const e=x[0],i=x[1]-p[3];a&&a[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,p[3],sh,_t,!1)}if(a&&a[3]?a[3](w[0],w[1],g[0],g[1]):t.lineTo(g[0],g[1]),!vt(f,g)){const e=f[0],i=f[1]+p[0];a&&a[3]&&t.moveTo(g[0],g[1]),t.arc(e,i,p[0],_t,_t+sh,!1)}return!a&&t.closePath(),t}var oh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};class lh{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,g=p&&!1!==p.visible;if(!f&&!g)return;const{cornerRadius:v=l.cornerRadius,opacity:m=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:w=l.scaleY,x1:S,y1:A,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:C,height:_}=t.attribute;C=(null!=C?C:S-i)||0,_=(null!=_?_:A-n)||0;const B=(r,s)=>{const a=!(!r||!r.stroke),o="outerBorder"===s?-1:1,{distance:h=l[s].distance}=r,c=T?h:bn(e,h,e.dpr),d=i+o*c,p=n+o*c,f=2*c;if(0===v||st(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*f,_-o*f)):(e.beginPath(),ah(e,d,p,C-o*f,_-o*f,v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,r,l[s]);else if(a){const a=l[s].opacity;l[s].opacity=m,e.setStrokeStyle(t,r,(y-i)/x,(b-n)/w,l[s]),l[s].opacity=a,e.stroke()}};f&&B(d,"outerBorder"),g&&B(p,"innerBorder")}}t.SplitRectBeforeRenderContribution=class{constructor(){this.time=t.BaseRenderContributionTime.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}},t.SplitRectBeforeRenderContribution=oh([g()],t.SplitRectBeforeRenderContribution),t.SplitRectAfterRenderContribution=class{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){const{x1:d,y1:p,x:f=l.x,y:g=l.y,stroke:v=l.stroke,cornerRadius:m=l.cornerRadius}=t.attribute;let{width:y,height:b}=t.attribute;if(y=(null!=y?y:d-f)||0,b=(null!=b?b:p-g)||0,Array.isArray(v)&&v.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),!(0===m||st(m)&&m.every((t=>0===t)))){let r,s=0;return ah(e,i,n,y,b,m,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{v[o]&&(s===o-1&&v[o]===r||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:v[o]}),i,n,l),e.beginPath(),e.moveTo(a,h),r=v[o]),s=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,n),v[0]?e.lineTo(i+y,n):e.moveTo(i+y,n),v[1]?e.lineTo(i+y,n+b):e.moveTo(i+y,n+b),v[2]?e.lineTo(i,n+b):e.moveTo(i,n+b),v[3]){const t=v[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}},t.SplitRectAfterRenderContribution=oh([g()],t.SplitRectAfterRenderContribution);const hh=new lh,ch=$l,uh=Yl;class dh extends Vl{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit}=t.attribute;if(d)if(t.backgroundImg){const i=t.resources.get(d);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=kr(t.parent).group,{scrollX:n=i.scrollX,scrollY:r=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,r)}const n=t.AABBBounds;this.doDrawImage(e,i.data,n,p,f),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(Q(d)){const{stroke:i,fill:n,lineWidth:r=1,cornerRadius:s=0,expandX:a=0,expandY:o=0}=d;if(!i&&!n)return;e.beginPath();const{x:l,y:h,width:c,height:u}=function(t){const e=ds(t.attribute.boundsPadding),i=t.AABBBounds;let n=i.x1,r=i.y1,s=i.width(),a=i.height();return ot(e)?(n+=e,r+=e,s-=2*e,a-=2*e):(n+=e[3],r+=e[0],s-=e[1]+e[3],a-=e[0]+e[2]),{x:n,y:r,width:s,height:a}}(t);s?ah(e,l-a,h-o,c+2*a,u+2*o,s):e.rect(l-a,h-o,c+2*a,u+2*o),e.globalAlpha=1,n&&(e.fillStyle=n,e.fill()),i&&r>0&&(e.lineWidth=r,e.strokeStyle=i,e.stroke())}else{e.beginPath();const r=t.AABBBounds;e.rect(i,n,r.width(),r.height()),e.fillStyle=d,e.globalAlpha=1,e.fill()}}}class ph extends lh{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){return super.drawShape(t,e,i,n,r,s,a,o,l,h,c,u)}}const fh=new ph,gh=new dh;class vh{constructor(){this.time=t.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:f}=t.attribute,g=p&&!1!==p.visible,v=f&&!1!==f.visible;if(!g&&!v)return;const{size:m=l.size,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:w=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,T=(r,s)=>{const a=!(!r||!r.stroke),{distance:o=l[s].distance}=r,h=A?o:bn(e,o,e.dpr),c="outerBorder"===s?1:-1;if(e.beginPath(),!1===d.drawOffset(e,m,i,n,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,r,l[s]);else if(a){const a=l[s].opacity;l[s].opacity=y,e.setStrokeStyle(t,r,(b-i)/w,(x-n)/S,l[s]),l[s].opacity=a,e.stroke()}};g&&T(p,"outerBorder"),v&&T(f,"innerBorder")}}const mh=new vh,yh=$l,bh=Yl;class xh extends Xl{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.afterFillStroke}drawShape(t,e,i,n,r,s,a,o,l,h,c,u,d){var p,f,g,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:ws(l,"texture")),textureColor:b=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:ws(l,"textureColor")),textureSize:x=(null!==(g=t.attribute.textureSize)&&void 0!==g?g:ws(l,"textureSize")),texturePadding:w=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:ws(l,"texturePadding"))}=m;y&&this.drawTexture(y,t,e,i,n,l,b,x,w)}}var wh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Sh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ah=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasArcRender=class extends Gl{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=no,this.builtinContributions=[Kl,Jl,Zl],this.init(t)}drawArcTailCapPath(t,e,i,n,r,s,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(r<s){const t=r;r=s,s=t}const{outerDeltaAngle:f,xors:g,yors:v,xirs:m,yirs:y,limitedOcr:b,outerCornerRadiusStart:x,outerCornerRadiusEnd:w,maxOuterCornerRadius:S,xore:A,yore:T,xire:C,yire:_,limitedIcr:B,innerDeltaAngle:P,innerStartAngle:R,innerCornerRadiusStart:M,innerCornerRadiusEnd:E,maxInnerCornerRadius:k}=qo(t,c,u,s,r);if(b>Ct){const t=Lt(x,b),s=Lt(w,b),a=$o(m,y,g,v,r,t,Number(d)),o=$o(A,T,C,_,r,s,Number(d));if(b<S&&t===s)e.moveTo(i+a.cx+a.x01,n+a.cy+a.y01),e.arc(i+a.cx,n+a.cy,b,Et(a.y01,a.x01),Et(o.y01,o.x01),!d);else{const t=u-l-.03,a=Et(o.y11,o.x11);e.arc(i,n,r,t,a,!d),s>0&&e.arc(i+o.cx,n+o.cy,s,Et(o.y11,o.x11),Et(o.y01,o.x01),!d)}}else e.moveTo(i+g,n+v);if(!(s>Ct)||P<.001)e.lineTo(i+C,n+_),p=!0;else if(B>Ct){const t=Lt(M,B),r=Lt(E,B),a=$o(C,_,A,T,s,-r,Number(d)),o=$o(g,v,m,y,s,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),B<k&&t===r){const t=Et(o.y01,o.x01);e.arc(i+a.cx,n+a.cy,B,Et(a.y01,a.x01),t,!d)}else{r>0&&e.arc(i+a.cx,n+a.cy,r,Et(a.y01,a.x01),Et(a.y11,a.x11),!d);const t=Et(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,n,s,t,o,d)}}else e.lineTo(i+s*kt(R),n+s*It(R));return p}drawShape(t,e,i,n,r,s,a,o){const l=kr(t,null==s?void 0:s.theme).arc,{fill:h=l.fill,stroke:c=l.stroke,x:u=l.x,y:d=l.y,fillStrokeOrder:p=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:g,sVisible:v,doFill:m,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:w=l.cap,forceShowCap:S=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:T=l.innerRadius}=t.attribute;A+=b,T-=x;let C=0;const _=(q(w)&&w||w[0])&&"conical"===h.gradient;if(_){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Mt(n-i)<Rt-Ct&&(C=e||0,h.startAngle-=C,h.endAngle-=C)}let B=!1;const{isFullStroke:P,stroke:R}=cs(c);if(m||P){e.beginPath(),Ko(t,e,i,n,A,T),B=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,m,y,g,v,l,r,a,o);const s=()=>{m&&(a?a(e,t.attribute,l):g&&(e.setCommonStyle(t,t.attribute,u-i,d-n,l),e.fill()))},h=()=>{y&&P&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))};p?(h(),s()):(s(),h())}if(!P&&y&&(e.beginPath(),Ko(t,e,i,n,A,T,R),B||this.beforeRenderStep(t,e,i,n,m,y,g,v,l,r,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),(q(w)&&w||w[1])&&S){const{startAngle:s,endAngle:h}=t.getParsedAngle();if(Mt(h-s)>=Rt-Ct){e.beginPath();const s=Math.abs(A-T)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,n,A,T,u,u+s),B||this.beforeRenderStep(t,e,i,n,m,y,g,v,l,r,a,o);const d=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke()))};(()=>{if(m){const r=c;if("conical"===r.gradient){const s=tl(0,0,h,r);a||Fo&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=s,e.fill())}}})(),d()}}this.afterRenderStep(t,e,i,n,m,y,g,v,l,r,a,o),_&&(h.startAngle+=C,h.endAngle+=C)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).arc;this._draw(t,r,!1,i,n)}},t.DefaultCanvasArcRender=wh([g(),Ah(0,p(k)),Ah(0,v(il)),Sh("design:paramtypes",[Object])],t.DefaultCanvasArcRender);var Th=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Ch=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_h=function(t,e){return function(i,n){e(i,n,t)}};function Bh(t,e,i,n){if(!e.p1)return;const{offsetX:r=0,offsetY:s=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(r+e.p1.x,s+e.p1.y,r+e.p2.x,s+e.p2.y,r+e.p3.x,s+e.p3.y,a):t.lineTo(r+e.p1.x,s+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ni(e,i);t.bezierCurveTo(r+n.p1.x,s+n.p1.y,r+n.p2.x,s+n.p2.y,r+n.p3.x,s+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(r+n.x,s+n.y,a)}}function Ph(t,e,i,n,r,s,a){var o;let l=e.p0,h=n;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)n||(t.lineTo(l.x+r,l.y+s,a),h=!n);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){h=!n;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+r,o+s,a)}else d&&(h=!n,t.lineTo(d.x+r,d.y+s,a))}return h}function Rh(e,i,n,r,s){const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1}=s||{};if(c&&"none"===h)return;if(!i)return;let u=!0;const{curves:d}=i;if(n>=1){if(c){let t,i=!0;d.forEach(((n,r)=>{n.originP1!==n.originP2?(i=Ph(e,n,t,i,a,o,l),t=n):t=n}))}else d.forEach((t=>{t.defined?(u&&e.moveTo(t.p0.x+a,t.p0.y+o,l),Bh(e,t,1,s),u=!1):u=!0}));return}if(n<=0)return;let p;"x"===r?p=t.Direction.ROW:"y"===r?p=t.Direction.COLUMN:"auto"===r&&(p=i.direction);const f=n*i.tryUpdateLength(p);let g=0,v=!0,m=null;for(let t=0,i=d.length;t<i;t++){const i=d[t],n=i.getLength(p),r=(f-g)/n;if(g+=n,r<0)break;if(c){if(i.originP1===i.originP2){m=i;continue}v=Ph(e,i,m,v,a,o,l),m=i}else{if(!i.defined){u=!0;continue}u&&e.moveTo(i.p0.x+a,i.p0.y+o,l),Bh(e,i,Lt(r,1),s),u=!1}}}function Mh(t,e,i,n){const{offsetX:r=0,offsetY:s=0}=n||{},a=e?e.points[e.points.length-1]:i.points[0];t.moveTo(a.x+r,a.y+s),i.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+r,e.y+s):t.moveTo(e.x+r,e.y+s)}))}function Eh(t,e,i,n){const{offsetX:r=0,offsetY:s=0}=n||{},{points:a}=i,o=[];for(let t=0;t<a.length;t++)a[t].defined;o.push(a),o.forEach(((i,n)=>{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+r,c.y+s),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+r,e.y+s):t.moveTo(e.x+r,e.y+s)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}t.DefaultCanvasCircleRender=class extends Gl{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=ao,this.builtinContributions=[th,ih,eh],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const l=kr(t,null==s?void 0:s.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:u=l.endAngle,x:d=l.x,y:p=l.y,fillStrokeOrder:f=l.fillStrokeOrder}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:v,sVisible:m,doFill:y,doStroke:b}=g;e.beginPath(),e.arc(i,n,h,c,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,b,v,m,l,r,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,d-i,p-n,l),e.fill()))},w=()=>{b&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,l),e.stroke()))};f?(w(),x()):(x(),w()),this.afterRenderStep(t,e,i,n,y,b,v,m,l,r,a,o)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).circle;this._draw(t,r,!1,i,n)}},t.DefaultCanvasCircleRender=Th([g(),_h(0,p(k)),_h(0,v(rl)),Ch("design:paramtypes",[Object])],t.DefaultCanvasCircleRender);var kh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};function Oh(e,i,n,r){var s;const{drawConnect:a=!1,mode:o="none"}=r||{};if(a&&"none"===o)return;const{top:l,bottom:h}=i;if(l.curves.length!==h.curves.length)return;if(n>=1){const t=[],i=[];let n=!0;if(a){let n,s,a=!0;const o=l.curves.length;l.curves.forEach(((l,c)=>{const u=h.curves[o-c-1];let d=l,p=u;if(l.originP1===l.originP2)return n=l,void(s=u);if(n&&n.originP1===n.originP2&&(d=n,p=s),l.defined)a||(t.push(d),i.push(p),Lh(e,t,i,r),t.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:s}=l;let o,h;n&&!1!==n.defined?(o=d,h=p):n&&!1!==s.defined&&(o=l,h=u),a?(a=!a,t.push(o||l),i.push(h||u)):o&&(a=!a,t.push(o||l),i.push(h||u),Lh(e,t,i,r),t.length=0,i.length=0)}n=l})),Lh(e,t,i,r)}else{for(let s=0,a=l.curves.length;s<a;s++){const o=l.curves[s];n!==o.defined?(n?(Ih(e,t,i,r),t.length=0,i.length=0):(t.push(o),i.push(h.curves[a-s-1])),n=!n):n&&(t.push(o),i.push(h.curves[a-s-1]))}Ih(e,t,i,r)}return}if(n<=0)return;let{direction:c}=r||{};const{curves:u}=l,d=null!==(s=u[u.length-1].p3)&&void 0!==s?s:u[u.length-1].p1,p=Mt(d.x-u[0].p0.x),f=Mt(d.y-u[0].p0.y);c=null!=c?c:p>f?t.Direction.ROW:t.Direction.COLUMN,Number.isFinite(p)||(c=t.Direction.COLUMN),Number.isFinite(f)||(c=t.Direction.ROW);const g=n*(c===t.Direction.ROW?p:f);let v=0,m=!0;const y=[],b=[];let x,w,S=!0;for(let t=0,i=l.curves.length;t<i;t++){const n=l.curves[t],s=n.getLength(c),o=(g-v)/s;if(o<0)break;if(v+=s,a){const s=h.curves[i-t-1];let a=n,o=s;if(n.originP1===n.originP2){x=n,w=s;continue}if(x&&x.originP1===x.originP2&&(a=x,o=w),n.defined)S||(y.push(a),b.push(o),Lh(e,y,b,r),y.length=0,b.length=0,S=!S);else{const{originP1:t,originP2:i}=n;let l,h;t&&!1!==t.defined?(l=a,h=o):t&&!1!==i.defined&&(l=n,h=s),S?(S=!S,y.push(l||n),b.push(h||s)):l&&(S=!S,y.push(l||n),b.push(h||s),Lh(e,y,b,r),y.length=0,b.length=0)}x=n}else{let s=null,a=null;m!==n.defined?(m?(Ih(e,y,b,r),y.length=0,b.length=0):(s=n,a=h.curves[i-t-1]),m=!m):m&&(s=n,a=h.curves[i-t-1]),s&&a&&(o<1&&(s=s.p2&&s.p3?ni(s,o)[0]:si(s,o)[0],a=a.p2&&a.p3?ni(a,1-o)[1]:si(a,1-o)[1]),s.defined=m,a.defined=m,y.push(s),b.push(a)),s=null,a=null}}a?Lh(e,y,b,r):Ih(e,y,b,r)}function Lh(t,e,i,n){if(e.length<2)return;const{offsetX:r=0,offsetY:s=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+r,l.p0.y+s,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+r,h.y+s,a),l=i[i.length-1],t.lineTo(l.p0.x+r,l.p0.y+s,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+r,h.y+s,a),t.closePath()}function Ih(t,e,i,n){const{offsetX:r=0,offsetY:s=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+r,e.p0.y+s,a),Bh(t,e,1,n),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+r,l.p0.y+s,a),Bh(t,l,1,n),o=!1):o=!0}t.closePath()}t.DefaultCanvasLineRender=class extends Gl{constructor(){super(...arguments),this.numberType=co}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).line;this._draw(t,r,!1,i,n)}drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,f){var g,v,m,y,b;if(!e)return;t.beginPath();const x=null!==(g=this.z)&&void 0!==g?g:0;Rh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u,offsetZ:x}),d.cache&&!st(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:w=0,x:S=0}=a;!1!==i&&(p?p(t,a,o):r&&(t.setCommonStyle(d,a,w-c,S-u,o),t.fill())),!1!==n&&(f?f(t,a,o):s&&(t.setStrokeStyle(d,a,w-c,S-u,o),t.stroke()));let{connectedType:A,connectedX:T,connectedY:C,connectedStyle:_}=a;if(st(o)?(A=null!==(v=null!=A?A:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,T=null!==(m=null!=T?T:o[0].connectedX)&&void 0!==m?m:o[1].connectedX,C=null!==(y=null!=C?C:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,_=null!==(b=null!=_?_:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,T=null!=T?T:o.connectedX,C=null!=C?C:o.connectedY,_=null!=_?_:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Rh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u,offsetZ:x,drawConnect:!0,mode:A,zeroX:T,zeroY:C});const g=[];st(o)?o.forEach((t=>g.push(t))):g.push(o),g.push(a),!1!==i&&(p?p(t,a,o):r&&(t.setCommonStyle(d,_,w-c,S-u,g),t.fill())),!1!==n&&(f?f(t,a,o):s&&(t.setStrokeStyle(d,_,w-c,S-u,g),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,n,r,s,a,o,l,h,c,u,d){var p;e.beginPath();const f=null!==(p=this.z)&&void 0!==p?p:0,{points:g}=t.attribute,v=g[0];e.moveTo(v.x+a,v.y+o,f);for(let t=1;t<g.length;t++){const i=g[t];e.lineTo(i.x+a,i.y+o,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const{x:m=0,x:y=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):r&&(e.setCommonStyle(t,t.attribute,m-a,y-o,l),e.fill())),!1!==n&&(d?d(e,t.attribute,l):s&&(e.setStrokeStyle(t,t.attribute,m-a,y-o,l),e.stroke()))}drawShape(t,e,i,n,r,s,a,o){const l=kr(t,null==s?void 0:s.theme).line,{fill:h=l.fill,stroke:c=l.stroke,fillOpacity:u=l.fillOpacity,strokeOpacity:d=l.strokeOpacity,segments:p,points:f,closePath:g,curveTension:v=l.curveTension}=t.attribute;if(!this.valid(t,l,a,o))return;let{curveType:m=l.curveType}=t.attribute;g&&"linear"===m&&(m="linearClosed");const{clipRange:y=l.clipRange,clipRangeByDimension:b=l.clipRangeByDimension}=t.attribute;if(1===y&&!p&&!f.some((t=>!1===t.defined))&&"linear"===m)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,n,l,r,s,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,n=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=Ui(t.points,m,{startPoint:e,curveTension:v});return n=r,r})).filter((t=>!!t)),"linearClosed"===m){let e;for(let i=0;i<t.cache.length;i++){const n=t.cache[i];for(let t=0;t<n.curves.length;t++)if(n.curves[t].defined){e=n.curves[t].p0;break}if(e)break}t.cache[t.cache.length-1]&&t.cache[t.cache.length-1].lineTo(e.x,e.y,!0)}}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=Ui(n,m,{curveTension:v})}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===y){let s=!1;t.cache.forEach(((p,f)=>{s||(s=this.drawSegmentItem(e,p,!!h,!!c,u,d,r[f],[l,t.attribute],y,b,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*s;let f=0,g=!1;t.cache.forEach(((s,v)=>{if(g)return;const m=s.getLength(),y=(p-f)/m;f+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,d,r[v],[l,t.attribute],Lt(y,1),b,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,y,b,i,n,t,a,o)}},t.DefaultCanvasLineRender=kh([g()],t.DefaultCanvasLineRender);const Dh=new xh,jh=Yl;var Uh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Wh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasAreaRender=class extends Gl{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=so,this.builtinContributions=[Dh,jh],this.init(t)}drawLinearAreaHighPerformance(t,e,i,n,r,s,a,o,l,h,c,u,d){var p,f,g;const{points:v}=t.attribute;if(v.length<2)return;e.beginPath();const m=null!==(p=this.z)&&void 0!==p?p:0,y=v[0];e.moveTo(y.x+a,y.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}for(let t=v.length-1;t>=0;t--){const i=v[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+a,(null!==(g=i.y1)&&void 0!==g?g:i.y)+o,m)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!r,!1,i,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):r&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!r,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,r;if(n){const{stroke:n=l&&l.stroke}=t.attribute;if(st(n)&&(n[0]||n[2])&&!1===n[1])if(e.beginPath(),n[0]){e.moveTo(y.x+a,y.y+o,m);for(let t=1;t<v.length;t++){const i=v[t];e.lineTo(i.x+a,i.y+o,m)}}else if(n[2]){const t=v[v.length-1];e.moveTo(t.x+a,t.y+o,m);for(let t=v.length-2;t>=0;t--){const n=v[t];e.lineTo((null!==(i=n.x1)&&void 0!==i?i:n.x)+a,(null!==(r=n.y1)&&void 0!==r?r:n.y)+o,m)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,n,r,s,a,o){var l,h,c,u,d,p;const f=kr(t,null==s?void 0:s.theme).area,{fill:g=f.fill,stroke:v=f.stroke,fillOpacity:m=f.fillOpacity,z:y=f.z,strokeOpacity:b=f.strokeOpacity,curveTension:x=f.curveTension}=t.attribute,w=this.valid(t,f,a,o);if(!w)return;const{doFill:S}=w,A=w.doStroke&&w.sVisible,{clipRange:T=f.clipRange,closePath:C,points:_,segments:B}=t.attribute;let{curveType:P=f.curveType}=t.attribute;if(C&&"linear"===P&&(P="linearClosed"),1===T&&!B&&!_.some((t=>!1===t.defined))&&"linear"===P)return this.drawLinearAreaHighPerformance(t,e,!!g,A,m,b,i,n,f,r,s,a,o);if(t.shouldUpdateShape()){if(B&&B.length){let e,i;const n=B.map(((t,n)=>{if(t.points.length<=1&&0===n)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===n?e={x:i.endX,y:i.endY}:n>1&&(e.x=i.endX,e.y=i.endY);const r=Ui(t.points,P,{startPoint:e,curveTension:x});return i=r,r})).filter((t=>!!t));let r;const s=[];for(let t=B.length-1;t>=0;t--){const e=B[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=B[t-1].points,n=e[e.length-1];n&&i.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(u=n.y1)&&void 0!==u?u:n.y})}i.length>1&&(r=Ui(i,"stepBefore"===P?"stepAfter":"stepAfter"===P?"stepBefore":P,{curveTension:x}),s.unshift(r))}t.cacheArea=s.map(((t,e)=>({top:n[e],bottom:t})))}else{if(!_||!_.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=_,i=[];for(let t=_.length-1;t>=0;t--)i.push({x:null!==(d=_[t].x1)&&void 0!==d?d:_[t].x,y:null!==(p=_[t].y1)&&void 0!==p?p:_[t].y});const n=Ui(e,P,{curveTension:x}),r=Ui(i,"stepBefore"===P?"stepAfter":"stepAfter"===P?"stepBefore":P,{curveTension:x});t.cacheArea={top:n,bottom:r}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const s=t.attribute.segments.filter((t=>t.points.length));if(1===s[0].points.length&&s.shift(),1===T){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,m,A,b,s[c],[f,t.attribute],T,i,n,y,t,r,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),g=(h-c)/p;c+=p,g>0&&(u=this.drawSegmentItem(e,l,S,m,A,b,s[d],[f,t.attribute],Lt(g,1),i,n,y,t,r,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,m,A,b,t.attribute,f,T,i,n,y,t,r,a,o)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).area;this._draw(t,r,!1,i,n)}drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,f,g){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,!1,f,g),v=v||this._drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,!0,f,g),v}_drawSegmentItem(e,i,n,r,s,a,o,l,h,c,u,d,p,f,g,v,m){var y,b,x,w;if(!(i&&i.top&&i.bottom&&i.top.curves&&i.top.curves.length&&i.bottom.curves&&i.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:T,connectedStyle:C}=o;const _=[];if(g&&(st(l)?(S=null!==(y=null!=S?S:l[0].connectedType)&&void 0!==y?y:l[1].connectedType,A=null!==(b=null!=A?A:l[0].connectedX)&&void 0!==b?b:l[1].connectedX,T=null!==(x=null!=T?T:l[0].connectedY)&&void 0!==x?x:l[1].connectedY,C=null!==(w=null!=C?C:l[0].connectedStyle)&&void 0!==w?w:l[1].connectedStyle):(S=null!=S?S:l.connectedType,A=null!=A?A:l.connectedX,T=null!=T?T:l.connectedY,C=null!=C?C:l.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),st(l)?l.forEach((t=>_.push(t))):_.push(l),_.push(o)),g&&"none"===S)return!1;e.beginPath();const{points:B,segments:P}=p.attribute;let R,M,E=t.Direction.ROW;if(P){const t=P[P.length-1];M=P[0].points[0],R=t.points[t.points.length-1]}else M=B[0],R=B[B.length-1];const k=Mt(R.x-M.x),O=Mt(R.y-M.y);E=null==R.x1?t.Direction.ROW:null==R.y1?t.Direction.COLUMN:Number.isFinite(k+O)?k>O?t.Direction.ROW:t.Direction.COLUMN:t.Direction.ROW,Oh(e.camera?e:e.nativeContext,i,h,{offsetX:c,offsetY:u,offsetZ:d,direction:E,drawConnect:g,mode:S,zeroX:A,zeroY:T}),this.beforeRenderStep(p,e,c,u,!!r,!1,n,!1,l,f,v,null,{attribute:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(p,o,l);const{x:L=0,x:I=0}=o;return!1!==n&&(v?v(e,o,l):r&&(e.setCommonStyle(p,g?C:o,L-c,I-u,g?_:l),e.fill())),this.afterRenderStep(p,e,c,u,!!r,!1,n,!1,l,f,v,null,{attribute:o}),(()=>{if(!1!==s)if(m)m(e,o,l);else{const{stroke:n=l&&l[1]&&l[1].stroke}=o;st(n)&&(n[0]||n[2])&&!1===n[1]&&(e.beginPath(),Rh(e.camera?e:e.nativeContext,n[0]?i.top:i.bottom,h,E===t.Direction.ROW?"x":"y",{offsetX:c,offsetY:u,offsetZ:d,drawConnect:g,mode:S,zeroX:A,zeroY:T})),e.setStrokeStyle(p,g?C:o,L-c,I-u,g?_:l),e.stroke()}})(),!1}},t.DefaultCanvasAreaRender=Uh([g(),Nh(0,p(k)),Nh(0,v(nl)),Wh("design:paramtypes",[Object])],t.DefaultCanvasAreaRender);const Gh=$l,Fh=Yl;var zh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vh=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasPathRender=class extends Gl{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=uo,this.builtinContributions=[Fh,Gh],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:kr(t,null==s?void 0:s.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:f=u.fillStrokeOrder}=t.attribute,g=null!==(h=this.z)&&void 0!==h?h:0,v=this.valid(t,u,a,o);if(!v)return;const{fVisible:m,sVisible:y,doFill:b,doStroke:x}=v;if(e.beginPath(),t.pathShape)Ze(t.pathShape.commandList,e,i,n,1,1,g);else{Ze((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,n,1,1,g)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,b,x,m,y,u,r,a,o);const w=()=>{x&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-n,u),e.stroke()))},S=()=>{b&&(a?a(e,t.attribute,u):m&&(e.setCommonStyle(t,t.attribute,d-i,p-n,u),e.fill()))};f?(w(),S()):(S(),w()),this.afterRenderStep(t,e,i,n,b,x,m,y,u,r,a,o)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).path;this.tempTheme=r,this._draw(t,r,!1,i,n),this.tempTheme=null}},t.DefaultCanvasPathRender=zh([g(),Vh(0,p(k)),Vh(0,v(ol)),Hh("design:paramtypes",[Object])],t.DefaultCanvasPathRender);var Yh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Xh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$h=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasRectRender=class extends Gl{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=go,this.builtinContributions=[hh,uh,ch],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:kr(t,null==s?void 0:s.theme).rect,{fill:c=h.fill,background:u,stroke:d=h.stroke,cornerRadius:p=h.cornerRadius,opacity:f=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x1:b,y1:x,x:w=h.x,y:S=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:b-w)||0,C=(null!=C?C:x-S)||0;const _=zo(f,g,T,C,c),B=Vo(f,m,T,C),P=No(c,u),R=Go(d,v);if(!t.valid||!y)return;if(!P&&!R)return;if(!(_||B||a||o||u))return;0===p||st(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,n,T,C)):(e.beginPath(),ah(e,i,n,T,C,p));const M={doFill:P,doStroke:R};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,P,R,_,B,h,r,a,o,M);const E=()=>{M.doFill&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,w-i,S-n,h),e.fill()))},k=()=>{M.doStroke&&(o?o(e,t.attribute,h):B&&(e.setStrokeStyle(t,t.attribute,w-i,S-n,h),e.stroke()))};A?(k(),E()):(E(),k()),this.afterRenderStep(t,e,i,n,P,R,_,B,h,r,a,o)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).rect;this.tempTheme=r,this._draw(t,r,!1,i,n),this.tempTheme=null}},t.DefaultCanvasRectRender=Yh([g(),$h(0,p(k)),$h(0,v(hl)),Xh("design:paramtypes",[Object])],t.DefaultCanvasRectRender);var qh=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Kh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zh=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasSymbolRender=class extends Gl{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=yo,this.builtinContributions=[mh,bh,yh],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var l;const h=kr(t,null==s?void 0:s.theme).symbol,{size:c=h.size,x:u=h.x,y:d=h.y,scaleX:p=h.scaleX,scaleY:f=h.scaleY,fillStrokeOrder:g=h.fillStrokeOrder}=t.attribute,v=this.valid(t,h,a,o);if(!v)return;const{fVisible:m,sVisible:y,doFill:b,doStroke:x}=v,w=t.getParsedPath();if(!w)return;const{keepDirIn3d:S=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const T=(r,s)=>{var l,c,v;if(t._parsedPath.svgCache){const e=Object.assign({},s);e.fill=null!==(l=s.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=s.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=s.stroke)&&void 0!==v?v:t.attribute.stroke,s=e}const m=()=>{s.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,s,u-i,d-n,h),e.fill()))},y=()=>{s.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,s,(u-i)/p,(d-n)/f,h),e.stroke()))};g?(y(),m()):(m(),y())};if(S&&e.camera&&e.project){const t=e.project(i,n,A),r=e.camera;e.camera=null,!1===w.draw(e,st(c)?[c[0]*p,c[1]*f]:c*p,t.x,t.y,void 0,T)&&e.closePath(),e.camera=r}else!1===w.draw(e,c,i,n,A,T)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,n,b,x,m,y,h,r,a,o);const C=()=>{b&&!w.isSvg&&(a?a(e,t.attribute,h):m&&(e.setCommonStyle(t,t.attribute,u-i,d-n,h),e.fill()))},_=()=>{x&&!w.isSvg&&(o?o(e,t.attribute,h):y&&(e.setStrokeStyle(t,t.attribute,(u-i)/p,(d-n)/f,h),e.stroke()))};g?(_(),C()):(C(),_()),this.afterRenderStep(t,e,i,n,b,x,m,y,h,r,a,o)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).symbol;this._draw(t,r,!1,i,n)}},t.DefaultCanvasSymbolRender=qh([g(),Zh(0,p(k)),Zh(0,v(cl)),Kh("design:paramtypes",[Object])],t.DefaultCanvasSymbolRender);const Jh=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new le)}allocate(t,e,i,n){if(!this.pools.length)return(new le).setValue(t,e,i,n);const r=this.pools.pop();return r.x1=t,r.y1=e,r.x2=i,r.y2=n,r}allocateByObj(t){if(!this.pools.length)return new le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const Qh=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let tc,ec;function ic(t){return tc||(tc=Qh.CreateGraphic("text",{})),tc.initAttributes(t),tc.AABBBounds}const nc=new class extends Vl{constructor(){super(...arguments),this.time=t.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,n,r,s,a,o,l,h,c,u){var d,p,f,g,v,m,y,b,x,w;const{backgroundMode:S=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let T,{background:C}=t.attribute;if(!C)return;const _=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let B;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const P=Q(C)&&C.background,R=t.transMatrix.onlyTranslate();if(P){const e=t.AABBBounds,i=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),n=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(g=C.dy)&&void 0!==g?g:0),r=null!==(v=C.width)&&void 0!==v?v:e.width(),s=null!==(m=C.height)&&void 0!==m?m:e.height();if(B=Jh.allocate(i,n,i+r,n+s),C=C.background,!R){const t=B.width(),e=B.height();B.set((null!==(y=C.x)&&void 0!==y?y:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(x=C.y)&&void 0!==x?x:0)+(null!==(w=C.dy)&&void 0!==w?w:0),t,e)}}else B=t.AABBBounds,R||(B=ic(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const r=t.resources.get(C);if("success"!==r.state||!r.data)return void _();e.highPerformanceSave(),R&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,n,l),this.doDrawImage(e,r.data,B,S,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:r}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=C,r?(ah(e,B.x1,B.y1,B.width(),B.height(),r),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}P&&Jh.free(B),_()}};var rc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},sc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ac=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasTextRender=class extends Gl{constructor(t){super(),this.textRenderContribitions=t,this.numberType=bo,this.builtinContributions=[nc],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var l,h,c;const u=kr(t,null==s?void 0:s.theme).text,{text:d,underline:p=u.underline,lineThrough:f=u.lineThrough,keepDirIn3d:g=u.keepDirIn3d,direction:v=u.direction,fontSize:m=u.fontSize,verticalMode:y=u.verticalMode,x:b=u.x,y:x=u.y}=t.attribute,w=null!==(l=Cs(t.attribute.lineHeight,m))&&void 0!==l?l:m,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:T,doFill:C,doStroke:_}=S,B=!g,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,n,C,_,A,T,u,r,a,o),B&&this.transformUseContext2d(t,u,P,e);const R=(r,s,l,h)=>{let c=i+s;const d=n+l;if(h){e.highPerformanceSave(),c+=m;const t=Ol.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Ol.free(t)}_&&(o?o(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,u),e.strokeText(r,c,d,P))),C&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,b-i,x-n,u),e.fillText(r,c,d,P))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,P),"horizontal"===v){const{multilineLayout:r}=t;if(!r)return void e.highPerformanceRestore();const{xOffset:s,yOffset:l}=r.bbox;_&&(o?o(e,t.attribute,u):T&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,u),r.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+s+i,(t.topOffset||0)+l+n,P)})))),C&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,b-i,x-n,u),r.lines.forEach((r=>{e.fillText(r.str,(r.leftOffset||0)+s+i,(r.topOffset||0)+l+n,P),this.drawUnderLine(p,f,t,(r.leftOffset||0)+s+i,(r.topOffset||0)+l+n,r.descent,(r.descent-r.ascent)/2,P,u,e,{width:r.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:n=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[n])&&void 0!==h?h:"left",n=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const r=t.cache,{verticalList:s}=r;e.textAlign="left",e.textBaseline="top";const a=w*s.length;let o=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Ot(e,o)}));let l=0,d=0;"bottom"===n?d=-a:"middle"===n&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),s.forEach(((t,e)=>{const n=t.reduce(((t,e)=>t+(e.width||0)),0),r=o-n;let s=l;"center"===i?s+=r/2:"right"===i&&(s+=r),t.forEach((t=>{const{text:i,width:n,direction:r}=t;R(i,a-(e+1)*w+d,s,r),s+=n}))}))}B&&this.restoreTransformUseContext2d(t,u,P,e),this.afterRenderStep(t,e,i,n,C,_,A,T,u,r,a,o)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).text,{keepDirIn3d:s=r.keepDirIn3d}=t.attribute,a=!s;this._draw(t,r,a,i,n)}drawUnderLine(t,e,i,n,r,s,a,o,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:d=l.fill,opacity:p=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:g=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,m=!Z(c),y=m?c.width:i.clipedWidth,b=m?0:fl(u,y),x={lineWidth:0,stroke:d,opacity:p,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,n,r,l),g&&h.setLineDash(g),h.beginPath();const e=r+s+f;h.moveTo(n+b,e,o),h.lineTo(n+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,n,r,l),h.beginPath();const t=r+a;h.moveTo(n+b,t,o),h.lineTo(n+b+y,t,o),h.stroke()}}},t.DefaultCanvasTextRender=rc([g(),ac(0,p(k)),ac(0,v(ul)),sc("design:paramtypes",[Object])],t.DefaultCanvasTextRender);var oc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};function lc(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let r=1;r<e.length;r++)t.lineTo(e[r].x+i,e[r].y+n)}function hc(t,e){return Math.sqrt(t*t+e*e)}function cc(t,e,i,n,r){const s=e/i;return{x:t.x-n*s,y:t.y-r*s}}t.AbstractGraphicRender=class{},t.AbstractGraphicRender=oc([g()],t.AbstractGraphicRender);const uc=$l,dc=Yl;var pc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gc=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasPolygonRender=class extends Gl{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=po,this.builtinContributions=[dc,uc],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const l=kr(t,null==s?void 0:s.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:u=l.x,y:d=l.y,closePath:p=l.closePath,fillStrokeOrder:f=l.fillStrokeOrder}=t.attribute,g=this.valid(t,l,a,o);if(!g)return;const{fVisible:v,sVisible:m,doFill:y,doStroke:b}=g;e.beginPath(),c<=0||st(c)&&c.every((t=>0===t))?lc(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,r){let s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void lc(t,e,i,n);let o=0,l=e.length-1;s||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+n));for(let s=o;s<=l;s++){const o=e[0===s?l:(s-1)%e.length],h=e[s%e.length],c=e[(s+1)%e.length],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,f=h.y-c.y,g=(Math.atan2(d,u)-Math.atan2(f,p))/2,v=Math.abs(Math.tan(g));let m=Array.isArray(r)?null!==(a=r[s%e.length])&&void 0!==a?a:0:r,y=m/v;const b=hc(u,d),x=hc(p,f),w=Math.min(b,x);y>w&&(y=w,m=w*v);const S=cc(h,y,b,u,d),A=cc(h,y,x,p,f),T=2*h.x-S.x-A.x,C=2*h.y-S.y-A.y,_=hc(T,C),B=cc(h,hc(y,m),_,T,C);let P=Math.atan2(S.y-B.y,S.x-B.x);const R=Math.atan2(A.y-B.y,A.x-B.x);let M=R-P;M<0&&(P=R,M=-M),M>Math.PI&&(M-=Math.PI),0===s?t.moveTo(S.x+i,S.y+n):t.lineTo(S.x+i,S.y+n),M&&t.arcTo(h.x+i,h.y+n,A.x+i,A.y+n,m),t.lineTo(A.x+i,A.y+n)}s||t.lineTo(e[l+1].x+i,e[l+1].y+n)}(e.camera?e:e.nativeContext,h,i,n,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,n,y,b,v,m,l,r,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,u-i,d-n,l),e.fill()))},w=()=>{b&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,u-i,d-n,l),e.stroke()))};f?(w(),x()):(x(),w()),this.afterRenderStep(t,e,i,n,y,b,v,m,l,r,a,o)}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).polygon;this._draw(t,r,!1,i,n)}},t.DefaultCanvasPolygonRender=pc([g(),gc(0,p(k)),gc(0,v(ll)),fc("design:paramtypes",[Object])],t.DefaultCanvasPolygonRender);var vc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},mc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yc=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasGroupRender=class{constructor(t){this.groupRenderContribitions=t,this.numberType=lo}drawShape(e,i,n,r,s,a,o,l){const h=kr(e,null==a?void 0:a.theme).group,{fill:c=h.fill,background:u,stroke:d=h.stroke,opacity:p=h.opacity,width:f=h.width,height:g=h.height,clip:v=h.clip,fillOpacity:m=h.fillOpacity,strokeOpacity:y=h.strokeOpacity,cornerRadius:b=h.cornerRadius,path:x=h.path,lineWidth:w=h.lineWidth,visible:S=h.visible,fillStrokeOrder:A=h.fillStrokeOrder,x:T=h.x,y:C=h.y}=e.attribute,_=zo(p,m,f,g,c),B=Vo(p,y,f,g),P=No(c,u),R=Go(d,w);if(!e.valid||!S)return;if(!v){if(!P&&!R)return;if(!(_||B||o||l||u))return}if(x&&x.length&&s.drawContribution){const t=i.disableFill,e=i.disableStroke,n=i.disableBeginPath;i.disableFill=!0,i.disableStroke=!0,i.disableBeginPath=!0,x.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,a)})),i.disableFill=t,i.disableStroke=e,i.disableBeginPath=n}else 0===b||st(b)&&b.every((t=>0===t))?(i.beginPath(),i.rect(n,r,f,g)):(i.beginPath(),ah(i,n,r,f,g,b));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(rh));const M={doFill:P,doStroke:R};this._groupRenderContribitions.forEach((a=>{a.time===t.BaseRenderContributionTime.beforeFillStroke&&a.drawShape(e,i,n,r,P,R,_,B,h,s,o,l,M)})),v&&i.clip(),i.setShadowBlendStyle&&i.setShadowBlendStyle(e,e.attribute,h);const E=()=>{M.doFill&&(o?o(i,e.attribute,h):_&&(i.setCommonStyle(e,e.attribute,T-n,C-r,h),i.fill()))},k=()=>{M.doStroke&&(l?l(i,e.attribute,h):B&&(i.setStrokeStyle(e,e.attribute,T-n,C-r,h),i.stroke()))};A?(k(),E()):(E(),k()),this._groupRenderContribitions.forEach((a=>{a.time===t.BaseRenderContributionTime.afterFillStroke&&a.drawShape(e,i,n,r,P,R,_,B,h,s,o,l)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;const{clip:s,baseOpacity:a=1}=t.attribute;s?r.save():r.highPerformanceSave();const o=r.baseGlobalAlpha;r.baseGlobalAlpha*=a;const l=kr(t,null==n?void 0:n.theme).group,h=r.modelMatrix;if(r.camera){const e=Ll.allocate(),i=Ll.allocate();Ul(i,t,l),Tl(e,h||e,i),r.modelMatrix=e,Ll.free(i),r.setTransform(1,0,0,1,0,0,!0)}else r.transformFromMatrix(t.transMatrix,!0);r.beginPath(),n.skipDraw?this.drawShape(t,r,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,r,0,0,i);const{scrollX:c=l.scrollX,scrollY:u=l.scrollY}=t.attribute;let d;(c||u)&&r.translate(c,u),n&&n.drawingCb&&(d=n.drawingCb()),r.modelMatrix!==h&&Ll.free(r.modelMatrix),r.modelMatrix=h,r.baseGlobalAlpha=o,d&&d.then?d.then((()=>{s?r.restore():r.highPerformanceRestore()})):s?r.restore():r.highPerformanceRestore()}},t.DefaultCanvasGroupRender=vc([g(),yc(0,p(k)),yc(0,v(sl)),mc("design:paramtypes",[Object])],t.DefaultCanvasGroupRender);var bc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},xc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wc=function(t,e){return function(i,n){e(i,n,t)}};const Sc=["","repeat-x","repeat-y","repeat"];t.DefaultCanvasImageRender=class extends Gl{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=ho,this.builtinContributions=[fh,gh],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const l=kr(t).image,{width:h=l.width,height:c=l.height,repeatX:u=l.repeatX,repeatY:d=l.repeatY,x:p=l.x,y:f=l.y,cornerRadius:g=l.cornerRadius,fillStrokeOrder:v=l.fillStrokeOrder,image:m}=t.attribute,y=this.valid(t,l,a);if(!y)return;const{fVisible:b,sVisible:x,doFill:w,doStroke:S}=y;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,n,w,!1,b,!1,l,r,a);const A=()=>{if(w)if(a)a(e,t.attribute,l);else if(b){if(!m||!t.resources)return;const r=t.resources.get(m);if("success"!==r.state)return;let s=!1;0===g||st(g)&&g.every((t=>0===t))||(e.beginPath(),ah(e,i,n,h,c,g),e.save(),e.clip(),s=!0),e.setCommonStyle(t,t.attribute,i,n,l);let a=0;if("repeat"===u&&(a|=1),"repeat"===d&&(a|=2),a){const t=e.createPattern(r.data,Sc[a]);e.fillStyle=t,e.translate(i,n,!0),e.fillRect(0,0,h,c),e.translate(-i,-n,!0)}else e.drawImage(r.data,i,n,h,c);s&&e.restore()}},T=()=>{S&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,f-n,l),e.stroke()))};v?(T(),A()):(A(),T()),this.afterRenderStep(t,e,i,n,w,!1,b,!1,l,r,a)}draw(t,e,i){const{image:n}=t.attribute;if(!n||!t.resources)return;const r=t.resources.get(n);if("loading"===r.state&&rt(n))return void Ta.improveImageLoading(n);if("success"!==r.state)return;const{context:s}=e.drawParams;if(!s)return;const a=kr(t).image;this._draw(t,a,!1,i)}},t.DefaultCanvasImageRender=bc([g(),wc(0,p(k)),wc(0,v(al)),xc("design:paramtypes",[Object])],t.DefaultCanvasImageRender);const Ac=Symbol.for("IncrementalDrawContribution"),Tc=Symbol.for("ArcRender"),Cc=Symbol.for("Arc3dRender"),_c=Symbol.for("AreaRender"),Bc=Symbol.for("CircleRender"),Pc=Symbol.for("GraphicRender"),Rc=Symbol.for("GroupRender"),Mc=Symbol.for("LineRender"),Ec=Symbol.for("PathRender"),kc=Symbol.for("PolygonRender"),Oc=Symbol.for("RectRender"),Lc=Symbol.for("Rect3DRender"),Ic=Symbol.for("SymbolRender"),Dc=Symbol.for("TextRender"),jc=Symbol.for("RichTextRender"),Uc=Symbol.for("Pyramid3dRender"),Wc=Symbol.for("GlyphRender"),Nc=Symbol.for("ImageRender"),Gc=Symbol.for("RenderSelector"),Fc=Symbol.for("DrawContribution"),zc=(t,e,i,n)=>{let r,s=!1,a=!1;if(e.forEachChildren((t=>(s=t.numberType===ro,!s))),e.forEachChildren((t=>(a=!!t.findFace,!a))),s){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,n,r,s;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(s=null!==(r=e.attribute.startAngle)&&void 0!==r?r:0+e.attribute.endAngle)&&void 0!==s?s:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),n.hack_pieFace="outside",r=i(s,a),r&&r.graphic||(n.hack_pieFace="inside",r=i(s,a)),r&&r.graphic||(n.hack_pieFace="top",r=i(s,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const n=e.getChildren(),o=n.map((e=>({ave_z:e.findFace().vertices.map((i=>{var n;return t.view(i[0],i[1],null!==(n=i[2]+e.attribute.z)&&void 0!==n?n:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),r=i(s,a),e.removeAllChild(),n.forEach((t=>{t._next=null,t._prev=null})),e.update(),n.forEach((t=>{e.add(t)}))}else r=i(s,a);return r};var Hc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Vc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Yc=Symbol.for("DrawItemInterceptor"),Xc=new le,$c=new le;class qc{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,n,r),!1}beforeDrawItem(t,e,i,n,r){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.shadowRoot)return!1;const{context:s}=i;s.highPerformanceSave();const a=t.parent.globalTransMatrix,o=t.stage.window.getViewBoxTransform().clone().multiply(a.a,a.b,a.c,a.d,a.e,a.f);if(t.parent&&s.setTransformFromMatrix(o,!0),n.dirtyBounds&&n.backupDirtyBounds){Xc.copy(n.dirtyBounds),$c.copy(n.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e),n.backupDirtyBounds.copy(n.dirtyBounds)}return n.renderGroup(t.shadowRoot,i,Ol.allocate(1,0,0,1,0,0)),s.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&(n.dirtyBounds.copy(Xc),n.backupDirtyBounds.copy($c)),!0}}class Kc{constructor(){this.order=1}afterDrawItem(t,e,i,n,r){return t.attribute._debug_bounds&&this.drawItem(t,e,i,n,r),!1}drawItem(t,e,i,n,r){if(!t.attribute._debug_bounds)return!1;const{context:s}=i;s.highPerformanceSave(),t.parent&&s.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&s.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(s,t),s.strokeRect(a.x1,a.y1,a.width(),a.height()),s.highPerformanceRestore(),!0}}t.CommonDrawItemInterceptorContribution=class{constructor(){this.order=1,this.interceptors=[new qc,new Jc,new Zc,new Kc]}afterDrawItem(t,e,i,n,r){for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].afterDrawItem&&this.interceptors[s].afterDrawItem(t,e,i,n,r))return!0;return!1}beforeDrawItem(t,e,i,n,r){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let s=0;s<this.interceptors.length;s++)if(this.interceptors[s].beforeDrawItem&&this.interceptors[s].beforeDrawItem(t,e,i,n,r))return!0;return!1}},t.CommonDrawItemInterceptorContribution=Hc([g(),Vc("design:paramtypes",[])],t.CommonDrawItemInterceptorContribution);class Zc{constructor(){this.order=1}beforeDrawItem(t,e,i,n,r){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,n,r):this.beforeSetInteractive(t,e,i,n,r))}beforeSetInteractive(t,e,i,n,r){let s=t.interactiveGraphic;if(t.attribute.globalZIndex){s||(s=t.clone(),t.interactiveGraphic=s,s.baseGraphic=t),s.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).add(s),!0}if(s){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(s),t.interactiveGraphic=null,s.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,n,r){const s=t.baseGraphic;let a=!!s.stage,o=s.parent;for(;a&&o&&o.stage!==o;)a=!!o.stage,o=o.parent;if(!a){const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(s){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(s.parent.globalTransMatrix,!0),s.isContainer?n.renderGroup(s,i,s.parent.globalTransMatrix):n.renderItem(s,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=Qh.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class Jc{constructor(){this.order=1}beforeDrawItem(t,e,i,n,r){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:s,stage:a}=e.drawParams;s.canvas,s.save(),this.initCanvasCtx(s),s.camera=a.camera;const o=s.currentMatrix;o.a/=s.dpr,o.b/=s.dpr,o.c/=s.dpr,o.d/=s.dpr,o.e/=s.dpr,o.f/=s.dpr;const l=Ll.allocate();Sl(l,o);const h=s.modelMatrix;if(h){if(l){const t=Ll.allocate();s.modelMatrix=Tl(t,h,l)}}else s.modelMatrix=l;return s.setTransform(1,0,0,1,0,0,!0),t.isContainer?zc(s,t,((e,r)=>n.renderGroup(t,i,t.parent.globalTransMatrix,!e&&r)),i):n.renderItem(t,i),s.camera=null,s.restore(),s.modelMatrix!==h&&Ll.free(s.modelMatrix),s.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Qc=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},tu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eu=function(t,e){return function(i,n){e(i,n,t)}};const iu=Symbol.for("RenderService"),nu=Symbol.for("BeforeRenderConstribution");t.DefaultRenderService=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}},t.DefaultRenderService=Qc([g(),eu(0,p(Fc)),tu("design:paramtypes",[Object])],t.DefaultRenderService);var ru=new i((e=>{e(iu).to(t.DefaultRenderService)}));const su=Symbol.for("GraphicPicker"),au=Symbol.for("PickerService"),ou=Symbol.for("BoundsPicker"),lu=Symbol.for("GlobalPickerService"),hu=(t,e,i)=>{const{outerBorder:n,shadowBlur:r=e.shadowBlur}=t;if(n){const t=e.outerBorder,{distance:s=t.distance,lineWidth:a=t.lineWidth}=n;i.expand(s+(r+a)/2)}return i},cu=["radius","startAngle","endAngle",...Pa];class uu extends La{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=ao}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return kr(this).circle}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=vn.graphicService.updateTempAABBBounds(i);return hu(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2),vn.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:n=e.radius}=t;return i.set(-n,-n,n,n),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:n=e.startAngle,endAngle:r=e.endAngle,radius:s=e.radius}=t;return r-n>Rt-Ct?i.set(-s,-s,s,s):gs(n,r,s,i),i}needUpdateTags(t){return super.needUpdateTags(t,cu)}needUpdateTag(t){return super.needUpdateTag(t,cu)}toCustomPath(){var t,e,i;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),s=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new Wi;return o.arc(0,0,r,s,a),o}clone(){return new uu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return uu.NOWORK_ANIMATE_ATTR}}function du(t){return new uu(t)}uu.NOWORK_ANIMATE_ATTR=Oa;class pu{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,n){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===n.length){const t=n[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(e,i,n,r){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0;const{lineWidth:l,suffixPosition:h="end",measureMode:c=t.MeasureModeEnum.actualBounding,keepCenterInLine:u=!1}=null!=o?o:{};e=e.map((t=>t.toString()));const d=[],p=[0,0];if("number"==typeof l&&l!==1/0){let t;for(let i=0,n=e.length;i<n;i++){const n=this.textMeasure.measureTextPixelADscentAndWidth(e[i],this.textOptions,c);let r=e[i].toString();if(n.width>l){const n=this.textMeasure.clipTextWithSuffix(e[i],this.textOptions,l,s,a,h);r=n.str,t=n.width}else t=n.width;d.push({str:r,width:t,ascent:n.ascent,descent:n.descent,keepCenterInLine:u})}p[0]=l}else{let t,i,n=0;for(let r=0,s=e.length;r<s;r++){i=e[r];const s=this.textMeasure.measureTextPixelADscentAndWidth(e[r],this.textOptions,c);t=s.width,n=Math.max(n,t),d.push({str:i,width:t,ascent:s.ascent,descent:s.descent,keepCenterInLine:u})}p[0]=n}p[1]=d.length*r,p[0]=d.reduce(((t,e)=>Math.max(t,e.width)),0);const f={xOffset:0,yOffset:0,width:p[0],height:p[1]};return this.LayoutBBox(f,i,n,d),this.layoutWithBBox(f,d,i,n,r)}layoutWithBBox(t,e,i,n,r){const s=[0,0],a=e.length*r;"top"===n||("middle"===n?s[1]=(t.height-a)/2:"bottom"===n&&(s[1]=t.height-a));for(let a=0;a<e.length;a++)this.lineOffset(t,e[a],i,n,r,s);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:r,textAlign:i,textBaseline:n}}lineOffset(t,e,i,n,r,s){if("left"===i||"start"===i?e.leftOffset=0:"center"===i?e.leftOffset=(t.width-e.width)/2:"right"!==i&&"end"!==i||(e.leftOffset=t.width-e.width),e.topOffset=r/2+(e.ascent-e.descent)/2+s[1],!e.keepCenterInLine){const t=0,i=e.ascent+e.descent+t;if(i<r-t&&("bottom"===n?e.topOffset+=(r-i)/2:"top"===n&&(e.topOffset-=(r-i)/2)),"alphabetic"===n){const t=r/(e.ascent+e.descent);e.topOffset=r/2+(e.ascent-e.descent)/2*t+s[1]}}return s[1]+=r,e}}const fu=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Pa];class gu extends La{get font(){const t=this.getGraphicTheme();return this._font||(this._font=re(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=this.getGraphicTheme(),n=this.getMaxWidth(i);return Number.isFinite(n)?(this.tryUpdateAABBBounds(),this.cache.clipedText):(null!==(t=e.text)&&void 0!==t?t:i.text).toString()}get clipedWidth(){return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){var t,e;const i=this.getGraphicTheme(),n=this.attribute,r=this.getMaxWidth(i);if(!Number.isFinite(r))return!1;const{text:s}=this.attribute;if(this.tryUpdateAABBBounds(),null===(e=null===(t=this.cache)||void 0===t?void 0:t.layoutData)||void 0===e?void 0:e.lines){let t="";return this.cache.layoutData.lines.forEach((e=>{t+=e.str})),(Array.isArray(s)?s.join(""):s)!==t}return"vertical"===n.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==n.text.toString():null!=this.clipedText&&this.clipedText!==n.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=bo,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return st(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return kr(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new gu({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:s}=e,a={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},o=Qt(a,i,{x:r,y:s});return this._OBBBounds.copy(n),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:n=e.text}=this.attribute;Array.isArray(n)?this.updateMultilineAABBBounds(n):this.updateSingallineAABBBounds(n);const{tb1:r}=vn.graphicService.updateTempAABBBounds(i),{scaleX:s=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){$a(r,o/Math.abs(s+a),!0,l),i.union(r)}return vn.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vn.graphicService.updateHTMLTextAABBBounds(t,e,i),ae(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:n=e.underlineOffset}=this.attribute,r="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&n&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+n),r}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=i.fontFamily,textAlign:s=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:u=i.stroke,wrap:d=i.wrap,measureMode:p=i.measureMode,lineWidth:f=i.lineWidth,whiteSpace:g=i.whiteSpace,suffixPosition:v=i.suffixPosition,ignoreBuf:m=i.ignoreBuf,keepCenterInLine:y=i.keepCenterInLine}=n,b=m?0:this.guessLineHeightBuf(o),x=this.getLineHeight(n,i,b);if("normal"===g||d)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}const w=vn.graphicUtil.textMeasure,S=new pu(r,{fontSize:o,fontWeight:l,fontFamily:r,lineHeight:x},w).GetLayoutByLines(t,s,a,x,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:v,measureMode:p,keepCenterInLine:y}),{bbox:A}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,n;const r=this.getGraphicTheme(),{fontFamily:s=r.fontFamily,textAlign:a=r.textAlign,textBaseline:o=r.textBaseline,fontSize:l=r.fontSize,ellipsis:h=r.ellipsis,maxLineWidth:c,stroke:u=r.stroke,lineWidth:d=r.lineWidth,wordBreak:p=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:g=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:m=r.suffixPosition,heightLimit:y=0,lineClamp:b,keepCenterInLine:x=r.keepCenterInLine}=this.attribute,w=g?0:this.guessLineHeightBuf(l),S=this.getLineHeight(this.attribute,r,w);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(d/2),this._AABBBounds}const A=vn.graphicUtil.textMeasure,T={fontSize:l,fontWeight:f,fontFamily:s,lineHeight:S},C=new pu(s,T,A),_=st(t)?t.map((t=>t.toString())):[t.toString()],B=[],P=[0,0];let R=1/0;if(y>0&&(R=Math.max(Math.floor(y/S),1)),b&&(R=Math.min(R,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t<_.length;t++){const e=_[t];let r=!0;if(t===R-1){const i=A.clipTextWithSuffix(e,T,c,h,!1,m,t!==_.length-1),n=A.measureTextPixelADscentAndWidth(i.str,T,v);B.push({str:i.str,width:i.width,ascent:n.ascent,descent:n.descent,keepCenterInLine:x});break}const s=A.clipText(e,T,c,"break-all"!==p,"keep-all"===p);if(""!==e&&""===s.str||s.wordBreaked){if(h){const t=A.clipTextWithSuffix(e,T,c,h,!1,m);s.str=null!==(i=t.str)&&void 0!==i?i:"",s.width=null!==(n=t.width)&&void 0!==n?n:0}else s.str="",s.width=0;r=!1}const a=A.measureTextPixelADscentAndWidth(s.str,T,v);B.push({str:s.str,width:s.width,ascent:a.ascent,descent:a.descent,keepCenterInLine:x});let o=s.str.length;if(!s.wordBreaked||""!==e&&""===s.str||(r=!0,o=s.wordBreaked),s.str.length===e.length);else if(r){let i=e.substring(o);"keep-all"===p&&(i=i.replace(/^\s+/g,"")),_.splice(t+1,0,i)}}let t=0;B.forEach((e=>{t=Math.max(t,e.width)})),P[0]=t}else{let t,e,i=0;for(let n=0,r=_.length;n<r;n++){if(n===R-1){const t=A.clipTextWithSuffix(_[n],T,c,h,!1,m),e=A.measureTextPixelADscentAndWidth(t.str,T,v);B.push({str:t.str,width:t.width,ascent:e.ascent,descent:e.descent,keepCenterInLine:x}),i=Math.max(i,t.width);break}e=_[n],t=A.measureTextWidth(e,T),i=Math.max(i,t);const r=A.measureTextPixelADscentAndWidth(e,T,v);B.push({str:e,width:t,ascent:r.ascent,descent:r.descent,keepCenterInLine:x})}P[0]=i}P[1]=B.length*S;const M={xOffset:0,yOffset:0,width:P[0],height:P[1]};C.LayoutBBox(M,a,o,B);const E=C.layoutWithBBox(M,B,a,o,S);return this.cache.layoutData=E,this.clearUpdateShapeTag(),this._AABBBounds.set(M.xOffset,M.yOffset,M.xOffset+M.width,M.yOffset+M.height),u&&this._AABBBounds.expand(d/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,n;const r=this.getGraphicTheme(),s=vn.graphicUtil.textMeasure;let a;const o=this.attribute,{maxLineWidth:l=r.maxLineWidth,ellipsis:h=r.ellipsis,fontFamily:c=r.fontFamily,fontSize:u=r.fontSize,fontWeight:d=r.fontWeight,stroke:p=r.stroke,lineWidth:f=r.lineWidth,verticalMode:g=r.verticalMode,suffixPosition:v=r.suffixPosition}=o,m=this.getLineHeight(o,r,0);let{textAlign:y=r.textAlign,textBaseline:b=r.textBaseline}=o;if(!g){const t=y;y=null!==(i=gu.baselineMapAlign[b])&&void 0!==i?i:"left",b=null!==(n=gu.alignMapBaseline[t])&&void 0!==n?n:"top"}if(a=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ot(e,a)}));const t=fl(y,a),e=this.cache.verticalList.length*m,i=gl(b,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const x=e.map((t=>Ja(t.toString())));x.forEach(((e,i)=>{if(Number.isFinite(l))if(h){const t=!0===h?r.ellipsis:h,n=s.clipTextWithSuffixVertical(e,{fontSize:u,fontWeight:d,fontFamily:c},l,t,!1,v);x[i]=n.verticalList,a=n.width}else{const t=s.clipTextVertical(e,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);x[i]=t.verticalList,a=t.width}else a=0,e.forEach((e=>{const i=e.direction===t.TextDirection.HORIZONTAL?u:s.measureTextWidth(e.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=i,e.width=i}))})),this.cache.verticalList=x,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ot(e,a)}));const w=fl(y,a),S=this.cache.verticalList.length*m,A=gl(b,S,u);return this._AABBBounds.set(A,w,A+S,w+a),p&&this._AABBBounds.expand(f/2),this._AABBBounds}getMaxWidth(t){var e,i;const n=this.attribute;return null!==(i=null!==(e=n.maxLineWidth)&&void 0!==e?e:n.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var n;return null!==(n=Cs(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==n?n:(t.fontSize||e.fontSize)+i}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fu;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fu;return super.needUpdateTag(t,e)}clone(){return new gu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gu.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return gu.baselineMapAlign}getAlignMapBaseline(){return gu.alignMapBaseline}}function vu(t){return new gu(t)}gu.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Oa),gu.baselineMapAlign={top:"left",bottom:"right",middle:"center"},gu.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const mu=["heightLimit","lineClamp"];class yu extends gu{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return st(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n,r;const s=this.getGraphicTheme(),{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:u,stroke:d=s.stroke,lineWidth:p=s.lineWidth,wordBreak:f=s.wordBreak,fontWeight:g=s.fontWeight,ignoreBuf:v=s.ignoreBuf,heightLimit:m=0,suffixPosition:y=s.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=Cs(this.attribute.lineHeight,this.attribute.fontSize||s.fontSize))&&void 0!==e?e:this.attribute.fontSize||s.fontSize,w=v?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const S=vn.graphicUtil.textMeasure,A=new pu(a,{fontSize:h,fontWeight:g,fontFamily:a},S),T=t.map((t=>t.toString())),C=[],_=[0,0];let B=1/0;if(m>0&&(B=Math.max(Math.floor(m/x),1)),b&&(B=Math.min(B,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t<T.length;t++){const e=T[t];let i=!0;if(t===B-1){const t=A.textMeasure.clipTextWithSuffix(e,A.textOptions,u,c,!1,y);C.push({str:t.str,width:t.width,ascent:0,descent:0,keepCenterInLine:!1});break}const s=A.textMeasure.clipText(e,A.textOptions,u,"break-word"===f);if(""!==e&&""===s.str){if(c){const t=A.textMeasure.clipTextWithSuffix(e,A.textOptions,u,c,!1,y);s.str=null!==(n=t.str)&&void 0!==n?n:"",s.width=null!==(r=t.width)&&void 0!==r?r:0}else s.str="",s.width=0;i=!1}if(C.push({str:s.str,width:s.width,ascent:0,descent:0,keepCenterInLine:!1}),s.str.length===e.length);else if(i){const i=e.substring(s.str.length);T.splice(t+1,0,i)}}let t=0;C.forEach((e=>{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,r=T.length;n<r;n++){if(n===B-1){const t=A.textMeasure.clipTextWithSuffix(T[n],A.textOptions,u,c,!1,y);C.push({str:t.str,width:t.width,ascent:0,descent:0,keepCenterInLine:!1}),i=Math.max(i,t.width);break}e=T[n],t=A.textMeasure.measureTextWidth(e,A.textOptions,"break-word"===f),i=Math.max(i,t),C.push({str:e,width:t,ascent:0,descent:0,keepCenterInLine:!1})}_[0]=i}_[1]=C.length*(x+w);const P={xOffset:0,yOffset:0,width:_[0],height:_[1]};A.LayoutBBox(P,o,l);const R=A.layoutWithBBox(P,C,o,l,x);return this.cache.layoutData=R,this.clearUpdateShapeTag(),this._AABBBounds.set(P.xOffset,P.yOffset,P.xOffset+P.width,P.yOffset+P.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<mu.length;e++){const i=mu[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<mu.length;e++)if(t===mu[e])return!0;return super.needUpdateTag(t)}getNoWorkAnimateAttr(){return yu.NOWORK_ANIMATE_ATTR}}function bu(t){return new yu(t)}class xu{bounds(t,e){if(ot(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return ot(t)?t:Math.min(t[0],t[1])}}function wu(t,e,i,n,r){return r?t.arc(i,n,e,0,Pt,!1,r):t.arc(i,n,e,0,Pt),!1}var Su=new class extends xu{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,n,r){return wu(t,this.parseSize(e)/2,i,n,r)}drawOffset(t,e,i,n,r,s){return wu(t,this.parseSize(e)/2+r,i,n,s)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} a ${r},${r} 0 1,0 ${2*r},0 a ${r},${r} 0 1,0 -${2*r},0`}};var Au=new class extends xu{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,n,r){return function(t,e,i,n,r){return t.moveTo(-3*e+i,-e+n,r),t.lineTo(-e+i,-e+n,r),t.lineTo(-e+i,-3*e+n,r),t.lineTo(e+i,-3*e+n,r),t.lineTo(e+i,-e+n,r),t.lineTo(3*e+i,-e+n,r),t.lineTo(3*e+i,e+n,r),t.lineTo(e+i,e+n,r),t.lineTo(e+i,3*e+n,r),t.lineTo(-e+i,3*e+n,r),t.lineTo(-e+i,e+n,r),t.lineTo(-3*e+i,e+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,r)}drawOffset(t,e,i,n,r,s){return function(t,e,i,n,r,s){return t.moveTo(-3*e+i-r,-e+n-r,s),t.lineTo(-e+i-r,-e+n-r,s),t.lineTo(-e+i-r,-3*e+n-r,s),t.lineTo(e+i+r,-3*e+n-r,s),t.lineTo(e+i+r,-e+n-r,s),t.lineTo(3*e+i+r,-e+n-r,s),t.lineTo(3*e+i+r,e+n+r,s),t.lineTo(e+i+r,e+n+r,s),t.lineTo(e+i+r,3*e+n+r,s),t.lineTo(-e+i-r,3*e+n+r,s),t.lineTo(-e+i-r,e+n+r,s),t.lineTo(-3*e+i-r,e+n+r,s),t.closePath(),!0}(t,this.parseSize(e)/6,i,n,r,s)}};function Tu(t,e,i,n,r){return t.moveTo(i,n-e,r),t.lineTo(e+i,n,r),t.lineTo(i,n+e,r),t.lineTo(i-e,n,r),t.closePath(),!0}var Cu=new class extends xu{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,n,r){return Tu(t,this.parseSize(e)/2,i,n,r)}drawFitDir(t,e,i,n,r){return Tu(t,this.parseSize(e)/2,i,n,r)}drawOffset(t,e,i,n,r,s){return Tu(t,this.parseSize(e)/2+r,i,n,s)}};function _u(t,e,i,n){const r=2*e;return t.rect(i-e,n-e,r,r),!1}var Bu=new class extends xu{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,n){return _u(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return _u(t,this.parseSize(e)/2+r,i,n)}};function Pu(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*r,e+n+r),t.lineTo(i-e-2*r,e+n+r),t.lineTo(i,n-e-2*r),t.closePath(),!0}class Ru extends xu{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,n){return Pu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Pu(t,this.parseSize(e)/2,i,n,r)}}var Mu=new Ru;var Eu=new class extends Ru{constructor(){super(...arguments),this.type="triangle"}};const ku=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Ou=Math.sin(Pt/10)*ku,Lu=-Math.cos(Pt/10)*ku;function Iu(t,e,i,n){const r=Ou*e,s=Lu*e;t.moveTo(i,-e+n),t.lineTo(r+i,s+n);for(let a=1;a<5;++a){const o=Pt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+n),t.lineTo(l*r-h*s+i,h*r+l*s+n)}return t.closePath(),!0}var Du=new class extends xu{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,n){return Iu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Iu(t,this.parseSize(e)/2+r,i,n)}};const ju=Dt(3);function Uu(t,e,i,n){const r=e,s=r/ju,a=s/5,o=e;return t.moveTo(0+i,-r+n),t.lineTo(s/2+i,n),t.lineTo(a/2+i,n),t.lineTo(a/2+i,o+n),t.lineTo(-a/2+i,o+n),t.lineTo(-a/2+i,n),t.lineTo(-s/2+i,n),t.closePath(),!0}var Wu=new class extends xu{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,n){return Uu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Uu(t,this.parseSize(e)/2+r,i,n)}};function Nu(t,e,i,n){const r=2*e;return t.moveTo(i,-e+n),t.lineTo(r/3/2+i,e+n),t.lineTo(-r/3/2+i,e+n),t.closePath(),!0}var Gu=new class extends xu{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,n){return Nu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Nu(t,this.parseSize(e)/2+r,i,n)}};function Fu(t,e,i,n){return t.moveTo(-e+i,n),t.lineTo(i,e+n),!1}var zu=new class extends xu{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,n){return Fu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Fu(t,this.parseSize(e)/2+r,i,n)}};const Hu=-.5,Vu=Dt(3)/2,Yu=1/Dt(12);function Xu(t,e,i,n){const r=e/2,s=e*Yu,a=r,o=e*Yu+e,l=-a,h=o;return t.moveTo(r+i,s+n),t.lineTo(a+i,o+n),t.lineTo(l+i,h+n),t.lineTo(Hu*r-Vu*s+i,Vu*r+Hu*s+n),t.lineTo(Hu*a-Vu*o+i,Vu*a+Hu*o+n),t.lineTo(Hu*l-Vu*h+i,Vu*l+Hu*h+n),t.lineTo(Hu*r+Vu*s+i,Hu*s-Vu*r+n),t.lineTo(Hu*a+Vu*o+i,Hu*o-Vu*a+n),t.lineTo(Hu*l+Vu*h+i,Hu*h-Vu*l+n),t.closePath(),!1}var $u=new class extends xu{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,n){return Xu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Xu(t,this.parseSize(e)/2+r,i,n)}};function qu(t,e,i,n,r){return t.moveTo(-e+i-2*r,n),t.lineTo(e+i+r,e+n+2*r),t.lineTo(e+i+r,n-e-2*r),t.closePath(),!0}var Ku=new class extends xu{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,n){return qu(t,this.parseSize(e)/2,i,n,0)}drawOffset(t,e,i,n,r){return qu(t,this.parseSize(e)/2,i,n,r)}};function Zu(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-r,e+n+2*r),t.lineTo(e+i+2*r,n),t.lineTo(i-e-r,n-e-2*r),t.closePath(),!0}var Ju=new class extends xu{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,n){return Zu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Zu(t,this.parseSize(e)/2,i,n,r)}};function Qu(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*r,n-e-r),t.lineTo(i+e+2*r,n-e-r),t.lineTo(i,n+e+2*r),t.closePath(),!0}var td=new class extends xu{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,n){return Qu(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r){return Qu(t,this.parseSize(e)/2,i,n,r)}};const ed=Dt(3);function id(t,e,i,n){const r=e*ed;return t.moveTo(i,n+-r/3*2),t.lineTo(e+i,n+r),t.lineTo(i-e,n+r),t.closePath(),!0}var nd=new class extends xu{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,n){return id(t,this.parseSize(e)/2/ed,i,n)}drawOffset(t,e,i,n,r){return id(t,this.parseSize(e)/2/ed+r,i,n)}};function rd(t,e,i,n){const r=2*e;return t.moveTo(e+i,n-r),t.lineTo(i-e,n),t.lineTo(e+i,r+n),!0}var sd=new class extends xu{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,n){return rd(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return rd(t,this.parseSize(e)/4+r,i,n)}};function ad(t,e,i,n){const r=2*e;return t.moveTo(i-e,n-r),t.lineTo(i+e,n),t.lineTo(i-e,r+n),!0}var od=new class extends xu{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,n){return ad(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return ad(t,this.parseSize(e)/4+r,i,n)}};function ld(t,e,i,n){const r=2*e;return t.moveTo(i-r,n+e),t.lineTo(i,n-e),t.lineTo(i+r,n+e),!0}var hd=new class extends xu{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,n){return ld(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return ld(t,this.parseSize(e)/4+r,i,n)}};function cd(t,e,i,n){const r=2*e;return t.moveTo(i-r,n-e),t.lineTo(i,n+e),t.lineTo(i+r,n-e),!0}var ud=new class extends xu{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,n){return cd(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return cd(t,this.parseSize(e)/4+r,i,n)}};function dd(t,e,i,n,r){return t.moveTo(i,n-e),t.lineTo(i,n+e),!0}var pd=new class extends xu{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,n,r){return dd(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r,s){return dd(t,this.parseSize(e)/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e}, ${i-r} L ${e},${i+r}`}};function fd(t,e,i,n,r){return t.moveTo(i-e,n),t.lineTo(i+e,n),!0}var gd=new class extends xu{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,n,r){return fd(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r,s){return fd(t,this.parseSize(e)/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e-r}, ${i} L ${e+r},${i}`}};function vd(t,e,i,n,r){return t.moveTo(i-e,n-e),t.lineTo(i+e,n+e),t.moveTo(i+e,n-e),t.lineTo(i-e,n+e),!0}var md=new class extends xu{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,n,r){return vd(t,this.parseSize(e)/2,i,n)}drawOffset(t,e,i,n,r,s){return vd(t,this.parseSize(e)/2+r,i,n)}drawToSvgPath(t,e,i,n){const r=this.parseSize(t)/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}};function yd(t,e,i,n){return t.rect(i-e[0]/2,n-e[1]/2,e[0],e[1]),!1}function bd(t,e,i,n){const r=e,s=e/2;return t.rect(i-r/2,n-s/2,r,s),!1}var xd=new class extends xu{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,n){return ot(e)?bd(t,e,i,n):yd(t,e,i,n)}drawOffset(t,e,i,n,r){return ot(e)?bd(t,e+2*r,i,n):yd(t,[e[0]+2*r,e[1]+2*r],i,n)}};const wd=new le;class Sd{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,st(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,n,r,s,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{t.beginPath(),Ze(r.path.commandList,t,i,n,e,e),a&&a(r.path,r.attribute)})),!1):(Ze(this.path.commandList,t,i,n,e+r,e+r),!1)}draw(t,e,i,n,r,s){return e=this.parseSize(e),this.drawOffset(t,e,i,n,0,r,s)}parseSize(t){return ot(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:n}=i;wd.x1=n.bounds.x1*t,wd.y1=n.bounds.y1*t,wd.x2=n.bounds.x2*t,wd.y2=n.bounds.y2*t,e.union(wd)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Ad=[Su,Au,Cu,Bu,nd,Eu,Du,Wu,Gu,zu,$u,Ku,Ju,Mu,td,sd,od,hd,ud,xd,pd,gd,md],Td={};Ad.forEach((t=>{Td[t.type]=t}));const Cd={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},_d=new le,Bd=["symbolType","size",...Pa];let Pd=class t extends La{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=yo}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return st(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,n=Td[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;if(i=Cd[i]||i,!0===Va(i)){const e=new Ha,{svg:n}=e.parse(i);if(!n)return null;const r=st(n.path)?n.path:[n.path];_d.clear();const s=[];r.forEach((t=>{const e=(new Wi).fromString(t.d),i={};Co.forEach((e=>{t[e]&&(i[To[e]]=t[e])})),s.push({path:e,attribute:i}),_d.union(e.bounds)}));const a=_d.width(),o=_d.height(),l=1/Ot(a,o);return s.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Sd(i,s,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}const r=(new Wi).fromString(i),s=r.bounds.width(),a=r.bounds.height(),o=1/Ot(s,a);return r.transform(0,0,o,o),this._parsedPath=new Sd(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return kr(this).symbol}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=vn.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:n,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:s=e.strokeBoundsBuffer}=t;if(n){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=n;$a(i,a+(r+o)/2,!0,s)}})(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2);const{lineJoin:a=e.lineJoin}=t;return vn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(st(n))i.set(-n[0]/2,-n[1]/2,n[0]/2,n[1]/2);else{const t=n/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:n=e.size}=t;return this.getParsedPath().bounds(n,i),i}needUpdateTags(t){return super.needUpdateTags(t,Bd)}needUpdateTag(t){return super.needUpdateTag(t,Bd)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=st(e)?e:[e,e];return t.path?(new Wi).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wi).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Rd(t){return new Pd(t)}Pd.userSymbolMap={},Pd.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Oa);const Md=["segments","points","curveType","curveTension",...Pa];let Ed=class t extends La{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=co}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,r){"points"===t&&(r.points=ys(i,n,e))}getGraphicTheme(){return kr(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),vn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return vn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:r=e.points,connectedType:s}=t,a=i;return r.forEach((t=>{!1===t.defined&&"zero"!==s&&"connect"!==s||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:r=e.segments,connectedType:s}=t,a=i;return r.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==s&&"connect"!==s||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Md)}needUpdateTag(t){return super.needUpdateTag(t,Md)}toCustomPath(){const t=this.attribute,e=new Wi,i=t.segments,n=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kd(t){return new Ed(t)}Ed.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Oa);const Od=["width","x1","y1","height","cornerRadius",...Pa];class Ld extends La{constructor(t){super(t),this.type="rect",this.numberType=go}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return kr(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:n}=t;const{x1:r,y1:s,x:a,y:o}=t;e=null!=e?e:r-a,n=null!=n?n:s-o,(isFinite(e)||isFinite(n)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,n||0)}const{tb1:n,tb2:r}=vn.graphicService.updateTempAABBBounds(i);return hu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),vn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Od)}needUpdateTag(t){return super.needUpdateTag(t,Od)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:n,height:r}=Ns(t),s=new Wi;return s.moveTo(e,i),s.rect(e,i,n,r),s}clone(){return new Ld(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ld.NOWORK_ANIMATE_ATTR}}function Id(t){return new Ld(t)}Ld.NOWORK_ANIMATE_ATTR=Oa;const Dd=[[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]];class jd extends Ld{constructor(t){super(t),this.type="rect3d",this.numberType=vo}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:n,x:r,y:s,length:a=Lt(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-r,l=null!=l?l:n-s;for(let e=0;e<Dd.length;e++){const i=Dd[e];t.vertices.push([i[0]*o,i[1]*l,i[2]*a])}return t.polygons.push({polygon:[0,1,5,4],normal:[0,-1,0]}),t.polygons.push({polygon:[2,3,7,6],normal:[0,1,0]}),t.polygons.push({polygon:[4,7,3,0],normal:[-1,0,0]}),t.polygons.push({polygon:[1,2,6,5],normal:[1,0,0]}),t.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),t.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),t.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],t}getNoWorkAnimateAttr(){return jd.NOWORK_ANIMATE_ATTR}}function Ud(t){return new jd(t)}jd.NOWORK_ANIMATE_ATTR=Oa;class Wd extends La{constructor(t){super(t),this.type="glyph",this.numberType=oo,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return kr(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const n={},r=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const s=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];s&&(Object.assign(n,s.attributes),(null===(i=s.subAttributes)||void 0===i?void 0:i.length)&&r.forEach(((t,e)=>{Object.assign(t,s.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(r[n]),i.applyStateAttrs(r[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Wd(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Wd.NOWORK_ANIMATE_ATTR}}function Nd(t){return new Wd(t)}Wd.NOWORK_ANIMATE_ATTR=Oa;class Gd{constructor(t,e,i,n,r,s,a,o,l,h,c,u,d,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=r,this.wordBreak=s,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=wn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),r=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let s=this.isHeightMax?Math.min(this.height,n):this.height||n||0;s=Math.min(s,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-s/2;break;case"bottom":a=-s}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-r:"center"===this.globalAlign&&(o=-r/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;i<this.lines.length;i++){const{top:n,height:r}=this.lines[i];if(n+r<this[this.directionKey.top]||n+r>this[this.directionKey.top]+l)return h;let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;i<this.lines.length;i++)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else if("bottom"===this.verticalDirection&&"vertical"!==this.layoutDirection)for(let i=0;i<this.lines.length;i++){const{top:n,height:r}=this.lines[i],s=l-this.lines[i].top-this.lines[i].height;if(0===l)this.lines[i].draw(t,!1,o,s+a,this.ellipsis,e);else{if(s+r>this[this.directionKey.top]+l||s<this[this.directionKey.top])return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&s-this.lines[i+1].height<this[this.directionKey.top]&&(n=!0,h=!0),this.lines[i].draw(t,n,o,s+a,this.ellipsis,e)}}}else{"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&this.singleLine&&this.isWidthMax&&(o+=this.lines[0].height+1);for(let i=0;i<this.lines.length;i++){"bottom"===this.verticalDirection&&"vertical"===this.layoutDirection&&(o-=this.lines[i].height+this.lines[i].top);const{top:n,height:r}=this.lines[i];if(0===l)this.lines[i].draw(t,!1,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e);else{if(n+r<this[this.directionKey.top]||n+r>this[this.directionKey.top]+l)return h;{let n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;i<this.lines.length;i++){const n=this.lines[i];n.actualWidth>t&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let r=this[this.directionKey.height];if(this.singleLine&&(r=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=r&&0!==r)for(let i=0;i<this.lines.length;i++){const{top:n,height:s}=this.lines[i];if(n+s<this[this.directionKey.top]||n+s>this[this.directionKey.top]+r);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+r){const n=!0===this.ellipsis?"...":this.ellipsis||"",r=this.lines[i].getWidthWithEllips(n);r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((r-this.actualHeight)/2);for(let i=0;i<this.lines.length;i++)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;i<this.lines.length;i++){const{top:n,height:s}=this.lines[i],a=r-this.lines[i].top-this.lines[i].height;if(0===r)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+s>this[this.directionKey.top]+r||a<this[this.directionKey.top]);else if(this.ellipsis&&this.lines[i+1]&&a-this.lines[i+1].height<this[this.directionKey.top]){const n=!0===this.ellipsis?"...":this.ellipsis||"",r=this.lines[i].getWidthWithEllips(n);r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;i<this.lines.length;i++){const{top:n,height:s}=this.lines[i];if(0===r)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(n+s<this[this.directionKey.top]||n+s>this[this.directionKey.top]+r);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+r){const n=!0===this.ellipsis?"...":this.ellipsis||"",r=this.lines[i].getWidthWithEllips(n);r>t&&(t=r),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Fd{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=Cs(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof n?n>this.fontSize?n:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:r,height:s,descent:a,width:o}=En(t,i);let l=0,h=0,c=0;this.height>s&&(l=(this.height-s)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=s-l):"bottom"===this.textBaseline?(this.ascent=s-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=r+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=En(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,r){let s=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)s=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)s+=this.ellipsisStr,"right"!==r&&"end"!==r||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Pn(s,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,s.length-1);if(s=s.slice(0,t),s+=this.ellipsisStr,"right"===r||"end"===r){const{width:e}=En(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(s,a,e),this.character.fill&&t.fillText(s,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Pn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=En(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const zd=["width","height","image",...Pa];class Hd extends La{constructor(t){super(t),this.type="image",this.numberType=ho,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,n){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,n)}getGraphicTheme(){return kr(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:n=e.width,height:r=e.height}=t;i.set(0,0,n,r)}const{tb1:n,tb2:r}=vn.graphicService.updateTempAABBBounds(i);return hu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),vn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return pn[t]}needUpdateTags(t){return super.needUpdateTags(t,zd)}needUpdateTag(t){return super.needUpdateTag(t,zd)}clone(){return new Hd(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Hd.NOWORK_ANIMATE_ATTR}}function Vd(t){return new Hd(t)}Hd.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Oa);class Yd extends Hd{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=ds(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(st(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=ds(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=pn.width,height:e=pn.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,r=(i-t)/2,s=(n-e)/2;return this._AABBBounds.expand([0,2*r,2*s,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Xd{constructor(t,e,i,n,r,s,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=r,this.top=i-n,this.paragraphs=s.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Yd?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=wn[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Fd){const e=_n.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,n=this.height;let r=this.left,s=0;this.actualWidth<t&&!e&&("right"===this.textAlign||"end"===this.textAlign?r=t-this.actualWidth:"center"===this.textAlign?r=(t-this.actualWidth)/2:"justify"===this.textAlign&&(this.paragraphs.length<2?r=(t-this.actualWidth)/2:s=(t-this.actualWidth)/(this.paragraphs.length-1))),this.paragraphs.map((function(t){t instanceof Yd?(t["_"+i.x]=r,r+=t[i.width]+s,t["_"+i.y]="top"===t.attribute.textBaseline?0:"bottom"===t.attribute.textBaseline?n-t.height:(n-t.height)/2):(t[i.left]=r,r+=t[i.width]+s)}))}draw(t,e,i,n,r,s){if(r&&(e||this.paragraphs.some((t=>t.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const n=this.paragraphs[e];if(n.overflow)t=t&&""===n.text;else if(t){i=!0;break}}let n=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Yd)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const s=!0===r?"...":r||"";i.ellipsisStr=s;const{width:a}=En(s,i.character),o=a||0;if(o<=this.blankWidth+n){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+n+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+n;break}i.ellipsis="hide",n+=i.width}}this.paragraphs.forEach(((e,r)=>{if(e instanceof Yd)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||An;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Bn(t,e)})(t,e.character),function(t,e,i){const n=e&&e.fill||Sn;if(!n)return void(t.globalAlpha=0);const{fillOpacity:r=1,opacity:s=1}=e;t.globalAlpha=r*s,t.fillStyle=i?xn(t,n,{AABBBounds:i}):n,Bn(t,e)}(t,e.character,a),e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const n=this.paragraphs[i];if(n instanceof Yd)break;const{width:r}=En(t,n.character),s=r||0;if(s<=this.blankWidth+e){n.ellipsis="add",n.ellipsisWidth=s;break}if(s<=this.blankWidth+e+n.width){n.ellipsis="replace",n.ellipsisWidth=s,n.ellipsisOtherParagraphWidth=this.blankWidth+e;break}n.ellipsis="hide",e+=n.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Yd?t.width:t.getWidthWithEllips(this.direction)})),i}}class $d{constructor(t){this.frame=t,this.width=this.frame.width,this.height=this.frame.height,this.lineWidth=0,this.y=this.frame.top,this.maxAscent=0,this.maxDescent=0,this.maxAscentForBlank=0,this.maxDescentForBlank=0,this.lineBuffer=[],this.direction=t.layoutDirection,this.directionKey=wn[this.direction]}store(t){if(t instanceof Yd){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Xd(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Yd?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,n=Math.ceil(i/t[this.directionKey.width]*t.length)||0,r=Pn(t.text,i,t.character,n,"break-word"===this.frame.wordBreak);if(0!==r){const[i,n]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new Fd(i,t.newLine,t.character),new Fd(n,!0,t.character)]}(t,r);this.store(i),e?this.send():this.deal(n)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const qd=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Pa];class Kd extends La{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=mo,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const n=this._frameCache.icons.get(t[i]);this.updateHoverIconState(n)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:dn.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:dn.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:dn.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:dn.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:dn.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:dn.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:dn.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:dn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return kr(this).richtext}updateAABBBounds(t,e,i){const{width:n=e.width,height:r=e.height,maxWidth:s=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(n>0&&r>0)i.set(0,0,n,r);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=n||e||0,h=r||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof s&&l>s?s:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),vn.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vn.graphicService.updateHTMLTextAABBBounds(t,e,i),vn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,qd)}needUpdateTag(t){return super.needUpdateTag(t,qd)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e<t.lines.length;e++){const i=t.lines[e];for(let t=0;t<i.paragraphs.length;t++){const e=i.paragraphs[t];if(e.overflow&&""!==e.text)return!0}}return!1}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:n,fontFamily:r,fontStyle:s,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:n,fontFamily:r,fontStyle:s,fontWeight:a,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:n,maxHeight:r,width:s,height:a,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:u,layoutDirection:d,singleLine:p,disableAutoWrapLine:f}=this.attribute,g=[],v=null!=t?t:i;for(let t=0;t<v.length;t++)if("image"in v[t]){const e=this.combinedStyleToCharacter(v[t]);e.lineWidth=void 0;const i=e.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(e.id);if(i)g.push(i);else{const t=new Yd(e);t.successCallback=()=>{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,g.push(t)}}else{const e=this.combinedStyleToCharacter(v[t]);if(ot(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i<t.length;i++)g.push(new Fd(t[i],0!==i,e))}else e.text&&g.push(new Fd(e.text,!1,e))}const m="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0,b="number"==typeof s&&Number.isFinite(s)&&s>0&&(!m||s<=n),x="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=r),w=new Gd(0,0,(b?s:m?n:0)||0,(x?a:y?r:0)||0,o,l,h,c,u,d||"horizontal",!b&&m,!x&&y,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),S=new $d(w);if(f){let t=0,e=!1;for(let i=0;i<g.length;i++){const n=g[i];e?(n.overflow=!0,n.left=1/0,n.top=1/0,!n.newLine&&w.lines[w.lines.length-1].paragraphs.push(n)):S.deal(n,!0),w.lines.length!==t&&(t=w.lines.length,S.lineBuffer.length=0,n.overflow=!0,n.left=1e3,n.top=1e3,w.lines[w.lines.length-1].paragraphs.push(n),e=!0),n.newLine&&(e=!1,S.lineWidth=0),S.send()}}else for(let t=0;t<g.length;t++)S.deal(g[t]);if(S.send(),!("horizontal"===w.layoutDirection?b:x)){const t=w.getActualSizeWidthEllipsis();let e="horizontal"===w.layoutDirection?t.width:t.height;("horizontal"===w.layoutDirection?m:y)&&(e=Math.min(e,"horizontal"===w.layoutDirection?n:r)),w.lines.forEach((function(t){t.calcOffset(e,!1)}))}this._frameCache=w}clone(){return new Kd(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,n,r,s;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(r=this.stage)||void 0===r||r.setCursor(),null===(s=this.stage)||void 0===s||s.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let r;return e.icons.forEach(((e,s)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-n})&&(r=e,r.globalX=(null!==(a=r.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],r.globalY=(null!==(o=r.attribute.y)&&void 0!==o?o:0)+n+e._marginArray[0])})),r}getNoWorkAnimateAttr(){return Kd.NOWORK_ANIMATE_ATTR}}function Zd(t){return new Kd(t)}Kd.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Oa);const Jd=["path","customPath",...Pa];class Qd extends La{constructor(t){super(t),this.type="path",this.numberType=uo}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wi?e.path:(Z(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wi?this.cache:t.path)}getGraphicTheme(){return kr(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:n,tb2:r}=vn.graphicService.updateTempAABBBounds(i);hu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:s=e.lineJoin}=t;return vn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;rt(t.path,!0)?this.cache=(new Wi).fromString(t.path):t.customPath&&(this.cache=new Wi,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jd)}needUpdateTag(t){return super.needUpdateTag(t,Jd)}toCustomPath(){return(new Wi).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qd(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qd.NOWORK_ANIMATE_ATTR}}function tp(t){return new Qd(t)}Qd.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Oa);const ep=["segments","points","curveType","curveTension",...Pa];class ip extends La{constructor(t){super(t),this.type="area",this.numberType=so}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return kr(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),vn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return vn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:r=e.points}=t,s=i;return r.forEach((t=>{var e,i;s.add(t.x,t.y),s.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),s}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:r=e.segments}=t,s=i;return r.forEach((t=>{t.points.forEach((t=>{var e,i;s.add(t.x,t.y),s.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),s}_interpolate(t,e,i,n,r){"points"===t&&(r.points=ys(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,ep)}needUpdateTag(t){return super.needUpdateTag(t,ep)}toCustomPath(){const t=new Wi,e=this.attribute,i=e.segments,n=e=>{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var r,s;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(r=e.x1)&&void 0!==r?r:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new ip(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ip.NOWORK_ANIMATE_ATTR}}function np(t){return new ip(t)}ip.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Oa);const rp=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Pa];class sp extends La{constructor(t){super(t),this.type="arc",this.numberType=no}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:n=t.outerPadding}=this.attribute;let{outerRadius:r=t.outerRadius,innerRadius:s=t.innerRadius}=this.attribute;if(r+=n,s-=i,0===e||"0%"===e)return 0;const a=Math.abs(r-s),o=t=>Math.min(ot(t,!0)?t:a*parseFloat(t)/100,a/2);if(st(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,r=i-e>=0?1:-1,s=i-e;if(e=Vt(e),i=e+s,n&&Mt(s)<Rt-Ct){let s=1,a=1;n.length&&(s=Number(n[0]),a=Number(n[1]));let{outerRadius:o=t.outerRadius,innerRadius:l=t.innerRadius}=this.attribute;const{outerPadding:h=t.outerPadding,innerPadding:c=t.innerPadding}=this.attribute;o+=h,l-=c;const u=Math.abs(o-l)/2,d=u/o;if(u>Ct&&o>Ct)return{startAngle:e-r*d*s,endAngle:i+r*d*a,sc:r*d*s,ec:r*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:n=i.innerPadding,outerPadding:r=i.outerPadding,padAngle:s=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=r,o-=n;const{padRadius:l=Dt(a*a+o*o)}=this.attribute,h=Mt(e-t);let c=t,u=e,d=t,p=e;const f=s/2;let g=h,v=h;if(f>Ct&&l>Ct){const i=e>t?1:-1;let n=Ut(Number(l)/o*It(f)),r=Ut(Number(l)/a*It(f));return(g-=2*n)>Ct?(n*=i,d+=n,p-=n):(g=0,d=p=(t+e)/2),(v-=2*r)>Ct?(r*=i,c+=r,u-=r):(v=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:g,outerDeltaAngle:v}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:g,outerDeltaAngle:v}}getGraphicTheme(){return kr(this).arc}updateAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i)||(n?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=vn.graphicService.updateTempAABBBounds(i);hu(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2);const{lineJoin:a=e.lineJoin}=t;return vn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:s=e.outerPadding,innerPadding:a=e.innerPadding}=t;return n+=s,r-=a,n<r&&(n=r),i.set(-n,-n,n,n),i}updateArcAABBBoundsAccurate(t,e,i){let{outerRadius:n=e.outerRadius,innerRadius:r=e.innerRadius}=t;const{outerPadding:s=e.outerPadding,innerPadding:a=e.innerPadding}=t;if(n+=s,r-=a,n<r){const t=n;n=r,r=t}let{endAngle:o=e.endAngle,startAngle:l=e.startAngle}=t;if(l>o){const t=l;l=o,o=t}return n<=Ct?i.set(0,0,0,0):Math.abs(o-l)>Rt-Ct?i.set(-n,-n,n,n):(gs(l,o,n,i),gs(l,o,r,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rp)}needUpdateTag(t){return super.needUpdateTag(t,rp)}toCustomPath(){var t,e,i,n;const r=this.attribute,{startAngle:s,endAngle:a}=this.getParsedAngle();let o=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),l=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(n=r.outerPadding)&&void 0!==n?n:0);const h=Mt(a-s),c=a>s;if(l<o){const t=l;l=o,o=t}const u=new Wi;if(l<=Ct)u.moveTo(0,0);else if(h>=Rt-Ct)u.moveTo(0+l*kt(s),0+l*It(s)),u.arc(0,0,l,s,a,!c),o>Ct&&(u.moveTo(0+o*kt(a),0+o*It(a)),u.arc(0,0,o,a,s,c));else{const t=l*kt(s),e=l*It(s),i=o*kt(a),n=o*It(a);u.moveTo(0+t,0+e),u.arc(0,0,l,s,a,!c),u.lineTo(0+i,0+n),u.arc(0,0,o,a,s,c),u.closePath()}return u}clone(){return new sp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sp.NOWORK_ANIMATE_ATTR}}function ap(t){return new sp(t)}sp.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Oa);class op extends sp{constructor(t){super(t),this.type="arc3d",this.numberType=ro}updateAABBBounds(t,e,i){const n=this.stage;if(!n||!n.camera)return i;const{outerRadius:r=e.outerRadius,height:s=0}=t,a=r+s;return i.setValue(-a,-a,a,a),vn.graphicService.updateTempAABBBounds(i),vn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function lp(t){return new op(t)}op.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Oa);const hp=["points","cornerRadius",...Pa];class cp extends La{constructor(t){super(t),this.type="polygon",this.numberType=po}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return kr(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),vn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return vn.graphicService.transformAABBBounds(t,i,e,"miter"===n,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:n=e.points}=t;return n.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,n,r){"points"===t&&(r.points=ys(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,hp)}needUpdateTag(t){return super.needUpdateTag(t,hp)}toCustomPath(){const t=this.attribute.points,e=new Wi;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new cp(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return cp.NOWORK_ANIMATE_ATTR}}function up(t){return new cp(t)}cp.NOWORK_ANIMATE_ATTR=Oa;class dp extends cp{constructor(t){super(t),this.type="pyramid3d",this.numberType=fo}updateAABBBounds(t,e,i){const n=this.stage;return n&&n.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)})),vn.graphicService.updateTempAABBBounds(i),vn.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],r=e.x-n.x;return 0===r?0:(e.y-n.y)/r})),i=t.map((t=>({p:t,d:0})));let n=!1,r=0;for(let t=0;t<e.length-1;t++){for(let s=t+1;s<e.length;s++){if(e[t]===e[s]){n=!0;const e=zt.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,r=Ot(r,e);const a=zt.distancePP(i[s].p,i[s+1].p);i[s].d=a,i[s+1].d=a,r=Ot(r,a)}if(n)break}if(n)break}for(let e=t.length-1;e>=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e<t.length;e++){const n=(r-i[e+t.length].d)/2;i[e].d+=n,i[e+t.length].d+=n}const s={polygons:[],vertices:[],edges:[]};return i.forEach((t=>{s.vertices.push([t.p.x,t.p.y,t.d])})),s.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),s.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),s.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),s.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),s.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),s.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),s.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],s}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return dp.NOWORK_ANIMATE_ATTR}}function pp(t){return new dp(t)}dp.NOWORK_ANIMATE_ATTR=Oa;class fp extends Bo{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function gp(t){return new fp(t)}var vp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const mp=Symbol.for("PickItemInterceptor");t.ShadowRootPickItemInterceptorContribution=class{constructor(){this.order=1}afterPickItem(t,e,i,n,r){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,n,r):null}beforePickItem(t,e,i,n,r){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,n,r):null}_pickItem(t,e,i,n,r){var s;if(!t.shadowRoot)return null;const{parentMatrix:a}=r||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(s=kr(t))||void 0===s?void 0:s[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Ol.allocateByObj(a),d=new Ft(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,n);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}},t.ShadowRootPickItemInterceptorContribution=vp([g()],t.ShadowRootPickItemInterceptorContribution),t.InteractivePickItemInterceptorContribution=class{constructor(){this.order=1}beforePickItem(t,e,i,n,r){const s=t.baseGraphic;if(s&&s.parent){const t=new Ft(i.x,i.y),r=e.pickContext;r.highPerformanceSave();const a=s.parent.globalTransMatrix;a.transformPoint(t,t);const o=s.isContainer?e.pickGroup(s,t.clone(),a,n):e.pickItem(s,t.clone(),a,n);return r.highPerformanceRestore(),o}return null}},t.InteractivePickItemInterceptorContribution=vp([g()],t.InteractivePickItemInterceptorContribution),t.Canvas3DPickItemInterceptor=class{constructor(){this.order=1}beforePickItem(t,e,i,n,r){if(!t.in3dMode||n.in3dInterceptor)return null;const s=e.pickContext,a=t.stage;if(!s||!a)return null;if(n.in3dInterceptor=!0,s.save(),this.initCanvasCtx(s),s.camera=a.camera,t.isContainer){const a=zc(s,t,(()=>e.pickGroup(t,i,r.parentMatrix,n)),n);return s.camera=null,n.in3dInterceptor=!1,s.restore(),a}return s.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}},t.Canvas3DPickItemInterceptor=vp([g()],t.Canvas3DPickItemInterceptor);var yp=new i(((e,i,n)=>{n(au)||(e(lu).toSelf(),e(au).toService(lu)),e(t.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(),e(mp).toService(t.Canvas3DPickItemInterceptor),e(t.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(),e(mp).toService(t.ShadowRootPickItemInterceptorContribution),e(t.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(),e(mp).toService(t.InteractivePickItemInterceptorContribution),L(e,mp)})),bp=new i((e=>{e(xo).to(t.DefaultGraphicService).inSingletonScope(),e(wo).toConstantValue(Qh)}));const xp=Symbol.for("AutoEnablePlugins"),wp=Symbol.for("PluginService");var Sp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Ap=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tp=function(t,e){return function(i,n){e(i,n,t)}};let Cp=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Dn.isBound(xp)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Cp=Sp([g(),Tp(0,p(k)),Tp(0,v(xp)),Ap("design:paramtypes",[Object])],Cp);var _p=new i((t=>{t(wp).to(Cp),I(t,xp)})),Bp=new i((t=>{L(t,U)})),Pp=new i((e=>{e(In).to(t.DefaultTextMeasureContribution).inSingletonScope(),L(e,In)})),Rp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ep=class{constructor(){this.type="static",this.offscreen=!1,this.global=vn.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,r=Wn({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});r.applyPosition(),this.canvas=r,this.context=r.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(n=e.background)&&void 0!==n?n:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var n;const r=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:r},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Ep=Rp([g(),Mp("design:paramtypes",[])],Ep);var kp=new i((t=>{t(Ep).toSelf(),t(Oo).toService(Ep)}));var Op=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function Lp(t,e,i){const n={},r=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;n[i]?n[i].push(t):(n[i]=[t],r.push(i))}),i),r.sort(((t,e)=>i?e-t:t-e)),{childMap:n,zIdxArray:r}}function Ip(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=!1;if(r)s=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:r=e}=t.attribute;if(0===n)i=r;else if(i!==r)return s=!0,!0;return!1}),n)}if(s){const{childMap:s,zIdxArray:a}=Lp(t,e,n);let o=!1;for(let t=0;t<a.length&&!o;t++){const e=s[a[t]];r&&e.sort(((t,e)=>{var i,r;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(r=t.attribute.z)&&void 0!==r?r:0))}));for(let t=0;t<e.length;t++)if(i(e[t],t)){o=!0;break}}}else t.forEachChildren(i,n)}function Dp(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Op(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function jp(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return r=!0,!0;return!1}),n);let s=null,a=!1;if(r){const{childMap:r,zIdxArray:o}=Lp(t,i,n);let l=!1;for(let t=0;t<o.length&&!l;t++){const i=r[o[t]];for(let t=0;t<i.length;t++){if(a){l=!0,s=i[t];break}i[t]._uid!==e||(a=!0)}}}else t.forEachChildren((t=>a?(s=t,!0):(t._uid===e&&(a=!0),!1)),n);return s}var Up=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Wp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Np=function(t,e){return function(i,n){e(i,n,t)}};let Gp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new oe,this.backupDirtyBounds=new oe,this.global=vn.global,this.layerService=vn.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,viewBox:r,transMatrix:s}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:n,x12:r,y11:s,y12:a,x21:o,x22:l,y21:h,y22:c}=Kt(t,e,i);return n>=l||r<=o||s>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(s,h),x2:Math.min(r,l),y2:Math.min(a,c)}}(a,n.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(s.a,s.b,s.c,s.d,s.e,s.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(r.x1,r.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ji.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Ji.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Ol.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=jp(e,i,Ji.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,n){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Zt(t.AABBBounds,this.dirtyBounds,!1))return;let r,s=i;if(this.useDirtyBounds){r=Jh.allocateByObj(this.dirtyBounds);const e=t.transMatrix;s=Ol.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;n?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,s):this.renderItem(t,e))})):Ip(t,Ji.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,s):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(r),Jh.free(r),Ol.free(s))}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:r}=i;let s=r.get(t._uid);s||(s={layer:this.layerService.createLayer(n),zIndex:r.size,group:t},r.set(t._uid,s));const a=s.layer.getNativeHandler().getContext(),o=s.drawContribution||Dn.get(Ac);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:s.layer,context:a,startAtId:t._uid,break:!1})),s.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=r.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:r.size},r.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const r=this.InterceptorContributions[n];if(r.beforeDrawItem&&r.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const n=this.getRenderContribution(t);if(!n)return;let r,s=this.scrollMatrix&&(0!==this.scrollMatrix.e||0!==this.scrollMatrix.f);if(t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;(e||i)&&(s=!0,this.scrollMatrix||(this.scrollMatrix=Ol.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-i))}if(s&&(r=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&!Zt(t.AABBBounds,null!=r?r:this.dirtyBounds,!1)){if(s&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}return}const a=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=a),a?t.isContainer&&n.draw(t,this.currentRenderService,e,i):n.draw(t,this.currentRenderService,e,i),s&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}if(this.InterceptorContributions.length)for(let i=0;i<this.InterceptorContributions.length;i++){const n=this.InterceptorContributions[i];if(n.afterDrawItem&&n.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return xt.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let i;if(e.attribute.renderStyle){const n=this.styleRenderMap.get(e.attribute.renderStyle);i=n&&n.get(t)}return i||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var n,r;const{clear:s,viewBox:a}=i,o=a.width(),l=a.height();if(s){e.clearRect(0,0,o,l);const i=null===(n=t.drawParams)||void 0===n?void 0:n.stage;if(i&&(e.globalAlpha=null!==(r=i.attribute.opacity)&&void 0!==r?r:1),i&&i.backgroundImg&&i.resources){const t=i.resources.get(s);t&&"success"===t.state&&t.data&&e.drawImage(t.data,0,0,o,l)}else e.fillStyle=xn(e,s,{AABBBounds:{x1:0,y1:0,x2:0+o,y2:0+l}},0,0),e.fillRect(0,0,o,l)}}afterDraw(t,e){}};Gp=Up([g(),Np(0,f(Pc)),Np(1,p(k)),Np(1,v(Yc)),Wp("design:paramtypes",[Array,Object])],Gp);var Fp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let zp=class extends t.DefaultCanvasLineRender{constructor(){super(...arguments),this.numberType=co}drawShape(t,e,i,n,r,s,a,o){if(t.incremental&&r.multiGraphicOptions){const{startAtIdx:e,length:s}=r.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=kr(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:f=h.strokeOpacity,lineWidth:g=h.lineWidth,visible:v=h.visible}=t.attribute,m=Fo(d,p,c),y=Ho(d,f),b=No(c),x=Go(u,g);if(!t.valid||!v)return;if(!b&&!x)return;if(!(m||y||a||o))return;const{context:w}=r;for(let r=e;r<e+s;r++)this.drawIncreaseSegment(t,w,l[r-1],l[r],t.attribute.segments[r],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,r,s,a,o)}drawIncreaseSegment(t,e,i,n,r,s,a,o){n&&(e.beginPath(),Mh(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,r,s),e.setStrokeStyle(t,r,a,o,s),e.stroke())}};zp=Fp([g()],zp);var Hp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Vp=class extends t.DefaultCanvasAreaRender{constructor(){super(...arguments),this.numberType=so}drawShape(t,e,i,n,r,s,a){if(t.incremental&&r.multiGraphicOptions){const{startAtIdx:s,length:o}=r.multiGraphicOptions,{segments:l=[]}=t.attribute;if(s>l.length)return;const h=kr(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,f=Fo(d,u,c),g=No(c);if(!t.valid||!p)return;if(!g)return;if(!f&&!a)return;for(let r=s;r<s+o;r++)this.drawIncreaseSegment(t,e,l[r-1],l[r],t.attribute.segments[r],[h,t.attribute],i,n)}else super.drawShape(t,e,i,n,r,s,a)}drawIncreaseSegment(t,e,i,n,r,s,a,o){n&&(e.beginPath(),Eh(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,r,s),e.setCommonStyle(t,r,a,o,s),e.fill())}};Vp=Hp([g()],Vp);var Yp,Xp=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},$p=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qp=function(t,e){return function(i,n){e(i,n,t)}},Kp=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Yp||(Yp={}));let Zp=class extends Gp{constructor(t,e,i,n){super(t,n),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=n,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Yp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new j([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Kp(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:n,viewBox:r}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(r.x1,r.y1,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ji.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Ji.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Kp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Kp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Kp(this,void 0,void 0,(function*(){if(2!==t.count)yield Dp(t,Ji.zIndex,((i,n)=>{if(this.status===Yp.STOP)return!0;if(i.isContainer)return!1;if(n<this.currentIdx)return!1;const r=this.currFrameStartAt+t.incremental;return n<r&&(this.currentIdx=n+1,this.renderItem(i,e)),n===r-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const n=t.getChildAt(0);if(n.incremental&&n.attribute.segments)for(n.incrementalAt||(n.incrementalAt=0);n.incrementalAt<n.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:n.incrementalAt,length:n.incremental},this.renderItem(n,e),n.incrementalAt+=n.incremental,yield this.waitToNextFrame();else this.renderItem(n,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return Kp(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Kp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Kp(this,void 0,void 0,(function*(){this.rendering&&(this.status=Yp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Yp.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Kp(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Kp(this,void 0,void 0,(function*(){yield Dp(t,Ji.zIndex,(t=>Kp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Zp=Xp([g(),qp(0,f(Pc)),qp(1,p(zp)),qp(2,p(Vp)),qp(3,p(k)),qp(3,v(Yc)),$p("design:paramtypes",[Array,Object,Object,Object])],Zp);var Jp=new i((e=>{e(Vl).toSelf().inSingletonScope(),e(Xl).toSelf().inSingletonScope(),e(Fc).to(Gp),e(Ac).to(Zp),e(Rc).to(t.DefaultCanvasGroupRender).inSingletonScope(),e(Pc).toService(Rc),L(e,sl),e(t.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(),L(e,pl),L(e,Pc),e(t.CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(),e(Yc).toService(t.CommonDrawItemInterceptorContribution),L(e,Yc)}));function Qp(){Qp.__loaded||(Qp.__loaded=!0,Dn.load(Wo),Dn.load(bp),Dn.load(ru),Dn.load(yp),Dn.load(_p),function(t){t.load(Bp),t.load(Pp),t.load(kp)}(Dn),function(t){t.load(Jp)}(Dn))}Qp.__loaded=!1,Qp();const tf=Dn.get(W);vn.global=tf;const ef=Dn.get(Eo);vn.graphicUtil=ef;const nf=Dn.get(Mo);vn.transformUtil=nf;const rf=Dn.get(xo);vn.graphicService=rf;const sf=Dn.get(ko);vn.layerService=sf;class af{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,vn.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),vn.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),vn.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));vn.graphicService.hooks.onAttributeUpdate.taps=e(vn.graphicService.hooks.onAttributeUpdate.taps),vn.graphicService.hooks.onSetStage.taps=e(vn.graphicService.hooks.onSetStage.taps),vn.graphicService.hooks.onRemove.taps=e(vn.graphicService.hooks.onRemove.taps)}}class of{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=vn.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=vn.global.getRequestAnimationFrame();this.rafId=t((()=>{vn.global.devicePixelRatio!==this.dpr&&(this.dpr=vn.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=vn.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class lf{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,vn.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),vn.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){vn.graphicService.hooks.onAddIncremental.taps=vn.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.onClearIncremental.taps=vn.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,vn.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const hf=new le;class cf{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),vn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(hf.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(hf,t.parent&&t.parent.globalTransMatrix)))})),vn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,r)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!r||e.dirty(n.globalAABBBounds))})),vn.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),vn.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){vn.graphicService.hooks.beforeUpdateAABBBounds.taps=vn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.afterUpdateAABBBounds.taps=vn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.clearAABBBounds.taps=vn.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.onRemove.taps=vn.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const uf=new Kr;let df;function pf(){if(null==df)try{const t=document.createElement("canvas"),e=t.getContext("2d");df=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),df&&(df=!!document.createElement)}catch(t){df=!1}}function ff(){pf();const t=vn.global&&vn.global.env;return t?"browser"===t:df}function gf(){pf();const t=vn.global&&vn.global.env;return t?"node"===t:!df}uf.addTimeline(ts),uf.setFPS(60);class vf{static registerPlugin(t,e){vf._pluginClasses[t]=e}static getPlugin(t){return vf._pluginClasses[t]}}vf._pluginClasses={};const mf="white";class yf extends Bo{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:mf}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this.tickedBeforeRender=!0,this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{var t;this.tickedBeforeRender=!0,"performance"===(null===(t=this.params.optimize)||void 0===t?void 0:t.tickRenderMode)||"rendering"!==this.state&&this.render()},this.params=t,this.theme=new Mr,this.hooks={beforeRender:new j(["stage"]),afterRender:new j(["stage"])},this.global=vn.global,!this.global.env&&ff()&&this.global.setEnv("browser"),this.window=Dn.get(yr),this.renderService=Dn.get(iu),this.pluginService=Dn.get(wp),this.layerService=Dn.get(ko),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:mf,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||uf,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new Qr,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&rt(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.ticker.on("afterTick",this.afterTickCb)}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Yr(Object.assign({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,supportsPointerEvents:this.params.supportsPointerEvents,supportsTouchEvents:this.params.supportsTouchEvents},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:r=0,camera:s,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:r,camera:s,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,r,s,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:f}=o,{dir:g=[1,1,-1],color:v="white",ambient:m}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),b=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(r=h.dy)&&void 0!==r?r:0),x=[y,b,(null!==(s=h.z)&&void 0!==s?s:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let w=0,S=0,A=0;c||(w=Math.sin(u)+y,S=Math.sin(d)+b,A=Math.cos(u)*Math.cos(d)*1);const T=vf.getPlugin("DirectionalLight");T&&(this.light=new T(g,v,m));const C={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:f,viewParams:{pos:[w,S,A],center:x,up:[0,1,0]}};if(this.camera)this.camera.params=C;else{const t=vf.getPlugin("OrthoCamera");t&&(this.camera=new t(C))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=vf.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new af))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new of))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new lf))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new oe;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new cf,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=vf.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=vf.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=vf.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.tickedBeforeRender||this.ticker.trySyncTickStatus(),this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e<t.length;e++){let n=t[e];"virtual"===n.layerMode&&(n=n.getNativeHandler().mainHandler.layer),i.includes(n)||i.push(n)}i.forEach((t=>{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,n,r){let s=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(s=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===r&&(s=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),s&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Ft(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.ticker.removeListener("afterTick",this.afterTickCb),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Dn.get(yr),i=t?-t.x1:0,n=t?-t.y1:0,r=t?t.x2:this.viewWidth,s=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:n,x2:r,y2:s},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Dn.get(au)),this.pickerService}}var bf=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},xf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const wf=new ce(1,0,0,1,0,0),Sf={x:0,y:0};t.EmptyContext2d=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ce(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ce(1,0,0,1,0,0),this.path=new Wi,this._clearMatrix=new ce(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Ol.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Ol.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Ol.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*r,o*s),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,r,s),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,r,s){this.path.arc(t,e,i,n,r,s)}arcTo(t,e,i,n,r){this.path.arcTo(t,e,i,n,r)}bezierCurveTo(t,e,i,n,r,s){this.path.bezierCurveTo(t,e,i,n,r,s)}closePath(){this.path.closePath()}ellipse(t,e,i,n,r,s,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,r,s){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Sf),function(t,e,i){return pr(t,0,!1,e,i)}(this.path.commandList,Sf.x,Sf.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Sf);const i=bn(this,this.lineWidth,this.dpr);return function(t,e,i,n){return pr(t,e,!0,i,n)}(this.path.commandList,i,Sf.x,Sf.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,r){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,r){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(wf,t,e)}setClearMatrix(t,e,i,n,r,s){this._clearMatrix.setValue(t,e,i,n,r,s)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Ol.free(t))),this.stack.length=0}},t.EmptyContext2d=bf([g(),xf("design:paramtypes",[Object,Number])],t.EmptyContext2d);const Af={WIDTH:500,HEIGHT:500,DPR:1};class Tf{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:n=Af.WIDTH,height:r=Af.HEIGHT,dpr:s=Af.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=n*s,this._pixelHeight=r*s,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=n,this._displayHeight=r,this._dpr=s,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}Tf.env="browser";var Cf=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};t.BaseEnvContribution=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new le}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}},t.BaseEnvContribution=Cf([g()],t.BaseEnvContribution);var _f=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Bf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.BaseWindowHandlerContribution=class{constructor(){this._uid=e.GenAutoIncrementId(),this.viewBox=new le,this.modelMatrix=new ce(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,n,r,s){this.modelMatrix.setValue(t,e,i,n,r,s)}getViewBoxTransform(){return this.modelMatrix}},t.BaseWindowHandlerContribution=_f([g(),Bf("design:paramtypes",[])],t.BaseWindowHandlerContribution);class Pf{constructor(e,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=e,this.color=i,this.colorRgb=ea.Get(i,t.ColorType.Color1),this.ambient=n;const r=Dt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);this.formatedDir=[e[0]/r,e[1]/r,e[2]/r]}computeColor(e,i){const n=this.formatedDir,r=Lt(Ot((e[0]*n[0]+e[1]*n[1]+e[2]*n[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=rt(i)?ea.Get(i,t.ColorType.Color1):i;const a=this.colorRgb;return`rgb(${a[0]*s[0]*r}, ${a[1]*s[1]*r}, ${a[2]*s[2]*r})`}}const Rf=()=>{vf.registerPlugin("DirectionalLight",Pf)};class Mf{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=Ll.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Ll.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return Cl(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Ll.allocate()),this._vp=Tl(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Ll.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Ll.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return _l(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=Ll.allocate()),this._vp=Tl(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:n}=this._params;return(null!=e?e:n-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const n=[0,0,0];return Bl(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:r}=this._params.viewParams;Bl(n,[t,e,i],this._viewMatrixCached),t=n[0],e=n[1],i=n[2];const s=this.getProjectionScale(i);return{x:t*s+r[0],y:e*s+r[1]}}}const Ef=()=>{vf.registerPlugin("OrthoCamera",Mf)};var kf=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Of=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lf=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultPickService=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=vn.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;const r=i.bounds.width(),s=i.bounds.height();if(!(new le).setValue(0,0,r,s).containsPoint(e))return n;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ce(1,0,0,1,0,0);let o;for(let r=t.length-1;r>=0&&(n=t[r].isContainer?this.pickGroup(t[r],e,a,i):this.pickItem(t[r],e,a,i),!n.graphic);r--)o||(o=n.group);if(n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n.graphic){let t=n.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(n.params={shadowTarget:n.graphic},n.graphic=t.shadowHost)}return n}containsPoint(t,e,i){var n;return!!(null===(n=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===n?void 0:n.graphic)}pickGroup(t,e,i,n){let r={group:null,graphic:null};if(!1===t.attribute.visibleAll)return r;const s=n.pickContext,a=s.modelMatrix;if(s.camera){const e=t.transMatrix,i=Ll.allocate();if(Sl(i,e),a){if(i){const t=Ll.allocate();s.modelMatrix=Tl(t,a,i),Ll.free(i)}}else Sl(i,t.globalTransMatrix),s.modelMatrix=i}if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const o=this.InterceptorContributions[r];if(o.beforePickItem){const r=o.beforePickItem(t,this,e,n,{parentMatrix:i});if(r)return s.modelMatrix!==a&&Ll.free(s.modelMatrix),s.modelMatrix=a,r}}const o=t.transMatrix,l=Ol.allocateByObj(i),h=new Ft(e.x,e.y);l.transformPoint(h,h);const c=t.AABBBounds.containsPoint(h);if(!c&&!t.stage.camera)return r;const u=this.pickItem(t,h.clone(),i,n);u&&u.graphic&&(r.graphic=u.graphic,r.params=u.params);const d=!1!==t.attribute.pickable&&c;return l.multiply(o.a,o.b,o.c,o.d,o.e,o.f),!1===t.attribute.childrenPickable||u&&u.graphic||Ip(t,Ji.zIndex,(s=>{if(s.isContainer){const i=new Ft(e.x,e.y),a=kr(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,r=this.pickGroup(s,i,l,n)}else{const a=new Ft(e.x,e.y);l.transformPoint(a,a);const o=kr(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(s,a,i,n);u&&u.graphic&&(r.graphic=u.graphic,r.params=u.params)}return!!r.graphic||!!r.group}),!0,!!s.camera),s.modelMatrix!==a&&Ll.free(s.modelMatrix),s.modelMatrix=a,r.graphic||r.group||!d||t.stage.camera||(r.group=t),Ol.free(l),r}selectPicker(t){return this.pickerMap.get(t.numberType)||null}},t.DefaultPickService=kf([g(),Lf(0,p(k)),Lf(0,v(mp)),Of("design:paramtypes",[Object])],t.DefaultPickService);var If=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function jf(t,e){let i=0;for(i=0;i<t.length;i++){const n=t[i];if(n.text&&"\n"===n.text||e--,e<0)break}return i}t.DefaultGlobalPickerService=class{constructor(){this.global=vn.global,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const r=new ce(1,0,0,1,0,0);let s;for(let a=0;a<t.length;a++){if(t[a].isContainer)n=this.pickGroup(t[a],e,r,i);else{const s=this.pickItem(t[a],e,r,i);s&&(n.graphic=s.graphic,n.params=s.params)}if(n.graphic)break;s||(s=n.group)}if(n.graphic||(n.group=s),n.graphic){let t=n.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(n.params={shadowTarget:n.graphic},n.graphic=t.shadowHost)}return n}containsPoint(t,e,i){return!!this.pickItem(t,e,null,i)}pickGroup(t,e,i,n){let r={group:null,graphic:null};if(!1===t.attribute.visibleAll)return r;const s=t.transMatrix,a=new Ft(e.x,e.y);i.transformPoint(a,a);const o=t.AABBBounds.containsPoint(a);if(!o)return r;const l=!1!==t.attribute.pickable&&o;return i.multiply(s.a,s.b,s.c,s.d,s.e,s.f),!1!==t.attribute.childrenPickable&&t.forEachChildren((t=>{if(t.isContainer)r=this.pickGroup(t,e,i,n);else{const s=new Ft(e.x,e.y);i.transformPoint(s,s);const a=this.pickItem(t,s,i,n);a&&(r.graphic=a.graphic,r.params=a.params)}return!!r.graphic||!!r.group})),r.graphic||r.group||!l||(r.group=t),r}pickItem(t,e,i,n){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}},t.DefaultGlobalPickerService=If([g(),Df("design:paramtypes",[])],t.DefaultGlobalPickerService);class Uf{constructor(t){this.handleKeyDown=t=>{"Delete"!==t.key&&"Backspace"!==t.key||this.handleInput({data:null,type:"Backspace"})},this.handleCompositionStart=()=>{const{textConfig:t=[]}=this.currRt.attribute,e=jf(t,this.cursorIndex),i=t[e];t.splice(e+1,0,Object.assign(Object.assign({},i),{text:""})),this.isComposing=!0},this.handleCompositionEnd=()=>{this.isComposing=!1;const{textConfig:t=[]}=this.currRt.attribute,e=jf(t,this.cursorIndex+1),i=t[e];t.splice(e,1);const n=i.text,r=Array.from(n.toString());for(let n=0;n<r.length;n++)t.splice(n+e,0,Object.assign(Object.assign({},i),{text:r[n]}));this.currRt.setAttributes({textConfig:t}),this.onChangeCbList.forEach((t=>{t(n,this.isComposing,this.cursorIndex+r.length,this.currRt,"right")}))},this.handleInput=t=>{if(!this.currRt)return;let e=t.data;"Backspace"===t.type||e||(e="\n");const{textConfig:i=[]}=this.currRt.attribute;let n=this.selectionStartCursorIdx,r=this.cursorIndex;n>r&&([n,r]=[r,n]),this.selectionStartCursorIdx=n,this.cursorIndex=n,n=jf(i,n);const s=this.selectionStartCursorIdx-n;r=jf(i,r);const a=i[n+(this.isComposing?1:0)];let o=a;"Backspace"!==t.type||this.isComposing?(n!==r&&i.splice(n+1,r-n),this.isComposing||(o=Object.assign(Object.assign({},a),{text:""}),n+=1,i.splice(n,0,o)),o.text=e):n!==r?i.splice(n+1,r-n):(i.splice(n,1),n-=1),this.currRt.setAttributes({textConfig:i}),this.isComposing?this.onInputCbList.forEach((t=>{t(e,this.isComposing,n+s,this.currRt,"\n"===e?"left":"right")})):this.onChangeCbList.forEach((t=>{t(e,this.isComposing,n+s,this.currRt,"\n"===e?"left":"right")}))},this.container=null!=t?t:document.body;const e=document.createElement("textarea");e.autocomplete="off",e.innerText="",this.applyStyle(e),this.container.append(e),this.textAreaDom=e,this.isComposing=!1,this.onInputCbList=[],this.onChangeCbList=[]}onInput(t){this.onInputCbList.push(t)}onChange(t){this.onChangeCbList.push(t)}applyStyle(t){t.setAttribute("style","width: 100px; height: 30px; left: 0; top: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;"),t.addEventListener("input",this.handleInput),t.addEventListener("compositionstart",this.handleCompositionStart),t.addEventListener("compositionend",this.handleCompositionEnd),window.addEventListener("keydown",this.handleKeyDown)}moveTo(t,e,i,n,r){this.textAreaDom.style.left=`${t}px`,this.textAreaDom.style.top=`${e}px`,setTimeout((()=>{this.textAreaDom.focus(),this.textAreaDom.setSelectionRange(0,0)})),this.currRt=i,this.cursorIndex=n,this.selectionStartCursorIdx=r}release(){this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),window.removeEventListener("keydown",this.handleKeyDown)}}class Wf{constructor(t,e,i,n,r){this.curCursorIdx=n,this.selectionStartCursorIdx=i,this.cacheCurCursorIdx=e,this.cacheSelectionStartCursorIdx=t,this.rt=r}hasFormat(t){return null!=this.getFormat(t)}getFormat(t){if(!this.rt)return null;const e=this.rt.attribute.textConfig,i=e[this.selectionStartCursorIdx+1][t];if(null==i)return null;for(let n=this.selectionStartCursorIdx+2;n<=this.curCursorIdx;n++)if(i!==e[n][t])return null;return i}getAllFormat(t){if(!this.rt)return[];const e=this.rt.attribute.textConfig,i=e[this.selectionStartCursorIdx+1][t],n=new Set;n.add(i);for(let i=this.selectionStartCursorIdx+2;i<=this.curCursorIdx;i++){const r=e[i];n.add(r[t])}return Array.from(n.values())}}const Nf="FORMAT_TEXT_COMMAND";class Gf{constructor(){this.pools=[]}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}class Ff extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.rect(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.rect(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const zf=new Ff;class Hf extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.arc(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.arc(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Vf=new Hf;class Yf extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.area(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.area(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Xf=new Yf;class $f extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.circle(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.circle(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const qf=new $f;class Kf extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.line(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.line(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Zf=new Kf;class Jf extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.path(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.path(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Qf=new Jf;class tg extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.symbol(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.symbol(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const eg=new tg;class ig extends Gf{allocate(t){if(!this.pools.length)return vn.graphicService.creator.text(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return vn.graphicService.creator.text(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const ng=new ig;class rg{constructor(){this.map={text:ng,symbol:eg}}gc(t){t.isContainer?t.forEachChildren((t=>this.gc(t))):this.gcItem(t)}gcItem(t){const e=this.map[t.type];e&&e.free(t)}}const sg=new rg;let ag=!1;const og=new i((e=>{ag||(ag=!0,e(t.DefaultCanvasArcRender).toSelf().inSingletonScope(),e(Tc).to(t.DefaultCanvasArcRender).inSingletonScope(),e(Pc).toService(Tc),e(il).toService(t.DefaultBaseInteractiveRenderContribution),L(e,il))}));let lg=!1;const hg=new i((e=>{lg||(lg=!0,e(t.DefaultCanvasRectRender).toSelf().inSingletonScope(),e(Oc).to(t.DefaultCanvasRectRender).inSingletonScope(),e(Pc).toService(Oc),e(t.SplitRectAfterRenderContribution).toSelf(),e(t.SplitRectBeforeRenderContribution).toSelf(),e(hl).toService(t.SplitRectAfterRenderContribution),e(hl).toService(t.SplitRectBeforeRenderContribution),e(hl).toService(t.DefaultBaseInteractiveRenderContribution),L(e,hl))}));let cg=!1;const ug=new i((e=>{cg||(cg=!0,e(t.DefaultCanvasLineRender).toSelf().inSingletonScope(),e(zp).toSelf().inSingletonScope(),e(Mc).to(t.DefaultCanvasLineRender).inSingletonScope(),e(Pc).toService(Mc))}));let dg=!1;const pg=new i((e=>{dg||(dg=!0,e(t.DefaultCanvasAreaRender).toSelf().inSingletonScope(),e(_c).to(t.DefaultCanvasAreaRender).inSingletonScope(),e(Pc).toService(_c),e(nl).toService(t.DefaultBaseInteractiveRenderContribution),L(e,nl),e(Vp).toSelf().inSingletonScope())}));let fg=!1;const gg=new i((e=>{fg||(fg=!0,e(t.DefaultCanvasSymbolRender).toSelf().inSingletonScope(),e(Ic).to(t.DefaultCanvasSymbolRender).inSingletonScope(),e(Pc).toService(Ic),e(cl).toService(t.DefaultBaseInteractiveRenderContribution),L(e,cl))}));let vg=!1;const mg=new i((e=>{vg||(vg=!0,e(t.DefaultCanvasCircleRender).toSelf().inSingletonScope(),e(Bc).to(t.DefaultCanvasCircleRender).inSingletonScope(),e(Pc).toService(Bc),e(rl).toService(t.DefaultBaseInteractiveRenderContribution),L(e,rl))}));let yg=!1;const bg=new i((e=>{yg||(yg=!0,e(Dc).to(t.DefaultCanvasTextRender).inSingletonScope(),e(Pc).toService(Dc),e(ul).toService(t.DefaultBaseInteractiveRenderContribution),L(e,ul))}));let xg=!1;const wg=new i((e=>{xg||(xg=!0,e(t.DefaultCanvasPathRender).toSelf().inSingletonScope(),e(Ec).to(t.DefaultCanvasPathRender).inSingletonScope(),e(Pc).toService(Ec),e(ol).toService(t.DefaultBaseInteractiveRenderContribution),L(e,ol))}));let Sg=!1;const Ag=new i((e=>{Sg||(Sg=!0,e(kc).to(t.DefaultCanvasPolygonRender).inSingletonScope(),e(Pc).toService(kc),e(ll).toService(t.DefaultBaseInteractiveRenderContribution),L(e,ll))}));var Tg=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Cg=class{constructor(){this.numberType=oo}drawShape(t,e,i,n,r,s,a,o){r.drawContribution&&t.getSubGraphic().forEach((t=>{const l=r.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,r,s,a,o)}))}draw(t,e,i,n){const{context:r}=i;if(!r)return;if(r.highPerformanceSave(),!i.drawContribution)return;const s=kr(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:s})})),r.highPerformanceRestore()}};Cg=Tg([g()],Cg);let _g=!1;const Bg=new i((t=>{_g||(_g=!0,t(Wc).to(Cg).inSingletonScope(),t(Pc).toService(Wc))}));var Pg=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Rg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Mg=class extends Gl{constructor(){super(),this.numberType=mo,this.builtinContributions=[nc],this.init()}drawShape(t,e,i,n,r){const s=kr(t).richtext,{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity,fillOpacity:l=s.fillOpacity,visible:h=s.visible}=t.attribute;if(!t.valid||!h)return;const c=Fo(o,l,!0),u=Fo(o,a,!0);c&&(e.translate(i,n),this.beforeRenderStep(t,e,i,n,c,u,c,u,s,r),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,n,c,u,c,u,s,r))}drawIcon(t,e,i,n,r){var s;const a=kr(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:f=a.backgroundStrokeOpacity,backgroundRadius:g=a.backgroundRadius,margin:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,r=(y-l)/2;0===g?(e.beginPath(),e.rect(i-t,n-r,m,y)):(e.beginPath(),ah(e,i-t,n-r,m,y,g)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=f,e.strokeStyle=p,e.stroke())}const b=c&&(null===(s=null==t?void 0:t.resources)||void 0===s?void 0:s.get(c));b&&"success"===b.state&&(e.globalAlpha=h,e.drawImage(b.data,i,n,o,l))}draw(t,e,i){const n=kr(t).richtext;this._draw(t,n,!1,i)}};Mg=Pg([g(),Rg("design:paramtypes",[])],Mg);let Eg=!1;const kg=new i((t=>{Eg||(Eg=!0,t(jc).to(Mg).inSingletonScope(),t(Pc).toService(jc))}));let Og=!1;const Lg=new i((e=>{Og||(Og=!0,e(Nc).to(t.DefaultCanvasImageRender).inSingletonScope(),e(Pc).toService(Nc),e(al).toService(t.DefaultBaseInteractiveRenderContribution),L(e,al))}));class Ig extends Gl{stroke(t,e,i,n,r){const s=n.vertices;n.edges.forEach((n=>{const a=s[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=s[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};r.beginPath(),r.moveTo(o.x,o.y,o.z),r.lineTo(h.x,h.y,h.z),r.stroke()}))}fill(e,i,n,r,s,a,o,l,h,c,u){const d=ea.Get(a,t.ColorType.Color255),p=r.vertices,f=p.map((t=>o.view(t[0],t[1],t[2])[2])),g=[];r.polygons.forEach(((t,e)=>{if(s&&!s[e])return;g.push({faceIdx:e,polygon:t});const{polygon:i}=t,n=f[i[0]],r=f[i[1]],a=f[i[2]],o=f[i[3]];t.ave_z=n+r+a+o})),g.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),g.forEach((t=>{const{polygon:r,normal:s}=t.polygon,f=p[r[0]],g=p[r[1]],v=p[r[2]],m=p[r[3]],y={x:e+f[0],y:i+f[1],z:n+f[2]},b={x:e+g[0],y:i+g[1],z:n+g[2]},x={x:e+v[0],y:i+v[1],z:n+v[2]},w={x:e+m[0],y:i+m[1],z:n+m[2]};o.beginPath(),o.moveTo(y.x,y.y,y.z),o.lineTo(b.x,b.y,b.z),o.lineTo(x.x,x.y,x.z),o.lineTo(w.x,w.y,w.z),o.closePath(),u?u(o,h&&h.attribute,c):(o.fillStyle=l?l.computeColor(s,d):a,o.fill())}))}}var Dg=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let jg=class extends Ig{constructor(){super(...arguments),this.type="rect3d",this.numberType=vo}drawShape(t,e,i,n,r,s,a,o){var l;const h=kr(t,null==s?void 0:s.theme).rect,{fill:c=h.fill,stroke:u=h.stroke,x1:d,y1:p,x:f,y:g,opacity:v=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:y=h.lineWidth,strokeOpacity:b=h.strokeOpacity,visible:x=h.visible}=t.attribute;let{width:w,height:S}=t.attribute;w=(null!=w?w:d-f)||0,S=(null!=S?S:p-g)||0;const A=null!==(l=this.z)&&void 0!==l?l:0,T=zo(v,m,w,S,c),C=Vo(v,b,w,S),_=No(c),B=Go(u,y);if(!t.valid||!x)return;if(!_&&!B)return;if(!(T||C||a||o))return;const{light:P}=r.stage||{},R=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,n,A,R,null,r,e,P,null,null,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,A,R,e))}draw(t,e,i){const n=kr(t).rect;this._draw(t,n,!1,i)}};jg=Dg([g()],jg);let Ug=!1;const Wg=new i((t=>{Ug||(Ug=!0,t(Lc).to(jg).inSingletonScope(),t(Pc).toService(Lc))}));var Ng=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Gg=class extends Gl{constructor(){super(...arguments),this.numberType=ro}drawShape(e,i,n,r,s,a,o,l){var h;const c=kr(e,null==a?void 0:a.theme).arc,{fill:u=c.fill}=e.attribute,d=this.valid(e,c,o,l);if(!d)return;const{fVisible:p,sVisible:f,doFill:g,doStroke:v}=d,m=null!==(h=this.z)&&void 0!==h?h:0,{outerPadding:y=c.outerPadding,innerPadding:b=c.innerPadding,height:x=10}=e.attribute;let{outerRadius:w=c.outerRadius,innerRadius:S=c.innerRadius}=e.attribute;w+=y,S-=b;const A=ea.Get(u,t.ColorType.Color255),{light:T}=s.stage||{},C=s.hack_pieFace,_={top:m,bottom:m+x},B={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===C||"top"===C?(i.beginPath(),function(t,e,i,n,r,s,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Mt(l-o),c=l>o;let u=!1;if(s<a){const t=s;s=a,a=t}if(s<=Ct)e.moveTo(i,n,r);else if(h>=Rt-Ct)e.moveTo(i+s*kt(o),n+s*It(o),r),e.arc(i,n,s,o,l,!c,r),a>Ct&&(e.moveTo(i+a*kt(l),n+a*It(l),r),e.arc(i,n,a,l,o,c,r));else{const{outerDeltaAngle:h,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:f,innerEndAngle:g,innerStartAngle:v}=t.getParsePadAngle(o,l),m=s*kt(p),y=s*It(p),b=a*kt(g),x=a*It(g);h<.001?u=!0:(e.moveTo(i+m,n+y,r),e.arc(i,n,s,p,f,!c,r)),!(a>Ct)||d<.001?(e.lineTo(i+b,n+x,r),u=!0):(e.lineTo(i+b,n+x,r),e.arc(i,n,a,g,v,c,r))}e.closePath()}(e,i,n,r,_[C],w,S),i.setShadowBlendStyle&&i.setShadowBlendStyle(e,e.attribute,c),g&&(o?o(i,e.attribute,c):p&&(i.setCommonStyle(e,e.attribute,n,r,c),i.fillStyle=T?T.computeColor(B[C],A):u,i.fill())),v&&(l?l(i,e.attribute,c):f&&(i.setStrokeStyle(e,e.attribute,n,r,c),i.stroke()))):"outside"!==C&&"inside"!==C||("inside"===C&&(i.save(),i.beginPath(),i.arc(n,r,S,0,Rt,!0,_.top),i.clip()),i.beginPath(),function(t,e,i,n,r,s,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Mt(h-l),u=h>l;let d=!1;if(a<=Ct)e.moveTo(i,n,r);else if(c>=Rt-Ct)e.moveTo(i+a*kt(l),n+a*It(l),r),e.arc(i,n,a,l,h,!u,r),e.lineTo(i+a*kt(h),n+a*It(h),s),e.arc(i,n,a,h,l,u,s);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),f=a*kt(c),g=a*It(c),v=a*kt(p),m=a*It(p);t<.001?d=!0:(e.moveTo(i+f,n+g,r),e.arc(i,n,a,c,p,!u,r),e.lineTo(i+v,n+m,s),e.arc(i,n,a,p,c,u,s))}e.closePath()}(e,i,n,r,_.top,_.bottom,"outside"===C?w:S,((t,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:r,outerStartAngle:s,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=e.getParsePadAngle(t,i);return"outside"===C?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:s}:{innerouterDeltaAngle:r,innerouterEndAngle:o,innerouterStartAngle:l}})),i.setShadowBlendStyle&&i.setShadowBlendStyle(e,e.attribute,c),g&&(o?o(i,e.attribute,c):p&&(i.setCommonStyle(e,e.attribute,n,r,c),i.fillStyle=T?T.computeColor(B[C],A):u,i.fill())),v&&(l?l(i,e.attribute,c):f&&(i.setStrokeStyle(e,e.attribute,n,r,c),i.stroke())),"inside"===C&&i.restore())}draw(t,e,i,n){const r=kr(t,null==n?void 0:n.theme).arc;this._draw(t,r,!1,i,n)}};Gg=Ng([g()],Gg);let Fg=!1;const zg=new i((t=>{Fg||(Fg=!0,t(Cc).to(Gg).inSingletonScope(),t(Pc).toService(Cc))}));var Hg=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Vg=class extends Ig{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=fo}drawShape(t,e,i,n,r,s,a,o){var l;const h=kr(t,null==s?void 0:s.theme).polygon,{fill:c=h.fill,stroke:u=h.stroke,face:d=[!0,!0,!0,!0,!0,!0]}=t.attribute,p=null!==(l=this.z)&&void 0!==l?l:0;if(!this.valid(t,h,a,o))return;const{light:f}=r.stage||{},g=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let r=c;"string"!=typeof r&&(r="black"),this.fill(i,n,p,g,d,r,e,f,t,h,a)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,p,g,e))}draw(t,e,i){const n=kr(t).polygon;this._draw(t,n,!1,i)}};Vg=Hg([g()],Vg);let Yg=!1;const Xg=new i((t=>{Yg||(Yg=!0,t(Uc).to(Vg).inSingletonScope(),t(Pc).toService(Uc))}));function $g(){Qh.RegisterGraphicCreator("arc",ap)}function qg(){Qh.RegisterGraphicCreator("arc3d",lp)}function Kg(){Qh.RegisterGraphicCreator("area",np)}function Zg(){Qh.RegisterGraphicCreator("circle",du)}function Jg(){Qh.RegisterGraphicCreator("glyph",Nd)}function Qg(){Qh.RegisterGraphicCreator("group",Po)}function tv(){Qh.RegisterGraphicCreator("image",Vd)}function ev(){Qh.RegisterGraphicCreator("line",kd)}function iv(){Qh.RegisterGraphicCreator("path",tp)}function nv(){Qh.RegisterGraphicCreator("polygon",up)}function rv(){Qh.RegisterGraphicCreator("pyramid3d",pp)}function sv(){Qh.RegisterGraphicCreator("rect",Id)}function av(){Qh.RegisterGraphicCreator("rect3d",Ud)}function ov(){Qh.RegisterGraphicCreator("richtext",Zd)}function lv(){Qh.RegisterGraphicCreator("symbol",Rd)}function hv(){Qh.RegisterGraphicCreator("text",vu)}function cv(){Qh.RegisterGraphicCreator("shadowRoot",gp)}function uv(){Qh.RegisterGraphicCreator("wrapText",bu)}class dv{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML(t.stage.renderService)}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.onRemove.unTap(this.key),vn.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?vn.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:vn.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return vl("text"===t.type&&t.attribute?t.attribute:kr(t).text)}getTransformOfText(t){const e=kr(t).text,{textAlign:i=e.textAlign,textBaseline:n=e.textBaseline}=t.attribute,r=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:s,scaleX:a,scaleY:o}=r,l={left:"0",start:"0",end:"-100%",center:"-50%",right:"-100%",top:"0",middle:"-50%",bottom:"-100%",alphabetic:"-79%"},h={left:"0",start:"0",end:"100%",center:"50%",right:"100%",top:"0",middle:"50%",bottom:"100%",alphabetic:"79%"};return{textAlign:i,transform:`translate(${l[i]},${l[n]}) rotate(${s}deg) scaleX(${a}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[n]}`}}updateStyleOfWrapContainer(t,e,i,n,r){const{pointerEvents:s}=r;let a=this.parseDefaultStyleFromGraphic(t);a.display=!1!==t.attribute.visible?"block":"none",a.pointerEvents=!0===s?"all":s||"none",i.style.position||(i.style.position="absolute",n.style.position="relative");let o=0,l=0;const h=t.globalAABBBounds;let c=r.anchorType;if(Z(c)&&(c="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===c&&(c="top-left"),"position"===c||h.empty()){const e=t.globalTransMatrix;o=e.e,l=e.f}else{const t=((t,e)=>{const{x1:i,x2:n,y1:r,y2:s}=t,a=Math.abs(n-i),o=Math.abs(s-r);let l=(i+n)/2,h=(r+s)/2,c=0,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}})(h,c);o=t.x,l=t.y}const u=vn.global.getElementTopLeft(n,!1),d=e.window.getTopLeft(!1),p=e.viewBox,f=o+d.left-u.left+p.x1,g=l+d.top-u.top+p.y1;if(a.left=`${f}px`,a.top=`${g}px`,"text"===t.type&&"position"===c&&(a=Object.assign(Object.assign({},a),this.getTransformOfText(t))),K(r.style)){const e=r.style({top:g,left:f,width:h.width(),height:h.height()},t,i);e&&(a=Object.assign(Object.assign({},a),e))}else Q(r.style)?a=Object.assign(Object.assign({},a),r.style):rt(r.style)&&r.style&&(a=Object.assign(Object.assign({},a),function(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(";").forEach((e=>{if(e){const i=e.split(":");if(2===i.length){const e=i[0].trim(),n=i[1].trim();e&&n&&(t[e]=n)}}})),t}(r.style)));vn.global.updateDom(i,{width:r.width,height:r.width,style:a})}clearCacheContainer(){this.htmlMap&&Object.keys(this.htmlMap).forEach((t=>{this.htmlMap[t]&&this.htmlMap[t].renderId!==this.renderId&&this.removeElement(t)})),this.renderId+=1}drawHTML(t){"browser"===vn.global.env&&(t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ji.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Ji.zIndex)})).forEach((t=>{this.renderGroupHTML(t)})),this.clearCacheContainer())}renderGroupHTML(t){this.renderGraphicHTML(t),t.forEachChildren((t=>{t.isContainer?this.renderGroupHTML(t):this.renderGraphicHTML(t)}))}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{wrapContainer:e}=this.htmlMap[t];e&&vn.global.removeDom(e),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const{dom:r,container:s}=i;if(!r)return;const a=Z(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[a]&&s&&s!==this.htmlMap[a].container&&this.removeElement(a),this.htmlMap&&this.htmlMap[a])"string"==typeof r?this.htmlMap[a].wrapContainer.innerHTML=r:r!==this.htmlMap[a].wrapContainer.firstChild&&(this.htmlMap[a].wrapContainer.removeChild(this.htmlMap[a].wrapContainer.firstChild),this.htmlMap[a].wrapContainer.appendChild(r));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,s);t&&("string"==typeof r?t.innerHTML=r:t.appendChild(r),this.htmlMap||(this.htmlMap={}),this.htmlMap[a]={wrapContainer:t,nativeContainer:e,container:s,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[a])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[a];this.updateStyleOfWrapContainer(t,n,o,l,i),this.htmlMap[a].renderId=this.renderId}release(){"browser"===vn.global.env&&this.removeAllDom(this.pluginService.stage.defaultLayer)}removeAllDom(t){this.htmlMap&&(Object.keys(this.htmlMap).forEach((t=>{this.removeElement(t)})),this.htmlMap=null)}}const pv=()=>{vf.registerPlugin("HtmlAttributePlugin",dv)};class fv extends dv{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:n}=this.htmlMap[t];e?vn.global.getRequestAnimationFrame()((()=>{e.unmount()})):n&&n(),i&&vn.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const n=t.stage;if(!n)return;const r=n.params.ReactDOM,{element:s,container:a}=i;if(!s||!r||!r.createRoot&&!r.render)return;const o=Z(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&a&&a!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])r.createRoot?this.htmlMap[o].root.render(s):r.render(s,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(n,a);if(t)if(this.htmlMap||(this.htmlMap={}),r.createRoot){const i=r.createRoot(t);i.render(s),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId}}else r.render(s,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId,unmount:()=>{r.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,n,l,h,i),this.htmlMap[o].renderId=this.renderId}}const gv=()=>{vf.registerPlugin("ReactAttributePlugin",fv)};class vv{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const r=t.page.x-this.pageX,s=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=r/100,o=s/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}const mv=()=>{vf.registerPlugin("ViewTransform3dPlugin",vv)},yv=new le;class bv{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=e.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new le}pauseLayout(t){this.pause=t}tryLayoutChildren(t){t.firstChild&&this.tryLayout(t.firstChild)}tryLayout(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.pause)return;const i=t.parent;if(!(e||i&&t.needUpdateLayout()))return;const n=kr(i).group,{display:r=n.display}=i.attribute;if("flex"!==r)return;const{flexDirection:s=n.flexDirection,flexWrap:a=n.flexWrap,alignItems:o=n.alignItems,clip:l=n.clip}=i.attribute,{alignContent:h=(null!=o?o:n.alignContent)}=i.attribute;let{width:c,height:u,justifyContent:d=n.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==u){let t=0,e=0,i=0;if(p.forEach((n=>{const r=this.getAABBBounds(n);r.empty()||("column"===s||"column-reverse"===s?(e+=r.height(),t=Math.max(t,r.width())):(t+=r.width(),e=Math.max(e,r.height())),i+=r.x1,i+=r.y1,i+=r.x2,i+=r.y2)})),!isFinite(i))return;c=t,u=e}null==i.attribute.width?i.attribute.width=c:c=i.attribute.width,null==i.attribute.height?i.attribute.height=u:u=i.attribute.height,this.tempBounds.copy(i._AABBBounds);const f={main:{len:c,field:"x"},cross:{len:u,field:"y"}},g=f.main,v=f.cross;"column"!==s&&"column-reverse"!==s||(g.len=u,v.len=c,g.field="y",v.field="x"),"row-reverse"!==s&&"column-reverse"!==s||("flex-start"===d?d="flex-end":"flex-end"===d?d="flex-start":p.reverse());let m=0,y=0;const b=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===g.field?e.width():e.height(),n="x"===v.field?e.width():e.height();b.push({mainLen:i,crossLen:n}),m+=i,y=Math.max(y,n)}));const x=[];if(m>g.len&&"wrap"===a){let t=0,e=0;b.forEach(((i,n)=>{let{mainLen:r,crossLen:s}=i;t+r>g.len?0===t?(x.push({idx:n,mainLen:t+r,crossLen:s}),t=0,e=0):(x.push({idx:n-1,mainLen:t,crossLen:e}),t=r,e=s):(t+=r,e=Math.max(e,s))})),x.push({idx:b.length-1,mainLen:t,crossLen:e})}else x.push({idx:b.length-1,mainLen:m,crossLen:y});let w=0;if(x.forEach((t=>{this.layoutMain(i,p,d,g,b,w,t),w=t.idx+1})),y=x.reduce(((t,e)=>t+e.crossLen),0),1===x.length){const t={"flex-start":0,"flex-end":v.len,center:v.len/2};this.layoutCross(p,o,v,t,b,x[0],0)}else if("flex-start"===h){w=0;let t=0;x.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",v,n,b,x[i],w),w=e.idx+1,t+=e.crossLen}))}else if("center"===h){w=0;let t=Math.max(0,(v.len-y)/2);x.forEach(((e,i)=>{const n={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",v,n,b,x[i],w),w=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){w=0;const t=Math.max(0,(v.len-y)/x.length/2);let e=t;x.forEach(((i,n)=>{const r={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",v,r,b,x[n],w),w=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){w=0;const t=Math.max(0,(v.len-y)/(2*x.length-2));let e=0;x.forEach(((i,n)=>{const r={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",v,r,b,x[n],w),w=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const S=this.getAABBBounds(i);l||this.tempBounds.equals(S)||this.tryLayout(i,!1)}getAABBBounds(t){this.skipBoundsTrigger=!0;const e=t.AABBBounds;return this.skipBoundsTrigger=!1,e}updateChildPos(t,e,i){return t+(null!=e?e:0)-i}layoutMain(t,e,i,n,r,s,a){if("flex-start"===i){let t=0;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}else if("flex-end"===i){let t=n.len;for(let i=a.idx;i>=s;i--){t-=r[i].mainLen;const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`]))}}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}else{const t=a.idx-s+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=s;t<=a.idx;t++){const s=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(s,e[t].attribute[n.field],a[`${n.field}1`])),o+=r[t].mainLen+2*i}}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}else{const t=a.idx-s+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=s;t<=a.idx;t++){const s=o+(e[t],n.field,0),a=this.getAABBBounds(e[t]);!a.empty()&&(e[t].attribute[n.field]=this.updateChildPos(s,e[t].attribute[n.field],a[`${n.field}1`])),o+=r[t].mainLen+2*i}}else if("center"===i){let t=(n.len-a.mainLen)/2;for(let i=s;i<=a.idx;i++){const s=t+(e[i],n.field,0),a=this.getAABBBounds(e[i]);!a.empty()&&(e[i].attribute[n.field]=this.updateChildPos(s,e[i].attribute[n.field],a[`${n.field}1`])),t+=r[i].mainLen}}}layoutCross(t,e,i,n,r,s,a){var o;for(let l=a;l<=s.idx;l++){const s=t[l];let{alignSelf:a}=s.attribute;a&&"auto"!==a||(a=e);const h=this.getAABBBounds(s),c=null!==(o=n[a])&&void 0!==o?o:n["flex-start"];"flex-end"===a?!h.empty()&&(s.attribute[i.field]=this.updateChildPos(c-r[l].crossLen+(i.field,0),s.attribute[i.field],h[`${i.field}1`])):"center"===a?!h.empty()&&(s.attribute[i.field]=this.updateChildPos(c-r[l].crossLen/2+(i.field,0),s.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(s.attribute[i.field]=this.updateChildPos(c+(i.field,0),s.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,vn.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),vn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&yv.copy(n)})),vn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,r)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(yv.equals(i)||this.tryLayout(t,!1))})),vn.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){vn.graphicService.hooks.onAttributeUpdate.taps=vn.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.beforeUpdateAABBBounds.taps=vn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.afterUpdateAABBBounds.taps=vn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),vn.graphicService.hooks.onSetStage.taps=vn.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const xv=()=>{vf.registerPlugin("FlexLayoutPlugin",bv)};function wv(t,e,i){if(t&&t.length){const[n,r]=e,s=Math.PI/180*i,a=Math.cos(s),o=Math.sin(s);t.forEach((t=>{const[e,i]=t;t[0]=(e-n)*a-(i-r)*o+n,t[1]=(e-n)*o+(i-r)*a+r}))}}function Sv(t){const e=t[0],i=t[1];return Math.sqrt(Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2))}function Av(t,e){const i=e.hachureAngle+90;let n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.max(n,.1);const r=[0,0];if(i)for(const e of t)wv(e,r,i);const s=function(t,e){const i=[];for(const e of t){const t=[...e];t[0].join(",")!==t[t.length-1].join(",")&&t.push([t[0][0],t[0][1]]),t.length>2&&i.push(t)}const n=[];e=Math.max(e,.1);const r=[];for(const t of i)for(let e=0;e<t.length-1;e++){const i=t[e],n=t[e+1];if(i[1]!==n[1]){const t=Math.min(i[1],n[1]);r.push({ymin:t,ymax:Math.max(i[1],n[1]),x:t===i[1]?i[0]:n[0],islope:(n[0]-i[0])/(n[1]-i[1])})}}if(r.sort(((t,e)=>t.ymin<e.ymin?-1:t.ymin>e.ymin?1:t.x<e.x?-1:t.x>e.x?1:t.ymax===e.ymax?0:(t.ymax-e.ymax)/Math.abs(t.ymax-e.ymax))),!r.length)return n;let s=[],a=r[0].ymin;for(;s.length||r.length;){if(r.length){let t=-1;for(let e=0;e<r.length&&!(r[e].ymin>a);e++)t=e;r.splice(0,t+1).forEach((t=>{s.push({s:a,edge:t})}))}if(s=s.filter((t=>!(t.edge.ymax<=a))),s.sort(((t,e)=>t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x))),s.length>1)for(let t=0;t<s.length;t+=2){const e=t+1;if(e>=s.length)break;const i=s[t].edge,r=s[e].edge;n.push([[Math.round(i.x),a],[Math.round(r.x),a]])}a+=e,s.forEach((t=>{t.edge.x=t.edge.x+e*t.edge.islope}))}return n}(t,n);if(i){for(const e of t)wv(e,r,-i);!function(t,e,i){const n=[];t.forEach((t=>n.push(...t))),wv(n,e,i)}(s,r,-i)}return s}class Tv{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){const i=Av(t,e);return{type:"fillSketch",ops:this.renderLines(i,e)}}renderLines(t,e){const i=[];for(const n of t)i.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],e));return i}}class Cv extends Tv{fillPolygons(t,e){let i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);const n=Av(t,Object.assign({},e,{hachureGap:i})),r=Math.PI/180*e.hachureAngle,s=[],a=.5*i*Math.cos(r),o=.5*i*Math.sin(r);for(const[t,e]of n)Sv([t,e])&&s.push([[t[0]-a,t[1]+o],[...e]],[[t[0]+a,t[1]-o],[...e]]);return{type:"fillSketch",ops:this.renderLines(s,e)}}}class _v extends Tv{fillPolygons(t,e){const i=this._fillPolygons(t,e),n=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),r=this._fillPolygons(t,n);return i.ops=i.ops.concat(r.ops),i}}class Bv{constructor(t){this.helper=t}fillPolygons(t,e){const i=Av(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(i,e)}dotsOnLines(t,e){const i=[];let n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.max(n,.1);let r=e.fillWeight;r<0&&(r=e.strokeWidth/2);const s=n/4;for(const a of t){const t=Sv(a),o=t/n,l=Math.ceil(o)-1,h=t-l*n,c=(a[0][0]+a[1][0])/2-n/4,u=Math.min(a[0][1],a[1][1]);for(let t=0;t<l;t++){const a=u+h+t*n,o=c-s+2*Math.random()*s,l=a-s+2*Math.random()*s,d=this.helper.ellipse(o,l,r,r,e);i.push(...d.ops)}}return{type:"fillSketch",ops:i}}}class Pv{constructor(t){this.helper=t}fillPolygons(t,e){const i=Av(t,e);return{type:"fillSketch",ops:this.dashedLine(i,e)}}dashedLine(t,e){const i=e.dashOffset<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashOffset,n=e.dashGap<0?e.hachureGap<0?4*e.strokeWidth:e.hachureGap:e.dashGap,r=[];return t.forEach((t=>{const s=Sv(t),a=Math.floor(s/(i+n)),o=(s+n-a*(i+n))/2;let l=t[0],h=t[1];l[0]>h[0]&&(l=t[1],h=t[0]);const c=Math.atan((h[1]-l[1])/(h[0]-l[0]));for(let t=0;t<a;t++){const s=t*(i+n),a=s+i,h=[l[0]+s*Math.cos(c)+o*Math.cos(c),l[1]+s*Math.sin(c)+o*Math.sin(c)],u=[l[0]+a*Math.cos(c)+o*Math.cos(c),l[1]+a*Math.sin(c)+o*Math.sin(c)];r.push(...this.helper.doubleLineOps(h[0],h[1],u[0],u[1],e))}})),r}}class Rv{constructor(t){this.helper=t}fillPolygons(t,e){const i=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,n=e.zigzagOffset<0?i:e.zigzagOffset,r=Av(t,e=Object.assign({},e,{hachureGap:i+n}));return{type:"fillSketch",ops:this.zigzagLines(r,n,e)}}zigzagLines(t,e,i){const n=[];return t.forEach((t=>{const r=Sv(t),s=Math.round(r/(2*e));let a=t[0],o=t[1];a[0]>o[0]&&(a=t[1],o=t[0]);const l=Math.atan((o[1]-a[1])/(o[0]-a[0]));for(let t=0;t<s;t++){const r=2*t*e,s=2*(t+1)*e,o=Math.sqrt(2*Math.pow(e,2)),h=[a[0]+r*Math.cos(l),a[1]+r*Math.sin(l)],c=[a[0]+s*Math.cos(l),a[1]+s*Math.sin(l)],u=[h[0]+o*Math.cos(l+Math.PI/4),h[1]+o*Math.sin(l+Math.PI/4)];n.push(...this.helper.doubleLineOps(h[0],h[1],u[0],u[1],i),...this.helper.doubleLineOps(u[0],u[1],c[0],c[1],i))}})),n}}const Mv={};class Ev{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const kv={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Ov(t,e){return t.type===e}function Lv(t){const e=[],i=function(t){const e=new Array;for(;""!==t;)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:0,text:RegExp.$1},t=t.substr(RegExp.$1.length);else{if(!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];e[e.length]={type:1,text:`${parseFloat(RegExp.$1)}`},t=t.substr(RegExp.$1.length)}return e[e.length]={type:2,text:""},e}(t);let n="BOD",r=0,s=i[r];for(;!Ov(s,2);){let a=0;const o=[];if("BOD"===n){if("M"!==s.text&&"m"!==s.text)return Lv("M0,0"+t);r++,a=kv[s.text],n=s.text}else Ov(s,1)?a=kv[n]:(r++,a=kv[s.text],n=s.text);if(!(r+a<i.length))throw new Error("Path data ended short");for(let t=r;t<r+a;t++){const e=i[t];if(!Ov(e,1))throw new Error("Param not a number: "+n+","+e.text);o[o.length]=+e.text}if("number"!=typeof kv[n])throw new Error("Bad segment: "+n);{const t={key:n,data:o};e.push(t),r+=a,s=i[r],"M"===n&&(n="L"),"m"===n&&(n="l")}}return e}function Iv(t){let e=0,i=0,n=0,r=0;const s=[];for(const{key:a,data:o}of t)switch(a){case"M":s.push({key:"M",data:[...o]}),[e,i]=o,[n,r]=o;break;case"m":e+=o[0],i+=o[1],s.push({key:"M",data:[e,i]}),n=e,r=i;break;case"L":s.push({key:"L",data:[...o]}),[e,i]=o;break;case"l":e+=o[0],i+=o[1],s.push({key:"L",data:[e,i]});break;case"C":s.push({key:"C",data:[...o]}),e=o[4],i=o[5];break;case"c":{const t=o.map(((t,n)=>n%2?t+i:t+e));s.push({key:"C",data:t}),e=t[4],i=t[5];break}case"Q":s.push({key:"Q",data:[...o]}),e=o[2],i=o[3];break;case"q":{const t=o.map(((t,n)=>n%2?t+i:t+e));s.push({key:"Q",data:t}),e=t[2],i=t[3];break}case"A":s.push({key:"A",data:[...o]}),e=o[5],i=o[6];break;case"a":e+=o[5],i+=o[6],s.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,i]});break;case"H":s.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],s.push({key:"H",data:[e]});break;case"V":s.push({key:"V",data:[...o]}),i=o[0];break;case"v":i+=o[0],s.push({key:"V",data:[i]});break;case"S":s.push({key:"S",data:[...o]}),e=o[2],i=o[3];break;case"s":{const t=o.map(((t,n)=>n%2?t+i:t+e));s.push({key:"S",data:t}),e=t[2],i=t[3];break}case"T":s.push({key:"T",data:[...o]}),e=o[0],i=o[1];break;case"t":e+=o[0],i+=o[1],s.push({key:"T",data:[e,i]});break;case"Z":case"z":s.push({key:"Z",data:[]}),e=n,i=r}return s}function Dv(t){const e=[];let i="",n=0,r=0,s=0,a=0,o=0,l=0;for(const{key:h,data:c}of t){switch(h){case"M":e.push({key:"M",data:[...c]}),[n,r]=c,[s,a]=c;break;case"C":e.push({key:"C",data:[...c]}),n=c[4],r=c[5],o=c[2],l=c[3];break;case"L":e.push({key:"L",data:[...c]}),[n,r]=c;break;case"H":n=c[0],e.push({key:"L",data:[n,r]});break;case"V":r=c[0],e.push({key:"L",data:[n,r]});break;case"S":{let t=0,s=0;"C"===i||"S"===i?(t=n+(n-o),s=r+(r-l)):(t=n,s=r),e.push({key:"C",data:[t,s,...c]}),o=c[0],l=c[1],n=c[2],r=c[3];break}case"T":{const[t,s]=c;let a=0,h=0;"Q"===i||"T"===i?(a=n+(n-o),h=r+(r-l)):(a=n,h=r);const u=n+2*(a-n)/3,d=r+2*(h-r)/3,p=t+2*(a-t)/3,f=s+2*(h-s)/3;e.push({key:"C",data:[u,d,p,f,t,s]}),o=a,l=h,n=t,r=s;break}case"Q":{const[t,i,s,a]=c,h=n+2*(t-n)/3,u=r+2*(i-r)/3,d=s+2*(t-s)/3,p=a+2*(i-a)/3;e.push({key:"C",data:[h,u,d,p,s,a]}),o=t,l=i,n=s,r=a;break}case"A":{const t=Math.abs(c[0]),i=Math.abs(c[1]),s=c[2],a=c[3],o=c[4],l=c[5],h=c[6];0===t||0===i?(e.push({key:"C",data:[n,r,l,h,l,h]}),n=l,r=h):n===l&&r===h||(Uv(n,r,l,h,t,i,s,a,o).forEach((function(t){e.push({key:"C",data:t})})),n=l,r=h);break}case"Z":e.push({key:"Z",data:[]}),n=s,r=a}i=h}return e}function jv(t,e,i){return[t*Math.cos(i)-e*Math.sin(i),t*Math.sin(i)+e*Math.cos(i)]}function Uv(t,e,i,n,r,s,a,o,l,h){const c=(u=a,Math.PI*u/180);var u;let d=[],p=0,f=0,g=0,v=0;if(h)[p,f,g,v]=h;else{[t,e]=jv(t,e,-c),[i,n]=jv(i,n,-c);const a=(t-i)/2,h=(e-n)/2;let u=a*a/(r*r)+h*h/(s*s);u>1&&(u=Math.sqrt(u),r*=u,s*=u);const d=r*r,m=s*s,y=d*m-d*h*h-m*a*a,b=d*h*h+m*a*a,x=(o===l?-1:1)*Math.sqrt(Math.abs(y/b));g=x*r*h/s+(t+i)/2,v=x*-s*a/r+(e+n)/2,p=Math.asin(parseFloat(((e-v)/s).toFixed(9))),f=Math.asin(parseFloat(((n-v)/s).toFixed(9))),t<g&&(p=Math.PI-p),i<g&&(f=Math.PI-f),p<0&&(p=2*Math.PI+p),f<0&&(f=2*Math.PI+f),l&&p>f&&(p-=2*Math.PI),!l&&f>p&&(f-=2*Math.PI)}let m=f-p;if(Math.abs(m)>120*Math.PI/180){const t=f,e=i,o=n;f=l&&f>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,d=Uv(i=g+r*Math.cos(f),n=v+s*Math.sin(f),e,o,r,s,a,0,l,[f,t,g,v])}m=f-p;const y=Math.cos(p),b=Math.sin(p),x=Math.cos(f),w=Math.sin(f),S=Math.tan(m/4),A=4/3*r*S,T=4/3*s*S,C=[t,e],_=[t+A*b,e-T*y],B=[i+A*w,n-T*x],P=[i,n];if(_[0]=2*C[0]-_[0],_[1]=2*C[1]-_[1],h)return[_,B,P].concat(d);{d=[_,B,P].concat(d);const t=[];for(let e=0;e<d.length;e+=3){const i=jv(d[e][0],d[e][1],c),n=jv(d[e+1][0],d[e+1][1],c),r=jv(d[e+2][0],d[e+2][1],c);t.push([i[0],i[1],n[0],n[1],r[0],r[1]])}return t}}const Wv={randOffset:function(t,e){return qv(t,e)},randOffsetWithRange:function(t,e,i){return $v(t,e,i)},ellipse:function(t,e,i,n,r){return zv(t,e,r,Fv(i,n,r)).opset},doubleLineOps:function(t,e,i,n,r){return Kv(t,e,i,n,r,!0)}};function Nv(t,e,i,n,r){return{type:"path",ops:Kv(t,e,i,n,r)}}function Gv(t,e,i){const n=(t||[]).length;if(n>2){const r=[];for(let e=0;e<n-1;e++)r.push(...Kv(t[e][0],t[e][1],t[e+1][0],t[e+1][1],i));return e&&r.push(...Kv(t[n-1][0],t[n-1][1],t[0][0],t[0][1],i)),{type:"path",ops:r}}return 2===n?Nv(t[0][0],t[0][1],t[1][0],t[1][1],i):{type:"path",ops:[]}}function Fv(t,e,i){const n=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),r=Math.ceil(Math.max(i.curveStepCount,i.curveStepCount/Math.sqrt(200)*n)),s=2*Math.PI/r;let a=Math.abs(t/2),o=Math.abs(e/2);const l=1-i.curveFitting;return a+=qv(a*l,i),o+=qv(o*l,i),{increment:s,rx:a,ry:o}}function zv(t,e,i,n){const[r,s]=tm(n.increment,t,e,n.rx,n.ry,1,n.increment*$v(.1,$v(.4,1,i),i),i);let a=Qv(r,null,i);if(!i.disableMultiStroke&&0!==i.roughness){const[r]=tm(n.increment,t,e,n.rx,n.ry,1.5,0,i),s=Qv(r,null,i);a=a.concat(s)}return{estimatedPoints:s,opset:{type:"path",ops:a}}}function Hv(t,e,i,n,r,s,a,o,l){const h=t,c=e;let u=Math.abs(i/2),d=Math.abs(n/2);u+=qv(.01*u,l),d+=qv(.01*d,l);let p=r,f=s;for(;p<0;)p+=2*Math.PI,f+=2*Math.PI;f-p>2*Math.PI&&(p=0,f=2*Math.PI);const g=2*Math.PI/l.curveStepCount,v=Math.min(g/2,(f-p)/2),m=em(v,h,c,u,d,p,f,1,l);if(!l.disableMultiStroke){const t=em(v,h,c,u,d,p,f,1.5,l);m.push(...t)}return a&&(o?m.push(...Kv(h,c,h+u*Math.cos(p),c+d*Math.sin(p),l),...Kv(h,c,h+u*Math.cos(f),c+d*Math.sin(f),l)):m.push({op:"lineTo",data:[h,c]},{op:"lineTo",data:[h+u*Math.cos(p),c+d*Math.sin(p)]})),{type:"path",ops:m}}function Vv(t,e){const i=[];for(const n of t)if(n.length){const t=e.maxRandomnessOffset||0,r=n.length;if(r>2){i.push({op:"move",data:[n[0][0]+qv(t,e),n[0][1]+qv(t,e)]});for(let s=1;s<r;s++)i.push({op:"lineTo",data:[n[s][0]+qv(t,e),n[s][1]+qv(t,e)]})}}return{type:"fillPath",ops:i}}function Yv(t,e){return function(t,e){let i=t.fillStyle||"hachure";if(!Mv[i])switch(i){case"zigzag":Mv[i]||(Mv[i]=new Cv(e));break;case"cross-hatch":Mv[i]||(Mv[i]=new _v(e));break;case"dots":Mv[i]||(Mv[i]=new Bv(e));break;case"dashed":Mv[i]||(Mv[i]=new Pv(e));break;case"zigzag-line":Mv[i]||(Mv[i]=new Rv(e));break;default:i="hachure",Mv[i]||(Mv[i]=new Tv(e))}return Mv[i]}(e,Wv).fillPolygons(t,e)}function Xv(t){return t.randomizer||(t.randomizer=new Ev(t.seed||0)),t.randomizer.next()}function $v(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return i.roughness*n*(Xv(i)*(e-t)+t)}function qv(t,e){return $v(-t,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function Kv(t,e,i,n,r){const s=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?r.disableMultiStrokeFill:r.disableMultiStroke,a=Zv(t,e,i,n,r,!0,!1);if(s)return a;const o=Zv(t,e,i,n,r,!0,!0);return a.concat(o)}function Zv(t,e,i,n,r,s,a){const o=Math.pow(t-i,2)+Math.pow(e-n,2),l=Math.sqrt(o);let h=1;h=l<200?1:l>500?.4:-.0016668*l+1.233334;let c=r.maxRandomnessOffset||0;c*c*100>o&&(c=l/10);const u=c/2,d=.2+.2*Xv(r);let p=r.bowing*r.maxRandomnessOffset*(n-e)/200,f=r.bowing*r.maxRandomnessOffset*(t-i)/200;p=qv(p,r,h),f=qv(f,r,h);const g=[],v=()=>qv(u,r,h),m=()=>qv(c,r,h),y=r.preserveVertices;return s&&(a?g.push({op:"move",data:[t+(y?0:v()),e+(y?0:v())]}):g.push({op:"move",data:[t+(y?0:qv(c,r,h)),e+(y?0:qv(c,r,h))]})),a?g.push({op:"bcurveTo",data:[p+t+(i-t)*d+v(),f+e+(n-e)*d+v(),p+t+2*(i-t)*d+v(),f+e+2*(n-e)*d+v(),i+(y?0:v()),n+(y?0:v())]}):g.push({op:"bcurveTo",data:[p+t+(i-t)*d+m(),f+e+(n-e)*d+m(),p+t+2*(i-t)*d+m(),f+e+2*(n-e)*d+m(),i+(y?0:m()),n+(y?0:m())]}),g}function Jv(t,e,i){const n=[];n.push([t[0][0]+qv(e,i),t[0][1]+qv(e,i)]),n.push([t[0][0]+qv(e,i),t[0][1]+qv(e,i)]);for(let r=1;r<t.length;r++)n.push([t[r][0]+qv(e,i),t[r][1]+qv(e,i)]),r===t.length-1&&n.push([t[r][0]+qv(e,i),t[r][1]+qv(e,i)]);return Qv(n,null,i)}function Qv(t,e,i){const n=t.length,r=[];if(n>3){const s=[],a=1-i.curveTightness;r.push({op:"move",data:[t[1][0],t[1][1]]});for(let e=1;e+2<n;e++){const i=t[e];s[0]=[i[0],i[1]],s[1]=[i[0]+(a*t[e+1][0]-a*t[e-1][0])/6,i[1]+(a*t[e+1][1]-a*t[e-1][1])/6],s[2]=[t[e+1][0]+(a*t[e][0]-a*t[e+2][0])/6,t[e+1][1]+(a*t[e][1]-a*t[e+2][1])/6],s[3]=[t[e+1][0],t[e+1][1]],r.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}if(e&&2===e.length){const t=i.maxRandomnessOffset;r.push({op:"lineTo",data:[e[0]+qv(t,i),e[1]+qv(t,i)]})}}else 3===n?(r.push({op:"move",data:[t[1][0],t[1][1]]}),r.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):2===n&&r.push(...Kv(t[0][0],t[0][1],t[1][0],t[1][1],i));return r}function tm(t,e,i,n,r,s,a,o){const l=[],h=[];if(0===o.roughness){t/=4,h.push([e+n*Math.cos(-t),i+r*Math.sin(-t)]);for(let s=0;s<=2*Math.PI;s+=t){const t=[e+n*Math.cos(s),i+r*Math.sin(s)];l.push(t),h.push(t)}h.push([e+n*Math.cos(0),i+r*Math.sin(0)]),h.push([e+n*Math.cos(t),i+r*Math.sin(t)])}else{const c=qv(.5,o)-Math.PI/2;h.push([qv(s,o)+e+.9*n*Math.cos(c-t),qv(s,o)+i+.9*r*Math.sin(c-t)]);const u=2*Math.PI+c-.01;for(let a=c;a<u;a+=t){const t=[qv(s,o)+e+n*Math.cos(a),qv(s,o)+i+r*Math.sin(a)];l.push(t),h.push(t)}h.push([qv(s,o)+e+n*Math.cos(c+2*Math.PI+.5*a),qv(s,o)+i+r*Math.sin(c+2*Math.PI+.5*a)]),h.push([qv(s,o)+e+.98*n*Math.cos(c+a),qv(s,o)+i+.98*r*Math.sin(c+a)]),h.push([qv(s,o)+e+.9*n*Math.cos(c+.5*a),qv(s,o)+i+.9*r*Math.sin(c+.5*a)])}return[h,l]}function em(t,e,i,n,r,s,a,o,l){const h=s+qv(.1,l),c=[];c.push([qv(o,l)+e+.9*n*Math.cos(h-t),qv(o,l)+i+.9*r*Math.sin(h-t)]);for(let s=h;s<=a;s+=t)c.push([qv(o,l)+e+n*Math.cos(s),qv(o,l)+i+r*Math.sin(s)]);return c.push([e+n*Math.cos(a),i+r*Math.sin(a)]),c.push([e+n*Math.cos(a),i+r*Math.sin(a)]),Qv(c,null,l)}function im(t,e,i,n,r,s,a,o){const l=[],h=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3];let c=[0,0];const u=o.disableMultiStroke?1:2,d=o.preserveVertices;for(let p=0;p<u;p++)0===p?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(d?0:qv(h[0],o)),a[1]+(d?0:qv(h[0],o))]}),c=d?[r,s]:[r+qv(h[p],o),s+qv(h[p],o)],l.push({op:"bcurveTo",data:[t+qv(h[p],o),e+qv(h[p],o),i+qv(h[p],o),n+qv(h[p],o),c[0],c[1]]});return l}function nm(t){return[...t]}function rm(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function sm(t,e,i){const n=rm(e,i);if(0===n)return rm(t,e);let r=((t[0]-e[0])*(i[0]-e[0])+(t[1]-e[1])*(i[1]-e[1]))/n;return r=Math.max(0,Math.min(1,r)),rm(t,am(e,i,r))}function am(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i]}function om(t,e,i,n){const r=n||[];if(function(t,e){const i=t[e+0],n=t[e+1],r=t[e+2],s=t[e+3];let a=3*n[0]-2*i[0]-s[0];a*=a;let o=3*n[1]-2*i[1]-s[1];o*=o;let l=3*r[0]-2*s[0]-i[0];l*=l;let h=3*r[1]-2*s[1]-i[1];return h*=h,a<l&&(a=l),o<h&&(o=h),a+o}(t,e)<i){const i=t[e+0];r.length?(s=r[r.length-1],a=i,Math.sqrt(rm(s,a))>1&&r.push(i)):r.push(i),r.push(t[e+3])}else{const n=.5,s=t[e+0],a=t[e+1],o=t[e+2],l=t[e+3],h=am(s,a,n),c=am(a,o,n),u=am(o,l,n),d=am(h,c,n),p=am(c,u,n),f=am(d,p,n);om([s,h,d,f],0,i,r),om([f,p,u,l],0,i,r)}var s,a;return r}function lm(t,e){return hm(t,0,t.length,e)}function hm(t,e,i,n,r){const s=r||[],a=t[e],o=t[i-1];let l=0,h=1;for(let n=e+1;n<i-1;++n){const e=sm(t[n],a,o);e>l&&(l=e,h=n)}return Math.sqrt(l)>n?(hm(t,e,h+1,n,s),hm(t,h,i,n,s)):(s.length||s.push(a),s.push(o)),s}function cm(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15,i=arguments.length>2?arguments[2]:void 0;const n=[],r=(t.length-1)/3;for(let i=0;i<r;i++)om(t,3*i,e,n);return i&&i>0?hm(n,0,n.length,i):n}const um="none";class dm{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,e,i){return{shape:t,sets:e||[],options:i||this.defaultOptions}}line(t,e,i,n,r){const s=this._o(r);return this._d("line",[Nv(t,e,i,n,s)],s)}rectangle(t,e,i,n,r){const s=this._o(r),a=[],o=function(t,e,i,n,r){return function(t,e){return Gv(t,!0,e)}([[t,e],[t+i,e],[t+i,e+n],[t,e+n]],r)}(t,e,i,n,s);if(s.fill){const r=[[t,e],[t+i,e],[t+i,e+n],[t,e+n]];"solid"===s.fillStyle?a.push(Vv([r],s)):a.push(Yv([r],s))}return s.stroke!==um&&a.push(o),this._d("rectangle",a,s)}ellipse(t,e,i,n,r){const s=this._o(r),a=[],o=Fv(i,n,s),l=zv(t,e,s,o);if(s.fill)if("solid"===s.fillStyle){const i=zv(t,e,s,o).opset;i.type="fillPath",a.push(i)}else a.push(Yv([l.estimatedPoints],s));return s.stroke!==um&&a.push(l.opset),this._d("ellipse",a,s)}circle(t,e,i,n){const r=this.ellipse(t,e,i,i,n);return r.shape="circle",r}linearPath(t,e){const i=this._o(e);return this._d("linearPath",[Gv(t,!1,i)],i)}arc(t,e,i,n,r,s){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0;const l=this._o(o),h=[],c=Hv(t,e,i,n,r,s,a,!0,l);if(a&&l.fill)if("solid"===l.fillStyle){const a=Object.assign({},l);a.disableMultiStroke=!0;const o=Hv(t,e,i,n,r,s,!0,!1,a);o.type="fillPath",h.push(o)}else h.push(function(t,e,i,n,r,s,a){const o=t,l=e;let h=Math.abs(i/2),c=Math.abs(n/2);h+=qv(.01*h,a),c+=qv(.01*c,a);let u=r,d=s;for(;u<0;)u+=2*Math.PI,d+=2*Math.PI;d-u>2*Math.PI&&(u=0,d=2*Math.PI);const p=(d-u)/a.curveStepCount,f=[];for(let t=u;t<=d;t+=p)f.push([o+h*Math.cos(t),l+c*Math.sin(t)]);return f.push([o+h*Math.cos(d),l+c*Math.sin(d)]),f.push([o,l]),Yv([f],a)}(t,e,i,n,r,s,l));return l.stroke!==um&&h.push(c),this._d("arc",h,l)}curve(t,e){const i=this._o(e),n=[],r=function(t,e){let i=Jv(t,1*(1+.2*e.roughness),e);if(!e.disableMultiStroke){const n=Jv(t,1.5*(1+.22*e.roughness),function(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}(e));i=i.concat(n)}return{type:"path",ops:i}}(t,i);if(i.fill&&i.fill!==um&&t.length>=3){const e=cm(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=t.length;if(i<3)throw new Error("A curve must have at least three points.");const n=[];if(3===i)n.push(nm(t[0]),nm(t[1]),nm(t[2]),nm(t[2]));else{const i=[];i.push(t[0],t[0]);for(let e=1;e<t.length;e++)i.push(t[e]),e===t.length-1&&i.push(t[e]);const r=[],s=1-e;n.push(nm(i[0]));for(let t=1;t+2<i.length;t++){const e=i[t];r[0]=[e[0],e[1]],r[1]=[e[0]+(s*i[t+1][0]-s*i[t-1][0])/6,e[1]+(s*i[t+1][1]-s*i[t-1][1])/6],r[2]=[i[t+1][0]+(s*i[t][0]-s*i[t+2][0])/6,i[t+1][1]+(s*i[t][1]-s*i[t+2][1])/6],r[3]=[i[t+1][0],i[t+1][1]],n.push(r[1],r[2],r[3])}}return n}(t),10,(1+i.roughness)/2);"solid"===i.fillStyle?n.push(Vv([e],i)):n.push(Yv([e],i))}return i.stroke!==um&&n.push(r),this._d("curve",n,i)}polygon(t,e){const i=this._o(e),n=[],r=Gv(t,!0,i);return i.fill&&("solid"===i.fillStyle?n.push(Vv([t],i)):n.push(Yv([t],i))),i.stroke!==um&&n.push(r),this._d("polygon",n,i)}path(t,e){const i=this._o(e),n=[];if(!t)return this._d("path",n,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const r=i.fill&&"transparent"!==i.fill&&i.fill!==um,s=i.stroke!==um,a=!!(i.simplification&&i.simplification<1),o=function(t,e,i){const n=Dv(Iv(Lv(t))),r=[];let s=[],a=[0,0],o=[];const l=()=>{o.length>=4&&s.push(...cm(o,1)),o=[]},h=()=>{l(),s.length&&(r.push(s),s=[])};for(const{key:t,data:e}of n)switch(t){case"M":h(),a=[e[0],e[1]],s.push(a);break;case"L":l(),s.push([e[0],e[1]]);break;case"C":if(!o.length){const t=s.length?s[s.length-1]:a;o.push([t[0],t[1]])}o.push([e[0],e[1]]),o.push([e[2],e[3]]),o.push([e[4],e[5]]);break;case"Z":l(),s.push([a[0],a[1]])}if(h(),!i)return r;const c=[];for(const t of r){const e=lm(t,i);e.length&&c.push(e)}return c}(t,0,a?4-4*i.simplification:(1+i.roughness)/2);return r&&("solid"===i.fillStyle?n.push(Vv(o,i)):n.push(Yv(o,i))),s&&(a?o.forEach((t=>{n.push(Gv(t,!1,i))})):n.push(function(t,e){const i=Dv(Iv(Lv(t))),n=[];let r=[0,0],s=[0,0];for(const{key:t,data:a}of i)switch(t){case"M":{const t=1*(e.maxRandomnessOffset||0),i=e.preserveVertices;n.push({op:"move",data:a.map((n=>n+(i?0:qv(t,e))))}),s=[a[0],a[1]],r=[a[0],a[1]];break}case"L":n.push(...Kv(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[t,i,r,o,l,h]=a;n.push(...im(t,i,r,o,l,h,s,e)),s=[l,h];break}case"Z":n.push(...Kv(s[0],s[1],r[0],r[1],e)),s=[r[0],r[1]]}return{type:"path",ops:n}}(t,i))),this._d("path",n,i)}opsToPath(t,e){let i="";for(const n of t.ops){const t="number"==typeof e&&e>=0?n.data.map((t=>+t.toFixed(e))):n.data;switch(n.op){case"move":i+=`M${t[0]} ${t[1]} `;break;case"bcurveTo":i+=`C${t[0]} ${t[1]}, ${t[2]} ${t[3]}, ${t[4]} ${t[5]} `;break;case"lineTo":i+=`L${t[0]} ${t[1]} `}}return i.trim()}toPaths(t){const e=t.sets||[],i=t.options||this.defaultOptions,n=[];for(const t of e){let e=null;switch(t.type){case"path":e={d:this.opsToPath(t),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:um};break;case"fillPath":e={d:this.opsToPath(t),stroke:um,strokeWidth:0,fill:i.fill||um};break;case"fillSketch":e=this.fillSketch(t,i)}e&&n.push(e)}return n}fillSketch(t,e){let i=e.fillWeight;return i<0&&(i=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||um,strokeWidth:i,fill:um}}}class pm{constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new dm(e)}draw(t){const e=t.sets||[],i=t.options||this.getDefaultOptions(),n=this.ctx,r=t.options.fixedDecimalPlaceDigits;for(const s of e)switch(s.type){case"path":n.save(),n.strokeStyle="none"===i.stroke?"transparent":i.stroke,n.lineWidth=i.strokeWidth,i.strokeLineDash&&n.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(n.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(n,s,r),n.restore();break;case"fillPath":{n.save(),n.fillStyle=i.fill||"";const e="curve"===t.shape||"polygon"===t.shape||"path"===t.shape?"evenodd":"nonzero";this._drawToContext(n,s,r,e),n.restore();break}case"fillSketch":this.fillSketch(n,s,i)}}fillSketch(t,e,i){let n=i.fillWeight;n<0&&(n=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=n,this._drawToContext(t,e,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"nonzero";t.beginPath();for(const n of e.ops){const e="number"==typeof i&&i>=0?n.data.map((t=>+t.toFixed(i))):n.data;switch(n.op){case"move":t.moveTo(e[0],e[1]);break;case"bcurveTo":t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]);break;case"lineTo":t.lineTo(e[0],e[1])}}"fillPath"===e.type?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,e,i,n,r){const s=this.gen.line(t,e,i,n,r);return this.draw(s),s}rectangle(t,e,i,n,r){const s=this.gen.rectangle(t,e,i,n,r);return this.draw(s),s}ellipse(t,e,i,n,r){const s=this.gen.ellipse(t,e,i,n,r);return this.draw(s),s}circle(t,e,i,n){const r=this.gen.circle(t,e,i,n);return this.draw(r),r}linearPath(t,e){const i=this.gen.linearPath(t,e);return this.draw(i),i}polygon(t,e){const i=this.gen.polygon(t,e);return this.draw(i),i}arc(t,e,i,n,r,s){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0;const l=this.gen.arc(t,e,i,n,r,s,a,o);return this.draw(l),l}curve(t,e){const i=this.gen.curve(t,e);return this.draw(i),i}path(t,e){const i=this.gen.path(t,e);return this.draw(i),i}}var fm=(t,e)=>new pm(t,e);const gm={maxRandomnessOffset:3,roughness:1,bowing:1,curveFitting:.95,curveTightness:void 0,curveStepCount:9,fillStyle:"hachure",fillWeight:void 0,hachureAngle:60,hachureGap:6,simplification:0,dashOffset:void 0,dashGap:void 0,zigzagOffset:void 0,seed:1,fillLineDash:void 0,fillLineDashOffset:void 0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!0,fixedDecimalPlaceDigits:void 0};class vm{drawShape(t,e,i,n,r,s,a,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,i,n,r,s,a,o)}}var mm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bm=function(t,e){return function(i,n){e(i,n,t)}};let xm=class extends vm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="arc",this.numberType=no}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=fm(s);r.highPerformanceSave();const o=t.getGraphicTheme();let{x:l=o.x,y:h=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=o.dx,dy:i=o.dy}=t.attribute;l+=e,h+=i,r.setTransformForCurrent()}else l=0,h=0,r.transformFromMatrix(t.transMatrix,!0);const c=new Wi,{fill:u=o.fill,stroke:d=o.stroke,lineWidth:p=o.lineWidth,outerRadius:f=o.outerRadius,innerRadius:g=o.innerRadius,maxRandomnessOffset:v=gm.maxRandomnessOffset,roughness:m=gm.roughness,bowing:y=gm.bowing,curveFitting:b=gm.curveFitting,curveTightness:x=gm.curveTightness,curveStepCount:w=gm.curveStepCount,fillStyle:S=gm.fillStyle,fillWeight:A=gm.fillWeight,hachureAngle:T=gm.hachureAngle,hachureGap:C=gm.hachureGap,simplification:_=gm.simplification,dashOffset:B=gm.dashOffset,dashGap:P=gm.dashGap,zigzagOffset:R=gm.zigzagOffset,seed:M=gm.seed,fillLineDash:E=gm.fillLineDash,fillLineDashOffset:k=gm.fillLineDashOffset,disableMultiStroke:O=gm.disableMultiStroke,disableMultiStrokeFill:L=gm.disableMultiStrokeFill,preserveVertices:I=gm.preserveVertices,fixedDecimalPlaceDigits:D=gm.fixedDecimalPlaceDigits}=t.attribute;Ko(t,c,l,h,f,g),a.path(c.toString(),{fill:u||void 0,stroke:d||void 0,strokeWidth:p,maxRandomnessOffset:v,roughness:m,bowing:y,curveFitting:b,curveTightness:x,curveStepCount:w,fillStyle:S,fillWeight:A,hachureAngle:T,hachureGap:C,simplification:_,dashOffset:B,dashGap:P,zigzagOffset:R,seed:M,fillLineDash:E,fillLineDashOffset:k,disableMultiStroke:O,disableMultiStrokeFill:L,preserveVertices:I,fixedDecimalPlaceDigits:D}),r.highPerformanceRestore()}};xm=mm([g(),bm(0,p(t.DefaultCanvasArcRender)),ym("design:paramtypes",[Object])],xm);var wm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Sm=class extends t.DefaultCanvasAreaRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,f){if(f)return super.drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,f);t.highPerformanceSave();const g=t.canvas.nativeCanvas,v=fm(g,{}),m=new Wi;Oh(m,e,l,{offsetX:h,offsetY:c});const{maxRandomnessOffset:y=gm.maxRandomnessOffset,roughness:b=gm.roughness,bowing:x=gm.bowing,curveFitting:w=gm.curveFitting,curveTightness:S=gm.curveTightness,curveStepCount:A=gm.curveStepCount,fillStyle:T=gm.fillStyle,fillWeight:C=gm.fillWeight,hachureAngle:_=gm.hachureAngle,hachureGap:B=gm.hachureGap,simplification:P=gm.simplification,dashOffset:R=gm.dashOffset,dashGap:M=gm.dashGap,zigzagOffset:E=gm.zigzagOffset,seed:k=gm.seed,fillLineDash:O=gm.fillLineDash,fillLineDashOffset:L=gm.fillLineDashOffset,disableMultiStroke:I=gm.disableMultiStroke,disableMultiStrokeFill:D=gm.disableMultiStrokeFill,preserveVertices:j=gm.preserveVertices,fixedDecimalPlaceDigits:U=gm.fixedDecimalPlaceDigits}=a;let{fill:W,stroke:N,lineWidth:G}=a;return Array.isArray(o)?o.forEach((t=>{W=null!=W?W:t.fill,N=null!=N?N:t.stroke,G=null!=G?G:t.lineWidth})):(W=null!=W?W:o.fill,N=null!=N?N:o.stroke,G=null!=G?G:o.lineWidth),v.path(m.toString(),{fill:i?W:void 0,strokeWidth:G,maxRandomnessOffset:y,roughness:b,bowing:x,curveFitting:w,curveTightness:S,curveStepCount:A,fillStyle:T,fillWeight:C,hachureAngle:_,hachureGap:B,simplification:P,dashOffset:R,dashGap:M,zigzagOffset:E,seed:k,fillLineDash:O,fillLineDashOffset:L,disableMultiStroke:I,disableMultiStrokeFill:D,preserveVertices:j,fixedDecimalPlaceDigits:U}),t.highPerformanceRestore(),!1}};Sm=wm([g()],Sm);var Am=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,n){e(i,n,t)}};let _m=class extends vm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="circle",this.numberType=ao}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=fm(s,{}),o=t.getGraphicTheme();let{x:l=o.x,y:h=o.y}=t.attribute;t.transMatrix.onlyTranslate()?r.onlyTranslate()||r.clearMatrix():(l=0,h=0,r.transformFromMatrix(t.transMatrix,!0));const{radius:c=o.radius,fill:u=o.fill,stroke:d=o.stroke,lineWidth:p=o.lineWidth}=t.attribute;a.circle(l,h,c,{fill:u||void 0,stroke:d||void 0,strokeWidth:p,fillStyle:"zigzag",roughness:.5})}};_m=Am([g(),Cm(0,p(t.DefaultCanvasCircleRender)),Tm("design:paramtypes",[Object])],_m);var Bm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Pm=class extends t.DefaultCanvasLineRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,f){if(p||f)return super.drawSegmentItem(t,e,i,n,r,s,a,o,l,h,c,u,d,p,f);t.highPerformanceSave();const g=t.canvas.nativeCanvas,v=fm(g,{}),m=new Wi;Rh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u});const{maxRandomnessOffset:y=gm.maxRandomnessOffset,roughness:b=gm.roughness,bowing:x=gm.bowing,curveFitting:w=gm.curveFitting,curveTightness:S=gm.curveTightness,curveStepCount:A=gm.curveStepCount,fillStyle:T=gm.fillStyle,fillWeight:C=gm.fillWeight,hachureAngle:_=gm.hachureAngle,hachureGap:B=gm.hachureGap,simplification:P=gm.simplification,dashOffset:R=gm.dashOffset,dashGap:M=gm.dashGap,zigzagOffset:E=gm.zigzagOffset,seed:k=gm.seed,fillLineDash:O=gm.fillLineDash,fillLineDashOffset:L=gm.fillLineDashOffset,disableMultiStroke:I=gm.disableMultiStroke,disableMultiStrokeFill:D=gm.disableMultiStrokeFill,preserveVertices:j=gm.preserveVertices,fixedDecimalPlaceDigits:U=gm.fixedDecimalPlaceDigits}=a;let{fill:W,stroke:N,lineWidth:G}=a;return Array.isArray(o)?o.forEach((t=>{W=null!=W?W:t.fill,N=null!=N?N:t.stroke,G=null!=G?G:t.lineWidth})):(W=null!=W?W:o.fill,N=null!=N?N:o.stroke,G=null!=G?G:o.lineWidth),v.path(m.toString(),{fill:i?W:void 0,stroke:n?N:void 0,strokeWidth:G,maxRandomnessOffset:y,roughness:b,bowing:x,curveFitting:w,curveTightness:S,curveStepCount:A,fillStyle:T,fillWeight:C,hachureAngle:_,hachureGap:B,simplification:P,dashOffset:R,dashGap:M,zigzagOffset:E,seed:k,fillLineDash:O,fillLineDashOffset:L,disableMultiStroke:I,disableMultiStrokeFill:D,preserveVertices:j,fixedDecimalPlaceDigits:U}),t.highPerformanceRestore(),!1}};Pm=Bm([g()],Pm);var Rm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Mm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,n){e(i,n,t)}};let km=class extends vm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="path",this.numberType=uo}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=fm(s,{});r.highPerformanceSave();const o=t.getGraphicTheme();r.transformFromMatrix(t.transMatrix,!0);const{fill:l=o.fill,stroke:h=o.stroke,lineWidth:c=o.lineWidth,path:u=o.path,maxRandomnessOffset:d=gm.maxRandomnessOffset,roughness:p=gm.roughness,bowing:f=gm.bowing,curveFitting:g=gm.curveFitting,curveTightness:v=gm.curveTightness,curveStepCount:m=gm.curveStepCount,fillStyle:y=gm.fillStyle,fillWeight:b=gm.fillWeight,hachureAngle:x=gm.hachureAngle,hachureGap:w=gm.hachureGap,simplification:S=gm.simplification,dashOffset:A=gm.dashOffset,dashGap:T=gm.dashGap,zigzagOffset:C=gm.zigzagOffset,seed:_=gm.seed,fillLineDash:B=gm.fillLineDash,fillLineDashOffset:P=gm.fillLineDashOffset,disableMultiStroke:R=gm.disableMultiStroke,disableMultiStrokeFill:M=gm.disableMultiStrokeFill,preserveVertices:E=gm.preserveVertices,fixedDecimalPlaceDigits:k=gm.fixedDecimalPlaceDigits}=t.attribute;"string"==typeof u&&a.path(u,{fill:l||void 0,stroke:h||void 0,strokeWidth:c,maxRandomnessOffset:d,roughness:p,bowing:f,curveFitting:g,curveTightness:v,curveStepCount:m,fillStyle:y,fillWeight:b,hachureAngle:x,hachureGap:w,simplification:S,dashOffset:A,dashGap:T,zigzagOffset:C,seed:_,fillLineDash:B,fillLineDashOffset:P,disableMultiStroke:R,disableMultiStrokeFill:M,preserveVertices:E,fixedDecimalPlaceDigits:k}),r.highPerformanceRestore()}};km=Rm([g(),Em(0,p(t.DefaultCanvasPathRender)),Mm("design:paramtypes",[Object])],km);var Om=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,n){e(i,n,t)}};let Dm=class extends vm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="rect",this.numberType=go}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=fm(s);r.highPerformanceSave();const o=t.getGraphicTheme();let{x:l=o.x,y:h=o.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const{dx:e=o.dx,dy:i=o.dy}=t.attribute;l+=e,h+=i,r.setTransformForCurrent()}else l=0,h=0,r.transformFromMatrix(t.transMatrix,!0);const{fill:c=o.fill,stroke:u=o.stroke,fillColor:d=o.fill,strokeColor:p=o.stroke,x1:f,y1:g,lineWidth:v=o.lineWidth,maxRandomnessOffset:m=gm.maxRandomnessOffset,roughness:y=gm.roughness,bowing:b=gm.bowing,curveFitting:x=gm.curveFitting,curveTightness:w=gm.curveTightness,curveStepCount:S=gm.curveStepCount,fillStyle:A=gm.fillStyle,fillWeight:T=gm.fillWeight,hachureAngle:C=gm.hachureAngle,hachureGap:_=gm.hachureGap,simplification:B=gm.simplification,dashOffset:P=gm.dashOffset,dashGap:R=gm.dashGap,zigzagOffset:M=gm.zigzagOffset,seed:E=gm.seed,fillLineDash:k=gm.fillLineDash,fillLineDashOffset:O=gm.fillLineDashOffset,disableMultiStroke:L=gm.disableMultiStroke,disableMultiStrokeFill:I=gm.disableMultiStrokeFill,preserveVertices:D=gm.preserveVertices,fixedDecimalPlaceDigits:j=gm.fixedDecimalPlaceDigits}=t.attribute;let{width:U=o.width,height:W=o.height}=t.attribute;U=(null!=U?U:f-l)||0,W=(null!=W?W:g-h)||0,a.rectangle(l,h,U,W,{fill:c?d:void 0,stroke:u?p:void 0,strokeWidth:v,maxRandomnessOffset:m,roughness:y,bowing:b,curveFitting:x,curveTightness:w,curveStepCount:S,fillStyle:A,fillWeight:T,hachureAngle:C,hachureGap:_,simplification:B,dashOffset:P,dashGap:R,zigzagOffset:M,seed:E,fillLineDash:k,fillLineDashOffset:O,disableMultiStroke:L,disableMultiStrokeFill:I,preserveVertices:D,fixedDecimalPlaceDigits:j}),r.highPerformanceRestore()}};Dm=Om([g(),Im(0,p(t.DefaultCanvasRectRender)),Lm("design:paramtypes",[Object])],Dm);var jm=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wm=function(t,e){return function(i,n){e(i,n,t)}};let Nm=class extends Gl{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=yo,this.style="rough"}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=fm(s);r.highPerformanceSave();const o=t.getGraphicTheme(),l=this.transform(t,o,r),{x:h,y:c,z:u,lastModelMatrix:d}=l,p=t.getParsedPath();if(!p)return;const{fill:f=o.fill,stroke:g=o.stroke,fillColor:v=o.fill,strokeColor:m=o.stroke,size:y=o.size,lineWidth:b=o.lineWidth,maxRandomnessOffset:x=gm.maxRandomnessOffset,roughness:w=gm.roughness,bowing:S=gm.bowing,curveFitting:A=gm.curveFitting,curveTightness:T=gm.curveTightness,curveStepCount:C=gm.curveStepCount,fillStyle:_=gm.fillStyle,fillWeight:B=gm.fillWeight,hachureAngle:P=gm.hachureAngle,hachureGap:R=gm.hachureGap,simplification:M=gm.simplification,dashOffset:E=gm.dashOffset,dashGap:k=gm.dashGap,zigzagOffset:O=gm.zigzagOffset,seed:L=gm.seed,fillLineDash:I=gm.fillLineDash,fillLineDashOffset:D=gm.fillLineDashOffset,disableMultiStroke:j=gm.disableMultiStroke,disableMultiStrokeFill:U=gm.disableMultiStrokeFill,preserveVertices:W=gm.preserveVertices,fixedDecimalPlaceDigits:N=gm.fixedDecimalPlaceDigits}=t.attribute;let G="";if(p.drawToSvgPath)G=p.drawToSvgPath(y,h,c);else{const t=new Wi;p.draw(t,y,h,c)&&t.closePath(),G=t.toString()}a.path(G,{fill:f?v:void 0,stroke:g?m:void 0,strokeWidth:b,maxRandomnessOffset:x,roughness:w,bowing:S,curveFitting:A,curveTightness:T,curveStepCount:C,fillStyle:_,fillWeight:B,hachureAngle:P,hachureGap:R,simplification:M,dashOffset:E,dashGap:k,zigzagOffset:O,seed:L,fillLineDash:I,fillLineDashOffset:D,disableMultiStroke:j,disableMultiStrokeFill:U,preserveVertices:W,fixedDecimalPlaceDigits:N}),r.highPerformanceRestore()}drawShape(t,e,i,n,r,s,a,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,i,n,r,s,a,o)}};Nm=jm([g(),Wm(0,p(t.DefaultCanvasSymbolRender)),Um("design:paramtypes",[Object])],Nm);var Gm=new i((t=>{t(_m).toSelf().inSingletonScope(),t(Pc).to(_m),t(Dm).toSelf().inSingletonScope(),t(Pc).to(Dm),t(km).toSelf().inSingletonScope(),t(Pc).to(km),t(Nm).toSelf().inSingletonScope(),t(Pc).to(Nm),t(Pm).toSelf().inSingletonScope(),t(Pc).to(Pm),t(Sm).toSelf().inSingletonScope(),t(Pc).to(Sm),t(xm).toSelf().inSingletonScope(),t(Pc).to(xm)}));const Fm=Symbol.for("MathPickerContribution"),zm=Symbol.for("MathArcPicker"),Hm=Symbol.for("MathAreaPicker"),Vm=Symbol.for("MathCirclePicker"),Ym=Symbol.for("MathImagePicker"),Xm=Symbol.for("MathLinePicker"),$m=Symbol.for("MathPathPicker"),qm=Symbol.for("MathRectPicker"),Km=Symbol.for("MathSymbolPicker"),Zm=Symbol.for("MathTextPicker"),Jm=Symbol.for("MathPolygonPicker"),Qm=Symbol.for("MathGlyphPicker"),ty=Symbol.for("CanvasArcPicker"),ey=Symbol.for("CanvasArc3dPicker"),iy=Symbol.for("CanvasAreaPicker"),ny=Symbol.for("CanvasCirclePicker"),ry=Symbol.for("CanvasImagePicker"),sy=Symbol.for("CanvasLinePicker"),ay=Symbol.for("CanvasPathPicker"),oy=Symbol.for("CanvasRectPicker"),ly=Symbol.for("CanvasRect3dPicker"),hy=Symbol.for("CanvasSymbolPicker"),cy=Symbol.for("CanvasTextPicker"),uy=Symbol.for("CanvasPolygonPicker"),dy=Symbol.for("CanvasPyramid3dPicker"),py=Symbol.for("CanvasRichTextPicker"),fy=Symbol.for("CanvasGlyphPicker"),gy=Symbol.for("CanvasGroupPicker"),vy=Symbol.for("CanvasPickerContribution"),my={onPointerDown:"pointerdown",onPointerUp:"pointerup",onPointerUpOutside:"pointerupoutside",onPointerTap:"pointertap",onPointerOver:"pointerover",onPointerMove:"pointermove",onPointerEnter:"pointerenter",onPointerLeave:"pointerleave",onPointerOut:"pointerout",onMouseDown:"mousedown",onMouseUp:"mouseup",onMouseUpOutside:"mouseupoutside",onMouseMove:"mousemove",onMouseOver:"mouseover",onMouseOut:"mouseout",onMouseEnter:"mouseenter",onMouseLeave:"mouseleave",onPinch:"pinch",onPinchStart:"pinchstart",onPinchEnd:"pinchend",onPan:"pan",onPanStart:"panstart",onPanEnd:"panend",onDrag:"drag",onDragStart:"dragstart",onDragEnter:"dragenter",onDragLeave:"dragleave",onDragOver:"dragover",onDragEnd:"dragend",onRightDown:"rightdown",onRightUp:"rightup",onRightUpOutside:"rightupoutside",onTouchStart:"touchstart",onTouchEnd:"touchend",onTouchEndOutside:"touchendoutside",onTouchMove:"touchmove",onTouchCancel:"touchcancel",onPress:"press",onPressUp:"pressup",onPressEnd:"pressend",onSwipe:"swipe",onDrop:"drop",onWeel:"wheel",onClick:"click",onDblClick:"dblclick"},yy=Object.keys(my);function by(t){return Qh.richtext(t?t.attribute:{})}by.Text=function(t){return Object.assign({type:"rich/text"},t)},by.Image=function(t){return Object.assign({type:"rich/image"},t)};var xy=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(i[n[r]]=t[n[r]])}return i};function wy(t,e){if(st(t))return t.forEach((t=>wy(t,e)));e.push(t)}const Sy=Bo;function Ay(t){if(!t||!t.$$typeof)return t;const e=t.type,{attribute:i,children:n,stateProxy:r,id:s,name:a}=t.props,o=e({attribute:i}),l=function(t,e,i){let n,r=!1;switch(t.type){case"richtext":break;case"rich/text":n=t.attribute||{},i&&(n.text=i),t.attribute=n;break;case"rich/image":n=t.attribute||{};break;default:r=!0}return r?Object.keys(e).forEach((i=>{const n=my[i];n&&t.on(n,e[i])})):"richtext"===t.type&&(t.attribute.textConfig=i.map((t=>Ay(t))).filter((t=>t))),n}(o,t.props,n);return l||(r&&(o.stateProxy=r),o.id=s,o.name=a,Ty(n,o),o)}function Ty(t,e){st(t)?t.forEach((t=>{if(st(t))Ty(t,e);else{const i=Ay(t);i&&i.type&&e.add(i)}})):t&&e.add(Ay(t))}const Cy=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},_y=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};var By=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Py=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ry=[0,0,0];let My=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Hi),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Yi),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Xi),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ce(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ce(1,0,0,1,0,0),this._clearMatrix=new ce(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&xt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ce(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Ol.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.nativeContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.restore()}restore(){this.nativeContext.restore(),this.stack.length>0&&(Ol.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Ol.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),r&&this.setTransformForCurrent()}setTransform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*r,o*s),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,r,s){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,r,s),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,r,s,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,r,s,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;i<e;)i+=Rt;const l=_t/3*(i>e?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,u=c<h?-1:1,d=Math.cos(h),p=Math.sin(h),f=Math.cos(c),g=Math.sin(c),v=d*s+n,m=p*a+r,y=f*s+n,b=g*a+r,x=s*o*u,w=a*o*u;t.push([v-x*p,m+w*d,y+x*g,b-w*f,y,b]),h=c}})(o,n,r,t,e,i,i,s);for(let t=0;t<o.length;++t){const e=o[t];this.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5],a)}}else this.nativeContext.arc(t,e,Math.max(0,i),n,r,s)}arcTo(t,e,i,n,r){this.nativeContext.arcTo(t,e,i,n,r)}bezierCurveTo(t,e,i,n,r,s,a){if(a=a||0,this.camera){let o=a,l=a;this.modelMatrix&&(Bl(Ry,[t,e,a],this.modelMatrix),t=Ry[0],e=Ry[1],o=Ry[2],Bl(Ry,[i,n,a],this.modelMatrix),i=Ry[0],n=Ry[1],l=Ry[2],Bl(Ry,[r,s,a],this.modelMatrix),r=Ry[0],s=Ry[1],a=Ry[2]);let h=this.camera.vp(r,s,a);r=h.x,s=h.y,h=this.camera.vp(t,e,o),t=h.x,e=h.y,h=this.camera.vp(i,n,l),i=h.x,n=h.y}this.nativeContext.bezierCurveTo(t,e,i,n,r,s)}closePath(){this.nativeContext.closePath()}ellipse(t,e,i,n,r,s,a,o){null==o?this.nativeContext.ellipse(t,e,i,n,r,s,a):this.nativeContext.ellipse(t,e,i,n,r,s,a,o)}lineTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Bl(Ry,[t,e,i],this.modelMatrix),t=Ry[0],e=Ry[1],i=Ry[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.lineTo(t,e)}moveTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Bl(Ry,[t,e,i],this.modelMatrix),t=Ry[0],e=Ry[1],i=Ry[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}this.nativeContext.moveTo(t,e)}quadraticCurveTo(t,e,i,n,r){if(r=r||0,this.camera){let s=r;this.modelMatrix&&(Bl(Ry,[t,e,r],this.modelMatrix),t=Ry[0],e=Ry[1],s=Ry[2],Bl(Ry,[i,n,r],this.modelMatrix),i=Ry[0],n=Ry[1],r=Ry[2]);let a=this.camera.vp(i,n,r);i=a.x,n=a.y,a=this.camera.vp(t,e,s),t=a.x,e=a.y}this.nativeContext.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n,r){r=r||0,this.camera?(this.moveTo(t,e,r),this.lineTo(t+i,e,r),this.lineTo(t+i,e+n,r),this.lineTo(t,e+n,r),this.closePath()):this.nativeContext.rect(t,e,i,n)}createImageData(){const t=arguments;return 2===t.length?this.nativeContext.createImageData(t[0],t[1]):1===t.length?this.nativeContext.createImageData(t[0]):null}createLinearGradient(t,e,i,n){return isFinite(t+e+i+n)||(t=0,e=0,i=0,n=0),this.nativeContext.createLinearGradient(t,e,i,n)}createPattern(t,e){return 0===t.width||0===t.height?null:this.nativeContext.createPattern(t,e)}createRadialGradient(t,e,i,n,r,s){return this.nativeContext.createRadialGradient(t,e,i,n,r,s)}createConicGradient(t,e,i,n){let r,s=!1;const a=this;return{stops:[],addColorStop(t,e){this.stops.push([t,e]),s=!0},GetPattern(o,l,h){return s&&(h||(h=n-i),r=el(a,this.stops,t,e,h,i,n,o,l),s=!1),r}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Bl(Ry,[t,e,i],this.modelMatrix),t=Ry[0],e=Ry[1],i=Ry[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Bl(Ry,[t,e,i],this.modelMatrix),t=Ry[0],e=Ry[1],i=Ry[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Bl(Ry,[e,i,n],this.modelMatrix),e=Ry[0],i=Ry[1],n=Ry[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vn.global.measureTextMethod;var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=vn.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const r=null!==(i=this.fontFamily)&&void 0!==i?i:Xi.fontFamily,s=null!==(n=this.fontSize)&&void 0!==n?n:Xi.fontSize;return this.mathTextMeasure.textSpec.fontFamily===r&&this.mathTextMeasure.textSpec.fontSize===s||(this.mathTextMeasure.textSpec.fontFamily=r,this.mathTextMeasure.textSpec.fontSize=s,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Bl(Ry,[e,i,n],this.modelMatrix),e=Ry[0],i=Ry[1],n=Ry[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,n,r){if(Array.isArray(r)){if(r.length<=1)return this._setCommonStyle(t,e,i,n,r[0]);const s=Object.create(r[0]);return r.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setCommonStyle(t,e,i,n,s)}return this._setCommonStyle(t,e,i,n,r)}_setCommonStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.fillAttributes);const{fillOpacity:a=r.fillOpacity,opacity:o=r.opacity,fill:l=r.fill}=e;s.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(s.fillStyle=xn(this,l,t,i,n))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const n=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(n,t)})),this._setShadowBlendStyle(t,e,n)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:r=i.opacity,shadowBlur:s=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;r<=1e-12||(s||o||l?(n.shadowBlur=s*this.dpr,n.shadowColor=a,n.shadowOffsetX=o*this.dpr,n.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1),c?(n.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(n.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,n,r){if(Array.isArray(r)){if(r.length<=1)return this._setStrokeStyle(t,e,i,n,r[0]);const s=Object.create(r[0]);return r.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setStrokeStyle(t,e,i,n,s)}return this._setStrokeStyle(t,e,i,n,r)}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(s.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=r.lineWidth,stroke:o=r.stroke,lineJoin:l=r.lineJoin,lineDash:h=r.lineDash,lineCap:c=r.lineCap,miterLimit:u=r.miterLimit,keepStrokeScale:d=r.keepStrokeScale}=e;s.lineWidth=d?a:bn(this,a,this.dpr),s.strokeStyle=xn(this,o,t,i,n),s.lineJoin=l,h&&s.setLineDash(h),s.lineCap=c,s.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:r=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=re(t,e,r&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:s=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=s,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,r;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=re(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,s.textBaseline=null!==(r=t.textBaseline)&&void 0!==r?r:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,n,r,s){this._clearMatrix.setValue(t,e,i,n,r,s)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Ol.free(t))),this.stack.length=0}};My.env="browser",My=By([g(),Py("design:paramtypes",[Object,Number])],My);var Ey=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ky=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Oy=class extends Tf{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=vn.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new My(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:r=this._x,y:s=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,r,s,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,r){this.controled&&(t.style.width=`${n}px`,t.style.height=`${r}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Ly(t,e){return new i((i=>{i(jn).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Un).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Oy.env="browser",Oy=Ey([g(),ky("design:paramtypes",[Object])],Oy);const Iy=Ly(Oy,My);var Dy=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},jy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uy=function(t,e){return function(i,n){e(i,n,t)}};let Wy=class extends t.DefaultPickService{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=gr.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const s=this.InterceptorContributions[r];if(s.beforePickItem){const r=s.beforePickItem(t,this,e,n,{parentMatrix:i});if(r)return r}}const r=this.pickerMap.get(t.numberType);if(!r)return null;const s=r.contains(t,e,n),a=s?t:null,o={graphic:a,params:s};if(a)return o;if(this.InterceptorContributions.length)for(let r=0;r<this.InterceptorContributions.length;r++){const s=this.InterceptorContributions[r];if(s.afterPickItem){const r=s.afterPickItem(t,this,e,n,{parentMatrix:i});if(r)return r}}return o}};Wy=Dy([g(),Uy(0,p(k)),Uy(0,v(vy)),Uy(1,p(Fc)),Uy(2,p(k)),Uy(2,v(mp)),jy("design:paramtypes",[Object,Object,Object])],Wy);var Ny=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Gy=class{constructor(){this.type="group",this.numberType=lo}contains(t,e,i){return!1}};Gy=Ny([g()],Gy);const Fy=new i(((t,e,i,n)=>{Fy.__vloaded||(Fy.__vloaded=!0,t(gy).to(Gy).inSingletonScope(),t(vy).toService(gy),L(t,vy))}));Fy.__vloaded=!1;var zy=Fy;const Hy=new i(((t,e,i,n)=>{i(Wy)||t(Wy).toSelf().inSingletonScope(),i(au)?n(au).toService(Wy):t(au).toService(Wy)}));function Vy(t){t.load(zy),t.load(Hy)}var Yy,Xy=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},$y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qy=Yy=class extends t.BaseWindowHandlerContribution{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Yy.idprefix}_${Yy.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=vn.global,this.viewBox=new le,this.modelMatrix=new ce(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>n)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Yy.GenerateCanvasId(),canvasControled:!0};this.canvas=new Oy(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,r=t.height;if(null==n||null==r||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,r=t.height}let s=t.dpr;null==s&&(s=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new Oy({width:n,height:r,dpr:s,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};qy.env="browser",qy.idprefix="visactor_window",qy.prefix_count=0,qy=Yy=Xy([g(),$y("design:paramtypes",[])],qy);const Ky=new i((t=>{t(qy).toSelf(),t(br).toDynamicValue((t=>t.container.get(qy))).whenTargetNamed(qy.env)}));var Zy=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Jy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Qy{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function tb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}t.BrowserEnvContribution=class extends t.BaseEnvContribution{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,n;let r=0,s=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};r=e.clientX||0,s=e.clientY||0,a=r,o=s}else r=t.clientX||0,s=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=r,i=s,a=e.getBoundingClientRect(),o=null===(n=e.getNativeHandler)||void 0===n?void 0:n.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(lt(l)?l:1),y:(i-a.top)/(lt(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Qy(t)}return new le}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:n,style:r}=e;return r&&(rt(r)?t.setAttribute("style",r):Object.keys(r).forEach((e=>{t.style[e]=r[e]}))),null!=i&&(t.style.width=`${i}px`),null!=n&&(t.style.height=`${n}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,n=document.createElement(e);if(this.updateDom(n,t),i){const t=rt(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return tb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return tb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var i,n;const r=document.createElement("canvas");t.id&&(r.id=null!==(i=t.id)&&void 0!==i?i:e.GenAutoIncrementId().toString());const s=null!==(n=t.dpr)&&void 0!==n?n:window.devicePixelRatio;return t.width&&t.height&&(r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.width=t.width*s,r.height=t.height*s),r}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,n=n.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetLeft,n=n.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,n=t.offsetLeft,r=t.offsetParent;for(;null!==r;)i+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{top:i,left:n}}},t.BrowserEnvContribution=Zy([g(),Jy("design:paramtypes",[])],t.BrowserEnvContribution);const eb=new i((e=>{eb.isBrowserBound||(eb.isBrowserBound=!0,e(t.BrowserEnvContribution).toSelf().inSingletonScope(),e(U).toService(t.BrowserEnvContribution))}));function ib(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];ib.__loaded||(ib.__loaded=!0,t.load(eb),t.load(Iy),t.load(Ky),e&&Vy(t))}eb.isBrowserBound=!1,ib.__loaded=!1;var nb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let rb=class extends My{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,n){return new Promise(((r,s)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:n,success(t){r(t)}})}catch(t){s(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};rb.env="feishu",rb=nb([g()],rb);var sb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},ab=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ob=class extends Tf{constructor(t){super(t)}init(){this._context=new rb(this,this._dpr)}release(){}};ob.env="feishu",ob=sb([g(),ab("design:paramtypes",[Object])],ob);const lb=Ly(ob,rb);var hb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},cb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ub=function(t,e){return function(i,n){e(i,n,t)}};let db=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new ob(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new ob({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};db.env="feishu",db=hb([g(),ub(0,p(W)),cb("design:paramtypes",[Object])],db);const pb=new i((t=>{t(db).toSelf(),t(br).toDynamicValue((t=>t.container.get(db))).whenTargetNamed(db.env)}));var fb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},gb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vb=function(t,e){return function(i,n){e(i,n,t)}};let mb=class extends t.DefaultPickService{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(e,i){this.pickContext=new t.EmptyContext2d(null,1)}pickItem(t,e,i,n){if(!1===t.attribute.pickable)return null;const r=this.pickerMap.get(t.numberType);if(!r)return null;const s=r.contains(t,e,n),a=s?t:null;return a?{graphic:a,params:s}:null}};mb=fb([g(),vb(0,p(k)),vb(0,v(Fm)),vb(1,p(k)),vb(1,v(mp)),gb("design:paramtypes",[Object,Object])],mb);const yb=new i((t=>{yb.__vloaded||(yb.__vloaded=!0,L(t,Fm))}));yb.__vloaded=!1;var bb=yb;class xb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getGraphicTheme();n.highPerformanceSave();let{x:s=r.x,y:a=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);s+=e.x,a+=e.y,n.setTransformForCurrent()}else s=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,s,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,r)=>{if(o)return!0;const s=i.lineWidth||r.lineWidth,a=i.pickStrokeBuffer||r.pickStrokeBuffer,l=i.keepStrokeScale||r.keepStrokeScale;return n.lineWidth=l?s+a:bn(n,s+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}}var wb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Sb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ab=function(t,e){return function(i,n){e(i,n,t)}};let Tb=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=no}};Tb=wb([g(),Ab(0,p(Tc)),Sb("design:paramtypes",[Object])],Tb);let Cb=!1;const _b=new i(((t,e,i,n)=>{Cb||(Cb=!0,t(zm).to(Tb).inSingletonScope(),t(Fm).toService(zm))}));var Bb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rb=function(t,e){return function(i,n){e(i,n,t)}};let Mb=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=so}};Mb=Bb([g(),Rb(0,p(_c)),Pb("design:paramtypes",[Object])],Mb);let Eb=!1;const kb=new i(((t,e,i,n)=>{Eb||(Eb=!0,t(Hm).to(Mb).inSingletonScope(),t(Fm).toService(Hm))}));var Ob=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Lb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ib=function(t,e){return function(i,n){e(i,n,t)}};let Db=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=ao}};Db=Ob([g(),Ib(0,p(Bc)),Lb("design:paramtypes",[Object])],Db);let jb=!1;const Ub=new i(((t,e,i,n)=>{jb||(jb=!0,t(Vm).to(Db).inSingletonScope(),t(Fm).toService(Vm))}));class Wb{constructor(){this.type="glyph",this.numberType=oo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=null==i?void 0:i.pickerService;if(r){let n=!1;return t.getSubGraphic().forEach((t=>{if(n)return;const s=r.pickItem(t,e,null,i);n=!(!s||!s.graphic)})),n}return!1}}var Nb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Gb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fb=function(t,e){return function(i,n){e(i,n,t)}};let zb=class extends Wb{constructor(t){super(),this.canvasRenderer=t}};zb=Nb([g(),Fb(0,p(Wc)),Gb("design:paramtypes",[Object])],zb);let Hb=!1;const Vb=new i(((t,e,i,n)=>{Hb||(Hb=!0,t(Qm).to(zb).inSingletonScope(),t(zb).toService(Qm))}));var Yb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Xb=class{constructor(){this.type="image",this.numberType=ho}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Xb=Yb([g()],Xb);let $b=!1;const qb=new i(((t,e,i,n)=>{$b||($b=!0,t(Ym).to(Xb).inSingletonScope(),t(Xb).toService(Ym))}));var Kb=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jb=function(t,e){return function(i,n){e(i,n,t)}};let Qb=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=co}};Qb=Kb([g(),Jb(0,p(Mc)),Zb("design:paramtypes",[Object])],Qb);let tx=!1;const ex=new i(((t,e,i,n)=>{tx||(tx=!0,t(Xm).to(Qb).inSingletonScope(),t(Fm).toService(Xm))}));var ix=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rx=function(t,e){return function(i,n){e(i,n,t)}};let sx=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=po}};sx=ix([g(),rx(0,p(kc)),nx("design:paramtypes",[Object])],sx);let ax=!1;const ox=new i(((t,e,i,n)=>{ax||(ax=!0,t(Jm).to(sx).inSingletonScope(),t(Fm).toService(Jm))}));var lx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,n){e(i,n,t)}};let ux=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=uo}};ux=lx([g(),cx(0,p(Ec)),hx("design:paramtypes",[Object])],ux);let dx=!1;const px=new i(((t,e,i,n)=>{dx||(dx=!0,t($m).to(ux).inSingletonScope(),t(Fm).toService($m))})),fx=new le;class gx{constructor(){this.type="rect",this.numberType=go}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getGraphicTheme(),{cornerRadius:s=r.cornerRadius}=t.attribute;let{x:a=r.x,y:o=r.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||ot(s,!0)&&0!==s||st(s)&&s.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,r)=>{if(h)return!0;const s=i.lineWidth||r.lineWidth,a=i.pickStrokeBuffer||r.pickStrokeBuffer,o=i.keepStrokeScale||r.keepStrokeScale;return n.lineWidth=o?s+a:bn(n,s+a,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=r.fill,stroke:n=r.stroke,lineWidth:s=r.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;fx.setValue(i.x1,i.y1,i.x2,i.y2),fx.expand(-s/2),h=!fx.containsPoint(e)}}return n.highPerformanceRestore(),h}}var vx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,n){e(i,n,t)}};let bx=class extends gx{constructor(t){super(),this.canvasRenderer=t}};bx=vx([g(),yx(0,p(Oc)),mx("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new i(((t,e,i,n)=>{xx||(xx=!0,t(qm).to(bx).inSingletonScope(),t(Fm).toService(qm))}));let Ax=!1;const Tx=new i(((t,e,i,n)=>{Ax||(Ax=!0,t(Ym).to(Xb).inSingletonScope(),t(Xb).toService(Ym))}));var Cx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bx=function(t,e){return function(i,n){e(i,n,t)}};let Px=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=yo}};Px=Cx([g(),Bx(0,p(Ic)),_x("design:paramtypes",[Object])],Px);let Rx=!1;const Mx=new i(((t,e,i,n)=>{Rx||(Rx=!0,t(Km).to(Px).inSingletonScope(),t(Fm).toService(Km))}));var Ex=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let kx=class{constructor(){this.type="text",this.numberType=bo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};kx=Ex([g()],kx);let Ox=!1;const Lx=new i(((t,e,i,n)=>{Ox||(Ox=!0,t(Zm).to(kx).inSingletonScope(),t(Fm).toService(Zm))})),Ix=new i(((t,e,i,n)=>{i(mb)||t(mb).toSelf().inSingletonScope(),i(au)?n(au).toService(mb):t(au).toService(mb)}));function Dx(t){t.load(bb),t.load(Ix),t.load(_b),t.load(kb),t.load(Ub),t.load(Vb),t.load(qb),t.load(ex),t.load(ox),t.load(px),t.load(Sx),t.load(Tx),t.load(Mx),t.load(Lx)}class jx{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,n,r,s){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=r,this.id=s,t.id=s,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class Ux{get width(){return this._w*this.dpr}set width(t){this._w=t/this.dpr,this.nativeCanvas.width=t}get height(){return this._h*this.dpr}set height(t){this._h=t/this.dpr,this.nativeCanvas.height=t}get offsetWidth(){return this._w}set offsetWidth(t){this._w=t,this.nativeCanvas.width=t*this.dpr}get offsetHeight(){return this._h}set offsetHeight(t){this._h=t,this.nativeCanvas.height=t*this.dpr}constructor(t,e,i,n,r,s){this.nativeCanvas=t,this.ctx=e,this._w=n,this._h=r,this.id=s,t.id=s,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var Wx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gx=class extends t.BaseEnvContribution{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,r,s){const a=null!=s?s:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,s)=>{const o=tt.createCanvasContext(e),l=new jx(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),s>=n&&r.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return As.call(t)}}getCancelAnimationFrame(){return t=>{As.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Gx=Wx([g(),Nx("design:paramtypes",[])],Gx);const Fx=new i((t=>{Fx.isFeishuBound||(Fx.isFeishuBound=!0,t(Gx).toSelf().inSingletonScope(),t(U).toService(Gx))}));function zx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];zx.__loaded||(zx.__loaded=!0,t.load(Fx),t.load(lb),t.load(pb),e&&Dx(t))}Fx.isFeishuBound=!1,zx.__loaded=!1;var Hx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Vx=class extends My{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=r.lineWidth,stroke:h=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit,keepStrokeScale:f=r.keepStrokeScale}=e;s.globalAlpha=a*o*this.baseGlobalAlpha,s.lineWidth=f?l:bn(this,l,this.dpr),s.strokeStyle=xn(this,h,t,i,n),s.lineJoin=c,0===u[0]&&0===u[1]||u&&s.setLineDash(u),s.lineCap=d,s.miterLimit=p}}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vn.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,vn.global.devicePixelRatio),super.measureText(t,e)}createPattern(t,e){return null}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}};Vx.env="lynx",Vx=Hx([g()],Vx);var Yx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $x=class extends Tf{constructor(t){super(t)}init(){this._context=new Vx(this,this._dpr)}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._nativeCanvas.nativeCanvas&&(this._nativeCanvas.nativeCanvas.width=this._pixelWidth,this._nativeCanvas.nativeCanvas.height=this._pixelHeight),this._context.dpr=this._dpr}release(){}};$x.env="lynx",$x=Yx([g(),Xx("design:paramtypes",[Object])],$x);var qx=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Kx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,n){e(i,n,t)}};let Jx=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new $x(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new $x({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Jx.env="lynx",Jx=qx([g(),Zx(0,p(W)),Kx("design:paramtypes",[Object])],Jx);const Qx=new i((t=>{t(Jx).toSelf(),t(br).toDynamicValue((t=>t.container.get(Jx))).whenTargetNamed(Jx.env)})),tw=Ly($x,Vx);var ew=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},iw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nw=!1;try{nw=!!lynx.createCanvasNG}catch(t){}let rw=class extends t.BaseEnvContribution{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,r,s,a){const o=null!=a?a:SystemInfo.pixelRatio;if(e.forEach(((e,a)=>{let l;s?l=lynx.createOffscreenCanvas():(l=nw?lynx.createCanvasNG(e):lynx.createCanvas(e),nw&&l.attachToCanvasView(e)),l.width=t.width*o,l.height=t.height*o;const h=l.getContext("2d"),c=new Ux(l,h,o,t.width,t.height,e);i.set(e,c),a>n&&r.push(c)})),!r.length&&lynx.createOffscreenCanvas){const e=lynx.createOffscreenCanvas();e.width=t.width*o,e.height=t.height*o;const n=e.getContext("2d"),s=Math.random().toString(),a=new Ux(e,n,o,t.width,t.height,s);i.set(s,a),r.push(a)}}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,!!e.offscreen,e.pixelRatio))}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return As.call(t)}}getCancelAnimationFrame(){return t=>{As.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};rw=ew([g(),iw("design:paramtypes",[])],rw);const sw=new i((t=>{sw.isLynxBound||(sw.isLynxBound=!0,t(rw).toSelf().inSingletonScope(),t(U).toService(rw))}));function aw(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];aw.__loaded||(aw.__loaded=!0,t.load(sw),t.load(tw),t.load(Qx),e&&Dx(t))}sw.isLynxBound=!1,aw.__loaded=!1;var ow=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},lw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hw=class extends My{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ce(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};hw.env="node",hw=ow([g(),lw("design:paramtypes",[Object,Number])],hw);var cw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},uw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dw=class extends Tf{constructor(t){super(t)}init(){this._context=new hw(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&K(this._nativeCanvas.release)&&this._nativeCanvas.release()}};dw.env="node",dw=cw([g(),uw("design:paramtypes",[Object])],dw);const pw=Ly(dw,hw);var fw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},gw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vw=function(t,e){return function(i,n){e(i,n,t)}};let mw=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new dw(n)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new dw({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};mw.env="node",mw=fw([g(),vw(0,p(W)),gw("design:paramtypes",[Object])],mw);const yw=new i((t=>{t(mw).toSelf(),t(br).toDynamicValue((t=>t.container.get(mw))).whenTargetNamed(mw.env)}));var bw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let xw=class extends t.BaseEnvContribution{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return As.call(t)}}getCancelAnimationFrame(){return t=>{As.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};xw=bw([g()],xw);const ww=new i((t=>{ww.isNodeBound||(ww.isNodeBound=!0,t(xw).toSelf().inSingletonScope(),t(U).toService(xw))}));function Sw(t){Sw.__loaded||(Sw.__loaded=!0,t.load(ww),t.load(pw),t.load(yw))}ww.isNodeBound=!1,Sw.__loaded=!1;var Aw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Tw=class extends My{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.fillAttributes);const{fillOpacity:a=r.fillOpacity,opacity:o=r.opacity,fill:l=r.fill}=e;a>1e-12&&o>1e-12&&(s.setGlobalAlpha(a*o),s.setFillStyle(xn(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=r.lineWidth,stroke:h=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit,keepStrokeScale:f=r.keepStrokeScale}=e;s.setGlobalAlpha(a*o),s.setLineWidth(f?l:bn(this,l,this.dpr)),s.setStrokeStyle(xn(this,h,t,i,n)),s.setLineJoin(c),u&&s.setLineDash(u),s.setLineCap(d),s.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=re(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=re(t,e),r.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),r.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}getImageData(t,e,i,n){const r=this.nativeContext,s=r.taro;if(r&&s)return!r.getImageData&&s.canvasGetImageData?new Promise(((r,a)=>{try{s.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:n,success(t){r(t)}})}catch(t){a(t)}})):void 0}createRadialGradient(t,e,i,n,r,s){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,n,r,s)}};Tw.env="taro",Tw=Aw([g()],Tw);var Cw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},_w=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Bw=class extends Tf{constructor(t){super(t)}init(){this._context=new Tw(this,this._dpr)}release(){}};Bw.env="taro",Bw=Cw([g(),_w("design:paramtypes",[Object])],Bw);const Pw=Ly(Bw,Tw);var Rw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Mw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ew=function(t,e){return function(i,n){e(i,n,t)}};let kw=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Bw(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new Bw({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.y})})),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};kw.env="taro",kw=Rw([g(),Ew(0,p(W)),Mw("design:paramtypes",[Object])],kw);const Ow=new i((t=>{t(kw).toSelf(),t(br).toDynamicValue((t=>t.container.get(kw))).whenTargetNamed(kw.env)}));var Lw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Iw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Dw=class extends t.BaseEnvContribution{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}configure(t,e){var i,n,r,s,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,r=this.canvasMap,s=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t),h=new jx(n.canvas||{},n,l,i.width,i.height,t);return n.canvas=h,r.set(t,h),e>=s&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio)}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),r=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:r,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}};Dw=Lw([g(),Iw("design:paramtypes",[])],Dw);const jw=new i((t=>{jw.isTaroBound||(jw.isTaroBound=!0,t(Dw).toSelf().inSingletonScope(),t(U).toService(Dw))}));function Uw(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Uw.__loaded||(Uw.__loaded=!0,t.load(jw),t.load(Pw),t.load(Ow),e&&Dx(t))}jw.isTaroBound=!1,Uw.__loaded=!1;var Ww=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let Nw=class extends My{draw(){}createPattern(t,e){return null}};Nw.env="wx",Nw=Ww([g()],Nw);var Gw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Fw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zw=class extends Tf{constructor(t){super(t)}init(){this._context=new Nw(this,this._dpr)}release(){}};zw.env="wx",zw=Gw([g(),Fw("design:paramtypes",[Object])],zw);const Hw=Ly(zw,Nw);var Vw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Yw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xw=function(t,e){return function(i,n){e(i,n,t)}};let $w=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zw(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new zw({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,r;const{type:s}=t;return!!this.eventManager.cache[s]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[s].listener&&this.eventManager.cache[s].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};$w.env="wx",$w=Vw([g(),Xw(0,p(W)),Yw("design:paramtypes",[Object])],$w);const qw=new i((t=>{t($w).toSelf(),t(br).toDynamicValue((t=>t.container.get($w))).whenTargetNamed($w.env)}));var Kw=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},Zw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jw=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let Qw=class extends t.BaseEnvContribution{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,r,s){return Jw(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a<e.length;a++){const o=e[a];yield new Promise((e=>{let l=wx.createSelectorQuery();s&&(l=l.in(s)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((s=>{if(!s[0])return;const l=s[0].node,h=s[0].width,c=s[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&r.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return As.call(t)}}getCancelAnimationFrame(){return t=>{As.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Qw=Kw([g(),Zw("design:paramtypes",[])],Qw);const tS=new i((t=>{tS._isWxBound||(tS._isWxBound=!0,t(Qw).toSelf().inSingletonScope(),t(U).toService(Qw))}));function eS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];eS.__loaded||(eS.__loaded=!0,t.load(tS),t.load(Hw),t.load(qw),e&&Dx(t))}function iS(t){nS(t)}function nS(t){nS.__loaded||(nS.__loaded=!0,ib(t,!1),zx(t,!1),aw(t,!1),Sw(t),Uw(t,!1),eS(t,!1),Vy(t),tf.hooks.onSetEnv.tap("loadMathPicker",((e,i)=>{"browser"!==i&&Dx(t)})))}tS._isWxBound=!1,eS.__loaded=!1,nS.__loaded=!1;var rS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let sS=class extends rb{};sS.env="tt",sS=rS([g()],sS);var aS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lS=class extends Tf{constructor(t){super(t)}init(){this._context=new sS(this,this._dpr)}release(){}};lS.env="tt",lS=aS([g(),oS("design:paramtypes",[Object])],lS);const hS=Ly(lS,sS);var cS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,n){e(i,n,t)}};let pS=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="tt",this.eventManager=new class{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lS(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new lS({width:i,height:n,dpr:r,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};pS.env="tt",pS=cS([g(),dS(0,p(W)),uS("design:paramtypes",[Object])],pS);const fS=new i((t=>{t(pS).toSelf(),t(br).toDynamicValue((t=>t.container.get(pS))).whenTargetNamed(pS.env)}));var gS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},vS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mS=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{l(n.next(t))}catch(t){s(t)}}function o(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let yS=class extends t.BaseEnvContribution{constructor(){super(),this.type="tt",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,r,s){return mS(this,void 0,void 0,(function*(){const t=tt.getSystemInfoSync().pixelRatio;for(let a=0;a<e.length;a++){const o=e[a];yield new Promise((e=>{let l=tt.createSelectorQuery();s&&(l=l.in(s)),l.select(`#${o}`).node().exec((s=>{const l=s[0].node,h=l.width,c=l.height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&r.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return As.call(t)}}getCancelAnimationFrame(){return t=>{As.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};yS=gS([g(),vS("design:paramtypes",[])],yS);const bS=new i((t=>{bS.isTTBound||(bS.isTTBound=!0,t(yS).toSelf().inSingletonScope(),t(U).toService(yS))}));function xS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];xS.__loaded||(xS.__loaded=!0,t.load(bS),t.load(hS),t.load(fS),e&&Dx(t))}bS.isTTBound=!1,xS.__loaded=!1;var wS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let SS=class extends My{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,r){const s=this.nativeContext;r||(r=this.strokeAttributes);const{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=r.lineWidth,stroke:h=r.stroke,lineJoin:c=r.lineJoin,lineDash:u=r.lineDash,lineCap:d=r.lineCap,miterLimit:p=r.miterLimit,keepStrokeScale:f=r.keepStrokeScale}=e;s.globalAlpha=a*o*this.baseGlobalAlpha,s.lineWidth=f?l:bn(this,l,this.dpr),s.strokeStyle=xn(this,h,t,i,n),s.lineJoin=c,0===u[0]&&0===u[1]||u&&s.setLineDash(u),s.lineCap=d,s.miterLimit=p}}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vn.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,vn.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:r=e.scaleIn3d}=t;let s="";s=t.font?t.font:re(t,e,r&&this.camera&&this.camera.getProjectionScale(i)),n.font=(s||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,r;const s=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:re(t,e,this.camera&&this.camera.getProjectionScale(i)),s.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,s.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,s.textBaseline=null!==(r=t.textBaseline)&&void 0!==r?r:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}draw(){}};SS.env="harmony",SS=wS([g()],SS);var AS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CS=class extends Tf{constructor(t){super(t)}init(){this._context=new SS(this,this._dpr)}resize(t,e){}release(){}};CS.env="harmony",CS=AS([g(),TS("design:paramtypes",[Object])],CS);var _S=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},BS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PS=function(t,e){return function(i,n){e(i,n,t)}};class RS{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let MS=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new RS}getTitle(){return this.canvas.id&&this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const i=this.global.createCanvas({width:t.width,height:t.height}),n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:i,id:e.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new CS(n)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}this.canvas=new CS({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};MS.env="harmony",MS=_S([g(),PS(0,p(W)),BS("design:paramtypes",[Object])],MS);const ES=new i((t=>{t(MS).toSelf(),t(br).toDynamicValue((t=>t.container.get(MS))).whenTargetNamed(MS.env)})),kS=Ly(CS,SS);var OS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let IS=class extends t.BaseEnvContribution{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new Ss(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const n=new OffscreenCanvas(t,e),r=n.getContext("2d");return new jx({width:t,height:e,context:r,_c:n,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>r},r,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(){}};IS=OS([g(),LS("design:paramtypes",[])],IS);const DS=new i((t=>{DS.isHarmonyBound||(DS.isHarmonyBound=!0,t(IS).toSelf().inSingletonScope(),t(U).toService(IS))}));function jS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];jS.__loaded||(jS.__loaded=!0,t.load(DS),t.load(kS),t.load(ES),e&&Dx(t))}DS.isHarmonyBound=!1,jS.__loaded=!1;var US=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NS=function(t,e){return function(i,n){e(i,n,t)}};let GS=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=no}};GS=US([g(),NS(0,p(Tc)),WS("design:paramtypes",[Object])],GS);let FS=!1;const zS=new i(((t,e,i,n)=>{FS||(FS=!0,t(ty).to(GS).inSingletonScope(),t(vy).toService(ty))}));var HS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},YS=function(t,e){return function(i,n){e(i,n,t)}};let XS=class extends gx{constructor(t){super(),this.canvasRenderer=t}};XS=HS([g(),YS(0,p(Oc)),VS("design:paramtypes",[Object])],XS);let $S=!1;const qS=new i(((t,e,i,n)=>{$S||($S=!0,t(oy).to(XS).inSingletonScope(),t(vy).toService(oy))}));class KS extends Gl{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const r=t.getGraphicTheme(),s=this.transform(t,r,n),{x:a,y:o,z:l,lastModelMatrix:h}=s;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const r=e.lineWidth||i.lineWidth,s=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?r+s:bn(n,r+s,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==h&&Ll.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}var ZS=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},JS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QS=function(t,e){return function(i,n){e(i,n,t)}};let tA=class extends KS{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=co}};tA=ZS([g(),QS(0,p(Mc)),JS("design:paramtypes",[Object])],tA);let eA=!1;const iA=new i(((t,e,i,n)=>{eA||(eA=!0,t(sy).to(tA).inSingletonScope(),t(vy).toService(sy))}));var nA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,n){e(i,n,t)}};let aA=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=so}};aA=nA([g(),sA(0,p(_c)),rA("design:paramtypes",[Object])],aA);let oA=!1;const lA=new i(((t,e,i,n)=>{oA||(oA=!0,t(iy).to(aA).inSingletonScope(),t(vy).toService(iy))}));class hA extends Gl{contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getGraphicTheme();n.highPerformanceSave();const s=this.transform(t,r,n),{x:a,y:o,z:l,lastModelMatrix:h}=s;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let u=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,n.modelMatrix!==h&&Ll.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),u}}var cA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dA=function(t,e){return function(i,n){e(i,n,t)}};let pA=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=yo}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.getParsedPath();if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(r.isSvg||"imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=t.getGraphicTheme(),a=this.transform(t,s,n),{x:o,y:l,z:h,lastModelMatrix:c}=a;let u=e;if(n.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,n,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const r=e.lineWidth||i.lineWidth,s=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return n.lineWidth=a?r+s:bn(n,r+s,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Ll.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}};pA=cA([g(),dA(0,p(Ic)),uA("design:paramtypes",[Object])],pA);let fA=!1;const gA=new i(((t,e,i,n)=>{fA||(fA=!0,t(hy).to(pA).inSingletonScope(),t(vy).toService(hy))}));var vA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},mA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yA=function(t,e){return function(i,n){e(i,n,t)}};let bA=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=ao}};bA=vA([g(),yA(0,p(Bc)),mA("design:paramtypes",[Object])],bA);let xA=!1;const wA=new i(((t,e,i,n)=>{xA||(xA=!0,t(ny).to(bA).inSingletonScope(),t(vy).toService(ny))}));var SA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},AA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TA=function(t,e){return function(i,n){e(i,n,t)}};let CA=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=bo}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const r=t.AABBBounds;if(!n.camera)return!!r.containsPoint(e);n.highPerformanceSave();const s=t.getGraphicTheme(),{keepDirIn3d:a=s.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,s,n,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let f=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(f)return!0;const{fontSize:r=s.fontSize,textBaseline:a=s.textBaseline,textAlign:o=s.textAlign}=t.attribute,l=t.AABBBounds,d=l.height(),g=l.width(),v=gl(a,d,r),m=fl(o,g);return e.rect(m+h,v+c,g,d,u),f=e.isPointInPath(p.x,p.y),f}),((t,e,i)=>f)),this.canvasRenderer.z=0,n.modelMatrix!==d&&Ll.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),f}};CA=SA([g(),TA(0,p(Dc)),AA("design:paramtypes",[Object])],CA);let _A=!1;const BA=new i(((t,e,i,n)=>{_A||(_A=!0,t(cy).to(CA).inSingletonScope(),t(vy).toService(cy))}));var PA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},RA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MA=function(t,e){return function(i,n){e(i,n,t)}};let EA=class extends KS{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=uo}};EA=PA([g(),MA(0,p(Ec)),RA("design:paramtypes",[Object])],EA);let kA=!1;const OA=new i(((t,e,i,n)=>{kA||(kA=!0,t(ay).to(EA).inSingletonScope(),t(vy).toService(ay))}));var LA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,n){e(i,n,t)}};let jA=class extends xb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=po}};jA=LA([g(),DA(0,p(kc)),IA("design:paramtypes",[Object])],jA);let UA=!1;const WA=new i(((t,e,i,n)=>{UA||(UA=!0,t(uy).to(jA).inSingletonScope(),t(vy).toService(uy))}));var NA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},GA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FA=function(t,e){return function(i,n){e(i,n,t)}};let zA=class extends Wb{constructor(t){super(),this.canvasRenderer=t}};zA=NA([g(),FA(0,p(Wc)),GA("design:paramtypes",[Object])],zA);let HA=!1;const VA=new i(((t,e,i,n)=>{HA||(HA=!0,t(fy).to(zA).inSingletonScope(),t(vy).toService(fy))}));var YA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},XA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$A=function(t,e){return function(i,n){e(i,n,t)}};let qA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=mo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};qA=YA([g(),$A(0,p(jc)),XA("design:paramtypes",[Object])],qA);let KA=!1;const ZA=new i(((t,e,i,n)=>{KA||(KA=!0,t(py).to(qA).inSingletonScope(),t(vy).toService(py))}));var JA=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let QA=class{constructor(){this.type="image",this.numberType=ho}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};QA=JA([g()],QA);let tT=!1;const eT=new i(((t,e,i,n)=>{tT||(tT=!0,t(ry).to(QA).inSingletonScope(),t(vy).toService(ry))}));var iT=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},nT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rT=function(t,e){return function(i,n){e(i,n,t)}};let sT=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=vo,this.themeType="rect"}};sT=iT([g(),rT(0,p(Lc)),nT("design:paramtypes",[Object])],sT);let aT=!1;const oT=new i(((t,e,i,n)=>{aT||(aT=!0,t(ly).to(sT).inSingletonScope(),t(vy).toService(ly))}));var lT=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},hT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cT=function(t,e){return function(i,n){e(i,n,t)}};let uT=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ro,this.themeType="arc"}};uT=lT([g(),cT(0,p(Cc)),hT("design:paramtypes",[Object])],uT);let dT=!1;const pT=new i(((t,e,i,n)=>{dT||(dT=!0,t(ey).to(uT).inSingletonScope(),t(vy).toService(ey))}));var fT=function(t,e,i,n){var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a},gT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vT=function(t,e){return function(i,n){e(i,n,t)}};let mT=class extends hA{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=fo,this.themeType="polygon"}};mT=fT([g(),vT(0,p(Uc)),gT("design:paramtypes",[Object])],mT);let yT=!1;const bT=new i(((t,e,i,n)=>{yT||(yT=!0,t(dy).to(mT).inSingletonScope(),t(vy).toService(dy))})),xT=ff();function wT(){wT.__loaded||(wT.__loaded=!0,$g(),Dn.load(og),Dn.load(xT?zS:_b))}wT.__loaded=!1;const ST=wT;function AT(){AT.__loaded||(AT.__loaded=!0,qg(),Rf(),Ef(),Dn.load(zg),Dn.load(pT))}AT.__loaded=!1;const TT=AT;function CT(){CT.__loaded||(CT.__loaded=!0,Kg(),Dn.load(pg),Dn.load(xT?lA:kb))}CT.__loaded=!1;const _T=CT;function BT(){BT.__loaded||(BT.__loaded=!0,Zg(),Dn.load(mg),Dn.load(xT?wA:Ub))}BT.__loaded=!1;const PT=BT;function RT(){RT.__loaded||(RT.__loaded=!0,Jg(),Dn.load(Bg),Dn.load(xT?VA:Vb))}RT.__loaded=!1;const MT=RT;function ET(){ET.__loaded||(ET.__loaded=!0,Qg())}ET.__loaded=!1;const kT=ET;function OT(){OT.__loaded||(OT.__loaded=!0,tv(),Dn.load(Lg),Dn.load(xT?eT:qb))}OT.__loaded=!1;const LT=OT;function IT(){IT.__loaded||(IT.__loaded=!0,ev(),Dn.load(ug),Dn.load(xT?iA:ex))}IT.__loaded=!1;const DT=IT;function jT(){jT.__loaded||(jT.__loaded=!0,iv(),Dn.load(wg),Dn.load(xT?OA:px))}jT.__loaded=!1;const UT=jT;function WT(){WT.__loaded||(WT.__loaded=!0,nv(),Dn.load(Ag),Dn.load(xT?WA:ox))}WT.__loaded=!1;const NT=WT;function GT(){GT.__loaded||(GT.__loaded=!0,rv(),Rf(),Ef(),Dn.load(Xg),Dn.load(bT))}GT.__loaded=!1;const FT=GT;function zT(){zT.__loaded||(zT.__loaded=!0,sv(),Dn.load(hg),Dn.load(xT?qS:Sx))}zT.__loaded=!1;const HT=zT;function VT(){VT.__loaded||(VT.__loaded=!0,av(),Dn.load(Wg),Dn.load(oT))}VT.__loaded=!1;const YT=VT;function XT(){XT.__loaded||(XT.__loaded=!0,ov(),Dn.load(kg),Dn.load(xT?ZA:Tx))}XT.__loaded=!1;const $T=XT;function qT(){qT.__loaded||(qT.__loaded=!0,cv())}qT.__loaded=!1;const KT=qT;function ZT(){ZT.__loaded||(ZT.__loaded=!0,lv(),Dn.load(gg),Dn.load(xT?gA:Mx))}ZT.__loaded=!1;const JT=ZT;function QT(){QT.__loaded||(QT.__loaded=!0,hv(),Dn.load(bg),Dn.load(xT?BA:Lx))}QT.__loaded=!1;const tC=QT;function eC(){eC.__loaded||(eC.__loaded=!0,uv())}eC.__loaded=!1;const iC=eC,nC=Gm;Qp(),ff()?ib(Dn):gf()&&Sw(Dn),ST(),TT(),_T(),PT(),MT(),kT(),LT(),DT(),UT(),NT(),FT(),HT(),YT(),$T(),KT(),JT(),tC(),iC(),xv(),mv(),pv(),gv(),Rf(),Ef(),t.ACustomAnimate=es,t.ARC3D_NUMBER_TYPE=ro,t.ARC_NUMBER_TYPE=no,t.AREA_NUMBER_TYPE=so,t.Animate=ns,t.AnimateGroup=class extends es{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onStart(){this.customAnimates.forEach((t=>{t.onStart()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const r=n.easing,s="string"==typeof r?Jr[r]:r;e=s(e),n.onUpdate(t,e,i)})),this.updating=!1)}},t.AnimateGroup1=class extends es{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const r=n.easing,s="string"==typeof r?Jr[r]:r;e=s(e),n.onUpdate(t,e,i)})),this.updating=!1)}},t.Application=gn,t.Arc=sp,t.Arc3d=op,t.Arc3dRender=Cc,t.ArcRender=Tc,t.ArcRenderContribution=il,t.Area=ip,t.AreaRender=_c,t.AreaRenderContribution=nl,t.AttributeAnimate=class extends es{constructor(t,e,i){super({},t,e,i)}getEndProps(){return this.to}onBind(){Object.keys(this.to).forEach((t=>{this.from[t]=this.target.getComputedAttribute(t)}))}onEnd(){}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this.to,this.from)}},t.AutoEnablePlugins=xp,t.BaseCanvas=Tf,t.BaseRender=Gl,t.Basis=gi,t.BeforeRenderConstribution=nu,t.BoundsContext=_e,t.BoundsPicker=ou,t.CIRCLE_NUMBER_TYPE=ao,t.Canvas3DDrawItemInterceptor=Jc,t.CanvasArc3dPicker=ey,t.CanvasArcPicker=ty,t.CanvasAreaPicker=iy,t.CanvasCirclePicker=ny,t.CanvasFactory=jn,t.CanvasGlyphPicker=fy,t.CanvasGroupPicker=gy,t.CanvasImagePicker=ry,t.CanvasLinePicker=sy,t.CanvasPathPicker=ay,t.CanvasPickerContribution=vy,t.CanvasPolygonPicker=uy,t.CanvasPyramid3dPicker=dy,t.CanvasRect3dPicker=ly,t.CanvasRectPicker=oy,t.CanvasRichTextPicker=py,t.CanvasSymbolPicker=hy,t.CanvasTextLayout=pu,t.CanvasTextPicker=cy,t.CbAnimate=is,t.Circle=uu,t.CircleRender=Bc,t.CircleRenderContribution=rl,t.ClipAngleAnimate=class extends Bs{constructor(t,e,i,n,r){var s,a,o,l,h,c,u,d,p,f,g,v;const m=null!==(a=null===(s=null==r?void 0:r.group)||void 0===s?void 0:s.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,b=null!==(l=m.height)&&void 0!==l?l:0,x=null!==(h=null==r?void 0:r.animationType)&&void 0!==h?h:"in",w=null!==(c=null==r?void 0:r.startAngle)&&void 0!==c?c:0,S=null!==(u=null==r?void 0:r.orient)&&void 0!==u?u:"clockwise";let A=0,T=0;"anticlockwise"===S?(T="in"===x?w+2*Math.PI:w,T=w+2*Math.PI):(A=w,T="out"===x?w+2*Math.PI:w);const C=vn.graphicService.creator.arc({x:null!==(p=null===(d=null==r?void 0:r.center)||void 0===d?void 0:d.x)&&void 0!==p?p:y/2,y:null!==(g=null===(f=null==r?void 0:r.center)||void 0===f?void 0:f.y)&&void 0!==g?g:b/2,outerRadius:null!==(v=null==r?void 0:r.radius)&&void 0!==v?v:(y+b)/2,innerRadius:0,startAngle:A,endAngle:T,fill:!0});let _,B;"anticlockwise"===S?(_={startAngle:w+2*Math.PI},B={startAngle:w}):(_={endAngle:w},B={endAngle:w+2*Math.PI}),super("in"===x?_:B,"in"===x?B:_,i,n,{group:null==r?void 0:r.group,clipGraphic:C})}},t.ClipDirectionAnimate=class extends Bs{constructor(t,e,i,n,r){var s,a,o,l,h,c,u,d,p;const f=null!==(a=null===(s=null==r?void 0:r.group)||void 0===s?void 0:s.attribute)&&void 0!==a?a:{},g=null!==(l=null!==(o=null==r?void 0:r.width)&&void 0!==o?o:f.width)&&void 0!==l?l:0,v=null!==(c=null!==(h=null==r?void 0:r.height)&&void 0!==h?h:f.height)&&void 0!==c?c:0,m=null!==(u=null==r?void 0:r.animationType)&&void 0!==u?u:"in",y=null!==(d=null==r?void 0:r.direction)&&void 0!==d?d:"x",b=null!==(p=null==r?void 0:r.orient)&&void 0!==p?p:"positive",x=vn.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:g,height:"in"===m&&"y"===y?0:v,fill:!0});let w={},S={};"y"===y?"negative"===b?(w={y:v,height:0},S={y:0,height:v}):(w={height:0},S={height:v}):"negative"===b?(w={x:g,width:0},S={x:0,width:g}):(w={width:0},S={width:g}),super("in"===m?w:S,"in"===m?S:w,i,n,{group:null==r?void 0:r.group,clipGraphic:x})}},t.ClipGraphicAnimate=Bs,t.ClipRadiusAnimate=class extends Bs{constructor(t,e,i,n,r){var s,a,o,l,h,c,u,d,p,f,g;const v=null!==(a=null===(s=null==r?void 0:r.group)||void 0===s?void 0:s.attribute)&&void 0!==a?a:{},m=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==r?void 0:r.animationType)&&void 0!==h?h:"in",x=null!==(c=null==r?void 0:r.startRadius)&&void 0!==c?c:0,w=null!==(u=null==r?void 0:r.endRadius)&&void 0!==u?u:Math.sqrt((m/2)**2+(y/2)**2),S=vn.graphicService.creator.arc({x:null!==(p=null===(d=null==r?void 0:r.center)||void 0===d?void 0:d.x)&&void 0!==p?p:m/2,y:null!==(g=null===(f=null==r?void 0:r.center)||void 0===f?void 0:f.y)&&void 0!==g?g:y/2,outerRadius:"out"===b?w:x,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:!0}),A={outerRadius:x},T={outerRadius:w};super("in"===b?A:T,"in"===b?T:A,i,n,{group:null==r?void 0:r.group,clipGraphic:S})}},t.ColorInterpolate=Jo,t.ColorStore=ea,t.CommonRenderContribution=dl,t.Container=E,t.ContainerModule=i,t.Context2dFactory=Un,t.ContributionProvider=k,t.CurveContext=class{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.curves.push(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ai(new Ft(this._lastX,this._lastY),new Ft(t,e))}quadraticCurveTo(t,e,i,n){throw new Error("CurveContext不支持调用quadraticCurveTo")}bezierCurveTo(t,e,i,n,r,s){const a=new ri(new Ft(this._lastX,this._lastY),new Ft(t,e),new Ft(i,n),new Ft(r,s));this.path.curves.push(a),this._lastX=r,this._lastY=s}arcTo(t,e,i,n,r){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,n,r,s,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,n){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,n,r,s){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}},t.CustomEvent=Nr,t.CustomPath2D=Wi,t.CustomSymbolClass=Sd,t.DEFAULT_TEXT_FONT_FAMILY=N,t.DebugDrawItemInterceptorContribution=Kc,t.DefaultArcAllocate=Hf,t.DefaultArcAttribute=Qi,t.DefaultArcRenderContribution=ql,t.DefaultAreaAllocate=Yf,t.DefaultAreaAttribute=tn,t.DefaultAreaTextureRenderContribution=xh,t.DefaultAttribute=Ji,t.DefaultBaseBackgroundRenderContribution=Vl,t.DefaultBaseTextureRenderContribution=Xl,t.DefaultCanvasAllocate=fr,t.DefaultCircleAllocate=$f,t.DefaultCircleAttribute=en,t.DefaultCircleRenderContribution=Ql,t.DefaultConnectAttribute=Ki,t.DefaultDebugAttribute=Zi,t.DefaultFillStyle=Hi,t.DefaultGlyphAttribute=rn,t.DefaultGraphicAllocate=Gf,t.DefaultGraphicMemoryManager=rg,t.DefaultGroupAttribute=nn,t.DefaultGroupBackgroundRenderContribution=nh,t.DefaultImageAttribute=pn,t.DefaultImageBackgroundRenderContribution=dh,t.DefaultImageRenderContribution=ph,t.DefaultLayout=Fi,t.DefaultLineAllocate=Kf,t.DefaultLineAttribute=sn,t.DefaultMat4Allocate=kl,t.DefaultMatrixAllocate=El,t.DefaultMorphingAnimateConfig=os,t.DefaultPathAllocate=Jf,t.DefaultPathAttribute=an,t.DefaultPickStyle=$i,t.DefaultPolygonAttribute=on,t.DefaultRect3dAttribute=hn,t.DefaultRectAllocate=Ff,t.DefaultRectAttribute=ln,t.DefaultRectRenderContribution=lh,t.DefaultRichTextAttribute=dn,t.DefaultRichTextIconAttribute=fn,t.DefaultStateAnimateConfig=as,t.DefaultStrokeStyle=Yi,t.DefaultStyle=qi,t.DefaultSymbolAllocate=tg,t.DefaultSymbolAttribute=cn,t.DefaultSymbolRenderContribution=vh,t.DefaultTextAllocate=ig,t.DefaultTextAttribute=un,t.DefaultTextStyle=Xi,t.DefaultTicker=Kr,t.DefaultTimeline=Qr,t.DefaultTransform=zi,t.DirectionalLight=Pf,t.DragNDrop=class{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let r,s=!1;function a(t){if(s||(t.type="dragstart",null==e||e.dispatchEvent(t),s=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.attribute.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,r!==n&&(r&&(t.type="dragleave",t.target=r,r.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),r=n,r&&(t.type="dragover",t.target=r,r.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){s&&(r&&(t.type="drop",t.target=r,r.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),s=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}},t.DrawContribution=Fc,t.DrawItemInterceptor=Yc,t.DynamicLayerHandlerContribution=Lo,t.EnvContribution=U,t.EventManager=zr,t.EventSystem=Yr,t.EventTarget=Hr,t.FORMAT_ELEMENT_COMMAND="FORMAT_ELEMENT_COMMAND",t.FORMAT_TEXT_COMMAND=Nf,t.Factory=vf,t.FadeInPlus=class extends es{constructor(t,e,i,n,r){super(t,e,i,n,r);const{direction:s=_s.LEFT_TO_RIGHT,fill:a=!0,stroke:o=!0}=r||{};this.direction=s,this.fill=a,this.stroke=o,this.fillGradient={gradient:"linear",stops:[]},this.strokeGradient={gradient:"linear",stops:[]}}getEndProps(){return{fill:this.toFill,stroke:this.toStroke}}onBind(){this.toFill=this.target.getComputedAttribute("fill"),this.toStroke=this.target.getComputedAttribute("stroke")}onEnd(){}onUpdate(t,e,i){if(this.toFill&&this.toStroke)switch(this.direction){case _s.RIGHT_TO_LEFT:this.rightToLeft(t,e,i);break;case _s.TOP_TO_BOTTOM:this.topToBottom(t,e,i);break;case _s.BOTTOM_TO_TOP:this.bottomToTop(t,e,i);break;case _s.STROKE:this.strokePath(t,e,i);break;default:this.leftToRight(t,e,i)}}leftToRight(t,e,i){if(this.fill){const t=this.toFill;this.fillGradient.x0=0,this.fillGradient.y0=0,this.fillGradient.x1=1,this.fillGradient.y1=0,this.fillGradient.stops=[{offset:0,color:t},{offset:e,color:t},{offset:Math.min(1,2*e),color:"transparent"}],i.fill=this.fillGradient}if(this.stroke){const t=this.toStroke;this.strokeGradient.x0=0,this.strokeGradient.y0=0,this.strokeGradient.x1=1,this.strokeGradient.y1=0,this.strokeGradient.stops=[{offset:0,color:t},{offset:e,color:t},{offset:Math.min(1,6*e),color:"transparent"}],i.stroke=this.strokeGradient}}strokePath(t,e,i){if(this.fill){const t=this.toFill;this.fillGradient.x0=0,this.fillGradient.y0=0,this.fillGradient.x1=1,this.fillGradient.y1=0,this.fillGradient.stops=[{offset:0,color:t},{offset:e,color:t},{offset:Math.min(1,2*e),color:"transparent"}],i.fill=this.fillGradient}if(this.stroke){const t=300,n=e*t;i.lineDash=[n,t-n]}}rightToLeft(t,e,i){}topToBottom(t,e,i){}bottomToTop(t,e,i){}},t.FederatedEvent=Dr,t.FederatedMouseEvent=jr,t.FederatedPointerEvent=Ur,t.FederatedWheelEvent=Wr,t.FlexLayoutPlugin=bv,t.Fragment=Sy,t.GLYPH_NUMBER_TYPE=oo,t.GRAPHIC_UPDATE_TAG_KEY=Pa,t.GROUP_NUMBER_TYPE=lo,t.Generator=e,t.Gesture=class extends X{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,r,s,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=Gr.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t<e.length;t++){const{x:n,y:r}=e[t],s={x:n,y:r};i[t]=s}if(1!==i.length)this.startDistance=_y(i[0],i[1]),this.center=(t=>{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,r=0;for(;r<e;)i+=t[r].x,n+=t[r].y,r++;return{x:Math.round(i/e),y:Math.round(n/e)}})([i[0],i[1]]);else{const t=e[0];this.pressTimeout=setTimeout((()=>{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:r,y:s,pointerId:a}=n;for(let t=0,e=i.length;t<e;t++)if(a===i[t].pointerId){i[t]=n;break}const o={x:r,y:s},l=i.map((t=>({x:t.x,y:t.y}))),h=Gr.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=r-t.x,a=s-t.y,h=this.direction||Cy(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,u=_y(l[0],l[1]);n.scale=u/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,r=i.map((t=>({x:t.x,y:t.y})));if(e.points=r,this.triggerEndEvent(e),1===i.length){const i=Gr.now(),r=this.lastMoveTime;if(i-r<100){const t=r-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],r=this.lastMovePoint||n[0],s=_y(i,r),a=s/t;if(a>this.config.swipe.velocity&&s>this.config.swipe.threshold)return e.velocity=a,e.direction=Cy(i,r),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime<this.config.press.time&&(i-this.lastTapTime<this.config.tap.interval&&t.target===this.lastTapTarget?this.tapCount++:this.tapCount=1,this.lastTapTime=i,this.lastTapTarget=t.target,1===this.tapCount?this.triggerEvent("tap",e):2===this.tapCount&&(this.triggerEvent("doubletap",e),this.tapCount=0))}for(let t=0,r=i.length;t<r;t++)if(i[t].pointerId===e.pointerId){i.splice(t,1),n.splice(t,1);break}this.reset(),i.length>0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(s=null===(r=null==e?void 0:e.press)||void 0===r?void 0:r.threshold)&&void 0!==s?s:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if("press"===e)return e;let r;return r=Gr.now()-i>this.config.press.time&&_y(n[0],t)<this.config.press.threshold?"press":"pan",this.eventType=r,r}enable(t){this.processEvent[t]=!0}isProcess(t){return this.processEvent[t]}pushEvent(t,e){const{emitThrottles:i}=this,n={type:t,ev:e};for(let e=0,r=i.length;e<r;e++)if(i[e].type===t)return void i.splice(e,1,n);i.push(n)}clearPressTimeout(){this.pressTimeout&&(clearTimeout(this.pressTimeout),this.pressTimeout=null)}reset(){this.clearPressTimeout(),this.startTime=0,this.startDistance=0,this.direction=null,this.eventType=null,this.prevMoveTime=0,this.prevMovePoint=null,this.lastMoveTime=0,this.lastMovePoint=null}triggerEvent(t,e){this.pushEvent(t,e);const{throttleTimer:i,emitThrottles:n}=this;i||(this.throttleTimer=vn.global.getRequestAnimationFrame()((()=>{vn.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=n.length;t<e;t++){const{type:e,ev:i}=n[t];this.emitEvent(e,i)}this.emitThrottles.length=0})))}triggerStartEvent(t,e){this.isProcess(t)||(this.enable(t),this.triggerEvent(`${t}start`,e))}triggerEndEvent(t){const e=this.processEvent;Object.keys(e).forEach((i=>{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,r=i.length;n<r&&!e.propagationImmediatelyStopped;n++)i[n].fn.call(i[n].context,e,t);this.emit(t,e)}},t.GlobalPickerService=lu,t.Glyph=Wd,t.GlyphRender=Wc,t.Graphic=La,t.GraphicAnimate=class extends es{constructor(t,e,i,n,r){super(t,e,i,n,r),this.graphic=null==r?void 0:r.graphic}onUpdate(t,e,i){this.graphic&&Object.keys(this.from).forEach((t=>{i[t]=this.from[t]+(this.to[t]-this.from[t])*e}))}},t.GraphicCreator=wo,t.GraphicPicker=su,t.GraphicRender=Pc,t.GraphicService=xo,t.GraphicUtil=Eo,t.Group=Bo,t.GroupFadeIn=class extends es{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}},t.GroupFadeOut=class extends es{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}},t.GroupRender=Rc,t.GroupRenderContribution=sl,t.HtmlAttributePlugin=dv,t.IMAGE_NUMBER_TYPE=ho,t.Image=Hd,t.ImageRender=Nc,t.ImageRenderContribution=al,t.IncreaseCount=class extends es{constructor(t,e,i,n,r){super(t,e,i,n,r)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,r,s,a,o;this.fromNumber=ot(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=ot(null===(n=this.to)||void 0===n?void 0:n.text)?null===(r=this.to)||void 0===r?void 0:r.text:Number.parseFloat(null===(s=this.to)||void 0===s?void 0:s.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Gt(this.fromNumber),Gt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}},t.IncrementalDrawContribution=Ac,t.InputText=class extends es{constructor(){super(...arguments),this.fromText="",this.toText=""}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n;if(this.fromText=null!==(e=null===(t=this.from)||void 0===t?void 0:t.text)&&void 0!==e?e:"",this.toText=null!==(n=null===(i=this.to)||void 0===i?void 0:i.text)&&void 0!==n?n:"",!this.toText||st(this.toText))this.valid=!1;else{this.toText=this.toText.toString();const t=this.target.attachShadow(),e=vn.graphicService.creator.line({x:0,y:0,points:[{x:0,y:0},{x:0,y:this.target.getComputedAttribute("fontSize")}],stroke:"black",lineWidth:1});t.add(e)}}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){var n;if(!1===this.valid)return;const r=this.fromText.length,s=this.toText.length,a=Math.ceil(r+(s-r)*e);i.text=this.toText.substr(0,a);const o=null===(n=this.target.shadowRoot)||void 0===n?void 0:n.at(0),l=this.target.clipedWidth+2;o.setAttribute("x",l)}},t.InteractiveDrawItemInterceptorContribution=Zc,t.InteractiveSubRenderContribution=pl,t.LINE_NUMBER_TYPE=co,t.Layer=Ro,t.LayerService=ko,t.Line=Ed,t.LineRender=Mc,t.Linear=ui,t.LinearClosed=Ei,t.ManualTickHandler=Zr,t.ManualTicker=class extends Kr{set mode(t){this.setupTickHandler()}get mode(){return this._mode}initHandler(){return this.mode="manual",null}setupTickHandler(){const t=new Zr;return this._mode="manual",this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}tickAt(t){this.tickerHandler.tick(t-Math.max(this.lastFrameTime,0),(t=>{this.handleTick(t,{once:!0})}))}ifCanStop(){return!1}},t.Mat4Allocate=Rl,t.MathArcPicker=zm,t.MathAreaPicker=Hm,t.MathCirclePicker=Vm,t.MathGlyphPicker=Qm,t.MathImagePicker=Ym,t.MathLinePicker=Xm,t.MathPathPicker=$m,t.MathPickerContribution=Fm,t.MathPolygonPicker=Jm,t.MathRectPicker=qm,t.MathSymbolPicker=Km,t.MathTextPicker=Zm,t.MatrixAllocate=Pl,t.Meteor=class extends es{get lastPos(){return this.posList[this.posList.length-1]}constructor(t,e,i,n){super(null,null,e,i,n),this.size=t,this.posList=[]}onBind(){const e=this.target.attachShadow();this.root=e;for(let i=0;i<this.size;i++){const n=this.target.clone(),r=Math.min((this.size-i)/this.size*3,1),s=Math.min(.2+.7/this.size);n.setAttributes({x:0,y:0,dx:0,dy:0,scaleX:r,scaleY:r,opacity:s},!1,{type:t.AttributeUpdateType.ANIMATE_BIND}),e.add(n)}}onUpdate(t,e,i){if(t)return this.target.detachShadow(),void(this.posList.length=0);const n=this.target.getComputedAttribute("x"),r=this.target.getComputedAttribute("y"),s=new Ft(n,r);this.posList.length?(this.target.shadowRoot.forEachChildren(((t,e)=>{const i=this.posList[Math.max(this.posList.length-e-1,0)];t.setAttributes({x:i.x-n,y:i.y-r},!1)})),this.posList.push(s)):this.posList.push(s)}},t.MonotoneX=Si,t.MonotoneY=Ai,t.MorphingPath=ma,t.MotionPath=class extends es{constructor(t,e,i,n,r){var s;super(t,e,i,n,r),r&&(this.pathLength=r.path.getLength(),this.path=r.path,this.distance=r.distance,this.to=r.distance*this.pathLength,this.initAngle=null!==(s=r.initAngle)&&void 0!==s?s:0,this.changeAngle=!!r.changeAngle,this.cb=r.cb)}onUpdate(t,e,i){const n=this.to*e,{pos:r,angle:s}=this.path.getAttrAt(n);i.x=r.x,i.y=r.y,this.changeAngle&&(i.angle=s+this.initAngle),this.cb&&this.cb(this.from,this.to,e,this.target)}},t.MultiToOneMorphingPath=ba,t.NOWORK_ANIMATE_ATTR=Oa,t.Node=Ir,t.OrthoCamera=Mf,t.PATH_NUMBER_TYPE=uo,t.POLYGON_NUMBER_TYPE=po,t.PURE_STYLE_KEY=["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],t.PYRAMID3D_NUMBER_TYPE=fo,t.Path=Qd,t.PathRender=Ec,t.PathRenderContribution=ol,t.PickItemInterceptor=mp,t.PickerService=au,t.PluginService=wp,t.Polygon=cp,t.PolygonRender=kc,t.PolygonRenderContribution=ll,t.Pyramid3d=dp,t.Pyramid3dRender=Uc,t.RAFTickHandler=$r,t.REACT_TO_CANOPUS_EVENTS=my,t.REACT_TO_CANOPUS_EVENTS_LIST=yy,t.RECT3D_NUMBER_TYPE=vo,t.RECT_NUMBER_TYPE=go,t.RICHTEXT_NUMBER_TYPE=mo,t.RafBasedSTO=Ss,t.ReactAttributePlugin=fv,t.Rect=Ld,t.Rect3DRender=Lc,t.Rect3d=jd,t.RectRender=Oc,t.RectRenderContribution=hl,t.ReflectSegContext=li,t.RenderSelector=Gc,t.RenderService=iu,t.ResourceLoader=Ta,t.RichText=Kd,t.RichTextEditPlugin=class{constructor(){this.name="RichTextEditPlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.editing=!1,this.pointerDown=!1,this.handleInput=(t,e,i,n,r)=>{const s=this.getPointByColumnIdx(i,n,r);this.hideSelection(),this.setCursor(s.x,s.y1,s.y2),this.updateCbs.forEach((t=>t("input",this)))},this.handleChange=(t,e,i,n,r)=>{const s=this.getPointByColumnIdx(i,n,r);this.curCursorIdx=i,this.selectionStartCursorIdx=i,this.setCursorAndTextArea(s.x,s.y1,s.y2,n),this.hideSelection(),this.updateCbs.forEach((t=>t("change",this)))},this.handleMove=t=>{this.isRichtext(t)&&(this.currRt=t.target,this.handleEnter(t),t.target.once("pointerleave",this.handleLeave),this.showSelection(t))},this.handlePointerDown=t=>{this.editing?this.onFocus(t):this.deFocus(t),this.applyUpdate(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.handleEnter=t=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=t=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.commandCbs=new Map,this.commandCbs.set(Nf,[this.formatTextCommandCb]),this.updateCbs=[]}getSelection(){return this.selectionStartCursorIdx&&this.curCursorIdx&&this.selectionStartCursorIdx!==this.curCursorIdx&&this.currRt?new Wf(this.selectionStartCursorIdx,this.curCursorIdx,jf(this.currRt.attribute.textConfig,this.selectionStartCursorIdx),jf(this.currRt.attribute.textConfig,this.curCursorIdx),this.currRt):null}formatTextCommandCb(t,e){const i=e.currRt;if(!i)return;const n=e.getSelection();if(!n)return;const{selectionStartCursorIdx:r,curCursorIdx:s}=n,a=i.attribute.textConfig.slice(r+1,s+1);"bold"===t?a.forEach((t=>t.fontWeight="bold")):"italic"===t?a.forEach((t=>t.fontStyle="italic")):"underline"===t?a.forEach((t=>t.underline=!0)):"lineThrough"===t?a.forEach((t=>t.lineThrough=!0)):Q(t)&&a.forEach((e=>function(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)pt(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}(e,t))),i.setAttributes(i.attribute)}dispatchCommand(t,e){const i=this.commandCbs.get(t);i&&i.forEach((t=>t(e,this))),this.updateCbs.forEach((t=>t("dispatch",this)))}registerCommand(t,e){(this.commandCbs.get(t)||[]).push(e)}registerUpdateListener(t){(this.updateCbs||[]).push(t)}activate(t){this.pluginService=t,this.editModule=new Uf,t.stage.on("pointermove",this.handleMove),t.stage.on("pointerdown",this.handlePointerDown),t.stage.on("pointerup",this.handlePointerUp),t.stage.on("pointerleave",this.handlePointerUp),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange)}showSelection(t){const e=t.target.getFrameCache();if(e&&this.editBg&&this.pointerDown){let i=this.lastPoint,n=this.getEventPosition(t),r=this.getLineByPoint(e,n);const s=this.getColumnByLinePoint(r,n),a=r.top,o=r.top+r.height;let l=s.left+s.width,h=this.getColumnIndex(e,s);n.x<s.left+s.width/2&&(l=s.left,h-=1),n.x=l,n.y=(a+o)/2;let c=this.getLineByPoint(e,i);if((i.y>n.y||i.y===n.y&&i.x>n.x)&&([i,n]=[n,i],[r,c]=[c,r]),this.editBg.removeAllChild(),c===r){const t=this.getColumnByLinePoint(c,i);this.editBg.setAttributes({x:i.x,y:c.top,width:n.x-i.x,height:t.height,fill:"#336df4",fillOpacity:.2})}else{this.editBg.setAttributes({x:0,y:c.top,width:0,height:0});const t=e.lines.findIndex((t=>t===c)),s=e.lines.findIndex((t=>t===r));let a=0;for(let r=t;r<=s;r++){const o=e.lines[r];if(r===t){const t=o.paragraphs[o.paragraphs.length-1];this.editBg.add(Id({x:i.x,y:a,width:t.left+t.width-i.x,height:o.height,fill:"#336df4",fillOpacity:.2}))}else if(r===s){const t=o.paragraphs[0];this.editBg.add(Id({x:t.left,y:a,width:n.x-t.left,height:o.height,fill:"#336df4",fillOpacity:.2}))}else{const t=o.paragraphs[0],e=o.paragraphs[o.paragraphs.length-1];this.editBg.add(Id({x:t.left,y:a,width:e.left+e.width-t.left,height:o.height,fill:"#336df4",fillOpacity:.2}))}a+=o.height}}this.curCursorIdx=h,this.setCursorAndTextArea(l,a+2,o-2,t.target),this.applyUpdate(),this.updateCbs.forEach((t=>t("selection",this)))}}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}isRichtext(t){return!(!t.target||"richtext"!==t.target.type||!t.target.attribute.editable)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};return t.target.globalTransMatrix.transformPoint(e,i),i}getLineByPoint(t,e){let i=t.lines[0];for(let n=0;n<t.lines.length&&!(i.top<=e.y&&i.top+i.height>=e.y);n++)i=t.lines[n+1];return i}getColumnByLinePoint(t,e){let i=t.paragraphs[0];for(let n=0;n<t.paragraphs.length&&!(i.left<=e.x&&i.left+i.width>=e.x);n++)i=t.paragraphs[n];return i}onFocus(t){this.deFocus(t);const e=t.target;this.tryUpdateRichtext(e);const i=e.attachShadow();i.setAttributes({shadowRootIdx:-1});const n=e.getFrameCache();if(!n)return;if(!this.editLine){const t=kd({x:0,y:0,lineWidth:1,stroke:"black"});t.animate().to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0),this.editLine=t;const e=Po({x:0,y:0,width:0,height:0});this.editBg=e,i.add(this.editLine),i.add(this.editBg)}const r=this.getEventPosition(t),s=this.getLineByPoint(n,r);if(s){const t=this.getColumnByLinePoint(s,r);if(!t)return;let i=s.top,a=s.top+s.height,o=t.left+t.width;i+=2,a-=2;let l=this.getColumnIndex(n,t);r.x<t.left+t.width/2&&(o=t.left,l-=1),this.lastPoint={x:o,y:(i+a)/2},this.curCursorIdx=l,this.selectionStartCursorIdx=l,this.setCursorAndTextArea(o,i,a,e)}}getPointByColumnIdx(t,e,i){const n=e.getFrameCache(),{lineInfo:r,columnInfo:s}=this.getColumnByIndex(n,t);let a=r.top,o=r.top+r.height;return a+=2,o-=2,{x:s.left+("left"===i?0:s.width),y1:a,y2:o}}getColumnIndex(t,e){let i=-1;for(let n=0;n<t.lines.length;n++){const r=t.lines[n];for(let t=0;t<r.paragraphs.length;t++)if(i++,e===r.paragraphs[t])return i}return-1}getColumnByIndex(t,e){let i=-1;for(let n=0;n<t.lines.length;n++){const r=t.lines[n];for(let t=0;t<r.paragraphs.length;t++){const n=r.paragraphs[t];if(i++,i===e)return{lineInfo:r,columnInfo:n}}}return null}setCursorAndTextArea(t,e,i,n){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]});const r={x:0,y:0};n.globalTransMatrix.getInverse().transformPoint({x:t,y:e},r);const{left:s,top:a}=this.pluginService.stage.window.getBoundingClientRect();r.x+=s,r.y+=a,this.editModule.moveTo(r.x,r.y,n,this.curCursorIdx,this.selectionStartCursorIdx)}setCursor(t,e,i){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]})}applyUpdate(){this.pluginService.stage.renderNextFrame()}deFocus(t){const e=this.currRt;e&&(e.detachShadow(),this.currRt=null,this.editLine&&(this.editLine.parent.removeChild(this.editLine),this.editLine.release(),this.editLine=null,this.editBg.parent.removeChild(this.editBg),this.editBg.release(),this.editBg=null))}splitText(t){return Array.from(t)}tryUpdateRichtext(t){if(!t.getFrameCache().lines.every((t=>t.paragraphs.every((t=>!(t.text&&rt(t.text)&&this.splitText(t.text).length>1)))))){const e=[];t.attribute.textConfig.forEach((t=>{const i=this.splitText(t.text.toString());if(rt(t.text)&&i.length>1)for(let n=0;n<i.length;n++){const r=i[n];e.push(Object.assign(Object.assign({},t),{text:r}))}else e.push(t)})),t.setAttributes({textConfig:e}),t.doUpdateFrameCache(e)}}onSelect(){}deactivate(t){t.stage.off("pointermove",this.handleMove),t.stage.off("pointerdown",this.handlePointerDown),t.stage.off("pointerup",this.handlePointerUp),t.stage.off("pointerleave",this.handlePointerUp)}release(){this.editModule.release()}},t.RichTextRender=jc,t.RotateBySphereAnimate=class extends es{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),r=this.target.getComputedAttribute("z"),s=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(s));r-t.z<0&&(a=Rt-a),this.theta=a,this.phi=s}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:r,cb:s}="function"==typeof this.params?this.params():this.params,a=2*Math.PI*e,o=this.theta+a,l=this.phi,h=r*Math.sin(l)*Math.cos(o)+n.x,c=r*Math.cos(l)+n.y,u=r*Math.sin(l)*Math.sin(o)+n.z;for(i.x=h,i.y=c,i.z=u,i.alpha=o+_t/2;i.alpha>Rt;)i.alpha-=Rt;i.alpha=Rt-i.alpha,i.zIndex=-1e4*i.z,s&&s(i)}},t.SVG_ATTRIBUTE_MAP=So,t.SVG_ATTRIBUTE_MAP_KEYS=Ao,t.SVG_PARSE_ATTRIBUTE_MAP=To,t.SVG_PARSE_ATTRIBUTE_MAP_KEYS=Co,t.SYMBOL_NUMBER_TYPE=yo,t.SegContext=oi,t.ShadowRoot=fp,t.ShadowRootDrawItemInterceptorContribution=qc,t.Stage=yf,t.StaticLayerHandlerContribution=Oo,t.Step=Pi,t.StreamLight=class extends es{constructor(t,e,i,n,r){super(t,e,i,n,r)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),n=vn.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=n,n.pathProxy=new Wi,i.add(n)}onStartRect(){var t,e,i;const n=this.target.attachShadow(),r=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,s=r?"height":"width",a=r?"width":"height",o=this.target.AABBBounds[s](),l=r?0:this.target.AABBBounds.y1,h=vn.graphicService.creator.rect(Object.assign(Object.assign({[s]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,n.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(e,i,n){var r,s,a,o,l,h,c,u,d,p,f,g,v,m,y,b;const x=null===(s=null===(r=this.params)||void 0===r?void 0:r.isHorizontal)||void 0===s||s,w=this.target.attribute;if(x){const n=null!==(o=null!==(a=w.width)&&void 0!==a?a:Math.abs(w.x1-w.x))&&void 0!==o?o:250,r=null!==(h=null===(l=this.params)||void 0===l?void 0:l.streamLength)&&void 0!==h?h:n,s=null!==(d=null===(u=null===(c=this.params)||void 0===c?void 0:c.attribute)||void 0===u?void 0:u.width)&&void 0!==d?d:60,p=-s,f=p+(r-p)*i,g=Math.max(f,0),v=Math.min(Math.min(f+s,s),r-f),m=v+g>n?Math.max(n-g,0):v;this.rect.setAttributes({x:g,width:m,dx:Math.min(w.x1-w.x,0)},!1,{type:t.AttributeUpdateType.ANIMATE_PLAY,animationState:{ratio:i,end:e}})}else{const n=null!==(f=null!==(p=w.height)&&void 0!==p?p:Math.abs(w.y1-w.y))&&void 0!==f?f:250,r=null!==(v=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==v?v:n,s=null!==(b=null===(y=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===y?void 0:y.height)&&void 0!==b?b:60,a=n-(r+s)*i;let o=Math.min(a,n);const l=Math.min(n-a,s);let h;o<=0?(h=Math.max(o+l,0),o=0):h=l,this.rect.setAttributes({y:o,height:h,dy:Math.min(w.y1-w.y,0)},!1,{type:t.AttributeUpdateType.ANIMATE_PLAY,animationState:{ratio:i,end:e}})}}onUpdateLineOrArea(t,e,i){const n=this.line||this.area;if(!n)return;const r=n.pathProxy,s=this.target;s.cache||s.cacheArea?this._onUpdateLineOrAreaWithCache(r,s,t,e,i):this._onUpdateLineWithoutCache(r,s,t,e,i);const a=s.attribute;n.setAttributes(Object.assign({stroke:a.stroke},n.attribute)),n.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,n,r){var s,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const r=i.reduce(((t,e)=>t+e.getLength()),0),s=[];return i.forEach((t=>{t.curves.forEach((t=>s.push(t)))})),this._updateCurves(t,s,r,n)}if("area"===e.type&&(null===(a=null===(s=e.cacheArea)||void 0===s?void 0:s.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,r=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,r,n)}}_updateCurves(t,e,i,n){var r,s;const a=i*n,o=Math.min(null!==(s=a+(null===(r=this.params)||void 0===r?void 0:r.streamLength))&&void 0!==s?s:10,i);let l=0,h=!1;for(let i=0;i<e.length;i++)if(!1!==e[i].defined){const n=e[i],r=n.getLength(),s=1-(l+r-a)/r;let c,u=1-(l+r-o)/r;if(l<a&&l+r>a)if(h=!0,n.p2&&n.p3){const[e,i]=ni(n,s);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=n.getPointAt(s);t.moveTo(e.x,e.y)}if(l<o&&l+r>o){if(n.p2&&n.p3){c&&(u=(o-a)/c.getLength());const[e]=ni(c||n,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=n.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(n.p2&&n.p3){const e=c||n;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(n.p1.x,n.p1.y);l+=r}}_onUpdateLineWithoutCache(t,e,i,n,r){var s,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;t<o.length;t++)h+=zt.distancePP(o[t],o[t-1]);const c=h*n,u=Math.min(null!==(a=c+(null===(s=this.params)||void 0===s?void 0:s.streamLength))&&void 0!==a?a:10,h),d=[];let p=0;for(let t=1;t<o.length;t++){const e=zt.distancePP(o[t],o[t-1]);if(p<c&&p+e>c&&d.push(zt.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),p<u&&p+e>u){d.push(zt.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;e<d.length;e++)t.lineTo(d[e].x,d[e].y)}}},t.SubAnimate=rs,t.Symbol=Pd,t.SymbolRender=Ic,t.SymbolRenderContribution=cl,t.TEXT_NUMBER_TYPE=bo,t.TagPointsUpdate=class extends es{constructor(t,e,i,n,r){var s,a;super(t,e,i,n,r),this.newPointAnimateType=null!==(s=null==r?void 0:r.newPointAnimateType)&&void 0!==s?s:"grow",this.clipRangeByDimension=null!==(a=null==r?void 0:r.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var n,r;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(r=null===(n=t.points)||void 0===n?void 0:n.length)&&void 0!==r?r:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let n,r,s=1/0,a=-1/0;for(let t=0;t<this.toPoints.length;t+=1)if(i.has(this.toPoints[t].context)){s=t,n=i.get(this.toPoints[t].context);break}for(let t=this.toPoints.length-1;t>=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,r=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[a][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),lt(this.clipRange)?this.clipRange=Tt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:e<s&&n?[n,t]:e>a&&r?[r,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ft(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onFirstRun(){const t=this.target.attribute.clipRange;lt(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const n=ms(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));i.clipRange=this.clipRange+(1-this.clipRange)*e}if(this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const n=t+this.segmentsCache[i],r=this.points.slice(t,n);return t=n,Object.assign(Object.assign({},e),{points:r})}))}else i.points=this.points}},t.Text=gu,t.TextMeasureContribution=In,t.TextRender=Dc,t.TextRenderContribution=ul,t.Theme=Mr,t.TimeOutTickHandler=qr,t.TransformUtil=Mo,t.VArc=function(t){return Qh.arc(t?t.attribute:{})},t.VArc3d=function(t){return Qh.arc3d(t?t.attribute:{})},t.VArea=function(t){return Qh.area(t?t.attribute:{})},t.VCircle=function(t){return Qh.circle(t?t.attribute:{})},t.VGlobal=W,t.VGlyph=function(t){return Qh.glyph(t?t.attribute:{})},t.VGroup=function(t){return Qh.group(t?t.attribute:{})},t.VImage=function(t){return Qh.image(t?t.attribute:{})},t.VLine=function(t){return Qh.line(t?t.attribute:{})},t.VPath=function(t){return Qh.path(t?t.attribute:{})},t.VPolygon=function(t){return Qh.polygon(t?t.attribute:{})},t.VPyramid3d=function(t){return Qh.pyramid3d(t?t.attribute:{})},t.VRect=function(t){return Qh.rect(t?t.attribute:{})},t.VRect3d=function(t){return Qh.rect3d(t?t.attribute:{})},t.VRichText=by,t.VSymbol=function(t){return Qh.symbol(t?t.attribute:{})},t.VText=function(t){return Qh.text(t?t.attribute:{})},t.VWindow=yr,t.ViewTransform3dPlugin=vv,t.VirtualLayerHandlerContribution=Io,t.WILDCARD="*",t.WindowHandlerContribution=br,t.WrapText=yu,t.XMLParser=Ha,t._calculateLineHeight=Ts,t._interpolateColor=ra,t._registerArc=wT,t.addArcToBezierPath=qe,t.addAttributeToPrototype=function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},t.alignBezierCurves=Is,t.alignSubpath=Rs,t.application=vn,t.applyTransformOnBezierCurves=Us,t.arc3dCanvasPickModule=pT,t.arc3dModule=zg,t.arcCanvasPickModule=zS,t.arcMathPickModule=_b,t.arcModule=og,t.areaCanvasPickModule=lA,t.areaMathPickModule=kb,t.areaModule=pg,t.bezier=Xe,t.bezierCurversToPath=Ws,t.binarySplitPolygon=Ks,t.bindContributionProvider=L,t.bindContributionProviderNoSingletonScope=I,t.boundStroke=$a,t.browserEnvModule=eb,t.builtInSymbolStrMap=Cd,t.builtinSymbols=Ad,t.builtinSymbolsMap=Td,t.calcLineCache=Ui,t.calculateArcCornerRadius=qo,t.calculateLineHeight=Cs,t.canvasAllocate=gr,t.centroidOfSubpath=ks,t.circleBounds=gs,t.circleCanvasPickModule=wA,t.circleMathPickModule=Ub,t.circleModule=mg,t.clock=Gr,t.cloneGraphic=Sa,t.colorEqual=function(t,e){const i=Se.parseColorString(t),n=Se.parseColorString(e);return!(!i||!n)&&i.r===n.r&&i.g===n.g&&i.b===n.b&&i.opacity===n.opacity},t.colorStringInterpolationToStr=ua,t.container=Dn,t.cornerTangents=$o,t.createArc=ap,t.createArc3d=lp,t.createArea=np,t.createCircle=du,t.createColor=xn,t.createConicalGradient=el,t.createGlyph=Nd,t.createGroup=Po,t.createImage=Vd,t.createImageElement=tb,t.createLine=kd,t.createMat4=Ml,t.createPath=tp,t.createPolygon=up,t.createPyramid3d=pp,t.createRect=Id,t.createRect3d=Ud,t.createRectPath=ah,t.createRichText=Zd,t.createShadowRoot=gp,t.createStage=function(t){return new yf(t)},t.createSymbol=Rd,t.createText=vu,t.createWrapText=bu,t.cubicCalc=ei,t.cubicLength=ti,t.cubicPointAt=ii,t.cubicSubdivide=Ps,t.decodeReactDom=Ay,t.defaultArcAllocate=Vf,t.defaultArcBackgroundRenderContribution=Jl,t.defaultArcRenderContribution=Kl,t.defaultArcTextureRenderContribution=Zl,t.defaultAreaAllocate=Xf,t.defaultBaseBackgroundRenderContribution=Yl,t.defaultBaseTextureRenderContribution=$l,t.defaultCircleAllocate=qf,t.defaultCircleBackgroundRenderContribution=ih,t.defaultCircleRenderContribution=th,t.defaultCircleTextureRenderContribution=eh,t.defaultGraphicMemoryManager=sg,t.defaultGroupBackgroundRenderContribution=rh,t.defaultImageBackgroundRenderContribution=gh,t.defaultImageRenderContribution=fh,t.defaultLineAllocate=Zf,t.defaultPathAllocate=Qf,t.defaultRectAllocate=zf,t.defaultRectBackgroundRenderContribution=uh,t.defaultRectRenderContribution=hh,t.defaultRectTextureRenderContribution=ch,t.defaultSymbolAllocate=eg,t.defaultSymbolBackgroundRenderContribution=bh,t.defaultSymbolRenderContribution=mh,t.defaultSymbolTextureRenderContribution=yh,t.defaultTextAllocate=ng,t.defaultTicker=uf,t.defaultTimeline=ts,t.drawArc=$e,t.drawArcPath=Ko,t.drawAreaSegments=Oh,t.drawIncrementalAreaSegments=Eh,t.drawIncrementalSegments=Mh,t.drawPathProxy=Yo,t.drawSegments=Rh,t.enumCommandMap=Me,t.feishuEnvModule=Fx,t.fillVisible=Fo,t.findBestMorphingRotation=Ls,t.findNextGraphic=jp,t.flatten_simplify=function(t,e,i){return t.length<=10||i?t:function(t,e){let i,n,r=t[0].x,s=t[0].y;const a=[t[0]];for(let o=1,l=t.length;o<l;o++)i=t[o].x-r,n=t[o].y-s,i*i+n*n>e&&(r=t[o].x,s=t[o].y,a.push(t[o]));return t[t.length-1].x===r&&t[t.length-1].y===s||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)},t.foreach=Ip,t.foreachAsync=Dp,t.genBasisSegments=mi,t.genBasisTypeSegments=vi,t.genLinearClosedSegments=ki,t.genLinearClosedTypeSegments=Oi,t.genLinearSegments=di,t.genLinearTypeSegments=pi,t.genMonotoneXSegments=Ci,t.genMonotoneXTypeSegments=Ti,t.genMonotoneYSegments=Bi,t.genMonotoneYTypeSegments=_i,t.genNumberType=Ka,t.genStepSegments=Ri,t.genStepTypeSegments=Mi,t.getAttributeFromDefaultAttrList=ws,t.getConicGradientAt=tl,t.getCurrentEnv=function(){return ff()?"browser":"node"},t.getExtraModelMatrix=function(t,e,i){const{alpha:n,beta:r}=i.attribute;if(!n&&!r)return null;const{anchor3d:s=i.attribute.anchor}=i.attribute,a=[0,0];if(s){if("string"==typeof s[0]){const t=parseFloat(s[0])/100,e=i.AABBBounds;a[0]=e.x1+(e.x2-e.x1)*t}else a[0]=s[0];if("string"==typeof s[1]){const t=parseFloat(s[1])/100,e=i.AABBBounds;a[1]=e.x1+(e.x2-e.x1)*t}else a[1]=s[1]}if("text"===i.type){const{textAlign:t}=i.attribute;a[0]+=fl(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Ll.allocate();return wl(o,o,[a[0],a[1],0]),r&&yl(o,o,r),n&&bl(o,o,n),wl(o,o,[-a[0],-a[1],0]),o},t.getModelMatrix=Ul,t.getRichTextBounds=function(t){return ec||(ec=Qh.CreateGraphic("richtext",{})),ec.setAttributes(t),ec.AABBBounds},t.getScaledStroke=bn,t.getTextBounds=ic,t.getTheme=kr,t.getThemeFromGroup=Or,t.globalTheme=Er,t.glyphCanvasPickModule=VA,t.glyphMathPickModule=Vb,t.glyphModule=Bg,t.graphicCreator=Qh,t.graphicService=rf,t.graphicUtil=ef,t.harmonyEnvModule=DS,t.identityMat4=ml,t.imageCanvasPickModule=eT,t.imageMathPickModule=qb,t.imageModule=Lg,t.incrementalAddTo=function(t,e){t.incrementalAppendChild(e)},t.initAllEnv=function(){iS(Dn)},t.initBrowserEnv=function(){ib(Dn)},t.initFeishuEnv=function(){zx(Dn)},t.initHarmonyEnv=function(){jS(Dn)},t.initLynxEnv=function(){aw(Dn)},t.initNodeEnv=function(){Sw(Dn)},t.initTTEnv=function(){xS(Dn)},t.initTaroEnv=function(){Uw(Dn)},t.initWxEnv=function(){eS(Dn)},t.inject=p,t.injectable=g,t.interpolateColor=na,t.interpolateGradientConicalColor=oa,t.interpolateGradientLinearColor=sa,t.interpolateGradientRadialColor=aa,t.interpolatePureColorArray=la,t.intersect=Xo,t.isBrowserEnv=ff,t.isNodeEnv=gf,t.isSvg=Va,t.isTransformKey=xs,t.isXML=Ya,t.jsx=function(t,e){const i=e||{},{key:n,name:r,id:s,attribute:a,stateProxy:o}=i,l=xy(i,["key","name","id","attribute","stateProxy"]);let h=t;rt(t)&&(h=Qh[t]);const c=[];for(var u=arguments.length,d=new Array(u>2?u-2:0),p=2;p<u;p++)d[p-2]=arguments[p];d.length&&wy(1===d.length?d[0]:d,c);const f="Group"===h.name?new h(a):h(e);return function(t,e,i){let n,r=!1;switch(t.type){case"richtext":case"rich/image":break;case"rich/text":n=t.attribute||{},e[0]&&(n.text=e[0]);break;default:r=!0}r?(e.forEach((e=>{e&&t.add(e)})),Object.keys(i).forEach((e=>{const n=my[e];n&&t.on(n,i[e])}))):"richtext"===t.type&&(t.attribute.textConfig=e.map((t=>t.attribute)).filter((t=>t)))}(f,c,l),o&&(f.stateProxy=o),f},t.layerService=sf,t.lineCanvasPickModule=iA,t.lineMathPickModule=ex,t.lineModule=ug,t.loadAllEnv=iS,t.loadAllModule=nS,t.loadBrowserEnv=ib,t.loadFeishuEnv=zx,t.loadHarmonyEnv=jS,t.loadLynxEnv=aw,t.loadNodeEnv=Sw,t.loadTTEnv=xS,t.loadTaroEnv=Uw,t.loadWxEnv=eS,t.lookAt=Cl,t.lynxEnvModule=sw,t.mat3Tomat4=Sl,t.mat4Allocate=Ll,t.matrixAllocate=Ol,t.morphPath=ya,t.multiInject=f,t.multiToOneMorph=(e,i,n)=>{var r,s,a;const o=e.filter((t=>t.toCustomPath&&t.valid));o.length||__DEV__&&console.error(e," is not validate"),i.valid&&i.toCustomPath||__DEV__&&console.error(i," is not validate");const l=("clone"===(null==n?void 0:n.splitPath)?Sa:null!==(r=null==n?void 0:n.splitPath)&&void 0!==r?r:Aa)(i,o.length,!0),h=i.attribute;i.setAttribute("visible",!1);const c=o.map(((t,e)=>fa(t.toCustomPath(),l[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:l[e].globalTransMatrix}))),u=o.map(((t,e)=>va(t.attribute,h)));if(null==n?void 0:n.individualDelay){const r=n.onEnd;let s=o.length;const a=()=>{s--,0===s&&(i.setAttributes({visible:!0,ratio:null},!1,{type:t.AttributeUpdateType.ANIMATE_END}),i.detachShadow(),r&&r())};l.forEach(((t,i)=>{var r,s,l;const h=(null!==(r=n.delay)&&void 0!==r?r:0)+n.individualDelay(i,o.length,e[i],t),d=t.animate(Object.assign({},n,{onEnd:a}));d.wait(h),d.play(new ma({morphingData:c[i],saveOnEnd:!0,otherAttrs:u[i]},null!==(s=n.duration)&&void 0!==s?s:os.duration,null!==(l=n.easing)&&void 0!==l?l:os.easing))}))}else{const e=null==n?void 0:n.onEnd,r=n?Object.assign({},n):{};r.onEnd=()=>{i.setAttribute("visible",!0,!1,{type:t.AttributeUpdateType.ANIMATE_END}),i.detachShadow(),e&&e()};const o=i.animate(r);(null==n?void 0:n.delay)&&o.wait(n.delay),o.play(new ba({morphingData:c,otherAttrs:u},null!==(s=null==n?void 0:n.duration)&&void 0!==s?s:os.duration,null!==(a=null==n?void 0:n.easing)&&void 0!==a?a:os.easing))}},t.multiplyMat4Mat3=function(t,e,i){const n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],u=e[8],d=e[9],p=e[10],f=e[11],g=e[12],v=e[13],m=e[14],y=e[15];let b=i.a,x=i.b,w=0,S=0;return t[0]=b*n+x*o+w*u+S*g,t[1]=b*r+x*l+w*d+S*v,t[2]=b*s+x*h+w*p+S*m,t[3]=b*a+x*c+w*f+S*y,b=i.c,x=i.d,w=0,S=0,t[4]=b*n+x*o+w*u+S*g,t[5]=b*r+x*l+w*d+S*v,t[6]=b*s+x*h+w*p+S*m,t[7]=b*a+x*c+w*f+S*y,b=0,x=0,w=1,S=0,t[8]=b*n+x*o+w*u+S*g,t[9]=b*r+x*l+w*d+S*v,t[10]=b*s+x*h+w*p+S*m,t[11]=b*a+x*c+w*f+S*y,b=i.e,x=i.f,w=0,S=1,t[12]=b*n+x*o+w*u+S*g,t[13]=b*r+x*l+w*d+S*v,t[14]=b*s+x*h+w*p+S*m,t[15]=b*a+x*c+w*f+S*y,t},t.multiplyMat4Mat4=Tl,t.named=v,t.newThemeObj=Br,t.nodeEnvModule=ww,t.oneToMultiMorph=(t,e,i)=>{var n;const r=e.filter((t=>t&&t.toCustomPath&&t.valid));r.length||__DEV__&&console.error(r," is not validate"),t.valid&&t.toCustomPath||__DEV__&&console.error(t," is not validate");const s=("clone"===(null==i?void 0:i.splitPath)?Sa:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:Aa)(t,r.length,!1),a=null==i?void 0:i.onEnd;let o=r.length;const l=()=>{o--,0===o&&a&&a()};r.forEach(((e,n)=>{var a;const o=s[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,r.length,o,e):0);ya(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))},t.ortho=_l,t.parsePadding=ds,t.parseStroke=cs,t.parseSvgPath=je,t.pathCanvasPickModule=OA,t.pathMathPickModule=px,t.pathModule=wg,t.pathToBezierCurves=js,t.point=fi,t.pointEqual=vs,t.pointInterpolation=ms,t.pointInterpolationHighPerformance=function(t,e,i,n){const{x:r,y:s}=Wt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Wt(t.x1,t.y1,e.x1,e.y1,i);return n.x=r,n.y=s,n.x1=a,n.y1=o,n.defined=e.defined,n},t.pointsEqual=function(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>vs(t,e[i]))):!Number.isNaN(t.x+t.y)&&vs(t,e))},t.pointsInterpolation=ys,t.polygonCanvasPickModule=WA,t.polygonMathPickModule=ox,t.polygonModule=Ag,t.preLoadAllModule=Qp,t.pyramid3dCanvasPickModule=bT,t.pyramid3dModule=Xg,t.rafBasedSto=As,t.rect3dCanvasPickModule=oT,t.rect3dModule=Wg,t.rectCanvasPickModule=qS,t.rectFillVisible=zo,t.rectMathPickModule=Sx,t.rectModule=hg,t.rectStrokeVisible=Vo,t.recursiveCallBinarySplit=Zs,t.registerArc=ST,t.registerArc3d=TT,t.registerArc3dGraphic=qg,t.registerArcGraphic=$g,t.registerArea=_T,t.registerAreaGraphic=Kg,t.registerCircle=PT,t.registerCircleGraphic=Zg,t.registerDirectionalLight=Rf,t.registerFlexLayoutPlugin=xv,t.registerGlyph=MT,t.registerGlyphGraphic=Jg,t.registerGroup=kT,t.registerGroupGraphic=Qg,t.registerHtmlAttributePlugin=pv,t.registerImage=LT,t.registerImageGraphic=tv,t.registerLine=DT,t.registerLineGraphic=ev,t.registerOrthoCamera=Ef,t.registerPath=UT,t.registerPathGraphic=iv,t.registerPolygon=NT,t.registerPolygonGraphic=nv,t.registerPyramid3d=FT,t.registerPyramid3dGraphic=rv,t.registerReactAttributePlugin=gv,t.registerRect=HT,t.registerRect3d=YT,t.registerRect3dGraphic=av,t.registerRectGraphic=sv,t.registerRichtext=$T,t.registerRichtextGraphic=ov,t.registerShadowRoot=KT,t.registerShadowRootGraphic=cv,t.registerSymbol=JT,t.registerSymbolGraphic=lv,t.registerText=tC,t.registerTextGraphic=hv,t.registerViewTransform3dPlugin=mv,t.registerWrapText=iC,t.registerWrapTextGraphic=uv,t.renderCommandList=Ze,t.rewriteProto=function(t,e){Object.setPrototypeOf(t,e)},t.richTextMathPickModule=Tx,t.richtextCanvasPickModule=ZA,t.richtextModule=kg,t.rotateX=yl,t.rotateY=bl,t.rotateZ=xl,t.roughModule=nC,t.runFill=No,t.runStroke=Go,t.scaleMat4=Al,t.segments=Ye,t.shouldUseMat4=Wl,t.snapLength=Qe,t.splitArc=zs,t.splitArea=Ys,t.splitCircle=Hs,t.splitGraphic=Aa,t.splitLine=Xs,t.splitPath=Qs,t.splitPolygon=Js,t.splitRect=Fs,t.splitToGrids=Gs,t.strCommandMap=["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],t.strokeVisible=Ho,t.symbolCanvasPickModule=gA,t.symbolMathPickModule=Mx,t.symbolModule=gg,t.taroEnvModule=jw,t.textAttributesToStyle=vl,t.textCanvasPickModule=BA,t.textDrawOffsetX=fl,t.textDrawOffsetY=function(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0},t.textLayoutOffsetY=gl,t.textMathPickModule=Lx,t.textModule=bg,t.transformKeys=bs,t.transformMat4=Bl,t.transformUtil=nf,t.translate=wl,t.ttEnvModule=bS,t.version="0.21.2-alpha.1",t.verticalLayout=Ja,t.vglobal=tf,t.waitForAllSubLayers=function(t){return Xa(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{vn.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))},t.wrapCanvas=Wn,t.wrapContext=function(t,e){return Dn.getNamed(Un,vn.global.env)(t,e)},t.wxEnvModule=tS,t.xul=function(t){const e=st(t)?t[0]:t,i=[];if(!e)return i;if(!0===Ya(e)){const t=(new Ha).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};io(t,e);const i=t["#text"];return i&&(e.text=i),e}(t.tc[e])):i.push(function(t){const e={image:"",width:0,height:0};io(t,e);const i=e.image;return i&&(e.image=i.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">")),e}(t.tc[e]))}))}return i}}));
|