@visactor/vrender 0.21.5-vstory.1 → 0.21.5

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/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(exports){"use strict";class Generator{static GenAutoIncrementId(){return Generator.auto_increment_id++}}Generator.auto_increment_id=0;class ContainerModule{constructor(t){this.id=Generator.GenAutoIncrementId(),this.registry=t}}const NAMED_TAG="named",INJECT_TAG="inject",MULTI_INJECT_TAG="multi_inject",TAGGED="inversify:tagged",PARAM_TYPES="inversify:paramtypes";class Metadata{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===NAMED_TAG?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Reflect$1=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),r=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function a(t,e,i){let a=n.get(t);if(h(a)){if(!i)return;a=new r,n.set(t,a)}let s=a.get(e);if(h(s)){if(!i)return;s=new r,a.set(e,s)}return s}function s(t,e,i){if(o(t,e,i))return!0;const r=m(e);return!c(r)&&s(t,r,i)}function o(t,e,i){const r=a(e,i,!1);return!h(r)&&!!r.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const r=a(e,i,!1);if(!h(r))return r.get(t)}(t,e,i);const r=m(e);return c(r)?void 0:l(t,r,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 r=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!f(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,r);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"===r?"number":r)}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 m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const r=t.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return e;const a=n.constructor;return"function"!=typeof a||a===t?e:a}t("defineMetadata",(function(t,e,i,r){if(!u(i))throw new TypeError;return function(t,e,i,r){a(i,r,!0).set(t,e)}(t,e,i,r)})),t("hasMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),s(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 _tagParameterOrProperty(t,e,i,r){const n=[r];let a={};Reflect$1.hasOwnMetadata(t,e)&&(a=Reflect$1.getMetadata(t,e));let s=a[i];void 0===s&&(s=[]),s.push(...n),a[i]=s,Reflect$1.defineMetadata(t,a,e)}function tagParameter(t,e,i,r){_tagParameterOrProperty(TAGGED,t,i.toString(),r)}function createTaggedDecorator(t){return(e,i,r)=>{tagParameter(e,i,r,t)}}function injectBase(t){return e=>(i,r,n)=>createTaggedDecorator(new Metadata(t,e))(i,r,n)}const inject=injectBase(INJECT_TAG),multiInject=injectBase(MULTI_INJECT_TAG);function injectable(){return function(t){return Reflect$1.defineMetadata(PARAM_TYPES,null,t),t}}function named(t){return createTaggedDecorator(new Metadata(NAMED_TAG,t))}const BindingScopeEnum={Singleton:"Singleton",Transient:"Transient"},BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};class Binding{constructor(t,e){this.id=Generator.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=BindingTypeEnum.Invalid,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Binding(this.serviceIdentifier,this.scope);return t.activated=t.scope===BindingScopeEnum.Singleton&&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 MetadataReader{getConstructorMetadata(t){return{compilerGeneratedMetadata:Reflect$1.getMetadata(PARAM_TYPES,t),userGeneratedMetadata:Reflect$1.getMetadata(TAGGED,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const taggedConstraint=t=>e=>{const i=i=>{if(null==i)return!1;if(i.key===t&&i.value===e)return!0;if(null==i.constructorArgsMetadata)return!1;const r=i.constructorArgsMetadata;for(let i=0;i<r.length;i++)if(r[i].key===t&&r[i].value===e)return!0;return!1};return i.metaData=new Metadata(t,e),i},namedConstraint=taggedConstraint(NAMED_TAG);class BindingInSyntax{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=BindingScopeEnum.Singleton,this}inTransientScope(){return this._binding.scope=BindingScopeEnum.Transient,this}whenTargetNamed(t){return this._binding.constraint=namedConstraint(t),this}}class BindingToSyntax{constructor(t){this._binding=t}to(t){return this._binding.type=BindingTypeEnum.Instance,this._binding.implementationType=t,new BindingInSyntax(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new BindingInSyntax(this._binding)}toConstantValue(t){return this._binding.type=BindingTypeEnum.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=BindingScopeEnum.Singleton,new BindingInSyntax(this._binding)}toFactory(t){return this._binding.type=BindingTypeEnum.Factory,this._binding.factory=t,this._binding.scope=BindingScopeEnum.Singleton,new BindingInSyntax(this._binding)}toService(t){this.toDynamicValue((e=>e.container.get(t)))}}class Container{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||BindingScopeEnum.Transient,this.options=e,this.id=Generator.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new MetadataReader}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 r=this._getNotAllArgs(t,!1,e,i);return this._get(r)}getNamed(t,e){return this.getTagged(t,NAMED_TAG,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Binding(t,e),r=this._bindingDictionary.get(t)||[];return r.push(i),this._bindingDictionary.set(t,r),new BindingToSyntax(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 r=this.bind(i);return t(r,e),r},i=()=>t=>this.unbind(t),r=()=>t=>this.isBound(t),n=e=>i=>{const r=this.rebind(i);return t(r,e),r};return t=>({bindFunction:e(t),isboundFunction:r(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,r){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:r}}_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),r=Object.keys(i),n=[];for(let t=0;t<r.length;t++){const e=i[t],r={};e.forEach((t=>{r[t.key]=t.value}));const a={inject:r[INJECT_TAG],multiInject:r[MULTI_INJECT_TAG]},s=a.inject||a.multiInject,o={serviceIdentifier:s,constructorArgsMetadata:e},l={injectIdentifier:s,metadata:e,bindings:this._bindingDictionary.get(s).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case BindingTypeEnum.ConstantValue:case BindingTypeEnum.Function:e=t.cache;break;case BindingTypeEnum.Instance: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===BindingScopeEnum.Singleton&&(t.cache=e,t.activated=!0)}}const ContributionProvider=Symbol("ContributionProvider");class ContributionProviderCache{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 bindContributionProvider(t,e){t(ContributionProvider).toDynamicValue((t=>{let{container:i}=t;return new ContributionProviderCache(e,i)})).inSingletonScope().whenTargetNamed(e)}function bindContributionProviderNoSingletonScope(t,e){t(ContributionProvider).toDynamicValue((t=>{let{container:i}=t;return new ContributionProviderCache(e,i)})).whenTargetNamed(e)}class Hook{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 r;if("string"==typeof e)r={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof r.name||""===r.name)throw new Error("Missing name for tap");return r=Object.assign({type:t,fn:i},r),r}_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 r=this.taps.length;for(;r>0;){r--;const t=this.taps[r];this.taps[r+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){r++;break}}this.taps[r]=t}}class SyncHook extends Hook{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 EnvContribution=Symbol.for("EnvContribution"),VGlobal=Symbol.for("VGlobal"),DEFAULT_TEXT_FONT_FAMILY="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 __decorate$1J=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$U=function(t,e){return function(i,r){e(i,r,t)}},__awaiter$8=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))},MeasureModeEnum;exports.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=Generator.GenAutoIncrementId(),this.hooks={onSetEnv:new SyncHook(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const r=i.configure(this,t);r&&r.then&&e.push(r)})),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 r=this.bindContribution(e);if(r&&r.then)return r.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)}loadFont(t,e,i){return __awaiter$8(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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)}},exports.DefaultGlobal=__decorate$1J([injectable(),__param$U(0,inject(ContributionProvider)),__param$U(0,named(EnvContribution)),__metadata$1i("design:paramtypes",[Object])],exports.DefaultGlobal),exports.MeasureModeEnum=void 0,MeasureModeEnum=exports.MeasureModeEnum||(exports.MeasureModeEnum={}),MeasureModeEnum[MeasureModeEnum.estimate=0]="estimate",MeasureModeEnum[MeasureModeEnum.actualBounding=1]="actualBounding",MeasureModeEnum[MeasureModeEnum.fontBounding=2]="fontBounding";const strCommandMap=["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"];var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var eventemitter3={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function r(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function a(t,e,r,a,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new n(r,a||t,s),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 s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,r,n=[];if(0===this._eventsCount)return n;for(r in t=this._events)e.call(t,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,a=r.length,s=new Array(a);n<a;n++)s[n]=r[n].fn;return s},o.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},o.prototype.emit=function(t,e,r,n,a,s){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,r),!0;case 4:return c.fn.call(c.context,e,r,n),!0;case 5:return c.fn.call(c.context,e,r,n,a),!0;case 6:return c.fn.call(c.context,e,r,n,a,s),!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,r);break;case 4:c[h].fn.call(c[h].context,e,r,n);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 a(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return a(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,r,n){var a=i?i+t:t;if(!this._events[a])return this;if(!e)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==e||n&&!o.once||r&&o.context!==r||s(this,a);else{for(var l=0,h=[],c=o.length;l<c;l++)(o[l].fn!==e||n&&!o[l].once||r&&o[l].context!==r)&&h.push(o[l]);h.length?this._events[a]=1===h.length?h[0]:h:s(this,a)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&s(this,e)):(this._events=new r,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}(eventemitter3);var eventemitter3Exports=eventemitter3.exports,EventEmitter=getDefaultExportFromCjs(eventemitter3Exports);const isType=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var isType$1=isType;const isBoolean=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||isType$1(t,"Boolean")};var isBoolean$1=isBoolean;const isFunction=t=>"function"==typeof t;var isFunction$1=isFunction;const isNil=t=>null==t;var isNil$1=isNil;const isValid=t=>null!=t;var isValid$1=isValid;const isObject=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var isObject$1=isObject;const isObjectLike=t=>"object"==typeof t&&null!==t;var isObjectLike$1=isObjectLike;const isPlainObject=function(t){if(!isObjectLike$1(t)||!isType$1(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 isPlainObject$1=isPlainObject;const isUndefined=t=>void 0===t;var isUndefined$1=isUndefined;const isString=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||isType$1(t,"String")};var isString$1=isString;const isArray=t=>Array.isArray?Array.isArray(t):isType$1(t,"Array");var isArray$1=isArray;const isArrayLike=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var isArrayLike$1=isArrayLike;const isNumber=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||isType$1(t,"Number")};var isNumber$1=isNumber;const isValidNumber=t=>isNumber$1(t)&&Number.isFinite(t);var isValidNumber$1=isValidNumber;const isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var isValidUrl$1=isValidUrl;const isBase64=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var isBase64$1=isBase64;const hasOwnProperty=Object.prototype.hasOwnProperty,has=(t,e)=>null!=t&&hasOwnProperty.call(t,e);var has$1=has;function baseMerge(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(isValid$1(e)&&"object"==typeof e){const n=Object(e),a=[];for(const t in n)a.push(t);let{length:s}=a,o=-1;for(;s--;){const s=a[++o];!isValid$1(n[s])||"object"!=typeof n[s]||r&&isArray$1(t[s])?assignMergeValue(t,s,n[s]):baseMergeDeep(t,e,s,i,r)}}}}function baseMergeDeep(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const a=t[i],s=e[i];let o=e[i],l=!0;if(isArray$1(s)){if(r)o=[];else if(isArray$1(a))o=a;else if(isArrayLike$1(a)){o=new Array(a.length);let t=-1;const e=a.length;for(;++t<e;)o[t]=a[t]}}else isPlainObject$1(s)?(o=null!=a?a:{},"function"!=typeof a&&"object"==typeof a||(o={})):l=!1;l&&baseMerge(o,s,r,n),assignMergeValue(t,i,o)}function assignMergeValue(t,e,i){(void 0!==i&&!eq(t[e],i)||void 0===i&&!(e in t))&&(t[e]=i)}function eq(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function merge(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)baseMerge(t,e+1<1||arguments.length<=e+1?void 0:arguments[e+1],!0);return t}function arrayEqual(t,e){if(!isArray$1(t)||!isArray$1(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 hasConsole="undefined"!=typeof console;function log(t,e,i){const r=[e].concat([].slice.call(i));hasConsole&&console[t].apply(console,r)}var LoggerLevel;!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"}(LoggerLevel||(LoggerLevel={}));class Logger{static getInstance(t,e){return Logger._instance&&isNumber$1(t)?Logger._instance.level(t):Logger._instance||(Logger._instance=new Logger(t,e)),Logger._instance}static setInstance(t){return Logger._instance=t}static setInstanceLevel(t){Logger._instance?Logger._instance.level(t):Logger._instance=new Logger(t)}static clearInstance(){Logger._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:LoggerLevel.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>=LoggerLevel.Info}canLogDebug(){return this._level>=LoggerLevel.Debug}canLogError(){return this._level>=LoggerLevel.Error}canLogWarn(){return this._level>=LoggerLevel.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return this._level>=LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):log(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>=LoggerLevel.Warn&&log(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>=LoggerLevel.Info&&log(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>=LoggerLevel.Debug&&log(this._method||"log","DEBUG",e),this}}Logger._instance=null;const DEFAULT_ABSOLUTE_TOLERATE=1e-10,DEFAULT_RELATIVE_TOLERATE=1e-10;function isNumberClose(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:DEFAULT_ABSOLUTE_TOLERATE,r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:DEFAULT_RELATIVE_TOLERATE)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,r)}const clamp=function(t,e,i){return t<e?e:t>i?i:t};var clamp$1=clamp;const epsilon=1e-12,pi=Math.PI,halfPi$1=pi/2,tau=2*pi,pi2=2*Math.PI,abs=Math.abs,atan2=Math.atan2,cos=Math.cos,max=Math.max,min=Math.min,sin=Math.sin,sqrt=Math.sqrt,pow=Math.pow;function acos(t){return t>1?0:t<-1?pi:Math.acos(t)}function asin(t){return t>=1?halfPi$1:t<=-1?-halfPi$1:Math.asin(t)}function pointAt(t,e,i,r,n){let a=i,s=r;return"number"==typeof t&&"number"==typeof i&&(a=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof r&&(s=(1-n)*e+n*r),{x:a,y:s}}function crossProduct$1(t,e){return t[0]*e[1]-t[1]*e[0]}function fuzzyEqualVec(t,e){return abs(t[0]-e[0])+abs(t[1]-e[1])<1e-12}function getDecimalPlaces(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class Point{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,r=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=r}clone(){return new Point(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 isNumber$1(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return isNumber$1(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 PointService{static distancePP(t,e){return sqrt(pow(t.x-e.x,2)+pow(t.y-e.y,2))}static distanceNN(t,e,i,r){return sqrt(pow(t-i,2)+pow(e-r,2))}static distancePN(t,e,i){return sqrt(pow(e-t.x,2)+pow(i-t.y,2))}static pointAtPP(t,e,i){return new Point((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function degreeToRadian(t){return t*(Math.PI/180)}function radianToDegree(t){return 180*t/Math.PI}const clampRadian=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-tau;)t+=tau;else if(t>0)for(;t>tau;)t-=tau;return t},clampAngleByRadian=clampRadian;function getAngleByPoint(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function sub(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function isIntersect(t,e,i,r){let n=t[0],a=e[0],s=i[0],o=r[0];return a<n&&([n,a]=[a,n]),o<s&&([o,s]=[s,o]),!(a<s||o<n||(n=t[1],a=e[1],s=i[1],o=r[1],a<n&&([n,a]=[a,n]),o<s&&([o,s]=[s,o]),a<s||o<n))}function getIntersectPoint(t,e,i,r){if(!isIntersect(t,e,i,r))return!1;const n=[0,0],a=[0,0],s=[0,0];if(sub(n,e,t),sub(a,r,i),fuzzyEqualVec(n,a))return!0;sub(s,i,t);const o=crossProduct$1(s,a)/crossProduct$1(n,a);return o>=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function getRectIntersect(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:r,x12:n,y11:a,y12:s,x21:o,x22:l,y21:h,y22:c}=formatTwoBBox(t,e,i);return r>=l||n<=o||a>=c||s<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,o),y1:Math.max(a,h),x2:Math.min(n,l),y2:Math.min(s,c)}}var InnerBBox;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(InnerBBox||(InnerBBox={}));const formatTwoBBox=(t,e,i)=>{let r=t.x1,n=t.x2,a=t.y1,s=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(r>n&&([r,n]=[n,r]),a>s&&([a,s]=[s,a]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:r,x12:n,y11:a,y12:s,x21:o,x22:l,y21:h,y22:c}};function isRectIntersect(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:r,x12:n,y11:a,y12:s,x21:o,x22:l,y21:h,y22:c}=formatTwoBBox(t,e,!0);return!(r>l||n<o||a>c||s<h)}return!0}function getProjectionRadius(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function rotatePoint(t,e){let{x:i,y:r}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(r-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(r-n.y)*Math.cos(e)+n.y}}function getCenterPoint(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function toRect(t,e){const i=e?degreeToRadian(t.angle):t.angle,r=getCenterPoint(t);return[rotatePoint({x:t.x1,y:t.y1},i,r),rotatePoint({x:t.x2,y:t.y1},i,r),rotatePoint({x:t.x2,y:t.y2},i,r),rotatePoint({x:t.x1,y:t.y2},i,r)]}function isRotateAABBIntersect(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;const n=toRect(t,i),a=toRect(e,i),s=(t,e)=>[e.x-t.x,e.y-t.y];r&&(r.save(),r.fillStyle="red",r.globalAlpha=.6,n.forEach(((t,e)=>{0===e?r.moveTo(t.x,t.y):r.lineTo(t.x,t.y)})),r.fill(),r.restore(),r.save(),r.fillStyle="green",r.globalAlpha=.6,a.forEach(((t,e)=>{0===e?r.moveTo(t.x,t.y):r.lineTo(t.x,t.y)})),r.fill(),r.restore());const o=getCenterPoint(t),l=getCenterPoint(e);r&&r.fillRect(o.x,o.y,2,2),r&&r.fillRect(l.x,l.y,2,2);const h=s(o,l),c=s(n[0],n[1]),u=s(n[1],n[2]),d=s(a[0],a[1]),p=s(a[1],a[2]),f=i?degreeToRadian(t.angle):t.angle;let m=i?degreeToRadian(90-t.angle):t.angle+halfPi$1;const g=i?degreeToRadian(e.angle):e.angle;let y=i?degreeToRadian(90-e.angle):e.angle+halfPi$1;m>pi2&&(m-=pi2),y>pi2&&(y-=pi2);const v=(t,e,i,r)=>{const n=[Math.cos(e),Math.sin(e)];return t+(getProjectionRadius(n,i)+getProjectionRadius(n,r))/2>getProjectionRadius(n,h)};return v((t.x2-t.x1)/2,f,d,p)&&v((t.y2-t.y1)/2,m,d,p)&&v((e.x2-e.x1)/2,g,c,u)&&v((e.y2-e.y1)/2,y,c,u)}function isPointInLine(t,e,i,r,n,a){if(a>e&&a>r||a<e&&a<r)return 0;if(r===e)return 0;const s=(a-e)/(r-e);let o=r<e?1:-1;1!==s&&0!==s||(o=r<e?.5:-.5);const l=s*(i-t)+t;return l===n?1/0:l>n?o:0}const eastAsianCharacterInfo=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,r=e<<10|i,r+=65536),12288===r||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":8361===r||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||172===r||175===r||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":161===r||164===r||167<=r&&r<=168||170===r||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||198===r||208===r||215<=r&&r<=216||222<=r&&r<=225||230===r||232<=r&&r<=234||236<=r&&r<=237||240===r||242<=r&&r<=243||247<=r&&r<=250||252===r||254===r||257===r||273===r||275===r||283===r||294<=r&&r<=295||299===r||305<=r&&r<=307||312===r||319<=r&&r<=322||324===r||328<=r&&r<=331||333===r||338<=r&&r<=339||358<=r&&r<=359||363===r||462===r||464===r||466===r||468===r||470===r||472===r||474===r||476===r||593===r||609===r||708===r||711===r||713<=r&&r<=715||717===r||720===r||728<=r&&r<=731||733===r||735===r||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||1025===r||1040<=r&&r<=1103||1105===r||8208===r||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||8240===r||8242<=r&&r<=8243||8245===r||8251===r||8254===r||8308===r||8319===r||8321<=r&&r<=8324||8364===r||8451===r||8453===r||8457===r||8467===r||8470===r||8481<=r&&r<=8482||8486===r||8491===r||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||8585===r||8592<=r&&r<=8601||8632<=r&&r<=8633||8658===r||8660===r||8679===r||8704===r||8706<=r&&r<=8707||8711<=r&&r<=8712||8715===r||8719===r||8721===r||8725===r||8730===r||8733<=r&&r<=8736||8739===r||8741===r||8743<=r&&r<=8748||8750===r||8756<=r&&r<=8759||8764<=r&&r<=8765||8776===r||8780===r||8786===r||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||8853===r||8857===r||8869===r||8895===r||8978===r||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||9675===r||9678<=r&&r<=9681||9698<=r&&r<=9701||9711===r||9733<=r&&r<=9734||9737===r||9742<=r&&r<=9743||9748<=r&&r<=9749||9756===r||9758===r||9792===r||9794===r||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||9839===r||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||9955===r||9960<=r&&r<=9983||10045===r||10071===r||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||65533===r||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"};function getContextFont(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:r=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:a=e.fontWeight,fontSize:s=e.fontSize,fontFamily:o=e.fontFamily}=t;return(r?r+" ":"")+(n?n+" ":"")+(a?a+" ":"")+s*i+"px "+(o||"sans-serif")}class TextMeasure{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(),isValid$1(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=isValid$1(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(isNil$1(this._canvas)&&(isValid$1(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),isNil$1(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&isValid$1(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),isNil$1(this._context)&&isValid$1(this._canvas)){const t=this._canvas.getContext("2d");isValid$1(t)&&(t.save(),t.font=getContextFont(this.textSpec),this._contextSaved=!0,this._context=t)}return!isNil$1(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:r={}}=this._option,{fontStyle:n=r.fontStyle,fontVariant:a=r.fontVariant,fontWeight:s=(null!==(t=r.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=r.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=r.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:m=o}=this._userSpec;if(isString$1(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:a,fontFamily:l,fontSize:o,fontWeight:s,textAlign:c,textBaseline:d,ellipsis:p,limit:f,lineHeight:m}}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(isNil$1(t))return{width:0,height:0};if(isNil$1(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:r,textAlign:n,textBaseline:a,ellipsis:s,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:r,textAlign:n,textBaseline:a,ellipsis:!!s,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:r,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:r,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 r=t[i];let n=this._measureSpecialChar(r);isNil$1(n)&&TextMeasure.NUMBERS_CHAR_SET.includes(r)&&(n=this._measureNumberChar()),isNil$1(n)&&["F","W"].includes(eastAsianCharacterInfo(r))&&(n=this._measureFullSizeChar()),isNil$1(n)&&(n=this._measureLetterChar()),e.width+=n.width,e.height=Math.max(e.height,n.height),!isNil$1(n.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=n.fontBoundingBoxAscent),!isNil$1(n.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=n.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:r,lineHeight:n}=this.textSpec;for(let e=0;e<t.length;e++){const n=t[e],a=["F","W"].includes(eastAsianCharacterInfo(n))?1:.53;i.width+=a*r}return i.height=null!==(e=n)&&void 0!==e?e:r,i}_measureReduce(t,e){var i;const{fontSize:r,lineHeight:n}=this.textSpec,a={width:0,height:0};if(isNil$1(t))return a;if(isArray$1(t)){const s=t.filter(isValid$1).map((t=>t.toString()));return 0===s.length?a:1===s.length?e(s[0]):{width:s.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:s.length*((null!==(i=n)&&void 0!==i?i:r)+1)+1}}return e(t.toString())}_measureNumberChar(){if(isNil$1(this._numberCharSize)){const t=this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/TextMeasure.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return isNil$1(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(TextMeasure.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(isNil$1(this._letterCharSize)){const t=this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/TextMeasure.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return isValid$1(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){isValid$1(this._canvas)&&(this._canvas=null),isValid$1(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}TextMeasure.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",TextMeasure.NUMBERS_CHAR_SET="0123456789",TextMeasure.FULL_SIZE_CHAR="字";const calculateAnchorOfBounds=(t,e)=>{const{x1:i,x2:r,y1:n,y2:a}=t,s=Math.abs(r-i),o=Math.abs(a-n);let l=(i+r)/2,h=(n+a)/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*s,h+=u*o,{x:l,y:h}};function transformBoundsWithMatrix(t,e,i){const{x1:r,y1:n,x2:a,y2:s}=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*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*a+i.c*n+i.e,i.b*a+i.d*n+i.f),t.add(i.a*a+i.c*s+i.e,i.b*a+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),e)}class Bounds{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Bounds(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,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=r,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,r=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),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),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 isArray$1(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 r=this.rotatedPoints(t,e,i);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[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,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,r);return this.clear().add(n[0],n[1]).add(n[2],n[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 transformBoundsWithMatrix(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:r,y1:n,x2:a,y2:s}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*r-l*n+h,l*r+o*n+c,o*r-l*s+h,l*r+o*s+c,o*a-l*n+h,l*a+o*n+c,o*a-l*s+h,l*a+o*s+c]}scalePoints(t,e,i,r){const{x1:n,y1:a,x2:s,y2:o}=this;return[t*n+(1-t)*i,e*a+(1-e)*r,t*s+(1-t)*i,e*o+(1-e)*r]}}class AABBBounds extends Bounds{}class OBBBounds extends Bounds{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return isRotateAABBIntersect(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,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,r),this.angle=n,this}}class Matrix{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,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=r,this.e=n,this.f=a}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,r,n,a){return!(this.e!==n||this.f!==a||this.a!==t||this.d!==r||this.b!==e||this.c!==i)}setValue(t,e,i,r,n,a){return this.a=t,this.b=e,this.c=i,this.d=r,this.e=n,this.f=a,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,r=this.d,n=this.e,a=this.f,s=new Matrix,o=t*r-e*i;return s.a=r/o,s.b=-e/o,s.c=-i/o,s.d=t/o,s.e=(i*a-r*n)/o,s.f=-(t*a-e*n)/o,s}rotate(t){const e=Math.cos(t),i=Math.sin(t),r=this.a*e+this.c*i,n=this.b*e+this.d*i,a=this.a*-i+this.c*e,s=this.b*-i+this.d*e;return this.a=r,this.b=n,this.c=a,this.d=s,this}rotateByCenter(t,e,i){const r=Math.cos(t),n=Math.sin(t),a=(1-r)*e+n*i,s=(1-r)*i-n*e,o=r*this.a-n*this.b,l=n*this.a+r*this.b,h=r*this.c-n*this.d,c=n*this.c+r*this.d,u=r*this.e-n*this.f+a,d=n*this.e+r*this.f+s;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,r,n,a){return this.multiply(t,e,i,r,n,a),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:r,e:n,f:a}=this;return this.a=e,this.b=t,this.c=r,this.d=i,this.e=a,this.f=n,this}multiply(t,e,i,r,n,a){const s=this.a,o=this.b,l=this.c,h=this.d,c=s*t+l*e,u=o*t+h*e,d=s*i+l*r,p=o*i+h*r,f=s*n+l*a+this.e,m=o*n+h*a+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=f,this.f=m,this}interpolate(t,e){const i=new Matrix;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:r,c:n,d:a,e:s,f:o}=this,l=i*a-r*n,h=a/l,c=-r/l,u=-n/l,d=i/l,p=(n*o-a*s)/l,f=-(i*o-r*s)/l,{x:m,y:g}=t;e.x=m*h+g*u+p,e.y=m*c+g*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 Matrix(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,r=this.d,n=t*r-e*i,a={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const s=Math.sqrt(t*t+e*e);a.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),a.scaleX=s,a.scaleY=n/s,a.skewX=(t*i+e*r)/n,a.skewY=0}else if(0!==i||0!==r){const s=Math.sqrt(i*i+r*r);a.rotateDeg=Math.PI/2-(r>0?Math.acos(-i/s):-Math.acos(i/s)),a.scaleX=n/s,a.scaleY=s,a.skewX=0,a.skewY=(t*i+e*r)/n}return a.rotateDeg=radianToDegree(a.rotateDeg),a}}function normalTransform(t,e,i,r,n,a,s,o){const l=e.a,h=e.b,c=e.c,u=e.d,d=e.e,p=e.f,f=cos(s),m=sin(s);let g,y;o?(g=o[0],y=o[1]):(g=i,y=r);const v=g-i,b=y-r,x=l*f+c*m,C=h*f+u*m,_=c*f-l*m,T=u*f-h*m;t.a=n*x,t.b=n*C,t.c=a*_,t.d=a*T,t.e=d+l*g+c*y-x*v-_*b,t.f=p+h*g+u*y-C*v-T*b}class LRU{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:r=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size<i)return 0;let a=0;const s=e=>{a++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<n)return s(e);let i=0;for(;o-t.timestamp[t.timestamp.length-1-i]<r&&(i++,!(i>=n)););if(i<n)return s(e);for(;o-t.timestamp[0]>r;)t.timestamp.shift()})),a}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>r&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,r=Date.now();t.forEach((t=>{for(;r-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,r=Date.now();for(;r-t.timestamp[0]>i;)t.timestamp.shift()}}function hslToRgb(t,e,i){e/=100,i/=100;const r=(1-Math.abs(2*i-1))*e,n=r*(1-Math.abs(t/60%2-1)),a=i-r/2;let s=0,o=0,l=0;return 0<=t&&t<60?(s=r,o=n,l=0):60<=t&&t<120?(s=n,o=r,l=0):120<=t&&t<180?(s=0,o=r,l=n):180<=t&&t<240?(s=0,o=n,l=r):240<=t&&t<300?(s=n,o=0,l=r):300<=t&&t<360&&(s=r,o=0,l=n),s=Math.round(255*(s+a)),o=Math.round(255*(o+a)),l=Math.round(255*(l+a)),{r:s,g:o,b:l}}function rgbToHsl(t,e,i){t/=255,e/=255,i/=255;const r=Math.min(t,e,i),n=Math.max(t,e,i),a=n-r;let s=0,o=0,l=0;return s=0===a?0:n===t?(e-i)/a%6:n===e?(i-t)/a+2:(t-e)/a+4,s=Math.round(60*s),s<0&&(s+=360),l=(n+r)/2,o=0===a?0:a/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:s,s:o,l:l}}const REG_HEX=/^#([0-9a-f]{3,8})$/,DEFAULT_COLORS_OPACITY={transparent:4294967040},DEFAULT_COLORS={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 hex(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function rgb(t){return isNumber$1(t)?new RGB(t>>16,t>>8&255,255&t,1):isArray$1(t)?new RGB(t[0],t[1],t[2]):new RGB(255,255,255)}function rgba(t){return isNumber$1(t)?new RGB(t>>>24,t>>>16&255,t>>>8&255,255&t):isArray$1(t)?new RGB(t[0],t[1],t[2],t[3]):new RGB(255,255,255,1)}function SRGBToLinear(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function LinearToSRGB(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const setHex=(t,e)=>{const i=REG_HEX.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new RGB((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?rgb(t):8===e?new RGB(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Color{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Color(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Color(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Color?t:new Color(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(isValid$1(DEFAULT_COLORS_OPACITY[t]))return rgba(DEFAULT_COLORS_OPACITY[t]);if(isValid$1(DEFAULT_COLORS[t]))return rgb(DEFAULT_COLORS[t]);const e=`${t}`.trim().toLowerCase(),i=setHex(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 RGB(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=hslToRgb(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new RGB(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Color.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new RGB(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:r}=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(r*t))),this}add(t){const{r:e,g:i,b:r}=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,r+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:r}=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(r*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 r=this.color.opacity,n=rgbToHsl(this.color.r,this.color.g,this.color.b),a=hslToRgb(isNil$1(t)?n.h:clamp$1(t,0,360),isNil$1(e)?n.s:e>=0&&e<=1?100*e:e,isNil$1(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new RGB(a.r,a.g,a.b,r),this}setRGB(t,e,i){return!isNil$1(t)&&(this.color.r=t),!isNil$1(e)&&(this.color.g=e),!isNil$1(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=setHex(e,!0);return null!=i?i:this}setColorName(t){const e=DEFAULT_COLORS[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 Color(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=SRGBToLinear(t.color.r),this.color.g=SRGBToLinear(t.color.g),this.color.b=SRGBToLinear(t.color.b),this}copyLinearToSRGB(t){return this.color.r=LinearToSRGB(t.color.r),this.color.g=LinearToSRGB(t.color.g),this.color.b=LinearToSRGB(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class RGB{constructor(t,e,i,r){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)),isValid$1(r)?this.opacity=isNaN(+r)?1:Math.max(0,Math.min(1,+r)):this.opacity=1}formatHex(){return`#${hex(this.r)+hex(this.g)+hex(this.b)+(1===this.opacity?"":hex(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:r}=rgbToHsl(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${r}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}const styleStringToObject=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(),r=i[1].trim();e&&r&&(t[e]=r)}}})),t},lowerCamelCaseToMiddle=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),circleThreshold=tau-1e-8;class BoundsContext{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,r,n,a){if(Math.abs(n-r)>circleThreshold)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let s,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(r),f(n),n!==r)if((r%=tau)<0&&(r+=tau),(n%=tau)<0&&(n+=tau),n<r&&(a=!a,s=r,r=n,n=s),a)for(n-=tau,s=r-r%halfPi$1,o=0;o<4&&s>n;++o,s-=halfPi$1)f(s);else for(s=r-r%halfPi$1+halfPi$1,o=0;o<4&&s<n;++o,s+=halfPi$1)f(s);this.bounds.add(t+c,e+d),this.bounds.add(t+u,e+p)}arcTo(t,e,i,r,n){this.bounds.add(t,e)}bezierCurveTo(t,e,i,r,n,a){this.bounds.add(t,e),this.bounds.add(i,r),this.bounds.add(n,a)}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,r){this.bounds.add(t,e),this.bounds.add(i,r)}rect(t,e,i,r){this.bounds.add(t,e),this.bounds.add(t+i,e+r)}clear(){this.bounds.clear()}release(){}}class CurvePath{constructor(){this._curves=[],this.bounds=new AABBBounds}get curves(){return this._curves}getCurveLengths(){return this._curves.map((t=>t.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,commandLengths={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},enumCommandMap={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let currPath,coordsStr,commandChar,coordStr,coordNumber,standardCommandLen;function parseSvgPath(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,r;const n=[];for(let t=0,a=e.length;t<a;t++)if(currPath=e[t],coordsStr=currPath.slice(1),commandChar=currPath[0],i=[commandChar],r=coordsStr.match(rePathCommand),null!==r){for(let t=0,e=r.length;t<e;t++)coordStr=r[t],coordNumber=parseFloat(coordStr),Number.isNaN(coordNumber)||i.push(coordNumber);if(standardCommandLen=commandLengths[commandChar],i.length-1>standardCommandLen){let t,e=commandChar;for(let r=1,a=i.length;r<a;r+=standardCommandLen){t=[e];for(let e=r,n=r+standardCommandLen;e<n;e++)t.push(i[e]);n.push(t),"m"===e?e="l":"M"===e&&(e="L")}}else n.push(i)}else n.push(i);return n}var UpdateTag,IContainPointMode,AttributeUpdateType,AnimateStatus,AnimateMode,AnimateStepType,CurveTypeEnum,BaseRenderContributionTime;function segments(t,e,i,r,n,a,s,o,l){const h=degreeToRadian(s),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/((r=Math.abs(r))*r);f>1&&(f=Math.sqrt(f),i*=f,r*=f);const m=u/i,g=c/i,y=-c/r,v=u/r,b=m*o+g*l,x=y*o+v*l,C=m*t+g*e,_=y*t+v*e;let T=1/((C-b)*(C-b)+(_-x)*(_-x))-.25;T<0&&(T=0);let A=Math.sqrt(T);a===n&&(A=-A);const S=.5*(b+C)-A*(_-x),P=.5*(x+_)+A*(C-b),w=Math.atan2(x-P,b-S);let M=Math.atan2(_-P,C-S)-w;M<0&&1===a?M+=tau:M>0&&0===a&&(M-=tau);const E=Math.ceil(Math.abs(M/(halfPi$1+.001))),R=[];for(let t=0;t<E;++t){const e=w+t*M/E,n=w+(t+1)*M/E;R[t]=[S,P,e,n,i,r,c,u]}return R}function bezier(t){const e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],s=t[5],o=t[6],l=t[7],h=l*a,c=-o*s,u=o*a,d=l*s,p=Math.cos(r),f=Math.sin(r),m=Math.cos(n),g=Math.sin(n),y=.5*(n-r),v=Math.sin(.5*y),b=8/3*v*v/Math.sin(y),x=e+p-b*f,C=i+f+b*p,_=e+m,T=i+g,A=_+b*g,S=T-b*m;return[h*x+c*C,u*x+d*C,h*A+c*S,u*A+d*S,h*_+c*T,u*_+d*T]}function drawArc(t,e,i,r){const n=segments(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,i);for(let e=0;e<n.length;++e){const i=bezier(n[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}exports.UpdateTag=void 0,UpdateTag=exports.UpdateTag||(exports.UpdateTag={}),UpdateTag[UpdateTag.NONE=0]="NONE",UpdateTag[UpdateTag.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",UpdateTag[UpdateTag.UPDATE_SHAPE=2]="UPDATE_SHAPE",UpdateTag[UpdateTag.CLEAR_SHAPE=253]="CLEAR_SHAPE",UpdateTag[UpdateTag.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",UpdateTag[UpdateTag.INIT=179]="INIT",UpdateTag[UpdateTag.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",UpdateTag[UpdateTag.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",UpdateTag[UpdateTag.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",UpdateTag[UpdateTag.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",UpdateTag[UpdateTag.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",UpdateTag[UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",UpdateTag[UpdateTag.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",UpdateTag[UpdateTag.CLEAR_LAYOUT=127]="CLEAR_LAYOUT",exports.IContainPointMode=void 0,IContainPointMode=exports.IContainPointMode||(exports.IContainPointMode={}),IContainPointMode[IContainPointMode.GLOBAL=1]="GLOBAL",IContainPointMode[IContainPointMode.LOCAL=16]="LOCAL",IContainPointMode[IContainPointMode.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",IContainPointMode[IContainPointMode.LOCAL_ACCURATE=48]="LOCAL_ACCURATE",exports.AttributeUpdateType=void 0,AttributeUpdateType=exports.AttributeUpdateType||(exports.AttributeUpdateType={}),AttributeUpdateType[AttributeUpdateType.INIT=0]="INIT",AttributeUpdateType[AttributeUpdateType.DEFAULT=1]="DEFAULT",AttributeUpdateType[AttributeUpdateType.STATE=2]="STATE",AttributeUpdateType[AttributeUpdateType.ANIMATE_BIND=10]="ANIMATE_BIND",AttributeUpdateType[AttributeUpdateType.ANIMATE_PLAY=11]="ANIMATE_PLAY",AttributeUpdateType[AttributeUpdateType.ANIMATE_START=12]="ANIMATE_START",AttributeUpdateType[AttributeUpdateType.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",AttributeUpdateType[AttributeUpdateType.ANIMATE_END=14]="ANIMATE_END",AttributeUpdateType[AttributeUpdateType.TRANSLATE=20]="TRANSLATE",AttributeUpdateType[AttributeUpdateType.TRANSLATE_TO=21]="TRANSLATE_TO",AttributeUpdateType[AttributeUpdateType.SCALE=22]="SCALE",AttributeUpdateType[AttributeUpdateType.SCALE_TO=23]="SCALE_TO",AttributeUpdateType[AttributeUpdateType.ROTATE=24]="ROTATE",AttributeUpdateType[AttributeUpdateType.ROTATE_TO=25]="ROTATE_TO",exports.AnimateStatus=void 0,AnimateStatus=exports.AnimateStatus||(exports.AnimateStatus={}),AnimateStatus[AnimateStatus.INITIAL=0]="INITIAL",AnimateStatus[AnimateStatus.RUNNING=1]="RUNNING",AnimateStatus[AnimateStatus.PAUSED=2]="PAUSED",AnimateStatus[AnimateStatus.END=3]="END",exports.AnimateMode=void 0,AnimateMode=exports.AnimateMode||(exports.AnimateMode={}),AnimateMode[AnimateMode.NORMAL=0]="NORMAL",AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY",exports.AnimateStepType=void 0,AnimateStepType=exports.AnimateStepType||(exports.AnimateStepType={}),AnimateStepType.wait="wait",AnimateStepType.from="from",AnimateStepType.to="to",AnimateStepType.customAnimate="customAnimate",exports.Direction=void 0,function(t){t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(exports.Direction||(exports.Direction={})),exports.CurveTypeEnum=void 0,CurveTypeEnum=exports.CurveTypeEnum||(exports.CurveTypeEnum={}),CurveTypeEnum[CurveTypeEnum.CubicBezierCurve=0]="CubicBezierCurve",CurveTypeEnum[CurveTypeEnum.QuadraticBezierCurve=1]="QuadraticBezierCurve",CurveTypeEnum[CurveTypeEnum.ArcCurve=2]="ArcCurve",CurveTypeEnum[CurveTypeEnum.LineCurve=3]="LineCurve",CurveTypeEnum[CurveTypeEnum.EllipseCurve=4]="EllipseCurve",CurveTypeEnum[CurveTypeEnum.MoveCurve=5]="MoveCurve",exports.BaseRenderContributionTime=void 0,BaseRenderContributionTime=exports.BaseRenderContributionTime||(exports.BaseRenderContributionTime={}),BaseRenderContributionTime[BaseRenderContributionTime.beforeFillStroke=0]="beforeFillStroke",BaseRenderContributionTime[BaseRenderContributionTime.afterFillStroke=1]="afterFillStroke";const addArcToBezierPath$1=(t,e,i,r,n,a,s)=>{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),m=Math.sin(l),g=d*a+r,y=p*s+n,v=f*a+r,b=m*s+n,x=a*c*u,C=s*c*u;t.push(g-x*p,y+C*d,v+x*m,b-C*f,v,b)}},commandFuncs=[(t,e,i,r,n,a,s)=>e.arc(t[1]*n+i,t[2]*a+r,t[3]*(n+a)/2,t[4],t[5],t[6],s),(t,e,i,r,n,a,s)=>e.arcTo(t[1]*n+i,t[2]*a+r,t[3]*n+i,t[4]*a+r,t[5]*(n+a)/2,s),(t,e,i,r,n,a,s)=>e.bezierCurveTo(t[1]*n+i,t[2]*a+r,t[3]*n+i,t[4]*a+r,t[5]*n+i,t[6]*a+r,s),(t,e,i,r)=>e.closePath(),(t,e,i,r,n,a)=>e.ellipse(t[1]*n+i,t[2]*a+r,t[3]*n,t[4]*a,t[5],t[6],t[7],t[8]),(t,e,i,r,n,a,s)=>e.lineTo(t[1]*n+i,t[2]*a+r,s),(t,e,i,r,n,a,s)=>e.moveTo(t[1]*n+i,t[2]*a+r,s),(t,e,i,r,n,a,s)=>e.quadraticCurveTo(t[1]*n+i,t[2]*a+r,t[3]*n+i,t[4]*a+r,s),(t,e,i,r,n,a,s)=>e.rect(t[1]*n+i,t[2]*a+r,t[3]*n,t[4]*a,s)];function renderCommandList(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6?arguments[6]:void 0;for(let o=0;o<t.length;o++){const l=t[o];commandFuncs[l[0]](l,e,i,r,n,a,s)}}class Curve{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function snapLength(t,e){let i=0;const r=t.length;for(let n=0;n<r;n++){const a=t[n],s=e[n],o=t[(n+1)%r],l=e[(n+1)%r];i+=PointService.distanceNN(a,s,o,l)}return i/2}function cubicLength(t,e,i,r,n){return snapLength([t.x,e.x,i.x,r.x],[t.y,e.y,i.y,r.y])}function cubicCalc(t,e,i,r,n){const a=1-n;return a*a*a*t+3*e*n*a*a+3*i*n*n*a+r*n*n*n}function cubicPointAt(t,e,i,r,n){const a=cubicCalc(t.x,e.x,i.x,r.x,n),s=cubicCalc(t.y,e.y,i.y,r.y,n);return new Point(a,s)}function quadCalc(t,e,i,r){const n=1-r;return n*n*t+2*n*r*e+r*r*i}function quadPointAt(t,e,i,r){const n=quadCalc(t.x,e.x,i.x,r),a=quadCalc(t.y,e.y,i.y,r);return new Point(n,a)}function quadLength(t,e,i,r){return snapLength([t.x,e.x,i.x],[t.y,e.y,i.y])}class QuadraticBezierCurve extends Curve{constructor(t,e,i){super(),this.type=exports.CurveTypeEnum.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return quadPointAt(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?quadLength(this.p0,this.p1,this.p2):60}calcProjLength(t){return t===exports.Direction.ROW?abs(this.p0.x-this.p2.x):t===exports.Direction.COLUMN?abs(this.p0.y-this.p2.y):0}getAngleAt(t){const e=max(t-.01,0),i=min(t+.01,1),r=this.getPointAt(e),n=this.getPointAt(i);return atan2(n.y-r.y,n.x-r.x)}draw(t,e,i,r,n,a){if(t.moveTo(this.p0.x*r+e,this.p0.y*n+i),a>=1)t.quadraticCurveTo(this.p1.x*r+e,this.p1.y*n+i,this.p2.x*r+e,this.p2.y*n+i);else if(a>0){const[s]=divideQuad(this,a);t.quadraticCurveTo(s.p1.x*r+e,s.p1.y*n+i,s.p2.x*r+e,s.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}function divideCubic(t,e){const{p0:i,p1:r,p2:n,p3:a}=t,s=cubicPointAt(i,r,n,a,e),o=PointService.pointAtPP(i,r,e),l=PointService.pointAtPP(r,n,e),h=PointService.pointAtPP(n,a,e),c=PointService.pointAtPP(o,l,e),u=PointService.pointAtPP(l,h,e);return[new CubicBezierCurve(i,o,c,s),new CubicBezierCurve(s,u,h,a)]}function divideQuad(t,e){const{p0:i,p1:r,p2:n}=t,a=quadPointAt(i,r,n,e),s=PointService.pointAtPP(i,r,e),o=PointService.pointAtPP(r,n,e);return[new QuadraticBezierCurve(i,s,a),new QuadraticBezierCurve(a,o,n)]}class CubicBezierCurve extends Curve{constructor(t,e,i,r){super(),this.type=exports.CurveTypeEnum.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,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 cubicPointAt(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?cubicLength(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(t){return t===exports.Direction.ROW?abs(this.p0.x-this.p3.x):t===exports.Direction.COLUMN?abs(this.p0.y-this.p3.y):0}getAngleAt(t){const e=max(t-.01,0),i=min(t+.01,1),r=this.getPointAt(e),n=this.getPointAt(i);return atan2(n.y-r.y,n.x-r.x)}draw(t,e,i,r,n,a){if(t.moveTo(this.p0.x*r+e,this.p0.y*n+i),a>=1)t.bezierCurveTo(this.p1.x*r+e,this.p1.y*n+i,this.p2.x*r+e,this.p2.y*n+i,this.p3.x*r+e,this.p3.y*n+i);else if(a>0){const[s]=divideCubic(this,a);t.bezierCurveTo(s.p1.x*r+e,s.p1.y*n+i,s.p2.x*r+e,s.p2.y*n+i,s.p3.x*r+e,s.p3.y*n+i)}}includeX(t){const e=min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=max(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=min(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(max(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function divideLinear(t,e){const{p0:i,p1:r}=t,n=PointService.pointAtPP(i,r,e);return[new LineCurve(i,n),new LineCurve(n,r)]}class LineCurve extends Curve{constructor(t,e){super(),this.type=exports.CurveTypeEnum.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return PointService.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=atan2(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()?PointService.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===exports.Direction.ROW?abs(this.p0.x-this.p1.x):t===exports.Direction.COLUMN?abs(this.p0.y-this.p1.y):0}draw(t,e,i,r,n,a){if(t.moveTo(this.p0.x*r+e,this.p0.y*n+i),a>=1)t.lineTo(this.p1.x*r+e,this.p1.y*n+i);else if(a>0){const s=this.getPointAt(a);t.lineTo(s.x*r+e,s.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const r=(t-e.x)/(i.x-e.x);return e.y+r*(i.y-e.y)}return 1/0}}class SegContext{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,r,n,a,s,o){const l=new CubicBezierCurve(new Point(this._lastX,this._lastY),new Point(t,e),new Point(i,r),new Point(n,a));l.originP1=this._lastOriginP,l.originP2=o,l.defined=s,this.curves.push(l),this._lastX=n,this._lastY=a,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,r){const n=this.addLinearCurve(t,e,i,this._lastOriginP,r);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=r}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,r){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,r,n){const a=new LineCurve(new Point(this._lastX,this._lastY),new Point(t,e));return a.originP1=r,a.originP2=n,a.defined=i,a}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===exports.Direction.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],r=null!==(e=i.p3)&&void 0!==e?e:i.p1;return abs(t.p0.y-r.y)}if(t===exports.Direction.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],r=null!==(i=e.p3)&&void 0!==i?i:e.p1;return abs(t.p0.x-r.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class ReflectSegContext extends SegContext{bezierCurveTo(t,e,i,r,n,a,s,o){return super.bezierCurveTo(e,t,r,i,a,n,s,o)}lineTo(t,e,i,r){return super.lineTo(e,t,i,r)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function genCurveSegments(t,e){let i=!1;for(let r=0,n=e.length;r<=n;r++)r>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[r])}function genSegContext(t,e,i){const r=null!=e?e:abs(i[i.length-1].x-i[0].x)>abs(i[i.length-1].y-i[0].y)?exports.Direction.ROW:exports.Direction.COLUMN;return"monotoneY"===t?new ReflectSegContext(t,r):new SegContext(t,r)}class Linear{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 genLinearSegments(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;const n=genSegContext("linear",i,t);return genLinearTypeSegments(new Linear(n,r),t),n}function genLinearTypeSegments(t,e){return genCurveSegments(t,e)}function point$3(t,e,i,r,n){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,r,t.lastPoint1)}class Basis{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&&point$3(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:point$3(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 genBasisTypeSegments(t,e){return genCurveSegments(t,e)}function genBasisSegments(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return genLinearSegments(t,e);const n=genSegContext("basis",i,t);return genBasisTypeSegments(new Basis(n,r),t),n}function sign(t){return t<0?-1:1}function slope3(t,e,i){const r=t._x1-t._x0,n=e-t._x1,a=(t._y1-t._y0)/(r||Number(n<0&&-0)),s=(i-t._y1)/(n||Number(r<0&&-0)),o=(a*n+s*r)/(r+n);return(sign(a)+sign(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function slope2(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function point$2(t,e,i,r,n){const a=t._x0,s=t._y0,o=t._x1,l=t._y1,h=(o-a)/3;t.context.bezierCurveTo(a+h,s+h*e,o-h,l-h*i,o,l,r,t.lastPoint1)}class MonotoneX{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:point$2(this,this._t0,slope2(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,r=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,r,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,r,t);break;case 1:this._point=2;break;case 2:this._point=3,point$2(this,slope2(this,e=slope3(this,i,r)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:point$2(this,this._t0,e=slope3(this,i,r),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=r,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 MonotoneY extends MonotoneX{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function genMonotoneXTypeSegments(t,e){return genCurveSegments(t,e)}function genMonotoneXSegments(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return genLinearSegments(t,e);const n=genSegContext("monotoneX",i,t);return genMonotoneXTypeSegments(new MonotoneX(n,r),t),n}function genMonotoneYTypeSegments(t,e){return genCurveSegments(t,e)}function genMonotoneYSegments(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;if(t.length<3-Number(!!r))return genLinearSegments(t,e);const n=genSegContext("monotoneY",i,t);return genMonotoneYTypeSegments(new MonotoneY(n,r),t),n}let Step$1=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 r=this._x*(1-this._t)+e*this._t;this.context.lineTo(r,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(r,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 genStepSegments(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const a=new SegContext("step",null!=r?r:abs(t[t.length-1].x-t[0].x)>abs(t[t.length-1].y-t[0].y)?exports.Direction.ROW:exports.Direction.COLUMN);return genStepTypeSegments(new Step$1(a,e,n),t),a}function genStepTypeSegments(t,e){return genCurveSegments(t,e)}class LinearClosed extends Linear{lineEnd(){this.context.closePath()}}function genLinearClosedSegments(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:r}=e;if(t.length<2-Number(!!r))return null;const n=genSegContext("linear",i,t);return genLinearClosedTypeSegments(new LinearClosed(n,r),t),n}function genLinearClosedTypeSegments(t,e){return genCurveSegments(t,e)}function point$1(t,e,i,r,n){let a=t._x1,s=t._y1,o=t._x2,l=t._y2;if(t._l01_a>epsilon){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);a=(a*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,s=(s*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>epsilon){const r=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*r+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*r+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(a,s,o,l,t._x2,t._y2,r,t.lastPoint1)}class CatmullRom{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,r=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+r*r,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:point$1(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 commonGenCatmullRomSegments(t,e){return function(i,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:a,startPoint:s}=n;if(i.length<2-Number(!!s))return null;if(i.length<3-Number(!!s))return genLinearSegments(i,n);const o=genSegContext(t,a,i);return genCurveSegments(new e(o,r,s),i),o}}const genCatmullRomSegments=commonGenCatmullRomSegments("catmullRom",CatmullRom);class CatmullRomClosed{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,r=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+r*r,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:point$1(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 genCatmullRomClosedSegments=commonGenCatmullRomSegments("catmullRomClosed",CatmullRomClosed);class CurveContext{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.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new LineCurve(new Point(this._lastX,this._lastY),new Point(t,e))}quadraticCurveTo(t,e,i,r){const n=new QuadraticBezierCurve(new Point(this._lastX,this._lastY),new Point(t,e),new Point(i,r));this.path.addCurve(n),this._lastX=i,this._lastY=r}bezierCurveTo(t,e,i,r,n,a){const s=new CubicBezierCurve(new Point(this._lastX,this._lastY),new Point(t,e),new Point(i,r),new Point(n,a));this.path.addCurve(s),this._lastX=n,this._lastY=a}arcTo(t,e,i,r,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,r,n,a,s,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,r){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,r,n,a){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function calcLineCache(t,e,i){var r,n;switch(e){case"linear":default:return genLinearSegments(t,i);case"basis":return genBasisSegments(t,i);case"monotoneX":return genMonotoneXSegments(t,i);case"monotoneY":return genMonotoneYSegments(t,i);case"step":return genStepSegments(t,.5,i);case"stepBefore":return genStepSegments(t,0,i);case"stepAfter":return genStepSegments(t,1,i);case"catmullRom":return genCatmullRomSegments(t,null!==(r=null==i?void 0:i.curveTension)&&void 0!==r?r:.5,i);case"catmullRomClosed":return genCatmullRomClosedSegments(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return genLinearClosedSegments(t,i)}}class CustomPath2D extends CurvePath{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new BoundsContext(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([enumCommandMap.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([enumCommandMap.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,r){return this.commandList.push([enumCommandMap.Q,t,e,i,r]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,r),this}bezierCurveTo(t,e,i,r,n,a){return this.commandList.push([enumCommandMap.C,t,e,i,r,n,a]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,r,n,a),this}arcTo(t,e,i,r,n){return this.commandList.push([enumCommandMap.AT,t,e,i,r,n]),this._ctx&&this._ctx.arcTo(t,e,i,r,n),this}ellipse(t,e,i,r,n,a,s,o){return this.commandList.push([enumCommandMap.E,t,e,i,r,n,a,s,o]),this._ctx&&this._ctx.ellipse(t,e,i,r,n,a,s,o),this}rect(t,e,i,r){return this.commandList.push([enumCommandMap.R,t,e,i,r]),this._ctx&&this._ctx.rect(t,e,i,r),this}arc(t,e,i,r,n,a){return this.commandList.push([enumCommandMap.A,t,e,i,r,n,a]),this._ctx&&this._ctx.arc(t,e,i,r,n,a),this}closePath(){return this.commandList.push([enumCommandMap.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new CurveContext(this);renderCommandList(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[enumCommandMap.M]=t=>`M${t[1]} ${t[2]}`,t[enumCommandMap.L]=t=>`L${t[1]} ${t[2]}`,t[enumCommandMap.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[enumCommandMap.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[enumCommandMap.A]=t=>{const e=[];addArcToBezierPath$1(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[enumCommandMap.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[enumCommandMap.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,r,n){this.clear();const a=parseSvgPath(t);return this._runCommandStrList(a,e,i,r,n),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:r}=t.attribute;if(!e)return;const n=calcLineCache(e,i);"x"===r?this.direction=exports.Direction.ROW:"y"===r?this.direction=exports.Direction.COLUMN:"auto"===r&&(this.direction=n.direction),this._curves=n.curves}fromCustomPath2D(t,e,i,r,n){return this.clear(),this._runCommandList(t.commandList,e,i,r,n),this._updateBounds(),this}transform(t,e,i,r){const n=this.commandList;if(!this.transformCbList){const t=[];t[enumCommandMap.M]=this.moveToTransform,t[enumCommandMap.L]=this.lineToTransform,t[enumCommandMap.Q]=this.quadraticCurveToTransform,t[enumCommandMap.C]=this.bezierCurveToTransform,t[enumCommandMap.AT]=this.arcToTransform,t[enumCommandMap.E]=this.ellipseTransform,t[enumCommandMap.R]=this.rectTransform,t[enumCommandMap.A]=this.arcTransform,t[enumCommandMap.Z]=this.closePathTransform,this.transformCbList=t}n.forEach((n=>{this.transformCbList[n[0]](n,t,e,i,r)})),this._updateBounds()}moveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i,t[5]=t[5]*r+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r+e,t[4]=t[4]*n+i,t[5]=t[5]*(r+n)/2}ellipseTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r,t[4]=t[4]*n}rectTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*r,t[4]=t[4]*n}arcTransform(t,e,i,r,n){t[1]=t[1]*r+e,t[2]=t[2]*n+i,t[3]=t[3]*(r+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,r,n,a,s=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 m=0,g=t.length;m<g;++m){switch(e=t[m],1===l&&1===h||(e=scale(e,l,h)),e[0]){case"l":u+=e[1],d+=e[2],this.lineTo(u+s,d+o);break;case"L":u=e[1],d=e[2],this.lineTo(u+s,d+o);break;case"h":u+=e[1],this.lineTo(u+s,d+o);break;case"H":u=e[1],this.lineTo(u+s,d+o);break;case"v":d+=e[1],this.lineTo(u+s,d+o);break;case"V":d=e[1],this.lineTo(u+s,d+o);break;case"m":u+=e[1],d+=e[2],this.moveTo(u+s,d+o);break;case"M":u=e[1],d=e[2],this.moveTo(u+s,d+o);break;case"c":i=u+e[5],r=d+e[6],p=u+e[3],f=d+e[4],this.bezierCurveTo(u+e[1]+s,d+e[2]+o,p+s,f+o,i+s,r+o),u=i,d=r;break;case"C":u=e[5],d=e[6],p=e[3],f=e[4],this.bezierCurveTo(e[1]+s,e[2]+o,p+s,f+o,u+s,d+o);break;case"s":i=u+e[3],r=d+e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+s,f+o,u+e[1]+s,d+e[2]+o,i+s,r+o),p=u+e[1],f=d+e[2],u=i,d=r;break;case"S":i=e[3],r=e[4],p=2*u-p,f=2*d-f,this.bezierCurveTo(p+s,f+o,e[1]+s,e[2]+o,i+s,r+o),u=i,d=r,p=e[1],f=e[2];break;case"q":i=u+e[3],r=d+e[4],p=u+e[1],f=d+e[2],this.quadraticCurveTo(p+s,f+o,i+s,r+o),u=i,d=r;break;case"Q":i=e[3],r=e[4],this.quadraticCurveTo(e[1]+s,e[2]+o,i+s,r+o),u=i,d=r,p=e[1],f=e[2];break;case"t":i=u+e[1],r=d+e[2],null===c[0].match(/[QqTt]/)?(p=u,f=d):"t"===c[0]?(p=2*u-n,f=2*d-a):"q"===c[0]&&(p=2*u-p,f=2*d-f),n=p,a=f,this.quadraticCurveTo(p+s,f+o,i+s,r+o),u=i,d=r,p=u+e[1],f=d+e[2];break;case"T":i=e[1],r=e[2],p=2*u-p,f=2*d-f,this.quadraticCurveTo(p+s,f+o,i+s,r+o),u=i,d=r;break;case"a":drawArc(this,u+s,d+o,[e[1],e[2],e[3],e[4],e[5],e[6]+u+s,e[7]+d+o]),u+=e[6],d+=e[7];break;case"A":drawArc(this,u+s,d+o,[e[1],e[2],e[3],e[4],e[5],e[6]+s,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,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==r||1!==n)for(let a=0,s=t.length;a<s;++a){const s=t[a].slice();switch(s[0]){case enumCommandMap.L:this.lineToTransform(s,e,i,r,n);break;case enumCommandMap.M:this.moveToTransform(s,e,i,r,n);break;case enumCommandMap.C:this.bezierCurveToTransform(s,e,i,r,n);break;case enumCommandMap.Q:this.quadraticCurveToTransform(s,e,i,r,n);break;case enumCommandMap.A:this.arcToTransform(s,e,i,r,n);break;case enumCommandMap.E:this.ellipseTransform(s,e,i,r,n);break;case enumCommandMap.R:this.rectTransform(s,e,i,r,n);break;case enumCommandMap.AT:this.arcToTransform(s,e,i,r,n);break;case enumCommandMap.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),renderCommandList(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===exports.Direction.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return abs(t.p0.y-e.p1.y)}if(this.direction===exports.Direction.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return abs(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e<this.curves.length;e++){const i=this.curves[e];if(i.includeX(t))return i.getYAt(t)}return 1/0}getAttrAt(t){if(!this._curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let r=0;r<this._curves.length;r++){e=this._curves[r];const n=e.getLength(this.direction);if(i+n>=t)break;i+=n}const r=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(r),angle:e.getAngleAt(r)}}drawWithClipRange(t,e,i,r,n){this.tryBuildCurves();const a=this.getLength()*n;let s=0;for(let n=0;n<this._curves.length;n++){const o=this._curves[n],l=o.getLength(this.direction);if(!(s+l<=a)){const n=1-(s+l-a)/l;o.draw(t,i,r,e,e,n);break}o.draw(t,i,r,e,e,1),s+=l}}}const temp=["l",0,0,0,0,0,0,0];function scale(t,e,i){const r=temp[0]=t[0];if("a"===r||"A"===r)temp[1]=e*t[1],temp[2]=i*t[2],temp[3]=t[3],temp[4]=t[4],temp[5]=t[5],temp[6]=e*t[6],temp[7]=i*t[7];else if("h"===r||"H"===r)temp[1]=e*t[1];else if("v"===r||"V"===r)temp[1]=i*t[1];else for(let r=1,n=t.length;r<n;++r)temp[r]=(r%2==1?e:i)*t[r];return temp}const DefaultLayout={alignSelf:"auto"},DefaultTransform={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 Matrix},DefaultFillStyle={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},commonStroke={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},DefaultStrokeStyle=Object.assign({outerBorder:Object.assign(Object.assign({},commonStroke),{distance:0}),innerBorder:Object.assign(Object.assign({},commonStroke),{distance:0})},commonStroke),DefaultTextStyle={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:exports.MeasureModeEnum.fontBounding,keepCenterInLine:!1},DefaultPickStyle={pickStrokeBuffer:0},DefaultStyle=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,autoAnimateTexture:!1,textureRatio:0,textureOptions: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},DefaultFillStyle),DefaultStrokeStyle),DefaultLayout),DefaultPickStyle),DefaultConnectAttribute={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},DefaultDebugAttribute={_debug_bounds:!1},DefaultAttribute=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},DefaultDebugAttribute),DefaultStyle),DefaultTransform);function addAttributeToPrototype(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))}function rewriteProto(t,e){Object.setPrototypeOf(t,e)}const DefaultArcAttribute=Object.assign(Object.assign({},DefaultAttribute),{startAngle:0,endAngle:pi2,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),DefaultAreaAttribute=Object.assign(Object.assign(Object.assign({},DefaultAttribute),DefaultConnectAttribute),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),DefaultCircleAttribute=Object.assign(Object.assign({},DefaultAttribute),{radius:1,startAngle:0,endAngle:pi2}),DefaultGroupAttribute=Object.assign(Object.assign({},DefaultAttribute),{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}),DefaultGlyphAttribute=Object.assign(Object.assign({},DefaultAttribute),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),DefaultLineAttribute=Object.assign(Object.assign(Object.assign({},DefaultAttribute),DefaultConnectAttribute),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),DefaultPathAttribute=Object.assign(Object.assign({},DefaultAttribute),{path:new CustomPath2D,fillStrokeOrder:1,clipRange:1,customPath:()=>{Logger.getInstance().warn("空函数")}}),DefaultPolygonAttribute=Object.assign(Object.assign({},DefaultAttribute),{points:[],cornerRadius:0,closePath:!0}),DefaultRectAttribute=Object.assign(Object.assign({},DefaultAttribute),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),DefaultRect3dAttribute=Object.assign(Object.assign({},DefaultAttribute),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),DefaultSymbolAttribute=Object.assign(Object.assign({},DefaultAttribute),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),DefaultTextAttribute=Object.assign(Object.assign(Object.assign({},DefaultAttribute),DefaultTextStyle),{strokeBoundsBuffer:0,keepDirIn3d:!0}),DefaultRichTextAttribute=Object.assign(Object.assign(Object.assign({},DefaultAttribute),DefaultTextStyle),{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}),DefaultImageAttribute=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},DefaultAttribute),{fill:!0,cornerRadius:0}),DefaultRichTextIconAttribute=Object.assign(Object.assign({},DefaultImageAttribute),{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 Application{}const application=new Application,parse=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 r(){return n("linear",t.linearGradient,a)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,s)}function n(e,r,n){return function(r,a){const s=y(r);if(s){y(t.startCall)||i("Missing (");const r=function(r){const a=n();return a&&(y(t.comma)||i("Missing comma before color stops")),{type:e,orientation:a,colorStops:d(p)}}();return y(t.endCall)||i("Missing )"),r}}(r)}function a(){return g("directional",t.sideOrCorner,1)||g("angular",t.angleValue,1)}function s(){return g("angular",t.fromAngleValue,1)}function o(){let i,r,n=l();return n&&(i=[],i.push(n),r=e,y(t.comma)&&(n=l(),n?i.push(n):e=r)),i}function l(){let t=function(){const t=g("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=g("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 g("extent-keyword",t.extentKeywords,1)}function c(){if(g("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 r=e();const n=[];if(r)for(n.push(r);y(t.comma);)r=e(),r?n.push(r):i("One extra comma");return n}function p(){const e=g("hex",t.hexColor,1)||g("rgba",t.rgbaColor,1)||g("rgb",t.rgbColor,1)||g("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=f(),e}function f(){return g("%",t.percentageValue,1)||g("position-keyword",t.positionKeywords,1)||m()}function m(){return g("px",t.pixelValue,1)||g("em",t.emValue,1)}function g(t,e,i){const r=y(e);if(r)return{type:t,value:r[i]}}function y(t){const i=/^[\n\r\t\s]+/.exec(e);i&&v(i[0].length);const r=t.exec(e);return r&&v(r[0].length),r}function v(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(r);return e.length>0&&i("Invalid input not EOF"),t}()}}();class GradientParser{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(GradientParser.IsGradientStr(t))try{const e=parse(t)[0];if(e){if("linear"===e.type)return GradientParser.ParseLinear(e);if("radial"===e.type)return GradientParser.ParseRadial(e);if("conic"===e.type)return GradientParser.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,r=pi/2,n=parseFloat(e.value)/180*pi-r;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+pi2,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,r=pi/2;let n="angular"===e.type?parseFloat(e.value)/180*pi:0;for(;n<0;)n+=pi2;for(;n>=pi2;)n-=pi2;let a=0,s=0,o=0,l=0;return n<r?(a=0,s=1,o=Math.sin(n),l=s-Math.cos(n)):n<pi?(a=0,s=0,o=Math.cos(n-r),l=Math.sin(n-r)):n<pi+r?(a=1,s=0,o=a-Math.sin(n-pi),l=Math.cos(n-pi)):(a=1,o=a-Math.cos(n-r-pi),l-=Math.sin(n-r-pi)),{gradient:"linear",x0:a,y0:s,x1:o,y1:l,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function getScaledStroke(t,e,i){let r=e;const{a:n,b:a,c:s,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+a*a),h=Math.sign(o)*Math.sqrt(s*s+o*o);return l+h===0?0:(r=r/Math.abs(l+h)*2*i,r)}function createColor(t,e,i){let r,n,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(isArray$1(e))for(let t=0;t<e.length&&(n=e[t],!n);t++);else n=e;if(n=GradientParser.Parse(n),"string"==typeof n)return n;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-a,c=e.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;o/=t,l/=e,h/=t,c/=e}"linear"===n.gradient?r=createLinearGradient(t,n,h,c,o,l):"conical"===n.gradient?r=createConicGradient(t,n,h,c,o,l):"radial"===n.gradient&&(r=createRadialGradient(t,n,h,c,o,l))}return r||"orange"}function createLinearGradient(t,e,i,r,n,a){var s,o,l,h;const c=t.createLinearGradient(i+(null!==(s=e.x0)&&void 0!==s?s:0)*n,r+(null!==(o=e.y0)&&void 0!==o?o:0)*a,i+(null!==(l=e.x1)&&void 0!==l?l:1)*n,r+(null!==(h=e.y1)&&void 0!==h?h:0)*a);return e.stops.forEach((t=>{c.addColorStop(t.offset,t.color)})),c}function createRadialGradient(t,e,i,r,n,a){var s,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(s=e.x0)&&void 0!==s?s:.5)*n,r+(null!==(o=e.y0)&&void 0!==o?o:.5)*a,Math.max(n,a)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,r+(null!==(c=e.y1)&&void 0!==c?c:.5)*a,Math.max(n,a)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}function createConicGradient(t,e,i,r,n,a){var s,o;const l=t.createConicGradient(i+(null!==(s=e.x)&&void 0!==s?s:0)*n,r+(null!==(o=e.y)&&void 0!==o?o:0)*a,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,a+r,void 0)}const DIRECTION_KEY={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"}},defaultFormatting={fontSize:16,fontFamily:DEFAULT_TEXT_FONT_FAMILY,fill:!0,stroke:!1,fontWeight:"normal",lineHeight:"normal",fontStyle:"normal",textDecoration:"none",textAlign:"left",script:"normal"},regLetter=/\w|\(|\)|-/,regPunctuation=/[.?!,;:/,。?!、;:]/,regFirstSpace=/\S/,setTextStyle=(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 applyFillStyle(t,e,i){const r=e&&e.fill||defaultFormatting.fill;if(!r)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:a=1}=e;t.globalAlpha=n*a,t.fillStyle=i?createColor(t,r,{AABBBounds:i}):r,setTextStyle(t,e)}function applyStrokeStyle(t,e){const i=e&&e.stroke||defaultFormatting.stroke;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:r=1,opacity:n=1}=e;t.globalAlpha=r*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,setTextStyle(t,e)}function getStrByWithCanvas(t,e,i,r,n){if(!e||e<=0)return 0;const a=application.graphicUtil.textMeasure;let s=r,o=t.slice(0,s),l=Math.floor(a.measureText(o,i).width),h=t.slice(0,s+1),c=Math.floor(a.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?s--:s++,s>t.length){s=t.length;break}if(s<0){s=0;break}o=t.slice(0,s),l=Math.floor(a.measureText(o,i).width),h=t.slice(0,s+1),c=Math.floor(a.measureText(h,i).width)}return n&&(s=testLetter(t,s)),s}function testLetter(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e;for(;regLetter.test(t[r-1])&&regLetter.test(t[r])||regPunctuation.test(t[r]);)if(r--,r<=0)return i?testLetter2(t,e):e;return r}function testLetter2(t,e){let i=e;for(;regLetter.test(t[i-1])&&regLetter.test(t[i])||regPunctuation.test(t[i]);)if(i++,i>=t.length)return i;return i}function measureTextCanvas(t,e){const i=application.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(r.width=Math.floor(i.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(i.width),r.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),r.ascent=Math.floor(i.actualBoundingBoxAscent),r.descent=r.height-r.ascent),r}var __decorate$1I=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let ATextMeasure=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const r=this.context.measureText(t);return i?this.compatibleMetrics(r,e):r}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const r=this.context.measureText(t);return i?this.compatibleMetrics(r,e):r}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){const{ascent:i,descent:r}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=r,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=r}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){const{left:i,right:r}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=r}return t}estimate(t,e){let{fontSize:i=DefaultTextAttribute.fontSize}=e,r=0,n=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?r++:n++;return{width:~~(.8*r*i+n*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 r;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)):null!==(r=e.fontSize)&&void 0!==r?r:DefaultTextStyle.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 r;return this.context?(i=null!=i?i:this._measureTextWithoutAlignBaseline(t,e,!0),Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)):null!==(r=e.fontSize)&&void 0!==r?r:DefaultTextStyle.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:DefaultTextStyle.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:DefaultTextStyle.fontSize,{textAlign:r}=t;return"center"===r?{left:i/2,right:i/2}:"right"===r||"end"===r?{left:i,right:0}:{left:0,right:i}}measureTextPixelADscentAndWidth(t,e,i){if(!this.context)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:this.estimate(t,e).width});const r=this._measureTextWithoutAlignBaseline(t,e,!0);if(i===exports.MeasureModeEnum.actualBounding)return{ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,width:r.width};if(i===exports.MeasureModeEnum.estimate)return Object.assign(Object.assign({},this.measureTextBoundADscentEstimate(e)),{width:r.width});if(i===exports.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,r){if(0===t.length)return{verticalList:t,width:0};const{fontSize:n=12}=e;t.forEach((t=>{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const a=[];let s=0,o=0;for(;o<t.length&&s+t[o].width<i;o++)s+=t[o].width,a.push(t[o]);if(t[o]&&t[o].text.length>1){const n=this._clipText(t[o].text,e,i-s,0,t[o].text.length-1,"end",!1);if(r&&n.str!==t[o].text){let i="",r=0;for(let e=0;e<o;e++){const n=t[e];i+=n.text,r+=n.text.length}i+=t[o].text;let a=testLetter(i,r+n.str.length);a-=r,a!==n.str.length-1&&(n.str=n.str.substring(0,a),n.width=this.measureTextWidth(n.str,e))}a.push(Object.assign(Object.assign({},t[o]),{text:n.str,width:n.width})),s+=n.width}return{verticalList:a,width:s}}clipText(t,e,i,r,n){if(0===t.length)return{str:"",width:0};let a=this.measureTextWidth(t,e);if(a<=i)return{str:t,width:a};if(a=this.measureTextWidth(t[0],e),a>i)return{str:"",width:0};const s=this._clipText(t,e,i,0,t.length-1,"end",!1);if(r&&s.str!==t){let i=testLetter(t,s.str.length,n);i!==s.str.length&&(i>s.str.length&&(s.wordBreaked=i,i=s.str.length),s.str=t.substring(0,i),s.width=this.measureTextWidth(s.str,e))}return s}_clipText(t,e,i,r,n,a,s){let o;if("start"===a)o=this._clipTextStart(t,e,i,r,n),s&&(o.result=s+o.str);else if("middle"===a){const r=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:r.width,result:r.left+s+r.right}}else o=this._clipTextEnd(t,e,i,r,n),s&&(o.result=o.str+s);return o}_clipTextEnd(t,e,i,r,n){if(r===n){Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${r}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const a=Math.floor((r+n)/2),s=t.substring(0,a+1),o=this.measureTextWidth(s,e);let l;if(o>i){if(s.length<=1)return{str:"",width:0};const n=t.substring(0,a);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,r,a)}if(o<i){if(a>=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const r=t.substring(0,a+2);return l=this.measureTextWidth(r,e),l>=i?{str:s,width:o}:this._clipTextEnd(t,e,i,a,n)}return{str:s,width:o}}_clipTextStart(t,e,i,r,n){const a=Math.ceil((r+n)/2),s=t.substring(a-1,t.length),o=this.measureTextWidth(s,e);let l;if(o>i){if(s.length<=1)return{str:"",width:0};const r=t.substring(a,t.length);return l=this.measureTextWidth(r,e),l<=i?{str:r,width:l}:this._clipTextStart(t,e,i,a,t.length)}if(o<i){if(a<=0)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(a-2,t.length);return l=this.measureTextWidth(n,e),l>=i?{str:s,width:o}:this._clipTextStart(t,e,i,r,a)}return{str:s,width:o}}_clipTextMiddle(t,e,i,r,n,a,s,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+s>i)return{left:r,right:n,width:a+s};const c=t.substring(t.length-o,t.length),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:n,width:h+s}:this._clipTextMiddle(t,e,i,l,c,h,u,o+1)}clipTextWithSuffixVertical(t,e,i,r,n,a){if(""===r)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const s=this.clipTextVertical(t,e,i,n);if(s.verticalList.length===t.length&&s.verticalList[s.verticalList.length-1].width===t[t.length-1].width)return s;const o=this.measureTextWidth(r,e);if(o>i)return s;let l;if(i-=o,"start"===a){const a=this.revertVerticalList(t);l=this.clipTextVertical(a,e,i,n);const s=this.revertVerticalList(l.verticalList);s.unshift({text:r,direction:1,width:o}),l.verticalList=s}else if("middle"===a){const a=this.clipTextVertical(t,e,i/2,n),s=this.revertVerticalList(t),h=this.clipTextVertical(s,e,i/2,n);a.verticalList.push({text:r,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>a.verticalList.push(t))),l={verticalList:a.verticalList,width:a.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:r,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,r,n,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===r)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!s&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(r,e);if(l>i)return{str:"",width:0};if(s&&o+l<=i)return{str:t+r,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,a,r);if(n&&h.str!==t){const i=testLetter(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else s&&h.str===t&&(h.result=t+r);return h.str=h.result,h.width+=l,h}};ATextMeasure=__decorate$1I([injectable()],ATextMeasure);var __decorate$1H=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};const TextMeasureContribution=Symbol.for("TextMeasureContribution");exports.DefaultTextMeasureContribution=class extends ATextMeasure{},exports.DefaultTextMeasureContribution=__decorate$1H([injectable()],exports.DefaultTextMeasureContribution);const container=new Container,CanvasFactory=Symbol.for("CanvasFactory"),Context2dFactory=Symbol.for("Context2dFactory");function wrapCanvas(t){return container.getNamed(CanvasFactory,application.global.env)(t)}function wrapContext(t,e){return container.getNamed(Context2dFactory,application.global.env)(t,e)}const EPSILON_NUMERIC=1e-4,THREE_SQRT=Math.sqrt(3),ONE_THIRD=1/3;function isAroundZero(t){return t>-EPSILON&&t<EPSILON}function isNotAroundZero(t){return t>EPSILON||t<-EPSILON}const _v0=[0,0],_v1=[0,0],_v2=[0,0];function distanceSquare(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function quadraticAt(t,e,i,r){const n=1-r;return n*(n*t+2*r*e)+r*r*i}function cubicAt(t,e,i,r,n){const a=1-n;return a*a*(a*t+3*n*e)+n*n*(n*r+3*a*i)}function quadraticRootAt(t,e,i,r,n){const a=t-2*e+i,s=2*(e-t),o=t-r;let l=0;if(isAroundZero(a)){if(isNotAroundZero(s)){const t=-o/s;t>=0&&t<=1&&(n[l++]=t)}}else{const t=s*s-4*a*o;if(isAroundZero(t)){const t=-s/(2*a);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-s+e)/(2*a),r=(-s-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),r>=0&&r<=1&&(n[l++]=r)}}return l}function quadraticExtremum(t,e,i){const r=t+i-2*e;return 0===r?.5:(t-e)/r}function quadraticProjectPoint(t,e,i,r,n,a,s,o,l){let h=0,c=.005,u=1/0;_v0[0]=s,_v0[1]=o;for(let s=0;s<1;s+=.05){_v1[0]=quadraticAt(t,i,n,s),_v1[1]=quadraticAt(e,r,a,s);const o=distanceSquare(_v0,_v1);o<u&&(h=s,u=o)}u=1/0;for(let s=0;s<32&&!(c<EPSILON_NUMERIC);s++){const s=h-c,o=h+c;_v1[0]=quadraticAt(t,i,n,s),_v1[1]=quadraticAt(e,r,a,s);const l=distanceSquare(_v1,_v0);if(s>=0&&l<u)h=s,u=l;else{_v2[0]=quadraticAt(t,i,n,o),_v2[1]=quadraticAt(e,r,a,o);const s=distanceSquare(_v2,_v0);o<=1&&s<u?(h=o,u=s):c*=.5}}return l&&(l[0]=quadraticAt(t,i,n,h),l[1]=quadraticAt(e,r,a,h)),Math.sqrt(u)}function cubicProjectPoint(t,e,i,r,n,a,s,o,l,h,c){let u,d,p,f,m=0,g=.005,y=1/0;_v0[0]=l,_v0[1]=h;for(let l=0;l<1;l+=.05)_v1[0]=cubicAt(t,i,n,s,l),_v1[1]=cubicAt(e,r,a,o,l),p=distanceSquare(_v0,_v1),p<y&&(m=l,y=p);y=1/0;for(let l=0;l<32&&!(g<EPSILON_NUMERIC);l++)u=m-g,d=m+g,_v1[0]=cubicAt(t,i,n,s,u),_v1[1]=cubicAt(e,r,a,o,u),p=distanceSquare(_v1,_v0),u>=0&&p<y?(m=u,y=p):(_v2[0]=cubicAt(t,i,n,s,d),_v2[1]=cubicAt(e,r,a,o,d),f=distanceSquare(_v2,_v0),d<=1&&f<y?(m=d,y=f):g*=.5);return c&&(c[0]=cubicAt(t,i,n,s,m),c[1]=cubicAt(e,r,a,o,m)),Math.sqrt(y)}function normalizeRadian(t){return(t%=pi2)<0&&(t+=pi2),t}function containQuadStroke(t,e,i,r,n,a,s,o,l){if(0===s)return!1;const h=s;return!(l>e+h&&l>r+h&&l>a+h||l<e-h&&l<r-h&&l<a-h||o>t+h&&o>i+h&&o>n+h||o<t-h&&o<i-h&&o<n-h)&&quadraticProjectPoint(t,e,i,r,n,a,o,l,null)<=h/2}function containCubicStroke(t,e,i,r,n,a,s,o,l,h,c){if(0===l)return!1;const u=l;return!(c>e+u&&c>r+u&&c>a+u&&c>o+u||c<e-u&&c<r-u&&c<a-u&&c<o-u||h>t+u&&h>i+u&&h>n+u&&h>s+u||h<t-u&&h<i-u&&h<n-u&&h<s-u)&&cubicProjectPoint(t,e,i,r,n,a,s,o,h,c,null)<=u/2}function containArcStroke(t,e,i,r,n,a,s,o,l){if(0===s)return!1;const h=s;o-=t,l-=e;const c=Math.sqrt(o*o+l*l);if(c-h>i||c+h<i)return!1;if(Math.abs(r-n)%pi2<1e-4)return!0;if(a){const t=r;r=normalizeRadian(n),n=normalizeRadian(t)}else r=normalizeRadian(r),n=normalizeRadian(n);r>n&&(n+=pi2);let u=Math.atan2(l,o);return u<0&&(u+=pi2),u>=r&&u<=n||u+pi2>=r&&u+pi2<=n}function containLineStroke(t,e,i,r,n,a,s){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(s>e+l&&s>r+l||s<e-l&&s<r-l||a>t+l&&a>i+l||a<t-l&&a<i-l)return!1;if(t===i)return Math.abs(a-t)<=o/2;h=(e-r)/(t-i),c=(t*r-i*e)/(t-i);const u=h*a-s+c;return u*u/(h*h+1)<=o/2*o/2}const EPSILON=1e-4;function cubicRootAt(t,e,i,r,n,a){const s=r+3*(e-i)-t,o=3*(i-2*e+t),l=3*(e-t),h=t-n,c=o*o-3*s*l,u=o*l-9*s*h,d=l*l-3*o*h;let p=0;if(isAroundZero(c)&&isAroundZero(u))if(isAroundZero(o))a[0]=0;else{const t=-l/o;t>=0&&t<=1&&(a[p++]=t)}else{const t=u*u-4*c*d;if(isAroundZero(t)){const t=u/c,e=-o/s+t,i=-t/2;e>=0&&e<=1&&(a[p++]=e),i>=0&&i<=1&&(a[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*s*(-u+e),r=c*o+1.5*s*(-u-e);i=i<0?-Math.pow(-i,ONE_THIRD):Math.pow(i,ONE_THIRD),r=r<0?-Math.pow(-r,ONE_THIRD):Math.pow(r,ONE_THIRD);const n=(-o-(i+r))/(3*s);n>=0&&n<=1&&(a[p++]=n)}else{const t=(2*c*o-3*s*u)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),r=Math.cos(e),n=(-o-2*i*r)/(3*s),l=(-o+i*(r+THREE_SQRT*Math.sin(e)))/(3*s),h=(-o+i*(r-THREE_SQRT*Math.sin(e)))/(3*s);n>=0&&n<=1&&(a[p++]=n),l>=0&&l<=1&&(a[p++]=l),h>=0&&h<=1&&(a[p++]=h)}}return p}function cubicExtrema(t,e,i,r,n){const a=6*i-12*e+6*t,s=9*e+3*r-3*t-9*i,o=3*e-3*t;let l=0;if(isAroundZero(s)){if(isNotAroundZero(a)){const t=-o/a;t>=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*s*o;if(isAroundZero(t))n[0]=-a/(2*s);else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*s),r=(-a-e)/(2*s);i>=0&&i<=1&&(n[l++]=i),r>=0&&r<=1&&(n[l++]=r)}}return l}function isAroundEqual(t,e){return Math.abs(t-e)<EPSILON}const roots=[-1,-1,-1],extrema=[-1,-1];function swapExtrema(){const t=extrema[0];extrema[0]=extrema[1],extrema[1]=t}function windingCubic(t,e,i,r,n,a,s,o,l,h){if(h>e&&h>r&&h>a&&h>o||h<e&&h<r&&h<a&&h<o)return 0;const c=cubicRootAt(e,r,a,o,h,roots);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let h=0;h<c;h++){const c=roots[h],m=0===c||1===c?.5:1;cubicAt(t,i,n,s,c)<l||(d<0&&(d=cubicExtrema(e,r,a,o,extrema),extrema[1]<extrema[0]&&d>1&&swapExtrema(),p=cubicAt(e,r,a,o,extrema[0]),d>1&&(f=cubicAt(e,r,a,o,extrema[1]))),2===d?c<extrema[0]?u+=p<e?m:-m:c<extrema[1]?u+=f<p?m:-m:u+=o<f?m:-m:c<extrema[0]?u+=p<e?m:-m:u+=o<p?m:-m)}return u}function windingQuadratic(t,e,i,r,n,a,s,o){if(o>e&&o>r&&o>a||o<e&&o<r&&o<a)return 0;const l=quadraticRootAt(e,r,a,o,roots);if(0===l)return 0;const h=quadraticExtremum(e,r,a);if(h>=0&&h<=1){let o=0;const c=quadraticAt(e,r,a,h);for(let r=0;r<l;r++){const l=0===roots[r]||1===roots[r]?.5:1;quadraticAt(t,i,n,roots[r])<s||(roots[r]<h?o+=c<e?l:-l:o+=a<c?l:-l)}return o}const c=0===roots[0]||1===roots[0]?.5:1;return quadraticAt(t,i,n,roots[0])<s?0:a<e?c:-c}function windingArc(t,e,i,r,n,a,s,o){if((o-=e)>i||o<-i)return 0;const l=Math.sqrt(i*i-o*o);roots[0]=-l,roots[1]=l;const h=Math.abs(r-n);if(h<1e-4)return 0;if(h>=pi2-1e-4){r=0,n=pi2;const e=a?1:-1;return s>=roots[0]+t&&s<=roots[1]+t?e:0}if(r>n){const t=r;r=n,n=t}r<0&&(r+=pi2,n+=pi2);let c=0;for(let e=0;e<2;e++){const i=roots[e];if(i+t>s){let t=Math.atan2(o,i),e=a?1:-1;t<0&&(t=pi2+t),(t>=r&&t<=n||t+pi2>=r&&t+pi2<=n)&&(t>pi/2&&t<1.5*pi&&(e=-e),c+=e)}}return c}function modpi2(t){return Math.round(t/pi*1e8)/1e8%2*pi}function normalizeArcAngles(t,e){let i=modpi2(t[0]);i<0&&(i+=pi2);const r=i-t[0];let n=t[1];n+=r,!e&&n-i>=pi2?n=i+pi2:e&&i-n>=pi2?n=i-pi2:!e&&i>n?n=i+(pi2-modpi2(i-n)):e&&i<n&&(n=i-(pi2-modpi2(n-i))),t[0]=i,t[1]=n}const tmpAngles=[0,0];function containPath(t,e,i,r,n){const a=t,s=t.length;let o,l,h=0,c=0,u=0,d=0,p=0;for(let t=0;t<s;t++){const s=a[t],f=0===t;s[0]===enumCommandMap.M&&t>1&&(i||(h+=isPointInLine(c,u,d,p,r,n))),f&&(c=s[1],u=s[2],d=c,p=u);const m=s[0],g=s[1],y=s[2],v=s[3],b=s[4],x=s[5],C=s[6];let _=b,T=x;tmpAngles[0]=_,tmpAngles[1]=T,normalizeArcAngles(tmpAngles,Boolean(s[6])),_=tmpAngles[0],T=tmpAngles[1];const A=_,S=T-_,P=!!(1-(s[6]?0:1)),w=(r-g)*v/v+g;switch(m){case enumCommandMap.M:d=g,p=y,c=d,u=p;break;case enumCommandMap.L:if(i){if(containLineStroke(c,u,g,y,e,r,n))return!0}else h+=isPointInLine(c,u,g,y,r,n)||0;c=g,u=y;break;case enumCommandMap.C:if(i){if(containCubicStroke(c,u,g,y,v,b,x,C,e,r,n))return!0}else h+=windingCubic(c,u,g,y,v,b,x,C,r,n)||0;c=x,u=C;break;case enumCommandMap.Q:if(i){if(containQuadStroke(c,u,g,y,v,b,e,r,n))return!0}else h+=windingQuadratic(c,u,g,y,v,b,r,n)||0;c=v,u=b;break;case enumCommandMap.A:if(o=Math.cos(A)*v+g,l=Math.sin(A)*v+y,f?(d=o,p=l):h+=isPointInLine(c,u,o,l,r,n),i){if(containArcStroke(g,y,v,A,A+S,P,e,w,n))return!0}else h+=windingArc(g,y,v,A,A+S,P,w,n);c=Math.cos(A+S)*v+g,u=Math.sin(A+S)*v+y;break;case enumCommandMap.R:if(d=c=g,p=u=y,o=d+v,l=p+b,i){if(containLineStroke(d,p,o,p,e,r,n)||containLineStroke(o,p,o,l,e,r,n)||containLineStroke(o,l,d,l,e,r,n)||containLineStroke(d,l,d,p,e,r,n))return!0}else h+=isPointInLine(o,p,o,l,r,n),h+=isPointInLine(d,l,d,p,r,n);break;case enumCommandMap.Z:if(i){if(containLineStroke(c,u,d,p,e,r,n))return!0}else h+=isPointInLine(c,u,d,p,r,n);c=d,u=p}}return i||isAroundEqual(u,p)||(h+=isPointInLine(c,u,d,p,r,n)||0),0!==h}function contain(t,e,i){return containPath(t,0,!1,e,i)}function containStroke(t,e,i,r){return containPath(t,e,!0,i,r)}class DefaultCanvasAllocate{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=wrapCanvas(Object.assign({nativeCanvas:application.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=wrapCanvas(Object.assign({nativeCanvas:application.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 canvasAllocate=new DefaultCanvasAllocate;var __decorate$1G=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1h=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const VWindow=Symbol.for("VWindow"),WindowHandlerContribution=Symbol.for("WindowHandlerContribution");exports.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 SyncHook(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(container.getNamed(WindowHandlerContribution,t.env).configure(this,t),this.actived=!0)},this._uid=Generator.GenAutoIncrementId(),this.global=application.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 r=this._handler.getWH();this._width=r.width,this._height=r.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,r,n,a){this._handler.setViewBoxTransform(t,e,i,r,n,a)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),r={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},r),r.x-=i.x1,r.y-=i.y1,r}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&isNumberClose(this.width,t.width())&&isNumberClose(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)}},exports.DefaultWindow=__decorate$1G([injectable(),__metadata$1h("design:paramtypes",[])],exports.DefaultWindow);var __decorate$1F=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1g=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$T=function(t,e){return function(i,r){e(i,r,t)}},TransformMode;exports.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=application.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=canvasAllocate.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 r;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const a={width:this._textMeasure.measureTextWidth(t,e),height:null!==(r=e.fontSize)&&void 0!==r?r:DefaultTextStyle.fontSize};return this.global.measureTextMethod=n,a}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new TextMeasure(Object.assign({defaultFontParams:{fontFamily:DefaultTextStyle.fontFamily,fontSize:DefaultTextStyle.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+TextMeasure.ALPHABET_CHAR_SET+TextMeasure.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const r=container.get(VWindow),n=t.AABBBounds,a=n.width(),s=n.height(),o=-n.x1,l=-n.y1;r.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:a,height:s,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(r,[t],{transMatrix:r.getViewBoxTransform(),viewBox:r.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=r.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}},exports.DefaultGraphicUtil=__decorate$1F([injectable(),__param$T(0,inject(ContributionProvider)),__param$T(0,named(TextMeasureContribution)),__metadata$1g("design:paramtypes",[Object])],exports.DefaultGraphicUtil),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(TransformMode||(TransformMode={}));const _matrix=new Matrix;exports.DefaultTransformUtil=class{constructor(){this.matrix=new Matrix}init(t){return this.mode=TransformMode.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=TransformMode.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const r=this.outSourceMatrix;if(_matrix.setValue(r.a,r.b,r.c,r.d,r.e,r.f),this.outTargetMatrix.reset(),i){const{x:r,y:n}=i;this.outTargetMatrix.translate(r,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-r,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(_matrix.a,_matrix.b,_matrix.c,_matrix.d,_matrix.e,_matrix.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(_matrix.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:r}=e;this.outTargetMatrix.translate(i,r),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-r)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(_matrix.a,_matrix.b,_matrix.c,_matrix.d,_matrix.e,_matrix.f),this}scale(t,e,i){return this.mode===TransformMode.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===TransformMode.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return _matrix.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(_matrix.a,_matrix.b,_matrix.c,_matrix.d,_matrix.e,_matrix.f),this}translate(t,e){return this.mode===TransformMode.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===TransformMode.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}},exports.DefaultTransformUtil=__decorate$1F([injectable(),__metadata$1g("design:paramtypes",[])],exports.DefaultTransformUtil);const defaultThemeObj={arc:DefaultArcAttribute,area:DefaultAreaAttribute,circle:DefaultCircleAttribute,line:DefaultLineAttribute,path:DefaultPathAttribute,symbol:DefaultSymbolAttribute,text:DefaultTextAttribute,rect:DefaultRectAttribute,polygon:DefaultPolygonAttribute,richtext:DefaultRichTextAttribute,richtextIcon:DefaultRichTextIconAttribute,image:DefaultImageAttribute,group:DefaultGroupAttribute,glyph:DefaultGlyphAttribute},themeKeys=Object.keys(defaultThemeObj);function newThemeObj(){return{arc:Object.assign({},defaultThemeObj.arc),area:Object.assign({},defaultThemeObj.area),circle:Object.assign({},defaultThemeObj.circle),line:Object.assign({},defaultThemeObj.line),path:Object.assign({},defaultThemeObj.path),symbol:Object.assign({},defaultThemeObj.symbol),text:Object.assign({},defaultThemeObj.text),rect:Object.assign({},defaultThemeObj.rect),polygon:Object.assign({},defaultThemeObj.polygon),richtext:Object.assign({},defaultThemeObj.richtext),richtextIcon:Object.assign({},defaultThemeObj.richtextIcon),image:Object.assign({},defaultThemeObj.image),group:Object.assign({},defaultThemeObj.group),glyph:Object.assign({},defaultThemeObj.glyph)}}function combine(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const globalThemeObj=newThemeObj();class Theme{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},themeKeys.forEach((t=>{this._defaultTheme[t]=Object.create(globalThemeObj[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 r=this.getParentWithTheme(t);if(r){const t=r.theme;(t.dirty||i)&&t.applyTheme(r,e,!0)}this.userTheme?this.doCombine(r&&r.theme.combinedTheme):(r?this.combinedTheme=r.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,Logger.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;themeKeys.forEach((r=>{const n=Object.create(globalThemeObj[r]);t&&t[r]&&combine(n,t[r]),i[r]&&combine(n,i[r]),e[r]&&combine(n,e[r]),this.combinedTheme[r]=n})),e.common&&themeKeys.forEach((t=>{combine(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 globalTheme=new Theme;function getTheme(t,e){return t.glyphHost?getTheme(t.glyphHost):e?(t.isContainer,e):getThemeFromGroup(t)||t.attachedThemeGraphic&&getTheme(t.attachedThemeGraphic)||globalTheme.getTheme()}function getThemeFromGroup(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)):globalTheme.getTheme()}return null}var __awaiter$7=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};class Node extends EventEmitter{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=Generator.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 __awaiter$7(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let r=t(e,i++);if(r.then&&(r=yield r),r)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let r=t(e,i++);if(r.then&&(r=yield r),r)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&&Logger.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 r=this.insertInto(t,0);return this._ignoreWarn=!1,r}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,r)=>!(e===this||!t(e,r)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const r=e.find(t,!0);if(r)return i=r,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,r)=>{e!==this&&t(e,r)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const r=e.findAll(t,!0);r.length&&(i=i.concat(r))}})),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 r=isBoolean$1(i,!0)&&i||isObject$1(i)&&i.capture,n=isObject$1(i)&&i.once,a=isFunction$1(e)?void 0:e;return t=r?`${t}capture`:t,e=isFunction$1(e)?e:e.handleEvent,n?super.once(t,e,a):super.on(t,e,a),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const r=isBoolean$1(i,!0)&&i||isObject$1(i)&&i.capture,n=isFunction$1(e)?void 0:e;t=r?`${t}capture`:t,e=isFunction$1(e)?e:e.handleEvent;const a=isObject$1(i)&&i.once;return super.off(t,e,n,a),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return isObject$1(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),r=1;r<e;r++)i[r-1]=arguments[r];return super.emit(t.type,t,...i),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class FederatedEvent{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=FederatedEvent.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&&isFunction$1(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&&isFunction$1(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class FederatedMouseEvent extends FederatedEvent{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,r,n,a,s,o,l,h,c,u,d,p,f){throw new Error("Method not implemented.")}}class FederatedPointerEvent extends FederatedMouseEvent{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 r=new FederatedPointerEvent(this.manager);r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.detailPath=[],r.target=null,r.nativeEvent=this.nativeEvent,r.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyPointerData(this,r),null===(e=this.manager)||void 0===e||e.copyMouseData(this,r),null===(i=this.manager)||void 0===i||i.copyData(this,r),r.target=this.target,r.path=this.composedPath().slice();const n=this.composedDetailPath();return r.detailPath=n&&n.slice(),r.type=this.type,r}}class FederatedWheelEvent extends FederatedMouseEvent{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const r=new FederatedWheelEvent(this.manager);r.eventPhase=r.NONE,r.currentTarget=null,r.path=[],r.detailPath=[],r.target=null,r.nativeEvent=this.nativeEvent,r.originalEvent=this.originalEvent,null===(t=this.manager)||void 0===t||t.copyWheelData(this,r),null===(e=this.manager)||void 0===e||e.copyMouseData(this,r),null===(i=this.manager)||void 0===i||i.copyData(this,r),r.target=this.target,r.path=this.composedPath().slice();const n=this.composedDetailPath();return r.detailPath=n&&n.slice(),r.type=this.type,r}}FederatedWheelEvent.DOM_DELTA_PIXEL=0,FederatedWheelEvent.DOM_DELTA_LINE=1,FederatedWheelEvent.DOM_DELTA_PAGE=2;class CustomEvent extends FederatedEvent{constructor(t,e){super(),this.type=t,this.detail=e}}const WILDCARD="*",clock="object"==typeof performance&&performance.now?performance:Date;function isMouseLike(t){return"mouse"===t||"pen"===t}class EventManager{constructor(t,e){this.dispatch=new EventEmitter,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof FederatedPointerEvent))return void Logger.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(isMouseLike(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,r;if(!(t instanceof FederatedPointerEvent))return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),a=isMouseLike(n.pointerType),s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),a&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),a&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),a&&this.dispatchEvent(i,"mouseover");let r=null==o?void 0:o.parent;for(;r&&r!==this.rootTarget.parent&&r!==n.target;)r=r.parent;if(!r||r===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let r=o;for(;r&&r!==this.rootTarget;)i.add(r),r=r.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),a&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),a&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(r=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===r?void 0:r.cursor)||this.rootTarget.getCursor()),s.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,r;if(!(t instanceof FederatedPointerEvent))return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),a=this.createPointerEvent(t,t.type,e),s=isMouseLike(a.pointerType);this.dispatchEvent(a,"pointerover"),s&&this.dispatchEvent(a,"mouseover"),"mouse"===a.pointerType&&(this.cursorTarget=a.target,this.cursor=(null===(r=null===(i=a.target)||void 0===i?void 0:i.attribute)||void 0===r?void 0:r.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(a,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=a.composedPath(),this.freeEvent(a),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof FederatedPointerEvent))return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=isMouseLike(t.pointerType),r=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",r||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r||void 0);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),e&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(a)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof FederatedPointerEvent))return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=clock.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(isMouseLike(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const a=this.trackingData(t.pointerId),s=this.findMountedTarget(a.pressTargetsByButton[t.button]);let o=s;if(s&&!n.composedPath().includes(s)){let e=s;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(isMouseLike(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete a.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],a.clicksByButton[t.button]||(a.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:r});const s=a.clicksByButton[t.button];s.target===e.target&&r-s.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++s.clickCount:s.clickCount=1,s.target=e.target,s.timeStamp=r,e.detail=s.clickCount,isMouseLike(e.pointerType)?(this.dispatchEvent(e,"click"),2===s.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===s.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof FederatedPointerEvent))return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),r=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(r){let e=r;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):isMouseLike(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof FederatedWheelEvent))return void Logger.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,r,n,a,s,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===(r=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===r?void 0:r.stage)&&(null===(a=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===a?void 0:a.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.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 Logger.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 r=0,n=i.length-1;r<n;r++)if(t.currentTarget=i[r],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 r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],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 r,n;const a=this.allocateEvent(FederatedPointerEvent);return this.copyPointerData(t,a),this.copyMouseData(t,a),this.copyData(t,a),a.nativeEvent=t.nativeEvent,a.originalEvent=t,a.target=i||this.pickTarget(null!==(r=a.viewX)&&void 0!==r?r:a.global.x,null!==(n=a.viewY)&&void 0!==n?n:a.global.y,a),"string"==typeof e&&(a.type=e),a}createWheelEvent(t,e){var i,r;const n=this.allocateEvent(FederatedWheelEvent);return this.copyWheelData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.nativeEvent=t.nativeEvent,n.originalEvent=t,n.target=e||this.pickTarget(null!==(i=n.viewX)&&void 0!==i?i:n.global.x,null!==(r=n.viewY)&&void 0!==r?r:n.global.y,n),n}clonePointerEvent(t,e){const i=this.allocateEvent(FederatedPointerEvent);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 r=t.composedDetailPath();return i.detailPath=r&&r.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 FederatedPointerEvent&&e instanceof FederatedPointerEvent&&(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 FederatedMouseEvent&&e instanceof FederatedMouseEvent&&(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=clock.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 r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeEventListener(e,i[r].fn,{once:!0}),i[r].fn.call(i[r].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const i=t.currentTarget._events[WILDCARD];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let r=0,n=i.length;r<n&&!t.propagationImmediatelyStopped;r++)i[r].fn.call(i[r].context,t,e)}pickTarget(t,e,i){let r;const n=this.rootTarget.pick(t,e);return r=n&&n.graphic?n.graphic:n&&n.group?n.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=n.params),r}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}}const EventTarget={dispatchEvent(t){var e;if(!(t instanceof FederatedEvent))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 CustomEvent(t,e))}},TOUCH_TO_POINTER={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class EventSystem{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],r=this.bootstrapEvent(this.rootPointerEvent,i);this.manager.mapEvent(r)}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,r=i.length;t<r;t++){const r=this.bootstrapEvent(this.rootPointerEvent,i[t]);r.type+=e,this.manager.mapEvent(r)}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:r,global:n,autoPreventDefault:a=!1,clickInterval:s,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new EventManager(r,{clickInterval:s,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.rootPointerEvent=new FederatedPointerEvent,this.rootWheelEvent=new FederatedWheelEvent,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:r}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?r.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(r.style,n):i&&isString$1(t)&&!has$1(this.cursorStyles,t)&&(r.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 r=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(r)return r;let n=0,a=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,a=e.clientY||0}else n=t.clientX||0,a=t.clientY||0;const s=this.domElement.getBoundingClientRect();return{x:n-s.left,y:a-s.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,r=t.changedTouches.length;i<r;i++){const r=t.changedTouches[i];isUndefined$1(r.button)&&(r.button=0),isUndefined$1(r.buttons)&&(r.buttons=1),isUndefined$1(r.isPrimary)&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),isUndefined$1(r.width)&&(r.width=r.radiusX||1),isUndefined$1(r.height)&&(r.height=r.radiusY||1),isUndefined$1(r.tiltX)&&(r.tiltX=0),isUndefined$1(r.tiltY)&&(r.tiltY=0),isUndefined$1(r.pointerType)&&(r.pointerType="touch"),isUndefined$1(r.pointerId)&&(r.pointerId=r.identifier||0),isUndefined$1(r.pressure)&&(r.pressure=r.force||.5),isUndefined$1(r.twist)&&(r.twist=0),isUndefined$1(r.tangentialPressure)&&(r.tangentialPressure=0),isUndefined$1(r.layerX)&&(r.layerX=r.offsetX=r.clientX),isUndefined$1(r.layerY)&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=t.type,e.push(r)}else if(!this.globalObj.supportsMouseEvents||t instanceof MouseEvent&&!(this.supportsPointerEvents&&t instanceof PointerEvent)){const i=t;isUndefined$1(i.isPrimary)&&(i.isPrimary=!0),isUndefined$1(i.width)&&(i.width=1),isUndefined$1(i.height)&&(i.height=1),isUndefined$1(i.tiltX)&&(i.tiltX=0),isUndefined$1(i.tiltY)&&(i.tiltY=0),isUndefined$1(i.pointerType)&&(i.pointerType="mouse"),isUndefined$1(i.pointerId)&&(i.pointerId=1),isUndefined$1(i.pressure)&&(i.pressure=.5),isUndefined$1(i.twist)&&(i.twist=0),isUndefined$1(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:r}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=r,e.global.x=i,e.global.y=r,e.offset.x=i,e.offset.y=r;const{x:n,y:a}=this.mapToViewportPoint(e);return e.viewport.x=n,e.viewport.y=a,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:r}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=r,t.global.x=i,t.global.y=r,t.offset.x=i,t.offset.y=r;const{x:n,y:a}=this.mapToViewportPoint(t);return t.viewport.x=n,t.viewport.y=a,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=TOUCH_TO_POINTER[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=clock.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(),r=i.width(),n=i.height();return!(e.x<r&&e.y<n&&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 STATUS$1;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(STATUS$1||(STATUS$1={}));class RAFTickHandler{static Avaliable(){return!!application.global.getRequestAnimationFrame()}avaliable(){return RAFTickHandler.Avaliable()}tick(t,e){application.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class TimeOutTickHandler{static Avaliable(){return!0}avaliable(){return TimeOutTickHandler.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 DefaultTicker extends EventEmitter{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===STATUS$1.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(e)})),this.emit("tick",e))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=STATUS$1.INITIAL,application.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),application.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:RAFTickHandler},{mode:"timeout",cons:TimeOutTickHandler}];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 RAFTickHandler;break;case"timeout":t=new TimeOutTickHandler;break;default:Logger.getInstance().warn("非法的计时器模式"),t=new RAFTickHandler}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!==STATUS$1.INITIAL&&(this.status=STATUS$1.PAUSE,!0)}resume(){return this.status!==STATUS$1.INITIAL&&(this.status=STATUS$1.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===STATUS$1.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===STATUS$1.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=STATUS$1.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=STATUS$1.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}release(){this.stop(),this.timelines=[],this.tickerHandler.release(),this.emit("afterTick")}trySyncTickStatus(){this.status===STATUS$1.RUNNING&&this._handlerTick()}}class ManualTickHandler{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return ManualTickHandler.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 ManualTicker extends DefaultTicker{set mode(t){this.setupTickHandler()}get mode(){return this._mode}initHandler(){return this.mode="manual",null}setupTickHandler(){const t=new ManualTickHandler;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}}class Easing{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-Easing.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Easing.bounceIn(2*t):.5*Easing.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const r=e/pi2*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*pi2/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const r=e/pi2*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-r)*pi2/e)+1}}static getElasticInOut(t,e){return function(i){const r=e/pi2*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-r)*pi2/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-r)*pi2/e)*.5+1}}static registerFunc(t,e){Easing[t]=e}}Easing.quadIn=Easing.getPowIn(2),Easing.quadOut=Easing.getPowOut(2),Easing.quadInOut=Easing.getPowInOut(2),Easing.cubicIn=Easing.getPowIn(3),Easing.cubicOut=Easing.getPowOut(3),Easing.cubicInOut=Easing.getPowInOut(3),Easing.quartIn=Easing.getPowIn(4),Easing.quartOut=Easing.getPowOut(4),Easing.quartInOut=Easing.getPowInOut(4),Easing.quintIn=Easing.getPowIn(5),Easing.quintOut=Easing.getPowOut(5),Easing.quintInOut=Easing.getPowInOut(5),Easing.backIn=Easing.getBackIn(1.7),Easing.backOut=Easing.getBackOut(1.7),Easing.backInOut=Easing.getBackInOut(1.7),Easing.elasticIn=Easing.getElasticIn(1,.3),Easing.elasticOut=Easing.getElasticOut(1,.3),Easing.elasticInOut=Easing.getElasticInOut(1,.3*1.5),Easing.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Easing.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Easing.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};class DefaultTimeline{constructor(){this.id=Generator.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(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===exports.AnimateStatus.END?this.removeAnimate(e):e.status===exports.AnimateStatus.RUNNING||e.status===exports.AnimateStatus.INITIAL?(this.animateCount++,e.advance(t)):e.status===exports.AnimateStatus.PAUSED&&this.animateCount++,e=e.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 defaultTimeline=new DefaultTimeline;class ACustomAnimate{constructor(t,e,i,r,n){this.from=t,this.to=e,this.duration=i,this.easing=r,this.params=n,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 CbAnimate extends ACustomAnimate{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class Animate{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Generator.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:defaultTimeline,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=exports.AnimateStatus.INITIAL,this.tailAnimate=new SubAnimate(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}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=max(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){Animate.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(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Animate.mode;t&&e&exports.AnimateMode.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:exports.AttributeUpdateType.ANIMATE_PLAY})}runCb(t){const e=new CbAnimate((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,r,n,a){const s=Animate.interpolateMap.get(t)||Animate.interpolateMap.get("");return!!s&&s(t,e,i,r,n,a)}pause(){this.status===exports.AnimateStatus.RUNNING&&(this.status=exports.AnimateStatus.PAUSED)}resume(){this.status===exports.AnimateStatus.PAUSED&&(this.status=exports.AnimateStatus.RUNNING)}to(t,e,i,r){if(this.tailAnimate.to(t,e,i,r),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,r){if(this.tailAnimate.from(t,e,i,r),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 SubAnimate(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(t){if(this._duringTime<this._startTime){if(this._duringTime+t*this.timeScale<this._startTime)return void(this._duringTime+=t*this.timeScale);t=this._duringTime+t*this.timeScale-this._startTime,this._duringTime=this._startTime}this.status===exports.AnimateStatus.INITIAL&&(this.status=exports.AnimateStatus.RUNNING,this._onStart&&this._onStart.forEach((t=>t()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===exports.AnimateStatus.RUNNING&&(this.status=exports.AnimateStatus.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const r=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const a=t>=n;if(a&&(t=n),t===r)return a;for(let r=0;r<this.subAnimates.length&&(e=this.subAnimates[r],!(i+e.totalDuration>=t));r++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),a}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=exports.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()}}Animate.mode=exports.AnimateMode.NORMAL,Animate.interpolateMap=new Map;class SubAnimate{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 Step(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(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,r="string"==typeof i?Easing[i]:i,n=this._addStep(e,null,r);return n.type=exports.AnimateStepType.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,r){(null==e||e<0)&&(e=0);const n="string"==typeof i?Easing[i]:i,a=this._addStep(e,null,n);return a.type=exports.AnimateStepType.to,this._appendProps(t,a,!!r&&r.tempProps),a.propKeys||(a.propKeys=Object.keys(a.props)),r&&r.noPreventAttrs||this.target.animates&&this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(a.propKeys)})),this}from(t,e,i,r){this.to(t,0,i,r);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,r),this.stepTail.type=exports.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(t){if(t>0){const e=this._addStep(+t,null);e.type=exports.AnimateStepType.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const r=new Step(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(r),this.stepTail=r,r}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let r=e.prev;const n=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))}));r.prev;)r.props&&(r.propKeys||(r.propKeys=Object.keys(r.props)),r.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=r.props[t])}))),e.propKeys=Object.keys(e.props),r=r.prev;const a=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===a[t]){const e=this.animate.getStartProps();a[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,r=this.loop,n=this.rawPosition;let a,s,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(a=Math.floor(t/i),s=t-a*i,o=t>=r*i+i,o&&(s=i,a=r,t=s*a+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&a%2);return h&&(s=i-s),this._deltaPosition=s-this.position,this.position=s,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const r=this.position,n=this.duration;if(this.target&&i){let a=i.next;for(;a&&a.position<=r;)i=a,a=i.next;let s=t?0===n?1:r/n:(r-i.position)/i.duration;i.easing&&(s=i.easing(s)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,s,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,s)))}}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 Logger.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 Step{constructor(t,e,i,r){this.duration=e,this.position=t,this.props=i,this.easing=r}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 DefaultStateAnimateConfig={duration:200,easing:"cubicOut"},DefaultMorphingAnimateConfig={duration:1e3,easing:"quadInOut"};var Edge;exports.Edge=void 0,Edge=exports.Edge||(exports.Edge={}),Edge[Edge.Top=1]="Top",Edge[Edge.Right=2]="Right",Edge[Edge.Bottom=4]="Bottom",Edge[Edge.Left=8]="Left",Edge[Edge.ALL=15]="ALL";const _strokeVec4=[!1,!1,!1,!1],parseStroke=t=>{var e;let i=!0;if(isBoolean$1(t,!0)){for(let r=0;r<4;r++)_strokeVec4[r]=t,i&&(i=!(null!==(e=_strokeVec4[r])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)_strokeVec4[e]=!!t[e],i&&(i=!!_strokeVec4[e]);else _strokeVec4[0]=!1,_strokeVec4[1]=!1,_strokeVec4[2]=!1,_strokeVec4[3]=!1;return{isFullStroke:i,stroke:_strokeVec4}},_paddingVec4=[0,0,0,0],parsePadding=t=>t?isArray$1(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_paddingVec4[0]=t[0],_paddingVec4[2]=t[0],_paddingVec4[1]=t[1],_paddingVec4[3]=t[1],_paddingVec4):t:t:0,_coords=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],indexList=[1,2,3,0,1,2,3,0];function circleBounds(t,e,i,r){for(;t>=pi2;)t-=pi2;for(;t<0;)t+=pi2;for(;t>e;)e+=pi2;_coords[0].x=i,_coords[1].y=i,_coords[2].x=-i,_coords[3].y=-i;const n=Math.ceil(t/halfPi$1)%4,a=Math.ceil(e/halfPi$1)%4;if(r.add(cos(t)*i,sin(t)*i),r.add(cos(e)*i,sin(e)*i),n!==a||e-t>pi){let t=!1;for(let e=0;e<indexList.length;e++)if(t||n!==indexList[e]){if(t&&a===indexList[e])break;if(t){const t=_coords[indexList[e]];r.add(t.x,t.y)}}else{t=!0;const e=_coords[n];r.add(e.x,e.y)}}}function pointsEqual(t,e){return!(!t||!e)&&(Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every(((t,i)=>pointEqual(t,e[i]))):!Number.isNaN(t.x+t.y)&&pointEqual(t,e))}function pointEqual(t,e){return t.x===e.x&&t.y===e.y&&t.x1===e.x1&&t.y1===e.y1&&t.defined===e.defined}function pointInterpolation(t,e,i){const{x:r,y:n}=pointAt(t.x,t.y,e.x,e.y,i),{x:a,y:s}=pointAt(t.x1,t.y1,e.x1,e.y1,i),o=new Point(r,n,a,s);return o.defined=e.defined,o}function pointInterpolationHighPerformance(t,e,i,r){const{x:n,y:a}=pointAt(t.x,t.y,e.x,e.y,i),{x:s,y:o}=pointAt(t.x1,t.y1,e.x1,e.y1,i);return r.x=n,r.y=a,r.x1=s,r.y1=o,r.defined=e.defined,r}function pointsInterpolation(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let r=[];if(t.length>e.length){r=e.map((t=>{const e=new Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<e.length;n++)r[n]=pointInterpolation(t[n],e[n],i)}else{r=e.map((t=>{const e=new Point(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n<t.length;n++)r[n]=pointInterpolation(t[n],e[n],i)}return r}const transformKeys=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],isTransformKey=t=>transformKeys.includes(t);function getAttributeFromDefaultAttrList(t,e){if(isArray$1(t)){let i;for(let r=0;r<t.length&&void 0===i;r++)i=t[r][e];return i}return t[e]}class RafBasedSTO{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:RafBasedSTO.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)}}RafBasedSTO.TimeOut=1e3/60;const rafBasedSto=new RafBasedSTO,_calculateLineHeight=(t,e)=>isString$1(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,calculateLineHeight=(t,e)=>{const i=_calculateLineHeight(t,e);return isNaN(i)?i:Math.max(e,i)};class IncreaseCount extends ACustomAnimate{constructor(t,e,i,r,n){super(t,e,i,r,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,r,n,a,s,o;this.fromNumber=isNumber$1(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=isNumber$1(null===(r=this.to)||void 0===r?void 0:r.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(a=this.to)||void 0===a?void 0:a.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(s=this.params)||void 0===s?void 0:s.fixed)&&void 0!==o?o:Math.max(getDecimalPlaces(this.fromNumber),getDecimalPlaces(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))}}var Direction;!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"}(Direction||(Direction={}));class FadeInPlus extends ACustomAnimate{constructor(t,e,i,r,n){super(t,e,i,r,n);const{direction:a=Direction.LEFT_TO_RIGHT,fill:s=!0,stroke:o=!0}=n||{};this.direction=a,this.fill=s,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 Direction.RIGHT_TO_LEFT:this.rightToLeft(t,e,i);break;case Direction.TOP_TO_BOTTOM:this.topToBottom(t,e,i);break;case Direction.BOTTOM_TO_TOP:this.bottomToTop(t,e,i);break;case Direction.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,r=e*t;i.lineDash=[r,t-r]}}rightToLeft(t,e,i){}topToBottom(t,e,i){}bottomToTop(t,e,i){}}class InputText extends ACustomAnimate{constructor(){super(...arguments),this.fromText="",this.toText=""}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,r;if(this.fromText=null!==(e=null===(t=this.from)||void 0===t?void 0:t.text)&&void 0!==e?e:"",this.toText=null!==(r=null===(i=this.to)||void 0===i?void 0:i.text)&&void 0!==r?r:"",!this.toText||isArray$1(this.toText))this.valid=!1;else{this.toText=this.toText.toString();const t=this.target.attachShadow(),e=application.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 r;if(!1===this.valid)return;const n=this.fromText.length,a=this.toText.length,s=Math.ceil(n+(a-n)*e);i.text=this.toText.substr(0,s);const o=null===(r=this.target.shadowRoot)||void 0===r?void 0:r.at(0),l=this.target.clipedWidth+2;o.setAttribute("x",l)}}class StreamLight extends ACustomAnimate{constructor(t,e,i,r,n){super(t,e,i,r,n)}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(),r=application.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=r,r.pathProxy=new CustomPath2D,i.add(r)}onStartRect(){var t,e,i;const r=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,a=n?"height":"width",s=n?"width":"height",o=this.target.AABBBounds[a](),l=n?0:this.target.AABBBounds.y1,h=application.graphicService.creator.rect(Object.assign(Object.assign({[a]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[s]:0}));this.rect=h,r.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(t,e,i){var r,n,a,s,o,l,h,c,u,d,p,f,m,g,y,v;const b=null===(n=null===(r=this.params)||void 0===r?void 0:r.isHorizontal)||void 0===n||n,x=this.target.attribute;if(b){const i=null!==(s=null!==(a=x.width)&&void 0!==a?a:Math.abs(x.x1-x.x))&&void 0!==s?s:250,r=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-n,p=d+(r-d)*e,f=Math.max(p,0),m=Math.min(Math.min(p+n,n),r-p),g=m+f>i?Math.max(i-f,0):m;this.rect.setAttributes({x:f,width:g,dx:Math.min(x.x1-x.x,0)},!1,{type:exports.AttributeUpdateType.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=x.height)&&void 0!==d?d:Math.abs(x.y1-x.y))&&void 0!==p?p:250,r=null!==(m=null===(f=this.params)||void 0===f?void 0:f.streamLength)&&void 0!==m?m:i,n=null!==(v=null===(y=null===(g=this.params)||void 0===g?void 0:g.attribute)||void 0===y?void 0:y.height)&&void 0!==v?v:60,a=i-(r+n)*e;let s=Math.min(a,i);const o=Math.min(i-a,n);let l;s<=0?(l=Math.max(s+o,0),s=0):l=o,this.rect.setAttributes({y:s,height:l,dy:Math.min(x.y1-x.y,0)},!1,{type:exports.AttributeUpdateType.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const r=this.line||this.area;if(!r)return;const n=r.pathProxy,a=this.target;a.cache||a.cacheArea?this._onUpdateLineOrAreaWithCache(n,a,t,e,i):this._onUpdateLineWithoutCache(n,a,t,e,i);const s=a.attribute;r.setAttributes(Object.assign({stroke:s.stroke},r.attribute)),r.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,r,n){var a,s;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),a=[];return i.forEach((t=>{t.curves.forEach((t=>a.push(t)))})),this._updateCurves(t,a,n,r)}if("area"===e.type&&(null===(s=null===(a=e.cacheArea)||void 0===a?void 0:a.top)||void 0===s?void 0:s.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,r)}}_updateCurves(t,e,i,r){var n,a;const s=i*r,o=Math.min(null!==(a=s+(null===(n=this.params)||void 0===n?void 0:n.streamLength))&&void 0!==a?a:10,i);let l=0,h=!1;for(let i=0;i<e.length;i++)if(!1!==e[i].defined){const r=e[i],n=r.getLength(),a=1-(l+n-s)/n;let c,u=1-(l+n-o)/n;if(l<s&&l+n>s)if(h=!0,r.p2&&r.p3){const[e,i]=divideCubic(r,a);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=r.getPointAt(a);t.moveTo(e.x,e.y)}if(l<o&&l+n>o){if(r.p2&&r.p3){c&&(u=(o-s)/c.getLength());const[e]=divideCubic(c||r,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=r.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(r.p2&&r.p3){const e=c||r;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(r.p1.x,r.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,r,n){var a,s;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+=PointService.distancePP(o[t],o[t-1]);const c=h*r,u=Math.min(null!==(s=c+(null===(a=this.params)||void 0===a?void 0:a.streamLength))&&void 0!==s?s:10,h),d=[];let p=0;for(let t=1;t<o.length;t++){const e=PointService.distancePP(o[t],o[t-1]);if(p<c&&p+e>c&&d.push(PointService.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),p<u&&p+e>u){d.push(PointService.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)}}}class Meteor extends ACustomAnimate{get lastPos(){return this.posList[this.posList.length-1]}constructor(t,e,i,r){super(null,null,e,i,r),this.size=t,this.posList=[]}onBind(){const t=this.target.attachShadow();this.root=t;for(let e=0;e<this.size;e++){const i=this.target.clone(),r=Math.min((this.size-e)/this.size*3,1),n=Math.min(.2+.7/this.size);i.setAttributes({x:0,y:0,dx:0,dy:0,scaleX:r,scaleY:r,opacity:n},!1,{type:exports.AttributeUpdateType.ANIMATE_BIND}),t.add(i)}}onUpdate(t,e,i){if(t)return this.target.detachShadow(),void(this.posList.length=0);const r=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),a=new Point(r,n);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-r,y:i.y-n},!1)})),this.posList.push(a)):this.posList.push(a)}}class MotionPath extends ACustomAnimate{constructor(t,e,i,r,n){var a;super(t,e,i,r,n),n&&(this.pathLength=n.path.getLength(),this.path=n.path,this.distance=n.distance,this.to=n.distance*this.pathLength,this.initAngle=null!==(a=n.initAngle)&&void 0!==a?a:0,this.changeAngle=!!n.changeAngle,this.cb=n.cb)}onUpdate(t,e,i){const r=this.to*e,{pos:n,angle:a}=this.path.getAttrAt(r);i.x=n.x,i.y=n.y,this.changeAngle&&(i.angle=a+this.initAngle),this.cb&&this.cb(this.from,this.to,e,this.target)}}class TagPointsUpdate extends ACustomAnimate{constructor(t,e,i,r,n){var a,s;super(t,e,i,r,n),this.newPointAnimateType=null!==(a=null==n?void 0:n.newPointAnimateType)&&void 0!==a?a:"grow",this.clipRangeByDimension=null!==(s=null==n?void 0:n.clipRangeByDimension)&&void 0!==s?s:"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 r,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(r=t.points)||void 0===r?void 0:r.length)&&void 0!==n?n: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 r,n,a=1/0,s=-1/0;for(let t=0;t<this.toPoints.length;t+=1)if(i.has(this.toPoints[t].context)){a=t,r=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)){s=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(s)?(this.clipRange=this.toPoints[s][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[s][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),isValidNumber$1(this.clipRange)?this.clipRange=clamp$1(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<a&&r?[r,t]:e>s&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],r=new Point(e.x,e.y,e.x1,e.y1);return r.defined=i.defined,r.context=i.context,r}))}onFirstRun(){const t=this.target.attribute.clipRange;isValidNumber$1(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const r=pointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return r.context=t.context,r})),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 r=t+this.segmentsCache[i],n=this.points.slice(t,r);return t=r,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class GraphicAnimate extends ACustomAnimate{constructor(t,e,i,r,n){super(t,e,i,r,n),this.graphic=null==n?void 0:n.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}))}}class ClipGraphicAnimate extends ACustomAnimate{constructor(t,e,i,r,n){super(null,null,i,r,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:exports.AttributeUpdateType.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:exports.AttributeUpdateType.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const r={};Object.keys(this.clipFromAttribute).forEach((t=>{r[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(r,!1,{type:exports.AttributeUpdateType.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class ClipAngleAnimate extends ClipGraphicAnimate{constructor(t,e,i,r,n){var a,s,o,l,h,c,u,d,p,f,m,g;const y=null!==(s=null===(a=null==n?void 0:n.group)||void 0===a?void 0:a.attribute)&&void 0!==s?s:{},v=null!==(o=y.width)&&void 0!==o?o:0,b=null!==(l=y.height)&&void 0!==l?l:0,x=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",C=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,_=null!==(u=null==n?void 0:n.orient)&&void 0!==u?u:"clockwise";let T=0,A=0;"anticlockwise"===_?(A="in"===x?C+2*Math.PI:C,A=C+2*Math.PI):(T=C,A="out"===x?C+2*Math.PI:C);const S=application.graphicService.creator.arc({x:null!==(p=null===(d=null==n?void 0:n.center)||void 0===d?void 0:d.x)&&void 0!==p?p:v/2,y:null!==(m=null===(f=null==n?void 0:n.center)||void 0===f?void 0:f.y)&&void 0!==m?m:b/2,outerRadius:null!==(g=null==n?void 0:n.radius)&&void 0!==g?g:(v+b)/2,innerRadius:0,startAngle:T,endAngle:A,fill:!0});let P,w;"anticlockwise"===_?(P={startAngle:C+2*Math.PI},w={startAngle:C}):(P={endAngle:C},w={endAngle:C+2*Math.PI}),super("in"===x?P:w,"in"===x?w:P,i,r,{group:null==n?void 0:n.group,clipGraphic:S})}}class ClipRadiusAnimate extends ClipGraphicAnimate{constructor(t,e,i,r,n){var a,s,o,l,h,c,u,d,p,f,m;const g=null!==(s=null===(a=null==n?void 0:n.group)||void 0===a?void 0:a.attribute)&&void 0!==s?s:{},y=null!==(o=g.width)&&void 0!==o?o:0,v=null!==(l=g.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startRadius)&&void 0!==c?c:0,C=null!==(u=null==n?void 0:n.endRadius)&&void 0!==u?u:Math.sqrt((y/2)**2+(v/2)**2),_=application.graphicService.creator.arc({x:null!==(p=null===(d=null==n?void 0:n.center)||void 0===d?void 0:d.x)&&void 0!==p?p:y/2,y:null!==(m=null===(f=null==n?void 0:n.center)||void 0===f?void 0:f.y)&&void 0!==m?m:v/2,outerRadius:"out"===b?C:x,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:!0}),T={outerRadius:x},A={outerRadius:C};super("in"===b?T:A,"in"===b?A:T,i,r,{group:null==n?void 0:n.group,clipGraphic:_})}}class ClipDirectionAnimate extends ClipGraphicAnimate{constructor(t,e,i,r,n){var a,s,o,l,h,c,u,d,p;const f=null!==(s=null===(a=null==n?void 0:n.group)||void 0===a?void 0:a.attribute)&&void 0!==s?s:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:f.width)&&void 0!==l?l:0,g=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:f.height)&&void 0!==c?c:0,y=null!==(u=null==n?void 0:n.animationType)&&void 0!==u?u:"in",v=null!==(d=null==n?void 0:n.direction)&&void 0!==d?d:"x",b=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",x=application.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===v?0:m,height:"in"===y&&"y"===v?0:g,fill:!0});let C={},_={};"y"===v?"negative"===b?(C={y:g,height:0},_={y:0,height:g}):(C={height:0},_={height:g}):"negative"===b?(C={x:m,width:0},_={x:0,width:m}):(C={width:0},_={width:m}),super("in"===y?C:_,"in"===y?_:C,i,r,{group:null==n?void 0:n.group,clipGraphic:x})}}class RotateBySphereAnimate extends ACustomAnimate{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),r=this.target.getComputedAttribute("y"),n=this.target.getComputedAttribute("z"),a=Math.acos((r-t.y)/e);let s=Math.acos((i-t.x)/e/Math.sin(a));n-t.z<0&&(s=pi2-s),this.theta=s,this.phi=a}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:r,r:n,cb:a}="function"==typeof this.params?this.params():this.params,s=2*Math.PI*e,o=this.theta+s,l=this.phi,h=n*Math.sin(l)*Math.cos(o)+r.x,c=n*Math.cos(l)+r.y,u=n*Math.sin(l)*Math.sin(o)+r.z;for(i.x=h,i.y=c,i.z=u,i.alpha=o+pi/2;i.alpha>pi2;)i.alpha-=pi2;i.alpha=pi2-i.alpha,i.zIndex=-1e4*i.z,a&&a(i)}}class AttributeAnimate extends ACustomAnimate{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)}}class AnimateGroup extends ACustomAnimate{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((r=>{const n=r.easing,a="string"==typeof n?Easing[n]:n;e=a(e),r.onUpdate(t,e,i)})),this.updating=!1)}}class AnimateGroup1 extends ACustomAnimate{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((r=>{const n=r.easing,a="string"==typeof n?Easing[n]:n;e=a(e),r.onUpdate(t,e,i)})),this.updating=!1)}}function cubicSubdivide(t,e,i,r,n,a){const s=(e-t)*n+t,o=(i-e)*n+e,l=(r-i)*n+i,h=(o-s)*n+s,c=(l-o)*n+o,u=(c-h)*n+h;a[0]=t,a[1]=s,a[2]=h,a[3]=u,a[4]=u,a[5]=c,a[6]=l,a[7]=r}function alignSubpath(t,e){const i=t.length,r=e.length;if(i===r)return[t,e];const n=[],a=[],s=i<r?t:e,o=Math.min(i,r),l=Math.abs(r-i)/6,h=(o-2)/6,c=Math.ceil(l/h),u=[s[0],s[1]];let d=l;for(let t=2;t<o;t+=6){let e=s[t-2],i=s[t-1],r=s[t],o=s[t+1],l=s[t+2],h=s[t+3];const p=s[t+4],f=s[t+5];if(d<=0){u.push(r,o,l,h,p,f);continue}const m=Math.min(d,c)+1;for(let t=1;t<=m;t++){const s=t/m;cubicSubdivide(e,r,l,p,s,n),cubicSubdivide(i,o,h,f,s,a),e=n[3],i=a[3],u.push(n[1],a[1],n[2],a[2],e,i),r=n[5],o=a[5],l=n[6],h=a[6]}d-=m-1}return s===t?[u,e]:[t,u]}function createSubpath(t,e){const i=t||e,r=i.length,n=i[r-2],a=i[r-1],s=[];for(let t=0;t<e.length;t+=2)s[t]=n,s[t+1]=a;return s}function reverseSubpath(t){const e=[],i=t.length;for(let r=0;r<i;r+=2)e[r]=t[i-r-2],e[r+1]=t[i-r-1];return e}function centroidOfSubpath(t){let e=0,i=0,r=0;const n=t.length;for(let a=0,s=n-2;a<n;s=a,a+=2){const n=t[s],o=t[s+1],l=t[a],h=t[a+1],c=n*h-l*o;e+=c,i+=(n+l)*c,r+=(o+h)*c}return 0===e?[t[0]||0,t[1]||0,0]:[i/e/3,r/e/3,e]}function findBestRotationOffset(t,e,i,r){const n=(t.length-2)/6;let a=1/0,s=0;const o=t.length,l=o-2;for(let h=0;h<n;h++){const n=6*h;let c=0;for(let a=0;a<o;a+=2){const s=0===a?n:(n+a-2)%l+2,o=t[s]-i[0],h=t[s+1]-i[1],u=e[a]-r[0]-o,d=e[a+1]-r[1]-h;c+=u*u+d*d}c<a&&(a=c,s=h)}return s}function findBestMorphingRotation(t,e,i,r){const n=[];let a;for(let s=0;s<t.length;s++){let o=t[s];const l=e[s],h=centroidOfSubpath(o),c=centroidOfSubpath(l);null==a&&(a=h[2]<0!=c[2]<0);const u=[],d=[];let p=0,f=1/0;const m=[],g=o.length;a&&(o=reverseSubpath(o));const y=6*findBestRotationOffset(o,l,h,c),v=g-2;for(let t=0;t<v;t+=2){const e=(y+t)%v+2;u[t+2]=o[e]-h[0],u[t+3]=o[e+1]-h[1]}if(u[0]=o[y]-h[0],u[1]=o[y+1]-h[1],i>0){const t=r/i;for(let e=-r/2;e<=r/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let r=0;for(let e=0;e<o.length;e+=2){const n=u[e],a=u[e+1],s=l[e]-c[0],o=l[e+1]-c[1],h=s*i-o*t,d=s*t+o*i;m[e]=h,m[e+1]=d;const p=h-n,f=d-a;r+=p*p+f*f}if(r<f){f=r,p=e;for(let t=0;t<m.length;t++)d[t]=m[t]}}}else for(let t=0;t<g;t+=2)d[t]=l[t]-c[0],d[t+1]=l[t+1]-c[1];n.push({from:u,to:d,fromCp:h,toCp:c,rotation:-p})}return n}function alignBezierCurves(t,e){let i,r;const n=[],a=[];for(let s=0;s<Math.max(t.length,e.length);s++){const o=t[s],l=e[s];let h,c;o?l?([h,c]=alignSubpath(o,l),i=h,r=c):(c=createSubpath(r,o),h=o):(h=createSubpath(i,l),c=l),n.push(h),a.push(c)}return[n,a]}const addLineToBezierPath=(t,e,i,r,n)=>{isNumberClose(e,r)&&isNumberClose(i,n)||t.push(e,i,r,n,r,n)};function pathToBezierCurves(t){const e=t.commandList,i=[];let r,n=0,a=0,s=0,o=0;const l=(t,e)=>{r&&r.length>2&&i.push(r),r=[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&&(s=n=i[1],o=a=i[2],[enumCommandMap.L,enumCommandMap.C,enumCommandMap.Q].includes(i[0])&&(r=[s,o])),i[0]){case enumCommandMap.M:n=s=i[1],a=o=i[2],l(s,o);break;case enumCommandMap.L:h=i[1],c=i[2],addLineToBezierPath(r,n,a,h,c),n=h,a=c;break;case enumCommandMap.C:r.push(i[1],i[2],i[3],i[4],n=i[5],a=i[6]);break;case enumCommandMap.Q:h=i[1],c=i[2],u=i[3],d=i[4],r.push(n+2/3*(h-n),a+2/3*(c-a),u+2/3*(h-u),d+2/3*(c-d),u,d),n=u,a=d;break;case enumCommandMap.A:{const t=i[1],e=i[2],u=i[3],d=u,f=i[4],m=i[5],g=!!i[6];h=Math.cos(f)*u+t,c=Math.sin(f)*u+e,p?(s=h,o=c,l(s,o)):addLineToBezierPath(r,n,a,h,c),n=Math.cos(m)*u+t,a=Math.sin(m)*u+e;const y=(g?-1:1)*Math.PI/2;for(let i=f;g?i>m:i<m;i+=y){const n=g?Math.max(i+y,m):Math.min(i+y,m);addArcToBezierPath$1(r,i,n,t,e,u,d)}break}case enumCommandMap.E:{const t=i[1],e=i[2],u=i[3],d=i[4],f=i[5],m=i[6],g=i[7]+m,y=!!i[8],v=!isNumberClose(f,0),b=Math.cos(f),x=Math.sin(f);let C=Math.cos(m)*u,_=Math.sin(m)*d;v?(h=C*b-_*x+t,c=C*x+_*b+e):(h=C+t,c=_+e),p?(s=h,o=c,l(s,o)):addLineToBezierPath(r,n,a,h,c),C=Math.cos(g)*u,_=Math.sin(g)*d,v?(n=C*b-_*x+t,a=C*x+_*b+e):(n=C+t,a=_+e);const T=(y?-1:1)*Math.PI/2;for(let i=m;y?i>g:i<g;i+=T){const n=y?Math.max(i+T,g):Math.min(i+T,g);if(addArcToBezierPath$1(r,i,n,t,e,u,d),v){const i=r.length;for(let n=i-6;n<=i-1;n+=2)C=r[n],_=r[n+1],r[n]=(C-t)*b-(_-e)*x+t,r[n+1]=(C-t)*x+(_-e)*b+e}}break}case enumCommandMap.R:s=n=i[1],o=a=i[2],h=s+i[3],c=o+i[4],l(h,o),addLineToBezierPath(r,h,o,h,c),addLineToBezierPath(r,h,c,s,c),addLineToBezierPath(r,s,c,s,o),addLineToBezierPath(r,s,o,h,o);break;case enumCommandMap.AT:{const t=i[1],e=i[2],l=i[3],h=i[4],c=i[5],u=PointService.distancePP({x:n,y:a},{x:t,y:e}),d=PointService.distancePP({x:l,y:h},{x:t,y:e}),p=((n-t)*(l-t)+(a-e)*(h-e))/(u*d),f=c/Math.sin(p/2),m=(n+l-2*t)/2,g=(a+h-2*e)/2,y=PointService.distancePP({x:m,y:g},{x:0,y:0}),v=t+f*m/y,b=l+f*g/y,x=Math.sqrt(f*f-c*c);s=t+x*(n-t)/u,o=e+x*(a-e)/u,addLineToBezierPath(r,n,a,s,o),n=t+x*(l-t)/d,a=e+x*(h-e)/d;const C=getAngleByPoint({x:v,y:b},{x:s,y:o}),_=getAngleByPoint({x:v,y:b},{x:n,y:a});addArcToBezierPath$1(r,C,_,v,b,c,c);break}case enumCommandMap.Z:r&&addLineToBezierPath(r,n,a,s,o),n=s,a=o}}return r&&r.length>2&&i.push(r),i}function applyTransformOnBezierCurves(t,e){for(let i=0;i<t.length;i++){const r=t[i];for(let t=0;t<r.length;t+=2){const i=r[t],n=r[t+1],a={x:i,y:n};e.transformPoint({x:i,y:n},a),r[t]=a.x,r[t+1]=a.y}}}function bezierCurversToPath(t){const e=new CustomPath2D;for(let i=0;i<t.length;i++){const r=t[i];if(r.length>2){e.moveTo(r[0],r[1]);for(let t=2;t<r.length;t+=6)e.bezierCurveTo(r[t],r[t+1],r[t+2],r[t+3],r[t+4],r[t+5])}}return e}const normalizeRectAttributes=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=isNil$1(t.width)?t.x1-t.x:t.width,i=isNil$1(t.height)?t.y1-t.y:t.height,r=0,n=0;return e<0?(r=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:r,y:n,width:e,height:i}};function splitToGrids(t,e,i){const r=t/e;let n,a;t>=e?(a=Math.ceil(Math.sqrt(i*r)),n=Math.floor(i/a),0===n&&(n=1,a=i)):(n=Math.ceil(Math.sqrt(i/r)),a=Math.floor(i/n),0===a&&(a=1,n=i));const s=[];for(let t=0;t<n;t++)s.push(a);const o=i-n*a;if(o>0)for(let t=0;t<o;t+=a)t+a<o?s.push(a):s.push(o-t);return s}const splitRect=(t,e)=>{const{width:i,height:r}=normalizeRectAttributes(t.attribute),n=splitToGrids(i,r,e),a=[],s=r/n.length;for(let t=0,e=n.length;t<e;t++){const e=n[t],r=i/e;for(let i=0;i<e;i++)a.push({x:0+i*r,y:0+t*s,width:r,height:s})}return a},splitArc=(t,e)=>{const i=t.getParsedAngle(),r=i.startAngle,n=i.endAngle,a=t.getComputedAttribute("innerRadius"),s=t.getComputedAttribute("outerRadius"),o=Math.abs(r-n),l=Math.abs(s-a),h=splitToGrids(o*(a+s)/2,l,e),c=[],u=l/h.length,d=s>=a?1:-1,p=n>=r?1:-1;for(let t=0,e=h.length;t<e;t++){const e=h[t],i=o/e;for(let n=0;n<e;n++)c.push({innerRadius:s-u*t*d,outerRadius:s-u*(t+1)*d,startAngle:r+i*n*p,endAngle:r+i*(n+1)*p})}return c},splitCircle=(t,e)=>{const i=t.getComputedAttribute("startAngle"),r=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),a=Math.abs(i-r),s=splitToGrids(a*n,n,e),o=[],l=a/s[0],h=n/s.length,c=r>=i?1:-1;for(let t=0,e=s.length;t<e;t++)for(let e=0,r=s[t];e<r;e++)o.push({innerRadius:h*t,outerRadius:h*(t+1),startAngle:i+l*e*c,endAngle:i+l*(e+1)*c});return o},samplingPoints=(t,e)=>{const i=t.filter((t=>!1!==t.defined&&isNumber$1(t.x)&&isNumber$1(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const r=[];if(e<=i.length){const t=i.length/e;let n=0,a=0;for(;n<e;)r.push(i[Math.floor(a)]),a+=t,n++;return r}const n=e-i.length,a=1/(n/(i.length-1)+1);let s=0;for(let e=0,i=t.length;e<i;e++)if(r.push(t[e]),e<i-1){let i=a;const o=t[e].x,l=t[e].y,h=t[e+1].x,c=t[e+1].y;for(;i<1&&s<n;)r.push({x:o+(h-o)*i,y:l+(c-l)*i}),i+=a,s+=1}return r},splitArea=(t,e)=>{var i,r;const n=t.attribute;let a=n.points;const s=n.segments;a||(a=s.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=a.filter((t=>!1!==t.defined&&isNumber$1(t.x)&&isNumber$1(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!==(r=e.y1)&&void 0!==r?r:e.y})}const h=[];return recursiveCallBinarySplit(a,e,h),h},splitLine=(t,e)=>{const i=t.attribute,r=i.points;if(r)return samplingPoints(r,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 samplingPoints(t,e)}return[]};function crossProduct(t,e){return t[0]*e[1]-t[1]*e[0]}const clonePoints=t=>t.map((t=>({x:t.x,y:t.y}))),splitPolygonByLine=(t,e,i)=>{const r=t.length,n=[];for(let a=0;a<r;a++){const s=t[a],o=a===r-1?t[0]:t[a+1],l=getIntersectPoint([e.x,e.y],[i.x,i.y],[s.x,s.y],[o.x,o.y]);l&&"boolean"!=typeof l&&n.push({dot:crossProduct([l[0]-e.x,l[1]-e.x],[i.x-e.x,i.y-e.x]),point:{x:l[0],y:l[1]},edgeIndex:a})}if(n.length<2)return[clonePoints(t),clonePoints(t)];n.sort(((t,e)=>t.dot-e.dot));let a=n[0],s=n[n.length-1];a.edgeIndex>s.edgeIndex&&([a,s]=[s,a]);const o=a.point,l=s.point,h=[{x:o.x,y:o.y}];for(let e=a.edgeIndex+1;e<=s.edgeIndex;e++)h.push({x:t[e].x,y:t[e].y});h.push({x:l.x,y:l.y});const c=[{x:l.x,y:l.y}];for(let e=s.edgeIndex+1,i=a.edgeIndex+r;e<=i;e++){const i=t[e%r];c.push({x:i.x,y:i.y})}return c.push({x:o.x,y:o.y}),[h,c]},binarySplitPolygon=t=>{const e=new Bounds;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),r=e.height();if(i>=r){const r=e.x1+i/2;return splitPolygonByLine(t,{x:r,y:e.y1},{x:r,y:e.y2})}const n=e.y1+r/2;return splitPolygonByLine(t,{x:e.x1,y:n},{x:e.x2,y:n})},recursiveCallBinarySplit=(t,e,i)=>{if(1===e)i.push({points:t});else{const r=Math.floor(e/2),n=binarySplitPolygon(t);recursiveCallBinarySplit(n[0],r,i),recursiveCallBinarySplit(n[1],e-r,i)}},splitPolygon=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:clonePoints(i)}];const r=[];return recursiveCallBinarySplit(i,e,r),r},splitPath=(t,e)=>{const i=pathToBezierCurves(t.getParsedPathShape());if(!i.length||e<0)return[];const r=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let a=0;a<e;a++){const s=i.slice(a*n,a===e-1?r:(a+1)*n);t.push({path:bezierCurversToPath(s)})}return t}const n=[],a=Math.floor(e/r);let s=e;for(let t=0;t<r;t++){const e=[];for(let r=2,n=i[t].length;r<n;r+=2)e.push({x:i[0][r],y:i[0][r+1]});recursiveCallBinarySplit(e,t===r-1?s:a,n),s-=a}return n};function colorEqual(t,e){const i=Color.parseColorString(t),r=Color.parseColorString(e);return!(!i||!r)&&i.r===r.r&&i.g===r.g&&i.b===r.b&&i.opacity===r.opacity}var ColorType;exports.ColorType=void 0,ColorType=exports.ColorType||(exports.ColorType={}),ColorType[ColorType.Color255=0]="Color255",ColorType[ColorType.Color1=1]="Color1";class ColorStore{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:exports.ColorType.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===exports.ColorType.Color1){const e=ColorStore.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const r=Color.parseColorString(t);if(r){const e=[r.r/255,r.g/255,r.b/255,r.opacity];ColorStore.store1[t]=e,ColorStore.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const r=ColorStore.store255[t];if(r)return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i;const n=Color.parseColorString(t);return n&&(ColorStore.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ColorStore.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===exports.ColorType.Color1){if(ColorStore.store1[t])return;ColorStore.store1[t]=i,ColorStore.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ColorStore.store255[t])return;ColorStore.store255[t]=i,ColorStore.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function colorArrayToString(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&isNumber$1(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 interpolateColor(t,e,i,r,n){return Array.isArray(t)&&!isNumber$1(t[0])||Array.isArray(e)&&!isNumber$1(e[0])?new Array(4).fill(0).map(((n,a)=>_interpolateColor(isArray$1(t)?t[a]:t,isArray$1(e)?e[a]:e,i,r))):_interpolateColor(t,e,i,r,n)}function _interpolateColor(t,e,i,r,n){if(!t||!e)return t&&colorArrayToString(t)||e&&colorArrayToString(e)||!1;let a,s,o=!1,l=!1;if(Array.isArray(t)?a=t:"string"==typeof t?a=ColorStore.Get(t,exports.ColorType.Color255):o=!0,Array.isArray(e)?s=e:"string"==typeof e?s=ColorStore.Get(e,exports.ColorType.Color255):l=!0,o!==l){const a=o?t:e,s=o?e:t,l=Object.assign(Object.assign({},a),{stops:a.stops.map((t=>Object.assign(Object.assign({},t),{color:colorArrayToString(s)})))});return o?interpolateColor(a,l,i,r,n):interpolateColor(l,a,i,r,n)}if(o){if(t.gradient===e.gradient){const r=t,n=e,a=r.stops,s=n.stops;if(a.length!==s.length)return!1;if("linear"===r.gradient)return interpolateGradientLinearColor(r,n,i);if("radial"===r.gradient)return interpolateGradientRadialColor(r,n,i);if("conical"===r.gradient)return interpolateGradientConicalColor(r,n,i)}return!1}return n&&n(a,s),colorArrayToString(interpolatePureColorArray(a,s,i),r)}function interpolateGradientLinearColor(t,e,i){const r=t.stops,n=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(r.length).fill(0).map(((t,e)=>({color:colorStringInterpolationToStr(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i})))}}function interpolateGradientRadialColor(t,e,i){const r=t.stops,n=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(r.length).fill(0).map(((t,e)=>({color:colorStringInterpolationToStr(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i})))}}function interpolateGradientConicalColor(t,e,i){const r=t.stops,n=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(r.length).fill(0).map(((t,e)=>({color:colorStringInterpolationToStr(r[e].color,n[e].color,i),offset:r[e].offset+(n[e].offset-r[e].offset)*i})))}}function interpolatePureColorArray(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]}ColorStore.store255={},ColorStore.store1={};const _fromColorRGB=[0,0,0,0],_toColorRGB=[0,0,0,0];function colorStringInterpolationToStr(t,e,i){return ColorStore.Get(t,exports.ColorType.Color255,_fromColorRGB),ColorStore.Get(e,exports.ColorType.Color255,_toColorRGB),`rgba(${Math.round(_fromColorRGB[0]+(_toColorRGB[0]-_fromColorRGB[0])*i)},${Math.round(_fromColorRGB[1]+(_toColorRGB[1]-_fromColorRGB[1])*i)},${Math.round(_fromColorRGB[2]+(_toColorRGB[2]-_fromColorRGB[2])*i)},${_fromColorRGB[3]+(_toColorRGB[3]-_fromColorRGB[3])*i})`}const interpolateOtherAttrs=(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 r=interpolateColor(t.from,t.to,i,!1);r&&(e[t.key]=r)}}))},interpolateMorphingData=(t,e,i)=>{const r=[],n=[];e.clear();for(let a=0;a<t.length;a++){const s=t[a],o=s.from,l=s.to,h=s.rotation*i,c=s.fromCp,u=s.toCp,d=Math.sin(h),p=Math.cos(h);n[0]=c[0]+(u[0]-c[0])*i,n[1]=c[1]+(u[1]-c[1])*i;for(let t=0;t<o.length;t+=2){const e=o[t],a=o[t+1],s=e*(1-i)+l[t]*i,h=a*(1-i)+l[t+1]*i;r[t]=s*p-h*d+n[0],r[t+1]=s*d+h*p+n[1]}let f=r[0],m=r[1];e.moveTo(f,m);for(let t=2;t<o.length;t+=6){const i=r[t],n=r[t+1],a=r[t+2],s=r[t+3],o=r[t+4],l=r[t+5];f===i&&m===n&&a===o&&s===l?e.lineTo(o,l):e.bezierCurveTo(i,n,a,s,o,l),f=o,m=l}}},parseMorphingData=(t,e,i)=>{const r=t?pathToBezierCurves(t):[],n=pathToBezierCurves(e);i&&r&&(i.fromTransform&&applyTransformOnBezierCurves(r,i.fromTransform.clone().getInverse()),applyTransformOnBezierCurves(r,i.toTransfrom));const[a,s]=alignBezierCurves(r,n);return t?findBestMorphingRotation(a,s,10,Math.PI):s.map(((t,e)=>({from:a[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},validateOtherAttrs=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],parseOtherAnimateAttrs=(t,e)=>{if(!t||!e)return null;const i=[];let r=!1;return Object.keys(t).forEach((n=>{if(!validateOtherAttrs.includes(n))return;const a=e[n];isNil$1(a)||isNil$1(t[n])||a===t[n]||("fill"===n||"stroke"===n?i.push({from:"string"==typeof t[n]?ColorStore.Get(t[n],exports.ColorType.Color255):t[n],to:"string"==typeof a?ColorStore.Get(a,exports.ColorType.Color255):a,key:n}):i.push({from:t[n],to:a,key:n}),r=!0)})),r?i:null};class MorphingPath extends ACustomAnimate{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 r=this.target,n="function"==typeof r.pathProxy?r.pathProxy(r.attribute):r.pathProxy;interpolateMorphingData(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&interpolateOtherAttrs(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const morphPath=(t,e,i,r)=>{var n,a,s;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;r&&o&&(o=r.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=parseMorphingData(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=parseOtherAnimateAttrs(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 MorphingPath({morphingData:l,otherAttrs:h},null!==(a=null==i?void 0:i.duration)&&void 0!==a?a:DefaultMorphingAnimateConfig.duration,null!==(s=null==i?void 0:i.easing)&&void 0!==s?s:DefaultMorphingAnimateConfig.easing)),c},oneToMultiMorph=(t,e,i)=>{var r;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||__DEV__&&console.error(n," is not validate"),t.valid&&t.toCustomPath||__DEV__&&console.error(t," is not validate");const a=("clone"===(null==i?void 0:i.splitPath)?cloneGraphic:null!==(r=null==i?void 0:i.splitPath)&&void 0!==r?r:splitGraphic)(t,n.length,!1),s=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&s&&s()};n.forEach(((e,r)=>{var s;const o=a[r],h=(null!==(s=null==i?void 0:i.delay)&&void 0!==s?s:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(r,n.length,o,e):0);morphPath(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))};class MultiToOneMorphingPath extends ACustomAnimate{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 r;interpolateMorphingData(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(r=this.otherAttrs)||void 0===r?void 0:r[i])&&this.otherAttrs[i].length&&interpolateOtherAttrs(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const parseShadowChildAttrs=t=>{const e={};return Object.keys(t).forEach((i=>{isTransformKey(i)||(e[i]=t[i])})),e},appendShadowChildrenToGraphic=(t,e,i)=>{const r=parseShadowChildAttrs(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:r}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const a=t.AABBBounds,s=a.width(),o=a.height();n.setTheme({rect:r}),new Array(i).fill(0).forEach((t=>{const i=application.graphicService.creator.rect({x:0,y:0,width:s,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},cloneGraphic=(t,e,i)=>{const r=[],n=i?null:parseShadowChildAttrs(t.attribute),a=t.toCustomPath();for(let t=0;t<e;t++){const t={path:(new CustomPath2D).fromCustomPath2D(a)};r.push(application.graphicService.creator.path(i?t:Object.assign({},n,t)))}return i&&appendShadowChildrenToGraphic(t,r,e),r},splitGraphic=(t,e,i)=>{const r=[],n=i?null:parseShadowChildAttrs(t.attribute);if("rect"===t.type)splitRect(t,e).forEach((t=>{r.push(application.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)splitArc(t,e).forEach((t=>{r.push(application.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)splitCircle(t,e).forEach((t=>{r.push(application.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const a=splitLine(t,e),s={size:10,symbolType:"circle"};a.forEach((t=>{r.push(application.graphicService.creator.symbol(i?Object.assign({},t,s):Object.assign({},n,t,s)))}))}else"polygon"===t.type?splitPolygon(t,e).forEach((t=>{r.push(application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?splitArea(t,e).forEach((t=>{r.push(application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&splitPath(t,e).forEach((t=>{"path"in t?r.push(application.graphicService.creator.path(i?t:Object.assign({},n,t))):r.push(application.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&appendShadowChildrenToGraphic(t,r,e),r},multiToOneMorph=(t,e,i)=>{var r,n,a;const s=t.filter((t=>t.toCustomPath&&t.valid));s.length||__DEV__&&console.error(t," is not validate"),e.valid&&e.toCustomPath||__DEV__&&console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?cloneGraphic:null!==(r=null==i?void 0:i.splitPath)&&void 0!==r?r:splitGraphic)(e,s.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=s.map(((t,e)=>parseMorphingData(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=s.map(((t,e)=>parseOtherAnimateAttrs(t.attribute,l)));if(null==i?void 0:i.individualDelay){const r=i.onEnd;let n=s.length;const a=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:exports.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),r&&r())};o.forEach(((e,r)=>{var n,o,l;const u=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(r,s.length,t[r],e),d=e.animate(Object.assign({},i,{onEnd:a}));d.wait(u),d.play(new MorphingPath({morphingData:h[r],saveOnEnd:!0,otherAttrs:c[r]},null!==(o=i.duration)&&void 0!==o?o:DefaultMorphingAnimateConfig.duration,null!==(l=i.easing)&&void 0!==l?l:DefaultMorphingAnimateConfig.easing))}))}else{const t=null==i?void 0:i.onEnd,r=i?Object.assign({},i):{};r.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:exports.AttributeUpdateType.ANIMATE_END}),e.detachShadow(),t&&t()};const s=e.animate(r);(null==i?void 0:i.delay)&&s.wait(i.delay),s.play(new MultiToOneMorphingPath({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:DefaultMorphingAnimateConfig.duration,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:DefaultMorphingAnimateConfig.easing))}};class GroupFadeIn extends ACustomAnimate{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}})}}class GroupFadeOut extends ACustomAnimate{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}})}}class ResourceLoader{static GetImage(t,e){var i;const r=ResourceLoader.cache.get(t);r?"fail"===r.loadState?application.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===r.loadState||"loading"===r.loadState?null===(i=r.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,r.data):ResourceLoader.loadImage(t,e)}static GetSvg(t,e){var i;let r=ResourceLoader.cache.get(t);r?"fail"===r.loadState?application.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===r.loadState||"loading"===r.loadState?null===(i=r.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,r.data):(r={type:"image",loadState:"init"},ResourceLoader.cache.set(t,r),r.dataPromise=application.global.loadSvg(t),r.dataPromise?(r.waitingMark=[e],r.dataPromise.then((e=>{var i;r.loadState=(null==e?void 0:e.data)?"success":"fail",r.data=null==e?void 0:e.data,null===(i=r.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(r.loadState="success",r.data=e.data,i.imageLoadSuccess(t,e.data)):(r.loadState="fail",i.imageLoadFail(t))})),r.waitingMark&&(r.waitingMark=[])}))):(r.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=ResourceLoader.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"},ResourceLoader.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=application.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=application.global.loadBlob(t):"json"===e&&(i.dataPromise=application.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!ResourceLoader.isLoading&&ResourceLoader.toLoadAueue.length){ResourceLoader.isLoading=!0;const t=ResourceLoader.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:r}=t,n={type:"image",loadState:"init"};if(ResourceLoader.cache.set(i,n),n.dataPromise=application.global.loadImage(i),n.dataPromise){n.waitingMark=r;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,r)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",r.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{ResourceLoader.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),ResourceLoader.loading()})).catch((t=>{console.error(t),ResourceLoader.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),ResourceLoader.loading()}))}}),0)}static loadImage(t,e){const i=getIndex(t,ResourceLoader.toLoadAueue);if(-1!==i)return ResourceLoader.toLoadAueue[i].marks.push(e),void ResourceLoader.loading();ResourceLoader.toLoadAueue.push({url:t,marks:[e]}),ResourceLoader.loading()}static improveImageLoading(t){const e=getIndex(t,ResourceLoader.toLoadAueue);if(-1!==e){const t=ResourceLoader.toLoadAueue.splice(e,1);ResourceLoader.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function getIndex(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}ResourceLoader.cache=new Map,ResourceLoader.isLoading=!1,ResourceLoader.toLoadAueue=[],ResourceLoader.onLoadSuccessCb=[];const tempMatrix=new Matrix,tempBounds$1=new AABBBounds,PURE_STYLE_KEY=["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],GRAPHIC_UPDATE_TAG_KEY=["lineWidth","scaleX","scaleY","angle","anchor","visible"],tempConstantXYKey=["x","y"],tempConstantScaleXYKey=["scaleX","scaleY"],tempConstantAngleKey=["angle"],point=new Point,NOWORK_ANIMATE_ATTR={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 Graphic extends Node{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const r=e[i];Object.defineProperty(Graphic.prototype,r,Object.getOwnPropertyDescriptor(t,r))}}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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new AABBBounds,this._updateTag=exports.UpdateTag.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.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,r;const{dx:n=t.dx,dy:a=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;point.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),point.y=a+(null!==(r=t.scrollY)&&void 0!==r?r:0)}else point.x=n,point.y=a;return point}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;application.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return application.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new OBBBounds),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,r=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,a=parsePadding(n);return a&&r.expand(a),this.clearUpdateBoundTag(),r}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new BoundsContext(t);return renderCommandList(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 Matrix),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&exports.UpdateTag.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&application.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&exports.UpdateTag.UPDATE_BOUNDS)&&application.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&exports.UpdateTag.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&exports.UpdateTag.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&exports.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&exports.UpdateTag.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=exports.UpdateTag.CLEAR_SHAPE}containsPoint(t,e,i,r){if(!r)return!1;if(i===exports.IContainPointMode.GLOBAL){const i=new Point(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return r.containsPoint(this,{x:t,y:e})}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 r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e];this.attribute[i]=t[i]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(r)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,r){var n;const a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,r);a?this._setAttributes(a,i,r):isNil$1(null===(n=this.normalAttrs)||void 0===n?void 0:n[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(r)):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]:GRAPHIC_UPDATE_TAG_KEY;for(let i=0;i<e.length;i++){const r=e[i];if(-1!==t.indexOf(r))return!0}return!1}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:GRAPHIC_UPDATE_TAG_KEY;for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:exports.AttributeUpdateType.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=exports.UpdateTag.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,r;if(0===t&&0===e)return this;const n={type:exports.AttributeUpdateType.TRANSLATE},a=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,tempConstantXYKey,n);a&&(t=a.x,e=a.y,delete a.x,delete a.y,this._setAttributes(a));const s=this.attribute,o=s.postMatrix;return o?application.transformUtil.fromMatrix(o,o).translate(t,e):(s.x=(null!==(i=s.x)&&void 0!==i?i:DefaultTransform.x)+t,s.y=(null!==(r=s.y)&&void 0!==r?r:DefaultTransform.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(n),this}translateTo(t,e){const i=this.attribute;if(i.x===t&&i.y===e)return this;const r={type:exports.AttributeUpdateType.TRANSLATE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,tempConstantXYKey,r);return n?(this._setAttributes(n,!1,r),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}scale(t,e,i){var r,n;if(1===t&&1===e)return this;const a={type:exports.AttributeUpdateType.SCALE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,tempConstantScaleXYKey,a);s&&(t=s.scaleX,e=s.scaleY,delete s.scaleX,delete s.scaleY,this._setAttributes(s));const o=this.attribute;if(i){let{postMatrix:r}=this.attribute;r||(r=new Matrix,o.postMatrix=r),application.transformUtil.fromMatrix(r,r).scale(t,e,i)}else o.scaleX=(null!==(r=o.scaleX)&&void 0!==r?r:DefaultTransform.scaleX)*t,o.scaleY=(null!==(n=o.scaleY)&&void 0!==n?n:DefaultTransform.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(a),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const r={type:exports.AttributeUpdateType.SCALE_TO},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,tempConstantScaleXYKey,r);return n?(this._setAttributes(n,!1,r),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this)}rotate(t,e){var i;if(0===t)return this;const r={type:exports.AttributeUpdateType.ROTATE},n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,tempConstantAngleKey,r);n&&(delete n.angle,this._setAttributes(n,!1,r));const a=this.attribute;if(e){let{postMatrix:i}=this.attribute;i||(i=new Matrix,a.postMatrix=i),application.transformUtil.fromMatrix(i,i).rotate(t,e)}else a.angle=(null!==(i=a.angle)&&void 0!==i?i:DefaultTransform.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:exports.AttributeUpdateType.ROTATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,tempConstantAngleKey,i);return r?(this._setAttributes(r,!1,i),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}skewTo(t,e){return this}animate(t){var e;this.animates||(this.animates=new Map);const i=new Animate(null==t?void 0:t.id,null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline(),null==t?void 0:t.slience);if(i.bind(this),t){const{onStart:e,onFrame:r,onEnd:n,onRemove:a}=t;null!=e&&i.onStart(e),null!=r&&i.onFrame(r),null!=n&&i.onEnd(n),null!=a&&i.onRemove(a),i.interpolateFunc=t.interpolate}return this.animates.set(i.id,i),i.onRemove((()=>{this.animates.delete(i.id)})),i}onAttributeUpdate(t){t&&t.skipUpdateCallback||(application.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)&&(!!isNil$1(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,r){var n,a,s,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=r&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const u=this.animate({slience:!0});u.stateNames=e,u.to(h,null!==(a=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==a?a:DefaultStateAnimateConfig.duration,null!==(o=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.easing)&&void 0!==o?o:DefaultStateAnimateConfig.easing),c&&this.setAttributes(c,!1,{type:exports.AttributeUpdateType.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:exports.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 r=i.getEndProps();has$1(r,t)&&(e=r[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 r;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(r=this.currentStates)||void 0===r?void 0:r.length)?this.currentStates.concat([t]):[t];this.useStates(n,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 r={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(r,n)})),this.updateNormalAttrs(r),this.currentStates=t,this.applyStateAttrs(r,t,e)}addUpdateBoundTag(){this._updateTag|=exports.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=exports.UpdateTag.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=exports.UpdateTag.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&exports.UpdateTag.UPDATE_SHAPE_AND_BOUNDS)===exports.UpdateTag.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=exports.UpdateTag.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=exports.UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=exports.UpdateTag.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=exports.UpdateTag.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=exports.UpdateTag.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=exports.UpdateTag.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=exports.UpdateTag.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&exports.UpdateTag.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],r=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:r}=this.attribute;return tempBounds$1.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(tempBounds$1),this.setAttributes({scaleX:t,scaleY:i,angle:r}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=r();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=r();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=DefaultTransform.x,y:e=DefaultTransform.y,scaleX:i=DefaultTransform.scaleX,scaleY:r=DefaultTransform.scaleY,angle:n=DefaultTransform.angle,scaleCenter:a,anchor:s,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(s&&(l=this.getAnchor(s,h)),!a||1===i&&1===r)normalTransform(this._transMatrix,this._transMatrix.reset(),t,e,i,r,n,s&&l);else{const s=this._transMatrix;s.reset(),s.translate(l[0],l[1]),s.rotate(n),s.translate(-l[0],-l[1]),s.translate(t,e),l=this.getAnchor(a,h),application.transformUtil.fromMatrix(s,s).scale(i,r,{x:l[0],y:l[1]})}const c=this.getOffsetXY(DefaultTransform);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=tempMatrix.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),application.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:exports.AttributeUpdateType.ANIMATE_END})}onStep(t,e,i,r,n){const a={};if(i.customAnimate)i.customAnimate.update(n,r,a);else{const s=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,a,i,r,n,s,void 0,o,l)}this.setAttributes(a,!1,{type:exports.AttributeUpdateType.ANIMATE_UPDATE,animationState:{ratio:r,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,r,n,a,s,o,l,h){h||(h=Object.keys(s),r.propKeys=h),a?r.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=s[t])})):h.forEach((a=>{var h;if(!e.validAttr(a))return;const c=s[a],u=null!==(h=o&&o[a])&&void 0!==h?h:t.getLastPropByName(a,r);if(null==c||null==u||c===u)return void(i[a]=c);let d;d=e.interpolateFunc&&e.interpolateFunc(a,n,u,c,i),d||(d=e.customInterpolate(a,n,u,c,this,i),d||this.defaultInterpolate(c,u,a,i,l,n)||this._interpolate(a,n,u,c,i))})),r.parsedProps=l}defaultInterpolate(t,e,i,r,n,a){if(Number.isFinite(t))return r[i]=e+(t-e)*a,!0;if("fill"===i){n||(n={});const s=n.fillColorArray,o=interpolateColor(e,null!=s?s:t,a,!1,((t,e)=>{n.fillColorArray=e}));return o&&(r[i]=o),!0}if("stroke"===i){n||(n={});const s=n.strokeColorArray,o=interpolateColor(e,null!=s?s:t,a,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(r[i]=o),!0}if("shadowColor"===i){n||(n={});const s=n.shadowColorArray,o=interpolateColor(e,null!=s?s:t,a,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(r[i]=o),!0}return!1}_interpolate(t,e,i,r,n){}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:application.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 isString$1(t,!0)?this.pathProxy=(new CustomPath2D).fromString(t):this.pathProxy=new CustomPath2D,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&backgroundNotImage(t))return;const i=t;this.resources||(this.resources=new Map);const r={data:"init",state:null};this.resources.set(i,r),"string"==typeof t?(r.state="loading",t.startsWith("<svg")?(ResourceLoader.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(isValidUrl$1(t)||t.includes("/")||isBase64$1(t))&&(ResourceLoader.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):isObject$1(t)?(r.state="success",r.data=t,this.backgroundImg=this.backgroundImg||e):r.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const r=this.resources.get(t);r&&(r.state="success",r.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",application.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,r;if(this._events&&t in this._events){const n=new CustomEvent(t,e);n.bubbles=!1,n.manager=null===(r=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===r?void 0:r.manager,this.dispatchEvent(n)}}}function backgroundNotImage(t){return!(!t.fill&&!t.stroke)}function getAllMatches(t,e){const i=[];let r=e.exec(t);for(;r;){const n=[];n.startIndex=e.lastIndex-r[0].length;const a=r.length;for(let t=0;t<a;t++)n.push(r[t]);i.push(n),r=e.exec(t)}return i}Graphic.mixin(EventTarget);class XmlNode{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 findClosingIndex(t,e,i,r){const n=t.indexOf(e,i);if(-1===n)throw new Error(r);return n+e.length-1}function tagExpWithClosingIndex(t,e){let i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let a=e;a<t.length;a++){let e=t[a];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===r[0]){if(!r[1])return{data:n,index:a};if(t[a+1]===r[1])return{data:n,index:a}}else"\t"===e&&(e=" ");n+=e}}function readTagExp(t,e,i){const r=tagExpWithClosingIndex(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!r)return;let n=r.data;const a=r.index,s=n.search(/\s/);let o=n,l=!0;-1!==s&&(o=n.substr(0,s).replace(/\s\s*$/,""),n=n.substr(s+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==r.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:a,attrExpPresent:l,rawTagName:h}}const attrsRegx=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class OrderedObjParser{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const r=e.tagname;"string"==typeof r?(e.tagname=r,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const r={};if(!t)return;const n=getAllMatches(t,attrsRegx),a=n.length;for(let t=0;t<a;t++){const e=n[t][1],i=n[t][4];e&&(r[e]=void 0===i||(isNaN(i)?i:Number(i)))}return r}parseXml(t){t=t.replace(/\r\n?/g,"\n");const e=new XmlNode("!xml");let i=e,r="",n="";for(let a=0;a<t.length;a++)if("<"===t[a])if("/"===t[a+1]){const e=findClosingIndex(t,">",a,"Closing Tag is not closed."),s=n.lastIndexOf(".");n=n.substring(0,s),i=this.tagsNodeStack.pop(),i&&i.child&&r&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=r),r="",a=e}else if("?"===t[a+1])a=readTagExp(t,a,!1,"?>").closeIndex+1;else if("!--"===t.substr(a+1,3))a=findClosingIndex(t,"--\x3e",a+4,"Comment is not closed.");else{const s=readTagExp(t,a,!1);let o=s.tagName,l=s.tagExp;const h=s.attrExpPresent,c=s.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new XmlNode(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new XmlNode(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}r="",a=c}else r+=t[a];return e.child}}function prettify(t,e){return compress(t)}function compress(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],n=propName(r);if(void 0!==n&&r[n]){const t=compress(r[n]);isLeafTag(t),r[":@"]&&assignAttributes(t,r[":@"]),void 0!==i[n]&&i.hasOwnProperty(n)?(Array.isArray(i[n])||(i[n]=[i[n]]),i[n].push(t)):i[n]=t}}return i}function propName(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function assignAttributes(t,e,i){if(e){const i=Object.keys(e),r=i.length;for(let n=0;n<r;n++){const r=i[n];t[r]=e[r]}}}function isLeafTag(t){return 0===Object.keys(t).length}class XMLParser{constructor(t){this.options=Object.assign({},XMLParser.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return prettify(new OrderedObjParser(this.options).parseXml(t),this.options)}}function isSvg(t){return t.startsWith("<svg")||t.startsWith("<?xml")}function isXML(t){return t.startsWith("<")}XMLParser.defaultOptions={};var __awaiter$6=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};function incrementalAddTo(t,e){t.incrementalAppendChild(e)}function waitForAllSubLayers(t){return __awaiter$6(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{application.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)}))}function boundStroke(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(r/2+(i?miterAdjustment(i,e):0))),t}function miterAdjustment(t,e){return t?e:0}let NUMBER_TYPE=0;function genNumberType(){return NUMBER_TYPE++}var TextDirection;function verticalLayout(t){const e=[];let i=0,r="";for(let n=0;n<t.length;n++)rotateText(t[n])?i?r+=t[n]:(i=1,r=t[n]):(i&&(e.push({text:r,direction:exports.TextDirection.VERTICAL}),r="",i=0),e.push({text:t[n],direction:exports.TextDirection.HORIZONTAL}));return r&&e.push({text:r,direction:exports.TextDirection.VERTICAL}),e}exports.TextDirection=void 0,TextDirection=exports.TextDirection||(exports.TextDirection={}),TextDirection[TextDirection.HORIZONTAL=0]="HORIZONTAL",TextDirection[TextDirection.VERTICAL=1]="VERTICAL";const rotateCharList=["…","(",")","—","【","】","「","」","《","》"],rotateCharMap=new Map;rotateCharList.forEach((t=>rotateCharMap.set(t,!0)));const noRotateCharList=[""],noRotateCharMap=new Map;function rotateText(t){if(rotateCharMap.has(t))return!0;if(noRotateCharMap.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function xul(t){const e=isArray$1(t)?t[0]:t,i=[];if(!e)return i;if(!0===isXML(e)){const t=(new XMLParser).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(parseRTTextXML(t.tc[e])):i.push(parseRTImageXML(t.tc[e]))}))}return i}function parseRTTextXML(t){const e={text:""};parseCommonXML(t,e);const i=t["#text"];return i&&(e.text=i),e}function parseCommonXML(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}}))}function parseRTImageXML(t){const e={image:"",width:0,height:0};parseCommonXML(t,e);const i=e.image;return i&&(e.image=i.replaceAll("&quot",'"').replaceAll("&lt","<").replaceAll("&gt",">")),e}noRotateCharList.forEach((t=>noRotateCharMap.set(t,!0)));const ARC_NUMBER_TYPE=genNumberType(),ARC3D_NUMBER_TYPE=genNumberType(),AREA_NUMBER_TYPE=genNumberType(),CIRCLE_NUMBER_TYPE=genNumberType(),GLYPH_NUMBER_TYPE=genNumberType(),GROUP_NUMBER_TYPE=genNumberType(),IMAGE_NUMBER_TYPE=genNumberType(),LINE_NUMBER_TYPE=genNumberType(),PATH_NUMBER_TYPE=genNumberType(),POLYGON_NUMBER_TYPE=genNumberType(),PYRAMID3D_NUMBER_TYPE=genNumberType(),RECT_NUMBER_TYPE=genNumberType(),RECT3D_NUMBER_TYPE=genNumberType(),RICHTEXT_NUMBER_TYPE=genNumberType(),SYMBOL_NUMBER_TYPE=genNumberType(),TEXT_NUMBER_TYPE=genNumberType(),GraphicService=Symbol.for("GraphicService"),GraphicCreator$1=Symbol.for("GraphicCreator"),SVG_ATTRIBUTE_MAP={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},SVG_ATTRIBUTE_MAP_KEYS=Object.keys(SVG_ATTRIBUTE_MAP),SVG_PARSE_ATTRIBUTE_MAP={"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"},SVG_PARSE_ATTRIBUTE_MAP_KEYS=Object.keys(SVG_PARSE_ATTRIBUTE_MAP);var GroupUpdateAABBBoundsMode;exports.GroupUpdateAABBBoundsMode=void 0,GroupUpdateAABBBoundsMode=exports.GroupUpdateAABBBoundsMode||(exports.GroupUpdateAABBBoundsMode={}),GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.LESS_GROUP=0]="LESS_GROUP",GroupUpdateAABBBoundsMode[GroupUpdateAABBBoundsMode.MORE_GROUP=1]="MORE_GROUP";class Group extends Graphic{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=GROUP_NUMBER_TYPE,this._childUpdateTag=exports.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 Theme),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Theme)}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(t,e,i){if(i===exports.IContainPointMode.GLOBAL){const i=new Point(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&exports.UpdateTag.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;application.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),application.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=DefaultTransform.x,y:e=DefaultTransform.y,dx:i=DefaultTransform.dx,dy:r=DefaultTransform.dy,scaleX:n=DefaultTransform.scaleX,scaleY:a=DefaultTransform.scaleY,angle:s=DefaultTransform.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==r||1!==n||1!==a||0!==s||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return getTheme(this).group}updateAABBBounds(t,e,i){const r=i;i=i.clone();const{width:n,height:a,path:s,clip:o=e.clip}=t;if(s&&s.length?s.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=a&&i.set(0,0,Math.max(0,n),Math.max(0,a)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:r=0}=t;i.translate(e,r)}return application.graphicService.updateTempAABBBounds(i),application.graphicService.transformAABBBounds(t,i,e,!1,this),r.copy(i),r}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=exports.UpdateTag.CLEAR_BOUNDS,this._childUpdateTag&=exports.UpdateTag.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=exports.UpdateTag.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&exports.UpdateTag.UPDATE_BOUNDS||(this._childUpdateTag|=exports.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(),application.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),application.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,application.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{application.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),application.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&exports.UpdateTag.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let r=this._getChildByName(t);return r?r.setAttributes(e):(r=application.graphicService.creator[i](e),r.name=t,this.add(r)),r}clone(){return new Group(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Group.NOWORK_ANIMATE_ATTR}}function createGroup(t){return new Group(t)}Group.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;class Layer extends Group{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,r){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=r.main,this.layerHandler=r.layerHandler,this.layerHandler.init(this,i,{main:r.main,canvasId:r.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=r.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Theme,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=>{application.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=>{application.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 TransformUtil=Symbol.for("TransformUtil"),GraphicUtil=Symbol.for("GraphicUtil"),LayerService=Symbol.for("LayerService"),StaticLayerHandlerContribution=Symbol.for("StaticLayerHandlerContribution"),DynamicLayerHandlerContribution=Symbol.for("DynamicLayerHandlerContribution"),VirtualLayerHandlerContribution=Symbol.for("VirtualLayerHandlerContribution");var DefaultLayerService_1,__decorate$1E=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};exports.DefaultLayerService=DefaultLayerService_1=class{static GenerateLayerId(){return`${DefaultLayerService_1.idprefix}_${DefaultLayerService_1.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=application.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?container.get(StaticLayerHandlerContribution):"dynamic"===t?container.get(DynamicLayerHandlerContribution):container.get(VirtualLayerHandlerContribution),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let r=this.getRecommendedLayerType(e.layerMode);r=e.main||e.canvasId?"static":r;const n=this.getLayerHandler(r),a=new Layer(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:r,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:DefaultLayerService_1.GenerateLayerId(),layerHandler:n})),s=this.layerMap.get(t)||[];return s.push(a),this.layerMap.set(t,s),this.staticLayerCountInEnv--,a}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)}},exports.DefaultLayerService.idprefix="visactor_layer",exports.DefaultLayerService.prefix_count=0,exports.DefaultLayerService=DefaultLayerService_1=__decorate$1E([injectable(),__metadata$1f("design:paramtypes",[])],exports.DefaultLayerService);var coreModule=new ContainerModule((t=>{t(VGlobal).to(exports.DefaultGlobal).inSingletonScope(),t(VWindow).to(exports.DefaultWindow),t(GraphicUtil).to(exports.DefaultGraphicUtil).inSingletonScope(),t(TransformUtil).to(exports.DefaultTransformUtil).inSingletonScope(),t(LayerService).to(exports.DefaultLayerService).inSingletonScope()}));function runFill(t,e){return!(!t&&!e)}function runStroke(t,e){let i;return i=isArray$1(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function fillVisible(t,e,i){return i&&t*e>0}function rectFillVisible(t,e,i,r,n){return n&&t*e>0&&0!==i&&0!==r}function strokeVisible(t,e){return t*e>0}function rectStrokeVisible(t,e,i,r){return t*e>0&&0!==i&&0!==r}function intersect(t,e,i,r,n,a,s,o){const l=i-t,h=r-e,c=s-n,u=o-a;let d=u*l-c*h;return d*d<epsilon?[]:(d=(c*(e-a)-u*(t-n))/d,[t+d*l,e+d*h])}function cornerTangents(t,e,i,r,n,a,s){const o=t-i,l=e-r,h=(s?a:-a)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,f=i+c,m=r+u,g=(d+f)/2,y=(p+m)/2,v=f-d,b=m-p,x=v*v+b*b,C=n-a,_=d*m-f*p,T=(b<0?-1:1)*Math.sqrt(Math.max(0,C*C*x-_*_));let A=(_*b-v*T)/x,S=(-_*v-b*T)/x;const P=(_*b+v*T)/x,w=(-_*v+b*T)/x,M=A-g,E=S-y,R=P-g,B=w-y;return M*M+E*E>R*R+B*B&&(A=P,S=w),{cx:A,cy:S,x01:-c,y01:-u,x11:A*(n/C-1),y11:S*(n/C-1)}}function calculateArcCornerRadius(t,e,i,r,n){const a=abs(i-e),s=t.getParsedCornerRadius(),o=isArray$1(s),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),f=o?s[0]:s,m=o?s[1]:s,g=o?s[2]:s,y=o?s[3]:s,v=Math.max(m,f),b=Math.max(g,y);let x=v,C=b;const _=n*cos(c),T=n*sin(c),A=r*cos(d),S=r*sin(d);let P,w,M,E;if((b>epsilon||v>epsilon)&&(P=n*cos(u),w=n*sin(u),M=r*cos(p),E=r*sin(p),a<pi)){const t=intersect(_,T,M,E,P,w,A,S);if(t){const e=_-t[0],i=T-t[1],a=P-t[0],s=w-t[1],o=1/sin(acos((e*a+i*s)/(sqrt(e*e+i*i)*sqrt(a*a+s*s)))/2),l=sqrt(t[0]*t[0]+t[1]*t[1]);C=min(b,(r-l)/(o-1)),x=min(v,(n-l)/(o+1))}}return{outerDeltaAngle:l,xors:_,yors:T,xirs:M,yirs:E,xore:P,yore:w,xire:A,yire:S,limitedOcr:x,limitedIcr:C,outerCornerRadiusStart:f,outerCornerRadiusEnd:m,maxOuterCornerRadius:v,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:y,innerCornerRadiusEnd:g}}function drawArcPath$1(t,e,i,r,n,a,s){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=abs(l-o),c=l>o;let u=!1;if(n<a){const t=n;n=a,a=t}if(n<=epsilon)e.moveTo(i,r);else if(h>=pi2-epsilon)e.moveTo(i+n*cos(o),r+n*sin(o)),e.arc(i,r,n,o,l,!c),a>epsilon&&(e.moveTo(i+a*cos(l),r+a*sin(l)),e.arc(i,r,a,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:f,yirs:m,limitedOcr:g,outerCornerRadiusStart:y,outerCornerRadiusEnd:v,maxOuterCornerRadius:b,xore:x,yore:C,xire:_,yire:T,outerStartAngle:A,outerEndAngle:S,limitedIcr:P,innerDeltaAngle:w,innerEndAngle:M,innerStartAngle:E,innerCornerRadiusStart:R,innerCornerRadiusEnd:B,maxInnerCornerRadius:k}=calculateArcCornerRadius(t,o,l,a,n);if(h<.001)s&&(s[3]||s[1])&&e.moveTo(i+d,r+p),u=!0;else if(g>epsilon){const t=min(y,g),a=min(v,g),o=cornerTangents(f,m,d,p,n,t,Number(c)),l=cornerTangents(x,C,_,T,n,a,Number(c));g<b&&t===a?!s||s[0]?(e.moveTo(i+o.cx+o.x01,r+o.cy+o.y01),e.arc(i+o.cx,r+o.cy,g,atan2(o.y01,o.x01),atan2(l.y01,l.x01),!c)):e.moveTo(i+o.cx+g*cos(atan2(l.y01,l.x01)),r+o.cy+g*sin(atan2(l.y01,l.x01))):!s||s[0]?(e.moveTo(i+o.cx+o.x01,r+o.cy+o.y01),t>0&&e.arc(i+o.cx,r+o.cy,t,atan2(o.y01,o.x01),atan2(o.y11,o.x11),!c),e.arc(i,r,n,atan2(o.cy+o.y11,o.cx+o.x11),atan2(l.cy+l.y11,l.cx+l.x11),!c),a>0&&e.arc(i+l.cx,r+l.cy,a,atan2(l.y11,l.x11),atan2(l.y01,l.x01),!c)):a>0?e.moveTo(i+l.cx+a*cos(atan2(l.y01,l.x01)),r+l.cy+a*sin(atan2(l.y01,l.x01))):e.moveTo(i+x,r+n*sin(S))}else!s||s[0]?(e.moveTo(i+d,r+p),e.arc(i,r,n,A,S,!c)):e.moveTo(i+n*cos(S),r+n*sin(S));if(!(a>epsilon)||w<.001)!s||s[1]?e.lineTo(i+_,r+T):e.moveTo(i+_,r+T),u=!0;else if(P>epsilon){const t=min(R,P),n=min(B,P),o=cornerTangents(_,T,x,C,a,-n,Number(c)),l=cornerTangents(d,p,f,m,a,-t,Number(c));if(!s||s[1]?e.lineTo(i+o.cx+o.x01,r+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,r+o.cy+o.y01),P<k&&t===n){const t=atan2(l.y01,l.x01);!s||s[2]?e.arc(i+o.cx,r+o.cy,P,atan2(o.y01,o.x01),t,!c):e.moveTo(i+o.cx+cos(t),r+o.cy+sin(t))}else!s||s[2]?(n>0&&e.arc(i+o.cx,r+o.cy,n,atan2(o.y01,o.x01),atan2(o.y11,o.x11),!c),e.arc(i,r,a,atan2(o.cy+o.y11,o.cx+o.x11),atan2(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,r+l.cy,t,atan2(l.y11,l.x11),atan2(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*cos(atan2(l.y01,l.x01)),r+l.cy+t*sin(atan2(l.y01,l.x01))):e.moveTo(i+f,r+m)}else!s||s[1]?e.lineTo(i+_,r+T):e.moveTo(i+_,r+T),!s||s[2]?e.arc(i,r,a,M,E,c):e.moveTo(i+a*cos(E),r+a*sin(E))}return s?s[3]&&e.lineTo(i+n*cos(o),r+n*sin(o)):e.closePath(),u}class ConicalCanvas{static GetCanvas(){try{return ConicalCanvas.canvas||(ConicalCanvas.canvas=application.global.createCanvas({})),ConicalCanvas.canvas}catch(t){return null}}static GetCtx(){if(!ConicalCanvas.ctx){const t=ConicalCanvas.GetCanvas();ConicalCanvas.ctx=t.getContext("2d")}return ConicalCanvas.ctx}}class ColorInterpolate extends LRU{static getInstance(){return ColorInterpolate._instance||(ColorInterpolate._instance=new ColorInterpolate),ColorInterpolate._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=ConicalCanvas.GetCanvas(),r=ConicalCanvas.GetCtx();if(i.width=e,i.height=1,!r)return;if(r.translate(0,0),!r)throw new Error("获取ctx发生错误");const n=r.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),r.fillStyle=n,r.fillRect(0,0,e,1),this.rgbaSet=r.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,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,s=`${t}${e}${i}${r}`;n.forEach((t=>s+=t.join())),s+=a;let o=this.dataMap.get(s);return o||(o={data:new ColorInterpolate(n,a),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(s,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class ConicalPatternStore{static GetSize(t){for(let e=0;e<ConicalPatternStore.ImageSize.length;e++)if(ConicalPatternStore.ImageSize[e]>=t)return ConicalPatternStore.ImageSize[e];return t}static Get(t,e,i,r,n,a,s){const o=ConicalPatternStore.GenKey(t,e,i,r,n),l=ConicalPatternStore.cache[o];if(!l||0===l.length)return null;for(let t=0;t<l.length;t++)if(l[t].width>=a&&l[t].height>=s)return l[t].pattern;return null}static Set(t,e,i,r,n,a,s,o){const l=ConicalPatternStore.GenKey(t,e,i,r,n);ConicalPatternStore.cache[l]?ConicalPatternStore.cache[l].push({width:s,height:o,pattern:a}):ConicalPatternStore.cache[l]=[{width:s,height:o,pattern:a}]}static GenKey(t,e,i,r,n){return`${e},${i},${r},${n},${t.join()}`}}function getConicGradientAt(t,e,i,r){const{stops:n,startAngle:a,endAngle:s}=r;for(;i<0;)i+=pi2;for(;i>pi2;)i-=pi2;if(i<a)return n[0].color;if(i>s)return n[0].color;let o,l,h=(i-a)/(s-a);for(let t=0;t<n.length;t++)if(n[t].offset>=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),interpolateColor(o.color,l.color,h,!1)}function createConicalGradient(t,e,i,r,n,a,s,o,l){const h=Math.floor(180*n/Math.PI),c=ConicalCanvas.GetCanvas(),u=ConicalCanvas.GetCtx();if(!u)return null;const d=ConicalPatternStore.GetSize(o),p=ConicalPatternStore.GetSize(l);let f=ConicalPatternStore.Get(e,i,r,a,s,d,p);if(f)return f;const m=Math.sqrt(Math.max(Math.max(Math.pow(i,2)+Math.pow(r,2),Math.pow(d-i,2)+Math.pow(r,2)),Math.max(Math.pow(d-i,2)+Math.pow(p-r,2),Math.pow(i,2)+Math.pow(p-r,2)))),g=h+1,y=n/Math.max(1,g-1),v=ColorInterpolate.getInstance().GetOrCreate(i,r,d,p,e,g),b=2*Math.PI*m/360;c.width=d,c.height=p,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,d,p),u.translate(i,r),u.rotate(a);for(let t=0,e=g-1;t<e&&!(a+t*y>s);t++){const e=v.getColor(t);u.beginPath(),u.rotate(y),u.moveTo(0,0),u.lineTo(m,-2*b),u.lineTo(m,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&&ConicalPatternStore.Set(e,i,r,a,s,f,d,p),f}ConicalPatternStore.cache={},ConicalPatternStore.ImageSize=[20,40,80,160,320,640,1280,2560];const ArcRenderContribution=Symbol.for("ArcRenderContribution"),AreaRenderContribution=Symbol.for("AreaRenderContribution"),CircleRenderContribution=Symbol.for("CircleRenderContribution"),GroupRenderContribution=Symbol.for("GroupRenderContribution"),ImageRenderContribution=Symbol.for("ImageRenderContribution"),PathRenderContribution=Symbol.for("PathRenderContribution"),PolygonRenderContribution=Symbol.for("PolygonRenderContribution"),RectRenderContribution=Symbol.for("RectRenderContribution"),SymbolRenderContribution=Symbol.for("SymbolRenderContribution"),TextRenderContribution=Symbol.for("TextRenderContribution"),CommonRenderContribution=Symbol.for("CommonRenderContribution"),InteractiveSubRenderContribution=Symbol.for("InteractiveSubRenderContribution");function textDrawOffsetY(t,e){return"top"===t?Math.ceil(.79*e):"middle"===t?Math.round(.3*e):"bottom"===t?Math.round(-.21*e):0}function textDrawOffsetX(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function textLayoutOffsetY(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 textAttributesToStyle(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[lowerCamelCaseToMiddle(i)]=t[i])})),["fontSize","lineHeight"].forEach((r=>{const n=lowerCamelCaseToMiddle(r);isNil$1(t[r])||(e[n]=i(t[r]))})),isValid$1(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&isString$1(t.fill)&&(e.color=t.fill),e}function identityMat4(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 rotateX(t,e,i){const r=Math.sin(i),n=Math.cos(i),a=e[4],s=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]=a*n+h*r,t[5]=s*n+c*r,t[6]=o*n+u*r,t[7]=l*n+d*r,t[8]=h*n-a*r,t[9]=c*n-s*r,t[10]=u*n-o*r,t[11]=d*n-l*r,t}function rotateY(t,e,i){const r=Math.sin(i),n=Math.cos(i),a=e[0],s=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]=a*n-h*r,t[1]=s*n-c*r,t[2]=o*n-u*r,t[3]=l*n-d*r,t[8]=a*r+h*n,t[9]=s*r+c*n,t[10]=o*r+u*n,t[11]=l*r+d*n,t}function rotateZ(t,e,i){const r=Math.sin(i),n=Math.cos(i),a=e[0],s=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]=a*n+h*r,t[1]=s*n+c*r,t[2]=o*n+u*r,t[3]=l*n+d*r,t[4]=h*n-a*r,t[5]=c*n-s*r,t[6]=u*n-o*r,t[7]=d*n-l*r,t}function translate(t,e,i){const r=i[0],n=i[1],a=i[2];let s,o,l,h,c,u,d,p,f,m,g,y;return e===t?(t[12]=e[0]*r+e[4]*n+e[8]*a+e[12],t[13]=e[1]*r+e[5]*n+e[9]*a+e[13],t[14]=e[2]*r+e[6]*n+e[10]*a+e[14],t[15]=e[3]*r+e[7]*n+e[11]*a+e[15]):(s=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],m=e[9],g=e[10],y=e[11],t[0]=s,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]=m,t[10]=g,t[11]=y,t[12]=s*r+c*n+f*a+e[12],t[13]=o*r+u*n+m*a+e[13],t[14]=l*r+d*n+g*a+e[14],t[15]=h*r+p*n+y*a+e[15]),t}function mat3Tomat4(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 multiplyMat4Mat3(t,e,i){const r=e[0],n=e[1],a=e[2],s=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],m=e[12],g=e[13],y=e[14],v=e[15];let b=i.a,x=i.b,C=0,_=0;return t[0]=b*r+x*o+C*u+_*m,t[1]=b*n+x*l+C*d+_*g,t[2]=b*a+x*h+C*p+_*y,t[3]=b*s+x*c+C*f+_*v,b=i.c,x=i.d,C=0,_=0,t[4]=b*r+x*o+C*u+_*m,t[5]=b*n+x*l+C*d+_*g,t[6]=b*a+x*h+C*p+_*y,t[7]=b*s+x*c+C*f+_*v,b=0,x=0,C=1,_=0,t[8]=b*r+x*o+C*u+_*m,t[9]=b*n+x*l+C*d+_*g,t[10]=b*a+x*h+C*p+_*y,t[11]=b*s+x*c+C*f+_*v,b=i.e,x=i.f,C=0,_=1,t[12]=b*r+x*o+C*u+_*m,t[13]=b*n+x*l+C*d+_*g,t[14]=b*a+x*h+C*p+_*y,t[15]=b*s+x*c+C*f+_*v,t}function scaleMat4(t,e,i){const r=i[0],n=i[1],a=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function multiplyMat4Mat4(t,e,i){const r=e[0],n=e[1],a=e[2],s=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],m=e[12],g=e[13],y=e[14],v=e[15];let b=i[0],x=i[1],C=i[2],_=i[3];return t[0]=b*r+x*o+C*u+_*m,t[1]=b*n+x*l+C*d+_*g,t[2]=b*a+x*h+C*p+_*y,t[3]=b*s+x*c+C*f+_*v,b=i[4],x=i[5],C=i[6],_=i[7],t[4]=b*r+x*o+C*u+_*m,t[5]=b*n+x*l+C*d+_*g,t[6]=b*a+x*h+C*p+_*y,t[7]=b*s+x*c+C*f+_*v,b=i[8],x=i[9],C=i[10],_=i[11],t[8]=b*r+x*o+C*u+_*m,t[9]=b*n+x*l+C*d+_*g,t[10]=b*a+x*h+C*p+_*y,t[11]=b*s+x*c+C*f+_*v,b=i[12],x=i[13],C=i[14],_=i[15],t[12]=b*r+x*o+C*u+_*m,t[13]=b*n+x*l+C*d+_*g,t[14]=b*a+x*h+C*p+_*y,t[15]=b*s+x*c+C*f+_*v,t}function lookAt(t,e,i,r){let n,a,s,o,l,h,c,u,d,p;const f=e[0],m=e[1],g=e[2],y=r[0],v=r[1],b=r[2],x=i[0],C=i[1],_=i[2];return Math.abs(f-x)<epsilon&&Math.abs(m-C)<epsilon&&Math.abs(g-_)<epsilon?identityMat4(t):(c=f-x,u=m-C,d=g-_,p=1/Math.hypot(c,u,d),c*=p,u*=p,d*=p,n=v*d-b*u,a=b*c-y*d,s=y*u-v*c,p=Math.hypot(n,a,s),p?(p=1/p,n*=p,a*=p,s*=p):(n=0,a=0,s=0),o=u*s-d*a,l=d*n-c*s,h=c*a-u*n,p=Math.hypot(o,l,h),p?(p=1/p,o*=p,l*=p,h*=p):(o=0,l=0,h=0),t[0]=n,t[1]=o,t[2]=c,t[3]=0,t[4]=a,t[5]=l,t[6]=u,t[7]=0,t[8]=s,t[9]=h,t[10]=d,t[11]=0,t[12]=-(n*f+a*m+s*g),t[13]=-(o*f+l*m+h*g),t[14]=-(c*f+u*m+d*g),t[15]=1,t)}function ortho(t,e,i,r,n,a,s){const o=1/(e-i),l=1/(r-n),h=1/(a-s);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]=(n+r)*l,t[14]=(s+a)*h,t[15]=1,t}function transformMat4(t,e,i){const r=e[0],n=e[1],a=e[2];let s=i[3]*r+i[7]*n+i[11]*a+i[15];return s=s||1,t[0]=(i[0]*r+i[4]*n+i[8]*a+i[12])/s,t[1]=(i[1]*r+i[5]*n+i[9]*a+i[13])/s,t[2]=(i[2]*r+i[6]*n+i[10]*a+i[14])/s,t}const MatrixAllocate=Symbol.for("MatrixAllocate"),Mat4Allocate=Symbol.for("Mat4Allocate");function createMat4(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class DefaultMatrixAllocate{constructor(){this.pools=[]}allocate(t,e,i,r,n,a){if(!this.pools.length)return new Matrix(t,e,i,r,n,a);const s=this.pools.pop();return s.a=t,s.b=e,s.c=i,s.d=r,s.e=n,s.f=a,s}allocateByObj(t){if(!this.pools.length)return new Matrix(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 DefaultMat4Allocate{constructor(){this.pools=[]}static identity(t){return identityMat4(t)}allocate(){if(!this.pools.length)return createMat4();const t=this.pools.pop();return DefaultMat4Allocate.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():createMat4();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 matrixAllocate=new DefaultMatrixAllocate,mat4Allocate=new DefaultMat4Allocate;var __decorate$1D=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1e=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$S=function(t,e){return function(i,r){e(i,r,t)}};function getExtraModelMatrix(t,e,i){const{alpha:r,beta:n}=i.attribute;if(!r&&!n)return null;const{anchor3d:a=i.attribute.anchor}=i.attribute,s=[0,0];if(a){if("string"==typeof a[0]){const t=parseFloat(a[0])/100,e=i.AABBBounds;s[0]=e.x1+(e.x2-e.x1)*t}else s[0]=a[0];if("string"==typeof a[1]){const t=parseFloat(a[1])/100,e=i.AABBBounds;s[1]=e.x1+(e.x2-e.x1)*t}else s[1]=a[1]}if("text"===i.type){const{textAlign:t}=i.attribute;s[0]+=textDrawOffsetX(t,i.clipedWidth)}s[0]+=t,s[1]+=e;const o=mat4Allocate.allocate();return translate(o,o,[s[0],s[1],0]),n&&rotateX(o,o,n),r&&rotateY(o,o,r),translate(o,o,[-s[0],-s[1],0]),o}function getModelMatrix(t,e,i){var r;const{x:n=i.x,y:a=i.y,z:s=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:m=i.angle,anchor3d:g=e.attribute.anchor,anchor:y}=e.attribute,v=[0,0,0];if(g){if("string"==typeof g[0]){const t=parseFloat(g[0])/100,i=e.AABBBounds;v[0]=i.x1+(i.x2-i.x1)*t}else v[0]=g[0];if("string"==typeof g[1]){const t=parseFloat(g[1])/100,i=e.AABBBounds;v[1]=i.x1+(i.x2-i.x1)*t}else v[1]=g[1];v[2]=null!==(r=g[2])&&void 0!==r?r:0}if(identityMat4(t),translate(t,t,[n+o,a+l,s+h]),translate(t,t,[v[0],v[1],v[2]]),rotateX(t,t,f),rotateY(t,t,p),translate(t,t,[-v[0],-v[1],v[2]]),scaleMat4(t,t,[c,u,d]),m){const i=mat4Allocate.allocate(),r=[0,0];if(y){if("string"==typeof g[0]){const t=parseFloat(g[0])/100,i=e.AABBBounds;r[0]=i.x1+(i.x2-i.x1)*t}else r[0]=g[0];if("string"==typeof g[1]){const t=parseFloat(g[1])/100,i=e.AABBBounds;r[1]=i.x1+(i.x2-i.x1)*t}else r[1]=g[1]}translate(i,i,[r[0],r[1],0]),rotateZ(i,i,m),translate(i,i,[-r[0],-r[1],0]),multiplyMat4Mat4(t,t,i)}}function shouldUseMat4(t){const{alpha:e,beta:i}=t.attribute;return e||i}exports.DefaultGraphicService=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new SyncHook(["graphic"]),onSetStage:new SyncHook(["graphic","stage"]),onRemove:new SyncHook(["graphic"]),onRelease:new SyncHook(["graphic"]),onAddIncremental:new SyncHook(["graphic","group","stage"]),onClearIncremental:new SyncHook(["graphic","group","stage"]),beforeUpdateAABBBounds:new SyncHook(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new SyncHook(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new SyncHook(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new AABBBounds,this.tempAABBBounds2=new AABBBounds}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,r){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,r)}afterUpdateAABBBounds(t,e,i,r,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,r,n)}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 r=new BoundsContext(t);return renderCommandList(i.commandList,r,0,0),!0}updateHTMLTextAABBBounds(t,e,i,r){const{textAlign:n,textBaseline:a}=t;if(null!=t.forceBoundsHeight){const e=isNumber$1(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),r=textLayoutOffsetY(a,e,e);i.set(i.x1,r,i.x2,r+e)}if(null!=t.forceBoundsWidth){const e=isNumber$1(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),r=textDrawOffsetX(n,e);i.set(r,i.y1,r+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,r,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:a=i.scaleY,stroke:s=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(s&&l){boundStroke(u,(l+h)/Math.abs(n+a),r,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:r=i.shadowOffsetX,shadowOffsetY:s=i.shadowOffsetY}=t;boundStroke(u,o/Math.abs(n+a)*2,!1,c+1),u.translate(r,s),e.union(u)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let a=!0;const s=n.transMatrix;n&&n.isContainer&&(a=!(1===s.a&&0===s.b&&0===s.c&&1===s.d&&0===s.e&&0===s.f)),a&&transformBoundsWithMatrix(e,e,s)}validCheck(t,e,i,r){if(!r)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(r.shadowRoot||r.isContainer)return!0;const{visible:n=e.visible}=t;return!(!r.valid||!n)||(i.empty()||(r.parent&&i.transformWithMatrix(r.parent.globalTransMatrix),application.graphicService.clearAABBBounds(r,r.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}}},exports.DefaultGraphicService=__decorate$1D([injectable(),__param$S(0,inject(GraphicCreator$1)),__metadata$1e("design:paramtypes",[Object])],exports.DefaultGraphicService);const updateBoundsOfCommonOuterBorder=(t,e,i)=>{const{outerBorder:r,shadowBlur:n=e.shadowBlur}=t;if(r){const t=e.outerBorder,{distance:a=t.distance,lineWidth:s=t.lineWidth}=r;i.expand(a+(n+s)/2)}return i},CIRCLE_UPDATE_TAG_KEY=["radius","startAngle","endAngle",...GRAPHIC_UPDATE_TAG_KEY];class Circle extends Graphic{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=CIRCLE_NUMBER_TYPE}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 getTheme(this).circle}updateAABBBounds(t,e,i,r){this.updatePathProxyAABBBounds(i)||(r?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:a}=application.graphicService.updateTempAABBBounds(i);return updateBoundsOfCommonOuterBorder(t,e,n),i.union(n),n.setValue(a.x1,a.y1,a.x2,a.y2),application.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:r=e.radius}=t;return i.set(-r,-r,r,r),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:r=e.startAngle,endAngle:n=e.endAngle,radius:a=e.radius}=t;return n-r>pi2-epsilon?i.set(-a,-a,a,a):circleBounds(r,n,a,i),i}needUpdateTags(t){return super.needUpdateTags(t,CIRCLE_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,CIRCLE_UPDATE_TAG_KEY)}toCustomPath(){var t,e,i;const r=this.attribute,n=null!==(t=r.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=r.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),s=null!==(i=r.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new CustomPath2D;return o.arc(0,0,n,a,s),o}clone(){return new Circle(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Circle.NOWORK_ANIMATE_ATTR}}function createCircle(t){return new Circle(t)}Circle.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;class CanvasTextLayout{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,r){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===r.length){const t=r[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0;const{lineWidth:o,suffixPosition:l="end",measureMode:h=exports.MeasureModeEnum.actualBounding,keepCenterInLine:c=!1}=null!=s?s:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,r=t.length;i<r;i++){const r=this.textMeasure.measureTextPixelADscentAndWidth(t[i],this.textOptions,h);let s=t[i].toString();if(r.width>o){const r=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,a,l);s=r.str,e=r.width}else e=r.width;u.push({str:s,width:e,ascent:r.ascent,descent:r.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,r=0;for(let n=0,a=t.length;n<a;n++){i=t[n];const a=this.textMeasure.measureTextPixelADscentAndWidth(t[n],this.textOptions,h);e=a.width,r=Math.max(r,e),u.push({str:i,width:e,ascent:a.ascent,descent:a.descent,keepCenterInLine:c})}d[0]=r}d[1]=u.length*r,d[0]=u.reduce(((t,e)=>Math.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,e,i,r)}layoutWithBBox(t,e,i,r,n){const a=[0,0],s=e.length*n;"top"===r||("middle"===r?a[1]=(t.height-s)/2:"bottom"===r&&(a[1]=t.height-s));for(let s=0;s<e.length;s++)this.lineOffset(t,e[s],i,r,n,a);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:n,textAlign:i,textBaseline:r}}lineOffset(t,e,i,r,n,a){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=n/2+(e.ascent-e.descent)/2+a[1],!e.keepCenterInLine){const t=0,i=e.ascent+e.descent+t;if(i<n-t&&("bottom"===r?e.topOffset+=(n-i)/2:"top"===r&&(e.topOffset-=(n-i)/2)),"alphabetic"===r){const t=n/(e.ascent+e.descent);e.topOffset=n/2+(e.ascent-e.descent)/2*t+a[1]}}return a[1]+=n,e}}const TEXT_UPDATE_TAG_KEY=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...GRAPHIC_UPDATE_TAG_KEY];class Text extends Graphic{get font(){const t=this.getGraphicTheme();return this._font||(this._font=getContextFont(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=this.getGraphicTheme(),r=this.getMaxWidth(i);return Number.isFinite(r)?(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(),r=this.attribute,n=this.getMaxWidth(i);if(!Number.isFinite(n))return!1;const{text:a}=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(a)?a.join(""):a)!==t}return"vertical"===r.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==r.text.toString():null!=this.clipedText&&this.clipedText!==r.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=TEXT_NUMBER_TYPE,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return isArray$1(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return getTheme(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 Text({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const r=this.obbText.AABBBounds,{x:n,y:a}=e,s={x:(r.x1+r.x2)/2,y:(r.y1+r.y2)/2},o=rotatePoint(s,i,{x:n,y:a});return this._OBBBounds.copy(r),this._OBBBounds.translate(o.x-s.x,o.y-s.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:r=e.text}=this.attribute;Array.isArray(r)?this.updateMultilineAABBBounds(r):this.updateSingallineAABBBounds(r);const{tb1:n}=application.graphicService.updateTempAABBBounds(i),{scaleX:a=e.scaleX,scaleY:s=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){boundStroke(n,o/Math.abs(a+s),!0,l),i.union(n)}return application.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||application.graphicService.updateHTMLTextAABBBounds(t,e,i),transformBoundsWithMatrix(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:r=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&r&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+r),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),r=this.attribute,{fontFamily:n=i.fontFamily,textAlign:a=i.textAlign,textBaseline:s=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:m=i.whiteSpace,suffixPosition:g=i.suffixPosition,ignoreBuf:y=i.ignoreBuf,keepCenterInLine:v=i.keepCenterInLine}=r,b=y?0:this.guessLineHeightBuf(o),x=this.getLineHeight(r,i,b);if("normal"===m||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 C=application.graphicUtil.textMeasure,_=new CanvasTextLayout(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:x},C).GetLayoutByLines(t,a,s,x,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:g,measureMode:p,keepCenterInLine:v}),{bbox:T}=_;return this.cache.layoutData=_,this.clearUpdateShapeTag(),this._AABBBounds.set(T.xOffset,T.yOffset,T.xOffset+T.width,T.yOffset+T.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,r;const n=this.getGraphicTheme(),{fontFamily:a=n.fontFamily,textAlign:s=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:u=n.stroke,lineWidth:d=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:f=n.fontWeight,ignoreBuf:m=n.ignoreBuf,measureMode:g=n.measureMode,suffixPosition:y=n.suffixPosition,heightLimit:v=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,C=m?0:this.guessLineHeightBuf(l),_=this.getLineHeight(this.attribute,n,C);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 T=application.graphicUtil.textMeasure,A={fontSize:l,fontWeight:f,fontFamily:a,lineHeight:_},S=new CanvasTextLayout(a,A,T),P=isArray$1(t)?t.map((t=>t.toString())):[t.toString()],w=[],M=[0,0];let E=1/0;if(v>0&&(E=Math.max(Math.floor(v/_),1)),b&&(E=Math.min(E,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t<P.length;t++){const e=P[t];let n=!0;if(t===E-1){const i=T.clipTextWithSuffix(e,A,c,h,!1,y,t!==P.length-1),r=T.measureTextPixelADscentAndWidth(i.str,A,g);w.push({str:i.str,width:i.width,ascent:r.ascent,descent:r.descent,keepCenterInLine:x});break}const a=T.clipText(e,A,c,"break-all"!==p,"keep-all"===p);if(""!==e&&""===a.str||a.wordBreaked){if(h){const t=T.clipTextWithSuffix(e,A,c,h,!1,y);a.str=null!==(i=t.str)&&void 0!==i?i:"",a.width=null!==(r=t.width)&&void 0!==r?r:0}else a.str="",a.width=0;n=!1}const s=T.measureTextPixelADscentAndWidth(a.str,A,g);w.push({str:a.str,width:a.width,ascent:s.ascent,descent:s.descent,keepCenterInLine:x});let o=a.str.length;if(!a.wordBreaked||""!==e&&""===a.str||(n=!0,o=a.wordBreaked),a.str.length===e.length);else if(n){let i=e.substring(o);"keep-all"===p&&(i=i.replace(/^\s+/g,"")),P.splice(t+1,0,i)}}let t=0;w.forEach((e=>{t=Math.max(t,e.width)})),M[0]=t}else{let t,e,i=0;for(let r=0,n=P.length;r<n;r++){if(r===E-1){const t=T.clipTextWithSuffix(P[r],A,c,h,!1,y),e=T.measureTextPixelADscentAndWidth(t.str,A,g);w.push({str:t.str,width:t.width,ascent:e.ascent,descent:e.descent,keepCenterInLine:x}),i=Math.max(i,t.width);break}e=P[r],t=T.measureTextWidth(e,A),i=Math.max(i,t);const n=T.measureTextPixelADscentAndWidth(e,A,g);w.push({str:e,width:t,ascent:n.ascent,descent:n.descent,keepCenterInLine:x})}M[0]=i}M[1]=w.length*_;const R={xOffset:0,yOffset:0,width:M[0],height:M[1]};S.LayoutBBox(R,s,o,w);const B=S.layoutWithBBox(R,w,s,o,_);return this.cache.layoutData=B,this.clearUpdateShapeTag(),this._AABBBounds.set(R.xOffset,R.yOffset,R.xOffset+R.width,R.yOffset+R.height),u&&this._AABBBounds.expand(d/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,i;const r=this.getGraphicTheme(),n=application.graphicUtil.textMeasure;let a;const s=this.attribute,{maxLineWidth:o=r.maxLineWidth,ellipsis:l=r.ellipsis,fontFamily:h=r.fontFamily,fontSize:c=r.fontSize,fontWeight:u=r.fontWeight,stroke:d=r.stroke,lineWidth:p=r.lineWidth,verticalMode:f=r.verticalMode,suffixPosition:m=r.suffixPosition}=s,g=this.getLineHeight(s,r,0);let{textAlign:y=r.textAlign,textBaseline:v=r.textBaseline}=s;if(!f){const t=y;y=null!==(e=Text.baselineMapAlign[v])&&void 0!==e?e:"left",v=null!==(i=Text.alignMapBaseline[t])&&void 0!==i?i:"top"}if(a=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=max(e,a)}));const t=textDrawOffsetX(y,a),e=this.cache.verticalList.length*g,i=textLayoutOffsetY(v,e,c);return this._AABBBounds.set(i,t,i+e,t+a),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const b=t.map((t=>verticalLayout(t.toString())));b.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const i=!0===l?r.ellipsis:l,s=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},o,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},o,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===exports.TextDirection.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:u,fontFamily:h});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=max(e,a)}));const x=textDrawOffsetX(y,a),C=this.cache.verticalList.length*g,_=textLayoutOffsetY(v,C,c);return this._AABBBounds.set(_,x,_+C,x+a),d&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const r=this.attribute;return null!==(i=null!==(e=r.maxLineWidth)&&void 0!==e?e:r.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var r;return null!==(r=calculateLineHeight(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==r?r:(t.fontSize||e.fontSize)+i}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:TEXT_UPDATE_TAG_KEY;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:TEXT_UPDATE_TAG_KEY;return super.needUpdateTag(t,e)}clone(){return new Text(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Text.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Text.baselineMapAlign}getAlignMapBaseline(){return Text.alignMapBaseline}}function createText(t){return new Text(t)}Text.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},NOWORK_ANIMATE_ATTR),Text.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Text.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const WRAP_TEXT_UPDATE_TAG_KEY=["heightLimit","lineClamp"];class WrapText extends Text{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return isArray$1(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,r,n;const a=this.getGraphicTheme(),{fontFamily:s=a.fontFamily,textAlign:o=a.textAlign,textBaseline:l=a.textBaseline,fontSize:h=a.fontSize,ellipsis:c=a.ellipsis,maxLineWidth:u,stroke:d=a.stroke,lineWidth:p=a.lineWidth,wordBreak:f=a.wordBreak,fontWeight:m=a.fontWeight,ignoreBuf:g=a.ignoreBuf,heightLimit:y=0,suffixPosition:v=a.suffixPosition,lineClamp:b}=this.attribute,x=null!==(e=calculateLineHeight(this.attribute.lineHeight,this.attribute.fontSize||a.fontSize))&&void 0!==e?e:this.attribute.fontSize||a.fontSize,C=g?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 _=application.graphicUtil.textMeasure,T=new CanvasTextLayout(s,{fontSize:h,fontWeight:m,fontFamily:s},_),A=t.map((t=>t.toString())),S=[],P=[0,0];let w=1/0;if(y>0&&(w=Math.max(Math.floor(y/x),1)),b&&(w=Math.min(w,b)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t<A.length;t++){const e=A[t];let i=!0;if(t===w-1){const t=T.textMeasure.clipTextWithSuffix(e,T.textOptions,u,c,!1,v);S.push({str:t.str,width:t.width,ascent:0,descent:0,keepCenterInLine:!1});break}const a=T.textMeasure.clipText(e,T.textOptions,u,"break-word"===f);if(""!==e&&""===a.str){if(c){const t=T.textMeasure.clipTextWithSuffix(e,T.textOptions,u,c,!1,v);a.str=null!==(r=t.str)&&void 0!==r?r:"",a.width=null!==(n=t.width)&&void 0!==n?n:0}else a.str="",a.width=0;i=!1}if(S.push({str:a.str,width:a.width,ascent:0,descent:0,keepCenterInLine:!1}),a.str.length===e.length);else if(i){const i=e.substring(a.str.length);A.splice(t+1,0,i)}}let t=0;S.forEach((e=>{t=Math.max(t,e.width)})),P[0]=t}else{let t,e,i=0;for(let r=0,n=A.length;r<n;r++){if(r===w-1){const t=T.textMeasure.clipTextWithSuffix(A[r],T.textOptions,u,c,!1,v);S.push({str:t.str,width:t.width,ascent:0,descent:0,keepCenterInLine:!1}),i=Math.max(i,t.width);break}e=A[r],t=T.textMeasure.measureTextWidth(e,T.textOptions,"break-word"===f),i=Math.max(i,t),S.push({str:e,width:t,ascent:0,descent:0,keepCenterInLine:!1})}P[0]=i}P[1]=S.length*(x+C);const M={xOffset:0,yOffset:0,width:P[0],height:P[1]};T.LayoutBBox(M,o,l);const E=T.layoutWithBBox(M,S,o,l,x);return this.cache.layoutData=E,this.clearUpdateShapeTag(),this._AABBBounds.set(M.xOffset,M.yOffset,M.xOffset+M.width,M.yOffset+M.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<WRAP_TEXT_UPDATE_TAG_KEY.length;e++){const i=WRAP_TEXT_UPDATE_TAG_KEY[e];if(-1!==t.indexOf(i))return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<WRAP_TEXT_UPDATE_TAG_KEY.length;e++)if(t===WRAP_TEXT_UPDATE_TAG_KEY[e])return!0;return super.needUpdateTag(t)}getNoWorkAnimateAttr(){return WrapText.NOWORK_ANIMATE_ATTR}}function createWrapText(t){return new WrapText(t)}class BaseSymbol{bounds(t,e){if(isNumber$1(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 isNumber$1(t)?t:Math.min(t[0],t[1])}}function circle(t,e,i,r,n){return n?t.arc(i,r,e,0,tau,!1,n):t.arc(i,r,e,0,tau),!1}class CircleSymbol extends BaseSymbol{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,r,n){return circle(t,this.parseSize(e)/2,i,r,n)}drawOffset(t,e,i,r,n,a){return circle(t,this.parseSize(e)/2+n,i,r,a)}drawToSvgPath(t,e,i,r){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}}var circle$1=new CircleSymbol;function cross(t,e,i,r,n){return t.moveTo(-3*e+i,-e+r,n),t.lineTo(-e+i,-e+r,n),t.lineTo(-e+i,-3*e+r,n),t.lineTo(e+i,-3*e+r,n),t.lineTo(e+i,-e+r,n),t.lineTo(3*e+i,-e+r,n),t.lineTo(3*e+i,e+r,n),t.lineTo(e+i,e+r,n),t.lineTo(e+i,3*e+r,n),t.lineTo(-e+i,3*e+r,n),t.lineTo(-e+i,e+r,n),t.lineTo(-3*e+i,e+r,n),t.closePath(),!0}function crossOffset(t,e,i,r,n,a){return t.moveTo(-3*e+i-n,-e+r-n,a),t.lineTo(-e+i-n,-e+r-n,a),t.lineTo(-e+i-n,-3*e+r-n,a),t.lineTo(e+i+n,-3*e+r-n,a),t.lineTo(e+i+n,-e+r-n,a),t.lineTo(3*e+i+n,-e+r-n,a),t.lineTo(3*e+i+n,e+r+n,a),t.lineTo(e+i+n,e+r+n,a),t.lineTo(e+i+n,3*e+r+n,a),t.lineTo(-e+i-n,3*e+r+n,a),t.lineTo(-e+i-n,e+r+n,a),t.lineTo(-3*e+i-n,e+r+n,a),t.closePath(),!0}class CrossSymbol extends BaseSymbol{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,r,n){return cross(t,this.parseSize(e)/6,i,r,n)}drawOffset(t,e,i,r,n,a){return crossOffset(t,this.parseSize(e)/6,i,r,n,a)}}var cross$1=new CrossSymbol;function diamond(t,e,i,r,n){return t.moveTo(i,r-e,n),t.lineTo(e+i,r,n),t.lineTo(i,r+e,n),t.lineTo(i-e,r,n),t.closePath(),!0}class DiamondSymbol extends BaseSymbol{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,r,n){return diamond(t,this.parseSize(e)/2,i,r,n)}drawFitDir(t,e,i,r,n){return diamond(t,this.parseSize(e)/2,i,r,n)}drawOffset(t,e,i,r,n,a){return diamond(t,this.parseSize(e)/2+n,i,r,a)}}var diamond$1=new DiamondSymbol;function square(t,e,i,r){const n=2*e;return t.rect(i-e,r-e,n,n),!1}class SquareSymbol extends BaseSymbol{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,r){return square(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return square(t,this.parseSize(e)/2+n,i,r)}}var square$1=new SquareSymbol;function trianglUpOffset(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+r+n),t.lineTo(i-e-2*n,e+r+n),t.lineTo(i,r-e-2*n),t.closePath(),!0}class TriangleUpSymbol extends BaseSymbol{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,r){return trianglUpOffset(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return trianglUpOffset(t,this.parseSize(e)/2,i,r,n)}}var triangleUp=new TriangleUpSymbol;class TriangleSymbol extends TriangleUpSymbol{constructor(){super(...arguments),this.type="triangle"}}var triangle=new TriangleSymbol;const kr=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),kx=Math.sin(tau/10)*kr,ky=-Math.cos(tau/10)*kr;function star(t,e,i,r){const n=kx*e,a=ky*e;t.moveTo(i,-e+r),t.lineTo(n+i,a+r);for(let s=1;s<5;++s){const o=tau*s/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+r),t.lineTo(l*n-h*a+i,h*n+l*a+r)}return t.closePath(),!0}class StarSymbol extends BaseSymbol{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,r){return star(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return star(t,this.parseSize(e)/2+n,i,r)}}var star$1=new StarSymbol;const sqrt3$1=sqrt(3);function arrow(t,e,i,r){const n=e,a=n/sqrt3$1,s=a/5,o=e;return t.moveTo(0+i,-n+r),t.lineTo(a/2+i,r),t.lineTo(s/2+i,r),t.lineTo(s/2+i,o+r),t.lineTo(-s/2+i,o+r),t.lineTo(-s/2+i,r),t.lineTo(-a/2+i,r),t.closePath(),!0}class ArrowSymbol extends BaseSymbol{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,r){return arrow(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return arrow(t,this.parseSize(e)/2+n,i,r)}}var arrow$1=new ArrowSymbol;function wedge(t,e,i,r){const n=2*e;return t.moveTo(i,-e+r),t.lineTo(n/3/2+i,e+r),t.lineTo(-n/3/2+i,e+r),t.closePath(),!0}class WedgeSymbol extends BaseSymbol{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,r){return wedge(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return wedge(t,this.parseSize(e)/2+n,i,r)}}var wedge$1=new WedgeSymbol;function stroke(t,e,i,r){return t.moveTo(-e+i,r),t.lineTo(i,e+r),!1}class StrokeSymbol extends BaseSymbol{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,r){return stroke(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return stroke(t,this.parseSize(e)/2+n,i,r)}}var stroke$1=new StrokeSymbol;const c$1=-.5,s$1=sqrt(3)/2,k$1=1/sqrt(12);function wye(t,e,i,r){const n=e/2,a=e*k$1,s=n,o=e*k$1+e,l=-s,h=o;return t.moveTo(n+i,a+r),t.lineTo(s+i,o+r),t.lineTo(l+i,h+r),t.lineTo(c$1*n-s$1*a+i,s$1*n+c$1*a+r),t.lineTo(c$1*s-s$1*o+i,s$1*s+c$1*o+r),t.lineTo(c$1*l-s$1*h+i,s$1*l+c$1*h+r),t.lineTo(c$1*n+s$1*a+i,c$1*a-s$1*n+r),t.lineTo(c$1*s+s$1*o+i,c$1*o-s$1*s+r),t.lineTo(c$1*l+s$1*h+i,c$1*h-s$1*l+r),t.closePath(),!1}class WyeSymbol extends BaseSymbol{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,r){return wye(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return wye(t,this.parseSize(e)/2+n,i,r)}}var wye$1=new WyeSymbol;function trianglLeftOffset(t,e,i,r,n){return t.moveTo(-e+i-2*n,r),t.lineTo(e+i+n,e+r+2*n),t.lineTo(e+i+n,r-e-2*n),t.closePath(),!0}class TriangleLeftSymbol extends BaseSymbol{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,r){return trianglLeftOffset(t,this.parseSize(e)/2,i,r,0)}drawOffset(t,e,i,r,n){return trianglLeftOffset(t,this.parseSize(e)/2,i,r,n)}}var triangleLeft=new TriangleLeftSymbol;function trianglRightOffset(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+r+2*n),t.lineTo(e+i+2*n,r),t.lineTo(i-e-n,r-e-2*n),t.closePath(),!0}class TriangleRightSymbol extends BaseSymbol{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,r){return trianglRightOffset(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return trianglRightOffset(t,this.parseSize(e)/2,i,r,n)}}var triangleRight=new TriangleRightSymbol;function trianglDownOffset(t,e,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,r-e-n),t.lineTo(i+e+2*n,r-e-n),t.lineTo(i,r+e+2*n),t.closePath(),!0}class TriangleDownSymbol extends BaseSymbol{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,r){return trianglDownOffset(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n){return trianglDownOffset(t,this.parseSize(e)/2,i,r,n)}}var triangleDown=new TriangleDownSymbol;const sqrt3=sqrt(3);function thinTriangle(t,e,i,r){const n=e*sqrt3;return t.moveTo(i,r+-n/3*2),t.lineTo(e+i,r+n),t.lineTo(i-e,r+n),t.closePath(),!0}class ThinTriangleSymbol extends BaseSymbol{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,r){return thinTriangle(t,this.parseSize(e)/2/sqrt3,i,r)}drawOffset(t,e,i,r,n){return thinTriangle(t,this.parseSize(e)/2/sqrt3+n,i,r)}}var thinTriangle$1=new ThinTriangleSymbol;function arrow2Left(t,e,i,r){const n=2*e;return t.moveTo(e+i,r-n),t.lineTo(i-e,r),t.lineTo(e+i,n+r),!0}class Arrow2LeftSymbol extends BaseSymbol{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,r){return arrow2Left(t,this.parseSize(e)/4,i,r)}drawOffset(t,e,i,r,n){return arrow2Left(t,this.parseSize(e)/4+n,i,r)}}var arrow2Left$1=new Arrow2LeftSymbol;function arrow2Right(t,e,i,r){const n=2*e;return t.moveTo(i-e,r-n),t.lineTo(i+e,r),t.lineTo(i-e,n+r),!0}class Arrow2RightSymbol extends BaseSymbol{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,r){return arrow2Right(t,this.parseSize(e)/4,i,r)}drawOffset(t,e,i,r,n){return arrow2Right(t,this.parseSize(e)/4+n,i,r)}}var arrow2Right$1=new Arrow2RightSymbol;function arrow2Up(t,e,i,r){const n=2*e;return t.moveTo(i-n,r+e),t.lineTo(i,r-e),t.lineTo(i+n,r+e),!0}class Arrow2UpSymbol extends BaseSymbol{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,r){return arrow2Up(t,this.parseSize(e)/4,i,r)}drawOffset(t,e,i,r,n){return arrow2Up(t,this.parseSize(e)/4+n,i,r)}}var arrow2Up$1=new Arrow2UpSymbol;function arrow2Down(t,e,i,r){const n=2*e;return t.moveTo(i-n,r-e),t.lineTo(i,r+e),t.lineTo(i+n,r-e),!0}class Arrow2DownSymbol extends BaseSymbol{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,r){return arrow2Down(t,this.parseSize(e)/4,i,r)}drawOffset(t,e,i,r,n){return arrow2Down(t,this.parseSize(e)/4+n,i,r)}}var arrow2Down$1=new Arrow2DownSymbol;function lineV(t,e,i,r,n){return t.moveTo(i,r-e),t.lineTo(i,r+e),!0}class LineVSymbol extends BaseSymbol{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,r,n){return lineV(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n,a){return lineV(t,this.parseSize(e)/2+n,i,r)}drawToSvgPath(t,e,i,r){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}}var lineV$1=new LineVSymbol;function lineH(t,e,i,r,n){return t.moveTo(i-e,r),t.lineTo(i+e,r),!0}class LineHSymbol extends BaseSymbol{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,r,n){return lineH(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n,a){return lineH(t,this.parseSize(e)/2+n,i,r)}drawToSvgPath(t,e,i,r){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}}var lineH$1=new LineHSymbol;function close(t,e,i,r,n){return t.moveTo(i-e,r-e),t.lineTo(i+e,r+e),t.moveTo(i+e,r-e),t.lineTo(i-e,r+e),!0}class CloseSymbol extends BaseSymbol{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,r,n){return close(t,this.parseSize(e)/2,i,r)}drawOffset(t,e,i,r,n,a){return close(t,this.parseSize(e)/2+n,i,r)}drawToSvgPath(t,e,i,r){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}}var close$1=new CloseSymbol;function rectSizeArray(t,e,i,r){return t.rect(i-e[0]/2,r-e[1]/2,e[0],e[1]),!1}function rectSize(t,e,i,r){const n=e,a=e/2;return t.rect(i-n/2,r-a/2,n,a),!1}class RectSymbol extends BaseSymbol{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,r){return isNumber$1(e)?rectSize(t,e,i,r):rectSizeArray(t,e,i,r)}drawWithClipRange(t,e,i,r,n,a,s){isNumber$1(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:r-e[1]/2},{x:i+e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r+e[1]/2},{x:i-e[0]/2,y:r-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;e<l.length;e++){const i=l[e],r=Math.sqrt((i.x-c.x)*(i.x-c.x)+(i.y-c.y)*(i.y-c.y));if(h+r>o){const e=(i.x-c.x)*(o-h)/r,n=(i.y-c.y)*(o-h)/r;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=r}return!1}drawOffset(t,e,i,r,n){return isNumber$1(e)?rectSize(t,e+2*n,i,r):rectSizeArray(t,[e[0]+2*n,e[1]+2*n],i,r)}}var rect=new RectSymbol;const tempBounds=new AABBBounds;class CustomSymbolClass{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,isArray$1(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,r,n,a,s){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),renderCommandList(n.path.commandList,t,i,r,e,e),s&&s(n.path,n.attribute)})),!1):(renderCommandList(this.path.commandList,t,i,r,e+n,e+n),!1)}draw(t,e,i,r,n,a){return e=this.parseSize(e),this.drawOffset(t,e,i,r,0,n,a)}drawWithClipRange(t,e,i,r,n,a,s){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((a=>{a.path.drawWithClipRange(t,e,i,r,n),s&&s(a.path,a.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,r,n),!1)}parseSize(t){return isNumber$1(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:r}=i;tempBounds.x1=r.bounds.x1*t,tempBounds.y1=r.bounds.y1*t,tempBounds.x2=r.bounds.x2*t,tempBounds.y2=r.bounds.y2*t,e.union(tempBounds)}))}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 builtinSymbols=[circle$1,cross$1,diamond$1,square$1,thinTriangle$1,triangle,star$1,arrow$1,wedge$1,stroke$1,wye$1,triangleLeft,triangleRight,triangleUp,triangleDown,arrow2Left$1,arrow2Right$1,arrow2Up$1,arrow2Down$1,rect,lineV$1,lineH$1,close$1],builtinSymbolsMap={};builtinSymbols.forEach((t=>{builtinSymbolsMap[t.type]=t}));const builtInSymbolStrMap={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"},updateBoundsOfSymbolOuterBorder=(t,e,i)=>{const{outerBorder:r,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(r){const t=e.outerBorder,{distance:s=t.distance,lineWidth:o=t.lineWidth}=r;boundStroke(i,s+(n+o)/2,!0,a)}return i},_tempBounds$1=new AABBBounds,SYMBOL_UPDATE_TAG_KEY=["symbolType","size",...GRAPHIC_UPDATE_TAG_KEY];let Symbol$1=class t extends Graphic{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=SYMBOL_NUMBER_TYPE}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return isArray$1(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,r=builtinSymbolsMap[i];if(r)return this._parsedPath=r,r;if(r=t.userSymbolMap[i],r)return this._parsedPath=r,r;if(i=builtInSymbolStrMap[i]||i,!0===isSvg(i)){const e=new XMLParser,{svg:r}=e.parse(i);if(!r)return null;const n=isArray$1(r.path)?r.path:[r.path];_tempBounds$1.clear();const a=[];n.forEach((t=>{const e=(new CustomPath2D).fromString(t.d),i={};SVG_PARSE_ATTRIBUTE_MAP_KEYS.forEach((e=>{t[e]&&(i[SVG_PARSE_ATTRIBUTE_MAP[e]]=t[e])})),a.push({path:e,attribute:i}),_tempBounds$1.union(e.bounds)}));const s=_tempBounds$1.width(),o=_tempBounds$1.height(),l=1/max(s,o);return a.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new CustomSymbolClass(i,a,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}const n=(new CustomPath2D).fromString(i),a=n.bounds.width(),s=n.bounds.height(),o=1/max(a,s);return n.transform(0,0,o,o),this._parsedPath=new CustomSymbolClass(i,n),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return getTheme(this).symbol}updateAABBBounds(t,e,i,r){this.updatePathProxyAABBBounds(i)||(r?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:a}=application.graphicService.updateTempAABBBounds(i);updateBoundsOfSymbolOuterBorder(t,e,n),i.union(n),n.setValue(a.x1,a.y1,a.x2,a.y2);const{lineJoin:s=e.lineJoin}=t;return application.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:r=e.size}=t;if(isArray$1(r))i.set(-r[0]/2,-r[1]/2,r[0]/2,r[1]/2);else{const t=r/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:r=e.size}=t;return this.getParsedPath().bounds(r,i),i}needUpdateTags(t){return super.needUpdateTags(t,SYMBOL_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,SYMBOL_UPDATE_TAG_KEY)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=isArray$1(e)?e:[e,e];return t.path?(new CustomPath2D).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new CustomPath2D).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function createSymbol(t){return new Symbol$1(t)}Symbol$1.userSymbolMap={},Symbol$1.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},NOWORK_ANIMATE_ATTR);const LINE_UPDATE_TAG_KEY=["segments","points","curveType","curveTension",...GRAPHIC_UPDATE_TAG_KEY];let Line$1=class t extends Graphic{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=LINE_NUMBER_TYPE}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,r,n){"points"===t&&(n.points=pointsInterpolation(i,r,e))}getGraphicTheme(){return getTheme(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),application.graphicService.updateTempAABBBounds(i);const{lineJoin:r=e.lineJoin}=t;return application.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}updateLineAABBBoundsByPoints(t,e,i,r){const{points:n=e.points,connectedType:a}=t,s=i;return n.forEach((t=>{!1===t.defined&&"zero"!==a&&"connect"!==a||s.add(t.x,t.y)})),s}updateLineAABBBoundsBySegments(t,e,i,r){const{segments:n=e.segments,connectedType:a}=t,s=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==a&&"connect"!==a||s.add(t.x,t.y)}))})),s}needUpdateTags(t){return super.needUpdateTags(t,LINE_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,LINE_UPDATE_TAG_KEY)}toCustomPath(){const t=this.attribute,e=new CustomPath2D,i=t.segments,r=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=>{r(t.points)})):t.points&&r(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function createLine(t){return new Line$1(t)}Line$1.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},NOWORK_ANIMATE_ATTR);const RECT_UPDATE_TAG_KEY=["width","x1","y1","height","cornerRadius",...GRAPHIC_UPDATE_TAG_KEY];class Rect extends Graphic{constructor(t){super(t),this.type="rect",this.numberType=RECT_NUMBER_TYPE}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return getTheme(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:r}=t;const{x1:n,y1:a,x:s,y:o}=t;e=null!=e?e:n-s,r=null!=r?r:a-o,(isFinite(e)||isFinite(r)||isFinite(s)||isFinite(o))&&i.set(0,0,e||0,r||0)}const{tb1:r,tb2:n}=application.graphicService.updateTempAABBBounds(i);return updateBoundsOfCommonOuterBorder(t,e,r),i.union(r),r.setValue(n.x1,n.y1,n.x2,n.y2),application.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,RECT_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,RECT_UPDATE_TAG_KEY)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:r,height:n}=normalizeRectAttributes(t),a=new CustomPath2D;return a.moveTo(e,i),a.rect(e,i,r,n),a}clone(){return new Rect(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rect.NOWORK_ANIMATE_ATTR}}function createRect(t){return new Rect(t)}Rect.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;const CUBE_VERTICES=[[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 Rect3d extends Rect{constructor(t){super(t),this.type="rect3d",this.numberType=RECT3D_NUMBER_TYPE}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:r,x:n,y:a,length:s=min(e.width,e.height)}=this.attribute;let{width:o,height:l}=this.attribute;o=null!=o?o:i-n,l=null!=l?l:r-a;for(let e=0;e<CUBE_VERTICES.length;e++){const i=CUBE_VERTICES[e];t.vertices.push([i[0]*o,i[1]*l,i[2]*s])}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 Rect3d.NOWORK_ANIMATE_ATTR}}function createRect3d(t){return new Rect3d(t)}Rect3d.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;class Glyph extends Graphic{constructor(t){super(t),this.type="glyph",this.numberType=GLYPH_NUMBER_TYPE,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,r){super.setAttribute(t,e,i,r),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 getTheme(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 r={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const a=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];a&&(Object.assign(r,a.attributes),(null===(i=a.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,a.subAttributes[e])})))})),this.subGraphic.forEach(((i,r)=>{i.updateNormalAttrs(n[r]),i.applyStateAttrs(n[r],t,e)})),this.updateNormalAttrs(r),this.currentStates=t,this.applyStateAttrs(r,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 Glyph(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Glyph.NOWORK_ANIMATE_ATTR}}function createGlyph(t){return new Glyph(t)}Glyph.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;class Frame{constructor(t,e,i,r,n,a,s,o,l,h,c,u,d,p){this.left=t,this.top=e,this.width=i,this.height=r,this.actualHeight=0,this.bottom=e+r,this.right=t+i,this.ellipsis=n,this.wordBreak=a,this.verticalDirection=s,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=DIRECTION_KEY[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:r}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let a=this.isHeightMax?Math.min(this.height,r):this.height||r||0;a=Math.min(a,r);let s=0;switch(this.globalBaseline){case"top":s=0;break;case"middle":s=-a/2;break;case"bottom":s=-a}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/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:r,height:n}=this.lines[i];if(r+n<this[this.directionKey.top]||r+n>this[this.directionKey.top]+l)return h;let a=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(a=!0,h=!0),this.lines[i].draw(t,a,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+s,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:s+=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]+s,this.ellipsis,e)}else if("bottom"===this.verticalDirection&&"vertical"!==this.layoutDirection)for(let i=0;i<this.lines.length;i++){const{top:r,height:n}=this.lines[i],a=l-this.lines[i].top-this.lines[i].height;if(0===l)this.lines[i].draw(t,!1,o,a+s,this.ellipsis,e);else{if(a+n>this[this.directionKey.top]+l||a<this[this.directionKey.top])return h;{let r=!1;this.ellipsis&&this.lines[i+1]&&a-this.lines[i+1].height<this[this.directionKey.top]&&(r=!0,h=!0),this.lines[i].draw(t,r,o,a+s,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:r,height:n}=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]+s,this.ellipsis,e);else{if(r+n<this[this.directionKey.top]||r+n>this[this.directionKey.top]+l)return h;{let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+s,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 r=this.lines[i];r.actualWidth>t&&(t=r.actualWidth),e+=r.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:r}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;i<this.lines.length;i++){const{top:r,height:a}=this.lines[i];if(r+a<this[this.directionKey.top]||r+a>this[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const r=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(r);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-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:r,height:a}=this.lines[i],s=n-this.lines[i].top-this.lines[i].height;if(0===n)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+a>this[this.directionKey.top]+n||s<this[this.directionKey.top]);else if(this.ellipsis&&this.lines[i+1]&&s-this.lines[i+1].height<this[this.directionKey.top]){const r=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(r);n>t&&(t=n),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:r,height:a}=this.lines[i];if(0===n)this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(r+a<this[this.directionKey.top]||r+a>this[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const r=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(r);n>t&&(t=n),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 Paragraph{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const r=calculateLineHeight(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof r?r>this.fontSize?r:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:a,descent:s,width:o}=measureTextCanvas(t,i);let l=0,h=0,c=0;this.height>a&&(l=(this.height-a)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=a-l):"bottom"===this.textBaseline?(this.ascent=a-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=s+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}=measureTextCanvas(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,r,n){let a=this.text,s=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)a=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)a+=this.ellipsisStr,"right"!==n&&"end"!==n||(s-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=getStrByWithCanvas(a,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,a.length-1);if(a=a.slice(0,t),a+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=measureTextCanvas(this.text.slice(t),this.character);"vertical"===o||(s-=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,s,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(s,e),s=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(a,s,e),this.character.fill&&t.fillText(a,s,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(s,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(s,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(s,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(s,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=getStrByWithCanvas(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:r}=measureTextCanvas(this.text.slice(t),this.character);return i+this.ellipsisWidth-r}return i}}function seperateParagraph(t,e){const i=t.text.slice(0,e),r=t.text.slice(e);return[new Paragraph(i,t.newLine,t.character),new Paragraph(r,!0,t.character)]}const IMAGE_UPDATE_TAG_KEY=["width","height","image",...GRAPHIC_UPDATE_TAG_KEY];let Image$1=class t extends Graphic{constructor(t){super(t),this.type="image",this.numberType=IMAGE_NUMBER_TYPE,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,r){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,r)}getGraphicTheme(){return getTheme(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:r=e.width,height:n=e.height}=t;i.set(0,0,r,n)}const{tb1:r,tb2:n}=application.graphicService.updateTempAABBBounds(i);return updateBoundsOfCommonOuterBorder(t,e,r),i.union(r),r.setValue(n.x1,n.y1,n.x2,n.y2),application.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return DefaultImageAttribute[t]}needUpdateTags(t){return super.needUpdateTags(t,IMAGE_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,IMAGE_UPDATE_TAG_KEY)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function createImage(t){return new Image$1(t)}Image$1.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},NOWORK_ANIMATE_ATTR);class RichTextIcon extends Image$1{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=parsePadding(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(isArray$1(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=parsePadding(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=DefaultImageAttribute.width,height:e=DefaultImageAttribute.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:r=e}=this.attribute,n=(i-t)/2,a=(r-e)/2;return this._AABBBounds.expand([0,2*n,2*a,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Line{constructor(t,e,i,r,n,a,s,o){this.left=t,this.width=e,this.baseline=i,this.ascent=r,this.descent=n,this.top=i-r,this.paragraphs=a.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof RichTextIcon?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=s,this.directionKey=DIRECTION_KEY[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Paragraph){const e=regFirstSpace.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,r=this.height;let n=this.left,a=0;this.actualWidth<t&&!e&&("right"===this.textAlign||"end"===this.textAlign?n=t-this.actualWidth:"center"===this.textAlign?n=(t-this.actualWidth)/2:"justify"===this.textAlign&&(this.paragraphs.length<2?n=(t-this.actualWidth)/2:a=(t-this.actualWidth)/(this.paragraphs.length-1))),this.paragraphs.map((function(t){t instanceof RichTextIcon?(t["_"+i.x]=n,n+=t[i.width]+a,t["_"+i.y]="top"===t.attribute.textBaseline?0:"bottom"===t.attribute.textBaseline?r-t.height:(r-t.height)/2):(t[i.left]=n,n+=t[i.width]+a)}))}draw(t,e,i,r,n,a){if(n&&(e||this.paragraphs.some((t=>t.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const r=this.paragraphs[e];if(r.overflow)t=t&&""===r.text;else if(t){i=!0;break}}let r=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 RichTextIcon)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const a=!0===n?"...":n||"";i.ellipsisStr=a;const{width:s}=measureTextCanvas(a,i.character),o=s||0;if(o<=this.blankWidth+r){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+r+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+r;break}i.ellipsis="hide",r+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof RichTextIcon)return e.setAttributes({x:i+e._x,y:r+e._y}),void a(e,t,i+e._x,r+e._y,this.ascent);const s={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};applyStrokeStyle(t,e.character),applyFillStyle(t,e.character,s),e.draw(t,r+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const r=this.paragraphs[i];if(r instanceof RichTextIcon)break;const{width:n}=measureTextCanvas(t,r.character),a=n||0;if(a<=this.blankWidth+e){r.ellipsis="add",r.ellipsisWidth=a;break}if(a<=this.blankWidth+e+r.width){r.ellipsis="replace",r.ellipsisWidth=a,r.ellipsisOtherParagraphWidth=this.blankWidth+e;break}r.ellipsis="hide",e+=r.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof RichTextIcon?t.width:t.getWidthWithEllips(this.direction)})),i}}class Wrapper{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=DIRECTION_KEY[this.direction]}store(t){if(t instanceof RichTextIcon){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 Line(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 RichTextIcon?"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||this.newLine)&&("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,r=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=getStrByWithCanvas(t.text,i,t.character,r,"break-word"===this.frame.wordBreak);if(0!==n){const[i,r]=seperateParagraph(t,n);this.store(i),e?this.send():this.deal(r)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const RICHTEXT_UPDATE_TAG_KEY=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...GRAPHIC_UPDATE_TAG_KEY];class RichText extends Graphic{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=RICHTEXT_NUMBER_TYPE,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const r=this._frameCache.icons.get(t[i]);this.updateHoverIconState(r)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:DefaultRichTextAttribute.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:DefaultRichTextAttribute.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:DefaultRichTextAttribute.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:DefaultRichTextAttribute.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:DefaultRichTextAttribute.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:DefaultRichTextAttribute.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:DefaultRichTextAttribute.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:DefaultRichTextAttribute.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return getTheme(this).richtext}updateAABBBounds(t,e,i){const{width:r=e.width,height:n=e.height,maxWidth:a=e.maxWidth,maxHeight:s=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(r>0&&n>0)i.set(0,0,r,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=r||e||0,h=n||o||0;h="number"==typeof s&&h>s?s:h||0,l="number"==typeof a&&l>a?a: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),application.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||application.graphicService.updateHTMLTextAABBBounds(t,e,i),application.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,RICHTEXT_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,RICHTEXT_UPDATE_TAG_KEY)}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:r,fontFamily:n,fontStyle:a,fontWeight:s,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:r,fontFamily:n,fontStyle:a,fontWeight:s,lineWidth:o,opacity:l,fillOpacity:h,strokeOpacity:c},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:r,maxHeight:n,width:a,height:s,ellipsis:o,wordBreak:l,verticalDirection:h,textAlign:c,textBaseline:u,layoutDirection:d,singleLine:p,disableAutoWrapLine:f}=this.attribute,m=[],g=null!=t?t:i;for(let t=0;t<g.length;t++)if("image"in g[t]){const e=this.combinedStyleToCharacter(g[t]);e.lineWidth=void 0;const i=e.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(e.id);if(i)m.push(i);else{const t=new RichTextIcon(e);t.successCallback=()=>{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(g[t]);if(isNumber$1(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++)m.push(new Paragraph(t[i],0!==i,e))}else e.text&&m.push(new Paragraph(e.text,!1,e))}const y="number"==typeof r&&Number.isFinite(r)&&r>0,v="number"==typeof n&&Number.isFinite(n)&&n>0,b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=r),x="number"==typeof s&&Number.isFinite(s)&&s>0&&(!v||s<=n),C=new Frame(0,0,(b?a:y?r:0)||0,(x?s:v?n:0)||0,o,l,h,c,u,d||"horizontal",!b&&y,!x&&v,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),_=new Wrapper(C);if(f){let t=0,e=!1;for(let i=0;i<m.length;i++){const r=m[i];e?(r.overflow=!0,r.left=1/0,r.top=1/0,!r.newLine&&C.lines[C.lines.length-1].paragraphs.push(r)):_.deal(r,!0),C.lines.length!==t&&(t=C.lines.length,_.lineBuffer.length=0,r.overflow=!0,r.left=1e3,r.top=1e3,C.lines[C.lines.length-1].paragraphs.push(r),e=!0),r.newLine&&(e=!1,_.lineWidth=0),_.send()}}else for(let t=0;t<m.length;t++)t===m.length-1&&(_.newLine=!0),_.deal(m[t]),_.newLine=!1;if(_.send(),!("horizontal"===C.layoutDirection?b:x)){const t=C.getActualSizeWidthEllipsis();let e="horizontal"===C.layoutDirection?t.width:t.height;("horizontal"===C.layoutDirection?y:v)&&(e=Math.min(e,"horizontal"===C.layoutDirection?r:n)),C.lines.forEach((function(t){t.calcOffset(e,!1)}))}this._frameCache=C}clone(){return new RichText(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,r,n,a;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===(r=this.stage)||void 0===r||r.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(a=this.stage)||void 0===a||a.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:r}=this.globalTransMatrix;let n;return e.icons.forEach(((e,a)=>{var s,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-r})&&(n=e,n.globalX=(null!==(s=n.attribute.x)&&void 0!==s?s:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+r+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return RichText.NOWORK_ANIMATE_ATTR}}function createRichText(t){return new RichText(t)}RichText.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},NOWORK_ANIMATE_ATTR);const PATH_UPDATE_TAG_KEY=["path","customPath",...GRAPHIC_UPDATE_TAG_KEY];class Path extends Graphic{constructor(t){super(t),this.type="path",this.numberType=PATH_NUMBER_TYPE}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 CustomPath2D?e.path:(isNil$1(this.cache)&&this.doUpdatePathShape(),this.cache instanceof CustomPath2D?this.cache:t.path)}getGraphicTheme(){return getTheme(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:r,tb2:n}=application.graphicService.updateTempAABBBounds(i);updateBoundsOfCommonOuterBorder(t,e,r),i.union(r),r.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:a=e.lineJoin}=t;return application.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;isString$1(t.path,!0)?this.cache=(new CustomPath2D).fromString(t.path):t.customPath&&(this.cache=new CustomPath2D,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,PATH_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,PATH_UPDATE_TAG_KEY)}toCustomPath(){return(new CustomPath2D).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Path(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Path.NOWORK_ANIMATE_ATTR}}function createPath(t){return new Path(t)}Path.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},NOWORK_ANIMATE_ATTR);const AREA_UPDATE_TAG_KEY=["segments","points","curveType","curveTension",...GRAPHIC_UPDATE_TAG_KEY];class Area extends Graphic{constructor(t){super(t),this.type="area",this.numberType=AREA_NUMBER_TYPE}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 getTheme(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),application.graphicService.updateTempAABBBounds(i);const{lineJoin:r=e.lineJoin}=t;return application.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}updateAreaAABBBoundsByPoints(t,e,i,r){const{points:n=e.points}=t,a=i;return n.forEach((t=>{var e,i;a.add(t.x,t.y),a.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),a}updateAreaAABBBoundsBySegments(t,e,i,r){const{segments:n=e.segments}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;a.add(t.x,t.y),a.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),a}_interpolate(t,e,i,r,n){"points"===t&&(n.points=pointsInterpolation(i,r,e))}needUpdateTags(t){return super.needUpdateTags(t,AREA_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,AREA_UPDATE_TAG_KEY)}toCustomPath(){const t=new CustomPath2D,e=this.attribute,i=e.segments,r=e=>{if(e&&e.length){let i=!0;const r=[];if(e.forEach((e=>{var n,a;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),r.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(a=e.y1)&&void 0!==a?a:e.y}),i=!1)})),r.length){for(let e=r.length-1;e>=0;e--)t.lineTo(r[e].x,r[e].y);t.closePath()}}};return e.points?r(e.points):i&&i.length&&i.forEach((t=>{r(t.points)})),t}clone(){return new Area(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Area.NOWORK_ANIMATE_ATTR}}function createArea(t){return new Area(t)}Area.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},NOWORK_ANIMATE_ATTR);const ARC_UPDATE_TAG_KEY=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...GRAPHIC_UPDATE_TAG_KEY];class Arc extends Graphic{constructor(t){super(t),this.type="arc",this.numberType=ARC_NUMBER_TYPE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:r}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(r)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:r=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:a=t.innerRadius}=this.attribute;if(n+=r,a-=i,0===e||"0%"===e)return 0;const s=Math.abs(n-a),o=t=>Math.min(isNumber$1(t,!0)?t:s*parseFloat(t)/100,s/2);if(isArray$1(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:r=t.cap}=this.attribute,n=i-e>=0?1:-1,a=i-e;if(e=clampAngleByRadian(e),i=e+a,r&&abs(a)<pi2-epsilon){let a=1,s=1;r.length&&(a=Number(r[0]),s=Number(r[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>epsilon&&o>epsilon)return{startAngle:e-n*d*a,endAngle:i+n*d*s,sc:n*d*a,ec:n*d*s}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:r=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:a=i.padAngle}=this.attribute;let{outerRadius:s=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;s+=n,o-=r;const{padRadius:l=sqrt(s*s+o*o)}=this.attribute,h=abs(e-t);let c=t,u=e,d=t,p=e;const f=a/2;let m=h,g=h;if(f>epsilon&&l>epsilon){const i=e>t?1:-1;let r=asin(Number(l)/o*sin(f)),n=asin(Number(l)/s*sin(f));return(m-=2*r)>epsilon?(r*=i,d+=r,p-=r):(m=0,d=p=(t+e)/2),(g-=2*n)>epsilon?(n*=i,c+=n,u-=n):(g=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:g}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:g}}getGraphicTheme(){return getTheme(this).arc}updateAABBBounds(t,e,i,r){this.updatePathProxyAABBBounds(i)||(r?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:a}=application.graphicService.updateTempAABBBounds(i);updateBoundsOfCommonOuterBorder(t,e,n),i.union(n),n.setValue(a.x1,a.y1,a.x2,a.y2);const{lineJoin:s=e.lineJoin}=t;return application.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:r=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:s=e.innerPadding}=t;return r+=a,n-=s,r<n&&(r=n),i.set(-r,-r,r,r),i}updateArcAABBBoundsAccurate(t,e,i){let{outerRadius:r=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:a=e.outerPadding,innerPadding:s=e.innerPadding}=t;if(r+=a,n-=s,r<n){const t=r;r=n,n=t}let{endAngle:o=e.endAngle,startAngle:l=e.startAngle}=t;if(l>o){const t=l;l=o,o=t}return r<=epsilon?i.set(0,0,0,0):Math.abs(o-l)>pi2-epsilon?i.set(-r,-r,r,r):(circleBounds(l,o,r,i),circleBounds(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,ARC_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,ARC_UPDATE_TAG_KEY)}toCustomPath(){var t,e,i,r;const n=this.attribute,{startAngle:a,endAngle:s}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(r=n.outerPadding)&&void 0!==r?r:0);const h=abs(s-a),c=s>a;if(l<o){const t=l;l=o,o=t}const u=new CustomPath2D;if(l<=epsilon)u.moveTo(0,0);else if(h>=pi2-epsilon)u.moveTo(0+l*cos(a),0+l*sin(a)),u.arc(0,0,l,a,s,!c),o>epsilon&&(u.moveTo(0+o*cos(s),0+o*sin(s)),u.arc(0,0,o,s,a,c));else{const t=l*cos(a),e=l*sin(a),i=o*cos(s),r=o*sin(s);u.moveTo(0+t,0+e),u.arc(0,0,l,a,s,!c),u.lineTo(0+i,0+r),u.arc(0,0,o,s,a,c),u.closePath()}return u}clone(){return new Arc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Arc.NOWORK_ANIMATE_ATTR}}function createArc(t){return new Arc(t)}Arc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},NOWORK_ANIMATE_ATTR);class Arc3d extends Arc{constructor(t){super(t),this.type="arc3d",this.numberType=ARC3D_NUMBER_TYPE}updateAABBBounds(t,e,i){const r=this.stage;if(!r||!r.camera)return i;const{outerRadius:n=e.outerRadius,height:a=0}=t,s=n+a;return i.setValue(-s,-s,s,s),application.graphicService.updateTempAABBBounds(i),application.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return Arc3d.NOWORK_ANIMATE_ATTR}}function createArc3d(t){return new Arc3d(t)}Arc3d.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},NOWORK_ANIMATE_ATTR);const POLYGON_UPDATE_TAG_KEY=["points","cornerRadius",...GRAPHIC_UPDATE_TAG_KEY];class Polygon extends Graphic{constructor(t){super(t),this.type="polygon",this.numberType=POLYGON_NUMBER_TYPE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return getTheme(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),application.graphicService.updateTempAABBBounds(i);const{lineJoin:r=e.lineJoin}=t;return application.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:r=e.points}=t;return r.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,r,n){"points"===t&&(n.points=pointsInterpolation(i,r,e))}needUpdateTags(t){return super.needUpdateTags(t,POLYGON_UPDATE_TAG_KEY)}needUpdateTag(t){return super.needUpdateTag(t,POLYGON_UPDATE_TAG_KEY)}toCustomPath(){const t=this.attribute.points,e=new CustomPath2D;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 Polygon(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Polygon.NOWORK_ANIMATE_ATTR}}function createPolygon(t){return new Polygon(t)}Polygon.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;class Pyramid3d extends Polygon{constructor(t){super(t),this.type="pyramid3d",this.numberType=PYRAMID3D_NUMBER_TYPE}updateAABBBounds(t,e,i){const r=this.stage;return r&&r.camera?(this.findFace().vertices.forEach((t=>{const e=t[0],r=t[1];i.add(e,r)})),application.graphicService.updateTempAABBBounds(i),application.graphicService.transformAABBBounds(t,i,e,!1,this),i):i}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const r=3===i?t[0]:t[i+1],n=e.x-r.x;return 0===n?0:(e.y-r.y)/n})),i=t.map((t=>({p:t,d:0})));let r=!1,n=0;for(let t=0;t<e.length-1;t++){for(let a=t+1;a<e.length;a++){if(e[t]===e[a]){r=!0;const e=PointService.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,n=max(n,e);const s=PointService.distancePP(i[a].p,i[a+1].p);i[a].d=s,i[a+1].d=s,n=max(n,s)}if(r)break}if(r)break}for(let e=t.length-1;e>=0;e--){const r=t[e];i.unshift({p:r,d:0})}for(let e=0;e<t.length;e++){const r=(n-i[e+t.length].d)/2;i[e].d+=r,i[e+t.length].d+=r}const a={polygons:[],vertices:[],edges:[]};return i.forEach((t=>{a.vertices.push([t.p.x,t.p.y,t.d])})),a.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),a.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),a.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),a.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),a.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),a.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),a.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]],a}_isValid(){return super._isValid()&&4===this.attribute.points.length}getNoWorkAnimateAttr(){return Pyramid3d.NOWORK_ANIMATE_ATTR}}function createPyramid3d(t){return new Pyramid3d(t)}Pyramid3d.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;class ShadowRoot extends Group{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 createShadowRoot(t){return new ShadowRoot(t)}class GraphicCreator{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}}const graphicCreator=new GraphicCreator;let text,richText;function getTextBounds(t){return text||(text=graphicCreator.CreateGraphic("text",{})),text.initAttributes(t),text.AABBBounds}function getRichTextBounds(t){return richText||(richText=graphicCreator.CreateGraphic("richtext",{})),richText.setAttributes(t),richText.AABBBounds}const result={x:0,y:0,z:0,lastModelMatrix:null};class BaseRender{init(t){t&&(this._renderContribitions=t.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((t=>t.time===exports.BaseRenderContributionTime.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===exports.BaseRenderContributionTime.afterFillStroke)))}beforeRenderStep(t,e,i,r,n,a,s,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,r,n,a,s,o,l,h,c,u,d)}))}afterRenderStep(t,e,i,r,n,a,s,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,r,n,a,s,o,l,h,c,u,d)}))}drawPathProxy(t,e,i,r,n,a,s,o){if(!t.pathProxy)return!1;const l=getTheme(t,null==a?void 0:a.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:m=l.visible,x:g=l.x,y:y=l.y}=t.attribute,v=fillVisible(u,d,h),b=strokeVisible(u,f),x=runFill(h),C=runStroke(c,p);if(!m)return!0;if(!x&&!C)return!0;if(!(v||b||s||o))return!0;e.beginPath();return renderCommandList(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,r),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,x,C,v,b,l,n,s,o),C&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,i-g,r-y,l),e.stroke())),x&&(s?s(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i-g,r-y,l),e.fill())),this.afterRenderStep(t,e,i,r,x,C,v,b,l,n,s,o),!0}valid(t,e,i,r){const{fill:n=e.fill,background:a,stroke:s=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=fillVisible(o,l,n),p=strokeVisible(o,c),f=runFill(n,a),m=runStroke(s,h);return!(!t.valid||!u)&&!(!f&&!m)&&!!(d||p||i||r||a)&&{fVisible:d,sVisible:p,doFill:f,doStroke:m}}transform(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:a=e.y,z:s=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,u=i.modelMatrix,d=i.camera;result.x=n,result.y=a,result.z=s,result.lastModelMatrix=u;const p=d&&(r||shouldUseMat4(t)),f=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const r=mat4Allocate.allocate(),n=mat4Allocate.allocate();getModelMatrix(n,t,e),multiplyMat4Mat4(r,u||r,n),result.x=0,result.y=0,result.z=0,i.modelMatrix=r,i.setTransform(1,0,0,1,0,0,!0),mat4Allocate.free(n)}if(f&&!u){const r=t.getOffsetXY(e);result.x+=r.x,result.y+=r.y,result.z=s,i.setTransformForCurrent()}else if(p)result.x=0,result.y=0,result.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const r=t.getOffsetXY(e);result.x+=r.x,result.y+=r.y,this.transformWithoutTranslate(i,result.x,result.y,result.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),result.x=0,result.y=0,result.z=0;return result}transformUseContext2d(t,e,i,r){const n=r.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,a=e.y2-e.y1,s=r.project(0,0,i),o=r.project(n,0,i),l=r.project(n,a,i),h={x:0,y:0},c={x:n,y:0},u={x:n,y:a};r.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)*s.x)*d,f=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*s.y)*d,m=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*s.x)*d,g=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*s.y)*d,y=(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)*s.x)*d,v=(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)*s.y)*d;r.setTransform(p,f,m,g,y,v,!0)}}restoreTransformUseContext2d(t,e,i,r){this.camera&&(r.camera=this.camera)}transformWithoutTranslate(t,e,i,r,n,a,s){const o=t.project(e,i,r);t.translate(o.x,o.y,!1),t.scale(n,a,!1),t.rotate(s,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,r,n){const{context:a}=r;if(!a)return;const{renderable:s}=t.attribute;if(!1===s)return;a.highPerformanceSave();const o=this.transform(t,e,a,i),{x:l,y:h,z:c,lastModelMatrix:u}=o;this.z=c,this.drawPathProxy(t,a,l,h,r,n)||(this.drawShape(t,a,l,h,r,n),this.z=0,a.modelMatrix!==u&&mat4Allocate.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var __decorate$1C=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1d=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$R=function(t,e){return function(i,r){e(i,r,t)}};class DefaultBaseBackgroundRenderContribution{constructor(){this.time=exports.BaseRenderContributionTime.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u,d){var p;const{background:f,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:g=l.opacity,backgroundMode:y=l.backgroundMode,backgroundFit:v=l.backgroundFit}=t.attribute;if(f)if(t.backgroundImg&&t.resources){const n=t.resources.get(f);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=getTheme(t.parent).group,{scrollX:r=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(r,n)}e.clip();const a=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,r,l),e.globalAlpha=m*g,this.doDrawImage(e,n.data,a,y,v),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,r,l),e.globalAlpha=m*g,e.fillStyle=f,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,r,n){if("no-repeat"===r)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const a=i.width(),s=i.height();let o=a,l=s;if(n&&"repeat"!==r&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===r?(o=i*(s/n),l=s):"repeat-y"===r&&(l=n*(a/i),o=a);const h=t.dpr,c=canvasAllocate.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),canvasAllocate.free(c)}const h=t.dpr,c=t.createPattern(e,r);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,a,s),t.translate(-i.x1,-i.y1)}}}const defaultBaseBackgroundRenderContribution=new DefaultBaseBackgroundRenderContribution;function formatRatio(t){return t<=.5?4*t-1:-4*t+3}function drawWave(t,e,i,r,n,a,s){const{fill:o="orange",percent:l=.6,frequency:h=4,opacity:c,phi:u=0}=n;let{amplitude:d=10}=n;d*=formatRatio(e);const p=r*(1-l),f=i,m=Math.max(Math.round(f/70),2);t.beginPath(),t.moveTo(0+a,r+s),t.lineTo(0+a,p+s);const g=f/h*e,y=f/Math.PI/(2*h);for(let e=0;e<f;e+=m){const i=d*Math.sin((e+g+u)/y+u);t.lineTo(e+a,p+i+s)}t.lineTo(f+a,r+s),t.closePath(),t.fillStyle=o,isFinite(c)&&(t.globalAlpha=c),t.fill()}exports.DefaultBaseInteractiveRenderContribution=class{constructor(t){this.subRenderContribitions=t,this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,r,n,a,s,o,l,h,c,u,d)}))}},exports.DefaultBaseInteractiveRenderContribution=__decorate$1C([injectable(),__param$R(0,inject(ContributionProvider)),__param$R(0,named(InteractiveSubRenderContribution)),__metadata$1d("design:paramtypes",[Object])],exports.DefaultBaseInteractiveRenderContribution);class DefaultBaseTextureRenderContribution{constructor(){this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,r,n){const a=(t-2*e)/2,s=r.dpr,o=canvasAllocate.allocate({width:t,height:t,dpr:s}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(a,l);const h=r.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),canvasAllocate.free(o),h}createCirclePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,pi2),e.fill()}))}createDiamondPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((e,r)=>{const n=t/2,a=n;r.fillStyle=i,r.moveTo(n,a-e),r.lineTo(e+n,a),r.lineTo(n,a+e),r.lineTo(n-e,a),r.closePath(),r.fill()}))}createRectPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,r)=>{const n=e,a=n;r.fillStyle=i,r.fillRect(n,a,2*t,2*t)}))}createVerticalLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((r,n)=>{const a=e;n.fillStyle=i,n.fillRect(a,0,2*r,t)}))}createHorizontalLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((r,n)=>{const a=e;n.fillStyle=i,n.fillRect(0,a,t,2*r)}))}createBiasLRLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((e,r)=>{r.strokeStyle=i,r.lineWidth=e,r.moveTo(0,0),r.lineTo(t,t);const n=t/2,a=-n;r.moveTo(n,a),r.lineTo(n+t,a+t),r.moveTo(-n,-a),r.lineTo(-n+t,-a+t),r.stroke()}))}createBiasRLLinePattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((e,r)=>{r.strokeStyle=i,r.lineWidth=e,r.moveTo(t,0),r.lineTo(0,t);const n=t/2,a=n;r.moveTo(t+n,a),r.lineTo(n,a+t),r.moveTo(t-n,-a),r.lineTo(-n,-a+t),r.stroke()}))}createGridPattern(t,e,i,r){return this.createCommonPattern(t,e,i,r,((t,r)=>{const n=e,a=n;r.fillStyle=i,r.fillRect(n,a,t,t),r.fillRect(n+t,a+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,r,n,a,s,o,l,h,c,u,d){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:f=l.textureColor,textureSize:m=l.textureSize,texturePadding:g=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,r,l,f,m,g)}drawTexture(t,e,i,r,n,a,s,o,l){const{textureRatio:h=a.textureRatio,textureOptions:c=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,s,i);break;case"diamond":u=this.createDiamondPattern(o,l,s,i);break;case"rect":u=this.createRectPattern(o,l,s,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,s,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,s,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,s,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,s,i);break;case"grid":u=this.createGridPattern(o,l,s,i)}if(u)i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,r,n,a),i.fillStyle=u,i.fill(),i.highPerformanceRestore();else if("wave"===t){i.save(),i.setCommonStyle(e,e.attribute,r,n,a),i.clip();const t=e.AABBBounds;drawWave(i,h,t.width(),t.height(),Object.assign(Object.assign({},c||{}),{fill:s}),r+t.x1-r,n+t.y1-n),i.restore()}}}const defaultBaseTextureRenderContribution=new DefaultBaseTextureRenderContribution;class DefaultArcRenderContribution{constructor(){this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,m=p&&!1!==p.visible;if(!f&&!m)return;const{innerPadding:g=l.innerPadding,outerPadding:y=l.outerPadding,startAngle:v=l.startAngle,endAngle:b=l.endAngle,opacity:x=l.opacity,x:C=l.x,y:_=l.y,scaleX:T=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:S=l.keepStrokeScale}=t.attribute;let{innerRadius:P=l.innerRadius,outerRadius:w=l.outerRadius}=t.attribute;w+=y,P-=g;const M=(n,a)=>{const s=!(!n||!n.stroke),{distance:o=l[a].distance}=n,h=S?o:getScaledStroke(e,o,e.dpr),c=o/w,d="outerBorder"===a?1:-1;if(t.setAttributes({outerRadius:w+d*h,innerRadius:P-d*h,startAngle:v-d*c,endAngle:b+d*c}),e.beginPath(),drawArcPath$1(t,e,i,r,w+d*h,P-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[a]);else if(s){const s=l[a].opacity;l[a].opacity=x,e.setStrokeStyle(t,n,(C-i)/T,(_-r)/A,l[a]),l[a].opacity=s,e.stroke()}};f&&M(d,"outerBorder"),m&&M(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:P,startAngle:v,endAngle:b})}}const defaultArcRenderContribution=new DefaultArcRenderContribution,defaultArcTextureRenderContribution=defaultBaseTextureRenderContribution,defaultArcBackgroundRenderContribution=defaultBaseBackgroundRenderContribution;class DefaultCircleRenderContribution{constructor(){this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,m=p&&!1!==p.visible;if(!f&&!m)return;const{radius:g=l.radius,startAngle:y=l.startAngle,endAngle:v=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:C=l.y,scaleX:_=l.scaleX,scaleY:T=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,S=(n,a)=>{const s=!(!n||!n.stroke),{distance:o=l[a].distance}=n,h=A?o:getScaledStroke(e,o,e.dpr),c="outerBorder"===a?1:-1;if(e.beginPath(),e.arc(i,r,g+c*h,y,v),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[a]);else if(s){const s=l[a].opacity;l[a].opacity=b,e.setStrokeStyle(t,n,(x-i)/_,(C-r)/T,l[a]),l[a].opacity=s,e.stroke()}};f&&S(d,"outerBorder"),m&&S(p,"innerBorder")}}const defaultCircleRenderContribution=new DefaultCircleRenderContribution,defaultCircleTextureRenderContribution=defaultBaseTextureRenderContribution,defaultCircleBackgroundRenderContribution=defaultBaseBackgroundRenderContribution;class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution{constructor(){super(...arguments),this.time=exports.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,r,n,a,s,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 r=t.AABBBounds;this.doDrawImage(e,i.data,r,p,f),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}}const defaultGroupBackgroundRenderContribution=new DefaultGroupBackgroundRenderContribution,halfPi=pi/2;function createRectPath(t,e,i,r,n,a,s){let o;if(r<0&&(e+=r,r=-r),n<0&&(i+=n,n=-n),isNumber$1(a,!0))o=[a=abs(a),a,a,a];else if(Array.isArray(a)){const t=a;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=abs(t[0]),o=[e,e,e,e];break;case 2:case 3:e=abs(t[0]),i=abs(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=abs(o[0]),o[1]=abs(o[1]),o[2]=abs(o[2]),o[3]=abs(o[3])}}else o=[0,0,0,0];if(r<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,r,n);const[l,h,c,u]=[[e,i],[e+r,i],[e+r,i+n],[e,i+n]],d=Math.min(r/2,n/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]],m=[l[0],l[1]+p[0]],g=[h[0]-p[1],h[1]],y=[h[0],h[1]+p[1]],v=[c[0]-p[2],c[1]],b=[c[0],c[1]-p[2]],x=[u[0]+p[3],u[1]],C=[u[0],u[1]-p[3]];if(t.moveTo(f[0],f[1]),s&&s[0]?s[0](f[0],f[1],g[0],g[1]):t.lineTo(g[0],g[1]),!arrayEqual(g,y)){s&&s[0]&&t.moveTo(g[0],g[1]);const e=g[0],i=g[1]+p[1];t.arc(e,i,p[1],-halfPi,0,!1)}if(s&&s[1]?s[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!arrayEqual(v,b)){const e=b[0]-p[2],i=b[1];s&&s[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[2],0,halfPi,!1)}if(s&&s[2]?s[2](v[0],v[1],x[0],x[1]):t.lineTo(x[0],x[1]),!arrayEqual(x,C)){const e=x[0],i=x[1]-p[3];s&&s[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,p[3],halfPi,pi,!1)}if(s&&s[3]?s[3](C[0],C[1],m[0],m[1]):t.lineTo(m[0],m[1]),!arrayEqual(f,m)){const e=f[0],i=f[1]+p[0];s&&s[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],pi,pi+halfPi,!1)}return!s&&t.closePath(),t}var __decorate$1B=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};class DefaultRectRenderContribution{constructor(){this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,f=d&&!1!==d.visible,m=p&&!1!==p.visible;if(!f&&!m)return;const{cornerRadius:g=l.cornerRadius,opacity:y=l.opacity,x:v=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:C=l.scaleY,x1:_,y1:T,keepStrokeScale:A=l.keepStrokeScale}=t.attribute;let{width:S,height:P}=t.attribute;S=(null!=S?S:_-i)||0,P=(null!=P?P:T-r)||0;const w=(n,a)=>{const s=!(!n||!n.stroke),o="outerBorder"===a?-1:1,{distance:h=l[a].distance}=n,c=A?h:getScaledStroke(e,h,e.dpr),d=i+o*c,p=r+o*c,f=2*c;if(0===g||isArray$1(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(d,p,S-o*f,P-o*f)):(e.beginPath(),createRectPath(e,d,p,S-o*f,P-o*f,g)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[a]);else if(s){const s=l[a].opacity;l[a].opacity=y,e.setStrokeStyle(t,n,(v-i)/x,(b-r)/C,l[a]),l[a].opacity=s,e.stroke()}};f&&w(d,"outerBorder"),m&&w(p,"innerBorder")}}exports.SplitRectBeforeRenderContribution=class{constructor(){this.time=exports.BaseRenderContributionTime.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}},exports.SplitRectBeforeRenderContribution=__decorate$1B([injectable()],exports.SplitRectBeforeRenderContribution),exports.SplitRectAfterRenderContribution=class{constructor(){this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){const{x1:d,y1:p,x:f=l.x,y:m=l.y,stroke:g=l.stroke,cornerRadius:y=l.cornerRadius}=t.attribute;let{width:v,height:b}=t.attribute;if(v=(null!=v?v:d-f)||0,b=(null!=b?b:p-m)||0,Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,r,l),!(0===y||isArray$1(y)&&y.every((t=>0===t)))){let n,a=0;return createRectPath(e,i,r,v,b,y,new Array(4).fill(0).map(((s,o)=>(s,h,c,u)=>{g[o]&&(a===o-1&&g[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:g[o]}),i,r,l),e.beginPath(),e.moveTo(s,h),n=g[o]),a=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,r),g[0]?e.lineTo(i+v,r):e.moveTo(i+v,r),g[1]?e.lineTo(i+v,r+b):e.moveTo(i+v,r+b),g[2]?e.lineTo(i,r+b):e.moveTo(i,r+b),g[3]){const t=g[0]?r-e.lineWidth/2:r;e.lineTo(i,t)}else e.moveTo(i,r);e.stroke()}}},exports.SplitRectAfterRenderContribution=__decorate$1B([injectable()],exports.SplitRectAfterRenderContribution);const defaultRectRenderContribution=new DefaultRectRenderContribution,defaultRectTextureRenderContribution=defaultBaseTextureRenderContribution,defaultRectBackgroundRenderContribution=defaultBaseBackgroundRenderContribution;class DefaultImageBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution{constructor(){super(...arguments),this.time=exports.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:f=l.backgroundFit,width:m,height:g}=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=getTheme(t.parent).group,{scrollX:r=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(r,n)}const r=t.AABBBounds;this.doDrawImage(e,i.data,r,p,f),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(isObject$1(d)){const{stroke:i,fill:r,lineWidth:n=1,cornerRadius:a=0,expandX:s=0,expandY:o=0}=d;if(!i&&!r)return;e.beginPath();const{x:l,y:h,width:c,height:u}=getActualPosition(t);a?createRectPath(e,l-s,h-o,c+2*s,u+2*o,a):e.rect(l-s,h-o,c+2*s,u+2*o),e.globalAlpha=1,r&&(e.fillStyle=r,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else e.beginPath(),e.rect(i,r,m||0,g||0),e.fillStyle=d,e.globalAlpha=1,e.fill()}}function getActualPosition(t){const e=parsePadding(t.attribute.boundsPadding),i=t.AABBBounds;let r=i.x1,n=i.y1,a=i.width(),s=i.height();return isNumber$1(e)?(r+=e,n+=e,a-=2*e,s-=2*e):(r+=e[3],n+=e[0],a-=e[1]+e[3],s-=e[0]+e[2]),{x:r,y:n,width:a,height:s}}class DefaultImageRenderContribution extends DefaultRectRenderContribution{constructor(){super(...arguments),this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){return super.drawShape(t,e,i,r,n,a,s,o,l,h,c,u)}}const defaultImageRenderContribution=new DefaultImageRenderContribution,defaultImageBackgroundRenderContribution=new DefaultImageBackgroundRenderContribution;class DefaultSymbolRenderContribution{constructor(){this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){const d=t.getParsedPath();if(!d)return;const{outerBorder:p,innerBorder:f}=t.attribute,m=p&&!1!==p.visible,g=f&&!1!==f.visible;if(!m&&!g)return;const{size:y=l.size,opacity:v=l.opacity,x:b=l.x,y:x=l.y,scaleX:C=l.scaleX,scaleY:_=l.scaleY,keepStrokeScale:T=l.keepStrokeScale}=t.attribute,A=(n,a)=>{const s=!(!n||!n.stroke),{distance:o=l[a].distance}=n,h=T?o:getScaledStroke(e,o,e.dpr),c="outerBorder"===a?1:-1;if(e.beginPath(),!1===d.drawOffset(e,y,i,r,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[a]);else if(s){const s=l[a].opacity;l[a].opacity=v,e.setStrokeStyle(t,n,(b-i)/C,(x-r)/_,l[a]),l[a].opacity=s,e.stroke()}};m&&A(p,"outerBorder"),g&&A(f,"innerBorder")}}class DefaultSymbolClipRangeStrokeRenderContribution{constructor(){this.time=exports.BaseRenderContributionTime.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,r,n,a,s,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:f=l.x,y:m=l.y,z:g=l.z,size:y=l.size,scaleX:v=l.scaleX,scaleY:b=l.scaleY}=t.attribute,x=t.getParsedPath();x&&p<1&&p>0&&(e.beginPath(),x.drawWithClipRange&&x.drawWithClipRange(e,y,i,r,p,g,((n,a)=>{var s,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},a);e.fill=null!==(s=a.fill)&&void 0!==s?s:t.attribute.fill,e.opacity=null!==(h=a.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=a.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=a.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,a=e}a.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,a,(f-i)/v,(m-r)/b,l),e.stroke()))})),a&&!x.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(f-i)/v,(m-r)/b,l),e.stroke())))}}const defaultSymbolRenderContribution=new DefaultSymbolRenderContribution,defaultSymbolClipRangeStrokeRenderContribution=new DefaultSymbolClipRangeStrokeRenderContribution,defaultSymbolTextureRenderContribution=defaultBaseTextureRenderContribution,defaultSymbolBackgroundRenderContribution=defaultBaseBackgroundRenderContribution;class DefaultAreaTextureRenderContribution extends DefaultBaseTextureRenderContribution{constructor(){super(...arguments),this.time=exports.BaseRenderContributionTime.afterFillStroke}drawShape(t,e,i,r,n,a,s,o,l,h,c,u,d){var p,f,m,g;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=d||{},{texture:v=(null!==(p=t.attribute.texture)&&void 0!==p?p:getAttributeFromDefaultAttrList(l,"texture")),textureColor:b=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:getAttributeFromDefaultAttrList(l,"textureColor")),textureSize:x=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:getAttributeFromDefaultAttrList(l,"textureSize")),texturePadding:C=(null!==(g=t.attribute.texturePadding)&&void 0!==g?g:getAttributeFromDefaultAttrList(l,"texturePadding"))}=y;v&&this.drawTexture(v,t,e,i,r,l,b,x,C)}}var __decorate$1A=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$Q=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasArcRender=class extends BaseRender{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=ARC_NUMBER_TYPE,this.builtinContributions=[defaultArcRenderContribution,defaultArcBackgroundRenderContribution,defaultArcTextureRenderContribution],this.init(t)}drawArcTailCapPath(t,e,i,r,n,a,s,o){const l=o-s,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(n<a){const t=n;n=a,a=t}const{outerDeltaAngle:f,xors:m,yors:g,xirs:y,yirs:v,limitedOcr:b,outerCornerRadiusStart:x,outerCornerRadiusEnd:C,maxOuterCornerRadius:_,xore:T,yore:A,xire:S,yire:P,limitedIcr:w,innerDeltaAngle:M,innerStartAngle:E,innerCornerRadiusStart:R,innerCornerRadiusEnd:B,maxInnerCornerRadius:k}=calculateArcCornerRadius(t,c,u,a,n);if(b>epsilon){const t=min(x,b),a=min(C,b),s=cornerTangents(y,v,m,g,n,t,Number(d)),o=cornerTangents(T,A,S,P,n,a,Number(d));if(b<_&&t===a)e.moveTo(i+s.cx+s.x01,r+s.cy+s.y01),e.arc(i+s.cx,r+s.cy,b,atan2(s.y01,s.x01),atan2(o.y01,o.x01),!d);else{const t=u-l-.03,s=atan2(o.y11,o.x11);e.arc(i,r,n,t,s,!d),a>0&&e.arc(i+o.cx,r+o.cy,a,atan2(o.y11,o.x11),atan2(o.y01,o.x01),!d)}}else e.moveTo(i+m,r+g);if(!(a>epsilon)||M<.001)e.lineTo(i+S,r+P),p=!0;else if(w>epsilon){const t=min(R,w),n=min(B,w),s=cornerTangents(S,P,T,A,a,-n,Number(d)),o=cornerTangents(m,g,y,v,a,-t,Number(d));if(e.lineTo(i+s.cx+s.x01,r+s.cy+s.y01),w<k&&t===n){const t=atan2(o.y01,o.x01);e.arc(i+s.cx,r+s.cy,w,atan2(s.y01,s.x01),t,!d)}else{n>0&&e.arc(i+s.cx,r+s.cy,n,atan2(s.y01,s.x01),atan2(s.y11,s.x11),!d);const t=atan2(s.cy+s.y11,s.cx+s.x11),o=u-l-.03;e.arc(i,r,a,t,o,d)}}else e.lineTo(i+a*cos(E),r+a*sin(E));return p}drawShape(t,e,i,r,n,a,s,o){const l=getTheme(t,null==a?void 0:a.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,s,o);if(!f)return;const{fVisible:m,sVisible:g,doFill:y,doStroke:v}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:C=l.cap,forceShowCap:_=l.forceShowCap}=t.attribute;let{outerRadius:T=l.outerRadius,innerRadius:A=l.innerRadius}=t.attribute;T+=b,A-=x;let S=0;const P=(isBoolean$1(C)&&C||C[0])&&"conical"===h.gradient;if(P){const{sc:e,startAngle:i,endAngle:r}=t.getParsedAngle();abs(r-i)<pi2-epsilon&&(S=e||0,h.startAngle-=S,h.endAngle-=S)}let w=!1;const{isFullStroke:M,stroke:E}=parseStroke(c);if(y||M){e.beginPath(),drawArcPath$1(t,e,i,r,T,A),w=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,y,v,m,g,l,n,s,o);const a=()=>{y&&(s?s(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-r,l),e.fill()))},h=()=>{v&&M&&(o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,u-i,d-r,l),e.stroke()))};p?(h(),a()):(a(),h())}if(!M&&v&&(e.beginPath(),drawArcPath$1(t,e,i,r,T,A,E),w||this.beforeRenderStep(t,e,i,r,y,v,m,g,l,n,s,o),o?o(e,t.attribute,l):g&&(e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke())),(isBoolean$1(C)&&C||C[1])&&_){const{startAngle:a,endAngle:h}=t.getParsedAngle();if(abs(h-a)>=pi2-epsilon){e.beginPath();const a=Math.abs(T-A)/2/T,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,r,T,A,u,u+a),w||this.beforeRenderStep(t,e,i,r,y,v,m,g,l,n,s,o);const d=()=>{v&&(o||g&&(e.setStrokeStyle(t,t.attribute,i,r,l),e.stroke()))};(()=>{if(y){const n=c;if("conical"===n.gradient){const a=getConicGradientAt(0,0,h,n);s||fillVisible&&(e.setCommonStyle(t,t.attribute,i,r,l),e.fillStyle=a,e.fill())}}})(),d()}}this.afterRenderStep(t,e,i,r,y,v,m,g,l,n,s,o),P&&(h.startAngle+=S,h.endAngle+=S)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).arc;this._draw(t,n,!1,i,r)}},exports.DefaultCanvasArcRender=__decorate$1A([injectable(),__param$Q(0,inject(ContributionProvider)),__param$Q(0,named(ArcRenderContribution)),__metadata$1c("design:paramtypes",[Object])],exports.DefaultCanvasArcRender);var __decorate$1z=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$P=function(t,e){return function(i,r){e(i,r,t)}};function drawSegItem(t,e,i,r){if(!e.p1)return;const{offsetX:n=0,offsetY:a=0,offsetZ:s=0}=r||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,a+e.p1.y,n+e.p2.x,a+e.p2.y,n+e.p3.x,a+e.p3.y,s):t.lineTo(n+e.p1.x,a+e.p1.y,s);else if(e.p2&&e.p3){const[r]=divideCubic(e,i);t.bezierCurveTo(n+r.p1.x,a+r.p1.y,n+r.p2.x,a+r.p2.y,n+r.p3.x,a+r.p3.y,s)}else{const r=e.getPointAt(i);t.lineTo(n+r.x,a+r.y,s)}}function drawEachCurve(t,e,i,r,n,a,s){var o;let l=e.p0,h=r;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)r||(t.lineTo(l.x+n,l.y+a,s),h=!r);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),r){h=!r;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+n,o+a,s)}else d&&(h=!r,t.lineTo(d.x+n,d.y+a,s))}return h}function drawSegments(t,e,i,r,n){const{offsetX:a=0,offsetY:s=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((r,n)=>{r.originP1!==r.originP2?(i=drawEachCurve(t,r,e,i,a,s,o),e=r):e=r}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+a,e.p0.y+s,o),drawSegItem(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===r?d=exports.Direction.ROW:"y"===r?d=exports.Direction.COLUMN:"auto"===r&&(d=e.direction);const p=i*e.tryUpdateLength(d);let f=0,m=!0,g=null;for(let e=0,i=u.length;e<i;e++){const i=u[e],r=i.getLength(d),l=(p-f)/r;if(f+=r,l<0)break;if(h){if(i.originP1===i.originP2){g=i;continue}m=drawEachCurve(t,i,g,m,a,s,o),g=i}else{if(!i.defined){c=!0;continue}c&&t.moveTo(i.p0.x+a,i.p0.y+s,o),drawSegItem(t,i,min(l,1),n),c=!1}}}function drawIncrementalSegments(t,e,i,r){const{offsetX:n=0,offsetY:a=0}=r||{},s=e?e.points[e.points.length-1]:i.points[0];t.moveTo(s.x+n,s.y+a),i.points.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+a):t.moveTo(e.x+n,e.y+a)}))}function drawIncrementalAreaSegments(t,e,i,r){const{offsetX:n=0,offsetY:a=0}=r||{},{points:s}=i,o=[];for(let t=0;t<s.length;t++)s[t].defined;o.push(s),o.forEach(((i,r)=>{var s,o,l,h;const c=e&&0===r?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+a),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+a):t.moveTo(e.x+n,e.y+a)}));for(let e=i.length-1;e>=0;e--){const r=i[e];t.lineTo(null!==(s=r.x1)&&void 0!==s?s:r.x,null!==(o=r.y1)&&void 0!==o?o:r.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()}))}exports.DefaultCanvasCircleRender=class extends BaseRender{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=CIRCLE_NUMBER_TYPE,this.builtinContributions=[defaultCircleRenderContribution,defaultCircleBackgroundRenderContribution,defaultCircleTextureRenderContribution],this.init(t)}drawShape(t,e,i,r,n,a,s,o){const l=getTheme(t,null==a?void 0:a.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,m=this.valid(t,l,s,o);if(!m)return;const{fVisible:g,sVisible:y,doFill:v,doStroke:b}=m;e.beginPath(),e.arc(i,r,h,c,u),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,v,b,g,y,l,n,s,o);const x=()=>{v&&(s?s(e,t.attribute,l):g&&(e.setCommonStyle(t,t.attribute,d-i,p-r,l),e.fill()))},C=()=>{b&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-r,l),e.stroke()))};f?(C(),x()):(x(),C()),this.afterRenderStep(t,e,i,r,v,b,g,y,l,n,s,o)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).circle;this._draw(t,n,!1,i,r)}},exports.DefaultCanvasCircleRender=__decorate$1z([injectable(),__param$P(0,inject(ContributionProvider)),__param$P(0,named(CircleRenderContribution)),__metadata$1b("design:paramtypes",[Object])],exports.DefaultCanvasCircleRender);var __decorate$1y=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};function drawAreaSegments(t,e,i,r){var n;const{drawConnect:a=!1,mode:s="none"}=r||{};if(a&&"none"===s)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(a){let n,a,s=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const u=l.curves[h-c-1];let d=o,p=u;if(o.originP1===o.originP2)return n=o,void(a=u);if(n&&n.originP1===n.originP2&&(d=n,p=a),o.defined)s||(e.push(d),i.push(p),drawAreaConnectBlock(t,e,i,r),e.length=0,i.length=0,s=!s);else{const{originP1:n,originP2:a}=o;let l,h;n&&!1!==n.defined?(l=d,h=p):n&&!1!==a.defined&&(l=o,h=u),s?(s=!s,e.push(l||o),i.push(h||u)):l&&(s=!s,e.push(l||o),i.push(h||u),drawAreaConnectBlock(t,e,i,r),e.length=0,i.length=0)}n=o})),drawAreaConnectBlock(t,e,i,r)}else{for(let a=0,s=o.curves.length;a<s;a++){const h=o.curves[a];n!==h.defined?(n?(drawAreaBlock(t,e,i,r),e.length=0,i.length=0):(e.push(h),i.push(l.curves[s-a-1])),n=!n):n&&(e.push(h),i.push(l.curves[s-a-1]))}drawAreaBlock(t,e,i,r)}return}if(i<=0)return;let{direction:h}=r||{};const{curves:c}=o,u=null!==(n=c[c.length-1].p3)&&void 0!==n?n:c[c.length-1].p1,d=abs(u.x-c[0].p0.x),p=abs(u.y-c[0].p0.y);h=null!=h?h:d>p?exports.Direction.ROW:exports.Direction.COLUMN,Number.isFinite(d)||(h=exports.Direction.COLUMN),Number.isFinite(p)||(h=exports.Direction.ROW);const f=i*(h===exports.Direction.ROW?d:p);let m=0,g=!0;const y=[],v=[];let b,x,C=!0;for(let e=0,i=o.curves.length;e<i;e++){const n=o.curves[e],s=n.getLength(h),c=(f-m)/s;if(c<0)break;if(m+=s,a){const a=l.curves[i-e-1];let s=n,o=a;if(n.originP1===n.originP2){b=n,x=a;continue}if(b&&b.originP1===b.originP2&&(s=b,o=x),n.defined)C||(y.push(s),v.push(o),drawAreaConnectBlock(t,y,v,r),y.length=0,v.length=0,C=!C);else{const{originP1:e,originP2:i}=n;let l,h;e&&!1!==e.defined?(l=s,h=o):e&&!1!==i.defined&&(l=n,h=a),C?(C=!C,y.push(l||n),v.push(h||a)):l&&(C=!C,y.push(l||n),v.push(h||a),drawAreaConnectBlock(t,y,v,r),y.length=0,v.length=0)}b=n}else{let a=null,s=null;g!==n.defined?(g?(drawAreaBlock(t,y,v,r),y.length=0,v.length=0):(a=n,s=l.curves[i-e-1]),g=!g):g&&(a=n,s=l.curves[i-e-1]),a&&s&&(c<1&&(a=a.p2&&a.p3?divideCubic(a,c)[0]:divideLinear(a,c)[0],s=s.p2&&s.p3?divideCubic(s,1-c)[1]:divideLinear(s,1-c)[1]),a.defined=g,s.defined=g,y.push(a),v.push(s)),a=null,s=null}}a?drawAreaConnectBlock(t,y,v,r):drawAreaBlock(t,y,v,r)}function drawAreaConnectBlock(t,e,i,r){if(e.length<2)return;const{offsetX:n=0,offsetY:a=0,offsetZ:s=0,mode:o}=r||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+a,s),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+a,s),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+a,s),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+a,s),t.closePath()}function drawAreaBlock(t,e,i,r){const{offsetX:n=0,offsetY:a=0,offsetZ:s=0}=r||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+a,s),drawSegItem(t,e,1,r),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+n,l.p0.y+a,s),drawSegItem(t,l,1,r),o=!1):o=!0}t.closePath()}exports.DefaultCanvasLineRender=class extends BaseRender{constructor(){super(...arguments),this.numberType=LINE_NUMBER_TYPE}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).line;this._draw(t,n,!1,i,r)}drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f){var m,g,y,v,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;drawSegments(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u,offsetZ:x}),d.cache&&!isArray$1(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,s,o);const{x:C=0,x:_=0}=s;!1!==i&&(p?p(t,s,o):n&&(t.setCommonStyle(d,s,C-c,_-u,o),t.fill())),!1!==r&&(f?f(t,s,o):a&&(t.setStrokeStyle(d,s,C-c,_-u,o),t.stroke()));let{connectedType:T,connectedX:A,connectedY:S,connectedStyle:P}=s;if(isArray$1(o)?(T=null!==(g=null!=T?T:o[0].connectedType)&&void 0!==g?g:o[1].connectedType,A=null!==(y=null!=A?A:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,S=null!==(v=null!=S?S:o[0].connectedY)&&void 0!==v?v:o[1].connectedY,P=null!==(b=null!=P?P:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(T=null!=T?T:o.connectedType,A=null!=A?A:o.connectedX,S=null!=S?S:o.connectedY,P=null!=P?P:o.connectedStyle),"connect"!==T&&"zero"!==T&&(T="none"),"none"!==T){t.beginPath(),drawSegments(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u,offsetZ:x,drawConnect:!0,mode:T,zeroX:A,zeroY:S});const m=[];isArray$1(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(s),!1!==i&&(p?p(t,s,o):n&&(t.setCommonStyle(d,P,C-c,_-u,m),t.fill())),!1!==r&&(f?f(t,s,o):a&&(t.setStrokeStyle(d,P,C-c,_-u,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,r,n,a,s,o,l,h,c,u,d){var p;e.beginPath();const f=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,g=m[0];e.moveTo(g.x+s,g.y+o,f);for(let t=1;t<m.length;t++){const i=m[t];e.lineTo(i.x+s,i.y+o,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const{x:y=0,x:v=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,y-s,v-o,l),e.fill())),!1!==r&&(d?d(e,t.attribute,l):a&&(e.setStrokeStyle(t,t.attribute,y-s,v-o,l),e.stroke()))}drawShape(t,e,i,r,n,a,s,o){const l=getTheme(t,null==a?void 0:a.theme).line,{fill:h=l.fill,stroke:c=l.stroke,fillOpacity:u=l.fillOpacity,strokeOpacity:d=l.strokeOpacity,segments:p,points:f,closePath:m,curveTension:g=l.curveTension}=t.attribute;if(!this.valid(t,l,s,o))return;let{curveType:y=l.curveType}=t.attribute;m&&"linear"===y&&(y="linearClosed");const{clipRange:v=l.clipRange,clipRangeByDimension:b=l.clipRangeByDimension}=t.attribute;if(1===v&&!p&&!f.some((t=>!1===t.defined))&&"linear"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,r,l,n,a,s,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,r=e;if(i&&i.length){let e,r;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(r={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:r.endX,y:r.endY,defined:r.curves[r.curves.length-1].defined}:i>1&&(e.x=r.endX,e.y=r.endY,e.defined=r.curves[r.curves.length-1].defined);const n=calcLineCache(t.points,y,{startPoint:e,curveTension:g});return r=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;i<t.cache.length;i++){const r=t.cache[i];for(let t=0;t<r.curves.length;t++)if(r.curves[t].defined){e=r.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=calcLineCache(r,y,{curveTension:g})}t.clearUpdateShapeTag()}if(Array.isArray(t.cache)){const n=t.attribute.segments.filter((t=>t.points.length));if(1===n[0].points.length&&n.shift(),1===v){let a=!1;t.cache.forEach(((p,f)=>{a||(a=this.drawSegmentItem(e,p,!!h,!!c,u,d,n[f],[l,t.attribute],v,b,i,r,t,s,o))}))}else{const a=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=v*a;let f=0,m=!1;t.cache.forEach(((a,g)=>{if(m)return;const y=a.getLength(),v=(p-f)/y;f+=y,v>0&&(m=this.drawSegmentItem(e,a,!!h,!!c,u,d,n[g],[l,t.attribute],min(v,1),b,i,r,t,s,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,v,b,i,r,t,s,o)}},exports.DefaultCanvasLineRender=__decorate$1y([injectable()],exports.DefaultCanvasLineRender);const defaultAreaTextureRenderContribution=new DefaultAreaTextureRenderContribution,defaultAreaBackgroundRenderContribution=defaultBaseBackgroundRenderContribution;var __decorate$1x=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1a=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$O=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasAreaRender=class extends BaseRender{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=AREA_NUMBER_TYPE,this.builtinContributions=[defaultAreaTextureRenderContribution,defaultAreaBackgroundRenderContribution],this.init(t)}drawLinearAreaHighPerformance(t,e,i,r,n,a,s,o,l,h,c,u,d){var p,f,m;const{points:g}=t.attribute;if(g.length<2)return;e.beginPath();const y=null!==(p=this.z)&&void 0!==p?p:0,v=g[0];e.moveTo(v.x+s,v.y+o,y);for(let t=1;t<g.length;t++){const i=g[t];e.lineTo(i.x+s,i.y+o,y)}for(let t=g.length-1;t>=0;t--){const i=g[t];e.lineTo((null!==(f=i.x1)&&void 0!==f?f:i.x)+s,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,y)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,s,o,!!n,!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):n&&(e.setCommonStyle(t,t.attribute,b-s,x-o,l),e.fill())),this.afterRenderStep(t,e,s,o,!!n,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,n;if(r){const{stroke:r=l&&l.stroke}=t.attribute;if(isArray$1(r)&&(r[0]||r[2])&&!1===r[1])if(e.beginPath(),r[0]){e.moveTo(v.x+s,v.y+o,y);for(let t=1;t<g.length;t++){const i=g[t];e.lineTo(i.x+s,i.y+o,y)}}else if(r[2]){const t=g[g.length-1];e.moveTo(t.x+s,t.y+o,y);for(let t=g.length-2;t>=0;t--){const r=g[t];e.lineTo((null!==(i=r.x1)&&void 0!==i?i:r.x)+s,(null!==(n=r.y1)&&void 0!==n?n:r.y)+o,y)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-s,x-o,l),e.stroke())}})()}drawShape(t,e,i,r,n,a,s,o){var l,h,c,u,d,p;const f=getTheme(t,null==a?void 0:a.theme).area,{fill:m=f.fill,stroke:g=f.stroke,fillOpacity:y=f.fillOpacity,z:v=f.z,strokeOpacity:b=f.strokeOpacity,curveTension:x=f.curveTension}=t.attribute,C=this.valid(t,f,s,o);if(!C)return;const{doFill:_}=C,T=C.doStroke&&C.sVisible,{clipRange:A=f.clipRange,closePath:S,points:P,segments:w}=t.attribute;let{curveType:M=f.curveType}=t.attribute;if(S&&"linear"===M&&(M="linearClosed"),1===A&&!w&&!P.some((t=>!1===t.defined))&&"linear"===M)return this.drawLinearAreaHighPerformance(t,e,!!m,T,y,b,i,r,f,n,a,s,o);if(t.shouldUpdateShape()){if(w&&w.length){let e,i;const r=w.map(((t,r)=>{if(t.points.length<=1&&0===r)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===r?e={x:i.endX,y:i.endY}:r>1&&(e.x=i.endX,e.y=i.endY);const n=calcLineCache(t.points,M,{startPoint:e,curveTension:x});return i=n,n})).filter((t=>!!t));let n;const a=[];for(let t=w.length-1;t>=0;t--){const e=w[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=w[t-1].points,r=e[e.length-1];r&&i.push({x:null!==(c=r.x1)&&void 0!==c?c:r.x,y:null!==(u=r.y1)&&void 0!==u?u:r.y})}i.length>1&&(n=calcLineCache(i,"stepBefore"===M?"stepAfter":"stepAfter"===M?"stepBefore":M,{curveTension:x}),a.unshift(n))}t.cacheArea=a.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!P||!P.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=P,i=[];for(let t=P.length-1;t>=0;t--)i.push({x:null!==(d=P[t].x1)&&void 0!==d?d:P[t].x,y:null!==(p=P[t].y1)&&void 0!==p?p:P[t].y});const r=calcLineCache(e,M,{curveTension:x}),n=calcLineCache(i,"stepBefore"===M?"stepAfter":"stepAfter"===M?"stepBefore":M,{curveTension:x});t.cacheArea={top:r,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const a=t.attribute.segments.filter((t=>t.points.length));if(1===a[0].points.length&&a.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,_,y,T,b,a[c],[f,t.attribute],A,i,r,v,t,n,s,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(u=this.drawSegmentItem(e,l,_,y,T,b,a[d],[f,t.attribute],min(m,1),i,r,v,t,n,s,o))}))}}else this.drawSegmentItem(e,t.cacheArea,_,y,T,b,t.attribute,f,A,i,r,v,t,n,s,o)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).area;this._draw(t,n,!1,i,r)}drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f,m){let g=!1;return g=g||this._drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,!1,f,m),g=g||this._drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,!0,f,m),g}_drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f,m,g){var y,v,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:C,connectedX:_,connectedY:T,connectedStyle:A}=s;const S=[];if(f&&(isArray$1(o)?(C=null!==(y=null!=C?C:o[0].connectedType)&&void 0!==y?y:o[1].connectedType,_=null!==(v=null!=_?_:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(b=null!=T?T:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,A=null!==(x=null!=A?A:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(C=null!=C?C:o.connectedType,_=null!=_?_:o.connectedX,T=null!=T?T:o.connectedY,A=null!=A?A:o.connectedStyle),"connect"!==C&&"zero"!==C&&(C="none"),isArray$1(o)?o.forEach((t=>S.push(t))):S.push(o),S.push(s)),f&&"none"===C)return!1;t.beginPath();const{points:P,segments:w}=d.attribute;let M,E,R=exports.Direction.ROW;if(w){const t=w[w.length-1];E=w[0].points[0],M=t.points[t.points.length-1]}else E=P[0],M=P[P.length-1];const B=abs(M.x-E.x),k=abs(M.y-E.y);R=null==M.x1?exports.Direction.ROW:null==M.y1?exports.Direction.COLUMN:Number.isFinite(B+k)?B>k?exports.Direction.ROW:exports.Direction.COLUMN:exports.Direction.ROW,drawAreaSegments(t.camera?t:t.nativeContext,e,l,{offsetX:h,offsetY:c,offsetZ:u,direction:R,drawConnect:f,mode:C,zeroX:_,zeroY:T}),this.beforeRenderStep(d,t,h,c,!!r,!1,i,!1,o,p,m,null,{attribute:s}),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,s,o);const{x:D=0,x:I=0}=s;return!1!==i&&(m?m(t,s,o):r&&(t.setCommonStyle(d,f?A:s,D-h,I-c,f?S:o),t.fill())),this.afterRenderStep(d,t,h,c,!!r,!1,i,!1,o,p,m,null,{attribute:s}),(()=>{if(!1!==n)if(g)g(t,s,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=s;isArray$1(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),drawSegments(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===exports.Direction.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u,drawConnect:f,mode:C,zeroX:_,zeroY:T})),t.setStrokeStyle(d,f?A:s,D-h,I-c,f?S:o),t.stroke()}})(),!1}},exports.DefaultCanvasAreaRender=__decorate$1x([injectable(),__param$O(0,inject(ContributionProvider)),__param$O(0,named(AreaRenderContribution)),__metadata$1a("design:paramtypes",[Object])],exports.DefaultCanvasAreaRender);const defaultPathTextureRenderContribution=defaultBaseTextureRenderContribution,defaultPathBackgroundRenderContribution=defaultBaseBackgroundRenderContribution;var __decorate$1w=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$19=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$N=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasPathRender=class extends BaseRender{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=PATH_NUMBER_TYPE,this.builtinContributions=[defaultPathBackgroundRenderContribution,defaultPathTextureRenderContribution],this.init(t)}drawShape(t,e,i,r,n,a,s,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:getTheme(t,null==a?void 0:a.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:f=u.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,g=this.valid(t,u,s,o);if(!g)return;const{fVisible:y,sVisible:v,doFill:b,doStroke:x}=g;if(e.beginPath(),t.pathShape)renderCommandList(t.pathShape.commandList,e,i,r,1,1,m);else{renderCommandList((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,r,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,r,b,x,y,v,u,n,s,o);const C=()=>{x&&(o?o(e,t.attribute,u):v&&(e.setStrokeStyle(t,t.attribute,d-i,p-r,u),e.stroke()))},_=()=>{b&&(s?s(e,t.attribute,u):y&&(e.setCommonStyle(t,t.attribute,d-i,p-r,u),e.fill()))};f?(C(),_()):(_(),C()),this.afterRenderStep(t,e,i,r,b,x,y,v,u,n,s,o)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,r),this.tempTheme=null}},exports.DefaultCanvasPathRender=__decorate$1w([injectable(),__param$N(0,inject(ContributionProvider)),__param$N(0,named(PathRenderContribution)),__metadata$19("design:paramtypes",[Object])],exports.DefaultCanvasPathRender);var __decorate$1v=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$18=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$M=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasRectRender=class extends BaseRender{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=RECT_NUMBER_TYPE,this.builtinContributions=[defaultRectRenderContribution,defaultRectBackgroundRenderContribution,defaultRectTextureRenderContribution],this.init(t)}drawShape(t,e,i,r,n,a,s,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:getTheme(t,null==a?void 0:a.theme).rect,{fill:c=h.fill,background:u,stroke:d=h.stroke,cornerRadius:p=h.cornerRadius,opacity:f=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:v=h.visible,x1:b,y1:x,x:C=h.x,y:_=h.y,fillStrokeOrder:T=h.fillStrokeOrder}=t.attribute;let{width:A,height:S}=t.attribute;A=(null!=A?A:b-C)||0,S=(null!=S?S:x-_)||0;const P=rectFillVisible(f,m,A,S,c),w=rectStrokeVisible(f,y,A,S),M=runFill(c,u),E=runStroke(d,g);if(!t.valid||!v)return;if(!M&&!E)return;if(!(P||w||s||o||u))return;0===p||isArray$1(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,r,A,S)):(e.beginPath(),createRectPath(e,i,r,A,S,p));const R={doFill:M,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,r,M,E,P,w,h,n,s,o,R);const B=()=>{R.doFill&&(s?s(e,t.attribute,h):P&&(e.setCommonStyle(t,t.attribute,C-i,_-r,h),e.fill()))},k=()=>{R.doStroke&&(o?o(e,t.attribute,h):w&&(e.setStrokeStyle(t,t.attribute,C-i,_-r,h),e.stroke()))};T?(k(),B()):(B(),k()),this.afterRenderStep(t,e,i,r,M,E,P,w,h,n,s,o)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,r),this.tempTheme=null}},exports.DefaultCanvasRectRender=__decorate$1v([injectable(),__param$M(0,inject(ContributionProvider)),__param$M(0,named(RectRenderContribution)),__metadata$18("design:paramtypes",[Object])],exports.DefaultCanvasRectRender);var __decorate$1u=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$17=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$L=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasSymbolRender=class extends BaseRender{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=SYMBOL_NUMBER_TYPE,this.builtinContributions=[defaultSymbolRenderContribution,defaultSymbolBackgroundRenderContribution,defaultSymbolTextureRenderContribution,defaultSymbolClipRangeStrokeRenderContribution],this.init(t)}drawShape(t,e,i,r,n,a,s,o){var l;const h=getTheme(t,null==a?void 0:a.theme).symbol,{size:c=h.size,x:u=h.x,y:d=h.y,scaleX:p=h.scaleX,scaleY:f=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder,clipRange:g=h.clipRange}=t.attribute,y=this.valid(t,h,s,o);if(!y)return;const{fVisible:v,sVisible:b,doFill:x,doStroke:C}=y,_=t.getParsedPath();if(!_)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const S=e.camera;if(T&&S&&e.project){const t=e.project(i,r,A);e.camera=null,isArray$1(c)&&(c[0],c[1]),t.x,t.y}!1===_.draw(e,c,i,r,A,((n,a)=>{var l,c,y,v;if(t._parsedPath.svgCache){const e=Object.assign({},a);e.fill=null!==(l=a.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=a.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(y=a.stroke)&&void 0!==y?y:t.attribute.stroke,e.lineWidth=null!==(v=a.lineWidth)&&void 0!==v?v:t.attribute.lineWidth,a=e}const x=()=>{a.fill&&(s?s(e,t.attribute,h):(e.setCommonStyle(t,a,u-i,d-r,h),e.fill()))},C=()=>{a.stroke&&(o?o(e,t.attribute,h):b&&g>=1&&(e.setStrokeStyle(t,a,(u-i)/p,(d-r)/f,h),e.stroke()))};m?(C(),x()):(x(),C())}))&&e.closePath(),T&&e.camera&&e.project&&(e.camera=S),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,r,x,C,v,b,h,n,s,o);const P=()=>{x&&!_.isSvg&&(s?s(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,u-i,d-r,h),e.fill()))},w=()=>{C&&!_.isSvg&&(o?o(e,t.attribute,h):b&&g>=1&&(e.setStrokeStyle(t,t.attribute,(u-i)/p,(d-r)/f,h),e.stroke()))};m?(w(),P()):(P(),w()),this.afterRenderStep(t,e,i,r,x,C,v,b,h,n,s,o)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).symbol;this._draw(t,n,!1,i,r)}},exports.DefaultCanvasSymbolRender=__decorate$1u([injectable(),__param$L(0,inject(ContributionProvider)),__param$L(0,named(SymbolRenderContribution)),__metadata$17("design:paramtypes",[Object])],exports.DefaultCanvasSymbolRender);class DefaultBoundsAllocate{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new AABBBounds)}allocate(t,e,i,r){if(!this.pools.length)return(new AABBBounds).setValue(t,e,i,r);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=r,n}allocateByObj(t){if(!this.pools.length)return new AABBBounds(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 boundsAllocate=new DefaultBoundsAllocate;class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution{constructor(){super(...arguments),this.time=exports.BaseRenderContributionTime.beforeFillStroke}drawShape(t,e,i,r,n,a,s,o,l,h,c,u){var d,p,f,m,g,y,v,b,x,C;const{backgroundMode:_=l.backgroundMode,backgroundFit:T=l.backgroundFit}=t.attribute;let A,{background:S}=t.attribute;if(!S)return;const P=()=>{"richtext"===t.type&&(e.restore(),e.save(),A&&e.setTransformFromMatrix(A,!0,1))};let w;"richtext"===t.type&&(A=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const M=isObject$1(S)&&S.background,E=t.transMatrix.onlyTranslate();if(M){const e=t.AABBBounds,i=(null!==(d=S.x)&&void 0!==d?d:e.x1)+(null!==(p=S.dx)&&void 0!==p?p:0),r=(null!==(f=S.y)&&void 0!==f?f:e.y1)+(null!==(m=S.dy)&&void 0!==m?m:0),n=null!==(g=S.width)&&void 0!==g?g:e.width(),a=null!==(y=S.height)&&void 0!==y?y:e.height();if(w=boundsAllocate.allocate(i,r,i+n,r+a),S=S.background,!E){const t=w.width(),e=w.height();w.set((null!==(v=S.x)&&void 0!==v?v:0)+(null!==(b=S.dx)&&void 0!==b?b:0),(null!==(x=S.y)&&void 0!==x?x:0)+(null!==(C=S.dy)&&void 0!==C?C:0),t,e)}}else w=t.AABBBounds,E||(w=getTextBounds(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 n=t.resources.get(S);if("success"!==n.state||!n.data)return void P();e.highPerformanceSave(),E&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,r,l),this.doDrawImage(e,n.data,w,_,T),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,r,l),e.fillStyle=S,n?(createRectPath(e,w.x1,w.y1,w.width(),w.height(),n),e.fill()):e.fillRect(w.x1,w.y1,w.width(),w.height()),e.highPerformanceRestore()}M&&boundsAllocate.free(w),P()}}const defaultTextBackgroundRenderContribution=new DefaultTextBackgroundRenderContribution;var __decorate$1t=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$16=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$K=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasTextRender=class extends BaseRender{constructor(t){super(),this.textRenderContribitions=t,this.numberType=TEXT_NUMBER_TYPE,this.builtinContributions=[defaultTextBackgroundRenderContribution],this.init(t)}drawShape(t,e,i,r,n,a,s,o){var l,h,c;const u=getTheme(t,null==a?void 0:a.theme).text,{text:d,underline:p=u.underline,lineThrough:f=u.lineThrough,keepDirIn3d:m=u.keepDirIn3d,direction:g=u.direction,fontSize:y=u.fontSize,verticalMode:v=u.verticalMode,x:b=u.x,y:x=u.y}=t.attribute,C=null!==(l=calculateLineHeight(t.attribute.lineHeight,y))&&void 0!==l?l:y,_=this.valid(t,u,s,o);if(!_)return;const{fVisible:T,sVisible:A,doFill:S,doStroke:P}=_,w=!m,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,r,S,P,T,A,u,n,s,o),w&&this.transformUseContext2d(t,u,M,e);const E=(n,a,l,h)=>{let c=i+a;const d=r+l;if(h){e.highPerformanceSave(),c+=y;const t=matrixAllocate.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),matrixAllocate.free(t)}P&&(o?o(e,t.attribute,u):A&&(e.setStrokeStyle(t,t.attribute,b-i,x-r,u),e.strokeText(n,c,d,M))),S&&(s?s(e,t.attribute,u):T&&(e.setCommonStyle(t,t.attribute,b-i,x-r,u),e.fillText(n,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===g){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:a,yOffset:l}=n.bbox;P&&(o?o(e,t.attribute,u):A&&(e.setStrokeStyle(t,t.attribute,b-i,x-r,u),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+a+i,(t.topOffset||0)+l+r,M)})))),S&&(s?s(e,t.attribute,u):T&&(e.setCommonStyle(t,t.attribute,b-i,x-r,u),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+a+i,(n.topOffset||0)+l+r,M),this.drawUnderLine(p,f,t,(n.leftOffset||0)+a+i,(n.topOffset||0)+l+r,n.descent,(n.descent-n.ascent)/2,M,u,e,{width:n.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:r=u.textBaseline}=t.attribute;if(!v){const e=i;i=null!==(h=t.getBaselineMapAlign()[r])&&void 0!==h?h:"left",r=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:a}=n;e.textAlign="left",e.textBaseline="top";const s=C*a.length;let o=0;a.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=max(e,o)}));let l=0,d=0;"bottom"===r?d=-s:"middle"===r&&(d=-s/2),"center"===i?l-=o/2:"right"===i&&(l-=o),a.forEach(((t,e)=>{const r=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-r;let a=l;"center"===i?a+=n/2:"right"===i&&(a+=n),t.forEach((t=>{const{text:i,width:r,direction:n}=t;E(i,s-(e+1)*C+d,a,n),a+=r}))}))}w&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,r,S,P,T,A,u,n,s,o)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).text,{keepDirIn3d:a=n.keepDirIn3d}=t.attribute,s=!a;this._draw(t,n,s,i,r)}drawUnderLine(t,e,i,r,n,a,s,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:m=l.underlineDash,fillOpacity:g=l.fillOpacity}=i.attribute,y=!isNil$1(c),v=y?c.width:i.clipedWidth,b=y?0:textDrawOffsetX(u,v),x={lineWidth:0,stroke:d,opacity:p,strokeOpacity:g};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,r,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+a+f;h.moveTo(r+b,e,o),h.lineTo(r+b+v,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,r,n,l),h.beginPath();const t=n+s;h.moveTo(r+b,t,o),h.lineTo(r+b+v,t,o),h.stroke()}}},exports.DefaultCanvasTextRender=__decorate$1t([injectable(),__param$K(0,inject(ContributionProvider)),__param$K(0,named(TextRenderContribution)),__metadata$16("design:paramtypes",[Object])],exports.DefaultCanvasTextRender);var __decorate$1s=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};function drawPolygon(t,e,i,r){t.moveTo(e[0].x+i,e[0].y+r);for(let n=1;n<e.length;n++)t.lineTo(e[n].x+i,e[n].y+r)}function drawRoundedPolygon(t,e,i,r,n){let a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var s;if(e.length<3)return void drawPolygon(t,e,i,r);let o=0,l=e.length-1;a||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+r));for(let a=o;a<=l;a++){const o=e[0===a?l:(a-1)%e.length],h=e[a%e.length],c=e[(a+1)%e.length],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,f=h.y-c.y,m=(Math.atan2(d,u)-Math.atan2(f,p))/2,g=Math.abs(Math.tan(m));let y=Array.isArray(n)?null!==(s=n[a%e.length])&&void 0!==s?s:0:n,v=y/g;const b=getLength(u,d),x=getLength(p,f),C=Math.min(b,x);v>C&&(v=C,y=C*g);const _=getProportionPoint(h,v,b,u,d),T=getProportionPoint(h,v,x,p,f),A=2*h.x-_.x-T.x,S=2*h.y-_.y-T.y,P=getLength(A,S),w=getProportionPoint(h,getLength(v,y),P,A,S);let M=Math.atan2(_.y-w.y,_.x-w.x);const E=Math.atan2(T.y-w.y,T.x-w.x);let R=E-M;R<0&&(M=E,R=-R),R>Math.PI&&(R-=Math.PI),0===a?t.moveTo(_.x+i,_.y+r):t.lineTo(_.x+i,_.y+r),R&&t.arcTo(h.x+i,h.y+r,T.x+i,T.y+r,y),t.lineTo(T.x+i,T.y+r)}a||t.lineTo(e[l+1].x+i,e[l+1].y+r)}function getLength(t,e){return Math.sqrt(t*t+e*e)}function getProportionPoint(t,e,i,r,n){const a=e/i;return{x:t.x-r*a,y:t.y-n*a}}exports.AbstractGraphicRender=class{},exports.AbstractGraphicRender=__decorate$1s([injectable()],exports.AbstractGraphicRender);const defaultPolygonTextureRenderContribution=defaultBaseTextureRenderContribution,defaultPolygonBackgroundRenderContribution=defaultBaseBackgroundRenderContribution;var __decorate$1r=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$15=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$J=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasPolygonRender=class extends BaseRender{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=POLYGON_NUMBER_TYPE,this.builtinContributions=[defaultPolygonBackgroundRenderContribution,defaultPolygonTextureRenderContribution],this.init(t)}drawShape(t,e,i,r,n,a,s,o){const l=getTheme(t,null==a?void 0:a.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,m=this.valid(t,l,s,o);if(!m)return;const{fVisible:g,sVisible:y,doFill:v,doStroke:b}=m;e.beginPath(),c<=0||isArray$1(c)&&c.every((t=>0===t))?drawPolygon(e.camera?e:e.nativeContext,h,i,r):drawRoundedPolygon(e.camera?e:e.nativeContext,h,i,r,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,v,b,g,y,l,n,s,o);const x=()=>{v&&(s?s(e,t.attribute,l):g&&(e.setCommonStyle(t,t.attribute,u-i,d-r,l),e.fill()))},C=()=>{b&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,u-i,d-r,l),e.stroke()))};f?(C(),x()):(x(),C()),this.afterRenderStep(t,e,i,r,v,b,g,y,l,n,s,o)}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).polygon;this._draw(t,n,!1,i,r)}},exports.DefaultCanvasPolygonRender=__decorate$1r([injectable(),__param$J(0,inject(ContributionProvider)),__param$J(0,named(PolygonRenderContribution)),__metadata$15("design:paramtypes",[Object])],exports.DefaultCanvasPolygonRender);var __decorate$1q=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$14=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$I=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultCanvasGroupRender=class{constructor(t){this.groupRenderContribitions=t,this.numberType=GROUP_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s,o){const l=getTheme(t,null==a?void 0:a.theme).group,{fill:h=l.fill,background:c,stroke:u=l.stroke,opacity:d=l.opacity,width:p=l.width,height:f=l.height,clip:m=l.clip,fillOpacity:g=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:C=l.visible,fillStrokeOrder:_=l.fillStrokeOrder,x:T=l.x,y:A=l.y}=t.attribute,S=rectFillVisible(d,g,p,f,h),P=rectStrokeVisible(d,y,p,f),w=runFill(h,c),M=runStroke(u,x);if(!t.valid||!C)return;if(!m){if(!w&&!M)return;if(!(S||P||s||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,r=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,a)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=r}else 0===v||isArray$1(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,r,p,f)):(e.beginPath(),createRectPath(e,i,r,p,f,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution));const E={doFill:w,doStroke:M};this._groupRenderContribitions.forEach((a=>{a.time===exports.BaseRenderContributionTime.beforeFillStroke&&a.drawShape(t,e,i,r,w,M,S,P,l,n,s,o,E)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{E.doFill&&(s?s(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,T-i,A-r,l),e.fill()))},B=()=>{E.doStroke&&(o?o(e,t.attribute,l):P&&(e.setStrokeStyle(t,t.attribute,T-i,A-r,l),e.stroke()))};_?(B(),R()):(R(),B()),this._groupRenderContribitions.forEach((a=>{a.time===exports.BaseRenderContributionTime.afterFillStroke&&a.drawShape(t,e,i,r,w,M,S,P,l,n,s,o)}))}draw(t,e,i,r){const{context:n}=i;if(!n)return;const{clip:a,baseOpacity:s=1}=t.attribute;a?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=s;const l=getTheme(t,null==r?void 0:r.theme).group,h=n.modelMatrix;if(n.camera){const e=mat4Allocate.allocate(),i=mat4Allocate.allocate();getModelMatrix(i,t,l),multiplyMat4Mat4(e,h||e,i),n.modelMatrix=e,mat4Allocate.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),r.skipDraw?this.drawShape(t,n,0,0,i,r,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:u=l.scrollY}=t.attribute;let d;(c||u)&&n.translate(c,u),r&&r.drawingCb&&(d=r.drawingCb()),n.modelMatrix!==h&&mat4Allocate.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,d&&d.then?d.then((()=>{a?n.restore():n.highPerformanceRestore()})):a?n.restore():n.highPerformanceRestore()}},exports.DefaultCanvasGroupRender=__decorate$1q([injectable(),__param$I(0,inject(ContributionProvider)),__param$I(0,named(GroupRenderContribution)),__metadata$14("design:paramtypes",[Object])],exports.DefaultCanvasGroupRender);var __decorate$1p=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$13=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$H=function(t,e){return function(i,r){e(i,r,t)}};const repeatStr=["","repeat-x","repeat-y","repeat"];exports.DefaultCanvasImageRender=class extends BaseRender{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=IMAGE_NUMBER_TYPE,this.builtinContributions=[defaultImageRenderContribution,defaultImageBackgroundRenderContribution],this.init(t)}drawShape(t,e,i,r,n,a,s,o){const l=getTheme(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:m=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,image:y}=t.attribute,v=this.valid(t,l,s);if(!v)return;const{fVisible:b,sVisible:x,doFill:C,doStroke:_}=v;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,r,C,!1,b,!1,l,n,s);const T=()=>{if(C)if(s)s(e,t.attribute,l);else if(b){if(!y||!t.resources)return;const n=t.resources.get(y);if("success"!==n.state)return;let a=!1;0===m||isArray$1(m)&&m.every((t=>0===t))||(e.beginPath(),createRectPath(e,i,r,h,c,m),e.save(),e.clip(),a=!0),e.setCommonStyle(t,t.attribute,i,r,l);let s=0;if("repeat"===u&&(s|=1),"repeat"===d&&(s|=2),s){const t=e.createPattern(n.data,repeatStr[s]);e.fillStyle=t,e.translate(i,r,!0),e.fillRect(0,0,h,c),e.translate(-i,-r,!0)}else e.drawImage(n.data,i,r,h,c);a&&e.restore()}},A=()=>{_&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,f-r,l),e.strokeRect(i,r,h,c)))};g?(A(),T()):(T(),A()),this.afterRenderStep(t,e,i,r,C,!1,b,!1,l,n,s)}draw(t,e,i){const{image:r}=t.attribute;if(!r||!t.resources)return;const n=t.resources.get(r);if("loading"===n.state&&isString$1(r))return void ResourceLoader.improveImageLoading(r);if("success"!==n.state)return;const{context:a}=e.drawParams;if(!a)return;const s=getTheme(t).image;this._draw(t,s,!1,i)}},exports.DefaultCanvasImageRender=__decorate$1p([injectable(),__param$H(0,inject(ContributionProvider)),__param$H(0,named(ImageRenderContribution)),__metadata$13("design:paramtypes",[Object])],exports.DefaultCanvasImageRender);const IncrementalDrawContribution=Symbol.for("IncrementalDrawContribution"),ArcRender=Symbol.for("ArcRender"),Arc3dRender=Symbol.for("Arc3dRender"),AreaRender=Symbol.for("AreaRender"),CircleRender=Symbol.for("CircleRender"),GraphicRender=Symbol.for("GraphicRender"),GroupRender=Symbol.for("GroupRender"),LineRender=Symbol.for("LineRender"),PathRender=Symbol.for("PathRender"),PolygonRender=Symbol.for("PolygonRender"),RectRender=Symbol.for("RectRender"),Rect3DRender=Symbol.for("Rect3DRender"),SymbolRender=Symbol.for("SymbolRender"),TextRender=Symbol.for("TextRender"),RichTextRender=Symbol.for("RichTextRender"),Pyramid3dRender=Symbol.for("Pyramid3dRender"),GlyphRender=Symbol.for("GlyphRender"),ImageRender=Symbol.for("ImageRender"),RenderSelector=Symbol.for("RenderSelector"),DrawContribution=Symbol.for("DrawContribution"),draw3dItem=(t,e,i,r)=>{let n,a=!1,s=!1;if(e.forEachChildren((t=>(a=t.numberType===ARC3D_NUMBER_TYPE,!a))),e.forEachChildren((t=>(s=!!t.findFace,!s))),a){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,r,n,a;let s=(null!==(r=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==r?r:0)/2,o=(null!==(a=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==a?a:0)/2;for(;s<0;)s+=pi2;for(;o<0;)o+=pi2;return o-s})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),r.hack_pieFace="outside",n=i(a,s),n&&n.graphic||(r.hack_pieFace="inside",n=i(a,s)),n&&n.graphic||(r.hack_pieFace="top",n=i(a,s)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(s){const r=e.getChildren(),o=r.map((e=>({ave_z:e.findFace().vertices.map((i=>{var r;return t.view(i[0],i[1],null!==(r=i[2]+e.attribute.z)&&void 0!==r?r: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)})),n=i(a,s),e.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),e.update(),r.forEach((t=>{e.add(t)}))}else n=i(a,s);return n};var __decorate$1o=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$12=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const DrawItemInterceptor=Symbol.for("DrawItemInterceptor"),tempDirtyBounds=new AABBBounds,tempBackupDirtyBounds=new AABBBounds;class ShadowRootDrawItemInterceptorContribution{constructor(){this.order=1}afterDrawItem(t,e,i,r,n){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,r,n),!1}beforeDrawItem(t,e,i,r,n){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,r,n),!1}drawItem(t,e,i,r,n){if(!t.shadowRoot)return!1;const{context:a}=i;if(a.highPerformanceSave(),a.transformFromMatrix(t.transMatrix,!0),r.dirtyBounds&&r.backupDirtyBounds){tempDirtyBounds.copy(r.dirtyBounds),tempBackupDirtyBounds.copy(r.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();r.dirtyBounds.copy(r.backupDirtyBounds).transformWithMatrix(e),r.backupDirtyBounds.copy(r.dirtyBounds)}return r.renderGroup(t.shadowRoot,i,matrixAllocate.allocate(1,0,0,1,0,0)),a.highPerformanceRestore(),r.dirtyBounds&&r.backupDirtyBounds&&(r.dirtyBounds.copy(tempDirtyBounds),r.backupDirtyBounds.copy(tempBackupDirtyBounds)),!0}}class DebugDrawItemInterceptorContribution{constructor(){this.order=1}afterDrawItem(t,e,i,r,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,r,n),!1}drawItem(t,e,i,r,n){if(!t.attribute._debug_bounds)return!1;const{context:a}=i;a.highPerformanceSave(),t.parent&&a.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&a.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const s=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(a,t),a.strokeRect(s.x1,s.y1,s.width(),s.height()),a.highPerformanceRestore(),!0}}exports.CommonDrawItemInterceptorContribution=class{constructor(){this.order=1,this.interceptors=[new ShadowRootDrawItemInterceptorContribution,new Canvas3DDrawItemInterceptor,new InteractiveDrawItemInterceptorContribution,new DebugDrawItemInterceptorContribution]}afterDrawItem(t,e,i,r,n){for(let a=0;a<this.interceptors.length;a++)if(this.interceptors[a].afterDrawItem&&this.interceptors[a].afterDrawItem(t,e,i,r,n))return!0;return!1}beforeDrawItem(t,e,i,r,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let a=0;a<this.interceptors.length;a++)if(this.interceptors[a].beforeDrawItem&&this.interceptors[a].beforeDrawItem(t,e,i,r,n))return!0;return!1}},exports.CommonDrawItemInterceptorContribution=__decorate$1o([injectable(),__metadata$12("design:paramtypes",[])],exports.CommonDrawItemInterceptorContribution);class InteractiveDrawItemInterceptorContribution{constructor(){this.order=1}beforeDrawItem(t,e,i,r,n){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,r,n):this.beforeSetInteractive(t,e,i,r,n))}beforeSetInteractive(t,e,i,r,n){let a=t.interactiveGraphic;if(t.attribute.globalZIndex){a||(a=t.clone(),t.interactiveGraphic=a,a.baseGraphic=t),a.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(a),!0}if(a){i.stage.tryInitInteractiveLayer();const e=i.stage.getLayer("_builtin_interactive");e&&this.getShadowRoot(e).removeChild(a),t.interactiveGraphic=null,a.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,r,n){const a=t.baseGraphic;let s=!!a.stage,o=a.parent;for(;s&&o&&o.stage!==o;)s=!!o.stage,o=o.parent;if(!s){const e=i.stage.getLayer("_builtin_interactive");return e&&this.getShadowRoot(e).removeChild(t),!0}if(a){this.processing=!0;const{context:t}=i;return t.highPerformanceSave(),t.setTransformFromMatrix(a.parent.globalTransMatrix,!0),a.isContainer?r.renderGroup(a,i,a.parent.globalTransMatrix):r.renderItem(a,i),t.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=graphicCreator.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),null!==(e=i.shadowRoot)&&void 0!==e?e:i.attachShadow()}}class Canvas3DDrawItemInterceptor{constructor(){this.order=1}beforeDrawItem(t,e,i,r,n){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:a,stage:s}=e.drawParams;a.canvas,a.save(),this.initCanvasCtx(a),a.camera=s.camera;const o=a.currentMatrix;o.a/=a.dpr,o.b/=a.dpr,o.c/=a.dpr,o.d/=a.dpr,o.e/=a.dpr,o.f/=a.dpr;const l=mat4Allocate.allocate();mat3Tomat4(l,o);const h=a.modelMatrix;if(h){if(l){const t=mat4Allocate.allocate();a.modelMatrix=multiplyMat4Mat4(t,h,l)}}else a.modelMatrix=l;return a.setTransform(1,0,0,1,0,0,!0),t.isContainer?draw3dItem(a,t,((e,n)=>r.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):r.renderItem(t,i),a.camera=null,a.restore(),a.modelMatrix!==h&&mat4Allocate.free(a.modelMatrix),a.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var __decorate$1n=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$11=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$G=function(t,e){return function(i,r){e(i,r,t)}};const RenderService=Symbol.for("RenderService"),BeforeRenderConstribution=Symbol.for("BeforeRenderConstribution");exports.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}},exports.DefaultRenderService=__decorate$1n([injectable(),__param$G(0,inject(DrawContribution)),__metadata$11("design:paramtypes",[Object])],exports.DefaultRenderService);var renderModule$1=new ContainerModule((t=>{t(RenderService).to(exports.DefaultRenderService)}));const GraphicPicker=Symbol.for("GraphicPicker"),PickerService=Symbol.for("PickerService"),BoundsPicker=Symbol.for("BoundsPicker"),GlobalPickerService=Symbol.for("GlobalPickerService"),PickItemInterceptor=Symbol.for("PickItemInterceptor"),PickServiceInterceptor=Symbol.for("PickServiceInterceptor");var __decorate$1m=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};exports.ShadowPickServiceInterceptorContribution=class{constructor(){this.order=1}afterPickItem(t,e,i,r,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}},exports.ShadowPickServiceInterceptorContribution=__decorate$1m([injectable()],exports.ShadowPickServiceInterceptorContribution),exports.ShadowRootPickItemInterceptorContribution=class{constructor(){this.order=1}afterPickItem(t,e,i,r,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,r,n):null}beforePickItem(t,e,i,r,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,r,n):null}_pickItem(t,e,i,r,n){var a;if(!t.shadowRoot)return null;const{parentMatrix:s}=n||{};if(!s)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(a=getTheme(t))||void 0===a?void 0:a[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=matrixAllocate.allocateByObj(s),d=new Point(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,r);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}},exports.ShadowRootPickItemInterceptorContribution=__decorate$1m([injectable()],exports.ShadowRootPickItemInterceptorContribution),exports.InteractivePickItemInterceptorContribution=class{constructor(){this.order=1}beforePickItem(t,e,i,r,n){const a=t.baseGraphic;if(a&&a.parent){const t=new Point(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const s=a.parent.globalTransMatrix;s.transformPoint(t,t);const o=a.isContainer?e.pickGroup(a,t.clone(),s,r):e.pickItem(a,t.clone(),s,r);return n.highPerformanceRestore(),o}return null}},exports.InteractivePickItemInterceptorContribution=__decorate$1m([injectable()],exports.InteractivePickItemInterceptorContribution),exports.Canvas3DPickItemInterceptor=class{constructor(){this.order=1}beforePickItem(t,e,i,r,n){if(!t.in3dMode||r.in3dInterceptor)return null;const a=e.pickContext,s=t.stage;if(!a||!s)return null;if(r.in3dInterceptor=!0,a.save(),this.initCanvasCtx(a),a.camera=s.camera,t.isContainer){const s=draw3dItem(a,t,(()=>e.pickGroup(t,i,n.parentMatrix,r)),r);return a.camera=null,r.in3dInterceptor=!1,a.restore(),s}return a.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}},exports.Canvas3DPickItemInterceptor=__decorate$1m([injectable()],exports.Canvas3DPickItemInterceptor);var pickModule=new ContainerModule(((t,e,i)=>{i(PickerService)||(t(GlobalPickerService).toSelf(),t(PickerService).toService(GlobalPickerService)),t(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(),t(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor),t(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(),t(PickItemInterceptor).toService(exports.ShadowRootPickItemInterceptorContribution),t(exports.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(),t(PickItemInterceptor).toService(exports.InteractivePickItemInterceptorContribution),bindContributionProvider(t,PickItemInterceptor),t(exports.ShadowPickServiceInterceptorContribution).toSelf().inSingletonScope(),t(PickServiceInterceptor).toService(exports.ShadowPickServiceInterceptorContribution),bindContributionProvider(t,PickServiceInterceptor)})),graphicModule=new ContainerModule((t=>{t(GraphicService).to(exports.DefaultGraphicService).inSingletonScope(),t(GraphicCreator$1).toConstantValue(graphicCreator)}));const AutoEnablePlugins=Symbol.for("AutoEnablePlugins"),PluginService=Symbol.for("PluginService");var __decorate$1l=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$10=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$F=function(t,e){return function(i,r){e(i,r,t)}};let DefaultPluginService=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&&container.isBound(AutoEnablePlugins)&&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=[]}};DefaultPluginService=__decorate$1l([injectable(),__param$F(0,inject(ContributionProvider)),__param$F(0,named(AutoEnablePlugins)),__metadata$10("design:paramtypes",[Object])],DefaultPluginService);var pluginModule=new ContainerModule((t=>{t(PluginService).to(DefaultPluginService),bindContributionProviderNoSingletonScope(t,AutoEnablePlugins)})),envModules=new ContainerModule((t=>{bindContributionProvider(t,EnvContribution)})),textMeasureModules=new ContainerModule((t=>{t(TextMeasureContribution).to(exports.DefaultTextMeasureContribution).inSingletonScope(),bindContributionProvider(t,TextMeasureContribution)})),__decorate$1k=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$$=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CanvasLayerHandlerContribution=class{constructor(){this.type="static",this.offscreen=!1,this.global=application.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 r=e.getContext().getCanvas().nativeCanvas,n=wrapCanvas({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:r.offsetLeft,y:r.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var r;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!==(r=e.background)&&void 0!==r?r:"#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 r;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(r=i.background)&&void 0!==r?r:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};CanvasLayerHandlerContribution=__decorate$1k([injectable(),__metadata$$("design:paramtypes",[])],CanvasLayerHandlerContribution);var layerHandlerModules=new ContainerModule((t=>{t(CanvasLayerHandlerContribution).toSelf(),t(StaticLayerHandlerContribution).toService(CanvasLayerHandlerContribution)}));function load$1(t){t.load(envModules),t.load(textMeasureModules),t.load(layerHandlerModules)}var __awaiter$5=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};function parseChildMap(t,e,i){const r={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:r,zIdxArray:n}}function foreach(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=!1;if(n)a=!0;else{let i;t.forEachChildren(((t,r)=>{const{zIndex:n=e}=t.attribute;if(0===r)i=n;else if(i!==n)return a=!0,!0;return!1}),r)}if(a){const{childMap:a,zIdxArray:s}=parseChildMap(t,e,r);let o=!1;for(let t=0;t<s.length&&!o;t++){const e=a[s[t]];n&&e.sort(((t,e)=>{var i,n;return(r?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t<e.length;t++)if(i(e[t],t)){o=!0;break}}}else t.forEachChildren(i,r)}function foreachAsync(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return __awaiter$5(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,r)}))}function findNextGraphic(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:r=i}=t.attribute;if(0===e);else if(void 0!==r)return n=!0,!0;return!1}),r);let a=null,s=!1;if(n){const{childMap:n,zIdxArray:o}=parseChildMap(t,i,r);let l=!1;for(let t=0;t<o.length&&!l;t++){const i=n[o[t]];for(let t=0;t<i.length;t++){if(s){l=!0,a=i[t];break}i[t]._uid!==e||(s=!0)}}}else t.forEachChildren((t=>s?(a=t,!0):(t._uid===e&&(s=!0),!1)),r);return a}var __decorate$1j=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$E=function(t,e){return function(i,r){e(i,r,t)}};let DefaultDrawContribution=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 Bounds,this.backupDirtyBounds=new Bounds,this.global=application.global,this.layerService=application.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:r,viewBox:n,transMatrix:a}=e;if(!i)return;const s=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(r.dirtyBounds&&!r.dirtyBounds.empty()){const t=getRectIntersect(s,r.dirtyBounds,!1);s.x1=Math.floor(t.x1),s.y1=Math.floor(t.y1),s.x2=Math.ceil(t.x2),s.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(s.x1=Math.floor(s.x1*i.dpr)/i.dpr,s.y1=Math.floor(s.y1*i.dpr)/i.dpr,s.x2=Math.ceil(s.x2*i.dpr)/i.dpr,s.y2=Math.ceil(s.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(s),i.inuse=!0,i.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(s.x1,s.y1,s.width(),s.height()),i.clip(),r.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,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:DefaultAttribute.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:DefaultAttribute.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,matrixAllocate.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=findNextGraphic(e,i,DefaultAttribute.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,r){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&&!isRectIntersect(t.AABBBounds,this.dirtyBounds,!1))return;let n,a=i;if(this.useDirtyBounds){n=boundsAllocate.allocateByObj(this.dirtyBounds);const e=t.transMatrix;a=matrixAllocate.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(a.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;r?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,a):this.renderItem(t,e))})):foreach(t,DefaultAttribute.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,a):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),boundsAllocate.free(n),matrixAllocate.free(a))}_increaseRender(t,e){const{layer:i,stage:r}=e,{subLayers:n}=i;let a=n.get(t._uid);a||(a={layer:this.layerService.createLayer(r),zIndex:n.size,group:t},n.set(t._uid,a));const s=a.layer.getNativeHandler().getContext(),o=a.drawContribution||container.get(IncrementalDrawContribution);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:a.layer,context:s,startAtId:t._uid,break:!1})),a.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(r),zIndex:n.size},n.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 r=0;r<this.InterceptorContributions.length;r++){const n=this.InterceptorContributions[r];if(n.beforeDrawItem&&n.beforeDrawItem(t,this.currentRenderService,e,this,i))return}const r=this.getRenderContribution(t);if(!r)return;let n,a=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)&&(a=!0,this.scrollMatrix||(this.scrollMatrix=matrixAllocate.allocate(1,0,0,1,0,0)),this.scrollMatrix.translate(-e,-i))}if(a&&(n=this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)),this.useDirtyBounds&&!t.isContainer&&!isRectIntersect(t.AABBBounds,null!=n?n:this.dirtyBounds,!1)){if(a&&t.parent){const{scrollX:e=0,scrollY:i=0}=t.parent.attribute;this.scrollMatrix&&this.scrollMatrix.translate(e,i)}return}const s=null!=e.startAtId&&t._uid!==e.startAtId;if(t._uid===e.startAtId&&(e.startAtId=null),i&&(i.skipDraw=s),s?t.isContainer&&r.draw(t,this.currentRenderService,e,i):r.draw(t,this.currentRenderService,e,i),a&&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 r=this.InterceptorContributions[i];if(r.afterDrawItem&&r.afterDrawItem(t,this.currentRenderService,e,this))return}}selectRenderByType(t){return Logger.getInstance().warn("未知错误,不应该走到这里"),null}selectRenderByNumberType(t,e){let i;if(e.attribute.renderStyle){const r=this.styleRenderMap.get(e.attribute.renderStyle);i=r&&r.get(t)}return i||this.currentRenderMap.get(t)||this.defaultRenderMap.get(t)}clearScreen(t,e,i){var r,n;const{clear:a,viewBox:s}=i,o=s.width(),l=s.height();if(a){e.clearRect(0,0,o,l);const i=null===(r=t.drawParams)||void 0===r?void 0:r.stage;if(i&&(e.globalAlpha=null!==(n=i.attribute.opacity)&&void 0!==n?n:1),i&&i.backgroundImg&&i.resources){const t=i.resources.get(a);t&&"success"===t.state&&t.data&&e.drawImage(t.data,0,0,o,l)}else e.fillStyle=createColor(e,a,{AABBBounds:{x1:0,y1:0,x2:0+o,y2:0+l}},0,0),e.fillRect(0,0,o,l)}}afterDraw(t,e){}};DefaultDrawContribution=__decorate$1j([injectable(),__param$E(0,multiInject(GraphicRender)),__param$E(1,inject(ContributionProvider)),__param$E(1,named(DrawItemInterceptor)),__metadata$_("design:paramtypes",[Array,Object])],DefaultDrawContribution);var __decorate$1i=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultIncrementalCanvasLineRender=class extends exports.DefaultCanvasLineRender{constructor(){super(...arguments),this.numberType=LINE_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:a}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=getTheme(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:f=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:g=h.visible}=t.attribute,y=fillVisible(d,p,c),v=strokeVisible(d,f),b=runFill(c),x=runStroke(u,m);if(!t.valid||!g)return;if(!b&&!x)return;if(!(y||v||s||o))return;const{context:C}=n;for(let n=e;n<e+a;n++)this.drawIncreaseSegment(t,C,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],i,r)}else super.drawShape(t,e,i,r,n,a,s,o)}drawIncreaseSegment(t,e,i,r,n,a,s,o){r&&(e.beginPath(),drawIncrementalSegments(e.nativeContext,i,r,{offsetX:s,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,a),e.setStrokeStyle(t,n,s,o,a),e.stroke())}};DefaultIncrementalCanvasLineRender=__decorate$1i([injectable()],DefaultIncrementalCanvasLineRender);var __decorate$1h=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultIncrementalCanvasAreaRender=class extends exports.DefaultCanvasAreaRender{constructor(){super(...arguments),this.numberType=AREA_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:a,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(a>l.length)return;const h=getTheme(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,f=fillVisible(d,u,c),m=runFill(c);if(!t.valid||!p)return;if(!m)return;if(!f&&!s)return;for(let n=a;n<a+o;n++)this.drawIncreaseSegment(t,e,l[n-1],l[n],t.attribute.segments[n],[h,t.attribute],i,r)}else super.drawShape(t,e,i,r,n,a,s)}drawIncreaseSegment(t,e,i,r,n,a,s,o){r&&(e.beginPath(),drawIncrementalAreaSegments(e.camera?e:e.nativeContext,i,r,{offsetX:s,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,a),e.setCommonStyle(t,n,s,o,a),e.fill())}};DefaultIncrementalCanvasAreaRender=__decorate$1h([injectable()],DefaultIncrementalCanvasAreaRender);var STATUS,__decorate$1g=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$Z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$D=function(t,e){return function(i,r){e(i,r,t)}},__awaiter$4=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(STATUS||(STATUS={}));let DefaultIncrementalDrawContribution=class extends DefaultDrawContribution{constructor(t,e,i,r){super(t,r),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=STATUS.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new SyncHook([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return __awaiter$4(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:r,viewBox:n}=e;r&&(r.inuse=!0,r.clearMatrix(),r.setTransformForCurrent(!0),r.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,r,e),r.translate(n.x1,n.y1,!0),r.save(),t.renderTreeRoots.sort(((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:DefaultAttribute.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:DefaultAttribute.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{r.restore(),r.restore(),r.draw(),r.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return __awaiter$4(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return __awaiter$4(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>__awaiter$4(this,void 0,void 0,(function*(){if(2!==t.count)yield foreachAsync(t,DefaultAttribute.zIndex,((i,r)=>{if(this.status===STATUS.STOP)return!0;if(i.isContainer)return!1;if(r<this.currentIdx)return!1;const n=this.currFrameStartAt+t.incremental;return r<n&&(this.currentIdx=r+1,this.renderItem(i,e)),r===n-1&&(this.currFrameStartAt=this.currentIdx,this.waitToNextFrame())})),i(!1);else{const r=t.getChildAt(0);if(r.incremental&&r.attribute.segments)for(r.incrementalAt||(r.incrementalAt=0);r.incrementalAt<r.attribute.segments.length;)e.multiGraphicOptions={startAtIdx:r.incrementalAt,length:r.incremental},this.renderItem(r,e),r.incrementalAt+=r.incremental,yield this.waitToNextFrame();else this.renderItem(r,e);i(!1)}}))})})),this.hooks.completeDraw.call()}))}waitToNextFrame(){return __awaiter$4(this,void 0,void 0,(function*(){return new Promise((t=>{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return __awaiter$4(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return __awaiter$4(this,void 0,void 0,(function*(){this.rendering&&(this.status=STATUS.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=STATUS.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 __awaiter$4(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:()=>__awaiter$4(this,void 0,void 0,(function*(){yield foreachAsync(t,DefaultAttribute.zIndex,(t=>__awaiter$4(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};DefaultIncrementalDrawContribution=__decorate$1g([injectable(),__param$D(0,multiInject(GraphicRender)),__param$D(1,inject(DefaultIncrementalCanvasLineRender)),__param$D(2,inject(DefaultIncrementalCanvasAreaRender)),__param$D(3,inject(ContributionProvider)),__param$D(3,named(DrawItemInterceptor)),__metadata$Z("design:paramtypes",[Array,Object,Object,Object])],DefaultIncrementalDrawContribution);var renderModule=new ContainerModule((t=>{t(DefaultBaseBackgroundRenderContribution).toSelf().inSingletonScope(),t(DefaultBaseTextureRenderContribution).toSelf().inSingletonScope(),t(DrawContribution).to(DefaultDrawContribution),t(IncrementalDrawContribution).to(DefaultIncrementalDrawContribution),t(GroupRender).to(exports.DefaultCanvasGroupRender).inSingletonScope(),t(GraphicRender).toService(GroupRender),bindContributionProvider(t,GroupRenderContribution),t(exports.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(),bindContributionProvider(t,InteractiveSubRenderContribution),bindContributionProvider(t,GraphicRender),t(exports.CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(),t(DrawItemInterceptor).toService(exports.CommonDrawItemInterceptorContribution),bindContributionProvider(t,DrawItemInterceptor)}));function load(t){t.load(renderModule)}function preLoadAllModule(){preLoadAllModule.__loaded||(preLoadAllModule.__loaded=!0,container.load(coreModule),container.load(graphicModule),container.load(renderModule$1),container.load(pickModule),container.load(pluginModule),load$1(container),load(container))}preLoadAllModule.__loaded=!1,preLoadAllModule();const vglobal=container.get(VGlobal);application.global=vglobal;const graphicUtil=container.get(GraphicUtil);application.graphicUtil=graphicUtil;const transformUtil=container.get(TransformUtil);application.transformUtil=transformUtil;const graphicService=container.get(GraphicService);application.graphicService=graphicService;const layerService=container.get(LayerService);application.layerService=layerService;class AutoRenderPlugin{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Generator.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,application.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),application.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),application.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));application.graphicService.hooks.onAttributeUpdate.taps=e(application.graphicService.hooks.onAttributeUpdate.taps),application.graphicService.hooks.onSetStage.taps=e(application.graphicService.hooks.onSetStage.taps),application.graphicService.hooks.onRemove.taps=e(application.graphicService.hooks.onRemove.taps)}}class AutoRefreshPlugin{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Generator.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=application.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=application.global.getRequestAnimationFrame();this.rafId=t((()=>{application.global.devicePixelRatio!==this.dpr&&(this.dpr=application.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=application.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class IncrementalAutoRenderPlugin{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Generator.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,application.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,r)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),application.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){application.graphicService.hooks.onAddIncremental.taps=application.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),application.graphicService.hooks.onClearIncremental.taps=application.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,application.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 r=e.layer.subLayers.get(e._uid);r&&r.drawContribution&&r.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:r.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const globalBounds=new AABBBounds;class DirtyBoundsPlugin{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Generator.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()})),application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,r)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(globalBounds.setValue(r.x1,r.y1,r.x2,r.y2),e.dirty(globalBounds,t.parent&&t.parent.globalTransMatrix)))})),application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,r,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(r.globalAABBBounds))})),application.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),application.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){application.graphicService.hooks.beforeUpdateAABBBounds.taps=application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),application.graphicService.hooks.afterUpdateAABBBounds.taps=application.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),application.graphicService.hooks.clearAABBBounds.taps=application.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)),application.graphicService.hooks.onRemove.taps=application.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const defaultTicker=new DefaultTicker;let _isBrowserEnv;function initIsBrowserEnv(){if(null==_isBrowserEnv)try{const t=document.createElement("canvas"),e=t.getContext("2d");_isBrowserEnv=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),_isBrowserEnv&&(_isBrowserEnv=!!document.createElement)}catch(t){_isBrowserEnv=!1}}function isBrowserEnv(){initIsBrowserEnv();const t=application.global&&application.global.env;return t?"browser"===t:_isBrowserEnv}function isNodeEnv(){initIsBrowserEnv();const t=application.global&&application.global.env;return t?"node"===t:!_isBrowserEnv}function getCurrentEnv(){return isBrowserEnv()?"browser":"node"}defaultTicker.addTimeline(defaultTimeline),defaultTicker.setFPS(60);class Factory{static registerPlugin(t,e){Factory._pluginClasses[t]=e}static getPlugin(t){return Factory._pluginClasses[t]}}Factory._pluginClasses={};const DefaultConfig$1={WIDTH:500,HEIGHT:500,X:0,Y:0,BACKGROUND:"white"};class Stage extends Group{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:DefaultConfig$1.BACKGROUND}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 Theme,this.hooks={beforeRender:new SyncHook(["stage"]),afterRender:new SyncHook(["stage"])},this.global=application.global,!this.global.env&&isBrowserEnv()&&this.global.setEnv("browser"),this.window=container.get(VWindow),this.renderService=container.get(RenderService),this.pluginService=container.get(PluginService),this.layerService=container.get(LayerService),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:DefaultConfig$1.BACKGROUND,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||defaultTicker,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new DefaultTimeline,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&isString$1(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 EventSystem(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:r=0,beta:n=0,camera:a,fieldRatio:s=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:r,beta:n,camera:a,fieldRatio:s,fieldDepth:o})}set3dOptions(t){var e,i,r,n,a,s;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:u,beta:d,fieldRatio:p,fieldDepth:f}=o,{dir:m=[1,1,-1],color:g="white",ambient:y}=l,v=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),b=(null!==(r=h.y)&&void 0!==r?r:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),x=[v,b,(null!==(a=h.z)&&void 0!==a?a:0)+(null!==(s=h.dz)&&void 0!==s?s:0)];let C=0,_=0,T=0;c||(C=Math.sin(u)+v,_=Math.sin(d)+b,T=Math.cos(u)*Math.cos(d)*1);const A=Factory.getPlugin("DirectionalLight");A&&(this.light=new A(m,g,y));const S={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:f,viewParams:{pos:[C,_,T],center:x,up:[0,1,0]}};if(this.camera)this.camera.params=S;else{const t=Factory.getPlugin("OrthoCamera");t&&(this.camera=new t(S))}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=Factory.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 AutoRenderPlugin))}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 AutoRefreshPlugin))}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 IncrementalAutoRenderPlugin))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Bounds;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new DirtyBoundsPlugin,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=Factory.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=Factory.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=Factory.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 r=t[e];"virtual"===r.layerMode&&(r=r.getNativeHandler().mainHandler.layer),i.includes(r)||i.push(r)}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,r,n){let a=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(a=!1)):(this.viewBox.setValue(t,e,t+i,e+r),!1===n&&(a=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),a&&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 Point(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=container.get(VWindow),i=t?-t.x1:0,r=t?-t.y1:0,n=t?t.x2:this.viewWidth,a=t?t.y2:this.viewHeight,s=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:r,x2:n,y2:a},width:s,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=container.get(PickerService)),this.pickerService}}function createStage(t){return new Stage(t)}var __decorate$1f=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$Y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const initMatrix=new Matrix(1,0,0,1,0,0),globalPoint={x:0,y:0};exports.EmptyContext2d=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Matrix(1,0,0,1,0,0),this.path=new CustomPath2D,this._clearMatrix=new Matrix(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 matrixAllocate.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(matrixAllocate.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(matrixAllocate.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,r){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,r,!1),this.scale(t,e,!1),this.translate(-i,-r,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,r,n,a){let s=!(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*r,o*n,o*a),s&&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,r,n,a){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,r,n,a),s&&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 r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),r&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),r&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,r,n,a){this.path.arc(t,e,i,r,n,a)}arcTo(t,e,i,r,n){this.path.arcTo(t,e,i,r,n)}bezierCurveTo(t,e,i,r,n,a){this.path.bezierCurveTo(t,e,i,r,n,a)}closePath(){this.path.closePath()}ellipse(t,e,i,r,n,a,s,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,r){this.path.quadraticCurveTo(t,e,i,r)}rect(t,e,i,r){this.path.rect(t,e,i,r)}createImageData(t,e){return null}createLinearGradient(t,e,i,r){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,r,n,a){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,r){return null}fill(t,e){}fillRect(t,e,i,r){this.path.rect(t,e,i,r)}clearRect(t,e,i,r){}fillText(t,e,i){}getImageData(t,e,i,r){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},globalPoint),contain(this.path.commandList,globalPoint.x,globalPoint.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},globalPoint);const i=getScaledStroke(this,this.lineWidth,this.dpr);return containStroke(this.path.commandList,i,globalPoint.x,globalPoint.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,r){this.path.rect(t,e,i,r)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,r,n){}_setCommonStyle(t,e,i,r){}setStrokeStyle(t,e,i,r,n){}_setStrokeStyle(t,e,i,r){}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(initMatrix,t,e)}setClearMatrix(t,e,i,r,n,a){this._clearMatrix.setValue(t,e,i,r,n,a)}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=>matrixAllocate.free(t))),this.stack.length=0}},exports.EmptyContext2d=__decorate$1f([injectable(),__metadata$Y("design:paramtypes",[Object,Number])],exports.EmptyContext2d);const DefaultConfig={WIDTH:500,HEIGHT:500,DPR:1};class BaseCanvas{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:r=DefaultConfig.WIDTH,height:n=DefaultConfig.HEIGHT,dpr:a=DefaultConfig.DPR,x:s,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=s?s:0,this._y=null!=o?o:0,this._pixelWidth=r*a,this._pixelHeight=n*a,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=r,this._displayHeight=n,this._dpr=a,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,r){return this._context.getImageData(t,e,i,r)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}BaseCanvas.env="browser";var __decorate$1e=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__awaiter$3=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};exports.BaseEnvContribution=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new AABBBounds}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}}loadFont(t,e,i){return __awaiter$3(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}},exports.BaseEnvContribution=__decorate$1e([injectable()],exports.BaseEnvContribution);var __decorate$1d=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$X=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};exports.BaseWindowHandlerContribution=class{constructor(){this._uid=Generator.GenAutoIncrementId(),this.viewBox=new AABBBounds,this.modelMatrix=new Matrix(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,r,n,a){this.modelMatrix.setValue(t,e,i,r,n,a)}getViewBoxTransform(){return this.modelMatrix}},exports.BaseWindowHandlerContribution=__decorate$1d([injectable(),__metadata$X("design:paramtypes",[])],exports.BaseWindowHandlerContribution);class DirectionalLight{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=ColorStore.Get(e,exports.ColorType.Color1),this.ambient=i;const r=sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/r,t[1]/r,t[2]/r]}computeColor(t,e){const i=this.formatedDir,r=min(max((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let n;n=isString$1(e)?ColorStore.Get(e,exports.ColorType.Color1):e;const a=this.colorRgb;return`rgb(${a[0]*n[0]*r}, ${a[1]*n[1]*r}, ${a[2]*n[2]*r})`}}const registerDirectionalLight=()=>{Factory.registerPlugin("DirectionalLight",DirectionalLight)};class OrthoCamera{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=mat4Allocate.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=mat4Allocate.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return lookAt(this._viewMatrixCached,t,e,i),this._vp||(this._vp=mat4Allocate.allocate()),this._vp=multiplyMat4Mat4(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=mat4Allocate.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=mat4Allocate.allocate());const{left:t,top:e,right:i,bottom:r}=this._params;return ortho(this._projectionMatrixCached,t,i,r,e,0,-2e6),this._vp||(this._vp=mat4Allocate.allocate()),this._vp=multiplyMat4Mat4(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._projectionMatrixCached}getField(){const{fieldRatio:t=.8,fieldDepth:e,left:i,right:r}=this._params;return(null!=e?e:r-i)*t}getProjectionScale(t){const e=this.getField();return e/(e+t)}view(t,e,i){const r=[0,0,0];return transformMat4(r,[t,e,i],this._viewMatrixCached),r}vp(t,e,i){const r=[0,0,0],{pos:n}=this._params.viewParams;transformMat4(r,[t,e,i],this._viewMatrixCached),t=r[0],e=r[1],i=r[2];const a=this.getProjectionScale(i);return{x:t*a+n[0],y:e*a+n[1]}}}const registerOrthoCamera=()=>{Factory.registerPlugin("OrthoCamera",OrthoCamera)};var __decorate$1c=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$W=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$C=function(t,e){return function(i,r){e(i,r,t)}};exports.DefaultPickService=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=application.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let r={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),a=i.bounds.height();if(!(new AABBBounds).setValue(0,0,n,a).containsPoint(e))return r;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const s=new Matrix(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(r=t[n].isContainer?this.pickGroup(t[n],e,s,i):this.pickItem(t[n],e,s,i),!r.graphic);n--)o||(o=r.group);if(r.graphic||(r.group=o),this.pickContext&&(this.pickContext.inuse=!1),this.pickerServiceInterceptorContributions.length)for(let t=0;t<this.pickerServiceInterceptorContributions.length;t++){const n=this.pickerServiceInterceptorContributions[t];n.afterPickItem&&(r=n.afterPickItem(r,this,e,i,{parentMatrix:s}))}return r}containsPoint(t,e,i){var r;return!!(null===(r=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===r?void 0:r.graphic)}pickGroup(t,e,i,r){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const a=r.pickContext,s=a.modelMatrix;if(a.camera){const e=t.transMatrix,i=mat4Allocate.allocate();if(mat3Tomat4(i,e),s){if(i){const t=mat4Allocate.allocate();a.modelMatrix=multiplyMat4Mat4(t,s,i),mat4Allocate.free(i)}}else mat3Tomat4(i,t.globalTransMatrix),a.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const o=this.InterceptorContributions[n];if(o.beforePickItem){const n=o.beforePickItem(t,this,e,r,{parentMatrix:i});if(n)return a.modelMatrix!==s&&mat4Allocate.free(a.modelMatrix),a.modelMatrix=s,n}}const o=t.transMatrix,l=matrixAllocate.allocateByObj(i),h=new Point(e.x,e.y);l.transformPoint(h,h);const c=t.AABBBounds.containsPoint(h);if(!c&&!t.stage.camera)return n;const u=this.pickItem(t,h.clone(),i,r);u&&u.graphic&&(n.graphic=u.graphic,n.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||foreach(t,DefaultAttribute.zIndex,(a=>{if(a.isContainer){const i=new Point(e.x,e.y),s=getTheme(t).group,{scrollX:o=s.scrollX,scrollY:h=s.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(a,i,l,r)}else{const s=new Point(e.x,e.y);l.transformPoint(s,s);const o=getTheme(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;s.x-=h,s.y-=c;const u=this.pickItem(a,s,i,r);u&&u.graphic&&(n.graphic=u.graphic,n.params=u.params)}return!!n.graphic||!!n.group}),!0,!!a.camera),a.modelMatrix!==s&&mat4Allocate.free(a.modelMatrix),a.modelMatrix=s,n.graphic||n.group||!d||t.stage.camera||(n.group=t),matrixAllocate.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}},exports.DefaultPickService=__decorate$1c([injectable(),__param$C(0,inject(ContributionProvider)),__param$C(0,named(PickItemInterceptor)),__param$C(1,inject(ContributionProvider)),__param$C(1,named(PickServiceInterceptor)),__metadata$W("design:paramtypes",[Object,Object])],exports.DefaultPickService);var __decorate$1b=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$V=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function simplifyRadialDist(t,e){let i,r,n=t[0].x,a=t[0].y;const s=[t[0]];for(let o=1,l=t.length;o<l;o++)i=t[o].x-n,r=t[o].y-a,i*i+r*r>e&&(n=t[o].x,a=t[o].y,s.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===a||s.push(t[t.length-1]),s}function flatten_simplify(t,e,i){return t.length<=10||i?t:simplifyRadialDist(t,void 0!==e?e*e:1)}exports.DefaultGlobalPickerService=class{constructor(){this.global=application.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 r={graphic:null,group:null};const n=new Matrix(1,0,0,1,0,0);let a;for(let s=0;s<t.length;s++){if(t[s].isContainer)r=this.pickGroup(t[s],e,n,i);else{const a=this.pickItem(t[s],e,n,i);a&&(r.graphic=a.graphic,r.params=a.params)}if(r.graphic)break;a||(a=r.group)}if(r.graphic||(r.group=a),r.graphic){let t=r.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(r.params={shadowTarget:r.graphic},r.graphic=t.shadowHost)}return r}containsPoint(t,e,i){return!!this.pickItem(t,e,null,i)}pickGroup(t,e,i,r){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const a=t.transMatrix,s=new Point(e.x,e.y);i.transformPoint(s,s);const o=t.AABBBounds.containsPoint(s);if(!o)return n;const l=!1!==t.attribute.pickable&&o;return i.multiply(a.a,a.b,a.c,a.d,a.e,a.f),!1!==t.attribute.childrenPickable&&t.forEachChildren((t=>{if(t.isContainer)n=this.pickGroup(t,e,i,r);else{const a=new Point(e.x,e.y);i.transformPoint(a,a);const s=this.pickItem(t,a,i,r);s&&(n.graphic=s.graphic,n.params=s.params)}return!!n.graphic||!!n.group})),n.graphic||n.group||!l||(n.group=t),n}pickItem(t,e,i,r){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?{graphic:t}:null}},exports.DefaultGlobalPickerService=__decorate$1b([injectable(),__metadata$V("design:paramtypes",[])],exports.DefaultGlobalPickerService);var __rest$1=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};function getMaxConfigIndexIgnoreLinebreak(t){let e=0;for(let i=0;i<t.length;i++)"\n"!==t[i].text&&e++;return Math.max(e-1,0)}function findConfigIndex(t,e){let i=0;if(e<0)return-1;let r=Math.round(e);for(i=0;i<t.length&&("\n"!==t[i].text&&r--,!(r<0));i++);return e-Math.round(e)<0&&i--,i=Math.max(i,0),Math.min(i,t.length-1)}function textConfigIgnoreLinebreakIdxToCursorIdx(t,e){var i;let r=0;for(let i=0;i<e;i++)"\n"!==t[i].text&&r++;return"\n"===(null===(i=t[e])||void 0===i?void 0:i.text)?r-=.1:r+=.1,r}class EditModule{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;if(this.cursorIndex<0){const e=t[0];t.unshift(Object.assign(Object.assign({fill:"black"},e),{text:""}))}else{const e=findConfigIndex(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=findConfigIndex(t,this.cursorIndex+1),i=t[e];t.splice(e,1);const r=i.text,n=r?Array.from(r.toString()):[];for(let r=0;r<n.length;r++)t.splice(r+e,0,Object.assign(Object.assign({},i),{text:n[r]}));this.currRt.setAttributes({textConfig:t}),this.onChangeCbList.forEach((e=>{e(r,this.isComposing,Math.min(this.cursorIndex+n.length,getMaxConfigIndexIgnoreLinebreak(t)+.1),this.currRt)}))},this.handleInput=t=>{var e,i,r,n;if(!this.currRt)return;const a=this.currRt.attribute,{textConfig:s=[]}=a,o=__rest$1(a,["textConfig"]);if("Backspace"===t.type&&!s.length)return;let l=t.data;this.isComposing||"Backspace"===t.type||l||(l="\n");let h=this.selectionStartCursorIdx,c=this.cursorIndex;h>c&&([h,c]=[c,h]),this.selectionStartCursorIdx=h,h=findConfigIndex(s,h),c=findConfigIndex(s,c);let u=0;"\n"===l&&(u=-.2);const d=h+(this.isComposing?1:0);let p=s[d];p||(p=0===s.length?{fill:null!==(e=o.fill)&&void 0!==e?e:"black",stroke:null!==(i=o.stroke)&&void 0!==i&&i,fontSize:null!==(r=o.fontSize)&&void 0!==r?r:12,fontWeight:null!==(n=o.fontWeight)&&void 0!==n?n:"normal"}:s[d-1]||s[d+1]);let f=p;"Backspace"!==t.type||this.isComposing?(h!==c&&s.splice(h+1,c-h),this.isComposing||(f=Object.assign(Object.assign({},p),{text:""}),h+=1,s.splice(h,0,f)),f.text=l,s.length||s.push(f)):h!==c?s.splice(h+1,c-h):(s.splice(h,1),h-=1),this.currRt.setAttributes({textConfig:s}),this.cursorIndex=textConfigIgnoreLinebreakIdxToCursorIdx(s,h),this.cursorIndex+=u,this.isComposing?this.onInputCbList.forEach((t=>{t(l,this.isComposing,this.cursorIndex,this.currRt)})):this.onChangeCbList.forEach((t=>{t(l,this.isComposing,this.cursorIndex,this.currRt)}))},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),application.global.addEventListener("keydown",this.handleKeyDown)}moveTo(t,e,i,r,n){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=r,this.selectionStartCursorIdx=n}release(){this.textAreaDom.removeEventListener("input",this.handleInput),this.textAreaDom.removeEventListener("compositionstart",this.handleCompositionStart),this.textAreaDom.removeEventListener("compositionend",this.handleCompositionEnd),application.global.removeEventListener("keydown",this.handleKeyDown)}}class Selection{constructor(t,e,i){this.curCursorIdx=e,this.selectionStartCursorIdx=t,this.rt=i}isEmpty(){return this.selectionStartCursorIdx===this.curCursorIdx}hasFormat(t){return null!=this.getFormat(t)}_getFormat(t,e){var i;if(!this.rt)return null;const r=Math.round(e),n=this.rt.attribute.textConfig;return null!==(i=n[Math.min(r,n.length-1)][t])&&void 0!==i?i:this.rt.attribute[t]}getFormat(t){return this.getAllFormat(t)[0]}getAllFormat(t){const e=new Set,i=Math.min(this.selectionStartCursorIdx,this.curCursorIdx),r=Math.max(this.selectionStartCursorIdx,this.curCursorIdx);if(i===r)return[this._getFormat(t,i)];for(let n=i;n<r;n++){const i=this._getFormat(t,n);i&&e.add(i)}return Array.from(e.values())}}const FORMAT_TEXT_COMMAND="FORMAT_TEXT_COMMAND",FORMAT_ELEMENT_COMMAND="FORMAT_ELEMENT_COMMAND";class RichTextEditPlugin{static splitText(t){return Array.from(t)}static tryUpdateRichtext(t){if(!t.getFrameCache().lines.every((t=>t.paragraphs.every((t=>!(t.text&&isString$1(t.text)&&RichTextEditPlugin.splitText(t.text).length>1)))))){const e=[];t.attribute.textConfig.forEach((t=>{const i=RichTextEditPlugin.splitText(t.text.toString());if(isString$1(t.text)&&i.length>1)for(let r=0;r<i.length;r++){const n=i[r];e.push(Object.assign(Object.assign({},t),{text:n}))}else e.push(t)})),t.setAttributes({textConfig:e}),t.doUpdateFrameCache(e)}}static CreateSelection(t){if(!t)return null;const{textConfig:e=[]}=t.attribute;return new Selection(0,e.length-1,t)}constructor(){this.name="RichTextEditPlugin",this.activeEvent="onRegister",this._uid=Generator.GenAutoIncrementId(),this.key=this.name+this._uid,this.editing=!1,this.pointerDown=!1,this.handleKeyDown=t=>{if(!this.currRt||!this.editing)return;const e=this.currRt.getFrameCache();if(!e)return;let i=0,r=0;"ArrowUp"===t.key?r=-1:"ArrowDown"===t.key?r=1:"ArrowLeft"===t.key?i=-1:"ArrowRight"===t.key&&(i=1);const{lineInfo:n,columnInfo:a}=this.getColumnByIndex(e,Math.round(this.curCursorIdx));if(i){i>0&&a===n.paragraphs[n.paragraphs.length-2]&&this.curCursorIdx<Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+.2:i>0&&a===n.paragraphs[n.paragraphs.length-1]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx+1-.2:i<0&&a===n.paragraphs[0]&&this.curCursorIdx>Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-.2:i<0&&a===n.paragraphs[0]&&this.curCursorIdx<Math.round(this.curCursorIdx)?this.curCursorIdx=this.curCursorIdx-1+.2:this.curCursorIdx+=i;const t=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt);this.setCursorAndTextArea(t.x,t.y1,t.y2,this.currRt),this.hideSelection()}if(r){if(r>0&&n===e.lines[e.lines.length-1])return;if(r<0&&n===e.lines[0])return;const t=e.lines.findIndex((t=>t===n))+r;if(t<0||t>=e.lines.length)return;const i=this.computedCursorPosByCursorIdx(this.curCursorIdx,this.currRt),a=i.x;let s=(i.y1+i.y2)/2;s+=r*n.height;const o=e.lines[t],{columnInfo:l,delta:h}=this.getColumnAndIndexByLinePoint(o,{x:a,y:s});if(!l)return;const c=this.getColumnIndex(e,l)+h,u=this.computedCursorPosByCursorIdx(c,this.currRt);this.curCursorIdx=c,this.selectionStartCursorIdx=c,this.setCursorAndTextArea(u.x,u.y1,u.y2,this.currRt)}},this.handleInput=(t,e,i,r)=>{this.hideSelection(),this.updateCbs.forEach((t=>t("input",this)))},this.handleChange=(t,e,i,r)=>{this.curCursorIdx=i,this.selectionStartCursorIdx=i;const n=this.computedCursorPosByCursorIdx(i,r);this.setCursorAndTextArea(n.x,n.y1,n.y2,r),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.tryShowSelection(t))},this.handleEnter=t=>{this.editing=!0,this.pluginService.stage.setCursor("text")},this.handleLeave=t=>{this.editing=!1,this.pluginService.stage.setCursor("default")},this.handlePointerDown=t=>{this.editing?this.onFocus(t):this.deFocus(t),this.triggerRender(),this.pointerDown=!0,this.updateCbs.forEach((t=>t(this.editing?"onfocus":"defocus",this)))},this.handlePointerUp=t=>{this.pointerDown=!1},this.commandCbs=new Map,this.commandCbs.set(FORMAT_TEXT_COMMAND,[this.formatTextCommandCb]),this.updateCbs=[],this.timeline=new DefaultTimeline,this.ticker=new DefaultTicker([this.timeline]),this.deltaX=0,this.deltaY=0}formatTextCommandCb(t,e){const i=e.currRt;if(!i)return;const r=e.getSelection();if(!r)return;const{selectionStartCursorIdx:n,curCursorIdx:a}=r,s=Math.min(n,a),o=Math.max(n,a),l=i.attribute.textConfig.slice(s+1,o+1);"bold"===t?l.forEach((t=>t.fontWeight="bold")):"italic"===t?l.forEach((t=>t.fontStyle="italic")):"underline"===t?l.forEach((t=>t.underline=!0)):"lineThrough"===t?l.forEach((t=>t.lineThrough=!0)):isObject$1(t)&&l.forEach((e=>merge(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 EditModule,t.stage.on("pointermove",this.handleMove),t.stage.on("pointerdown",this.handlePointerDown),t.stage.on("pointerup",this.handlePointerUp),t.stage.on("pointerleave",this.handlePointerUp),application.global.addEventListener("keydown",this.handleKeyDown),this.editModule.onInput(this.handleInput),this.editModule.onChange(this.handleChange)}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),application.global.addEventListener("keydown",this.handleKeyDown)}onFocus(t){this.deFocus(t),this.currRt=t.target;const e=t.target;RichTextEditPlugin.tryUpdateRichtext(e);const i=e.attachShadow(),r=e.getFrameCache();if(!r)return;if(this.computeGlobalDelta(r),i.setAttributes({shadowRootIdx:-1,x:this.deltaX,y:this.deltaY}),!this.editLine){const t=createLine({x:0,y:0,lineWidth:1,stroke:"black"});this.addAnimateToLine(t),this.editLine=t,this.ticker.start(!0);const e=createGroup({x:0,y:0,width:0,height:0});this.editBg=e,i.add(this.editLine),i.add(this.editBg)}const n=this.computedCursorPosByEvent(t,r);if(n){const{x:t,y1:i,y2:r,cursorIndex:a}=n;this.startCursorPos={x:t,y:(i+r)/2},this.curCursorIdx=a,this.selectionStartCursorIdx=a,this.setCursorAndTextArea(t,i,r,e)}}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))}addAnimateToLine(t){t.animates&&t.animates.forEach((t=>{t.stop(),t.release()}));const e=t.animate();e.setTimeline(this.timeline),e.to({opacity:1},10,"linear").wait(700).to({opacity:0},10,"linear").wait(700).loop(1/0)}tryShowSelection(t){const e=t.target.getFrameCache();if(!(e&&this.editBg&&this.pointerDown&&this.startCursorPos))return;let i=this.startCursorPos;const r=this.computedCursorPosByEvent(t,e);if(!r)return;this.curCursorIdx=r.cursorIndex;let n={x:r.x,y:(r.y1+r.y2)/2},a=this.getLineByPoint(e,i),s=this.getLineByPoint(e,n);if((i.y>n.y||i.y===n.y&&i.x>n.x)&&([i,n]=[n,i],[s,a]=[a,s]),this.hideSelection(),a===s)this.editBg.setAttributes({x:i.x,y:a.top,width:n.x-i.x,height:a.height,fill:"#336df4",fillOpacity:.2});else{this.editBg.setAttributes({x:0,y:a.top,width:0,height:0});const t=e.lines.findIndex((t=>t===a)),r=e.lines.findIndex((t=>t===s));let o=0;for(let a=t;a<=r;a++){const s=e.lines[a];if(a===t){const t=s.paragraphs[s.paragraphs.length-1];this.editBg.add(createRect({x:i.x,y:o,width:t.left+t.width-i.x,height:s.height,fill:"#336df4",fillOpacity:.2}))}else if(a===r){const t=s.paragraphs[0];this.editBg.add(createRect({x:t.left,y:o,width:n.x-t.left,height:s.height,fill:"#336df4",fillOpacity:.2}))}else{const t=s.paragraphs[0],e=s.paragraphs[s.paragraphs.length-1];this.editBg.add(createRect({x:t.left,y:o,width:e.left+e.width-t.left,height:s.height,fill:"#336df4",fillOpacity:.2}))}o+=s.height}}this.setCursorAndTextArea(r.x,r.y1+2,r.y2-2,t.target),this.triggerRender(),this.updateCbs.forEach((t=>t("selection",this)))}hideSelection(){this.editBg&&(this.editBg.removeAllChild(),this.editBg.setAttributes({fill:"transparent"}))}getLineByPoint(t,e){let i=t.lines[0];for(let r=0;r<t.lines.length&&!(i.top<=e.y&&i.top+i.height>=e.y);r++)i=t.lines[r+1];return i}getColumnAndIndexByLinePoint(t,e){let i=t.paragraphs[0],r=0;if(t.paragraphs.length){const n=t.paragraphs[0],a=t.paragraphs[t.paragraphs.length-1];e.x<=n.left?(r=-.1,i=n):e.x>=a.left+a.width&&(r=.1,i=a)}if(!r)for(let n=0;n<t.paragraphs.length;n++)if(i=t.paragraphs[n],i.left<=e.x&&i.left+i.width>=e.x){r=e.x>i.left+i.width/2?.1:-.1;break}return{columnInfo:i,delta:r}}getColumnIndex(t,e){let i=-1;for(let r=0;r<t.lines.length;r++){const n=t.lines[r];for(let t=0;t<n.paragraphs.length;t++)if(i++,e===n.paragraphs[t])return i}return-1}isRichtext(t){return!(!t.target||"richtext"!==t.target.type||!t.target.attribute.editable)}triggerRender(){this.pluginService.stage.renderNextFrame()}computeGlobalDelta(t){this.deltaX=0,this.deltaY=0;const e=t.height,i=t.actualHeight,r=t.lines.reduce(((t,e)=>Math.max(t,e.actualWidth)),0);"center"===t.globalAlign?this.deltaX=-r/2:"right"===t.globalAlign&&(this.deltaX=-r),"middle"===t.verticalDirection?this.deltaY=e/2-i/2:"bottom"===t.verticalDirection&&(this.deltaY=e-i)}getEventPosition(t){const e=this.pluginService.stage.eventPointTransform(t),i={x:0,y:0};return t.target.globalTransMatrix.transformPoint(e,i),i.x-=this.deltaX,i.y-=this.deltaY,i}setCursorAndTextArea(t,e,i,r){this.editLine.setAttributes({points:[{x:t,y:e},{x:t,y:i}]}),this.addAnimateToLine(this.editLine);const n={x:0,y:0};r.globalTransMatrix.getInverse().transformPoint({x:t,y:e},n);const{left:a,top:s}=this.pluginService.stage.window.getBoundingClientRect();n.x+=a,n.y+=s,this.editModule.moveTo(n.x,n.y,r,this.curCursorIdx,this.selectionStartCursorIdx)}computedCursorPosByEvent(t,e){const i=this.getEventPosition(t),r=this.getLineByPoint(e,i);if(!r)return;const{columnInfo:n,delta:a}=this.getColumnAndIndexByLinePoint(r,i);if(!n)return;let s=r.top,o=r.top+r.height;s+=2,o-=2;let l=this.getColumnIndex(e,n);return l+=a,{x:n.left+(a>0?n.width:0),y1:s,y2:o,cursorIndex:l}}computedCursorPosByCursorIdx(t,e){var i,r,n;const a=Math.round(t),s=t-a,o=e.getFrameCache(),l=this.getColumnByIndex(o,a),h=null!==(i=e.attribute.fontSize)&&void 0!==i?i:null===(n=null===(r=e.attribute.textConfig)||void 0===r?void 0:r[0])||void 0===n?void 0:n.fontSize;if(!l)return{x:0,y1:0,y2:h};const{lineInfo:c,columnInfo:u}=l;let d=c.top,p=c.top+c.height;return d+=2,p-=2,{x:u.left+(s<0?0:u.width),y1:d,y2:p}}getColumnByIndex(t,e){for(let i=0,r=0;i<t.lines.length;i++){const n=t.lines[i];for(let t=0;t<n.paragraphs.length;t++){const i=n.paragraphs[t];if(r===e)return{lineInfo:n,columnInfo:i};r++}}return null}release(){this.deactivate(this.pluginService),this.editModule.release()}getSelection(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.currRt?null!=this.selectionStartCursorIdx&&null!=this.curCursorIdx?new Selection(this.selectionStartCursorIdx,this.curCursorIdx,this.currRt):t?RichTextEditPlugin.CreateSelection(this.currRt):null:null}}class DefaultGraphicAllocate{constructor(){this.pools=[]}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}class DefaultRectAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.rect(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.rect(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultRectAllocate=new DefaultRectAllocate;class DefaultArcAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.arc(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.arc(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultArcAllocate=new DefaultArcAllocate;class DefaultAreaAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.area(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.area(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultAreaAllocate=new DefaultAreaAllocate;class DefaultCircleAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.circle(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.circle(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultCircleAllocate=new DefaultCircleAllocate;class DefaultLineAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.line(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.line(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultLineAllocate=new DefaultLineAllocate;class DefaultPathAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.path(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.path(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultPathAllocate=new DefaultPathAllocate;class DefaultSymbolAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.symbol(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.symbol(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultSymbolAllocate=new DefaultSymbolAllocate;class DefaultTextAllocate extends DefaultGraphicAllocate{allocate(t){if(!this.pools.length)return application.graphicService.creator.text(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return application.graphicService.creator.text(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const defaultTextAllocate=new DefaultTextAllocate;class DefaultGraphicMemoryManager{constructor(){this.map={text:defaultTextAllocate,symbol:defaultSymbolAllocate}}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 defaultGraphicMemoryManager=new DefaultGraphicMemoryManager;let loadArcModule=!1;const arcModule=new ContainerModule((t=>{loadArcModule||(loadArcModule=!0,t(exports.DefaultCanvasArcRender).toSelf().inSingletonScope(),t(ArcRender).to(exports.DefaultCanvasArcRender).inSingletonScope(),t(GraphicRender).toService(ArcRender),t(ArcRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,ArcRenderContribution))}));let loadRectModule=!1;const rectModule=new ContainerModule((t=>{loadRectModule||(loadRectModule=!0,t(exports.DefaultCanvasRectRender).toSelf().inSingletonScope(),t(RectRender).to(exports.DefaultCanvasRectRender).inSingletonScope(),t(GraphicRender).toService(RectRender),t(exports.SplitRectAfterRenderContribution).toSelf(),t(exports.SplitRectBeforeRenderContribution).toSelf(),t(RectRenderContribution).toService(exports.SplitRectAfterRenderContribution),t(RectRenderContribution).toService(exports.SplitRectBeforeRenderContribution),t(RectRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,RectRenderContribution))}));let loadLineModule=!1;const lineModule=new ContainerModule((t=>{loadLineModule||(loadLineModule=!0,t(exports.DefaultCanvasLineRender).toSelf().inSingletonScope(),t(DefaultIncrementalCanvasLineRender).toSelf().inSingletonScope(),t(LineRender).to(exports.DefaultCanvasLineRender).inSingletonScope(),t(GraphicRender).toService(LineRender))}));let loadAreaModule=!1;const areaModule=new ContainerModule((t=>{loadAreaModule||(loadAreaModule=!0,t(exports.DefaultCanvasAreaRender).toSelf().inSingletonScope(),t(AreaRender).to(exports.DefaultCanvasAreaRender).inSingletonScope(),t(GraphicRender).toService(AreaRender),t(AreaRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,AreaRenderContribution),t(DefaultIncrementalCanvasAreaRender).toSelf().inSingletonScope())}));let loadSymbolModule=!1;const symbolModule=new ContainerModule((t=>{loadSymbolModule||(loadSymbolModule=!0,t(exports.DefaultCanvasSymbolRender).toSelf().inSingletonScope(),t(SymbolRender).to(exports.DefaultCanvasSymbolRender).inSingletonScope(),t(GraphicRender).toService(SymbolRender),t(SymbolRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,SymbolRenderContribution))}));let loadCircleModule=!1;const circleModule=new ContainerModule((t=>{loadCircleModule||(loadCircleModule=!0,t(exports.DefaultCanvasCircleRender).toSelf().inSingletonScope(),t(CircleRender).to(exports.DefaultCanvasCircleRender).inSingletonScope(),t(GraphicRender).toService(CircleRender),t(CircleRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,CircleRenderContribution))}));let loadTextModule=!1;const textModule=new ContainerModule((t=>{loadTextModule||(loadTextModule=!0,t(TextRender).to(exports.DefaultCanvasTextRender).inSingletonScope(),t(GraphicRender).toService(TextRender),t(TextRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,TextRenderContribution))}));let loadPathModule=!1;const pathModule=new ContainerModule((t=>{loadPathModule||(loadPathModule=!0,t(exports.DefaultCanvasPathRender).toSelf().inSingletonScope(),t(PathRender).to(exports.DefaultCanvasPathRender).inSingletonScope(),t(GraphicRender).toService(PathRender),t(PathRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,PathRenderContribution))}));let loadPolygonModule=!1;const polygonModule=new ContainerModule((t=>{loadPolygonModule||(loadPolygonModule=!0,t(PolygonRender).to(exports.DefaultCanvasPolygonRender).inSingletonScope(),t(GraphicRender).toService(PolygonRender),t(PolygonRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,PolygonRenderContribution))}));var __decorate$1a=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultCanvasGlyphRender=class{constructor(){this.numberType=GLYPH_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,r,n,a,s,o)}))}draw(t,e,i,r){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const a=getTheme(t),s=t.getSubGraphic();s.length&&s.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:a})})),n.highPerformanceRestore()}};DefaultCanvasGlyphRender=__decorate$1a([injectable()],DefaultCanvasGlyphRender);let loadGlyphModule=!1;const glyphModule=new ContainerModule((t=>{loadGlyphModule||(loadGlyphModule=!0,t(GlyphRender).to(DefaultCanvasGlyphRender).inSingletonScope(),t(GraphicRender).toService(GlyphRender))}));var __decorate$19=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$U=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let DefaultCanvasRichTextRender=class extends BaseRender{constructor(){super(),this.numberType=RICHTEXT_NUMBER_TYPE,this.builtinContributions=[defaultTextBackgroundRenderContribution],this.init()}drawShape(t,e,i,r,n){const a=getTheme(t).richtext,{strokeOpacity:s=a.strokeOpacity,opacity:o=a.opacity,fillOpacity:l=a.fillOpacity,visible:h=a.visible}=t.attribute;if(!t.valid||!h)return;const c=fillVisible(o,l,!0),u=fillVisible(o,s,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,a),e.translate(i,r),this.beforeRenderStep(t,e,i,r,c,u,c,u,a,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,r,c,u,c,u,a,n))}drawIcon(t,e,i,r,n){var a;const s=getTheme(t).richtextIcon,{width:o=s.width,height:l=s.height,opacity:h=s.opacity,image:c,backgroundFill:u=s.backgroundFill,backgroundFillOpacity:d=s.backgroundFillOpacity,backgroundStroke:p=s.backgroundStroke,backgroundStrokeOpacity:f=s.backgroundStrokeOpacity,backgroundRadius:m=s.backgroundRadius,margin:g}=t.attribute,{backgroundWidth:y=o,backgroundHeight:v=l}=t.attribute;if(g&&(i+=t._marginArray[3],r+=t._marginArray[0]),t._hovered){const t=(y-o)/2,n=(v-l)/2;0===m?(e.beginPath(),e.rect(i-t,r-n,y,v)):(e.beginPath(),createRectPath(e,i-t,r-n,y,v,m)),u&&(e.globalAlpha=d,e.fillStyle=u,e.fill()),p&&(e.globalAlpha=f,e.strokeStyle=p,e.stroke())}const b=c&&(null===(a=null==t?void 0:t.resources)||void 0===a?void 0:a.get(c));b&&"success"===b.state&&(e.globalAlpha=h,e.drawImage(b.data,i,r,o,l))}draw(t,e,i){const r=getTheme(t).richtext;this._draw(t,r,!1,i)}};DefaultCanvasRichTextRender=__decorate$19([injectable(),__metadata$U("design:paramtypes",[])],DefaultCanvasRichTextRender);let loadRichtextModule=!1;const richtextModule=new ContainerModule((t=>{loadRichtextModule||(loadRichtextModule=!0,t(RichTextRender).to(DefaultCanvasRichTextRender).inSingletonScope(),t(GraphicRender).toService(RichTextRender))}));let loadImageModule=!1;const imageModule=new ContainerModule((t=>{loadImageModule||(loadImageModule=!0,t(ImageRender).to(exports.DefaultCanvasImageRender).inSingletonScope(),t(GraphicRender).toService(ImageRender),t(ImageRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution),bindContributionProvider(t,ImageRenderContribution))}));class Base3dRender extends BaseRender{stroke(t,e,i,r,n){const a=r.vertices;r.edges.forEach((r=>{const s=a[r[0]],o={x:t+s[0],y:e+s[1],z:i+s[2]},l=a[r[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};n.beginPath(),n.moveTo(o.x,o.y,o.z),n.lineTo(h.x,h.y,h.z),n.stroke()}))}fill(t,e,i,r,n,a,s,o,l,h,c){const u=ColorStore.Get(a,exports.ColorType.Color255),d=r.vertices,p=d.map((t=>s.view(t[0],t[1],t[2])[2])),f=[];r.polygons.forEach(((t,e)=>{if(n&&!n[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i}=t,r=p[i[0]],a=p[i[1]],s=p[i[2]],o=p[i[3]];t.ave_z=r+a+s+o})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((r=>{const{polygon:n,normal:p}=r.polygon,f=d[n[0]],m=d[n[1]],g=d[n[2]],y=d[n[3]],v={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+m[0],y:e+m[1],z:i+m[2]},x={x:t+g[0],y:e+g[1],z:i+g[2]},C={x:t+y[0],y:e+y[1],z:i+y[2]};s.beginPath(),s.moveTo(v.x,v.y,v.z),s.lineTo(b.x,b.y,b.z),s.lineTo(x.x,x.y,x.z),s.lineTo(C.x,C.y,C.z),s.closePath(),c?c(s,l&&l.attribute,h):(s.fillStyle=o?o.computeColor(p,u):a,s.fill())}))}}var __decorate$18=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultCanvasRect3dRender=class extends Base3dRender{constructor(){super(...arguments),this.type="rect3d",this.numberType=RECT3D_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s,o){var l;const h=getTheme(t,null==a?void 0:a.theme).rect,{fill:c=h.fill,stroke:u=h.stroke,x1:d,y1:p,x:f,y:m,opacity:g=h.opacity,fillOpacity:y=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:b=h.strokeOpacity,visible:x=h.visible}=t.attribute;let{width:C,height:_}=t.attribute;C=(null!=C?C:d-f)||0,_=(null!=_?_:p-m)||0;const T=null!==(l=this.z)&&void 0!==l?l:0,A=rectFillVisible(g,y,C,_,c),S=rectStrokeVisible(g,b,C,_),P=runFill(c),w=runStroke(u,v);if(!t.valid||!x)return;if(!P&&!w)return;if(!(A||S||s||o))return;const{light:M}=n.stage||{},E=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,r,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,r,T,E,null,n,e,M,null,null,s)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,r,h),this.stroke(i,r,T,E,e))}draw(t,e,i){const r=getTheme(t).rect;this._draw(t,r,!1,i)}};DefaultCanvasRect3dRender=__decorate$18([injectable()],DefaultCanvasRect3dRender);let loadRect3dModule=!1;const rect3dModule=new ContainerModule((t=>{loadRect3dModule||(loadRect3dModule=!0,t(Rect3DRender).to(DefaultCanvasRect3dRender).inSingletonScope(),t(GraphicRender).toService(Rect3DRender))}));var __decorate$17=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};function drawArcPath(t,e,i,r,n,a,s){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=abs(l-o),c=l>o;let u=!1;if(a<s){const t=a;a=s,s=t}if(a<=epsilon)e.moveTo(i,r,n);else if(h>=pi2-epsilon)e.moveTo(i+a*cos(o),r+a*sin(o),n),e.arc(i,r,a,o,l,!c,n),s>epsilon&&(e.moveTo(i+s*cos(l),r+s*sin(l),n),e.arc(i,r,s,l,o,c,n));else{const{outerDeltaAngle:h,innerDeltaAngle:d,outerStartAngle:p,outerEndAngle:f,innerEndAngle:m,innerStartAngle:g}=t.getParsePadAngle(o,l),y=a*cos(p),v=a*sin(p),b=s*cos(m),x=s*sin(m);h<.001?u=!0:(e.moveTo(i+y,r+v,n),e.arc(i,r,a,p,f,!c,n)),!(s>epsilon)||d<.001?(e.lineTo(i+b,r+x,n),u=!0):(e.lineTo(i+b,r+x,n),e.arc(i,r,s,m,g,c,n))}return e.closePath(),u}function drawInnerOuterArcPath(t,e,i,r,n,a,s,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=abs(h-l),u=h>l;let d=!1;if(s<=epsilon)e.moveTo(i,r,n);else if(c>=pi2-epsilon)e.moveTo(i+s*cos(l),r+s*sin(l),n),e.arc(i,r,s,l,h,!u,n),e.lineTo(i+s*cos(h),r+s*sin(h),a),e.arc(i,r,s,h,l,u,a);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),f=s*cos(c),m=s*sin(c),g=s*cos(p),y=s*sin(p);t<.001?d=!0:(e.moveTo(i+f,r+m,n),e.arc(i,r,s,c,p,!u,n),e.lineTo(i+g,r+y,a),e.arc(i,r,s,p,c,u,a))}return e.closePath(),d}let DefaultCanvasArc3DRender=class extends BaseRender{constructor(){super(...arguments),this.numberType=ARC3D_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s,o){var l;const h=getTheme(t,null==a?void 0:a.theme).arc,{fill:c=h.fill}=t.attribute,u=this.valid(t,h,s,o);if(!u)return;const{fVisible:d,sVisible:p,doFill:f,doStroke:m}=u,g=null!==(l=this.z)&&void 0!==l?l:0,{outerPadding:y=h.outerPadding,innerPadding:v=h.innerPadding,height:b=10}=t.attribute;let{outerRadius:x=h.outerRadius,innerRadius:C=h.innerRadius}=t.attribute;x+=y,C-=v;const _=ColorStore.Get(c,exports.ColorType.Color255),{light:T}=n.stage||{},A=n.hack_pieFace,S={top:g,bottom:g+b},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===A||"top"===A?(e.beginPath(),drawArcPath(t,e,i,r,S[A],x,C),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),f&&(s?s(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,r,h),e.fillStyle=T?T.computeColor(P[A],_):c,e.fill())),m&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,r,h),e.stroke()))):"outside"!==A&&"inside"!==A||("inside"===A&&(e.save(),e.beginPath(),e.arc(i,r,C,0,pi2,!0,S.top),e.clip()),e.beginPath(),drawInnerOuterArcPath(t,e,i,r,S.top,S.bottom,"outside"===A?x:C,((e,i)=>{const{outerDeltaAngle:r,innerDeltaAngle:n,outerStartAngle:a,outerEndAngle:s,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===A?{innerouterDeltaAngle:r,innerouterEndAngle:s,innerouterStartAngle:a}:{innerouterDeltaAngle:n,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),f&&(s?s(e,t.attribute,h):d&&(e.setCommonStyle(t,t.attribute,i,r,h),e.fillStyle=T?T.computeColor(P[A],_):c,e.fill())),m&&(o?o(e,t.attribute,h):p&&(e.setStrokeStyle(t,t.attribute,i,r,h),e.stroke())),"inside"===A&&e.restore())}draw(t,e,i,r){const n=getTheme(t,null==r?void 0:r.theme).arc;this._draw(t,n,!1,i,r)}};DefaultCanvasArc3DRender=__decorate$17([injectable()],DefaultCanvasArc3DRender);let loadArc3dModule=!1;const arc3dModule=new ContainerModule((t=>{loadArc3dModule||(loadArc3dModule=!0,t(Arc3dRender).to(DefaultCanvasArc3DRender).inSingletonScope(),t(GraphicRender).toService(Arc3dRender))}));var __decorate$16=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultCanvasPyramid3dRender=class extends Base3dRender{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=PYRAMID3D_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s,o){var l;const h=getTheme(t,null==a?void 0:a.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,s,o))return;const{light:f}=n.stage||{},m=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,r,h);let n=c;"string"!=typeof n&&(n="black"),this.fill(i,r,p,m,d,n,e,f,t,h,s)}!1!==u&&(e.setStrokeStyle(t,t.attribute,i,r,h),this.stroke(i,r,p,m,e))}draw(t,e,i){const r=getTheme(t).polygon;this._draw(t,r,!1,i)}};DefaultCanvasPyramid3dRender=__decorate$16([injectable()],DefaultCanvasPyramid3dRender);let loadPyramid3dModule=!1;const pyramid3dModule=new ContainerModule((t=>{loadPyramid3dModule||(loadPyramid3dModule=!0,t(Pyramid3dRender).to(DefaultCanvasPyramid3dRender).inSingletonScope(),t(GraphicRender).toService(Pyramid3dRender))}));function registerArcGraphic(){graphicCreator.RegisterGraphicCreator("arc",createArc)}function registerArc3dGraphic(){graphicCreator.RegisterGraphicCreator("arc3d",createArc3d)}function registerAreaGraphic(){graphicCreator.RegisterGraphicCreator("area",createArea)}function registerCircleGraphic(){graphicCreator.RegisterGraphicCreator("circle",createCircle)}function registerGlyphGraphic(){graphicCreator.RegisterGraphicCreator("glyph",createGlyph)}function registerGroupGraphic(){graphicCreator.RegisterGraphicCreator("group",createGroup)}function registerImageGraphic(){graphicCreator.RegisterGraphicCreator("image",createImage)}function registerLineGraphic(){graphicCreator.RegisterGraphicCreator("line",createLine)}function registerPathGraphic(){graphicCreator.RegisterGraphicCreator("path",createPath)}function registerPolygonGraphic(){graphicCreator.RegisterGraphicCreator("polygon",createPolygon)}function registerPyramid3dGraphic(){graphicCreator.RegisterGraphicCreator("pyramid3d",createPyramid3d)}function registerRectGraphic(){graphicCreator.RegisterGraphicCreator("rect",createRect)}function registerRect3dGraphic(){graphicCreator.RegisterGraphicCreator("rect3d",createRect3d)}function registerRichtextGraphic(){graphicCreator.RegisterGraphicCreator("richtext",createRichText)}function registerSymbolGraphic(){graphicCreator.RegisterGraphicCreator("symbol",createSymbol)}function registerTextGraphic(){graphicCreator.RegisterGraphicCreator("text",createText)}function registerShadowRootGraphic(){graphicCreator.RegisterGraphicCreator("shadowRoot",createShadowRoot)}function registerWrapTextGraphic(){graphicCreator.RegisterGraphicCreator("wrapText",createWrapText)}class HtmlAttributePlugin{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=Generator.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),application.graphicService.hooks.onRemove.unTap(this.key),application.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let r;return r=e?"string"==typeof e?application.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:application.global.createDom(Object.assign({tagName:"div",parent:r},i)),nativeContainer:r}}parseDefaultStyleFromGraphic(t){return textAttributesToStyle("text"===t.type&&t.attribute?t.attribute:getTheme(t).text)}getTransformOfText(t){const e=getTheme(t).text,{textAlign:i=e.textAlign,textBaseline:r=e.textBaseline}=t.attribute,n=t.globalTransMatrix.toTransformAttrs(),{rotateDeg:a,scaleX:s,scaleY:o}=n,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[r]}) rotate(${a}deg) scaleX(${s}) scaleY(${o})`,transformOrigin:`${h[i]} ${h[r]}`}}updateStyleOfWrapContainer(t,e,i,r,n){const{pointerEvents:a,penetrateEventList:s=[]}=n;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===a?"all":a||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),s.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",r.style.position="relative");let l=0,h=0;const c=t.globalAABBBounds;let u=n.anchorType;if(isNil$1(u)&&(u="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===u&&(u="top-left"),"position"===u||c.empty()){const e=t.globalTransMatrix;l=e.e,h=e.f}else{const t=calculateAnchorOfBounds(c,u);l=t.x,h=t.y}const d=application.global.getElementTopLeft(r,!1),p=e.window.getTopLeft(!1),f=e.viewBox,m=l+p.left-d.left+f.x1,g=h+p.top-d.top+f.y1;if(o.left=`${m}px`,o.top=`${g}px`,"text"===t.type&&"position"===u&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),isFunction$1(n.style)){const e=n.style({top:g,left:m,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else isObject$1(n.style)?o=Object.assign(Object.assign({},o),n.style):isString$1(n.style)&&n.style&&(o=Object.assign(Object.assign({},o),styleStringToObject(n.style)));application.global.updateDom(i,{width:n.width,height:n.width,style:o})}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"===application.global.env&&(t.sort(((t,e)=>{var i,r;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:DefaultAttribute.zIndex)-(null!==(r=e.attribute.zIndex)&&void 0!==r?r:DefaultAttribute.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&&application.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}renderGraphicHTML(t){var e;const{html:i}=t.attribute;if(!i)return;const r=t.stage;if(!r)return;const{dom:n,container:a}=i;if(!n)return;const s=isNil$1(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[s]&&a&&a!==this.htmlMap[s].container&&this.removeElement(s),this.htmlMap&&this.htmlMap[s])"string"==typeof n?this.htmlMap[s].wrapContainer.innerHTML=n:n!==this.htmlMap[s].wrapContainer.firstChild&&(this.htmlMap[s].wrapContainer.removeChild(this.htmlMap[s].wrapContainer.firstChild),this.htmlMap[s].wrapContainer.appendChild(n));else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(r,a);t&&("string"==typeof n?t.innerHTML=n:t.appendChild(n),this.htmlMap||(this.htmlMap={}),this.htmlMap[s]={wrapContainer:t,nativeContainer:e,container:a,renderId:this.renderId})}if(!this.htmlMap||!this.htmlMap[s])return;const{wrapContainer:o,nativeContainer:l}=this.htmlMap[s];this.updateStyleOfWrapContainer(t,r,o,l,i),this.htmlMap[s].renderId=this.renderId}release(){"browser"===application.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 registerHtmlAttributePlugin=()=>{Factory.registerPlugin("HtmlAttributePlugin",HtmlAttributePlugin)};class ReactAttributePlugin extends HtmlAttributePlugin{constructor(){super(...arguments),this.name="ReactAttributePlugin",this.activeEvent="onRegister",this._uid=Generator.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={}}removeElement(t){if(!this.htmlMap||!this.htmlMap[t])return;const{root:e,wrapContainer:i,unmount:r}=this.htmlMap[t];e?application.global.getRequestAnimationFrame()((()=>{e.unmount()})):r&&r(),i&&application.global.removeDom(i),this.htmlMap[t]=null}renderGraphicHTML(t){var e;const{react:i}=t.attribute;if(!i)return;const r=t.stage;if(!r)return;const n=r.params.ReactDOM,{element:a,container:s}=i;if(!a||!n||!n.createRoot&&!n.render)return;const o=isNil$1(i.id)?`${null!==(e=t.id)&&void 0!==e?e:t._uid}_react`:i.id;if(this.htmlMap&&this.htmlMap[o]&&s&&s!==this.htmlMap[o].container&&this.removeElement(o),this.htmlMap&&this.htmlMap[o])n.createRoot?this.htmlMap[o].root.render(a):n.render(a,this.htmlMap[o].wrapContainer);else{const{wrapContainer:t,nativeContainer:e}=this.getWrapContainer(r,s);if(t)if(this.htmlMap||(this.htmlMap={}),n.createRoot){const i=n.createRoot(t);i.render(a),this.htmlMap[o]={root:i,wrapContainer:t,nativeContainer:e,container:s,renderId:this.renderId}}else n.render(a,t),this.htmlMap[o]={wrapContainer:t,nativeContainer:e,container:s,renderId:this.renderId,unmount:()=>{n.unmountComponentAtNode(t)}}}if(!this.htmlMap||!this.htmlMap[o])return;const{wrapContainer:l,nativeContainer:h}=this.htmlMap[o];this.updateStyleOfWrapContainer(t,r,l,h,i),this.htmlMap[o].renderId=this.renderId}}const registerReactAttributePlugin=()=>{Factory.registerPlugin("ReactAttributePlugin",ReactAttributePlugin)};class ViewTransform3dPlugin{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=Generator.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 r=this.pluginService.stage;if(this.option3d||(this.option3d=r.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const n=t.page.x-this.pageX,a=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const s=n/100,o=a/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+s,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,r.set3dOptions(this.option3d),r.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 registerViewTransform3dPlugin=()=>{Factory.registerPlugin("ViewTransform3dPlugin",ViewTransform3dPlugin)},_tempBounds=new AABBBounds;class FlexLayoutPlugin{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=Generator.GenAutoIncrementId(),this.key=this.name+this.id,this.tempBounds=new AABBBounds}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 r=getTheme(i).group,{display:n=r.display}=i.attribute;if("flex"!==n)return;const{flexDirection:a=r.flexDirection,flexWrap:s=r.flexWrap,alignItems:o=r.alignItems,clip:l=r.clip}=i.attribute,{alignContent:h=(null!=o?o:r.alignContent)}=i.attribute;let{width:c,height:u,justifyContent:d=r.justifyContent}=i.attribute;const p=i.getChildren();if(null==c||null==u){let t=0,e=0,i=0;if(p.forEach((r=>{const n=this.getAABBBounds(r);n.empty()||("column"===a||"column-reverse"===a?(e+=n.height(),t=Math.max(t,n.width())):(t+=n.width(),e=Math.max(e,n.height())),i+=n.x1,i+=n.y1,i+=n.x2,i+=n.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"}},m=f.main,g=f.cross;"column"!==a&&"column-reverse"!==a||(m.len=u,g.len=c,m.field="y",g.field="x"),"row-reverse"!==a&&"column-reverse"!==a||("flex-start"===d?d="flex-end":"flex-end"===d?d="flex-start":p.reverse());let y=0,v=0;const b=[];p.forEach((t=>{const e=this.getAABBBounds(t);if(e.empty())return;const i="x"===m.field?e.width():e.height(),r="x"===g.field?e.width():e.height();b.push({mainLen:i,crossLen:r}),y+=i,v=Math.max(v,r)}));const x=[];if(y>m.len&&"wrap"===s){let t=0,e=0;b.forEach(((i,r)=>{let{mainLen:n,crossLen:a}=i;t+n>m.len?0===t?(x.push({idx:r,mainLen:t+n,crossLen:a}),t=0,e=0):(x.push({idx:r-1,mainLen:t,crossLen:e}),t=n,e=a):(t+=n,e=Math.max(e,a))})),x.push({idx:b.length-1,mainLen:t,crossLen:e})}else x.push({idx:b.length-1,mainLen:y,crossLen:v});let C=0;if(x.forEach((t=>{this.layoutMain(i,p,d,m,b,C,t),C=t.idx+1})),v=x.reduce(((t,e)=>t+e.crossLen),0),1===x.length){const t={"flex-start":0,"flex-end":g.len,center:g.len/2};this.layoutCross(p,o,g,t,b,x[0],0)}else if("flex-start"===h){C=0;let t=0;x.forEach(((e,i)=>{const r={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"flex-start",g,r,b,x[i],C),C=e.idx+1,t+=e.crossLen}))}else if("center"===h){C=0;let t=Math.max(0,(g.len-v)/2);x.forEach(((e,i)=>{const r={"flex-start":t,"flex-end":t+e.crossLen,center:t+e.crossLen/2};this.layoutCross(p,"center",g,r,b,x[i],C),C=e.idx+1,t+=e.crossLen}))}else if("space-around"===h){C=0;const t=Math.max(0,(g.len-v)/x.length/2);let e=t;x.forEach(((i,r)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",g,n,b,x[r],C),C=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===h){C=0;const t=Math.max(0,(g.len-v)/(2*x.length-2));let e=0;x.forEach(((i,r)=>{const n={"flex-start":e,"flex-end":e+i.crossLen,center:e+i.crossLen/2};this.layoutCross(p,"flex-start",g,n,b,x[r],C),C=i.idx+1,e+=i.crossLen+2*t}))}p.forEach(((t,e)=>{t.addUpdateBoundTag(),t.addUpdatePositionTag(),t.clearUpdateLayoutTag()})),i.addUpdateLayoutTag();const _=this.getAABBBounds(i);l||this.tempBounds.equals(_)||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,r,n,a,s){if("flex-start"===i){let t=0;for(let i=a;i<=s.idx;i++){const a=t+getPadding(e[i],r.field),s=this.getAABBBounds(e[i]);!s.empty()&&(e[i].attribute[r.field]=this.updateChildPos(a,e[i].attribute[r.field],s[`${r.field}1`])),t+=n[i].mainLen}}else if("flex-end"===i){let t=r.len;for(let i=s.idx;i>=a;i--){t-=n[i].mainLen;const a=t+getPadding(e[i],r.field),s=this.getAABBBounds(e[i]);!s.empty()&&(e[i].attribute[r.field]=this.updateChildPos(a,e[i].attribute[r.field],s[`${r.field}1`]))}}else if("space-around"===i)if(s.mainLen>=r.len){let t=0;for(let i=a;i<=s.idx;i++){const a=t+getPadding(e[i],r.field),s=this.getAABBBounds(e[i]);!s.empty()&&(e[i].attribute[r.field]=this.updateChildPos(a,e[i].attribute[r.field],s[`${r.field}1`])),t+=n[i].mainLen}}else{const t=s.idx-a+1,i=(r.len-s.mainLen)/t/2;let o=i;for(let t=a;t<=s.idx;t++){const a=o+getPadding(e[t],r.field),s=this.getAABBBounds(e[t]);!s.empty()&&(e[t].attribute[r.field]=this.updateChildPos(a,e[t].attribute[r.field],s[`${r.field}1`])),o+=n[t].mainLen+2*i}}else if("space-between"===i)if(s.mainLen>=r.len){let t=0;for(let i=a;i<=s.idx;i++){const a=t+getPadding(e[i],r.field),s=this.getAABBBounds(e[i]);!s.empty()&&(e[i].attribute[r.field]=this.updateChildPos(a,e[i].attribute[r.field],s[`${r.field}1`])),t+=n[i].mainLen}}else{const t=s.idx-a+1,i=(r.len-s.mainLen)/(2*t-2);let o=0;for(let t=a;t<=s.idx;t++){const a=o+getPadding(e[t],r.field),s=this.getAABBBounds(e[t]);!s.empty()&&(e[t].attribute[r.field]=this.updateChildPos(a,e[t].attribute[r.field],s[`${r.field}1`])),o+=n[t].mainLen+2*i}}else if("center"===i){let t=(r.len-s.mainLen)/2;for(let i=a;i<=s.idx;i++){const a=t+getPadding(e[i],r.field),s=this.getAABBBounds(e[i]);!s.empty()&&(e[i].attribute[r.field]=this.updateChildPos(a,e[i].attribute[r.field],s[`${r.field}1`])),t+=n[i].mainLen}}}layoutCross(t,e,i,r,n,a,s){var o;for(let l=s;l<=a.idx;l++){const a=t[l];let{alignSelf:s}=a.attribute;s&&"auto"!==s||(s=e);const h=this.getAABBBounds(a),c=null!==(o=r[s])&&void 0!==o?o:r["flex-start"];"flex-end"===s?!h.empty()&&(a.attribute[i.field]=this.updateChildPos(c-n[l].crossLen+getPadding(a,i.field),a.attribute[i.field],h[`${i.field}1`])):"center"===s?!h.empty()&&(a.attribute[i.field]=this.updateChildPos(c-n[l].crossLen/2+getPadding(a,i.field),a.attribute[i.field],h[`${i.field}1`])):!h.empty()&&(a.attribute[i.field]=this.updateChildPos(c+getPadding(a,i.field),a.attribute[i.field],h[`${i.field}1`]))}}activate(t){this.pluginService=t,application.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,r)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&_tempBounds.copy(r)})),application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,r,n)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(_tempBounds.equals(i)||this.tryLayout(t,!1))})),application.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){application.graphicService.hooks.onAttributeUpdate.taps=application.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),application.graphicService.hooks.beforeUpdateAABBBounds.taps=application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),application.graphicService.hooks.afterUpdateAABBBounds.taps=application.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),application.graphicService.hooks.onSetStage.taps=application.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}function getPadding(t,e){return 0}const registerFlexLayoutPlugin=()=>{Factory.registerPlugin("FlexLayoutPlugin",FlexLayoutPlugin)};function generatorPathEasingFunc(t){const e=new CustomPath2D;return e.setCtx(new CurveContext(e)),e.fromString(t,0,0,1,1),t=>e.getYAt(t)}function t(t,e,i){if(t&&t.length){const[r,n]=e,a=Math.PI/180*i,s=Math.cos(a),o=Math.sin(a);t.forEach((t=>{const[e,i]=t;t[0]=(e-r)*s-(i-n)*o+r,t[1]=(e-r)*o+(i-n)*s+n}))}}function e(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 s(e,i){const r=i.hachureAngle+90;let n=i.hachureGap;n<0&&(n=4*i.strokeWidth),n=Math.max(n,.1);const a=[0,0];if(r)for(const i of e)t(i,a,r);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 r=[];e=Math.max(e,.1);const n=[];for(const t of i)for(let e=0;e<t.length-1;e++){const i=t[e],r=t[e+1];if(i[1]!==r[1]){const t=Math.min(i[1],r[1]);n.push({ymin:t,ymax:Math.max(i[1],r[1]),x:t===i[1]?i[0]:r[0],islope:(r[0]-i[0])/(r[1]-i[1])})}}if(n.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))),!n.length)return r;let a=[],s=n[0].ymin;for(;a.length||n.length;){if(n.length){let t=-1;for(let e=0;e<n.length&&!(n[e].ymin>s);e++)t=e;n.splice(0,t+1).forEach((t=>{a.push({s:s,edge:t})}))}if(a=a.filter((t=>!(t.edge.ymax<=s))),a.sort(((t,e)=>t.edge.x===e.edge.x?0:(t.edge.x-e.edge.x)/Math.abs(t.edge.x-e.edge.x))),a.length>1)for(let t=0;t<a.length;t+=2){const e=t+1;if(e>=a.length)break;const i=a[t].edge,n=a[e].edge;r.push([[Math.round(i.x),s],[Math.round(n.x),s]])}s+=e,a.forEach((t=>{t.edge.x=t.edge.x+e*t.edge.islope}))}return r}(e,n);if(r){for(const i of e)t(i,a,-r);!function(e,i,r){const n=[];e.forEach((t=>n.push(...t))),t(n,i,r)}(s,a,-r)}return s}class n{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){const i=s(t,e);return{type:"fillSketch",ops:this.renderLines(i,e)}}renderLines(t,e){const i=[];for(const r of t)i.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],e));return i}}class a extends n{fillPolygons(t,i){let r=i.hachureGap;r<0&&(r=4*i.strokeWidth),r=Math.max(r,.1);const n=s(t,Object.assign({},i,{hachureGap:r})),a=Math.PI/180*i.hachureAngle,o=[],l=.5*r*Math.cos(a),h=.5*r*Math.sin(a);for(const[t,i]of n)e([t,i])&&o.push([[t[0]-l,t[1]+h],[...i]],[[t[0]+l,t[1]-h],[...i]]);return{type:"fillSketch",ops:this.renderLines(o,i)}}}class o extends n{fillPolygons(t,e){const i=this._fillPolygons(t,e),r=Object.assign({},e,{hachureAngle:e.hachureAngle+90}),n=this._fillPolygons(t,r);return i.ops=i.ops.concat(n.ops),i}}class h{constructor(t){this.helper=t}fillPolygons(t,e){const i=s(t,e=Object.assign({},e,{hachureAngle:0}));return this.dotsOnLines(i,e)}dotsOnLines(t,i){const r=[];let n=i.hachureGap;n<0&&(n=4*i.strokeWidth),n=Math.max(n,.1);let a=i.fillWeight;a<0&&(a=i.strokeWidth/2);const s=n/4;for(const o of t){const t=e(o),l=t/n,h=Math.ceil(l)-1,c=t-h*n,u=(o[0][0]+o[1][0])/2-n/4,d=Math.min(o[0][1],o[1][1]);for(let t=0;t<h;t++){const e=d+c+t*n,o=u-s+2*Math.random()*s,l=e-s+2*Math.random()*s,h=this.helper.ellipse(o,l,a,a,i);r.push(...h.ops)}}return{type:"fillSketch",ops:r}}}class r{constructor(t){this.helper=t}fillPolygons(t,e){const i=s(t,e);return{type:"fillSketch",ops:this.dashedLine(i,e)}}dashedLine(t,i){const r=i.dashOffset<0?i.hachureGap<0?4*i.strokeWidth:i.hachureGap:i.dashOffset,n=i.dashGap<0?i.hachureGap<0?4*i.strokeWidth:i.hachureGap:i.dashGap,a=[];return t.forEach((t=>{const s=e(t),o=Math.floor(s/(r+n)),l=(s+n-o*(r+n))/2;let h=t[0],c=t[1];h[0]>c[0]&&(h=t[1],c=t[0]);const u=Math.atan((c[1]-h[1])/(c[0]-h[0]));for(let t=0;t<o;t++){const e=t*(r+n),s=e+r,o=[h[0]+e*Math.cos(u)+l*Math.cos(u),h[1]+e*Math.sin(u)+l*Math.sin(u)],c=[h[0]+s*Math.cos(u)+l*Math.cos(u),h[1]+s*Math.sin(u)+l*Math.sin(u)];a.push(...this.helper.doubleLineOps(o[0],o[1],c[0],c[1],i))}})),a}}class i{constructor(t){this.helper=t}fillPolygons(t,e){const i=e.hachureGap<0?4*e.strokeWidth:e.hachureGap,r=e.zigzagOffset<0?i:e.zigzagOffset,n=s(t,e=Object.assign({},e,{hachureGap:i+r}));return{type:"fillSketch",ops:this.zigzagLines(n,r,e)}}zigzagLines(t,i,r){const n=[];return t.forEach((t=>{const a=e(t),s=Math.round(a/(2*i));let o=t[0],l=t[1];o[0]>l[0]&&(o=t[1],l=t[0]);const h=Math.atan((l[1]-o[1])/(l[0]-o[0]));for(let t=0;t<s;t++){const e=2*t*i,a=2*(t+1)*i,s=Math.sqrt(2*Math.pow(i,2)),l=[o[0]+e*Math.cos(h),o[1]+e*Math.sin(h)],c=[o[0]+a*Math.cos(h),o[1]+a*Math.sin(h)],u=[l[0]+s*Math.cos(h+Math.PI/4),l[1]+s*Math.sin(h+Math.PI/4)];n.push(...this.helper.doubleLineOps(l[0],l[1],u[0],u[1],r),...this.helper.doubleLineOps(u[0],u[1],c[0],c[1],r))}})),n}}const c={};class l{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const u={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 p(t,e){return t.type===e}function f(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 r="BOD",n=0,a=i[n];for(;!p(a,2);){let s=0;const o=[];if("BOD"===r){if("M"!==a.text&&"m"!==a.text)return f("M0,0"+t);n++,s=u[a.text],r=a.text}else p(a,1)?s=u[r]:(n++,s=u[a.text],r=a.text);if(!(n+s<i.length))throw new Error("Path data ended short");for(let t=n;t<n+s;t++){const e=i[t];if(!p(e,1))throw new Error("Param not a number: "+r+","+e.text);o[o.length]=+e.text}if("number"!=typeof u[r])throw new Error("Bad segment: "+r);{const t={key:r,data:o};e.push(t),n+=s,a=i[n],"M"===r&&(r="L"),"m"===r&&(r="l")}}return e}function d(t){let e=0,i=0,r=0,n=0;const a=[];for(const{key:s,data:o}of t)switch(s){case"M":a.push({key:"M",data:[...o]}),[e,i]=o,[r,n]=o;break;case"m":e+=o[0],i+=o[1],a.push({key:"M",data:[e,i]}),r=e,n=i;break;case"L":a.push({key:"L",data:[...o]}),[e,i]=o;break;case"l":e+=o[0],i+=o[1],a.push({key:"L",data:[e,i]});break;case"C":a.push({key:"C",data:[...o]}),e=o[4],i=o[5];break;case"c":{const t=o.map(((t,r)=>r%2?t+i:t+e));a.push({key:"C",data:t}),e=t[4],i=t[5];break}case"Q":a.push({key:"Q",data:[...o]}),e=o[2],i=o[3];break;case"q":{const t=o.map(((t,r)=>r%2?t+i:t+e));a.push({key:"Q",data:t}),e=t[2],i=t[3];break}case"A":a.push({key:"A",data:[...o]}),e=o[5],i=o[6];break;case"a":e+=o[5],i+=o[6],a.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,i]});break;case"H":a.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],a.push({key:"H",data:[e]});break;case"V":a.push({key:"V",data:[...o]}),i=o[0];break;case"v":i+=o[0],a.push({key:"V",data:[i]});break;case"S":a.push({key:"S",data:[...o]}),e=o[2],i=o[3];break;case"s":{const t=o.map(((t,r)=>r%2?t+i:t+e));a.push({key:"S",data:t}),e=t[2],i=t[3];break}case"T":a.push({key:"T",data:[...o]}),e=o[0],i=o[1];break;case"t":e+=o[0],i+=o[1],a.push({key:"T",data:[e,i]});break;case"Z":case"z":a.push({key:"Z",data:[]}),e=r,i=n}return a}function g(t){const e=[];let i="",r=0,n=0,a=0,s=0,o=0,l=0;for(const{key:h,data:c}of t){switch(h){case"M":e.push({key:"M",data:[...c]}),[r,n]=c,[a,s]=c;break;case"C":e.push({key:"C",data:[...c]}),r=c[4],n=c[5],o=c[2],l=c[3];break;case"L":e.push({key:"L",data:[...c]}),[r,n]=c;break;case"H":r=c[0],e.push({key:"L",data:[r,n]});break;case"V":n=c[0],e.push({key:"L",data:[r,n]});break;case"S":{let t=0,a=0;"C"===i||"S"===i?(t=r+(r-o),a=n+(n-l)):(t=r,a=n),e.push({key:"C",data:[t,a,...c]}),o=c[0],l=c[1],r=c[2],n=c[3];break}case"T":{const[t,a]=c;let s=0,h=0;"Q"===i||"T"===i?(s=r+(r-o),h=n+(n-l)):(s=r,h=n);const u=r+2*(s-r)/3,d=n+2*(h-n)/3,p=t+2*(s-t)/3,f=a+2*(h-a)/3;e.push({key:"C",data:[u,d,p,f,t,a]}),o=s,l=h,r=t,n=a;break}case"Q":{const[t,i,a,s]=c,h=r+2*(t-r)/3,u=n+2*(i-n)/3,d=a+2*(t-a)/3,p=s+2*(i-s)/3;e.push({key:"C",data:[h,u,d,p,a,s]}),o=t,l=i,r=a,n=s;break}case"A":{const t=Math.abs(c[0]),i=Math.abs(c[1]),a=c[2],s=c[3],o=c[4],l=c[5],h=c[6];0===t||0===i?(e.push({key:"C",data:[r,n,l,h,l,h]}),r=l,n=h):r===l&&n===h||(k(r,n,l,h,t,i,a,s,o).forEach((function(t){e.push({key:"C",data:t})})),r=l,n=h);break}case"Z":e.push({key:"Z",data:[]}),r=a,n=s}i=h}return e}function M(t,e,i){return[t*Math.cos(i)-e*Math.sin(i),t*Math.sin(i)+e*Math.cos(i)]}function k(t,e,i,r,n,a,s,o,l,h){const c=(u=s,Math.PI*u/180);var u;let d=[],p=0,f=0,m=0,g=0;if(h)[p,f,m,g]=h;else{[t,e]=M(t,e,-c),[i,r]=M(i,r,-c);const s=(t-i)/2,h=(e-r)/2;let u=s*s/(n*n)+h*h/(a*a);u>1&&(u=Math.sqrt(u),n*=u,a*=u);const d=n*n,y=a*a,v=d*y-d*h*h-y*s*s,b=d*h*h+y*s*s,x=(o===l?-1:1)*Math.sqrt(Math.abs(v/b));m=x*n*h/a+(t+i)/2,g=x*-a*s/n+(e+r)/2,p=Math.asin(parseFloat(((e-g)/a).toFixed(9))),f=Math.asin(parseFloat(((r-g)/a).toFixed(9))),t<m&&(p=Math.PI-p),i<m&&(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 y=f-p;if(Math.abs(y)>120*Math.PI/180){const t=f,e=i,o=r;f=l&&f>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,d=k(i=m+n*Math.cos(f),r=g+a*Math.sin(f),e,o,n,a,s,0,l,[f,t,m,g])}y=f-p;const v=Math.cos(p),b=Math.sin(p),x=Math.cos(f),C=Math.sin(f),_=Math.tan(y/4),T=4/3*n*_,A=4/3*a*_,S=[t,e],P=[t+T*b,e-A*v],w=[i+T*C,r-A*x],E=[i,r];if(P[0]=2*S[0]-P[0],P[1]=2*S[1]-P[1],h)return[P,w,E].concat(d);{d=[P,w,E].concat(d);const t=[];for(let e=0;e<d.length;e+=3){const i=M(d[e][0],d[e][1],c),r=M(d[e+1][0],d[e+1][1],c),n=M(d[e+2][0],d[e+2][1],c);t.push([i[0],i[1],r[0],r[1],n[0],n[1]])}return t}}const b={randOffset:function(t,e){return A(t,e)},randOffsetWithRange:function(t,e,i){return D(t,e,i)},ellipse:function(t,e,i,r,n){return v(t,e,n,P(i,r,n)).opset},doubleLineOps:function(t,e,i,r,n){return I(t,e,i,r,n,!0)}};function y(t,e,i,r,n){return{type:"path",ops:I(t,e,i,r,n)}}function m$2(t,e,i){const r=(t||[]).length;if(r>2){const n=[];for(let e=0;e<r-1;e++)n.push(...I(t[e][0],t[e][1],t[e+1][0],t[e+1][1],i));return e&&n.push(...I(t[r-1][0],t[r-1][1],t[0][0],t[0][1],i)),{type:"path",ops:n}}return 2===r?y(t[0][0],t[0][1],t[1][0],t[1][1],i):{type:"path",ops:[]}}function w(t,e,i,r,n){return function(t,e){return m$2(t,!0,e)}([[t,e],[t+i,e],[t+i,e+r],[t,e+r]],n)}function x(t,e){let i=_(t,1*(1+.2*e.roughness),e);if(!e.disableMultiStroke){const r=_(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(r)}return{type:"path",ops:i}}function P(t,e,i){const r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),n=Math.ceil(Math.max(i.curveStepCount,i.curveStepCount/Math.sqrt(200)*r)),a=2*Math.PI/n;let s=Math.abs(t/2),o=Math.abs(e/2);const l=1-i.curveFitting;return s+=A(s*l,i),o+=A(o*l,i),{increment:a,rx:s,ry:o}}function v(t,e,i,r){const[n,a]=z(r.increment,t,e,r.rx,r.ry,1,r.increment*D(.1,D(.4,1,i),i),i);let s=W(n,null,i);if(!i.disableMultiStroke&&0!==i.roughness){const[n]=z(r.increment,t,e,r.rx,r.ry,1.5,0,i),a=W(n,null,i);s=s.concat(a)}return{estimatedPoints:a,opset:{type:"path",ops:s}}}function O(t,e,i,r,n,a,s,o,l){const h=t,c=e;let u=Math.abs(i/2),d=Math.abs(r/2);u+=A(.01*u,l),d+=A(.01*d,l);let p=n,f=a;for(;p<0;)p+=2*Math.PI,f+=2*Math.PI;f-p>2*Math.PI&&(p=0,f=2*Math.PI);const m=2*Math.PI/l.curveStepCount,g=Math.min(m/2,(f-p)/2),y=E(g,h,c,u,d,p,f,1,l);if(!l.disableMultiStroke){const t=E(g,h,c,u,d,p,f,1.5,l);y.push(...t)}return s&&(o?y.push(...I(h,c,h+u*Math.cos(p),c+d*Math.sin(p),l),...I(h,c,h+u*Math.cos(f),c+d*Math.sin(f),l)):y.push({op:"lineTo",data:[h,c]},{op:"lineTo",data:[h+u*Math.cos(p),c+d*Math.sin(p)]})),{type:"path",ops:y}}function S(t,e){const i=[];for(const r of t)if(r.length){const t=e.maxRandomnessOffset||0,n=r.length;if(n>2){i.push({op:"move",data:[r[0][0]+A(t,e),r[0][1]+A(t,e)]});for(let a=1;a<n;a++)i.push({op:"lineTo",data:[r[a][0]+A(t,e),r[a][1]+A(t,e)]})}}return{type:"fillPath",ops:i}}function L(t,e){return function(t,e){let s=t.fillStyle||"hachure";if(!c[s])switch(s){case"zigzag":c[s]||(c[s]=new a(e));break;case"cross-hatch":c[s]||(c[s]=new o(e));break;case"dots":c[s]||(c[s]=new h(e));break;case"dashed":c[s]||(c[s]=new r(e));break;case"zigzag-line":c[s]||(c[s]=new i(e));break;default:s="hachure",c[s]||(c[s]=new n(e))}return c[s]}(e,b).fillPolygons(t,e)}function T(t){return t.randomizer||(t.randomizer=new l(t.seed||0)),t.randomizer.next()}function D(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return i.roughness*r*(T(i)*(e-t)+t)}function A(t,e){return D(-t,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function I(t,e,i,r,n){const a=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?n.disableMultiStrokeFill:n.disableMultiStroke,s=C(t,e,i,r,n,!0,!1);if(a)return s;const o=C(t,e,i,r,n,!0,!0);return s.concat(o)}function C(t,e,i,r,n,a,s){const o=Math.pow(t-i,2)+Math.pow(e-r,2),l=Math.sqrt(o);let h=1;h=l<200?1:l>500?.4:-.0016668*l+1.233334;let c=n.maxRandomnessOffset||0;c*c*100>o&&(c=l/10);const u=c/2,d=.2+.2*T(n);let p=n.bowing*n.maxRandomnessOffset*(r-e)/200,f=n.bowing*n.maxRandomnessOffset*(t-i)/200;p=A(p,n,h),f=A(f,n,h);const m=[],g=()=>A(u,n,h),y=()=>A(c,n,h),v=n.preserveVertices;return a&&(s?m.push({op:"move",data:[t+(v?0:g()),e+(v?0:g())]}):m.push({op:"move",data:[t+(v?0:A(c,n,h)),e+(v?0:A(c,n,h))]})),s?m.push({op:"bcurveTo",data:[p+t+(i-t)*d+g(),f+e+(r-e)*d+g(),p+t+2*(i-t)*d+g(),f+e+2*(r-e)*d+g(),i+(v?0:g()),r+(v?0:g())]}):m.push({op:"bcurveTo",data:[p+t+(i-t)*d+y(),f+e+(r-e)*d+y(),p+t+2*(i-t)*d+y(),f+e+2*(r-e)*d+y(),i+(v?0:y()),r+(v?0:y())]}),m}function _(t,e,i){const r=[];r.push([t[0][0]+A(e,i),t[0][1]+A(e,i)]),r.push([t[0][0]+A(e,i),t[0][1]+A(e,i)]);for(let n=1;n<t.length;n++)r.push([t[n][0]+A(e,i),t[n][1]+A(e,i)]),n===t.length-1&&r.push([t[n][0]+A(e,i),t[n][1]+A(e,i)]);return W(r,null,i)}function W(t,e,i){const r=t.length,n=[];if(r>3){const a=[],s=1-i.curveTightness;n.push({op:"move",data:[t[1][0],t[1][1]]});for(let e=1;e+2<r;e++){const i=t[e];a[0]=[i[0],i[1]],a[1]=[i[0]+(s*t[e+1][0]-s*t[e-1][0])/6,i[1]+(s*t[e+1][1]-s*t[e-1][1])/6],a[2]=[t[e+1][0]+(s*t[e][0]-s*t[e+2][0])/6,t[e+1][1]+(s*t[e][1]-s*t[e+2][1])/6],a[3]=[t[e+1][0],t[e+1][1]],n.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(e&&2===e.length){const t=i.maxRandomnessOffset;n.push({op:"lineTo",data:[e[0]+A(t,i),e[1]+A(t,i)]})}}else 3===r?(n.push({op:"move",data:[t[1][0],t[1][1]]}),n.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):2===r&&n.push(...I(t[0][0],t[0][1],t[1][0],t[1][1],i));return n}function z(t,e,i,r,n,a,s,o){const l=[],h=[];if(0===o.roughness){t/=4,h.push([e+r*Math.cos(-t),i+n*Math.sin(-t)]);for(let a=0;a<=2*Math.PI;a+=t){const t=[e+r*Math.cos(a),i+n*Math.sin(a)];l.push(t),h.push(t)}h.push([e+r*Math.cos(0),i+n*Math.sin(0)]),h.push([e+r*Math.cos(t),i+n*Math.sin(t)])}else{const c=A(.5,o)-Math.PI/2;h.push([A(a,o)+e+.9*r*Math.cos(c-t),A(a,o)+i+.9*n*Math.sin(c-t)]);const u=2*Math.PI+c-.01;for(let s=c;s<u;s+=t){const t=[A(a,o)+e+r*Math.cos(s),A(a,o)+i+n*Math.sin(s)];l.push(t),h.push(t)}h.push([A(a,o)+e+r*Math.cos(c+2*Math.PI+.5*s),A(a,o)+i+n*Math.sin(c+2*Math.PI+.5*s)]),h.push([A(a,o)+e+.98*r*Math.cos(c+s),A(a,o)+i+.98*n*Math.sin(c+s)]),h.push([A(a,o)+e+.9*r*Math.cos(c+.5*s),A(a,o)+i+.9*n*Math.sin(c+.5*s)])}return[h,l]}function E(t,e,i,r,n,a,s,o,l){const h=a+A(.1,l),c=[];c.push([A(o,l)+e+.9*r*Math.cos(h-t),A(o,l)+i+.9*n*Math.sin(h-t)]);for(let a=h;a<=s;a+=t)c.push([A(o,l)+e+r*Math.cos(a),A(o,l)+i+n*Math.sin(a)]);return c.push([e+r*Math.cos(s),i+n*Math.sin(s)]),c.push([e+r*Math.cos(s),i+n*Math.sin(s)]),W(c,null,l)}function $(t,e,i,r,n,a,s,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:[s[0],s[1]]}):l.push({op:"move",data:[s[0]+(d?0:A(h[0],o)),s[1]+(d?0:A(h[0],o))]}),c=d?[n,a]:[n+A(h[p],o),a+A(h[p],o)],l.push({op:"bcurveTo",data:[t+A(h[p],o),e+A(h[p],o),i+A(h[p],o),r+A(h[p],o),c[0],c[1]]});return l}function G(t){return[...t]}function R(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function q(t,e,i){const r=R(e,i);if(0===r)return R(t,e);let n=((t[0]-e[0])*(i[0]-e[0])+(t[1]-e[1])*(i[1]-e[1]))/r;return n=Math.max(0,Math.min(1,n)),R(t,j(e,i,n))}function j(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i]}function F(t,e,i,r){const n=r||[];if(function(t,e){const i=t[e+0],r=t[e+1],n=t[e+2],a=t[e+3];let s=3*r[0]-2*i[0]-a[0];s*=s;let o=3*r[1]-2*i[1]-a[1];o*=o;let l=3*n[0]-2*a[0]-i[0];l*=l;let h=3*n[1]-2*a[1]-i[1];return h*=h,s<l&&(s=l),o<h&&(o=h),s+o}(t,e)<i){const i=t[e+0];n.length?(a=n[n.length-1],s=i,Math.sqrt(R(a,s))>1&&n.push(i)):n.push(i),n.push(t[e+3])}else{const r=.5,a=t[e+0],s=t[e+1],o=t[e+2],l=t[e+3],h=j(a,s,r),c=j(s,o,r),u=j(o,l,r),d=j(h,c,r),p=j(c,u,r),f=j(d,p,r);F([a,h,d,f],0,i,n),F([f,p,u,l],0,i,n)}var a,s;return n}function V(t,e){return Z(t,0,t.length,e)}function Z(t,e,i,r,n){const a=n||[],s=t[e],o=t[i-1];let l=0,h=1;for(let r=e+1;r<i-1;++r){const e=q(t[r],s,o);e>l&&(l=e,h=r)}return Math.sqrt(l)>r?(Z(t,e,h+1,r,a),Z(t,h,i,r,a)):(a.length||a.push(s),a.push(o)),a}function Q(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15,i=arguments.length>2?arguments[2]:void 0;const r=[],n=(t.length-1)/3;for(let i=0;i<n;i++)F(t,3*i,e,r);return i&&i>0?Z(r,0,r.length,i):r}const H="none";class N{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,r,n){const a=this._o(n);return this._d("line",[y(t,e,i,r,a)],a)}rectangle(t,e,i,r,n){const a=this._o(n),s=[],o=w(t,e,i,r,a);if(a.fill){const n=[[t,e],[t+i,e],[t+i,e+r],[t,e+r]];"solid"===a.fillStyle?s.push(S([n],a)):s.push(L([n],a))}return a.stroke!==H&&s.push(o),this._d("rectangle",s,a)}ellipse(t,e,i,r,n){const a=this._o(n),s=[],o=P(i,r,a),l=v(t,e,a,o);if(a.fill)if("solid"===a.fillStyle){const i=v(t,e,a,o).opset;i.type="fillPath",s.push(i)}else s.push(L([l.estimatedPoints],a));return a.stroke!==H&&s.push(l.opset),this._d("ellipse",s,a)}circle(t,e,i,r){const n=this.ellipse(t,e,i,i,r);return n.shape="circle",n}linearPath(t,e){const i=this._o(e);return this._d("linearPath",[m$2(t,!1,i)],i)}arc(t,e,i,r,n,a){let s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0;const l=this._o(o),h=[],c=O(t,e,i,r,n,a,s,!0,l);if(s&&l.fill)if("solid"===l.fillStyle){const s=Object.assign({},l);s.disableMultiStroke=!0;const o=O(t,e,i,r,n,a,!0,!1,s);o.type="fillPath",h.push(o)}else h.push(function(t,e,i,r,n,a,s){const o=t,l=e;let h=Math.abs(i/2),c=Math.abs(r/2);h+=A(.01*h,s),c+=A(.01*c,s);let u=n,d=a;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)/s.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]),L([f],s)}(t,e,i,r,n,a,l));return l.stroke!==H&&h.push(c),this._d("arc",h,l)}curve(t,e){const i=this._o(e),r=[],n=x(t,i);if(i.fill&&i.fill!==H&&t.length>=3){const e=Q(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 r=[];if(3===i)r.push(G(t[0]),G(t[1]),G(t[2]),G(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 n=[],a=1-e;r.push(G(i[0]));for(let t=1;t+2<i.length;t++){const e=i[t];n[0]=[e[0],e[1]],n[1]=[e[0]+(a*i[t+1][0]-a*i[t-1][0])/6,e[1]+(a*i[t+1][1]-a*i[t-1][1])/6],n[2]=[i[t+1][0]+(a*i[t][0]-a*i[t+2][0])/6,i[t+1][1]+(a*i[t][1]-a*i[t+2][1])/6],n[3]=[i[t+1][0],i[t+1][1]],r.push(n[1],n[2],n[3])}}return r}(t),10,(1+i.roughness)/2);"solid"===i.fillStyle?r.push(S([e],i)):r.push(L([e],i))}return i.stroke!==H&&r.push(n),this._d("curve",r,i)}polygon(t,e){const i=this._o(e),r=[],n=m$2(t,!0,i);return i.fill&&("solid"===i.fillStyle?r.push(S([t],i)):r.push(L([t],i))),i.stroke!==H&&r.push(n),this._d("polygon",r,i)}path(t,e){const i=this._o(e),r=[];if(!t)return this._d("path",r,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const n=i.fill&&"transparent"!==i.fill&&i.fill!==H,a=i.stroke!==H,s=!!(i.simplification&&i.simplification<1),o=function(t,e,i){const r=g(d(f(t))),n=[];let a=[],s=[0,0],o=[];const l=()=>{o.length>=4&&a.push(...Q(o,1)),o=[]},h=()=>{l(),a.length&&(n.push(a),a=[])};for(const{key:t,data:e}of r)switch(t){case"M":h(),s=[e[0],e[1]],a.push(s);break;case"L":l(),a.push([e[0],e[1]]);break;case"C":if(!o.length){const t=a.length?a[a.length-1]:s;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(),a.push([s[0],s[1]])}if(h(),!i)return n;const c=[];for(const t of n){const e=V(t,i);e.length&&c.push(e)}return c}(t,0,s?4-4*i.simplification:(1+i.roughness)/2);return n&&("solid"===i.fillStyle?r.push(S(o,i)):r.push(L(o,i))),a&&(s?o.forEach((t=>{r.push(m$2(t,!1,i))})):r.push(function(t,e){const i=g(d(f(t))),r=[];let n=[0,0],a=[0,0];for(const{key:t,data:s}of i)switch(t){case"M":{const t=1*(e.maxRandomnessOffset||0),i=e.preserveVertices;r.push({op:"move",data:s.map((r=>r+(i?0:A(t,e))))}),a=[s[0],s[1]],n=[s[0],s[1]];break}case"L":r.push(...I(a[0],a[1],s[0],s[1],e)),a=[s[0],s[1]];break;case"C":{const[t,i,n,o,l,h]=s;r.push(...$(t,i,n,o,l,h,a,e)),a=[l,h];break}case"Z":r.push(...I(a[0],a[1],n[0],n[1],e)),a=[n[0],n[1]]}return{type:"path",ops:r}}(t,i))),this._d("path",r,i)}opsToPath(t,e){let i="";for(const r of t.ops){const t="number"==typeof e&&e>=0?r.data.map((t=>+t.toFixed(e))):r.data;switch(r.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,r=[];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:H};break;case"fillPath":e={d:this.opsToPath(t),stroke:H,strokeWidth:0,fill:i.fill||H};break;case"fillSketch":e=this.fillSketch(t,i)}e&&r.push(e)}return r}fillSketch(t,e){let i=e.fillWeight;return i<0&&(i=e.strokeWidth/2),{d:this.opsToPath(t),stroke:e.fill||H,strokeWidth:i,fill:H}}}class B{constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new N(e)}draw(t){const e=t.sets||[],i=t.options||this.getDefaultOptions(),r=this.ctx,n=t.options.fixedDecimalPlaceDigits;for(const a of e)switch(a.type){case"path":r.save(),r.strokeStyle="none"===i.stroke?"transparent":i.stroke,r.lineWidth=i.strokeWidth,i.strokeLineDash&&r.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(r.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(r,a,n),r.restore();break;case"fillPath":{r.save(),r.fillStyle=i.fill||"";const e="curve"===t.shape||"polygon"===t.shape||"path"===t.shape?"evenodd":"nonzero";this._drawToContext(r,a,n,e),r.restore();break}case"fillSketch":this.fillSketch(r,a,i)}}fillSketch(t,e,i){let r=i.fillWeight;r<0&&(r=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=r,this._drawToContext(t,e,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"nonzero";t.beginPath();for(const r of e.ops){const e="number"==typeof i&&i>=0?r.data.map((t=>+t.toFixed(i))):r.data;switch(r.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(r):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,e,i,r,n){const a=this.gen.line(t,e,i,r,n);return this.draw(a),a}rectangle(t,e,i,r,n){const a=this.gen.rectangle(t,e,i,r,n);return this.draw(a),a}ellipse(t,e,i,r,n){const a=this.gen.ellipse(t,e,i,r,n);return this.draw(a),a}circle(t,e,i,r){const n=this.gen.circle(t,e,i,r);return this.draw(n),n}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,r,n,a){let s=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,r,n,a,s,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}}const J="http://www.w3.org/2000/svg";class K{constructor(t,e){this.svg=t,this.gen=new N(e)}draw(t){const e=t.sets||[],i=t.options||this.getDefaultOptions(),r=this.svg.ownerDocument||window.document,n=r.createElementNS(J,"g"),a=t.options.fixedDecimalPlaceDigits;for(const s of e){let e=null;switch(s.type){case"path":e=r.createElementNS(J,"path"),e.setAttribute("d",this.opsToPath(s,a)),e.setAttribute("stroke",i.stroke),e.setAttribute("stroke-width",i.strokeWidth+""),e.setAttribute("fill","none"),i.strokeLineDash&&e.setAttribute("stroke-dasharray",i.strokeLineDash.join(" ").trim()),i.strokeLineDashOffset&&e.setAttribute("stroke-dashoffset",`${i.strokeLineDashOffset}`);break;case"fillPath":e=r.createElementNS(J,"path"),e.setAttribute("d",this.opsToPath(s,a)),e.setAttribute("stroke","none"),e.setAttribute("stroke-width","0"),e.setAttribute("fill",i.fill||""),"curve"!==t.shape&&"polygon"!==t.shape||e.setAttribute("fill-rule","evenodd");break;case"fillSketch":e=this.fillSketch(r,s,i)}e&&n.appendChild(e)}return n}fillSketch(t,e,i){let r=i.fillWeight;r<0&&(r=i.strokeWidth/2);const n=t.createElementNS(J,"path");return n.setAttribute("d",this.opsToPath(e,i.fixedDecimalPlaceDigits)),n.setAttribute("stroke",i.fill||""),n.setAttribute("stroke-width",r+""),n.setAttribute("fill","none"),i.fillLineDash&&n.setAttribute("stroke-dasharray",i.fillLineDash.join(" ").trim()),i.fillLineDashOffset&&n.setAttribute("stroke-dashoffset",`${i.fillLineDashOffset}`),n}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,e){return this.gen.opsToPath(t,e)}line(t,e,i,r,n){const a=this.gen.line(t,e,i,r,n);return this.draw(a)}rectangle(t,e,i,r,n){const a=this.gen.rectangle(t,e,i,r,n);return this.draw(a)}ellipse(t,e,i,r,n){const a=this.gen.ellipse(t,e,i,r,n);return this.draw(a)}circle(t,e,i,r){const n=this.gen.circle(t,e,i,r);return this.draw(n)}linearPath(t,e){const i=this.gen.linearPath(t,e);return this.draw(i)}polygon(t,e){const i=this.gen.polygon(t,e);return this.draw(i)}arc(t,e,i,r,n,a){let s=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,r,n,a,s,o);return this.draw(l)}curve(t,e){const i=this.gen.curve(t,e);return this.draw(i)}path(t,e){const i=this.gen.path(t,e);return this.draw(i)}}var U={canvas:(t,e)=>new B(t,e),svg:(t,e)=>new K(t,e),generator:t=>new N(t),newSeed:()=>N.newSeed()};const defaultRouthThemeSpec={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 RoughBaseRender{drawShape(t,e,i,r,n,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,i,r,n,a,s,o)}}var __decorate$15=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$T=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$B=function(t,e){return function(i,r){e(i,r,t)}};let RoughCanvasArcRender=class extends RoughBaseRender{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="arc",this.numberType=ARC_NUMBER_TYPE}draw(t,e,i,r){const{context:n}=i;if(!n)return;const a=n.canvas.nativeCanvas,s=U.canvas(a);n.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,n.setTransformForCurrent()}else l=0,h=0,n.transformFromMatrix(t.transMatrix,!0);const c=new CustomPath2D,{fill:u=o.fill,stroke:d=o.stroke,lineWidth:p=o.lineWidth,outerRadius:f=o.outerRadius,innerRadius:m=o.innerRadius,maxRandomnessOffset:g=defaultRouthThemeSpec.maxRandomnessOffset,roughness:y=defaultRouthThemeSpec.roughness,bowing:v=defaultRouthThemeSpec.bowing,curveFitting:b=defaultRouthThemeSpec.curveFitting,curveTightness:x=defaultRouthThemeSpec.curveTightness,curveStepCount:C=defaultRouthThemeSpec.curveStepCount,fillStyle:_=defaultRouthThemeSpec.fillStyle,fillWeight:T=defaultRouthThemeSpec.fillWeight,hachureAngle:A=defaultRouthThemeSpec.hachureAngle,hachureGap:S=defaultRouthThemeSpec.hachureGap,simplification:P=defaultRouthThemeSpec.simplification,dashOffset:w=defaultRouthThemeSpec.dashOffset,dashGap:M=defaultRouthThemeSpec.dashGap,zigzagOffset:E=defaultRouthThemeSpec.zigzagOffset,seed:R=defaultRouthThemeSpec.seed,fillLineDash:B=defaultRouthThemeSpec.fillLineDash,fillLineDashOffset:k=defaultRouthThemeSpec.fillLineDashOffset,disableMultiStroke:D=defaultRouthThemeSpec.disableMultiStroke,disableMultiStrokeFill:I=defaultRouthThemeSpec.disableMultiStrokeFill,preserveVertices:L=defaultRouthThemeSpec.preserveVertices,fixedDecimalPlaceDigits:O=defaultRouthThemeSpec.fixedDecimalPlaceDigits}=t.attribute;drawArcPath$1(t,c,l,h,f,m),s.path(c.toString(),{fill:u||void 0,stroke:d||void 0,strokeWidth:p,maxRandomnessOffset:g,roughness:y,bowing:v,curveFitting:b,curveTightness:x,curveStepCount:C,fillStyle:_,fillWeight:T,hachureAngle:A,hachureGap:S,simplification:P,dashOffset:w,dashGap:M,zigzagOffset:E,seed:R,fillLineDash:B,fillLineDashOffset:k,disableMultiStroke:D,disableMultiStrokeFill:I,preserveVertices:L,fixedDecimalPlaceDigits:O}),n.highPerformanceRestore()}};RoughCanvasArcRender=__decorate$15([injectable(),__param$B(0,inject(exports.DefaultCanvasArcRender)),__metadata$T("design:paramtypes",[Object])],RoughCanvasArcRender);var __decorate$14=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let RoughCanvasAreaRender=class extends exports.DefaultCanvasAreaRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f){if(f)return super.drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f);t.highPerformanceSave();const m=t.canvas.nativeCanvas,g=U.canvas(m,{}),y=new CustomPath2D;drawAreaSegments(y,e,l,{offsetX:h,offsetY:c});const{maxRandomnessOffset:v=defaultRouthThemeSpec.maxRandomnessOffset,roughness:b=defaultRouthThemeSpec.roughness,bowing:x=defaultRouthThemeSpec.bowing,curveFitting:C=defaultRouthThemeSpec.curveFitting,curveTightness:_=defaultRouthThemeSpec.curveTightness,curveStepCount:T=defaultRouthThemeSpec.curveStepCount,fillStyle:A=defaultRouthThemeSpec.fillStyle,fillWeight:S=defaultRouthThemeSpec.fillWeight,hachureAngle:P=defaultRouthThemeSpec.hachureAngle,hachureGap:w=defaultRouthThemeSpec.hachureGap,simplification:M=defaultRouthThemeSpec.simplification,dashOffset:E=defaultRouthThemeSpec.dashOffset,dashGap:R=defaultRouthThemeSpec.dashGap,zigzagOffset:B=defaultRouthThemeSpec.zigzagOffset,seed:k=defaultRouthThemeSpec.seed,fillLineDash:D=defaultRouthThemeSpec.fillLineDash,fillLineDashOffset:I=defaultRouthThemeSpec.fillLineDashOffset,disableMultiStroke:L=defaultRouthThemeSpec.disableMultiStroke,disableMultiStrokeFill:O=defaultRouthThemeSpec.disableMultiStrokeFill,preserveVertices:F=defaultRouthThemeSpec.preserveVertices,fixedDecimalPlaceDigits:G=defaultRouthThemeSpec.fixedDecimalPlaceDigits}=s;let{fill:N,stroke:j,lineWidth:$}=s;return Array.isArray(o)?o.forEach((t=>{N=null!=N?N:t.fill,j=null!=j?j:t.stroke,$=null!=$?$:t.lineWidth})):(N=null!=N?N:o.fill,j=null!=j?j:o.stroke,$=null!=$?$:o.lineWidth),g.path(y.toString(),{fill:i?N:void 0,strokeWidth:$,maxRandomnessOffset:v,roughness:b,bowing:x,curveFitting:C,curveTightness:_,curveStepCount:T,fillStyle:A,fillWeight:S,hachureAngle:P,hachureGap:w,simplification:M,dashOffset:E,dashGap:R,zigzagOffset:B,seed:k,fillLineDash:D,fillLineDashOffset:I,disableMultiStroke:L,disableMultiStrokeFill:O,preserveVertices:F,fixedDecimalPlaceDigits:G}),t.highPerformanceRestore(),!1}};RoughCanvasAreaRender=__decorate$14([injectable()],RoughCanvasAreaRender);var __decorate$13=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$A=function(t,e){return function(i,r){e(i,r,t)}};let RoughCanvasCircleRender=class extends RoughBaseRender{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="circle",this.numberType=CIRCLE_NUMBER_TYPE}draw(t,e,i,r){const{context:n}=i;if(!n)return;const a=n.canvas.nativeCanvas,s=U.canvas(a,{}),o=t.getGraphicTheme();let{x:l=o.x,y:h=o.y}=t.attribute;t.transMatrix.onlyTranslate()?n.onlyTranslate()||n.clearMatrix():(l=0,h=0,n.transformFromMatrix(t.transMatrix,!0));const{radius:c=o.radius,fill:u=o.fill,stroke:d=o.stroke,lineWidth:p=o.lineWidth}=t.attribute;s.circle(l,h,c,{fill:u||void 0,stroke:d||void 0,strokeWidth:p,fillStyle:"zigzag",roughness:.5})}};RoughCanvasCircleRender=__decorate$13([injectable(),__param$A(0,inject(exports.DefaultCanvasCircleRender)),__metadata$S("design:paramtypes",[Object])],RoughCanvasCircleRender);var __decorate$12=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let RoughCanvasLineRender=class extends exports.DefaultCanvasLineRender{constructor(){super(...arguments),this.style="rough"}drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f){if(p||f)return super.drawSegmentItem(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f);t.highPerformanceSave();const m=t.canvas.nativeCanvas,g=U.canvas(m,{}),y=new CustomPath2D;drawSegments(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:u});const{maxRandomnessOffset:v=defaultRouthThemeSpec.maxRandomnessOffset,roughness:b=defaultRouthThemeSpec.roughness,bowing:x=defaultRouthThemeSpec.bowing,curveFitting:C=defaultRouthThemeSpec.curveFitting,curveTightness:_=defaultRouthThemeSpec.curveTightness,curveStepCount:T=defaultRouthThemeSpec.curveStepCount,fillStyle:A=defaultRouthThemeSpec.fillStyle,fillWeight:S=defaultRouthThemeSpec.fillWeight,hachureAngle:P=defaultRouthThemeSpec.hachureAngle,hachureGap:w=defaultRouthThemeSpec.hachureGap,simplification:M=defaultRouthThemeSpec.simplification,dashOffset:E=defaultRouthThemeSpec.dashOffset,dashGap:R=defaultRouthThemeSpec.dashGap,zigzagOffset:B=defaultRouthThemeSpec.zigzagOffset,seed:k=defaultRouthThemeSpec.seed,fillLineDash:D=defaultRouthThemeSpec.fillLineDash,fillLineDashOffset:I=defaultRouthThemeSpec.fillLineDashOffset,disableMultiStroke:L=defaultRouthThemeSpec.disableMultiStroke,disableMultiStrokeFill:O=defaultRouthThemeSpec.disableMultiStrokeFill,preserveVertices:F=defaultRouthThemeSpec.preserveVertices,fixedDecimalPlaceDigits:G=defaultRouthThemeSpec.fixedDecimalPlaceDigits}=s;let{fill:N,stroke:j,lineWidth:$}=s;return Array.isArray(o)?o.forEach((t=>{N=null!=N?N:t.fill,j=null!=j?j:t.stroke,$=null!=$?$:t.lineWidth})):(N=null!=N?N:o.fill,j=null!=j?j:o.stroke,$=null!=$?$:o.lineWidth),g.path(y.toString(),{fill:i?N:void 0,stroke:r?j:void 0,strokeWidth:$,maxRandomnessOffset:v,roughness:b,bowing:x,curveFitting:C,curveTightness:_,curveStepCount:T,fillStyle:A,fillWeight:S,hachureAngle:P,hachureGap:w,simplification:M,dashOffset:E,dashGap:R,zigzagOffset:B,seed:k,fillLineDash:D,fillLineDashOffset:I,disableMultiStroke:L,disableMultiStrokeFill:O,preserveVertices:F,fixedDecimalPlaceDigits:G}),t.highPerformanceRestore(),!1}};RoughCanvasLineRender=__decorate$12([injectable()],RoughCanvasLineRender);var __decorate$11=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$R=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$z=function(t,e){return function(i,r){e(i,r,t)}};let RoughCanvasPathRender=class extends RoughBaseRender{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="path",this.numberType=PATH_NUMBER_TYPE}draw(t,e,i,r){const{context:n}=i;if(!n)return;const a=n.canvas.nativeCanvas,s=U.canvas(a,{});n.highPerformanceSave();const o=t.getGraphicTheme();n.transformFromMatrix(t.transMatrix,!0);const{fill:l=o.fill,stroke:h=o.stroke,lineWidth:c=o.lineWidth,path:u=o.path,maxRandomnessOffset:d=defaultRouthThemeSpec.maxRandomnessOffset,roughness:p=defaultRouthThemeSpec.roughness,bowing:f=defaultRouthThemeSpec.bowing,curveFitting:m=defaultRouthThemeSpec.curveFitting,curveTightness:g=defaultRouthThemeSpec.curveTightness,curveStepCount:y=defaultRouthThemeSpec.curveStepCount,fillStyle:v=defaultRouthThemeSpec.fillStyle,fillWeight:b=defaultRouthThemeSpec.fillWeight,hachureAngle:x=defaultRouthThemeSpec.hachureAngle,hachureGap:C=defaultRouthThemeSpec.hachureGap,simplification:_=defaultRouthThemeSpec.simplification,dashOffset:T=defaultRouthThemeSpec.dashOffset,dashGap:A=defaultRouthThemeSpec.dashGap,zigzagOffset:S=defaultRouthThemeSpec.zigzagOffset,seed:P=defaultRouthThemeSpec.seed,fillLineDash:w=defaultRouthThemeSpec.fillLineDash,fillLineDashOffset:M=defaultRouthThemeSpec.fillLineDashOffset,disableMultiStroke:E=defaultRouthThemeSpec.disableMultiStroke,disableMultiStrokeFill:R=defaultRouthThemeSpec.disableMultiStrokeFill,preserveVertices:B=defaultRouthThemeSpec.preserveVertices,fixedDecimalPlaceDigits:k=defaultRouthThemeSpec.fixedDecimalPlaceDigits}=t.attribute;"string"==typeof u&&s.path(u,{fill:l||void 0,stroke:h||void 0,strokeWidth:c,maxRandomnessOffset:d,roughness:p,bowing:f,curveFitting:m,curveTightness:g,curveStepCount:y,fillStyle:v,fillWeight:b,hachureAngle:x,hachureGap:C,simplification:_,dashOffset:T,dashGap:A,zigzagOffset:S,seed:P,fillLineDash:w,fillLineDashOffset:M,disableMultiStroke:E,disableMultiStrokeFill:R,preserveVertices:B,fixedDecimalPlaceDigits:k}),n.highPerformanceRestore()}};RoughCanvasPathRender=__decorate$11([injectable(),__param$z(0,inject(exports.DefaultCanvasPathRender)),__metadata$R("design:paramtypes",[Object])],RoughCanvasPathRender);var __decorate$10=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$Q=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$y=function(t,e){return function(i,r){e(i,r,t)}};let RoughCanvasRectRender=class extends RoughBaseRender{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="rect",this.numberType=RECT_NUMBER_TYPE}draw(t,e,i,r){const{context:n}=i;if(!n)return;const a=n.canvas.nativeCanvas,s=U.canvas(a);n.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,n.setTransformForCurrent()}else l=0,h=0,n.transformFromMatrix(t.transMatrix,!0);const{fill:c=o.fill,stroke:u=o.stroke,fillColor:d=o.fill,strokeColor:p=o.stroke,x1:f,y1:m,lineWidth:g=o.lineWidth,maxRandomnessOffset:y=defaultRouthThemeSpec.maxRandomnessOffset,roughness:v=defaultRouthThemeSpec.roughness,bowing:b=defaultRouthThemeSpec.bowing,curveFitting:x=defaultRouthThemeSpec.curveFitting,curveTightness:C=defaultRouthThemeSpec.curveTightness,curveStepCount:_=defaultRouthThemeSpec.curveStepCount,fillStyle:T=defaultRouthThemeSpec.fillStyle,fillWeight:A=defaultRouthThemeSpec.fillWeight,hachureAngle:S=defaultRouthThemeSpec.hachureAngle,hachureGap:P=defaultRouthThemeSpec.hachureGap,simplification:w=defaultRouthThemeSpec.simplification,dashOffset:M=defaultRouthThemeSpec.dashOffset,dashGap:E=defaultRouthThemeSpec.dashGap,zigzagOffset:R=defaultRouthThemeSpec.zigzagOffset,seed:B=defaultRouthThemeSpec.seed,fillLineDash:k=defaultRouthThemeSpec.fillLineDash,fillLineDashOffset:D=defaultRouthThemeSpec.fillLineDashOffset,disableMultiStroke:I=defaultRouthThemeSpec.disableMultiStroke,disableMultiStrokeFill:L=defaultRouthThemeSpec.disableMultiStrokeFill,preserveVertices:O=defaultRouthThemeSpec.preserveVertices,fixedDecimalPlaceDigits:F=defaultRouthThemeSpec.fixedDecimalPlaceDigits}=t.attribute;let{width:G=o.width,height:N=o.height}=t.attribute;G=(null!=G?G:f-l)||0,N=(null!=N?N:m-h)||0,s.rectangle(l,h,G,N,{fill:c?d:void 0,stroke:u?p:void 0,strokeWidth:g,maxRandomnessOffset:y,roughness:v,bowing:b,curveFitting:x,curveTightness:C,curveStepCount:_,fillStyle:T,fillWeight:A,hachureAngle:S,hachureGap:P,simplification:w,dashOffset:M,dashGap:E,zigzagOffset:R,seed:B,fillLineDash:k,fillLineDashOffset:D,disableMultiStroke:I,disableMultiStrokeFill:L,preserveVertices:O,fixedDecimalPlaceDigits:F}),n.highPerformanceRestore()}};RoughCanvasRectRender=__decorate$10([injectable(),__param$y(0,inject(exports.DefaultCanvasRectRender)),__metadata$Q("design:paramtypes",[Object])],RoughCanvasRectRender);var __decorate$$=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$P=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$x=function(t,e){return function(i,r){e(i,r,t)}};let RoughCanvasSymbolRender=class extends BaseRender{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=SYMBOL_NUMBER_TYPE,this.style="rough"}draw(t,e,i,r){const{context:n}=i;if(!n)return;const a=n.canvas.nativeCanvas,s=U.canvas(a);n.highPerformanceSave();const o=t.getGraphicTheme(),l=this.transform(t,o,n),{x:h,y:c,z:u,lastModelMatrix:d}=l,p=t.getParsedPath();if(!p)return;const{fill:f=o.fill,stroke:m=o.stroke,fillColor:g=o.fill,strokeColor:y=o.stroke,size:v=o.size,lineWidth:b=o.lineWidth,maxRandomnessOffset:x=defaultRouthThemeSpec.maxRandomnessOffset,roughness:C=defaultRouthThemeSpec.roughness,bowing:_=defaultRouthThemeSpec.bowing,curveFitting:T=defaultRouthThemeSpec.curveFitting,curveTightness:A=defaultRouthThemeSpec.curveTightness,curveStepCount:S=defaultRouthThemeSpec.curveStepCount,fillStyle:P=defaultRouthThemeSpec.fillStyle,fillWeight:w=defaultRouthThemeSpec.fillWeight,hachureAngle:M=defaultRouthThemeSpec.hachureAngle,hachureGap:E=defaultRouthThemeSpec.hachureGap,simplification:R=defaultRouthThemeSpec.simplification,dashOffset:B=defaultRouthThemeSpec.dashOffset,dashGap:k=defaultRouthThemeSpec.dashGap,zigzagOffset:D=defaultRouthThemeSpec.zigzagOffset,seed:I=defaultRouthThemeSpec.seed,fillLineDash:L=defaultRouthThemeSpec.fillLineDash,fillLineDashOffset:O=defaultRouthThemeSpec.fillLineDashOffset,disableMultiStroke:F=defaultRouthThemeSpec.disableMultiStroke,disableMultiStrokeFill:G=defaultRouthThemeSpec.disableMultiStrokeFill,preserveVertices:N=defaultRouthThemeSpec.preserveVertices,fixedDecimalPlaceDigits:j=defaultRouthThemeSpec.fixedDecimalPlaceDigits}=t.attribute;let $="";if(p.drawToSvgPath)$=p.drawToSvgPath(v,h,c);else{const t=new CustomPath2D;p.draw(t,v,h,c)&&t.closePath(),$=t.toString()}s.path($,{fill:f?g:void 0,stroke:m?y:void 0,strokeWidth:b,maxRandomnessOffset:x,roughness:C,bowing:_,curveFitting:T,curveTightness:A,curveStepCount:S,fillStyle:P,fillWeight:w,hachureAngle:M,hachureGap:E,simplification:R,dashOffset:B,dashGap:k,zigzagOffset:D,seed:I,fillLineDash:L,fillLineDashOffset:O,disableMultiStroke:F,disableMultiStrokeFill:G,preserveVertices:N,fixedDecimalPlaceDigits:j}),n.highPerformanceRestore()}drawShape(t,e,i,r,n,a,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(t,e,i,r,n,a,s,o)}};RoughCanvasSymbolRender=__decorate$$([injectable(),__param$x(0,inject(exports.DefaultCanvasSymbolRender)),__metadata$P("design:paramtypes",[Object])],RoughCanvasSymbolRender);var _roughModule=new ContainerModule((t=>{t(RoughCanvasCircleRender).toSelf().inSingletonScope(),t(GraphicRender).to(RoughCanvasCircleRender),t(RoughCanvasRectRender).toSelf().inSingletonScope(),t(GraphicRender).to(RoughCanvasRectRender),t(RoughCanvasPathRender).toSelf().inSingletonScope(),t(GraphicRender).to(RoughCanvasPathRender),t(RoughCanvasSymbolRender).toSelf().inSingletonScope(),t(GraphicRender).to(RoughCanvasSymbolRender),t(RoughCanvasLineRender).toSelf().inSingletonScope(),t(GraphicRender).to(RoughCanvasLineRender),t(RoughCanvasAreaRender).toSelf().inSingletonScope(),t(GraphicRender).to(RoughCanvasAreaRender),t(RoughCanvasArcRender).toSelf().inSingletonScope(),t(GraphicRender).to(RoughCanvasArcRender)}));const MathPickerContribution=Symbol.for("MathPickerContribution"),MathArcPicker=Symbol.for("MathArcPicker"),MathAreaPicker=Symbol.for("MathAreaPicker"),MathCirclePicker=Symbol.for("MathCirclePicker"),MathImagePicker=Symbol.for("MathImagePicker"),MathLinePicker=Symbol.for("MathLinePicker"),MathPathPicker=Symbol.for("MathPathPicker"),MathRectPicker=Symbol.for("MathRectPicker"),MathSymbolPicker=Symbol.for("MathSymbolPicker"),MathTextPicker=Symbol.for("MathTextPicker"),MathPolygonPicker=Symbol.for("MathPolygonPicker"),MathGlyphPicker=Symbol.for("MathGlyphPicker"),CanvasArcPicker=Symbol.for("CanvasArcPicker"),CanvasArc3dPicker=Symbol.for("CanvasArc3dPicker"),CanvasAreaPicker=Symbol.for("CanvasAreaPicker"),CanvasCirclePicker=Symbol.for("CanvasCirclePicker"),CanvasImagePicker=Symbol.for("CanvasImagePicker"),CanvasLinePicker=Symbol.for("CanvasLinePicker"),CanvasLottiePicker=Symbol.for("CanvasLottiePicker"),CanvasPathPicker=Symbol.for("CanvasPathPicker"),CanvasRectPicker=Symbol.for("CanvasRectPicker"),CanvasRect3dPicker=Symbol.for("CanvasRect3dPicker"),CanvasSymbolPicker=Symbol.for("CanvasSymbolPicker"),CanvasTextPicker=Symbol.for("CanvasTextPicker"),CanvasPolygonPicker=Symbol.for("CanvasPolygonPicker"),CanvasPyramid3dPicker=Symbol.for("CanvasPyramid3dPicker"),CanvasRichTextPicker=Symbol.for("CanvasRichTextPicker"),CanvasGlyphPicker=Symbol.for("CanvasGlyphPicker"),CanvasGroupPicker=Symbol.for("CanvasGroupPicker"),CanvasPickerContribution=Symbol.for("CanvasPickerContribution"),REACT_TO_CANOPUS_EVENTS={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"},REACT_TO_CANOPUS_EVENTS_LIST=Object.keys(REACT_TO_CANOPUS_EVENTS);function VArc(t){return graphicCreator.arc(t?t.attribute:{})}function VArc3d(t){return graphicCreator.arc3d(t?t.attribute:{})}function VArea(t){return graphicCreator.area(t?t.attribute:{})}function VCircle(t){return graphicCreator.circle(t?t.attribute:{})}function VGroup(t){return graphicCreator.group(t?t.attribute:{})}function VGlyph(t){return graphicCreator.glyph(t?t.attribute:{})}function VImage(t){return graphicCreator.image(t?t.attribute:{})}function VLine(t){return graphicCreator.line(t?t.attribute:{})}function VPath(t){return graphicCreator.path(t?t.attribute:{})}function VPolygon(t){return graphicCreator.polygon(t?t.attribute:{})}function VPyramid3d(t){return graphicCreator.pyramid3d(t?t.attribute:{})}function VRect(t){return graphicCreator.rect(t?t.attribute:{})}function VRect3d(t){return graphicCreator.rect3d(t?t.attribute:{})}function VSymbol(t){return graphicCreator.symbol(t?t.attribute:{})}function VText(t){return graphicCreator.text(t?t.attribute:{})}function VRichText(t){return graphicCreator.richtext(t?t.attribute:{})}VRichText.Text=function(t){return Object.assign({type:"rich/text"},t)},VRichText.Image=function(t){return Object.assign({type:"rich/image"},t)};var __rest=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(i[r[n]]=t[r[n]])}return i};function flatten(t,e){if(isArray$1(t))return t.forEach((t=>flatten(t,e)));e.push(t)}function jsx(t,e){const i=e||{},{key:r,name:n,id:a,attribute:s,stateProxy:o}=i,l=__rest(i,["key","name","id","attribute","stateProxy"]);let h=t;isString$1(t)&&(h=graphicCreator[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&&flatten(1===d.length?d[0]:d,c);const f="Group"===h.name?new h(s):h(e);return parseToGraphic$1(f,c,l),o&&(f.stateProxy=o),f}function parseToGraphic$1(t,e,i){let r,n=!1;switch(t.type){case"richtext":case"rich/image":break;case"rich/text":r=t.attribute||{},e[0]&&(r.text=e[0]);break;default:n=!0}n?(e.forEach((e=>{e&&t.add(e)})),Object.keys(i).forEach((e=>{const r=REACT_TO_CANOPUS_EVENTS[e];r&&t.on(r,i[e])}))):"richtext"===t.type&&(t.attribute.textConfig=e.map((t=>t.attribute)).filter((t=>t)))}const Fragment=Group;function decodeReactDom(t){if(!t||!t.$$typeof)return t;const e=t.type,{attribute:i,children:r,stateProxy:n,id:a,name:s}=t.props,o=e({attribute:i});return parseToGraphic(o,t.props,r)||(n&&(o.stateProxy=n),o.id=a,o.name=s,parseChildren(r,o),o)}function parseChildren(t,e){isArray$1(t)?t.forEach((t=>{if(isArray$1(t))parseChildren(t,e);else{const i=decodeReactDom(t);i&&i.type&&e.add(i)}})):t&&e.add(decodeReactDom(t))}function parseToGraphic(t,e,i){let r,n=!1;switch(t.type){case"richtext":break;case"rich/text":r=t.attribute||{},i&&(r.text=i),t.attribute=r;break;case"rich/image":r=t.attribute||{};break;default:n=!0}return n?Object.keys(e).forEach((i=>{const r=REACT_TO_CANOPUS_EVENTS[i];r&&t.on(r,e[i])})):"richtext"===t.type&&(t.attribute.textConfig=i.map((t=>decodeReactDom(t))).filter((t=>t))),r}class DragNDrop{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,r=e===i;if(e&&!r){let n,a=!1;function s(t){if(a||(t.type="dragstart",null==e||e.dispatchEvent(t),a=!0),t.type="drag",null==e||e.dispatchEvent(t),!r){e.attribute.pickable=!1;const r=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.attribute.pickable=!0,n!==r&&(n&&(t.type="dragleave",t.target=n,n.dispatchEvent(t)),r&&(t.type="dragenter",t.target=r,r.dispatchEvent(t)),n=r,n&&(t.type="dragover",t.target=n,n.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",s);const o=function(){a&&(n&&(t.type="drop",t.target=n,n.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),a=!1),null==i||i.removeEventListener("pointermove",s)};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}}const calcDirection=(t,e)=>{const i=e.x-t.x,r=e.y-t.y;return Math.abs(i)>Math.abs(r)?i>0?"right":"left":r>0?"down":"up"},calcDistance=(t,e)=>{const i=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);return Math.sqrt(i*i+r*r)},getCenter=t=>{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,r=0,n=0;for(;n<e;)i+=t[n].x,r+=t[n].y,n++;return{x:Math.round(i/e),y:Math.round(r/e)}};class Gesture extends EventEmitter{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,r,n,a,s,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=clock.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:r,y:n}=e[t],a={x:r,y:n};i[t]=a}if(1!==i.length)this.startDistance=calcDistance(i[0],i[1]),this.center=getCenter([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 r=t.clone(),{x:n,y:a,pointerId:s}=r;for(let t=0,e=i.length;t<e;t++)if(s===i[t].pointerId){i[t]=r;break}const o={x:n,y:a},l=i.map((t=>({x:t.x,y:t.y}))),h=clock.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,s=a-t.y,h=this.direction||calcDirection(t,o);this.direction=h;const c=this.getEventType(o);return r.direction=h,r.deltaX=i,r.deltaY=s,r.points=l,this.triggerStartEvent(c,r),void this.triggerEvent(c,r)}const{startDistance:c}=this,u=calcDistance(l[0],l[1]);r.scale=u/c,r.center=this.center,r.points=l,this.triggerStartEvent("pinch",r),this.triggerEvent("pinch",r)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:r}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=clock.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||r[0],n=this.lastMovePoint||r[0],a=calcDistance(i,n),s=a/t;if(s>this.config.swipe.velocity&&a>this.config.swipe.threshold)return e.velocity=s,e.direction=calcDirection(i,n),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,n=i.length;t<n;t++)if(i[t].pointerId===e.pointerId){i.splice(t,1),r.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!==(r=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==r?r:251,threshold:null!==(a=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==a?a:9},swipe:{threshold:null!==(o=null===(s=null==e?void 0:e.swipe)||void 0===s?void 0:s.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:r}=this;if("press"===e)return e;let n;return n=clock.now()-i>this.config.press.time&&calcDistance(r[0],t)<this.config.press.threshold?"press":"pan",this.eventType=n,n}enable(t){this.processEvent[t]=!0}isProcess(t){return this.processEvent[t]}pushEvent(t,e){const{emitThrottles:i}=this,r={type:t,ev:e};for(let e=0,n=i.length;e<n;e++)if(i[e].type===t)return void i.splice(e,1,r);i.push(r)}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:r}=this;i||(this.throttleTimer=application.global.getRequestAnimationFrame()((()=>{application.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=r.length;t<e;t++){const{type:e,ev:i}=r[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){if(!this.element)return;const i=this.element._events[WILDCARD];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let r=0,n=i.length;r<n&&!e.propagationImmediatelyStopped;r++)i[r].fn.call(i[r].context,e,t);this.emit(t,e)}}var __decorate$_=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$O=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const outP=[0,0,0],addArcToBezierPath=(t,e,i,r,n,a,s,o)=>{if(o)for(;i>e;)i-=pi2;else for(;i<e;)i+=pi2;const l=pi/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),m=Math.sin(c),g=d*a+r,y=p*s+n,v=f*a+r,b=m*s+n,x=a*o*u,C=s*o*u;t.push([g-x*p,y+C*d,v+x*m,b-C*f,v,b]),h=c}};let BrowserContext2d=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({},DefaultFillStyle),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},DefaultStrokeStyle),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},DefaultTextStyle),{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 Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Matrix(1,0,0,1,0,0),this._clearMatrix=new Matrix(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&Logger.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Matrix(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 matrixAllocate.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&&(matrixAllocate.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(matrixAllocate.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,r){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,r,!1),this.scale(t,e,!1),this.translate(-i,-r,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,r,n,a){let s=!(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*r,o*n,o*a),s&&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,r,n,a){let s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,r,n,a),s&&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 r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),r&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),r&&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,r,n,a,s){if(s=s||0,this.camera){const o=[];addArcToBezierPath(o,r,n,t,e,i,i,a);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],s)}}else this.nativeContext.arc(t,e,Math.max(0,i),r,n,a)}arcTo(t,e,i,r,n){this.nativeContext.arcTo(t,e,i,r,n)}bezierCurveTo(t,e,i,r,n,a,s){if(s=s||0,this.camera){let o=s,l=s;this.modelMatrix&&(transformMat4(outP,[t,e,s],this.modelMatrix),t=outP[0],e=outP[1],o=outP[2],transformMat4(outP,[i,r,s],this.modelMatrix),i=outP[0],r=outP[1],l=outP[2],transformMat4(outP,[n,a,s],this.modelMatrix),n=outP[0],a=outP[1],s=outP[2]);let h=this.camera.vp(n,a,s);n=h.x,a=h.y,h=this.camera.vp(t,e,o),t=h.x,e=h.y,h=this.camera.vp(i,r,l),i=h.x,r=h.y}this.nativeContext.bezierCurveTo(t,e,i,r,n,a)}closePath(){this.nativeContext.closePath()}ellipse(t,e,i,r,n,a,s,o){null==o?this.nativeContext.ellipse(t,e,i,r,n,a,s):this.nativeContext.ellipse(t,e,i,r,n,a,s,o)}lineTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(transformMat4(outP,[t,e,i],this.modelMatrix),t=outP[0],e=outP[1],i=outP[2]);const r=this.camera.vp(t,e,i);t=r.x,e=r.y}this.nativeContext.lineTo(t,e)}moveTo(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(transformMat4(outP,[t,e,i],this.modelMatrix),t=outP[0],e=outP[1],i=outP[2]);const r=this.camera.vp(t,e,i);t=r.x,e=r.y}this.nativeContext.moveTo(t,e)}quadraticCurveTo(t,e,i,r,n){if(n=n||0,this.camera){let a=n;this.modelMatrix&&(transformMat4(outP,[t,e,n],this.modelMatrix),t=outP[0],e=outP[1],a=outP[2],transformMat4(outP,[i,r,n],this.modelMatrix),i=outP[0],r=outP[1],n=outP[2]);let s=this.camera.vp(i,r,n);i=s.x,r=s.y,s=this.camera.vp(t,e,a),t=s.x,e=s.y}this.nativeContext.quadraticCurveTo(t,e,i,r)}rect(t,e,i,r,n){n=n||0,this.camera?(this.moveTo(t,e,n),this.lineTo(t+i,e,n),this.lineTo(t+i,e+r,n),this.lineTo(t,e+r,n),this.closePath()):this.nativeContext.rect(t,e,i,r)}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,r){return isFinite(t+e+i+r)||(t=0,e=0,i=0,r=0),this.nativeContext.createLinearGradient(t,e,i,r)}createPattern(t,e){return 0===t.width||0===t.height?null:this.nativeContext.createPattern(t,e)}createRadialGradient(t,e,i,r,n,a){return this.nativeContext.createRadialGradient(t,e,i,r,n,a)}createConicGradient(t,e,i,r){let n,a=!1;const s=this;return{stops:[],addColorStop(t,e){this.stops.push([t,e]),a=!0},GetPattern(o,l,h){return a&&(h||(h=r-i),n=createConicalGradient(s,this.stops,t,e,h,i,r,o,l),a=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,r){this.nativeContext.fillRect(t,e,i,r)}clearRect(t,e,i,r){this.nativeContext.clearRect(t,e,i,r)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(transformMat4(outP,[t,e,i],this.modelMatrix),t=outP[0],e=outP[1],i=outP[2]);const r=this.camera.vp(t,e,i);t=r.x,e=r.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(transformMat4(outP,[t,e,i],this.modelMatrix),t=outP[0],e=outP[1],i=outP[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,r){if(r=r||0,this.camera){this.modelMatrix&&(transformMat4(outP,[e,i,r],this.modelMatrix),e=outP[0],i=outP[1],r=outP[2]);const t=this.camera.vp(e,i,r);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,r){return this.nativeContext.getImageData(t,e,i,r)}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]:application.global.measureTextMethod;var i,r;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=application.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:DefaultTextStyle.fontFamily,a=null!==(r=this.fontSize)&&void 0!==r?r:DefaultTextStyle.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===a||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=a,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,r){this.nativeContext.strokeRect(t,e,i,r)}strokeText(t,e,i,r){if(r=r||0,this.camera){this.modelMatrix&&(transformMat4(outP,[e,i,r],this.modelMatrix),e=outP[0],i=outP[1],r=outP[2]);const t=this.camera.vp(e,i,r);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,r,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,r,n[0]);const a=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(a,t)})),this._setCommonStyle(t,e,i,r,a)}return this._setCommonStyle(t,e,i,r,n)}_setCommonStyle(t,e,i,r,n){const a=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:s=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;a.globalAlpha=s*o*this.baseGlobalAlpha,s>1e-12&&o>1e-12&&(a.fillStyle=createColor(this,l,t,i,r))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const r=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setShadowBlendStyle(t,e,r)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const r=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:a=i.shadowBlur,shadowColor:s=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(a||o||l?(r.shadowBlur=a*this.dpr,r.shadowColor=s,r.shadowOffsetX=o*this.dpr,r.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(r.shadowBlur=0,r.shadowOffsetX=0,r.shadowOffsetY=0),h?(r.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(r.filter="blur(0px)",this._clearFilterStyle=!1),c?(r.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(r.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,r,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,r,n[0]);const a=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(a,t)})),this._setStrokeStyle(t,e,i,r,a)}return this._setStrokeStyle(t,e,i,r,n)}_setStrokeStyle(t,e,i,r,n){const a=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:s=n.strokeOpacity,opacity:o=n.opacity}=e;if(a.globalAlpha=s*o*this.baseGlobalAlpha,s>1e-12&&o>1e-12){const{lineWidth:s=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:d=n.keepStrokeScale}=e;a.lineWidth=d?s:getScaledStroke(this,s,this.dpr),a.strokeStyle=createColor(this,o,t,i,r),a.lineJoin=l,h&&a.setLineDash(h),a.lineCap=c,a.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const r=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?r.font=t.font:r.font=getContextFont(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:s=e.fontSize}=t;this.fontFamily=a,this.fontSize=s,r.textAlign="left",r.textBaseline="alphabetic"}setTextStyle(t,e,i){var r,n;const a=this.nativeContext;e||(e=this.textAttributes),t.font?a.font=t.font:a.font=getContextFont(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:s=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=s,this.fontSize=o,a.textAlign=null!==(r=t.textAlign)&&void 0!==r?r:e.textAlign,a.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n: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,r,n,a){this._clearMatrix.setValue(t,e,i,r,n,a)}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=>matrixAllocate.free(t))),this.stack.length=0}};BrowserContext2d.env="browser",BrowserContext2d=__decorate$_([injectable(),__metadata$O("design:paramtypes",[Object,Number])],BrowserContext2d);var __decorate$Z=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$N=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let BrowserCanvas=class extends BaseCanvas{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=application.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new BrowserContext2d(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:r=this._dpr,x:n=this._x,y:a=this._y}=t,{nativeCanvas:s}=this;s.width=e*r,s.height=i*r,!s.style||this.setCanvasStyle(s,n,a,e,i),t.id&&(s.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,r,n){this.controled&&(t.style.width=`${r}px`,t.style.height=`${n}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 createModule(t,e){return new ContainerModule((i=>{i(CanvasFactory).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Context2dFactory).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}BrowserCanvas.env="browser",BrowserCanvas=__decorate$Z([injectable(),__metadata$N("design:paramtypes",[Object])],BrowserCanvas);const browserCanvasModule=createModule(BrowserCanvas,BrowserContext2d);var __decorate$Y=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$M=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$w=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasPickerService=class extends exports.DefaultPickService{constructor(t,e,i,r){super(i,r),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=r,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=canvasAllocate.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,r){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const a=this.InterceptorContributions[n];if(a.beforePickItem){const n=a.beforePickItem(t,this,e,r,{parentMatrix:i});if(n)return n}}const n=this.pickerMap.get(t.numberType);if(!n)return null;const a=n.contains(t,e,r),s=a?t:null,o={graphic:s,params:a};if(s)return o;if(this.InterceptorContributions.length)for(let n=0;n<this.InterceptorContributions.length;n++){const a=this.InterceptorContributions[n];if(a.afterPickItem){const n=a.afterPickItem(t,this,e,r,{parentMatrix:i});if(n)return n}}return o}};DefaultCanvasPickerService=__decorate$Y([injectable(),__param$w(0,inject(ContributionProvider)),__param$w(0,named(CanvasPickerContribution)),__param$w(1,inject(DrawContribution)),__param$w(2,inject(ContributionProvider)),__param$w(2,named(PickItemInterceptor)),__param$w(3,inject(ContributionProvider)),__param$w(3,named(PickServiceInterceptor)),__metadata$M("design:paramtypes",[Object,Object,Object,Object])],DefaultCanvasPickerService);var __decorate$X=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultCanvasGroupPicker=class{constructor(){this.type="group",this.numberType=GROUP_NUMBER_TYPE}contains(t,e,i){return!1}};DefaultCanvasGroupPicker=__decorate$X([injectable()],DefaultCanvasGroupPicker);const m$1=new ContainerModule(((t,e,i,r)=>{m$1.__vloaded||(m$1.__vloaded=!0,t(CanvasGroupPicker).to(DefaultCanvasGroupPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasGroupPicker),bindContributionProvider(t,CanvasPickerContribution))}));m$1.__vloaded=!1;var canvasModule=m$1;const canvasPickerModule=new ContainerModule(((t,e,i,r)=>{i(DefaultCanvasPickerService)||t(DefaultCanvasPickerService).toSelf().inSingletonScope(),i(PickerService)?r(PickerService).toService(DefaultCanvasPickerService):t(PickerService).toService(DefaultCanvasPickerService)}));function loadCanvasPicker(t){t.load(canvasModule),t.load(canvasPickerModule)}var BrowserWindowHandlerContribution_1,__decorate$W=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let BrowserWindowHandlerContribution=BrowserWindowHandlerContribution_1=class extends exports.BaseWindowHandlerContribution{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${BrowserWindowHandlerContribution_1.idprefix}_${BrowserWindowHandlerContribution_1.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=application.global,this.viewBox=new AABBBounds,this.modelMatrix=new Matrix(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,r=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>r)}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 r={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:BrowserWindowHandlerContribution_1.GenerateCanvasId(),canvasControled:!0};this.canvas=new BrowserCanvas(r)}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 r=t.width,n=t.height;if(null==r||null==n||!t.canvasControled){const t=i.getBoundingClientRect();r=t.width,n=t.height}let a=t.dpr;null==a&&(a=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/r),this.canvas=new BrowserCanvas({width:r,height:n,dpr:a,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(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,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)}};BrowserWindowHandlerContribution.env="browser",BrowserWindowHandlerContribution.idprefix="visactor_window",BrowserWindowHandlerContribution.prefix_count=0,BrowserWindowHandlerContribution=BrowserWindowHandlerContribution_1=__decorate$W([injectable(),__metadata$L("design:paramtypes",[])],BrowserWindowHandlerContribution);const browserWindowModule=new ContainerModule((t=>{t(BrowserWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(BrowserWindowHandlerContribution))).whenTargetNamed(BrowserWindowHandlerContribution.env)}));var __decorate$V=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$K=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter$2=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};class DynamicB{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 createImageElement$1(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("加载失败"))}}))}exports.BrowserEnvContribution=class extends exports.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,r;let n=0,a=0,s=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,a=e.clientY||0,s=n,o=a}else n=t.clientX||0,a=t.clientY||0,s=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=a,s=e.getBoundingClientRect(),o=null===(r=e.getNativeHandler)||void 0===r?void 0:r.call(e).nativeCanvas;let l,h;return o&&(l=s.width/o.offsetWidth,h=s.height/o.offsetHeight),{x:(t-s.left)/(isValidNumber$1(l)?l:1),y:(i-s.top)/(isValidNumber$1(h)?h:1)}}return{x:s,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 DynamicB(t)}return new AABBBounds}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:r,style:n}=e;return n&&(isString$1(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=r&&(t.style.height=`${r}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,r=document.createElement(e);if(this.updateDom(r,t),i){const t=isString$1(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(r)}return r}loadImage(t){return createImageElement$1(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return createImageElement$1(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const r=document.createElement("canvas");t.id&&(r.id=null!==(e=t.id)&&void 0!==e?e:Generator.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.width=t.width*n,r.height=t.height*n),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,r=t.offsetParent;for(;null!==r;)i+=r.offsetTop,r=r.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,r=t.offsetParent;for(;null!==r;)i+=r.offsetLeft,r=r.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,r=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent;return{top:i,left:r}}loadFont(t,e,i){return __awaiter$2(this,void 0,void 0,(function*(){return new FontFace(t,isString$1(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}},exports.BrowserEnvContribution=__decorate$V([injectable(),__metadata$K("design:paramtypes",[])],exports.BrowserEnvContribution);const browserEnvModule=new ContainerModule((t=>{browserEnvModule.isBrowserBound||(browserEnvModule.isBrowserBound=!0,t(exports.BrowserEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(exports.BrowserEnvContribution))}));function loadBrowserEnv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];loadBrowserEnv.__loaded||(loadBrowserEnv.__loaded=!0,t.load(browserEnvModule),t.load(browserCanvasModule),t.load(browserWindowModule),e&&loadCanvasPicker(t))}function initBrowserEnv(){loadBrowserEnv(container)}browserEnvModule.isBrowserBound=!1,loadBrowserEnv.__loaded=!1;var __decorate$U=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let FeishuContext2d=class extends BrowserContext2d{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,r){return new Promise(((n,a)=>{var s;try{tt.canvasGetImageData({canvasId:null!==(s=this.canvas.nativeCanvas.id)&&void 0!==s?s:this.canvas.id,x:t,y:e,width:i,height:r,success(t){n(t)}})}catch(t){a(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}};FeishuContext2d.env="feishu",FeishuContext2d=__decorate$U([injectable()],FeishuContext2d);var __decorate$T=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$J=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let FeishuCanvas=class extends BaseCanvas{constructor(t){super(t)}init(){this._context=new FeishuContext2d(this,this._dpr)}release(){}};FeishuCanvas.env="feishu",FeishuCanvas=__decorate$T([injectable(),__metadata$J("design:paramtypes",[Object])],FeishuCanvas);const feishuCanvasModule=createModule(FeishuCanvas,FeishuContext2d);var __decorate$S=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$I=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$v=function(t,e){return function(i,r){e(i,r,t)}};let MiniAppEventManager$5=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={}}},FeishuWindowHandlerContribution=class extends exports.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new MiniAppEventManager$5}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 e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new FeishuCanvas(i)}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,r=t.height;if(null==i||null==r||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,r=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new FeishuCanvas({width:i,height:r,dpr:n,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(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,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()}};FeishuWindowHandlerContribution.env="feishu",FeishuWindowHandlerContribution=__decorate$S([injectable(),__param$v(0,inject(VGlobal)),__metadata$I("design:paramtypes",[Object])],FeishuWindowHandlerContribution);const feishuWindowModule=new ContainerModule((t=>{t(FeishuWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(FeishuWindowHandlerContribution))).whenTargetNamed(FeishuWindowHandlerContribution.env)}));var __decorate$R=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$u=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathPickerService=class extends exports.DefaultPickService{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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(t,e){this.pickContext=new exports.EmptyContext2d(null,1)}pickItem(t,e,i,r){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const a=n.contains(t,e,r),s=a?t:null;return s?{graphic:s,params:a}:null}};DefaultMathPickerService=__decorate$R([injectable(),__param$u(0,inject(ContributionProvider)),__param$u(0,named(MathPickerContribution)),__param$u(1,inject(ContributionProvider)),__param$u(1,named(PickItemInterceptor)),__param$u(2,inject(ContributionProvider)),__param$u(2,named(PickServiceInterceptor)),__metadata$H("design:paramtypes",[Object,Object,Object])],DefaultMathPickerService);const m=new ContainerModule((t=>{m.__vloaded||(m.__vloaded=!0,bindContributionProvider(t,MathPickerContribution))}));m.__vloaded=!1;var mathModule=m;class PickerBase{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=t.getGraphicTheme();r.highPerformanceSave();let{x:a=n.x,y:s=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,s+=e.y,r.setTransformForCurrent()}else a=0,s=0,r.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,r,a,s,{},null,((t,i,r)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const a=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return r.lineWidth=l?a+s:getScaledStroke(r,a+s,r.dpr),o=t.isPointInStroke(e.x,e.y),o})),r.highPerformanceRestore(),o}}var __decorate$Q=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$G=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$t=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathArcPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ARC_NUMBER_TYPE}};DefaultMathArcPicker=__decorate$Q([injectable(),__param$t(0,inject(ArcRender)),__metadata$G("design:paramtypes",[Object])],DefaultMathArcPicker);let loadArcPick$1=!1;const arcMathPickModule=new ContainerModule(((t,e,i,r)=>{loadArcPick$1||(loadArcPick$1=!0,t(MathArcPicker).to(DefaultMathArcPicker).inSingletonScope(),t(MathPickerContribution).toService(MathArcPicker))}));var __decorate$P=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$F=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$s=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathAreaPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=AREA_NUMBER_TYPE}};DefaultMathAreaPicker=__decorate$P([injectable(),__param$s(0,inject(AreaRender)),__metadata$F("design:paramtypes",[Object])],DefaultMathAreaPicker);let loadAreaPick$1=!1;const areaMathPickModule=new ContainerModule(((t,e,i,r)=>{loadAreaPick$1||(loadAreaPick$1=!0,t(MathAreaPicker).to(DefaultMathAreaPicker).inSingletonScope(),t(MathPickerContribution).toService(MathAreaPicker))}));var __decorate$O=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$E=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$r=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathCirclePicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=CIRCLE_NUMBER_TYPE}};DefaultMathCirclePicker=__decorate$O([injectable(),__param$r(0,inject(CircleRender)),__metadata$E("design:paramtypes",[Object])],DefaultMathCirclePicker);let loadCirclePick$1=!1;const circleMathPickModule=new ContainerModule(((t,e,i,r)=>{loadCirclePick$1||(loadCirclePick$1=!0,t(MathCirclePicker).to(DefaultMathCirclePicker).inSingletonScope(),t(MathPickerContribution).toService(MathCirclePicker))}));class GlyphPickerBase{constructor(){this.type="glyph",this.numberType=GLYPH_NUMBER_TYPE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=null==i?void 0:i.pickerService;if(n){let r=!1;return t.getSubGraphic().forEach((t=>{if(r)return;const a=n.pickItem(t,e,null,i);r=!(!a||!a.graphic)})),r}return!1}}var __decorate$N=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$D=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$q=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathGlyphPicker=class extends GlyphPickerBase{constructor(t){super(),this.canvasRenderer=t}};DefaultMathGlyphPicker=__decorate$N([injectable(),__param$q(0,inject(GlyphRender)),__metadata$D("design:paramtypes",[Object])],DefaultMathGlyphPicker);let loadGlyphPick$1=!1;const glyphMathPickModule=new ContainerModule(((t,e,i,r)=>{loadGlyphPick$1||(loadGlyphPick$1=!0,t(MathGlyphPicker).to(DefaultMathGlyphPicker).inSingletonScope(),t(DefaultMathGlyphPicker).toService(MathGlyphPicker))}));var __decorate$M=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultMathImagePicker=class{constructor(){this.type="image",this.numberType=IMAGE_NUMBER_TYPE}contains(t,e,i){const{pickContext:r}=null!=i?i:{};return!!r&&!!t.AABBBounds.containsPoint(e)}};DefaultMathImagePicker=__decorate$M([injectable()],DefaultMathImagePicker);let loadImagePick$1=!1;const imageMathPickModule=new ContainerModule(((t,e,i,r)=>{loadImagePick$1||(loadImagePick$1=!0,t(MathImagePicker).to(DefaultMathImagePicker).inSingletonScope(),t(DefaultMathImagePicker).toService(MathImagePicker))}));var __decorate$L=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$C=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$p=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathLinePicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=LINE_NUMBER_TYPE}};DefaultMathLinePicker=__decorate$L([injectable(),__param$p(0,inject(LineRender)),__metadata$C("design:paramtypes",[Object])],DefaultMathLinePicker);let loadLinePick$1=!1;const lineMathPickModule=new ContainerModule(((t,e,i,r)=>{loadLinePick$1||(loadLinePick$1=!0,t(MathLinePicker).to(DefaultMathLinePicker).inSingletonScope(),t(MathPickerContribution).toService(MathLinePicker))}));var __decorate$K=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$B=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$o=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathPolygonPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=POLYGON_NUMBER_TYPE}};DefaultMathPolygonPicker=__decorate$K([injectable(),__param$o(0,inject(PolygonRender)),__metadata$B("design:paramtypes",[Object])],DefaultMathPolygonPicker);let loadPolygonPick$1=!1;const polygonMathPickModule=new ContainerModule(((t,e,i,r)=>{loadPolygonPick$1||(loadPolygonPick$1=!0,t(MathPolygonPicker).to(DefaultMathPolygonPicker).inSingletonScope(),t(MathPickerContribution).toService(MathPolygonPicker))}));var __decorate$J=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$n=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathPathPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=PATH_NUMBER_TYPE}};DefaultMathPathPicker=__decorate$J([injectable(),__param$n(0,inject(PathRender)),__metadata$A("design:paramtypes",[Object])],DefaultMathPathPicker);let loadPathPick$1=!1;const pathMathPickModule=new ContainerModule(((t,e,i,r)=>{loadPathPick$1||(loadPathPick$1=!0,t(MathPathPicker).to(DefaultMathPathPicker).inSingletonScope(),t(MathPickerContribution).toService(MathPathPicker))})),_bounds=new AABBBounds;class RectPickerBase{constructor(){this.type="rect",this.numberType=RECT_NUMBER_TYPE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=t.getGraphicTheme(),{cornerRadius:a=n.cornerRadius}=t.attribute;let{x:s=n.x,y:o=n.y}=t.attribute;r.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);s+=e.x,o+=e.y,r.setTransformForCurrent()}else s=0,o=0,l=!1,r.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||isNumber$1(a,!0)&&0!==a||isArray$1(a)&&a.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,r,s,o,{},null,((t,i,r)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const a=i.lineWidth||n.lineWidth,s=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return r.lineWidth=o?a+s:getScaledStroke(r,a+s,r.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:r=n.stroke,lineWidth:a=n.lineWidth}=t.attribute;if(i)h=!0;else if(r){const i=t.AABBBounds;_bounds.setValue(i.x1,i.y1,i.x2,i.y2),_bounds.expand(-a/2),h=!_bounds.containsPoint(e)}}return r.highPerformanceRestore(),h}}var __decorate$I=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$m=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathRectPicker=class extends RectPickerBase{constructor(t){super(),this.canvasRenderer=t}};DefaultMathRectPicker=__decorate$I([injectable(),__param$m(0,inject(RectRender)),__metadata$z("design:paramtypes",[Object])],DefaultMathRectPicker);let loadRectPick$1=!1;const rectMathPickModule=new ContainerModule(((t,e,i,r)=>{loadRectPick$1||(loadRectPick$1=!0,t(MathRectPicker).to(DefaultMathRectPicker).inSingletonScope(),t(MathPickerContribution).toService(MathRectPicker))}));let loadRichTextPick=!1;const richTextMathPickModule=new ContainerModule(((t,e,i,r)=>{loadRichTextPick||(loadRichTextPick=!0,t(MathImagePicker).to(DefaultMathImagePicker).inSingletonScope(),t(DefaultMathImagePicker).toService(MathImagePicker))}));var __decorate$H=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$l=function(t,e){return function(i,r){e(i,r,t)}};let DefaultMathSymbolPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=SYMBOL_NUMBER_TYPE}};DefaultMathSymbolPicker=__decorate$H([injectable(),__param$l(0,inject(SymbolRender)),__metadata$y("design:paramtypes",[Object])],DefaultMathSymbolPicker);let loadSymbolPick$1=!1;const symbolMathPickModule=new ContainerModule(((t,e,i,r)=>{loadSymbolPick$1||(loadSymbolPick$1=!0,t(MathSymbolPicker).to(DefaultMathSymbolPicker).inSingletonScope(),t(MathPickerContribution).toService(MathSymbolPicker))}));var __decorate$G=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultMathTextPicker=class{constructor(){this.type="text",this.numberType=TEXT_NUMBER_TYPE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DefaultMathTextPicker=__decorate$G([injectable()],DefaultMathTextPicker);let loadTextPick$1=!1;const textMathPickModule=new ContainerModule(((t,e,i,r)=>{loadTextPick$1||(loadTextPick$1=!0,t(MathTextPicker).to(DefaultMathTextPicker).inSingletonScope(),t(MathPickerContribution).toService(MathTextPicker))})),mathPickerModule=new ContainerModule(((t,e,i,r)=>{i(DefaultMathPickerService)||t(DefaultMathPickerService).toSelf().inSingletonScope(),i(PickerService)?r(PickerService).toService(DefaultMathPickerService):t(PickerService).toService(DefaultMathPickerService)}));function loadMathPicker(t){t.load(mathModule),t.load(mathPickerModule),t.load(arcMathPickModule),t.load(areaMathPickModule),t.load(circleMathPickModule),t.load(glyphMathPickModule),t.load(imageMathPickModule),t.load(lineMathPickModule),t.load(polygonMathPickModule),t.load(pathMathPickModule),t.load(rectMathPickModule),t.load(richTextMathPickModule),t.load(symbolMathPickModule),t.load(textMathPickModule)}class CanvasWrapDisableWH{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,r,n,a){this.nativeCanvas=t,this.ctx=e,this._w=r,this._h=n,this.id=a,t.id=a,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}class CanvasWrapEnableWH{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,r,n,a){this.nativeCanvas=t,this.ctx=e,this._w=r,this._h=n,this.id=a,t.id=a,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var __decorate$F=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function makeUpCanvas$4(t,e,i,r,n,a){const s=null!=a?a:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e),l=new CanvasWrapDisableWH(o.canvas||{},o,s,t.width,t.height,e);o.canvas=l,i.set(e,l),a>=r&&n.push(l)}))}let FeishuEnvContribution=class extends exports.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),makeUpCanvas$4(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 rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{rafBasedSto.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}};FeishuEnvContribution=__decorate$F([injectable(),__metadata$x("design:paramtypes",[])],FeishuEnvContribution);const feishuEnvModule=new ContainerModule((t=>{feishuEnvModule.isFeishuBound||(feishuEnvModule.isFeishuBound=!0,t(FeishuEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(FeishuEnvContribution))}));function loadFeishuEnv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];loadFeishuEnv.__loaded||(loadFeishuEnv.__loaded=!0,t.load(feishuEnvModule),t.load(feishuCanvasModule),t.load(feishuWindowModule),e&&loadMathPicker(t))}function initFeishuEnv(){loadFeishuEnv(container)}feishuEnvModule.isFeishuBound=!1,loadFeishuEnv.__loaded=!1;var __decorate$E=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let LynxContext2d=class extends BrowserContext2d{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,r,n){const a=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:s=n.strokeOpacity,opacity:o=n.opacity}=e;if(s>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:u=n.lineDash,lineCap:d=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;a.globalAlpha=s*o*this.baseGlobalAlpha,a.lineWidth=f?l:getScaledStroke(this,l,this.dpr),a.strokeStyle=createColor(this,h,t,i,r),a.lineJoin=c,0===u[0]&&0===u[1]||u&&a.setLineDash(u),a.lineCap=d,a.miterLimit=p}}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:application.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,application.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)}))})))}};LynxContext2d.env="lynx",LynxContext2d=__decorate$E([injectable()],LynxContext2d);var __decorate$D=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$w=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let LynxCanvas=class extends BaseCanvas{constructor(t){super(t)}init(){this._context=new LynxContext2d(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(){}};LynxCanvas.env="lynx",LynxCanvas=__decorate$D([injectable(),__metadata$w("design:paramtypes",[Object])],LynxCanvas);var __decorate$C=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$k=function(t,e){return function(i,r){e(i,r,t)}};let MiniAppEventManager$4=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={}}},LynxWindowHandlerContribution=class extends exports.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new MiniAppEventManager$4}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 e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new LynxCanvas(i)}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,r=t.height;if(null==i||null==r||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,r=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new LynxCanvas({width:i,height:r,dpr:n,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(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,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()}};LynxWindowHandlerContribution.env="lynx",LynxWindowHandlerContribution=__decorate$C([injectable(),__param$k(0,inject(VGlobal)),__metadata$v("design:paramtypes",[Object])],LynxWindowHandlerContribution);const lynxWindowModule=new ContainerModule((t=>{t(LynxWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(LynxWindowHandlerContribution))).whenTargetNamed(LynxWindowHandlerContribution.env)})),lynxCanvasModule=createModule(LynxCanvas,LynxContext2d);var __decorate$B=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ng=!1;try{ng=!!lynx.createCanvasNG}catch(t){}function makeUpCanvas$3(t,e,i,r,n,a,s){const o=null!=s?s:SystemInfo.pixelRatio;if(e.forEach(((e,s)=>{let l;a?l=lynx.createOffscreenCanvas():(l=ng?lynx.createCanvasNG(e):lynx.createCanvas(e),ng&&l.attachToCanvasView(e)),l.width=t.width*o,l.height=t.height*o;const h=l.getContext("2d"),c=new CanvasWrapEnableWH(l,h,o,t.width,t.height,e);i.set(e,c),s>r&&n.push(c)})),!n.length&&lynx.createOffscreenCanvas){const e=lynx.createOffscreenCanvas();e.width=t.width*o,e.height=t.height*o;const r=e.getContext("2d"),a=Math.random().toString(),s=new CanvasWrapEnableWH(e,r,o,t.width,t.height,a);i.set(a,s),n.push(s)}}function createImageElement(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("加载失败"))}}))}let LynxEnvContribution=class extends exports.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),makeUpCanvas$3(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 createImageElement(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 rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{rafBasedSto.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(){}};LynxEnvContribution=__decorate$B([injectable(),__metadata$u("design:paramtypes",[])],LynxEnvContribution);const lynxEnvModule=new ContainerModule((t=>{lynxEnvModule.isLynxBound||(lynxEnvModule.isLynxBound=!0,t(LynxEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(LynxEnvContribution))}));function loadLynxEnv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];loadLynxEnv.__loaded||(loadLynxEnv.__loaded=!0,t.load(lynxEnvModule),t.load(lynxCanvasModule),t.load(lynxWindowModule),e&&loadMathPicker(t))}function initLynxEnv(){loadLynxEnv(container)}lynxEnvModule.isLynxBound=!1,loadLynxEnv.__loaded=!1;var __decorate$A=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$t=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let NodeContext2d=class extends BrowserContext2d{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 Matrix(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};NodeContext2d.env="node",NodeContext2d=__decorate$A([injectable(),__metadata$t("design:paramtypes",[Object,Number])],NodeContext2d);var __decorate$z=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$s=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let NodeCanvas=class extends BaseCanvas{constructor(t){super(t)}init(){this._context=new NodeContext2d(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&isFunction$1(this._nativeCanvas.release)&&this._nativeCanvas.release()}};NodeCanvas.env="node",NodeCanvas=__decorate$z([injectable(),__metadata$s("design:paramtypes",[Object])],NodeCanvas);const nodeCanvasModule=createModule(NodeCanvas,NodeContext2d);var __decorate$y=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$r=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$j=function(t,e){return function(i,r){e(i,r,t)}};let NodeWindowHandlerContribution=class extends exports.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 e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Generator.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new NodeCanvas(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,r=t.height;null!=i&&null!=r&&t.canvasControled||(i=e.width,r=e.height),this.canvas=new NodeCanvas({width:i,height:r,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){}};NodeWindowHandlerContribution.env="node",NodeWindowHandlerContribution=__decorate$y([injectable(),__param$j(0,inject(VGlobal)),__metadata$r("design:paramtypes",[Object])],NodeWindowHandlerContribution);const nodeWindowModule=new ContainerModule((t=>{t(NodeWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(NodeWindowHandlerContribution))).whenTargetNamed(NodeWindowHandlerContribution.env)}));var __decorate$x=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let NodeEnvContribution=class extends exports.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 rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{rafBasedSto.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};NodeEnvContribution=__decorate$x([injectable()],NodeEnvContribution);const nodeEnvModule=new ContainerModule((t=>{nodeEnvModule.isNodeBound||(nodeEnvModule.isNodeBound=!0,t(NodeEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(NodeEnvContribution))}));function loadNodeEnv(t){loadNodeEnv.__loaded||(loadNodeEnv.__loaded=!0,t.load(nodeEnvModule),t.load(nodeCanvasModule),t.load(nodeWindowModule))}function initNodeEnv(){loadNodeEnv(container)}nodeEnvModule.isNodeBound=!1,loadNodeEnv.__loaded=!1;var __decorate$w=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let TaroContext2d=class extends BrowserContext2d{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,r,n){const a=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:s=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;s>1e-12&&o>1e-12&&(a.setGlobalAlpha(s*o),a.setFillStyle(createColor(this,l,t,i,r)))}_setStrokeStyle(t,e,i,r,n){const a=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:s=n.strokeOpacity,opacity:o=n.opacity}=e;if(s>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:u=n.lineDash,lineCap:d=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;a.setGlobalAlpha(s*o),a.setLineWidth(f?l:getScaledStroke(this,l,this.dpr)),a.setStrokeStyle(createColor(this,h,t,i,r)),a.setLineJoin(c),u&&a.setLineDash(u),a.setLineCap(d),a.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=getContextFont(t,e),r.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,r;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=getContextFont(t,e),n.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),n.setTextBaseline(null!==(r=t.textBaseline)&&void 0!==r?r:e.textBaseline)}createConicGradient(t,e,i,r){return null}createPattern(t,e){return null}getImageData(t,e,i,r){const n=this.nativeContext,a=n.taro;if(n&&a)return!n.getImageData&&a.canvasGetImageData?new Promise(((n,s)=>{try{a.canvasGetImageData({canvasId:this.canvas.nativeCanvas.id,sx:t,sy:e,sw:i,sh:r,success(t){n(t)}})}catch(t){s(t)}})):void 0}createRadialGradient(t,e,i,r,n,a){return this.nativeContext.createCircularGradient&&this.nativeContext.createCircularGradient(t,e,i,r,n,a)}};TaroContext2d.env="taro",TaroContext2d=__decorate$w([injectable()],TaroContext2d);var __decorate$v=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$q=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TaroCanvas=class extends BaseCanvas{constructor(t){super(t)}init(){this._context=new TaroContext2d(this,this._dpr)}release(){}};TaroCanvas.env="taro",TaroCanvas=__decorate$v([injectable(),__metadata$q("design:paramtypes",[Object])],TaroCanvas);const taroCanvasModule=createModule(TaroCanvas,TaroContext2d);var __decorate$u=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$p=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$i=function(t,e){return function(i,r){e(i,r,t)}};let MiniAppEventManager$3=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={}}},TaroWindowHandlerContribution=class extends exports.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new MiniAppEventManager$3}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 e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new TaroCanvas(i)}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,r=t.height;if(null==i||null==r||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,r=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new TaroCanvas({width:i,height:r,dpr:n,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(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,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()}};TaroWindowHandlerContribution.env="taro",TaroWindowHandlerContribution=__decorate$u([injectable(),__param$i(0,inject(VGlobal)),__metadata$p("design:paramtypes",[Object])],TaroWindowHandlerContribution);const taroWindowModule=new ContainerModule((t=>{t(TaroWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(TaroWindowHandlerContribution))).whenTargetNamed(TaroWindowHandlerContribution.env)}));var __decorate$t=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$o=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function makeUpCanvas$2(t,e,i,r,n,a,s){e.forEach(((e,o)=>{const l=a.createCanvasContext(e),h=new CanvasWrapDisableWH(l.canvas||{},l,s,t.width,t.height,e);return l.canvas=h,i.set(e,h),o>=r&&n.push(h),h}))}let TaroEnvContribution=class extends exports.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){t.env===this.type&&(t.setActiveEnvContribution(this),makeUpCanvas$2(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.taro,e.pixelRatio),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],r=(new XMLSerializer).serializeToString(i),n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r)}`;return Promise.resolve({data:n,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),r=e.URL.createObjectURL(i);return Promise.resolve({data:r,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(){}};TaroEnvContribution=__decorate$t([injectable(),__metadata$o("design:paramtypes",[])],TaroEnvContribution);const taroEnvModule=new ContainerModule((t=>{taroEnvModule.isTaroBound||(taroEnvModule.isTaroBound=!0,t(TaroEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(TaroEnvContribution))}));function loadTaroEnv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];loadTaroEnv.__loaded||(loadTaroEnv.__loaded=!0,t.load(taroEnvModule),t.load(taroCanvasModule),t.load(taroWindowModule),e&&loadMathPicker(t))}function initTaroEnv(){loadTaroEnv(container)}taroEnvModule.isTaroBound=!1,loadTaroEnv.__loaded=!1;var __decorate$s=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let WxContext2d=class extends BrowserContext2d{draw(){}createPattern(t,e){return null}};WxContext2d.env="wx",WxContext2d=__decorate$s([injectable()],WxContext2d);var __decorate$r=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$n=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WxCanvas=class extends BaseCanvas{constructor(t){super(t)}init(){this._context=new WxContext2d(this,this._dpr)}release(){}};WxCanvas.env="wx",WxCanvas=__decorate$r([injectable(),__metadata$n("design:paramtypes",[Object])],WxCanvas);const wxCanvasModule=createModule(WxCanvas,WxContext2d);var __decorate$q=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$h=function(t,e){return function(i,r){e(i,r,t)}};let MiniAppEventManager$2=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={}}},WxWindowHandlerContribution=class extends exports.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new MiniAppEventManager$2}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 e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new WxCanvas(i)}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,r=t.height;if(null==i||null==r||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,r=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new WxCanvas({width:i,height:r,dpr:n,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,r,n;const{type:a}=t;return!!this.eventManager.cache[a]&&(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!==(r=t.changedTouches[0].y)&&void 0!==r?r:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[a].listener&&this.eventManager.cache[a].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(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,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()}};WxWindowHandlerContribution.env="wx",WxWindowHandlerContribution=__decorate$q([injectable(),__param$h(0,inject(VGlobal)),__metadata$m("design:paramtypes",[Object])],WxWindowHandlerContribution);const wxWindowModule=new ContainerModule((t=>{t(WxWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(WxWindowHandlerContribution))).whenTargetNamed(WxWindowHandlerContribution.env)}));var __decorate$p=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$l=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter$1=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};function makeUpCanvas$1(t,e,i,r,n,a){return __awaiter$1(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let s=0;s<e.length;s++){const o=e[s];yield new Promise((e=>{let l=wx.createSelectorQuery();a&&(l=l.in(a)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((a=>{if(!a[0])return;const l=a[0].node,h=a[0].width,c=a[0].height;l.width=h*t,l.height=c*t,i.set(o,l),s>=r&&n.push(l),e(null)}))}))}}))}let WxEnvContribution=class extends exports.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),makeUpCanvas$1(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 rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{rafBasedSto.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}};WxEnvContribution=__decorate$p([injectable(),__metadata$l("design:paramtypes",[])],WxEnvContribution);const wxEnvModule=new ContainerModule((t=>{wxEnvModule._isWxBound||(wxEnvModule._isWxBound=!0,t(WxEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(WxEnvContribution))}));function loadWxEnv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];loadWxEnv.__loaded||(loadWxEnv.__loaded=!0,t.load(wxEnvModule),t.load(wxCanvasModule),t.load(wxWindowModule),e&&loadMathPicker(t))}function initWxEnv(){loadWxEnv(container)}function loadAllEnv(t){loadAllModule(t)}function loadAllModule(t){loadAllModule.__loaded||(loadAllModule.__loaded=!0,loadBrowserEnv(t,!1),loadFeishuEnv(t,!1),loadLynxEnv(t,!1),loadNodeEnv(t),loadTaroEnv(t,!1),loadWxEnv(t,!1),loadCanvasPicker(t),vglobal.hooks.onSetEnv.tap("loadMathPicker",((e,i)=>{"browser"!==i&&loadMathPicker(t)})))}function initAllEnv(){loadAllEnv(container)}wxEnvModule._isWxBound=!1,loadWxEnv.__loaded=!1,loadAllModule.__loaded=!1;var __decorate$o=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let TTContext2d=class extends FeishuContext2d{};TTContext2d.env="tt",TTContext2d=__decorate$o([injectable()],TTContext2d);var __decorate$n=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$k=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TTCanvas=class extends BaseCanvas{constructor(t){super(t)}init(){this._context=new TTContext2d(this,this._dpr)}release(){}};TTCanvas.env="tt",TTCanvas=__decorate$n([injectable(),__metadata$k("design:paramtypes",[Object])],TTCanvas);const ttCanvasModule=createModule(TTCanvas,TTContext2d);var __decorate$m=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$j=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$g=function(t,e){return function(i,r){e(i,r,t)}};let MiniAppEventManager$1=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={}}},TTWindowHandlerContribution=class extends exports.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="tt",this.eventManager=new MiniAppEventManager$1}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 e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new TTCanvas(i)}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,r=t.height;if(null==i||null==r||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,r=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new TTCanvas({width:i,height:r,dpr:n,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(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,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()}};TTWindowHandlerContribution.env="tt",TTWindowHandlerContribution=__decorate$m([injectable(),__param$g(0,inject(VGlobal)),__metadata$j("design:paramtypes",[Object])],TTWindowHandlerContribution);const ttWindowModule=new ContainerModule((t=>{t(TTWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(TTWindowHandlerContribution))).whenTargetNamed(TTWindowHandlerContribution.env)}));var __decorate$l=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{l(r.next(t))}catch(t){a(t)}}function o(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((r=r.apply(t,e||[])).next())}))};function makeUpCanvas(t,e,i,r,n,a){return __awaiter(this,void 0,void 0,(function*(){const t=tt.getSystemInfoSync().pixelRatio;for(let s=0;s<e.length;s++){const o=e[s];yield new Promise((e=>{let l=tt.createSelectorQuery();a&&(l=l.in(a)),l.select(`#${o}`).node().exec((a=>{const l=a[0].node,h=l.width,c=l.height;l.width=h*t,l.height=c*t,i.set(o,l),s>=r&&n.push(l),e(null)}))}))}}))}let TTEnvContribution=class extends exports.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),makeUpCanvas(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 rafBasedSto.call(t)}}getCancelAnimationFrame(){return t=>{rafBasedSto.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}};TTEnvContribution=__decorate$l([injectable(),__metadata$i("design:paramtypes",[])],TTEnvContribution);const ttEnvModule=new ContainerModule((t=>{ttEnvModule.isTTBound||(ttEnvModule.isTTBound=!0,t(TTEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(TTEnvContribution))}));function loadTTEnv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];loadTTEnv.__loaded||(loadTTEnv.__loaded=!0,t.load(ttEnvModule),t.load(ttCanvasModule),t.load(ttWindowModule),e&&loadMathPicker(t))}function initTTEnv(){loadTTEnv(container)}ttEnvModule.isTTBound=!1,loadTTEnv.__loaded=!1;var __decorate$k=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let HarmonyContext2d=class extends BrowserContext2d{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,r,n){const a=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:s=n.strokeOpacity,opacity:o=n.opacity}=e;if(s>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:u=n.lineDash,lineCap:d=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:f=n.keepStrokeScale}=e;a.globalAlpha=s*o*this.baseGlobalAlpha,a.lineWidth=f?l:getScaledStroke(this,l,this.dpr),a.strokeStyle=createColor(this,h,t,i,r),a.lineJoin=c,0===u[0]&&0===u[1]||u&&a.setLineDash(u),a.lineCap=d,a.miterLimit=p}}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:application.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,application.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const r=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let a="";a=t.font?t.font:getContextFont(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:s=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=s,this.fontSize=o,r.textAlign="left",r.textBaseline="alphabetic"}setTextStyle(t,e,i){var r,n;const a=this.nativeContext;e||(e=this.textAttributes);let s="";s=t.font?t.font:getContextFont(t,e,this.camera&&this.camera.getProjectionScale(i)),a.font=(s||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,a.textAlign=null!==(r=t.textAlign)&&void 0!==r?r:e.textAlign,a.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n: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(){}};HarmonyContext2d.env="harmony",HarmonyContext2d=__decorate$k([injectable()],HarmonyContext2d);var __decorate$j=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$h=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let HarmonyCanvas=class extends BaseCanvas{constructor(t){super(t)}init(){this._context=new HarmonyContext2d(this,this._dpr)}resize(t,e){}release(){}};HarmonyCanvas.env="harmony",HarmonyCanvas=__decorate$j([injectable(),__metadata$h("design:paramtypes",[Object])],HarmonyCanvas);var __decorate$i=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$g=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$f=function(t,e){return function(i,r){e(i,r,t)}};class MiniAppEventManager{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 HarmonyWindowHandlerContribution=class extends exports.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new MiniAppEventManager}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 e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:Generator.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new HarmonyCanvas(i)}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,r=t.height;if(null==i||null==r||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,r=t.height}this.canvas=new HarmonyCanvas({width:i,height:r,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(),r=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(r,0,0,r,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()}};HarmonyWindowHandlerContribution.env="harmony",HarmonyWindowHandlerContribution=__decorate$i([injectable(),__param$f(0,inject(VGlobal)),__metadata$g("design:paramtypes",[Object])],HarmonyWindowHandlerContribution);const harmonyWindowModule=new ContainerModule((t=>{t(HarmonyWindowHandlerContribution).toSelf(),t(WindowHandlerContribution).toDynamicValue((t=>t.container.get(HarmonyWindowHandlerContribution))).whenTargetNamed(HarmonyWindowHandlerContribution.env)})),harmonyCanvasModule=createModule(HarmonyCanvas,HarmonyContext2d);var __decorate$h=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function createCanvas(t,e,i){const r=new OffscreenCanvas(t,e),n=r.getContext("2d");return new CanvasWrapDisableWH({width:t,height:e,context:n,_c:r,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}let HarmonyEnvContribution=class extends exports.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 RafBasedSTO(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 createCanvas(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(){}};HarmonyEnvContribution=__decorate$h([injectable(),__metadata$f("design:paramtypes",[])],HarmonyEnvContribution);const harmonyEnvModule=new ContainerModule((t=>{harmonyEnvModule.isHarmonyBound||(harmonyEnvModule.isHarmonyBound=!0,t(HarmonyEnvContribution).toSelf().inSingletonScope(),t(EnvContribution).toService(HarmonyEnvContribution))}));function loadHarmonyEnv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];loadHarmonyEnv.__loaded||(loadHarmonyEnv.__loaded=!0,t.load(harmonyEnvModule),t.load(harmonyCanvasModule),t.load(harmonyWindowModule),e&&loadMathPicker(t))}function initHarmonyEnv(){loadHarmonyEnv(container)}harmonyEnvModule.isHarmonyBound=!1,loadHarmonyEnv.__loaded=!1;var __decorate$g=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$e=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$e=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasArcPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ARC_NUMBER_TYPE}};DefaultCanvasArcPicker=__decorate$g([injectable(),__param$e(0,inject(ArcRender)),__metadata$e("design:paramtypes",[Object])],DefaultCanvasArcPicker);let loadArcPick=!1;const arcCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadArcPick||(loadArcPick=!0,t(CanvasArcPicker).to(DefaultCanvasArcPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasArcPicker))}));var __decorate$f=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$d=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$d=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasRectPicker=class extends RectPickerBase{constructor(t){super(),this.canvasRenderer=t}};DefaultCanvasRectPicker=__decorate$f([injectable(),__param$d(0,inject(RectRender)),__metadata$d("design:paramtypes",[Object])],DefaultCanvasRectPicker);let loadRectPick=!1;const rectCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadRectPick||(loadRectPick=!0,t(CanvasRectPicker).to(DefaultCanvasRectPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasRectPicker))}));class BaseLinePicker extends BaseRender{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:r}=null!=i?i:{};if(!r)return!1;r.highPerformanceSave();const n=t.getGraphicTheme(),a=this.transform(t,n,r),{x:s,y:o,z:l,lastModelMatrix:h}=a;let c=e;if(r.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,r,s,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,a=e.pickStrokeBuffer||i.pickStrokeBuffer,s=e.keepStrokeScale||i.keepStrokeScale;return r.lineWidth=s?n+a:getScaledStroke(r,n+a,r.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,r.modelMatrix!==h&&mat4Allocate.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),u}}var __decorate$e=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$c=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasLinePicker=class extends BaseLinePicker{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=LINE_NUMBER_TYPE}};DefaultCanvasLinePicker=__decorate$e([injectable(),__param$c(0,inject(LineRender)),__metadata$c("design:paramtypes",[Object])],DefaultCanvasLinePicker);let loadLinePick=!1;const lineCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadLinePick||(loadLinePick=!0,t(CanvasLinePicker).to(DefaultCanvasLinePicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasLinePicker))}));var __decorate$d=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$b=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasAreaPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=AREA_NUMBER_TYPE}};DefaultCanvasAreaPicker=__decorate$d([injectable(),__param$b(0,inject(AreaRender)),__metadata$b("design:paramtypes",[Object])],DefaultCanvasAreaPicker);let loadAreaPick=!1;const areaCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadAreaPick||(loadAreaPick=!0,t(CanvasAreaPicker).to(DefaultCanvasAreaPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasAreaPicker))}));class Base3dPicker extends BaseRender{contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=t.getGraphicTheme();r.highPerformanceSave();const a=this.transform(t,n,r),{x:s,y:o,z:l,lastModelMatrix:h}=a;let c=e;if(r.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,r,s,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,r.modelMatrix!==h&&mat4Allocate.free(r.modelMatrix),r.modelMatrix=h,r.highPerformanceRestore(),u}}var __decorate$c=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$a=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$a=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasSymbolPicker=class extends Base3dPicker{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=SYMBOL_NUMBER_TYPE}contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=t.getParsedPath();if(!r.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}r.highPerformanceSave();const a=t.getGraphicTheme(),s=this.transform(t,a,r),{x:o,y:l,z:h,lastModelMatrix:c}=s;let u=e;if(r.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,r,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,a=e.pickStrokeBuffer||i.pickStrokeBuffer,s=e.keepStrokeScale||i.keepStrokeScale;return r.lineWidth=s?n+a:getScaledStroke(r,n+a,r.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,r.modelMatrix!==c&&mat4Allocate.free(r.modelMatrix),r.modelMatrix=c,r.highPerformanceRestore(),d}};DefaultCanvasSymbolPicker=__decorate$c([injectable(),__param$a(0,inject(SymbolRender)),__metadata$a("design:paramtypes",[Object])],DefaultCanvasSymbolPicker);let loadSymbolPick=!1;const symbolCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadSymbolPick||(loadSymbolPick=!0,t(CanvasSymbolPicker).to(DefaultCanvasSymbolPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasSymbolPicker))}));var __decorate$b=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$9=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$9=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasCirclePicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=CIRCLE_NUMBER_TYPE}};DefaultCanvasCirclePicker=__decorate$b([injectable(),__param$9(0,inject(CircleRender)),__metadata$9("design:paramtypes",[Object])],DefaultCanvasCirclePicker);let loadCirclePick=!1;const circleCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadCirclePick||(loadCirclePick=!0,t(CanvasCirclePicker).to(DefaultCanvasCirclePicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasCirclePicker))}));var __decorate$a=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$8=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$8=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasTextPicker=class extends Base3dPicker{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=TEXT_NUMBER_TYPE}contains(t,e,i){const{pickContext:r}=null!=i?i:{};if(!r)return!1;const n=t.AABBBounds;if(!r.camera)return!!n.containsPoint(e);r.highPerformanceSave();const a=t.getGraphicTheme(),{keepDirIn3d:s=a.keepDirIn3d}=t.attribute,o=!s,l=this.transform(t,a,r,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;let p=e;if(r.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,r,h,c,{},null,((e,i,r)=>{if(f)return!0;const{fontSize:n=a.fontSize,textBaseline:s=a.textBaseline,textAlign:o=a.textAlign}=t.attribute,l=t.AABBBounds,d=l.height(),m=l.width(),g=textLayoutOffsetY(s,d,n),y=textDrawOffsetX(o,m);return e.rect(y+h,g+c,m,d,u),f=e.isPointInPath(p.x,p.y),f}),((t,e,i)=>f)),this.canvasRenderer.z=0,r.modelMatrix!==d&&mat4Allocate.free(r.modelMatrix),r.modelMatrix=d,r.highPerformanceRestore(),f}};DefaultCanvasTextPicker=__decorate$a([injectable(),__param$8(0,inject(TextRender)),__metadata$8("design:paramtypes",[Object])],DefaultCanvasTextPicker);let loadTextPick=!1;const textCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadTextPick||(loadTextPick=!0,t(CanvasTextPicker).to(DefaultCanvasTextPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasTextPicker))}));var __decorate$9=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$7=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$7=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasPathPicker=class extends BaseLinePicker{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=PATH_NUMBER_TYPE}};DefaultCanvasPathPicker=__decorate$9([injectable(),__param$7(0,inject(PathRender)),__metadata$7("design:paramtypes",[Object])],DefaultCanvasPathPicker);let loadPathPick=!1;const pathCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadPathPick||(loadPathPick=!0,t(CanvasPathPicker).to(DefaultCanvasPathPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasPathPicker))}));var __decorate$8=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$6=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$6=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasPolygonPicker=class extends PickerBase{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=POLYGON_NUMBER_TYPE}};DefaultCanvasPolygonPicker=__decorate$8([injectable(),__param$6(0,inject(PolygonRender)),__metadata$6("design:paramtypes",[Object])],DefaultCanvasPolygonPicker);let loadPolygonPick=!1;const polygonCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadPolygonPick||(loadPolygonPick=!0,t(CanvasPolygonPicker).to(DefaultCanvasPolygonPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasPolygonPicker))}));var __decorate$7=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$5=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$5=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasGlyphPicker=class extends GlyphPickerBase{constructor(t){super(),this.canvasRenderer=t}};DefaultCanvasGlyphPicker=__decorate$7([injectable(),__param$5(0,inject(GlyphRender)),__metadata$5("design:paramtypes",[Object])],DefaultCanvasGlyphPicker);let loadGlyphPick=!1;const glyphCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadGlyphPick||(loadGlyphPick=!0,t(CanvasGlyphPicker).to(DefaultCanvasGlyphPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasGlyphPicker))}));var __decorate$6=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$4=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$4=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasRichTextPicker=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=RICHTEXT_NUMBER_TYPE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DefaultCanvasRichTextPicker=__decorate$6([injectable(),__param$4(0,inject(RichTextRender)),__metadata$4("design:paramtypes",[Object])],DefaultCanvasRichTextPicker);let loadRichtextPick=!1;const richtextCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadRichtextPick||(loadRichtextPick=!0,t(CanvasRichTextPicker).to(DefaultCanvasRichTextPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasRichTextPicker))}));var __decorate$5=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultCanvasImagePicker=class{constructor(){this.type="image",this.numberType=IMAGE_NUMBER_TYPE}contains(t,e,i){const{pickContext:r}=null!=i?i:{};return!!r&&!!t.AABBBounds.containsPoint(e)}};DefaultCanvasImagePicker=__decorate$5([injectable()],DefaultCanvasImagePicker);let loadImagePick=!1;const imageCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadImagePick||(loadImagePick=!0,t(CanvasImagePicker).to(DefaultCanvasImagePicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasImagePicker))}));var __decorate$4=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$3=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$3=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasRect3dPicker=class extends Base3dPicker{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=RECT3D_NUMBER_TYPE,this.themeType="rect"}};DefaultCanvasRect3dPicker=__decorate$4([injectable(),__param$3(0,inject(Rect3DRender)),__metadata$3("design:paramtypes",[Object])],DefaultCanvasRect3dPicker);let loadRect3dPick=!1;const rect3dCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadRect3dPick||(loadRect3dPick=!0,t(CanvasRect3dPicker).to(DefaultCanvasRect3dPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasRect3dPicker))}));var __decorate$3=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$2=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$2=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasArc3dPicker=class extends Base3dPicker{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=ARC3D_NUMBER_TYPE,this.themeType="arc"}};DefaultCanvasArc3dPicker=__decorate$3([injectable(),__param$2(0,inject(Arc3dRender)),__metadata$2("design:paramtypes",[Object])],DefaultCanvasArc3dPicker);let loadArc3dPick=!1;const arc3dCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadArc3dPick||(loadArc3dPick=!0,t(CanvasArc3dPicker).to(DefaultCanvasArc3dPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasArc3dPicker))}));var __decorate$2=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata$1=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param$1=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasPyramid3dPicker=class extends Base3dPicker{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=PYRAMID3D_NUMBER_TYPE,this.themeType="polygon"}};DefaultCanvasPyramid3dPicker=__decorate$2([injectable(),__param$1(0,inject(Pyramid3dRender)),__metadata$1("design:paramtypes",[Object])],DefaultCanvasPyramid3dPicker);let loadPyramid3dPick=!1;const pyramid3dCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadPyramid3dPick||(loadPyramid3dPick=!0,t(CanvasPyramid3dPicker).to(DefaultCanvasPyramid3dPicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasPyramid3dPicker))})),LOTTIE_NUMBER_TYPE=Generator.GenAutoIncrementId();var lottie={exports:{}};(function(module,exports){var factory;"undefined"!=typeof navigator&&(factory=function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(t){_useWebWorker=!!t},getWebWorker=function(){return _useWebWorker},setLocationHref=function(t){locationHref=t},getLocationHref=function(){return locationHref};function createTag(t){return document.createElement(t)}function extendPrototype(t,e){var i,r,n=t.length;for(i=0;i<n;i+=1)for(var a in r=t[i].prototype)Object.prototype.hasOwnProperty.call(r,a)&&(e.prototype[a]=r[a])}function getDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)}function createProxyFunction(t){function e(){}return e.prototype=t,e}var audioControllerFactory=function(){function t(t){this.audios=[],this.audioFactory=t,this._volume=1,this._isMuted=!1}return t.prototype={addAudio:function(t){this.audios.push(t)},pause:function(){var t,e=this.audios.length;for(t=0;t<e;t+=1)this.audios[t].pause()},resume:function(){var t,e=this.audios.length;for(t=0;t<e;t+=1)this.audios[t].resume()},setRate:function(t){var e,i=this.audios.length;for(e=0;e<i;e+=1)this.audios[e].setRate(t)},createAudio:function(t){return this.audioFactory?this.audioFactory(t):window.Howl?new window.Howl({src:[t]}):{isPlaying:!1,play:function(){this.isPlaying=!0},seek:function(){this.isPlaying=!1},playing:function(){},rate:function(){},setVolume:function(){}}},setAudioFactory:function(t){this.audioFactory=t},setVolume:function(t){this._volume=t,this._updateVolume()},mute:function(){this._isMuted=!0,this._updateVolume()},unmute:function(){this._isMuted=!1,this._updateVolume()},getVolume:function(){return this._volume},_updateVolume:function(){var t,e=this.audios.length;for(t=0;t<e;t+=1)this.audios[t].volume(this._volume*(this._isMuted?0:1))}},function(){return new t}}(),createTypedArray=function(){function t(t,e){var i,r=0,n=[];switch(t){case"int16":case"uint8c":i=1;break;default:i=1.1}for(r=0;r<e;r+=1)n.push(i);return n}return"function"==typeof Uint8ClampedArray&&"function"==typeof Float32Array?function(e,i){return"float32"===e?new Float32Array(i):"int16"===e?new Int16Array(i):"uint8c"===e?new Uint8ClampedArray(i):t(e,i)}:t}();function createSizedArray(t){return Array.apply(null,{length:t})}function _typeof$6(t){return _typeof$6="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$6(t)}var subframeEnabled=!0,expressionsPlugin=null,expressionsInterfaces=null,idPrefix$1="",isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),bmPow=Math.pow,bmSqrt=Math.sqrt,bmFloor=Math.floor,bmMax=Math.max,bmMin=Math.min,BMMath={};!function(){var t,e=["abs","acos","acosh","asin","asinh","atan","atanh","atan2","ceil","cbrt","expm1","clz32","cos","cosh","exp","floor","fround","hypot","imul","log","log1p","log2","log10","max","min","pow","random","round","sign","sin","sinh","sqrt","tan","tanh","trunc","E","LN10","LN2","LOG10E","LOG2E","PI","SQRT1_2","SQRT2"],i=e.length;for(t=0;t<i;t+=1)BMMath[e[t]]=Math[e[t]]}(),BMMath.random=Math.random,BMMath.abs=function(t){if("object"===_typeof$6(t)&&t.length){var e,i=createSizedArray(t.length),r=t.length;for(e=0;e<r;e+=1)i[e]=Math.abs(t[e]);return i}return Math.abs(t)};var defaultCurveSegments=150,degToRads=Math.PI/180,roundCorner=.5519;function styleDiv(t){t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.display="block",t.style.transformOrigin="0 0",t.style.webkitTransformOrigin="0 0",t.style.backfaceVisibility="visible",t.style.webkitBackfaceVisibility="visible",t.style.transformStyle="preserve-3d",t.style.webkitTransformStyle="preserve-3d",t.style.mozTransformStyle="preserve-3d"}function BMEnterFrameEvent(t,e,i,r){this.type=t,this.currentTime=e,this.totalTime=i,this.direction=r<0?-1:1}function BMCompleteEvent(t,e){this.type=t,this.direction=e<0?-1:1}function BMCompleteLoopEvent(t,e,i,r){this.type=t,this.currentLoop=i,this.totalLoops=e,this.direction=r<0?-1:1}function BMSegmentStartEvent(t,e,i){this.type=t,this.firstFrame=e,this.totalFrames=i}function BMDestroyEvent(t,e){this.type=t,this.target=e}function BMRenderFrameErrorEvent(t,e){this.type="renderFrameError",this.nativeError=t,this.currentTime=e}function BMConfigErrorEvent(t){this.type="configError",this.nativeError=t}var createElementID=(_count=0,function(){return idPrefix$1+"__lottie_element_"+(_count+=1)}),_count;function HSVtoRGB(t,e,i){var r,n,a,s,o,l,h,c;switch(l=i*(1-e),h=i*(1-(o=6*t-(s=Math.floor(6*t)))*e),c=i*(1-(1-o)*e),s%6){case 0:r=i,n=c,a=l;break;case 1:r=h,n=i,a=l;break;case 2:r=l,n=i,a=c;break;case 3:r=l,n=h,a=i;break;case 4:r=c,n=l,a=i;break;case 5:r=i,n=l,a=h}return[r,n,a]}function RGBtoHSV(t,e,i){var r,n=Math.max(t,e,i),a=Math.min(t,e,i),s=n-a,o=0===n?0:s/n,l=n/255;switch(n){case a:r=0;break;case t:r=e-i+s*(e<i?6:0),r/=6*s;break;case e:r=i-t+2*s,r/=6*s;break;case i:r=t-e+4*s,r/=6*s}return[r,o,l]}function addSaturationToRGB(t,e){var i=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return i[1]+=e,i[1]>1?i[1]=1:i[1]<=0&&(i[1]=0),HSVtoRGB(i[0],i[1],i[2])}function addBrightnessToRGB(t,e){var i=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return i[2]+=e,i[2]>1?i[2]=1:i[2]<0&&(i[2]=0),HSVtoRGB(i[0],i[1],i[2])}function addHueToRGB(t,e){var i=RGBtoHSV(255*t[0],255*t[1],255*t[2]);return i[0]+=e/360,i[0]>1?i[0]-=1:i[0]<0&&(i[0]+=1),HSVtoRGB(i[0],i[1],i[2])}var rgbToHex=function(){var t,e,i=[];for(t=0;t<256;t+=1)e=t.toString(16),i[t]=1===e.length?"0"+e:e;return function(t,e,r){return t<0&&(t=0),e<0&&(e=0),r<0&&(r=0),"#"+i[t]+i[e]+i[r]}}(),setSubframeEnabled=function(t){subframeEnabled=!!t},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(t){expressionsPlugin=t},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(t){expressionsInterfaces=t},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(t){defaultCurveSegments=t},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(t){idPrefix$1=t};function createNS(t){return document.createElementNS(svgNS,t)}function _typeof$5(t){return _typeof$5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$5(t)}var dataManager=function(){var t,e,i=1,r=[],n={onmessage:function(){},postMessage:function(e){t({data:e})}},a={postMessage:function(t){n.onmessage({data:t})}};function s(){e||(e=function(e){if(window.Worker&&window.Blob&&getWebWorker()){var i=new Blob(["var _workerSelf = self; self.onmessage = ",e.toString()],{type:"text/javascript"}),r=URL.createObjectURL(i);return new Worker(r)}return t=e,n}((function(t){if(a.dataManager||(a.dataManager=function(){function t(n,a){var s,o,l,h,c,d,p=n.length;for(o=0;o<p;o+=1)if("ks"in(s=n[o])&&!s.completed){if(s.completed=!0,s.hasMask){var f=s.masksProperties;for(h=f.length,l=0;l<h;l+=1)if(f[l].pt.k.i)r(f[l].pt.k);else for(d=f[l].pt.k.length,c=0;c<d;c+=1)f[l].pt.k[c].s&&r(f[l].pt.k[c].s[0]),f[l].pt.k[c].e&&r(f[l].pt.k[c].e[0])}0===s.ty?(s.layers=e(s.refId,a),t(s.layers,a)):4===s.ty?i(s.shapes):5===s.ty&&u(s)}}function e(t,e){var i=function(t,e){for(var i=0,r=e.length;i<r;){if(e[i].id===t)return e[i];i+=1}return null}(t,e);return i?i.layers.__used?JSON.parse(JSON.stringify(i.layers)):(i.layers.__used=!0,i.layers):null}function i(t){var e,n,a;for(e=t.length-1;e>=0;e-=1)if("sh"===t[e].ty)if(t[e].ks.k.i)r(t[e].ks.k);else for(a=t[e].ks.k.length,n=0;n<a;n+=1)t[e].ks.k[n].s&&r(t[e].ks.k[n].s[0]),t[e].ks.k[n].e&&r(t[e].ks.k[n].e[0]);else"gr"===t[e].ty&&i(t[e].it)}function r(t){var e,i=t.i.length;for(e=0;e<i;e+=1)t.i[e][0]+=t.v[e][0],t.i[e][1]+=t.v[e][1],t.o[e][0]+=t.v[e][0],t.o[e][1]+=t.v[e][1]}function n(t,e){var i=e?e.split("."):[100,100,100];return t[0]>i[0]||!(i[0]>t[0])&&(t[1]>i[1]||!(i[1]>t[1])&&(t[2]>i[2]||!(i[2]>t[2])&&null))}var a,s=function(){var t=[4,4,14];function e(t){var e,i,r,n=t.length;for(e=0;e<n;e+=1)5===t[e].ty&&(r=void 0,r=(i=t[e]).t.d,i.t.d={k:[{s:r,t:0}]})}return function(i){if(n(t,i.v)&&(e(i.layers),i.assets)){var r,a=i.assets.length;for(r=0;r<a;r+=1)i.assets[r].layers&&e(i.assets[r].layers)}}}(),o=(a=[4,7,99],function(t){if(t.chars&&!n(a,t.v)){var e,r=t.chars.length;for(e=0;e<r;e+=1){var s=t.chars[e];s.data&&s.data.shapes&&(i(s.data.shapes),s.data.ip=0,s.data.op=99999,s.data.st=0,s.data.sr=1,s.data.ks={p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0}},t.chars[e].t||(s.data.shapes.push({ty:"no"}),s.data.shapes[0].it.push({p:{k:[0,0],a:0},s:{k:[100,100],a:0},a:{k:[0,0],a:0},r:{k:0,a:0},o:{k:100,a:0},sk:{k:0,a:0},sa:{k:0,a:0},ty:"tr"})))}}}),l=function(){var t=[5,7,15];function e(t){var e,i,r=t.length;for(e=0;e<r;e+=1)5===t[e].ty&&(i=void 0,"number"==typeof(i=t[e].t.p).a&&(i.a={a:0,k:i.a}),"number"==typeof i.p&&(i.p={a:0,k:i.p}),"number"==typeof i.r&&(i.r={a:0,k:i.r}))}return function(i){if(n(t,i.v)&&(e(i.layers),i.assets)){var r,a=i.assets.length;for(r=0;r<a;r+=1)i.assets[r].layers&&e(i.assets[r].layers)}}}(),h=function(){var t=[4,1,9];function e(t){var i,r,n,a=t.length;for(i=0;i<a;i+=1)if("gr"===t[i].ty)e(t[i].it);else if("fl"===t[i].ty||"st"===t[i].ty)if(t[i].c.k&&t[i].c.k[0].i)for(n=t[i].c.k.length,r=0;r<n;r+=1)t[i].c.k[r].s&&(t[i].c.k[r].s[0]/=255,t[i].c.k[r].s[1]/=255,t[i].c.k[r].s[2]/=255,t[i].c.k[r].s[3]/=255),t[i].c.k[r].e&&(t[i].c.k[r].e[0]/=255,t[i].c.k[r].e[1]/=255,t[i].c.k[r].e[2]/=255,t[i].c.k[r].e[3]/=255);else t[i].c.k[0]/=255,t[i].c.k[1]/=255,t[i].c.k[2]/=255,t[i].c.k[3]/=255}function i(t){var i,r=t.length;for(i=0;i<r;i+=1)4===t[i].ty&&e(t[i].shapes)}return function(e){if(n(t,e.v)&&(i(e.layers),e.assets)){var r,a=e.assets.length;for(r=0;r<a;r+=1)e.assets[r].layers&&i(e.assets[r].layers)}}}(),c=function(){var t=[4,4,18];function e(t){var i,r,n;for(i=t.length-1;i>=0;i-=1)if("sh"===t[i].ty)if(t[i].ks.k.i)t[i].ks.k.c=t[i].closed;else for(n=t[i].ks.k.length,r=0;r<n;r+=1)t[i].ks.k[r].s&&(t[i].ks.k[r].s[0].c=t[i].closed),t[i].ks.k[r].e&&(t[i].ks.k[r].e[0].c=t[i].closed);else"gr"===t[i].ty&&e(t[i].it)}function i(t){var i,r,n,a,s,o,l=t.length;for(r=0;r<l;r+=1){if((i=t[r]).hasMask){var h=i.masksProperties;for(a=h.length,n=0;n<a;n+=1)if(h[n].pt.k.i)h[n].pt.k.c=h[n].cl;else for(o=h[n].pt.k.length,s=0;s<o;s+=1)h[n].pt.k[s].s&&(h[n].pt.k[s].s[0].c=h[n].cl),h[n].pt.k[s].e&&(h[n].pt.k[s].e[0].c=h[n].cl)}4===i.ty&&e(i.shapes)}}return function(e){if(n(t,e.v)&&(i(e.layers),e.assets)){var r,a=e.assets.length;for(r=0;r<a;r+=1)e.assets[r].layers&&i(e.assets[r].layers)}}}();function u(t){0===t.t.a.length&&t.t.p}var d={completeData:function(i){i.__complete||(h(i),s(i),o(i),l(i),c(i),t(i.layers,i.assets),function(i,r){if(i){var n=0,a=i.length;for(n=0;n<a;n+=1)1===i[n].t&&(i[n].data.layers=e(i[n].data.refId,r),t(i[n].data.layers,r))}}(i.chars,i.assets),i.__complete=!0)}};return d.checkColors=h,d.checkChars=o,d.checkPathProperties=l,d.checkShapes=c,d.completeLayers=t,d}()),a.assetLoader||(a.assetLoader=function(){function t(t){var e=t.getResponseHeader("content-type");return e&&"json"===t.responseType&&-1!==e.indexOf("json")||t.response&&"object"===_typeof$5(t.response)?t.response:t.response&&"string"==typeof t.response?JSON.parse(t.response):t.responseText?JSON.parse(t.responseText):null}return{load:function(e,i,r,n){var a,s=new XMLHttpRequest;try{s.responseType="json"}catch(t){}s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status)a=t(s),r(a);else try{a=t(s),r(a)}catch(t){n&&n(t)}};try{s.open(["G","E","T"].join(""),e,!0)}catch(t){s.open(["G","E","T"].join(""),i+"/"+e,!0)}s.send()}}}()),"loadAnimation"===t.data.type)a.assetLoader.load(t.data.path,t.data.fullPath,(function(e){a.dataManager.completeData(e),a.postMessage({id:t.data.id,payload:e,status:"success"})}),(function(){a.postMessage({id:t.data.id,status:"error"})}));else if("complete"===t.data.type){var e=t.data.animation;a.dataManager.completeData(e),a.postMessage({id:t.data.id,payload:e,status:"success"})}else"loadData"===t.data.type&&a.assetLoader.load(t.data.path,t.data.fullPath,(function(e){a.postMessage({id:t.data.id,payload:e,status:"success"})}),(function(){a.postMessage({id:t.data.id,status:"error"})}))})),e.onmessage=function(t){var e=t.data,i=e.id,n=r[i];r[i]=null,"success"===e.status?n.onComplete(e.payload):n.onError&&n.onError()})}function o(t,e){var n="processId_"+(i+=1);return r[n]={onComplete:t,onError:e},n}return{loadAnimation:function(t,i,r){s();var n=o(i,r);e.postMessage({type:"loadAnimation",path:t,fullPath:window.location.origin+window.location.pathname,id:n})},loadData:function(t,i,r){s();var n=o(i,r);e.postMessage({type:"loadData",path:t,fullPath:window.location.origin+window.location.pathname,id:n})},completeAnimation:function(t,i,r){s();var n=o(i,r);e.postMessage({type:"complete",animation:t,id:n})}}}(),ImagePreloader=function(){var t=function(){var t=createTag("canvas");t.width=1,t.height=1;var e=t.getContext("2d");return e.fillStyle="rgba(0,0,0,0)",e.fillRect(0,0,1,1),t}();function e(){this.loadedAssets+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function i(){this.loadedFootagesCount+=1,this.loadedAssets===this.totalImages&&this.loadedFootagesCount===this.totalFootages&&this.imagesLoadedCb&&this.imagesLoadedCb(null)}function r(t,e,i){var r="";if(t.e)r=t.p;else if(e){var n=t.p;-1!==n.indexOf("images/")&&(n=n.split("/")[1]),r=e+n}else r=i,r+=t.u?t.u:"",r+=t.p;return r}function n(t){var e=0,i=setInterval(function(){(t.getBBox().width||e>500)&&(this._imageLoaded(),clearInterval(i)),e+=1}.bind(this),50)}function a(t){var e={assetData:t},i=r(t,this.assetsPath,this.path);return dataManager.loadData(i,function(t){e.img=t,this._footageLoaded()}.bind(this),function(){e.img={},this._footageLoaded()}.bind(this)),e}function s(){this._imageLoaded=e.bind(this),this._footageLoaded=i.bind(this),this.testImageLoaded=n.bind(this),this.createFootageData=a.bind(this),this.assetsPath="",this.path="",this.totalImages=0,this.totalFootages=0,this.loadedAssets=0,this.loadedFootagesCount=0,this.imagesLoadedCb=null,this.images=[]}return s.prototype={loadAssets:function(t,e){var i;this.imagesLoadedCb=e;var r=t.length;for(i=0;i<r;i+=1)t[i].layers||(t[i].t&&"seq"!==t[i].t?3===t[i].t&&(this.totalFootages+=1,this.images.push(this.createFootageData(t[i]))):(this.totalImages+=1,this.images.push(this._createImageData(t[i]))))},setAssetsPath:function(t){this.assetsPath=t||""},setPath:function(t){this.path=t||""},loadedImages:function(){return this.totalImages===this.loadedAssets},loadedFootages:function(){return this.totalFootages===this.loadedFootagesCount},destroy:function(){this.imagesLoadedCb=null,this.images.length=0},getAsset:function(t){for(var e=0,i=this.images.length;e<i;){if(this.images[e].assetData===t)return this.images[e].img;e+=1}return null},createImgData:function(e){var i=r(e,this.assetsPath,this.path),n=createTag("img");n.crossOrigin="anonymous",n.addEventListener("load",this._imageLoaded,!1),n.addEventListener("error",function(){a.img=t,this._imageLoaded()}.bind(this),!1),n.src=i;var a={img:n,assetData:e};return a},createImageData:function(e){var i=r(e,this.assetsPath,this.path),n=createNS("image");isSafari?this.testImageLoaded(n):n.addEventListener("load",this._imageLoaded,!1),n.addEventListener("error",function(){a.img=t,this._imageLoaded()}.bind(this),!1),n.setAttributeNS("http://www.w3.org/1999/xlink","href",i),this._elementHelper.append?this._elementHelper.append(n):this._elementHelper.appendChild(n);var a={img:n,assetData:e};return a},imageLoaded:e,footageLoaded:i,setCacheType:function(t,e){"svg"===t?(this._elementHelper=e,this._createImageData=this.createImageData.bind(this)):this._createImageData=this.createImgData.bind(this)}},s}();function BaseEvent(){}BaseEvent.prototype={triggerEvent:function(t,e){if(this._cbs[t])for(var i=this._cbs[t],r=0;r<i.length;r+=1)i[r](e)},addEventListener:function(t,e){return this._cbs[t]||(this._cbs[t]=[]),this._cbs[t].push(e),function(){this.removeEventListener(t,e)}.bind(this)},removeEventListener:function(t,e){if(e){if(this._cbs[t]){for(var i=0,r=this._cbs[t].length;i<r;)this._cbs[t][i]===e&&(this._cbs[t].splice(i,1),i-=1,r-=1),i+=1;this._cbs[t].length||(this._cbs[t]=null)}}else this._cbs[t]=null}};var markerParser=function(){function t(t){for(var e,i=t.split("\r\n"),r={},n=0,a=0;a<i.length;a+=1)2===(e=i[a].split(":")).length&&(r[e[0]]=e[1].trim(),n+=1);if(0===n)throw new Error;return r}return function(e){for(var i=[],r=0;r<e.length;r+=1){var n=e[r],a={time:n.tm,duration:n.dr};try{a.payload=JSON.parse(e[r].cm)}catch(i){try{a.payload=t(e[r].cm)}catch(t){a.payload={name:e[r].cm}}}i.push(a)}return i}}(),ProjectInterface=function(){function t(t){this.compositions.push(t)}return function(){function e(t){for(var e=0,i=this.compositions.length;e<i;){if(this.compositions[e].data&&this.compositions[e].data.nm===t)return this.compositions[e].prepareFrame&&this.compositions[e].data.xt&&this.compositions[e].prepareFrame(this.currentFrame),this.compositions[e].compInterface;e+=1}return null}return e.compositions=[],e.currentFrame=0,e.registerComposition=t,e}}(),renderers={},registerRenderer=function(t,e){renderers[t]=e};function getRenderer(t){return renderers[t]}function getRegisteredRenderer(){if(renderers.canvas)return"canvas";for(var t in renderers)if(renderers[t])return t;return""}function _typeof$4(t){return _typeof$4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$4(t)}var AnimationItem=function(){this._cbs=[],this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.firstFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.playCount=0,this.animationData={},this.assets=[],this.isPaused=!0,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=createElementID(),this.assetsPath="",this.timeCompleted=0,this.segmentPos=0,this.isSubframeEnabled=getSubframeEnabled(),this.segments=[],this._idle=!0,this._completedLoop=!1,this.projectInterface=ProjectInterface(),this.imagePreloader=new ImagePreloader,this.audioController=audioControllerFactory(),this.markers=[],this.configAnimation=this.configAnimation.bind(this),this.onSetupError=this.onSetupError.bind(this),this.onSegmentComplete=this.onSegmentComplete.bind(this),this.drawnFrameEvent=new BMEnterFrameEvent("drawnFrame",0,0,0),this.expressionsPlugin=getExpressionsPlugin()};extendPrototype([BaseEvent],AnimationItem),AnimationItem.prototype.setParams=function(t){(t.wrapper||t.container)&&(this.wrapper=t.wrapper||t.container);var e="svg";t.animType?e=t.animType:t.renderer&&(e=t.renderer);var i=getRenderer(e);this.renderer=new i(this,t.rendererSettings),this.imagePreloader.setCacheType(e,this.renderer.globalData.defs),this.renderer.setProjectInterface(this.projectInterface),this.animType=e,""===t.loop||null===t.loop||void 0===t.loop||!0===t.loop?this.loop=!0:!1===t.loop?this.loop=!1:this.loop=parseInt(t.loop,10),this.autoplay=!("autoplay"in t)||t.autoplay,this.name=t.name?t.name:"",this.autoloadSegments=!Object.prototype.hasOwnProperty.call(t,"autoloadSegments")||t.autoloadSegments,this.assetsPath=t.assetsPath,this.initialSegment=t.initialSegment,t.audioFactory&&this.audioController.setAudioFactory(t.audioFactory),t.animationData?this.setupAnimation(t.animationData):t.path&&(-1!==t.path.lastIndexOf("\\")?this.path=t.path.substr(0,t.path.lastIndexOf("\\")+1):this.path=t.path.substr(0,t.path.lastIndexOf("/")+1),this.fileName=t.path.substr(t.path.lastIndexOf("/")+1),this.fileName=this.fileName.substr(0,this.fileName.lastIndexOf(".json")),dataManager.loadAnimation(t.path,this.configAnimation,this.onSetupError))},AnimationItem.prototype.onSetupError=function(){this.trigger("data_failed")},AnimationItem.prototype.setupAnimation=function(t){dataManager.completeAnimation(t,this.configAnimation)},AnimationItem.prototype.setData=function(t,e){e&&"object"!==_typeof$4(e)&&(e=JSON.parse(e));var i={wrapper:t,animationData:e},r=t.attributes;i.path=r.getNamedItem("data-animation-path")?r.getNamedItem("data-animation-path").value:r.getNamedItem("data-bm-path")?r.getNamedItem("data-bm-path").value:r.getNamedItem("bm-path")?r.getNamedItem("bm-path").value:"",i.animType=r.getNamedItem("data-anim-type")?r.getNamedItem("data-anim-type").value:r.getNamedItem("data-bm-type")?r.getNamedItem("data-bm-type").value:r.getNamedItem("bm-type")?r.getNamedItem("bm-type").value:r.getNamedItem("data-bm-renderer")?r.getNamedItem("data-bm-renderer").value:r.getNamedItem("bm-renderer")?r.getNamedItem("bm-renderer").value:getRegisteredRenderer()||"canvas";var n=r.getNamedItem("data-anim-loop")?r.getNamedItem("data-anim-loop").value:r.getNamedItem("data-bm-loop")?r.getNamedItem("data-bm-loop").value:r.getNamedItem("bm-loop")?r.getNamedItem("bm-loop").value:"";"false"===n?i.loop=!1:"true"===n?i.loop=!0:""!==n&&(i.loop=parseInt(n,10));var a=r.getNamedItem("data-anim-autoplay")?r.getNamedItem("data-anim-autoplay").value:r.getNamedItem("data-bm-autoplay")?r.getNamedItem("data-bm-autoplay").value:!r.getNamedItem("bm-autoplay")||r.getNamedItem("bm-autoplay").value;i.autoplay="false"!==a,i.name=r.getNamedItem("data-name")?r.getNamedItem("data-name").value:r.getNamedItem("data-bm-name")?r.getNamedItem("data-bm-name").value:r.getNamedItem("bm-name")?r.getNamedItem("bm-name").value:"","false"===(r.getNamedItem("data-anim-prerender")?r.getNamedItem("data-anim-prerender").value:r.getNamedItem("data-bm-prerender")?r.getNamedItem("data-bm-prerender").value:r.getNamedItem("bm-prerender")?r.getNamedItem("bm-prerender").value:"")&&(i.prerender=!1),i.path?this.setParams(i):this.trigger("destroy")},AnimationItem.prototype.includeLayers=function(t){t.op>this.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-this.animationData.ip));var e,i,r=this.animationData.layers,n=r.length,a=t.layers,s=a.length;for(i=0;i<s;i+=1)for(e=0;e<n;){if(r[e].id===a[i].id){r[e]=a[i];break}e+=1}if((t.chars||t.fonts)&&(this.renderer.globalData.fontManager.addChars(t.chars),this.renderer.globalData.fontManager.addFonts(t.fonts,this.renderer.globalData.defs)),t.assets)for(n=t.assets.length,e=0;e<n;e+=1)this.animationData.assets.push(t.assets[e]);this.animationData.__complete=!1,dataManager.completeAnimation(this.animationData,this.onSegmentComplete)},AnimationItem.prototype.onSegmentComplete=function(t){this.animationData=t;var e=getExpressionsPlugin();e&&e.initExpressions(this),this.loadNextSegment()},AnimationItem.prototype.loadNextSegment=function(){var t=this.animationData.segments;if(!t||0===t.length||!this.autoloadSegments)return this.trigger("data_ready"),void(this.timeCompleted=this.totalFrames);var e=t.shift();this.timeCompleted=e.time*this.frameRate;var i=this.path+this.fileName+"_"+this.segmentPos+".json";this.segmentPos+=1,dataManager.loadData(i,this.includeLayers.bind(this),function(){this.trigger("data_failed")}.bind(this))},AnimationItem.prototype.loadSegments=function(){this.animationData.segments||(this.timeCompleted=this.totalFrames),this.loadNextSegment()},AnimationItem.prototype.imagesLoaded=function(){this.trigger("loaded_images"),this.checkLoaded()},AnimationItem.prototype.preloadImages=function(){this.imagePreloader.setAssetsPath(this.assetsPath),this.imagePreloader.setPath(this.path),this.imagePreloader.loadAssets(this.animationData.assets,this.imagesLoaded.bind(this))},AnimationItem.prototype.configAnimation=function(t){if(this.renderer)try{this.animationData=t,this.initialSegment?(this.totalFrames=Math.floor(this.initialSegment[1]-this.initialSegment[0]),this.firstFrame=Math.round(this.initialSegment[0])):(this.totalFrames=Math.floor(this.animationData.op-this.animationData.ip),this.firstFrame=Math.round(this.animationData.ip)),this.renderer.configAnimation(t),t.assets||(t.assets=[]),this.assets=this.animationData.assets,this.frameRate=this.animationData.fr,this.frameMult=this.animationData.fr/1e3,this.renderer.searchExtraCompositions(t.assets),this.markers=markerParser(t.markers||[]),this.trigger("config_ready"),this.preloadImages(),this.loadSegments(),this.updaFrameModifier(),this.waitForFontsLoaded(),this.isPaused&&this.audioController.pause()}catch(t){this.triggerConfigError(t)}},AnimationItem.prototype.waitForFontsLoaded=function(){this.renderer&&(this.renderer.globalData.fontManager.isLoaded?this.checkLoaded():setTimeout(this.waitForFontsLoaded.bind(this),20))},AnimationItem.prototype.checkLoaded=function(){if(!this.isLoaded&&this.renderer.globalData.fontManager.isLoaded&&(this.imagePreloader.loadedImages()||"canvas"!==this.renderer.rendererType)&&this.imagePreloader.loadedFootages()){this.isLoaded=!0;var t=getExpressionsPlugin();t&&t.initExpressions(this),this.renderer.initItems(),setTimeout(function(){this.trigger("DOMLoaded")}.bind(this),0),this.gotoFrame(),this.autoplay&&this.play()}},AnimationItem.prototype.resize=function(t,e){var i="number"==typeof t?t:void 0,r="number"==typeof e?e:void 0;this.renderer.updateContainerSize(i,r)},AnimationItem.prototype.setSubframe=function(t){this.isSubframeEnabled=!!t},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=this.isSubframeEnabled?this.currentRawFrame:~~this.currentRawFrame,this.timeCompleted!==this.totalFrames&&this.currentFrame>this.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!1!==this.isLoaded&&this.renderer)try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(t){this.triggerRenderFrameError(t)}},AnimationItem.prototype.play=function(t){t&&this.name!==t||!0===this.isPaused&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(t){t&&this.name!==t||!1===this.isPaused&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(t){t&&this.name!==t||(!0===this.isPaused?this.play():this.pause())},AnimationItem.prototype.stop=function(t){t&&this.name!==t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(t){for(var e,i=0;i<this.markers.length;i+=1)if((e=this.markers[i]).payload&&e.payload.name===t)return e;return null},AnimationItem.prototype.goToAndStop=function(t,e,i){if(!i||this.name===i){var r=Number(t);if(isNaN(r)){var n=this.getMarkerData(t);n&&this.goToAndStop(n.time,!0)}else e?this.setCurrentRawFrameValue(t):this.setCurrentRawFrameValue(t*this.frameModifier);this.pause()}},AnimationItem.prototype.goToAndPlay=function(t,e,i){if(!i||this.name===i){var r=Number(t);if(isNaN(r)){var n=this.getMarkerData(t);n&&(n.duration?this.playSegments([n.time,n.time+n.duration],!0):this.goToAndStop(n.time,!0))}else this.goToAndStop(r,e,i);this.play()}},AnimationItem.prototype.advanceTime=function(t){if(!0!==this.isPaused&&!1!==this.isLoaded){var e=this.currentRawFrame+t*this.frameModifier,i=!1;e>=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(i=!0,e=this.totalFrames-1):e<0?this.checkSegments(e%this.totalFrames)||(!this.loop||this.playCount--<=0&&!0!==this.loop?(i=!0,e=0):(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(e),i&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(t,e){this.playCount=0,t[1]<t[0]?(this.frameModifier>0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=t[0]-t[1],this.timeCompleted=this.totalFrames,this.firstFrame=t[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):t[1]>t[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=t[1]-t[0],this.timeCompleted=this.totalFrames,this.firstFrame=t[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(t,e){var i=-1;this.isPaused&&(this.currentRawFrame+this.firstFrame<t?i=t:this.currentRawFrame+this.firstFrame>e&&(i=e-t)),this.firstFrame=t,this.totalFrames=e-t,this.timeCompleted=this.totalFrames,-1!==i&&this.goToAndStop(i,!0)},AnimationItem.prototype.playSegments=function(t,e){if(e&&(this.segments.length=0),"object"===_typeof$4(t[0])){var i,r=t.length;for(i=0;i<r;i+=1)this.segments.push(t[i])}else this.segments.push(t);this.segments.length&&e&&this.adjustSegment(this.segments.shift(),0),this.isPaused&&this.play()},AnimationItem.prototype.resetSegments=function(t){this.segments.length=0,this.segments.push([this.animationData.ip,this.animationData.op]),t&&this.checkSegments(0)},AnimationItem.prototype.checkSegments=function(t){return!!this.segments.length&&(this.adjustSegment(this.segments.shift(),t),!0)},AnimationItem.prototype.destroy=function(t){t&&this.name!==t||!this.renderer||(this.renderer.destroy(),this.imagePreloader.destroy(),this.trigger("destroy"),this._cbs=null,this.onEnterFrame=null,this.onLoopComplete=null,this.onComplete=null,this.onSegmentStart=null,this.onDestroy=null,this.renderer=null,this.expressionsPlugin=null,this.imagePreloader=null,this.projectInterface=null)},AnimationItem.prototype.setCurrentRawFrameValue=function(t){this.currentRawFrame=t,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(t){this.playSpeed=t,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(t){this.playDirection=t<0?-1:1,this.updaFrameModifier()},AnimationItem.prototype.setLoop=function(t){this.loop=t},AnimationItem.prototype.setVolume=function(t,e){e&&this.name!==e||this.audioController.setVolume(t)},AnimationItem.prototype.getVolume=function(){return this.audioController.getVolume()},AnimationItem.prototype.mute=function(t){t&&this.name!==t||this.audioController.mute()},AnimationItem.prototype.unmute=function(t){t&&this.name!==t||this.audioController.unmute()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection,this.audioController.setRate(this.playSpeed*this.playDirection)},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssetsPath=function(t){var e="";if(t.e)e=t.p;else if(this.assetsPath){var i=t.p;-1!==i.indexOf("images/")&&(i=i.split("/")[1]),e=this.assetsPath+i}else e=this.path,e+=t.u?t.u:"",e+=t.p;return e},AnimationItem.prototype.getAssetData=function(t){for(var e=0,i=this.assets.length;e<i;){if(t===this.assets[e].id)return this.assets[e];e+=1}return null},AnimationItem.prototype.hide=function(){this.renderer.hide()},AnimationItem.prototype.show=function(){this.renderer.show()},AnimationItem.prototype.getDuration=function(t){return t?this.totalFrames:this.totalFrames/this.frameRate},AnimationItem.prototype.updateDocumentData=function(t,e,i){try{this.renderer.getElementByPath(t).updateDocumentData(e,i)}catch(t){}},AnimationItem.prototype.trigger=function(t){if(this._cbs&&this._cbs[t])switch(t){case"enterFrame":this.triggerEvent(t,new BMEnterFrameEvent(t,this.currentFrame,this.totalFrames,this.frameModifier));break;case"drawnFrame":this.drawnFrameEvent.currentTime=this.currentFrame,this.drawnFrameEvent.totalTime=this.totalFrames,this.drawnFrameEvent.direction=this.frameModifier,this.triggerEvent(t,this.drawnFrameEvent);break;case"loopComplete":this.triggerEvent(t,new BMCompleteLoopEvent(t,this.loop,this.playCount,this.frameMult));break;case"complete":this.triggerEvent(t,new BMCompleteEvent(t,this.frameMult));break;case"segmentStart":this.triggerEvent(t,new BMSegmentStartEvent(t,this.firstFrame,this.totalFrames));break;case"destroy":this.triggerEvent(t,new BMDestroyEvent(t,this));break;default:this.triggerEvent(t)}"enterFrame"===t&&this.onEnterFrame&&this.onEnterFrame.call(this,new BMEnterFrameEvent(t,this.currentFrame,this.totalFrames,this.frameMult)),"loopComplete"===t&&this.onLoopComplete&&this.onLoopComplete.call(this,new BMCompleteLoopEvent(t,this.loop,this.playCount,this.frameMult)),"complete"===t&&this.onComplete&&this.onComplete.call(this,new BMCompleteEvent(t,this.frameMult)),"segmentStart"===t&&this.onSegmentStart&&this.onSegmentStart.call(this,new BMSegmentStartEvent(t,this.firstFrame,this.totalFrames)),"destroy"===t&&this.onDestroy&&this.onDestroy.call(this,new BMDestroyEvent(t,this))},AnimationItem.prototype.triggerRenderFrameError=function(t){var e=new BMRenderFrameErrorEvent(t,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)},AnimationItem.prototype.triggerConfigError=function(t){var e=new BMConfigErrorEvent(t,this.currentFrame);this.triggerEvent("error",e),this.onError&&this.onError.call(this,e)};var animationManager=function(){var t={},e=[],i=0,r=0,n=0,a=!0,s=!1;function o(t){for(var i=0,n=t.target;i<r;)e[i].animation===n&&(e.splice(i,1),i-=1,r-=1,n.isPaused||c()),i+=1}function l(t,i){if(!t)return null;for(var n=0;n<r;){if(e[n].elem===t&&null!==e[n].elem)return e[n].animation;n+=1}var a=new AnimationItem;return u(a,t),a.setData(t,i),a}function h(){n+=1,f()}function c(){n-=1}function u(t,i){t.addEventListener("destroy",o),t.addEventListener("_active",h),t.addEventListener("_idle",c),e.push({elem:i,animation:t}),r+=1}function d(t){var o,l=t-i;for(o=0;o<r;o+=1)e[o].animation.advanceTime(l);i=t,n&&!s?window.requestAnimationFrame(d):a=!0}function p(t){i=t,window.requestAnimationFrame(d)}function f(){!s&&n&&a&&(window.requestAnimationFrame(p),a=!1)}return t.registerAnimation=l,t.loadAnimation=function(t){var e=new AnimationItem;return u(e,null),e.setParams(t),e},t.setSpeed=function(t,i){var n;for(n=0;n<r;n+=1)e[n].animation.setSpeed(t,i)},t.setDirection=function(t,i){var n;for(n=0;n<r;n+=1)e[n].animation.setDirection(t,i)},t.play=function(t){var i;for(i=0;i<r;i+=1)e[i].animation.play(t)},t.pause=function(t){var i;for(i=0;i<r;i+=1)e[i].animation.pause(t)},t.stop=function(t){var i;for(i=0;i<r;i+=1)e[i].animation.stop(t)},t.togglePause=function(t){var i;for(i=0;i<r;i+=1)e[i].animation.togglePause(t)},t.searchAnimations=function(t,e,i){var r,n=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),a=n.length;for(r=0;r<a;r+=1)i&&n[r].setAttribute("data-bm-type",i),l(n[r],t);if(e&&0===a){i||(i="svg");var s=document.getElementsByTagName("body")[0];s.innerText="";var o=createTag("div");o.style.width="100%",o.style.height="100%",o.setAttribute("data-bm-type",i),s.appendChild(o),l(o,t)}},t.resize=function(){var t;for(t=0;t<r;t+=1)e[t].animation.resize()},t.goToAndStop=function(t,i,n){var a;for(a=0;a<r;a+=1)e[a].animation.goToAndStop(t,i,n)},t.destroy=function(t){var i;for(i=r-1;i>=0;i-=1)e[i].animation.destroy(t)},t.freeze=function(){s=!0},t.unfreeze=function(){s=!1,f()},t.setVolume=function(t,i){var n;for(n=0;n<r;n+=1)e[n].animation.setVolume(t,i)},t.mute=function(t){var i;for(i=0;i<r;i+=1)e[i].animation.mute(t)},t.unmute=function(t){var i;for(i=0;i<r;i+=1)e[i].animation.unmute(t)},t.getRegisteredAnimations=function(){var t,i=e.length,r=[];for(t=0;t<i;t+=1)r.push(e[t].animation);return r},t}(),BezierFactory=function(){var t={getBezierEasing:function(t,i,r,n,a){var s=a||("bez_"+t+"_"+i+"_"+r+"_"+n).replace(/\./g,"p");if(e[s])return e[s];var o=new c([t,i,r,n]);return e[s]=o,o}},e={},i=11,r=1/(i-1),n="function"==typeof Float32Array;function a(t,e){return 1-3*e+3*t}function s(t,e){return 3*e-6*t}function o(t){return 3*t}function l(t,e,i){return((a(e,i)*t+s(e,i))*t+o(e))*t}function h(t,e,i){return 3*a(e,i)*t*t+2*s(e,i)*t+o(e)}function c(t){this._p=t,this._mSampleValues=n?new Float32Array(i):new Array(i),this._precomputed=!1,this.get=this.get.bind(this)}return c.prototype={get:function(t){var e=this._p[0],i=this._p[1],r=this._p[2],n=this._p[3];return this._precomputed||this._precompute(),e===i&&r===n?t:0===t?0:1===t?1:l(this._getTForX(t),i,n)},_precompute:function(){var t=this._p[0],e=this._p[1],i=this._p[2],r=this._p[3];this._precomputed=!0,t===e&&i===r||this._calcSampleValues()},_calcSampleValues:function(){for(var t=this._p[0],e=this._p[2],n=0;n<i;++n)this._mSampleValues[n]=l(n*r,t,e)},_getTForX:function(t){for(var e=this._p[0],n=this._p[2],a=this._mSampleValues,s=0,o=1,c=i-1;o!==c&&a[o]<=t;++o)s+=r;var u=s+(t-a[--o])/(a[o+1]-a[o])*r,d=h(u,e,n);return d>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=h(e,i,r);if(0===a)return e;e-=(l(e,i,r)-t)/a}return e}(t,u,e,n):0===d?u:function(t,e,i,r,n){var a,s,o=0;do{(a=l(s=e+(i-e)/2,r,n)-t)>0?i=s:e=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,s,s+r,e,n)}},t}(),pooling={double:function(t){return t.concat(createSizedArray(t.length))}},poolFactory=function(t,e,i){var r=0,n=t,a=createSizedArray(n);return{newElement:function(){return r?a[r-=1]:e()},release:function(t){r===n&&(a=pooling.double(a),n*=2),i&&i(t),a[r]=t,r+=1}}},bezierLengthPool=poolFactory(8,(function(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}})),segmentsLengthPool=poolFactory(8,(function(){return{lengths:[],totalLength:0}}),(function(t){var e,i=t.lengths.length;for(e=0;e<i;e+=1)bezierLengthPool.release(t.lengths[e]);t.lengths.length=0}));function bezFunction(){var t=Math;function e(t,e,i,r,n,a){var s=t*r+e*n+i*a-n*r-a*t-i*e;return s>-.001&&s<.001}var i=function(t,e,i,r){var n,a,s,o,l,h,c=getDefaultCurveSegments(),u=0,d=[],p=[],f=bezierLengthPool.newElement();for(s=i.length,n=0;n<c;n+=1){for(l=n/(c-1),h=0,a=0;a<s;a+=1)o=bmPow(1-l,3)*t[a]+3*bmPow(1-l,2)*l*i[a]+3*(1-l)*bmPow(l,2)*r[a]+bmPow(l,3)*e[a],d[a]=o,null!==p[a]&&(h+=bmPow(d[a]-p[a],2)),p[a]=d[a];h&&(u+=h=bmSqrt(h)),f.percents[n]=l,f.lengths[n]=u}return f.addedLength=u,f};function r(t){this.segmentLength=0,this.points=new Array(t)}function n(t,e){this.partialLength=t,this.point=e}var a,s=(a={},function(t,i,s,o){var l=(t[0]+"_"+t[1]+"_"+i[0]+"_"+i[1]+"_"+s[0]+"_"+s[1]+"_"+o[0]+"_"+o[1]).replace(/\./g,"p");if(!a[l]){var h,c,u,d,p,f,m,g=getDefaultCurveSegments(),y=0,v=null;2===t.length&&(t[0]!==i[0]||t[1]!==i[1])&&e(t[0],t[1],i[0],i[1],t[0]+s[0],t[1]+s[1])&&e(t[0],t[1],i[0],i[1],i[0]+o[0],i[1]+o[1])&&(g=2);var b=new r(g);for(u=s.length,h=0;h<g;h+=1){for(m=createSizedArray(u),p=h/(g-1),f=0,c=0;c<u;c+=1)d=bmPow(1-p,3)*t[c]+3*bmPow(1-p,2)*p*(t[c]+s[c])+3*(1-p)*bmPow(p,2)*(i[c]+o[c])+bmPow(p,3)*i[c],m[c]=d,null!==v&&(f+=bmPow(m[c]-v[c],2));y+=f=bmSqrt(f),b.points[h]=new n(f,m),v=m}b.segmentLength=y,a[l]=b}return a[l]});function o(t,e){var i=e.percents,r=e.lengths,n=i.length,a=bmFloor((n-1)*t),s=t*e.addedLength,o=0;if(a===n-1||0===a||s===r[a])return i[a];for(var l=r[a]>s?-1:1,h=!0;h;)if(r[a]<=s&&r[a+1]>s?(o=(s-r[a])/(r[a+1]-r[a]),h=!1):a+=l,a<0||a>=n-1){if(a===n-1)return i[a];h=!1}return i[a]+(i[a+1]-i[a])*o}var l=createTypedArray("float32",8);return{getSegmentsLength:function(t){var e,r=segmentsLengthPool.newElement(),n=t.c,a=t.v,s=t.o,o=t.i,l=t._length,h=r.lengths,c=0;for(e=0;e<l-1;e+=1)h[e]=i(a[e],a[e+1],s[e],o[e+1]),c+=h[e].addedLength;return n&&l&&(h[e]=i(a[e],a[0],s[e],o[0]),c+=h[e].addedLength),r.totalLength=c,r},getNewSegment:function(e,i,r,n,a,s,h){a<0?a=0:a>1&&(a=1);var c,u=o(a,h),d=o(s=s>1?1:s,h),p=e.length,f=1-u,m=1-d,g=f*f*f,y=u*f*f*3,v=u*u*f*3,b=u*u*u,x=f*f*m,C=u*f*m+f*u*m+f*f*d,_=u*u*m+f*u*d+u*f*d,T=u*u*d,A=f*m*m,S=u*m*m+f*d*m+f*m*d,P=u*d*m+f*d*d+u*m*d,w=u*d*d,M=m*m*m,E=d*m*m+m*d*m+m*m*d,R=d*d*m+m*d*d+d*m*d,B=d*d*d;for(c=0;c<p;c+=1)l[4*c]=t.round(1e3*(g*e[c]+y*r[c]+v*n[c]+b*i[c]))/1e3,l[4*c+1]=t.round(1e3*(x*e[c]+C*r[c]+_*n[c]+T*i[c]))/1e3,l[4*c+2]=t.round(1e3*(A*e[c]+S*r[c]+P*n[c]+w*i[c]))/1e3,l[4*c+3]=t.round(1e3*(M*e[c]+E*r[c]+R*n[c]+B*i[c]))/1e3;return l},getPointInSegment:function(e,i,r,n,a,s){var l=o(a,s),h=1-l;return[t.round(1e3*(h*h*h*e[0]+(l*h*h+h*l*h+h*h*l)*r[0]+(l*l*h+h*l*l+l*h*l)*n[0]+l*l*l*i[0]))/1e3,t.round(1e3*(h*h*h*e[1]+(l*h*h+h*l*h+h*h*l)*r[1]+(l*l*h+h*l*l+l*h*l)*n[1]+l*l*l*i[1]))/1e3]},buildBezierData:s,pointOnLine2D:e,pointOnLine3D:function(i,r,n,a,s,o,l,h,c){if(0===n&&0===o&&0===c)return e(i,r,a,s,l,h);var u,d=t.sqrt(t.pow(a-i,2)+t.pow(s-r,2)+t.pow(o-n,2)),p=t.sqrt(t.pow(l-i,2)+t.pow(h-r,2)+t.pow(c-n,2)),f=t.sqrt(t.pow(l-a,2)+t.pow(h-s,2)+t.pow(c-o,2));return(u=d>p?d>f?d-p-f:f-p-d:f>p?f-p-d:p-d-f)>-1e-4&&u<1e-4}}}var bez=bezFunction(),initFrame=initialDefaultFrame,mathAbs=Math.abs;function interpolateValue(t,e){var i,r=this.offsetTime;"multidimensional"===this.propType&&(i=createTypedArray("float32",this.pv.length));for(var n,a,s,o,l,h,c,u,d,p=e.lastIndex,f=p,m=this.keyframes.length-1,g=!0;g;){if(n=this.keyframes[f],a=this.keyframes[f+1],f===m-1&&t>=a.t-r){n.h&&(n=a),p=0;break}if(a.t-r>t){p=f;break}f<m-1?f+=1:(p=0,g=!1)}s=this.keyframesMetadata[f]||{};var y,v=a.t-r,b=n.t-r;if(n.to){s.bezierData||(s.bezierData=bez.buildBezierData(n.s,a.s||n.e,n.to,n.ti));var x=s.bezierData;if(t>=v||t<b){var C=t>=v?x.points.length-1:0;for(l=x.points[C].point.length,o=0;o<l;o+=1)i[o]=x.points[C].point[o]}else{s.__fnct?d=s.__fnct:(d=BezierFactory.getBezierEasing(n.o.x,n.o.y,n.i.x,n.i.y,n.n).get,s.__fnct=d),h=d((t-b)/(v-b));var _,T=x.segmentLength*h,A=e.lastFrame<t&&e._lastKeyframeIndex===f?e._lastAddedLength:0;for(u=e.lastFrame<t&&e._lastKeyframeIndex===f?e._lastPoint:0,g=!0,c=x.points.length;g;){if(A+=x.points[u].partialLength,0===T||0===h||u===x.points.length-1){for(l=x.points[u].point.length,o=0;o<l;o+=1)i[o]=x.points[u].point[o];break}if(T>=A&&T<A+x.points[u+1].partialLength){for(_=(T-A)/x.points[u+1].partialLength,l=x.points[u].point.length,o=0;o<l;o+=1)i[o]=x.points[u].point[o]+(x.points[u+1].point[o]-x.points[u].point[o])*_;break}u<c-1?u+=1:g=!1}e._lastPoint=u,e._lastAddedLength=A-x.points[u].partialLength,e._lastKeyframeIndex=f}}else{var S,P,w,M,E;if(m=n.s.length,y=a.s||n.e,this.sh&&1!==n.h)t>=v?(i[0]=y[0],i[1]=y[1],i[2]=y[2]):t<=b?(i[0]=n.s[0],i[1]=n.s[1],i[2]=n.s[2]):quaternionToEuler(i,slerp(createQuaternion(n.s),createQuaternion(y),(t-b)/(v-b)));else for(f=0;f<m;f+=1)1!==n.h&&(t>=v?h=1:t<b?h=0:(n.o.x.constructor===Array?(s.__fnct||(s.__fnct=[]),s.__fnct[f]?d=s.__fnct[f]:(S=void 0===n.o.x[f]?n.o.x[0]:n.o.x[f],P=void 0===n.o.y[f]?n.o.y[0]:n.o.y[f],w=void 0===n.i.x[f]?n.i.x[0]:n.i.x[f],M=void 0===n.i.y[f]?n.i.y[0]:n.i.y[f],d=BezierFactory.getBezierEasing(S,P,w,M).get,s.__fnct[f]=d)):s.__fnct?d=s.__fnct:(S=n.o.x,P=n.o.y,w=n.i.x,M=n.i.y,d=BezierFactory.getBezierEasing(S,P,w,M).get,n.keyframeMetadata=d),h=d((t-b)/(v-b)))),y=a.s||n.e,E=1===n.h?n.s[f]:n.s[f]+(y[f]-n.s[f])*h,"multidimensional"===this.propType?i[f]=E:i=E}return e.lastIndex=p,i}function slerp(t,e,i){var r,n,a,s,o,l=[],h=t[0],c=t[1],u=t[2],d=t[3],p=e[0],f=e[1],m=e[2],g=e[3];return(n=h*p+c*f+u*m+d*g)<0&&(n=-n,p=-p,f=-f,m=-m,g=-g),1-n>1e-6?(r=Math.acos(n),a=Math.sin(r),s=Math.sin((1-i)*r)/a,o=Math.sin(i*r)/a):(s=1-i,o=i),l[0]=s*h+o*p,l[1]=s*c+o*f,l[2]=s*u+o*m,l[3]=s*d+o*g,l}function quaternionToEuler(t,e){var i=e[0],r=e[1],n=e[2],a=e[3],s=Math.atan2(2*r*a-2*i*n,1-2*r*r-2*n*n),o=Math.asin(2*i*r+2*n*a),l=Math.atan2(2*i*a-2*r*n,1-2*i*i-2*n*n);t[0]=s/degToRads,t[1]=o/degToRads,t[2]=l/degToRads}function createQuaternion(t){var e=t[0]*degToRads,i=t[1]*degToRads,r=t[2]*degToRads,n=Math.cos(e/2),a=Math.cos(i/2),s=Math.cos(r/2),o=Math.sin(e/2),l=Math.sin(i/2),h=Math.sin(r/2);return[o*l*s+n*a*h,o*a*s+n*l*h,n*l*s-o*a*h,n*a*s-o*l*h]}function getValueAtCurrentTime(){var t=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,i=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(t===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=i&&t>=i||this._caching.lastFrame<e&&t<e))){this._caching.lastFrame>=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var r=this.interpolateValue(t,this._caching);this.pv=r}return this._caching.lastFrame=t,this.pv}function setVValue(t){var e;if("unidimensional"===this.propType)e=t*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var i=0,r=this.v.length;i<r;)e=t[i]*this.mult,mathAbs(this.v[i]-e)>1e-5&&(this.v[i]=e,this._mdf=!0),i+=1}function processEffectsSequence(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var t;this.lock=!0,this._mdf=this._isFirstFrame;var e=this.effectsSequence.length,i=this.kf?this.pv:this.data.k;for(t=0;t<e;t+=1)i=this.effectsSequence[t](i);this.setVValue(i),this._isFirstFrame=!1,this.lock=!1,this.frameId=this.elem.globalData.frameId}}function addEffect(t){this.effectsSequence.push(t),this.container.addDynamicProperty(this)}function ValueProperty(t,e,i,r){this.propType="unidimensional",this.mult=i||1,this.data=e,this.v=i?e.k*i:e.k,this.pv=e.k,this._mdf=!1,this.elem=t,this.container=r,this.comp=t.comp,this.k=!1,this.kf=!1,this.vel=0,this.effectsSequence=[],this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function MultiDimensionalProperty(t,e,i,r){var n;this.propType="multidimensional",this.mult=i||1,this.data=e,this._mdf=!1,this.elem=t,this.container=r,this.comp=t.comp,this.k=!1,this.kf=!1,this.frameId=-1;var a=e.k.length;for(this.v=createTypedArray("float32",a),this.pv=createTypedArray("float32",a),this.vel=createTypedArray("float32",a),n=0;n<a;n+=1)this.v[n]=e.k[n]*this.mult,this.pv[n]=e.k[n];this._isFirstFrame=!0,this.effectsSequence=[],this.getValue=processEffectsSequence,this.setVValue=setVValue,this.addEffect=addEffect}function KeyframedValueProperty(t,e,i,r){this.propType="unidimensional",this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=t.data.st,this.frameId=-1,this._caching={lastFrame:initFrame,lastIndex:0,value:0,_lastKeyframeIndex:-1},this.k=!0,this.kf=!0,this.data=e,this.mult=i||1,this.elem=t,this.container=r,this.comp=t.comp,this.v=initFrame,this.pv=initFrame,this._isFirstFrame=!0,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.addEffect=addEffect}function KeyframedMultidimensionalProperty(t,e,i,r){var n;this.propType="multidimensional";var a,s,o,l,h=e.k.length;for(n=0;n<h-1;n+=1)e.k[n].to&&e.k[n].s&&e.k[n+1]&&e.k[n+1].s&&(a=e.k[n].s,s=e.k[n+1].s,o=e.k[n].to,l=e.k[n].ti,(2===a.length&&(a[0]!==s[0]||a[1]!==s[1])&&bez.pointOnLine2D(a[0],a[1],s[0],s[1],a[0]+o[0],a[1]+o[1])&&bez.pointOnLine2D(a[0],a[1],s[0],s[1],s[0]+l[0],s[1]+l[1])||3===a.length&&(a[0]!==s[0]||a[1]!==s[1]||a[2]!==s[2])&&bez.pointOnLine3D(a[0],a[1],a[2],s[0],s[1],s[2],a[0]+o[0],a[1]+o[1],a[2]+o[2])&&bez.pointOnLine3D(a[0],a[1],a[2],s[0],s[1],s[2],s[0]+l[0],s[1]+l[1],s[2]+l[2]))&&(e.k[n].to=null,e.k[n].ti=null),a[0]===s[0]&&a[1]===s[1]&&0===o[0]&&0===o[1]&&0===l[0]&&0===l[1]&&(2===a.length||a[2]===s[2]&&0===o[2]&&0===l[2])&&(e.k[n].to=null,e.k[n].ti=null));this.effectsSequence=[getValueAtCurrentTime.bind(this)],this.data=e,this.keyframes=e.k,this.keyframesMetadata=[],this.offsetTime=t.data.st,this.k=!0,this.kf=!0,this._isFirstFrame=!0,this.mult=i||1,this.elem=t,this.container=r,this.comp=t.comp,this.getValue=processEffectsSequence,this.setVValue=setVValue,this.interpolateValue=interpolateValue,this.frameId=-1;var c=e.k[0].s.length;for(this.v=createTypedArray("float32",c),this.pv=createTypedArray("float32",c),n=0;n<c;n+=1)this.v[n]=initFrame,this.pv[n]=initFrame;this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray("float32",c)},this.addEffect=addEffect}var PropertyFactory=(ob={getProp:function(t,e,i,r,n){var a;if(e.sid&&(e=t.globalData.slotManager.getProp(e)),e.k.length)if("number"==typeof e.k[0])a=new MultiDimensionalProperty(t,e,r,n);else switch(i){case 0:a=new KeyframedValueProperty(t,e,r,n);break;case 1:a=new KeyframedMultidimensionalProperty(t,e,r,n)}else a=new ValueProperty(t,e,r,n);return a.effectsSequence.length&&n.addDynamicProperty(a),a}},ob),ob;function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype={addDynamicProperty:function(t){-1===this.dynamicProperties.indexOf(t)&&(this.dynamicProperties.push(t),this.container.addDynamicProperty(this),this._isAnimated=!0)},iterateDynamicProperties:function(){var t;this._mdf=!1;var e=this.dynamicProperties.length;for(t=0;t<e;t+=1)this.dynamicProperties[t].getValue(),this.dynamicProperties[t]._mdf&&(this._mdf=!0)},initDynamicPropertyContainer:function(t){this.container=t,this.dynamicProperties=[],this._mdf=!1,this._isAnimated=!1}};var pointPool=poolFactory(8,(function(){return createTypedArray("float32",2)}));function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(t,e){this.c=t,this.setLength(e);for(var i=0;i<e;)this.v[i]=pointPool.newElement(),this.o[i]=pointPool.newElement(),this.i[i]=pointPool.newElement(),i+=1},ShapePath.prototype.setLength=function(t){for(;this._maxLength<t;)this.doubleArrayLength();this._length=t},ShapePath.prototype.doubleArrayLength=function(){this.v=this.v.concat(createSizedArray(this._maxLength)),this.i=this.i.concat(createSizedArray(this._maxLength)),this.o=this.o.concat(createSizedArray(this._maxLength)),this._maxLength*=2},ShapePath.prototype.setXYAt=function(t,e,i,r,n){var a;switch(this._length=Math.max(this._length,r+1),this._length>=this._maxLength&&this.doubleArrayLength(),i){case"v":a=this.v;break;case"i":a=this.i;break;case"o":a=this.o;break;default:a=[]}(!a[r]||a[r]&&!n)&&(a[r]=pointPool.newElement()),a[r][0]=t,a[r][1]=e},ShapePath.prototype.setTripleAt=function(t,e,i,r,n,a,s,o){this.setXYAt(t,e,"v",s,o),this.setXYAt(i,r,"o",s,o),this.setXYAt(n,a,"i",s,o)},ShapePath.prototype.reverse=function(){var t=new ShapePath;t.setPathData(this.c,this._length);var e=this.v,i=this.o,r=this.i,n=0;this.c&&(t.setTripleAt(e[0][0],e[0][1],r[0][0],r[0][1],i[0][0],i[0][1],0,!1),n=1);var a,s=this._length-1,o=this._length;for(a=n;a<o;a+=1)t.setTripleAt(e[s][0],e[s][1],r[s][0],r[s][1],i[s][0],i[s][1],a,!1),s-=1;return t},ShapePath.prototype.length=function(){return this._length};var shapePool=(factory=poolFactory(4,(function(){return new ShapePath}),(function(t){var e,i=t._length;for(e=0;e<i;e+=1)pointPool.release(t.v[e]),pointPool.release(t.i[e]),pointPool.release(t.o[e]),t.v[e]=null,t.i[e]=null,t.o[e]=null;t._length=0,t.c=!1})),factory.clone=function(t){var e,i=factory.newElement(),r=void 0===t._length?t.v.length:t._length;for(i.setLength(r),i.c=t.c,e=0;e<r;e+=1)i.setTripleAt(t.v[e][0],t.v[e][1],t.o[e][0],t.o[e][1],t.i[e][0],t.i[e][1],e);return i},factory),factory;function ShapeCollection(){this._length=0,this._maxLength=4,this.shapes=createSizedArray(this._maxLength)}ShapeCollection.prototype.addShape=function(t){this._length===this._maxLength&&(this.shapes=this.shapes.concat(createSizedArray(this._maxLength)),this._maxLength*=2),this.shapes[this._length]=t,this._length+=1},ShapeCollection.prototype.releaseShapes=function(){var t;for(t=0;t<this._length;t+=1)shapePool.release(this.shapes[t]);this._length=0};var shapeCollectionPool=function(){var t={newShapeCollection:function(){return e?r[e-=1]:new ShapeCollection},release:function(t){var n,a=t._length;for(n=0;n<a;n+=1)shapePool.release(t.shapes[n]);t._length=0,e===i&&(r=pooling.double(r),i*=2),r[e]=t,e+=1}},e=0,i=4,r=createSizedArray(i);return t}(),ShapePropertyFactory=function(){var t=-999999;function e(t,e,i){var r,n,a,s,o,l,h,c,u,d=i.lastIndex,p=this.keyframes;if(t<p[0].t-this.offsetTime)r=p[0].s[0],a=!0,d=0;else if(t>=p[p.length-1].t-this.offsetTime)r=p[p.length-1].s?p[p.length-1].s[0]:p[p.length-2].e[0],a=!0;else{for(var f,m,g,y=d,v=p.length-1,b=!0;b&&(f=p[y],!((m=p[y+1]).t-this.offsetTime>t));)y<v-1?y+=1:b=!1;if(g=this.keyframesMetadata[y]||{},d=y,!(a=1===f.h)){if(t>=m.t-this.offsetTime)c=1;else if(t<f.t-this.offsetTime)c=0;else{var x;g.__fnct?x=g.__fnct:(x=BezierFactory.getBezierEasing(f.o.x,f.o.y,f.i.x,f.i.y).get,g.__fnct=x),c=x((t-(f.t-this.offsetTime))/(m.t-this.offsetTime-(f.t-this.offsetTime)))}n=m.s?m.s[0]:f.e[0]}r=f.s[0]}for(l=e._length,h=r.i[0].length,i.lastIndex=d,s=0;s<l;s+=1)for(o=0;o<h;o+=1)u=a?r.i[s][o]:r.i[s][o]+(n.i[s][o]-r.i[s][o])*c,e.i[s][o]=u,u=a?r.o[s][o]:r.o[s][o]+(n.o[s][o]-r.o[s][o])*c,e.o[s][o]=u,u=a?r.v[s][o]:r.v[s][o]+(n.v[s][o]-r.v[s][o])*c,e.v[s][o]=u}function i(){var e=this.comp.renderedFrame-this.offsetTime,i=this.keyframes[0].t-this.offsetTime,r=this.keyframes[this.keyframes.length-1].t-this.offsetTime,n=this._caching.lastFrame;return n!==t&&(n<i&&e<i||n>r&&e>r)||(this._caching.lastIndex=n<e?this._caching.lastIndex:0,this.interpolateShape(e,this.pv,this._caching)),this._caching.lastFrame=e,this.pv}function r(){this.paths=this.localShapeCollection}function n(t){(function(t,e){if(t._length!==e._length||t.c!==e.c)return!1;var i,r=t._length;for(i=0;i<r;i+=1)if(t.v[i][0]!==e.v[i][0]||t.v[i][1]!==e.v[i][1]||t.o[i][0]!==e.o[i][0]||t.o[i][1]!==e.o[i][1]||t.i[i][0]!==e.i[i][0]||t.i[i][1]!==e.i[i][1])return!1;return!0})(this.v,t)||(this.v=shapePool.clone(t),this.localShapeCollection.releaseShapes(),this.localShapeCollection.addShape(this.v),this._mdf=!0,this.paths=this.localShapeCollection)}function a(){if(this.elem.globalData.frameId!==this.frameId)if(this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{var t,e;this.lock=!0,this._mdf=!1,t=this.kf?this.pv:this.data.ks?this.data.ks.k:this.data.pt.k;var i=this.effectsSequence.length;for(e=0;e<i;e+=1)t=this.effectsSequence[e](t);this.setVValue(t),this.lock=!1,this.frameId=this.elem.globalData.frameId}else this._mdf=!1}function s(t,e,i){this.propType="shape",this.comp=t.comp,this.container=t,this.elem=t,this.data=e,this.k=!1,this.kf=!1,this._mdf=!1;var n=3===i?e.pt.k:e.ks.k;this.v=shapePool.clone(n),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.reset=r,this.effectsSequence=[]}function o(t){this.effectsSequence.push(t),this.container.addDynamicProperty(this)}function l(e,n,a){this.propType="shape",this.comp=e.comp,this.elem=e,this.container=e,this.offsetTime=e.data.st,this.keyframes=3===a?n.pt.k:n.ks.k,this.keyframesMetadata=[],this.k=!0,this.kf=!0;var s=this.keyframes[0].s[0].i.length;this.v=shapePool.newElement(),this.v.setPathData(this.keyframes[0].s[0].c,s),this.pv=shapePool.clone(this.v),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.paths.addShape(this.v),this.lastFrame=t,this.reset=r,this._caching={lastFrame:t,lastIndex:0},this.effectsSequence=[i.bind(this)]}s.prototype.interpolateShape=e,s.prototype.getValue=a,s.prototype.setVValue=n,s.prototype.addEffect=o,l.prototype.getValue=a,l.prototype.interpolateShape=e,l.prototype.setVValue=n,l.prototype.addEffect=o;var h=function(){var t=roundCorner;function e(t,e){this.v=shapePool.newElement(),this.v.setPathData(!0,4),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.paths=this.localShapeCollection,this.localShapeCollection.addShape(this.v),this.d=e.d,this.elem=t,this.comp=t.comp,this.frameId=-1,this.initDynamicPropertyContainer(t),this.p=PropertyFactory.getProp(t,e.p,1,0,this),this.s=PropertyFactory.getProp(t,e.s,1,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertEllToPath())}return e.prototype={reset:r,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertEllToPath())},convertEllToPath:function(){var e=this.p.v[0],i=this.p.v[1],r=this.s.v[0]/2,n=this.s.v[1]/2,a=3!==this.d,s=this.v;s.v[0][0]=e,s.v[0][1]=i-n,s.v[1][0]=a?e+r:e-r,s.v[1][1]=i,s.v[2][0]=e,s.v[2][1]=i+n,s.v[3][0]=a?e-r:e+r,s.v[3][1]=i,s.i[0][0]=a?e-r*t:e+r*t,s.i[0][1]=i-n,s.i[1][0]=a?e+r:e-r,s.i[1][1]=i-n*t,s.i[2][0]=a?e+r*t:e-r*t,s.i[2][1]=i+n,s.i[3][0]=a?e-r:e+r,s.i[3][1]=i+n*t,s.o[0][0]=a?e+r*t:e-r*t,s.o[0][1]=i-n,s.o[1][0]=a?e+r:e-r,s.o[1][1]=i+n*t,s.o[2][0]=a?e-r*t:e+r*t,s.o[2][1]=i+n,s.o[3][0]=a?e-r:e+r,s.o[3][1]=i-n*t}},extendPrototype([DynamicPropertyContainer],e),e}(),c=function(){function t(t,e){this.v=shapePool.newElement(),this.v.setPathData(!0,0),this.elem=t,this.comp=t.comp,this.data=e,this.frameId=-1,this.d=e.d,this.initDynamicPropertyContainer(t),1===e.sy?(this.ir=PropertyFactory.getProp(t,e.ir,0,0,this),this.is=PropertyFactory.getProp(t,e.is,0,.01,this),this.convertToPath=this.convertStarToPath):this.convertToPath=this.convertPolygonToPath,this.pt=PropertyFactory.getProp(t,e.pt,0,0,this),this.p=PropertyFactory.getProp(t,e.p,1,0,this),this.r=PropertyFactory.getProp(t,e.r,0,degToRads,this),this.or=PropertyFactory.getProp(t,e.or,0,0,this),this.os=PropertyFactory.getProp(t,e.os,0,.01,this),this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertToPath())}return t.prototype={reset:r,getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertToPath())},convertStarToPath:function(){var t,e,i,r,n=2*Math.floor(this.pt.v),a=2*Math.PI/n,s=!0,o=this.or.v,l=this.ir.v,h=this.os.v,c=this.is.v,u=2*Math.PI*o/(2*n),d=2*Math.PI*l/(2*n),p=-Math.PI/2;p+=this.r.v;var f=3===this.data.d?-1:1;for(this.v._length=0,t=0;t<n;t+=1){i=s?h:c,r=s?u:d;var m=(e=s?o:l)*Math.cos(p),g=e*Math.sin(p),y=0===m&&0===g?0:g/Math.sqrt(m*m+g*g),v=0===m&&0===g?0:-m/Math.sqrt(m*m+g*g);m+=+this.p.v[0],g+=+this.p.v[1],this.v.setTripleAt(m,g,m-y*r*i*f,g-v*r*i*f,m+y*r*i*f,g+v*r*i*f,t,!0),s=!s,p+=a*f}},convertPolygonToPath:function(){var t,e=Math.floor(this.pt.v),i=2*Math.PI/e,r=this.or.v,n=this.os.v,a=2*Math.PI*r/(4*e),s=.5*-Math.PI,o=3===this.data.d?-1:1;for(s+=this.r.v,this.v._length=0,t=0;t<e;t+=1){var l=r*Math.cos(s),h=r*Math.sin(s),c=0===l&&0===h?0:h/Math.sqrt(l*l+h*h),u=0===l&&0===h?0:-l/Math.sqrt(l*l+h*h);l+=+this.p.v[0],h+=+this.p.v[1],this.v.setTripleAt(l,h,l-c*a*n*o,h-u*a*n*o,l+c*a*n*o,h+u*a*n*o,t,!0),s+=i*o}this.paths.length=0,this.paths[0]=this.v}},extendPrototype([DynamicPropertyContainer],t),t}(),u=function(){function t(t,e){this.v=shapePool.newElement(),this.v.c=!0,this.localShapeCollection=shapeCollectionPool.newShapeCollection(),this.localShapeCollection.addShape(this.v),this.paths=this.localShapeCollection,this.elem=t,this.comp=t.comp,this.frameId=-1,this.d=e.d,this.initDynamicPropertyContainer(t),this.p=PropertyFactory.getProp(t,e.p,1,0,this),this.s=PropertyFactory.getProp(t,e.s,1,0,this),this.r=PropertyFactory.getProp(t,e.r,0,0,this),this.dynamicProperties.length?this.k=!0:(this.k=!1,this.convertRectToPath())}return t.prototype={convertRectToPath:function(){var t=this.p.v[0],e=this.p.v[1],i=this.s.v[0]/2,r=this.s.v[1]/2,n=bmMin(i,r,this.r.v),a=n*(1-roundCorner);this.v._length=0,2===this.d||1===this.d?(this.v.setTripleAt(t+i,e-r+n,t+i,e-r+n,t+i,e-r+a,0,!0),this.v.setTripleAt(t+i,e+r-n,t+i,e+r-a,t+i,e+r-n,1,!0),0!==n?(this.v.setTripleAt(t+i-n,e+r,t+i-n,e+r,t+i-a,e+r,2,!0),this.v.setTripleAt(t-i+n,e+r,t-i+a,e+r,t-i+n,e+r,3,!0),this.v.setTripleAt(t-i,e+r-n,t-i,e+r-n,t-i,e+r-a,4,!0),this.v.setTripleAt(t-i,e-r+n,t-i,e-r+a,t-i,e-r+n,5,!0),this.v.setTripleAt(t-i+n,e-r,t-i+n,e-r,t-i+a,e-r,6,!0),this.v.setTripleAt(t+i-n,e-r,t+i-a,e-r,t+i-n,e-r,7,!0)):(this.v.setTripleAt(t-i,e+r,t-i+a,e+r,t-i,e+r,2),this.v.setTripleAt(t-i,e-r,t-i,e-r+a,t-i,e-r,3))):(this.v.setTripleAt(t+i,e-r+n,t+i,e-r+a,t+i,e-r+n,0,!0),0!==n?(this.v.setTripleAt(t+i-n,e-r,t+i-n,e-r,t+i-a,e-r,1,!0),this.v.setTripleAt(t-i+n,e-r,t-i+a,e-r,t-i+n,e-r,2,!0),this.v.setTripleAt(t-i,e-r+n,t-i,e-r+n,t-i,e-r+a,3,!0),this.v.setTripleAt(t-i,e+r-n,t-i,e+r-a,t-i,e+r-n,4,!0),this.v.setTripleAt(t-i+n,e+r,t-i+n,e+r,t-i+a,e+r,5,!0),this.v.setTripleAt(t+i-n,e+r,t+i-a,e+r,t+i-n,e+r,6,!0),this.v.setTripleAt(t+i,e+r-n,t+i,e+r-n,t+i,e+r-a,7,!0)):(this.v.setTripleAt(t-i,e-r,t-i+a,e-r,t-i,e-r,1,!0),this.v.setTripleAt(t-i,e+r,t-i,e+r-a,t-i,e+r,2,!0),this.v.setTripleAt(t+i,e+r,t+i-a,e+r,t+i,e+r,3,!0)))},getValue:function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf&&this.convertRectToPath())},reset:r},extendPrototype([DynamicPropertyContainer],t),t}(),d={getShapeProp:function(t,e,i){var r;return 3===i||4===i?r=(3===i?e.pt:e.ks).k.length?new l(t,e,i):new s(t,e,i):5===i?r=new u(t,e):6===i?r=new h(t,e):7===i&&(r=new c(t,e)),r.k&&t.addDynamicProperty(r),r},getConstructorFunction:function(){return s},getKeyframedConstructorFunction:function(){return l}};return d}(),Matrix=function(){var t=Math.cos,e=Math.sin,i=Math.tan,r=Math.round;function n(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function a(i){if(0===i)return this;var r=t(i),n=e(i);return this._t(r,-n,0,0,n,r,0,0,0,0,1,0,0,0,0,1)}function s(i){if(0===i)return this;var r=t(i),n=e(i);return this._t(1,0,0,0,0,r,-n,0,0,n,r,0,0,0,0,1)}function o(i){if(0===i)return this;var r=t(i),n=e(i);return this._t(r,0,n,0,0,1,0,0,-n,0,r,0,0,0,0,1)}function l(i){if(0===i)return this;var r=t(i),n=e(i);return this._t(r,-n,0,0,n,r,0,0,0,0,1,0,0,0,0,1)}function h(t,e){return this._t(1,e,t,1,0,0)}function c(t,e){return this.shear(i(t),i(e))}function u(r,n){var a=t(n),s=e(n);return this._t(a,s,0,0,-s,a,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,i(r),1,0,0,0,0,1,0,0,0,0,1)._t(a,-s,0,0,s,a,0,0,0,0,1,0,0,0,0,1)}function d(t,e,i){return i||0===i||(i=1),1===t&&1===e&&1===i?this:this._t(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)}function p(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f,m){return this.props[0]=t,this.props[1]=e,this.props[2]=i,this.props[3]=r,this.props[4]=n,this.props[5]=a,this.props[6]=s,this.props[7]=o,this.props[8]=l,this.props[9]=h,this.props[10]=c,this.props[11]=u,this.props[12]=d,this.props[13]=p,this.props[14]=f,this.props[15]=m,this}function f(t,e,i){return i=i||0,0!==t||0!==e||0!==i?this._t(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1):this}function m(t,e,i,r,n,a,s,o,l,h,c,u,d,p,f,m){var g=this.props;if(1===t&&0===e&&0===i&&0===r&&0===n&&1===a&&0===s&&0===o&&0===l&&0===h&&1===c&&0===u)return g[12]=g[12]*t+g[15]*d,g[13]=g[13]*a+g[15]*p,g[14]=g[14]*c+g[15]*f,g[15]*=m,this._identityCalculated=!1,this;var y=g[0],v=g[1],b=g[2],x=g[3],C=g[4],_=g[5],T=g[6],A=g[7],S=g[8],P=g[9],w=g[10],M=g[11],E=g[12],R=g[13],B=g[14],k=g[15];return g[0]=y*t+v*n+b*l+x*d,g[1]=y*e+v*a+b*h+x*p,g[2]=y*i+v*s+b*c+x*f,g[3]=y*r+v*o+b*u+x*m,g[4]=C*t+_*n+T*l+A*d,g[5]=C*e+_*a+T*h+A*p,g[6]=C*i+_*s+T*c+A*f,g[7]=C*r+_*o+T*u+A*m,g[8]=S*t+P*n+w*l+M*d,g[9]=S*e+P*a+w*h+M*p,g[10]=S*i+P*s+w*c+M*f,g[11]=S*r+P*o+w*u+M*m,g[12]=E*t+R*n+B*l+k*d,g[13]=E*e+R*a+B*h+k*p,g[14]=E*i+R*s+B*c+k*f,g[15]=E*r+R*o+B*u+k*m,this._identityCalculated=!1,this}function g(t){var e=t.props;return this.transform(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function y(){return this._identityCalculated||(this._identity=!(1!==this.props[0]||0!==this.props[1]||0!==this.props[2]||0!==this.props[3]||0!==this.props[4]||1!==this.props[5]||0!==this.props[6]||0!==this.props[7]||0!==this.props[8]||0!==this.props[9]||1!==this.props[10]||0!==this.props[11]||0!==this.props[12]||0!==this.props[13]||0!==this.props[14]||1!==this.props[15]),this._identityCalculated=!0),this._identity}function v(t){for(var e=0;e<16;){if(t.props[e]!==this.props[e])return!1;e+=1}return!0}function b(t){var e;for(e=0;e<16;e+=1)t.props[e]=this.props[e];return t}function x(t){var e;for(e=0;e<16;e+=1)this.props[e]=t[e]}function C(t,e,i){return{x:t*this.props[0]+e*this.props[4]+i*this.props[8]+this.props[12],y:t*this.props[1]+e*this.props[5]+i*this.props[9]+this.props[13],z:t*this.props[2]+e*this.props[6]+i*this.props[10]+this.props[14]}}function _(t,e,i){return t*this.props[0]+e*this.props[4]+i*this.props[8]+this.props[12]}function T(t,e,i){return t*this.props[1]+e*this.props[5]+i*this.props[9]+this.props[13]}function A(t,e,i){return t*this.props[2]+e*this.props[6]+i*this.props[10]+this.props[14]}function S(){var t=this.props[0]*this.props[5]-this.props[1]*this.props[4],e=this.props[5]/t,i=-this.props[1]/t,r=-this.props[4]/t,n=this.props[0]/t,a=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/t,s=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/t,o=new Matrix;return o.props[0]=e,o.props[1]=i,o.props[4]=r,o.props[5]=n,o.props[12]=a,o.props[13]=s,o}function P(t){return this.getInverseMatrix().applyToPointArray(t[0],t[1],t[2]||0)}function w(t){var e,i=t.length,r=[];for(e=0;e<i;e+=1)r[e]=P(t[e]);return r}function M(t,e,i){var r=createTypedArray("float32",6);if(this.isIdentity())r[0]=t[0],r[1]=t[1],r[2]=e[0],r[3]=e[1],r[4]=i[0],r[5]=i[1];else{var n=this.props[0],a=this.props[1],s=this.props[4],o=this.props[5],l=this.props[12],h=this.props[13];r[0]=t[0]*n+t[1]*s+l,r[1]=t[0]*a+t[1]*o+h,r[2]=e[0]*n+e[1]*s+l,r[3]=e[0]*a+e[1]*o+h,r[4]=i[0]*n+i[1]*s+l,r[5]=i[0]*a+i[1]*o+h}return r}function E(t,e,i){return this.isIdentity()?[t,e,i]:[t*this.props[0]+e*this.props[4]+i*this.props[8]+this.props[12],t*this.props[1]+e*this.props[5]+i*this.props[9]+this.props[13],t*this.props[2]+e*this.props[6]+i*this.props[10]+this.props[14]]}function R(t,e){if(this.isIdentity())return t+","+e;var i=this.props;return Math.round(100*(t*i[0]+e*i[4]+i[12]))/100+","+Math.round(100*(t*i[1]+e*i[5]+i[13]))/100}function B(){for(var t=0,e=this.props,i="matrix3d(";t<16;)i+=r(1e4*e[t])/1e4,i+=15===t?")":",",t+=1;return i}function k(t){return t<1e-6&&t>0||t>-1e-6&&t<0?r(1e4*t)/1e4:t}function D(){var t=this.props;return"matrix("+k(t[0])+","+k(t[1])+","+k(t[4])+","+k(t[5])+","+k(t[12])+","+k(t[13])+")"}return function(){this.reset=n,this.rotate=a,this.rotateX=s,this.rotateY=o,this.rotateZ=l,this.skew=c,this.skewFromAxis=u,this.shear=h,this.scale=d,this.setTransform=p,this.translate=f,this.transform=m,this.multiply=g,this.applyToPoint=C,this.applyToX=_,this.applyToY=T,this.applyToZ=A,this.applyToPointArray=E,this.applyToTriplePoints=M,this.applyToPointStringified=R,this.toCSS=B,this.to2dCSS=D,this.clone=b,this.cloneFromProps=x,this.equals=v,this.inversePoints=w,this.inversePoint=P,this.getInverseMatrix=S,this._t=this.transform,this.isIdentity=y,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(t){return _typeof$3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$3(t)}var lottie={};function setLocation(t){setLocationHref(t)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(t){setSubframeEnabled(t)}function setPrefix(t){setIdPrefix(t)}function loadAnimation(t){return animationManager.loadAnimation(t)}function setQuality(t){if("string"==typeof t)switch(t){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10)}else!isNaN(t)&&t>1&&setDefaultCurveSegments(t)}function inBrowser(){return"undefined"!=typeof navigator}function installPlugin(t,e){"expressions"===t&&setExpressionsPlugin(e)}function getFactory(t){switch(t){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}function checkReady(){"complete"===document.readyState&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(t){for(var e=queryString.split("&"),i=0;i<e.length;i+=1){var r=e[i].split("=");if(decodeURIComponent(r[0])==t)return decodeURIComponent(r[1])}return null}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.12.2";var queryString="",scripts=document.getElementsByTagName("script"),index=scripts.length-1,myScript=scripts[index]||{src:""};queryString=myScript.src?myScript.src.replace(/^[^\?]+\??/,""):"",getQueryVariable("renderer");var readyStateCheckInterval=setInterval(checkReady,100);try{"object"!==_typeof$3(exports)&&(window.bodymovin=lottie)}catch(t){}var ShapeModifiers=function(){var t={},e={};return t.registerModifier=function(t,i){e[t]||(e[t]=i)},t.getModifier=function(t,i,r){return new e[t](i,r)},t}();function ShapeModifier(){}function TrimModifier(){}function PuckerAndBloatModifier(){}ShapeModifier.prototype.initModifierProperties=function(){},ShapeModifier.prototype.addShapeToModifier=function(){},ShapeModifier.prototype.addShape=function(t){if(!this.closed){t.sh.container.addDynamicProperty(t.sh);var e={shape:t.sh,data:t,localShapeCollection:shapeCollectionPool.newShapeCollection()};this.shapes.push(e),this.addShapeToModifier(e),this._isAnimated&&t.setAsAnimated()}},ShapeModifier.prototype.init=function(t,e){this.shapes=[],this.elem=t,this.initDynamicPropertyContainer(t),this.initModifierProperties(t,e),this.frameId=initialDefaultFrame,this.closed=!1,this.k=!1,this.dynamicProperties.length?this.k=!0:this.getValue(!0)},ShapeModifier.prototype.processKeys=function(){this.elem.globalData.frameId!==this.frameId&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties())},extendPrototype([DynamicPropertyContainer],ShapeModifier),extendPrototype([ShapeModifier],TrimModifier),TrimModifier.prototype.initModifierProperties=function(t,e){this.s=PropertyFactory.getProp(t,e.s,0,.01,this),this.e=PropertyFactory.getProp(t,e.e,0,.01,this),this.o=PropertyFactory.getProp(t,e.o,0,0,this),this.sValue=0,this.eValue=0,this.getValue=this.processKeys,this.m=e.m,this._isAnimated=!!this.s.effectsSequence.length||!!this.e.effectsSequence.length||!!this.o.effectsSequence.length},TrimModifier.prototype.addShapeToModifier=function(t){t.pathsData=[]},TrimModifier.prototype.calculateShapeEdges=function(t,e,i,r,n){var a=[];e<=1?a.push({s:t,e:e}):t>=1?a.push({s:t-1,e:e-1}):(a.push({s:t,e:1}),a.push({s:0,e:e-1}));var s,o,l=[],h=a.length;for(s=0;s<h;s+=1){var c,u;(o=a[s]).e*n<r||o.s*n>r+i||(c=o.s*n<=r?0:(o.s*n-r)/i,u=o.e*n>=r+i?1:(o.e*n-r)/i,l.push([c,u]))}return l.length||l.push([0,0]),l},TrimModifier.prototype.releasePathsData=function(t){var e,i=t.length;for(e=0;e<i;e+=1)segmentsLengthPool.release(t[e]);return t.length=0,t},TrimModifier.prototype.processShapes=function(t){var e,i,r,n;if(this._mdf||t){var a=this.o.v%360/360;if(a<0&&(a+=1),(e=this.s.v>1?1+a:this.s.v<0?0+a:this.s.v+a)>(i=this.e.v>1?1+a:this.e.v<0?0+a:this.e.v+a)){var s=e;e=i,i=s}e=1e-4*Math.round(1e4*e),i=1e-4*Math.round(1e4*i),this.sValue=e,this.eValue=i}else e=this.sValue,i=this.eValue;var o,l,h,c,u,d=this.shapes.length,p=0;if(i===e)for(n=0;n<d;n+=1)this.shapes[n].localShapeCollection.releaseShapes(),this.shapes[n].shape._mdf=!0,this.shapes[n].shape.paths=this.shapes[n].localShapeCollection,this._mdf&&(this.shapes[n].pathsData.length=0);else if(1===i&&0===e||0===i&&1===e){if(this._mdf)for(n=0;n<d;n+=1)this.shapes[n].pathsData.length=0,this.shapes[n].shape._mdf=!0}else{var f,m,g=[];for(n=0;n<d;n+=1)if((f=this.shapes[n]).shape._mdf||this._mdf||t||2===this.m){if(l=(r=f.shape.paths)._length,u=0,!f.shape._mdf&&f.pathsData.length)u=f.totalShapeLength;else{for(h=this.releasePathsData(f.pathsData),o=0;o<l;o+=1)c=bez.getSegmentsLength(r.shapes[o]),h.push(c),u+=c.totalLength;f.totalShapeLength=u,f.pathsData=h}p+=u,f.shape._mdf=!0}else f.shape.paths=f.localShapeCollection;var y,v=e,b=i,x=0;for(n=d-1;n>=0;n-=1)if((f=this.shapes[n]).shape._mdf){for((m=f.localShapeCollection).releaseShapes(),2===this.m&&d>1?(y=this.calculateShapeEdges(e,i,f.totalShapeLength,x,p),x+=f.totalShapeLength):y=[[v,b]],l=y.length,o=0;o<l;o+=1){v=y[o][0],b=y[o][1],g.length=0,b<=1?g.push({s:f.totalShapeLength*v,e:f.totalShapeLength*b}):v>=1?g.push({s:f.totalShapeLength*(v-1),e:f.totalShapeLength*(b-1)}):(g.push({s:f.totalShapeLength*v,e:f.totalShapeLength}),g.push({s:0,e:f.totalShapeLength*(b-1)}));var C=this.addShapes(f,g[0]);if(g[0].s!==g[0].e){if(g.length>1)if(f.shape.paths.shapes[f.shape.paths._length-1].c){var _=C.pop();this.addPaths(C,m),C=this.addShapes(f,g[1],_)}else this.addPaths(C,m),C=this.addShapes(f,g[1]);this.addPaths(C,m)}}f.shape.paths=m}}},TrimModifier.prototype.addPaths=function(t,e){var i,r=t.length;for(i=0;i<r;i+=1)e.addShape(t[i])},TrimModifier.prototype.addSegment=function(t,e,i,r,n,a,s){n.setXYAt(e[0],e[1],"o",a),n.setXYAt(i[0],i[1],"i",a+1),s&&n.setXYAt(t[0],t[1],"v",a),n.setXYAt(r[0],r[1],"v",a+1)},TrimModifier.prototype.addSegmentFromArray=function(t,e,i,r){e.setXYAt(t[1],t[5],"o",i),e.setXYAt(t[2],t[6],"i",i+1),r&&e.setXYAt(t[0],t[4],"v",i),e.setXYAt(t[3],t[7],"v",i+1)},TrimModifier.prototype.addShapes=function(t,e,i){var r,n,a,s,o,l,h,c,u=t.pathsData,d=t.shape.paths.shapes,p=t.shape.paths._length,f=0,m=[],g=!0;for(i?(o=i._length,c=i._length):(i=shapePool.newElement(),o=0,c=0),m.push(i),r=0;r<p;r+=1){for(l=u[r].lengths,i.c=d[r].c,a=d[r].c?l.length:l.length+1,n=1;n<a;n+=1)if(f+(s=l[n-1]).addedLength<e.s)f+=s.addedLength,i.c=!1;else{if(f>e.e){i.c=!1;break}e.s<=f&&e.e>=f+s.addedLength?(this.addSegment(d[r].v[n-1],d[r].o[n-1],d[r].i[n],d[r].v[n],i,o,g),g=!1):(h=bez.getNewSegment(d[r].v[n-1],d[r].v[n],d[r].o[n-1],d[r].i[n],(e.s-f)/s.addedLength,(e.e-f)/s.addedLength,l[n-1]),this.addSegmentFromArray(h,i,o,g),g=!1,i.c=!1),f+=s.addedLength,o+=1}if(d[r].c&&l.length){if(s=l[n-1],f<=e.e){var y=l[n-1].addedLength;e.s<=f&&e.e>=f+y?(this.addSegment(d[r].v[n-1],d[r].o[n-1],d[r].i[0],d[r].v[0],i,o,g),g=!1):(h=bez.getNewSegment(d[r].v[n-1],d[r].v[0],d[r].o[n-1],d[r].i[0],(e.s-f)/y,(e.e-f)/y,l[n-1]),this.addSegmentFromArray(h,i,o,g),g=!1,i.c=!1)}else i.c=!1;f+=s.addedLength,o+=1}if(i._length&&(i.setXYAt(i.v[c][0],i.v[c][1],"i",c),i.setXYAt(i.v[i._length-1][0],i.v[i._length-1][1],"o",i._length-1)),f>e.e)break;r<p-1&&(i=shapePool.newElement(),g=!0,m.push(i),o=0)}return m},extendPrototype([ShapeModifier],PuckerAndBloatModifier),PuckerAndBloatModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(t,e.a,0,null,this),this._isAnimated=!!this.amount.effectsSequence.length},PuckerAndBloatModifier.prototype.processPath=function(t,e){var i=e/100,r=[0,0],n=t._length,a=0;for(a=0;a<n;a+=1)r[0]+=t.v[a][0],r[1]+=t.v[a][1];r[0]/=n,r[1]/=n;var s,o,l,h,c,u,d=shapePool.newElement();for(d.c=t.c,a=0;a<n;a+=1)s=t.v[a][0]+(r[0]-t.v[a][0])*i,o=t.v[a][1]+(r[1]-t.v[a][1])*i,l=t.o[a][0]+(r[0]-t.o[a][0])*-i,h=t.o[a][1]+(r[1]-t.o[a][1])*-i,c=t.i[a][0]+(r[0]-t.i[a][0])*-i,u=t.i[a][1]+(r[1]-t.i[a][1])*-i,d.setTripleAt(s,o,l,h,c,u,a);return d},PuckerAndBloatModifier.prototype.processShapes=function(t){var e,i,r,n,a,s,o=this.shapes.length,l=this.amount.v;if(0!==l)for(i=0;i<o;i+=1){if(s=(a=this.shapes[i]).localShapeCollection,a.shape._mdf||this._mdf||t)for(s.releaseShapes(),a.shape._mdf=!0,e=a.shape.paths.shapes,n=a.shape.paths._length,r=0;r<n;r+=1)s.addShape(this.processPath(e[r],l));a.shape.paths=a.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)};var TransformPropertyFactory=function(){var t=[0,0];function e(t,e,i){if(this.elem=t,this.frameId=-1,this.propType="transform",this.data=e,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(i||t),e.p&&e.p.s?(this.px=PropertyFactory.getProp(t,e.p.x,0,0,this),this.py=PropertyFactory.getProp(t,e.p.y,0,0,this),e.p.z&&(this.pz=PropertyFactory.getProp(t,e.p.z,0,0,this))):this.p=PropertyFactory.getProp(t,e.p||{k:[0,0,0]},1,0,this),e.rx){if(this.rx=PropertyFactory.getProp(t,e.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(t,e.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(t,e.rz,0,degToRads,this),e.or.k[0].ti){var r,n=e.or.k.length;for(r=0;r<n;r+=1)e.or.k[r].to=null,e.or.k[r].ti=null}this.or=PropertyFactory.getProp(t,e.or,1,degToRads,this),this.or.sh=!0}else this.r=PropertyFactory.getProp(t,e.r||{k:0},0,degToRads,this);e.sk&&(this.sk=PropertyFactory.getProp(t,e.sk,0,degToRads,this),this.sa=PropertyFactory.getProp(t,e.sa,0,degToRads,this)),this.a=PropertyFactory.getProp(t,e.a||{k:[0,0,0]},1,0,this),this.s=PropertyFactory.getProp(t,e.s||{k:[100,100,100]},1,.01,this),e.o?this.o=PropertyFactory.getProp(t,e.o,0,.01,t):this.o={_mdf:!1,v:1},this._isDirty=!0,this.dynamicProperties.length||this.getValue(!0)}return e.prototype={applyToMatrix:function(t){var e=this._mdf;this.iterateDynamicProperties(),this._mdf=this._mdf||e,this.a&&t.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.s&&t.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&t.skewFromAxis(-this.sk.v,this.sa.v),this.r?t.rotate(-this.r.v):t.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.data.p.s?this.data.p.z?t.translate(this.px.v,this.py.v,-this.pz.v):t.translate(this.px.v,this.py.v,0):t.translate(this.p.v[0],this.p.v[1],-this.p.v[2])},getValue:function(e){if(this.elem.globalData.frameId!==this.frameId){if(this._isDirty&&(this.precalculateMatrix(),this._isDirty=!1),this.iterateDynamicProperties(),this._mdf||e){var i;if(this.v.cloneFromProps(this.pre.props),this.appliedTransformations<1&&this.v.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations<2&&this.v.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.sk&&this.appliedTransformations<3&&this.v.skewFromAxis(-this.sk.v,this.sa.v),this.r&&this.appliedTransformations<4?this.v.rotate(-this.r.v):!this.r&&this.appliedTransformations<4&&this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.autoOriented){var r,n;if(i=this.elem.globalData.frameRate,this.p&&this.p.keyframes&&this.p.getValueAtTime)this.p._caching.lastFrame+this.p.offsetTime<=this.p.keyframes[0].t?(r=this.p.getValueAtTime((this.p.keyframes[0].t+.01)/i,0),n=this.p.getValueAtTime(this.p.keyframes[0].t/i,0)):this.p._caching.lastFrame+this.p.offsetTime>=this.p.keyframes[this.p.keyframes.length-1].t?(r=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/i,0),n=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/i,0)):(r=this.p.pv,n=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/i,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){r=[],n=[];var a=this.px,s=this.py;a._caching.lastFrame+a.offsetTime<=a.keyframes[0].t?(r[0]=a.getValueAtTime((a.keyframes[0].t+.01)/i,0),r[1]=s.getValueAtTime((s.keyframes[0].t+.01)/i,0),n[0]=a.getValueAtTime(a.keyframes[0].t/i,0),n[1]=s.getValueAtTime(s.keyframes[0].t/i,0)):a._caching.lastFrame+a.offsetTime>=a.keyframes[a.keyframes.length-1].t?(r[0]=a.getValueAtTime(a.keyframes[a.keyframes.length-1].t/i,0),r[1]=s.getValueAtTime(s.keyframes[s.keyframes.length-1].t/i,0),n[0]=a.getValueAtTime((a.keyframes[a.keyframes.length-1].t-.01)/i,0),n[1]=s.getValueAtTime((s.keyframes[s.keyframes.length-1].t-.01)/i,0)):(r=[a.pv,s.pv],n[0]=a.getValueAtTime((a._caching.lastFrame+a.offsetTime-.01)/i,a.offsetTime),n[1]=s.getValueAtTime((s._caching.lastFrame+s.offsetTime-.01)/i,s.offsetTime))}else r=n=t;this.v.rotate(-Math.atan2(r[1]-n[1],r[0]-n[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}},precalculateMatrix:function(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}},autoOrient:function(){}},extendPrototype([DynamicPropertyContainer],e),e.prototype.addDynamicProperty=function(t){this._addDynamicProperty(t),this.elem.addDynamicProperty(t),this._isDirty=!0},e.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty,{getTransformProperty:function(t,i,r){return new e(t,i,r)}}}();function RepeaterModifier(){}function RoundCornersModifier(){}function floatEqual(t,e){return 1e5*Math.abs(t-e)<=Math.min(Math.abs(t),Math.abs(e))}function floatZero(t){return Math.abs(t)<=1e-5}function lerp(t,e,i){return t*(1-i)+e*i}function lerpPoint(t,e,i){return[lerp(t[0],e[0],i),lerp(t[1],e[1],i)]}function quadRoots(t,e,i){if(0===t)return[];var r=e*e-4*t*i;if(r<0)return[];var n=-e/(2*t);if(0===r)return[n];var a=Math.sqrt(r)/(2*t);return[n-a,n+a]}function polynomialCoefficients(t,e,i,r){return[3*e-t-3*i+r,3*t-6*e+3*i,-3*t+3*e,t]}function singlePoint(t){return new PolynomialBezier(t,t,t,t,!1)}function PolynomialBezier(t,e,i,r,n){n&&pointEqual(t,e)&&(e=lerpPoint(t,r,1/3)),n&&pointEqual(i,r)&&(i=lerpPoint(t,r,2/3));var a=polynomialCoefficients(t[0],e[0],i[0],r[0]),s=polynomialCoefficients(t[1],e[1],i[1],r[1]);this.a=[a[0],s[0]],this.b=[a[1],s[1]],this.c=[a[2],s[2]],this.d=[a[3],s[3]],this.points=[t,e,i,r]}function extrema(t,e){var i=t.points[0][e],r=t.points[t.points.length-1][e];if(i>r){var n=r;r=i,i=n}for(var a=quadRoots(3*t.a[e],2*t.b[e],t.c[e]),s=0;s<a.length;s+=1)if(a[s]>0&&a[s]<1){var o=t.point(a[s])[e];o<i?i=o:o>r&&(r=o)}return{min:i,max:r}}function intersectData(t,e,i){var r=t.boundingBox();return{cx:r.cx,cy:r.cy,width:r.width,height:r.height,bez:t,t:(e+i)/2,t1:e,t2:i}}function splitData(t){var e=t.bez.split(.5);return[intersectData(e[0],t.t1,t.t),intersectData(e[1],t.t,t.t2)]}function boxIntersect(t,e){return 2*Math.abs(t.cx-e.cx)<t.width+e.width&&2*Math.abs(t.cy-e.cy)<t.height+e.height}function intersectsImpl(t,e,i,r,n,a){if(boxIntersect(t,e))if(i>=a||t.width<=r&&t.height<=r&&e.width<=r&&e.height<=r)n.push([t.t,e.t]);else{var s=splitData(t),o=splitData(e);intersectsImpl(s[0],o[0],i+1,r,n,a),intersectsImpl(s[0],o[1],i+1,r,n,a),intersectsImpl(s[1],o[0],i+1,r,n,a),intersectsImpl(s[1],o[1],i+1,r,n,a)}}function crossProduct(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function lineIntersection(t,e,i,r){var n=[t[0],t[1],1],a=[e[0],e[1],1],s=[i[0],i[1],1],o=[r[0],r[1],1],l=crossProduct(crossProduct(n,a),crossProduct(s,o));return floatZero(l[2])?null:[l[0]/l[2],l[1]/l[2]]}function polarOffset(t,e,i){return[t[0]+Math.cos(e)*i,t[1]-Math.sin(e)*i]}function pointDistance(t,e){return Math.hypot(t[0]-e[0],t[1]-e[1])}function pointEqual(t,e){return floatEqual(t[0],e[0])&&floatEqual(t[1],e[1])}function ZigZagModifier(){}function setPoint(t,e,i,r,n,a,s){var o=i-Math.PI/2,l=i+Math.PI/2,h=e[0]+Math.cos(i)*r*n,c=e[1]-Math.sin(i)*r*n;t.setTripleAt(h,c,h+Math.cos(o)*a,c-Math.sin(o)*a,h+Math.cos(l)*s,c-Math.sin(l)*s,t.length())}function getPerpendicularVector(t,e){var i=[e[0]-t[0],e[1]-t[1]],r=.5*-Math.PI;return[Math.cos(r)*i[0]-Math.sin(r)*i[1],Math.sin(r)*i[0]+Math.cos(r)*i[1]]}function getProjectingAngle(t,e){var i=0===e?t.length()-1:e-1,r=(e+1)%t.length(),n=getPerpendicularVector(t.v[i],t.v[r]);return Math.atan2(0,1)-Math.atan2(n[1],n[0])}function zigZagCorner(t,e,i,r,n,a,s){var o=getProjectingAngle(e,i),l=e.v[i%e._length],h=e.v[0===i?e._length-1:i-1],c=e.v[(i+1)%e._length],u=2===a?Math.sqrt(Math.pow(l[0]-h[0],2)+Math.pow(l[1]-h[1],2)):0,d=2===a?Math.sqrt(Math.pow(l[0]-c[0],2)+Math.pow(l[1]-c[1],2)):0;setPoint(t,e.v[i%e._length],o,s,r,d/(2*(n+1)),u/(2*(n+1)))}function zigZagSegment(t,e,i,r,n,a){for(var s=0;s<r;s+=1){var o=(s+1)/(r+1),l=2===n?Math.sqrt(Math.pow(e.points[3][0]-e.points[0][0],2)+Math.pow(e.points[3][1]-e.points[0][1],2)):0,h=e.normalAngle(o);setPoint(t,e.point(o),h,a,i,l/(2*(r+1)),l/(2*(r+1))),a=-a}return a}function linearOffset(t,e,i){var r=Math.atan2(e[0]-t[0],e[1]-t[1]);return[polarOffset(t,r,i),polarOffset(e,r,i)]}function offsetSegment(t,e){var i,r,n,a,s,o,l;i=(l=linearOffset(t.points[0],t.points[1],e))[0],r=l[1],n=(l=linearOffset(t.points[1],t.points[2],e))[0],a=l[1],s=(l=linearOffset(t.points[2],t.points[3],e))[0],o=l[1];var h=lineIntersection(i,r,n,a);null===h&&(h=r);var c=lineIntersection(s,o,n,a);return null===c&&(c=s),new PolynomialBezier(i,h,c,o)}function joinLines(t,e,i,r,n){var a=e.points[3],s=i.points[0];if(3===r)return a;if(pointEqual(a,s))return a;if(2===r){var o=-e.tangentAngle(1),l=-i.tangentAngle(0)+Math.PI,h=lineIntersection(a,polarOffset(a,o+Math.PI/2,100),s,polarOffset(s,o+Math.PI/2,100)),c=h?pointDistance(h,a):pointDistance(a,s)/2,u=polarOffset(a,o,2*c*roundCorner);return t.setXYAt(u[0],u[1],"o",t.length()-1),u=polarOffset(s,l,2*c*roundCorner),t.setTripleAt(s[0],s[1],s[0],s[1],u[0],u[1],t.length()),s}var d=lineIntersection(pointEqual(a,e.points[2])?e.points[0]:e.points[2],a,s,pointEqual(s,i.points[1])?i.points[3]:i.points[1]);return d&&pointDistance(d,a)<n?(t.setTripleAt(d[0],d[1],d[0],d[1],d[0],d[1],t.length()),d):a}function getIntersection(t,e){var i=t.intersections(e);return i.length&&floatEqual(i[0][0],1)&&i.shift(),i.length?i[0]:null}function pruneSegmentIntersection(t,e){var i=t.slice(),r=e.slice(),n=getIntersection(t[t.length-1],e[0]);return n&&(i[t.length-1]=t[t.length-1].split(n[0])[0],r[0]=e[0].split(n[1])[1]),t.length>1&&e.length>1&&(n=getIntersection(t[0],e[e.length-1]))?[[t[0].split(n[0])[0]],[e[e.length-1].split(n[1])[1]]]:[i,r]}function pruneIntersections(t){for(var e,i=1;i<t.length;i+=1)e=pruneSegmentIntersection(t[i-1],t[i]),t[i-1]=e[0],t[i]=e[1];return t.length>1&&(e=pruneSegmentIntersection(t[t.length-1],t[0]),t[t.length-1]=e[0],t[0]=e[1]),t}function offsetSegmentSplit(t,e){var i,r,n,a,s=t.inflectionPoints();if(0===s.length)return[offsetSegment(t,e)];if(1===s.length||floatEqual(s[1],1))return i=(n=t.split(s[0]))[0],r=n[1],[offsetSegment(i,e),offsetSegment(r,e)];i=(n=t.split(s[0]))[0];var o=(s[1]-s[0])/(1-s[0]);return a=(n=n[1].split(o))[0],r=n[1],[offsetSegment(i,e),offsetSegment(a,e),offsetSegment(r,e)]}function OffsetPathModifier(){}function getFontProperties(t){for(var e=t.fStyle?t.fStyle.split(" "):[],i="normal",r="normal",n=e.length,a=0;a<n;a+=1)switch(e[a].toLowerCase()){case"italic":r="italic";break;case"bold":i="700";break;case"black":i="900";break;case"medium":i="500";break;case"regular":case"normal":i="400";break;case"light":case"thin":i="200"}return{style:r,weight:t.fWeight||i}}extendPrototype([ShapeModifier],RepeaterModifier),RepeaterModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.c=PropertyFactory.getProp(t,e.c,0,null,this),this.o=PropertyFactory.getProp(t,e.o,0,null,this),this.tr=TransformPropertyFactory.getTransformProperty(t,e.tr,this),this.so=PropertyFactory.getProp(t,e.tr.so,0,.01,this),this.eo=PropertyFactory.getProp(t,e.tr.eo,0,.01,this),this.data=e,this.dynamicProperties.length||this.getValue(!0),this._isAnimated=!!this.dynamicProperties.length,this.pMatrix=new Matrix,this.rMatrix=new Matrix,this.sMatrix=new Matrix,this.tMatrix=new Matrix,this.matrix=new Matrix},RepeaterModifier.prototype.applyTransforms=function(t,e,i,r,n,a){var s=a?-1:1,o=r.s.v[0]+(1-r.s.v[0])*(1-n),l=r.s.v[1]+(1-r.s.v[1])*(1-n);t.translate(r.p.v[0]*s*n,r.p.v[1]*s*n,r.p.v[2]),e.translate(-r.a.v[0],-r.a.v[1],r.a.v[2]),e.rotate(-r.r.v*s*n),e.translate(r.a.v[0],r.a.v[1],r.a.v[2]),i.translate(-r.a.v[0],-r.a.v[1],r.a.v[2]),i.scale(a?1/o:o,a?1/l:l),i.translate(r.a.v[0],r.a.v[1],r.a.v[2])},RepeaterModifier.prototype.init=function(t,e,i,r){for(this.elem=t,this.arr=e,this.pos=i,this.elemsData=r,this._currentCopies=0,this._elements=[],this._groups=[],this.frameId=-1,this.initDynamicPropertyContainer(t),this.initModifierProperties(t,e[i]);i>0;)i-=1,this._elements.unshift(e[i]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(t){var e,i=t.length;for(e=0;e<i;e+=1)t[e]._processed=!1,"gr"===t[e].ty&&this.resetElements(t[e].it)},RepeaterModifier.prototype.cloneElements=function(t){var e=JSON.parse(JSON.stringify(t));return this.resetElements(e),e},RepeaterModifier.prototype.changeGroupRender=function(t,e){var i,r=t.length;for(i=0;i<r;i+=1)t[i]._render=e,"gr"===t[i].ty&&this.changeGroupRender(t[i].it,e)},RepeaterModifier.prototype.processShapes=function(t){var e,i,r,n,a,s=!1;if(this._mdf||t){var o,l=Math.ceil(this.c.v);if(this._groups.length<l){for(;this._groups.length<l;){var h={it:this.cloneElements(this._elements),ty:"gr"};h.it.push({a:{a:0,ix:1,k:[0,0]},nm:"Transform",o:{a:0,ix:7,k:100},p:{a:0,ix:2,k:[0,0]},r:{a:1,ix:6,k:[{s:0,e:0,t:0},{s:0,e:0,t:1}]},s:{a:0,ix:3,k:[100,100]},sa:{a:0,ix:5,k:0},sk:{a:0,ix:4,k:0},ty:"tr"}),this.arr.splice(0,0,h),this._groups.splice(0,0,h),this._currentCopies+=1}this.elem.reloadShapes(),s=!0}for(a=0,r=0;r<=this._groups.length-1;r+=1){if(o=a<l,this._groups[r]._render=o,this.changeGroupRender(this._groups[r].it,o),!o){var c=this.elemsData[r].it,u=c[c.length-1];0!==u.transform.op.v?(u.transform.op._mdf=!0,u.transform.op.v=0):u.transform.op._mdf=!1}a+=1}this._currentCopies=l;var d=this.o.v,p=d%1,f=d>0?Math.floor(d):Math.ceil(d),m=this.pMatrix.props,g=this.rMatrix.props,y=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var v,b,x=0;if(d>0){for(;x<f;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),x+=1;p&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,p,!1),x+=p)}else if(d<0){for(;x>f;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),x-=1;p&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-p,!0),x-=p)}for(r=1===this.data.m?0:this._currentCopies-1,n=1===this.data.m?1:-1,a=this._currentCopies;a;){if(b=(i=(e=this.elemsData[r].it)[e.length-1].transform.mProps.v.props).length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=1===this._currentCopies?this.so.v:this.so.v+(this.eo.v-this.so.v)*(r/(this._currentCopies-1)),0!==x){for((0!==r&&1===n||r!==this._currentCopies-1&&-1===n)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]),this.matrix.transform(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],y[8],y[9],y[10],y[11],y[12],y[13],y[14],y[15]),this.matrix.transform(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15]),v=0;v<b;v+=1)i[v]=this.matrix.props[v];this.matrix.reset()}else for(this.matrix.reset(),v=0;v<b;v+=1)i[v]=this.matrix.props[v];x+=1,a-=1,r+=n}}else for(a=this._currentCopies,r=0,n=1;a;)i=(e=this.elemsData[r].it)[e.length-1].transform.mProps.v.props,e[e.length-1].transform.mProps._mdf=!1,e[e.length-1].transform.op._mdf=!1,a-=1,r+=n;return s},RepeaterModifier.prototype.addShape=function(){},extendPrototype([ShapeModifier],RoundCornersModifier),RoundCornersModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.rd=PropertyFactory.getProp(t,e.r,0,null,this),this._isAnimated=!!this.rd.effectsSequence.length},RoundCornersModifier.prototype.processPath=function(t,e){var i,r=shapePool.newElement();r.c=t.c;var n,a,s,o,l,h,c,u,d,p,f,m,g=t._length,y=0;for(i=0;i<g;i+=1)n=t.v[i],s=t.o[i],a=t.i[i],n[0]===s[0]&&n[1]===s[1]&&n[0]===a[0]&&n[1]===a[1]?0!==i&&i!==g-1||t.c?(o=0===i?t.v[g-1]:t.v[i-1],h=(l=Math.sqrt(Math.pow(n[0]-o[0],2)+Math.pow(n[1]-o[1],2)))?Math.min(l/2,e)/l:0,c=f=n[0]+(o[0]-n[0])*h,u=m=n[1]-(n[1]-o[1])*h,d=c-(c-n[0])*roundCorner,p=u-(u-n[1])*roundCorner,r.setTripleAt(c,u,d,p,f,m,y),y+=1,o=i===g-1?t.v[0]:t.v[i+1],h=(l=Math.sqrt(Math.pow(n[0]-o[0],2)+Math.pow(n[1]-o[1],2)))?Math.min(l/2,e)/l:0,c=d=n[0]+(o[0]-n[0])*h,u=p=n[1]+(o[1]-n[1])*h,f=c-(c-n[0])*roundCorner,m=u-(u-n[1])*roundCorner,r.setTripleAt(c,u,d,p,f,m,y),y+=1):(r.setTripleAt(n[0],n[1],s[0],s[1],a[0],a[1],y),y+=1):(r.setTripleAt(t.v[i][0],t.v[i][1],t.o[i][0],t.o[i][1],t.i[i][0],t.i[i][1],y),y+=1);return r},RoundCornersModifier.prototype.processShapes=function(t){var e,i,r,n,a,s,o=this.shapes.length,l=this.rd.v;if(0!==l)for(i=0;i<o;i+=1){if(s=(a=this.shapes[i]).localShapeCollection,a.shape._mdf||this._mdf||t)for(s.releaseShapes(),a.shape._mdf=!0,e=a.shape.paths.shapes,n=a.shape.paths._length,r=0;r<n;r+=1)s.addShape(this.processPath(e[r],l));a.shape.paths=a.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)},PolynomialBezier.prototype.point=function(t){return[((this.a[0]*t+this.b[0])*t+this.c[0])*t+this.d[0],((this.a[1]*t+this.b[1])*t+this.c[1])*t+this.d[1]]},PolynomialBezier.prototype.derivative=function(t){return[(3*t*this.a[0]+2*this.b[0])*t+this.c[0],(3*t*this.a[1]+2*this.b[1])*t+this.c[1]]},PolynomialBezier.prototype.tangentAngle=function(t){var e=this.derivative(t);return Math.atan2(e[1],e[0])},PolynomialBezier.prototype.normalAngle=function(t){var e=this.derivative(t);return Math.atan2(e[0],e[1])},PolynomialBezier.prototype.inflectionPoints=function(){var t=this.a[1]*this.b[0]-this.a[0]*this.b[1];if(floatZero(t))return[];var e=-.5*(this.a[1]*this.c[0]-this.a[0]*this.c[1])/t,i=e*e-1/3*(this.b[1]*this.c[0]-this.b[0]*this.c[1])/t;if(i<0)return[];var r=Math.sqrt(i);return floatZero(r)?r>0&&r<1?[e]:[]:[e-r,e+r].filter((function(t){return t>0&&t<1}))},PolynomialBezier.prototype.split=function(t){if(t<=0)return[singlePoint(this.points[0]),this];if(t>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],t),i=lerpPoint(this.points[1],this.points[2],t),r=lerpPoint(this.points[2],this.points[3],t),n=lerpPoint(e,i,t),a=lerpPoint(i,r,t),s=lerpPoint(n,a,t);return[new PolynomialBezier(this.points[0],e,n,s,!0),new PolynomialBezier(s,a,r,this.points[3],!0)]},PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var t=this.bounds();return{left:t.x.min,right:t.x.max,top:t.y.min,bottom:t.y.max,width:t.x.max-t.x.min,height:t.y.max-t.y.min,cx:(t.x.max+t.x.min)/2,cy:(t.y.max+t.y.min)/2}},PolynomialBezier.prototype.intersections=function(t,e,i){void 0===e&&(e=2),void 0===i&&(i=7);var r=[];return intersectsImpl(intersectData(this,0,1),intersectData(t,0,1),0,e,r,i),r},PolynomialBezier.shapeSegment=function(t,e){var i=(e+1)%t.length();return new PolynomialBezier(t.v[e],t.o[e],t.i[i],t.v[i],!0)},PolynomialBezier.shapeSegmentInverted=function(t,e){var i=(e+1)%t.length();return new PolynomialBezier(t.v[i],t.i[i],t.o[e],t.v[e],!0)},extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(t,e.s,0,null,this),this.frequency=PropertyFactory.getProp(t,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(t,e.pt,0,null,this),this._isAnimated=0!==this.amplitude.effectsSequence.length||0!==this.frequency.effectsSequence.length||0!==this.pointsType.effectsSequence.length},ZigZagModifier.prototype.processPath=function(t,e,i,r){var n=t._length,a=shapePool.newElement();if(a.c=t.c,t.c||(n-=1),0===n)return a;var s=-1,o=PolynomialBezier.shapeSegment(t,0);zigZagCorner(a,t,0,e,i,r,s);for(var l=0;l<n;l+=1)s=zigZagSegment(a,o,e,i,r,-s),o=l!==n-1||t.c?PolynomialBezier.shapeSegment(t,(l+1)%n):null,zigZagCorner(a,t,l+1,e,i,r,s);return a},ZigZagModifier.prototype.processShapes=function(t){var e,i,r,n,a,s,o=this.shapes.length,l=this.amplitude.v,h=Math.max(0,Math.round(this.frequency.v)),c=this.pointsType.v;if(0!==l)for(i=0;i<o;i+=1){if(s=(a=this.shapes[i]).localShapeCollection,a.shape._mdf||this._mdf||t)for(s.releaseShapes(),a.shape._mdf=!0,e=a.shape.paths.shapes,n=a.shape.paths._length,r=0;r<n;r+=1)s.addShape(this.processPath(e[r],l,h,c));a.shape.paths=a.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)},extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(t,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(t,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=0!==this.amount.effectsSequence.length},OffsetPathModifier.prototype.processPath=function(t,e,i,r){var n=shapePool.newElement();n.c=t.c;var a,s,o,l=t.length();t.c||(l-=1);var h=[];for(a=0;a<l;a+=1)o=PolynomialBezier.shapeSegment(t,a),h.push(offsetSegmentSplit(o,e));if(!t.c)for(a=l-1;a>=0;a-=1)o=PolynomialBezier.shapeSegmentInverted(t,a),h.push(offsetSegmentSplit(o,e));h=pruneIntersections(h);var c=null,u=null;for(a=0;a<h.length;a+=1){var d=h[a];for(u&&(c=joinLines(n,u,d[0],i,r)),u=d[d.length-1],s=0;s<d.length;s+=1)o=d[s],c&&pointEqual(o.points[0],c)?n.setXYAt(o.points[1][0],o.points[1][1],"o",n.length()-1):n.setTripleAt(o.points[0][0],o.points[0][1],o.points[1][0],o.points[1][1],o.points[0][0],o.points[0][1],n.length()),n.setTripleAt(o.points[3][0],o.points[3][1],o.points[3][0],o.points[3][1],o.points[2][0],o.points[2][1],n.length()),c=o.points[3]}return h.length&&joinLines(n,u,h[0][0],i,r),n},OffsetPathModifier.prototype.processShapes=function(t){var e,i,r,n,a,s,o=this.shapes.length,l=this.amount.v,h=this.miterLimit.v,c=this.lineJoin;if(0!==l)for(i=0;i<o;i+=1){if(s=(a=this.shapes[i]).localShapeCollection,a.shape._mdf||this._mdf||t)for(s.releaseShapes(),a.shape._mdf=!0,e=a.shape.paths.shapes,n=a.shape.paths._length,r=0;r<n;r+=1)s.addShape(this.processPath(e[r],l,c,h));a.shape.paths=a.localShapeCollection}this.dynamicProperties.length||(this._mdf=!1)};var FontManager=function(){var t={w:0,size:0,shapes:[],data:{shapes:[]}},e=[];e=e.concat([2304,2305,2306,2307,2362,2363,2364,2364,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2387,2388,2389,2390,2391,2402,2403]);var i=127988,r=127462,n=127487,a=["d83cdffb","d83cdffc","d83cdffd","d83cdffe","d83cdfff"];function s(t,e){var i=createTag("span");i.setAttribute("aria-hidden",!0),i.style.fontFamily=e;var r=createTag("span");r.innerText="giItT1WQy@!-/#",i.style.position="absolute",i.style.left="-10000px",i.style.top="-10000px",i.style.fontSize="300px",i.style.fontVariant="normal",i.style.fontStyle="normal",i.style.fontWeight="normal",i.style.letterSpacing="0",i.appendChild(r),document.body.appendChild(i);var n=r.offsetWidth;return r.style.fontFamily=function(t){var e,i=t.split(","),r=i.length,n=[];for(e=0;e<r;e+=1)"sans-serif"!==i[e]&&"monospace"!==i[e]&&n.push(i[e]);return n.join(",")}(t)+", "+e,{node:r,w:n,parent:i}}function o(t,e){var i,r=document.body&&e?"svg":"canvas",n=getFontProperties(t);if("svg"===r){var a=createNS("text");a.style.fontSize="100px",a.setAttribute("font-family",t.fFamily),a.setAttribute("font-style",n.style),a.setAttribute("font-weight",n.weight),a.textContent="1",t.fClass?(a.style.fontFamily="inherit",a.setAttribute("class",t.fClass)):a.style.fontFamily=t.fFamily,e.appendChild(a),i=a}else{var s=new OffscreenCanvas(500,500).getContext("2d");s.font=n.style+" "+n.weight+" 100px "+t.fFamily,i=s}return{measureText:function(t){return"svg"===r?(i.textContent=t,i.getComputedTextLength()):i.measureText(t).width}}}function l(t){var e=0,i=t.charCodeAt(0);if(i>=55296&&i<=56319){var r=t.charCodeAt(1);r>=56320&&r<=57343&&(e=1024*(i-55296)+r-56320+65536)}return e}function h(t){var e=l(t);return e>=r&&e<=n}var c=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};c.isModifier=function(t,e){var i=t.toString(16)+e.toString(16);return-1!==a.indexOf(i)},c.isZeroWidthJoiner=function(t){return 8205===t},c.isFlagEmoji=function(t){return h(t.substr(0,2))&&h(t.substr(2,2))},c.isRegionalCode=h,c.isCombinedCharacter=function(t){return-1!==e.indexOf(t)},c.isRegionalFlag=function(t,e){var r=l(t.substr(e,2));if(r!==i)return!1;var n=0;for(e+=2;n<5;){if((r=l(t.substr(e,2)))<917601||r>917626)return!1;n+=1,e+=2}return 917631===l(t.substr(e,2))},c.isVariationSelector=function(t){return 65039===t},c.BLACK_FLAG_CODE_POINT=i;var u={addChars:function(t){if(t){var e;this.chars||(this.chars=[]);var i,r,n=t.length,a=this.chars.length;for(e=0;e<n;e+=1){for(i=0,r=!1;i<a;)this.chars[i].style===t[e].style&&this.chars[i].fFamily===t[e].fFamily&&this.chars[i].ch===t[e].ch&&(r=!0),i+=1;r||(this.chars.push(t[e]),a+=1)}}},addFonts:function(t,e){if(t){if(this.chars)return this.isLoaded=!0,void(this.fonts=t.list);if(!document.body)return this.isLoaded=!0,t.list.forEach((function(t){t.helper=o(t),t.cache={}})),void(this.fonts=t.list);var i,r=t.list,n=r.length,a=n;for(i=0;i<n;i+=1){var l,h,c=!0;if(r[i].loaded=!1,r[i].monoCase=s(r[i].fFamily,"monospace"),r[i].sansCase=s(r[i].fFamily,"sans-serif"),r[i].fPath){if("p"===r[i].fOrigin||3===r[i].origin){if((l=document.querySelectorAll('style[f-forigin="p"][f-family="'+r[i].fFamily+'"], style[f-origin="3"][f-family="'+r[i].fFamily+'"]')).length>0&&(c=!1),c){var u=createTag("style");u.setAttribute("f-forigin",r[i].fOrigin),u.setAttribute("f-origin",r[i].origin),u.setAttribute("f-family",r[i].fFamily),u.type="text/css",u.innerText="@font-face {font-family: "+r[i].fFamily+"; font-style: normal; src: url('"+r[i].fPath+"');}",e.appendChild(u)}}else if("g"===r[i].fOrigin||1===r[i].origin){for(l=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),h=0;h<l.length;h+=1)-1!==l[h].href.indexOf(r[i].fPath)&&(c=!1);if(c){var d=createTag("link");d.setAttribute("f-forigin",r[i].fOrigin),d.setAttribute("f-origin",r[i].origin),d.type="text/css",d.rel="stylesheet",d.href=r[i].fPath,document.body.appendChild(d)}}else if("t"===r[i].fOrigin||2===r[i].origin){for(l=document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'),h=0;h<l.length;h+=1)r[i].fPath===l[h].src&&(c=!1);if(c){var p=createTag("link");p.setAttribute("f-forigin",r[i].fOrigin),p.setAttribute("f-origin",r[i].origin),p.setAttribute("rel","stylesheet"),p.setAttribute("href",r[i].fPath),e.appendChild(p)}}}else r[i].loaded=!0,a-=1;r[i].helper=o(r[i],e),r[i].cache={},this.fonts.push(r[i])}0===a?this.isLoaded=!0:setTimeout(this.checkLoadedFonts.bind(this),100)}else this.isLoaded=!0},getCharData:function(e,i,r){for(var n=0,a=this.chars.length;n<a;){if(this.chars[n].ch===e&&this.chars[n].style===i&&this.chars[n].fFamily===r)return this.chars[n];n+=1}return("string"==typeof e&&13!==e.charCodeAt(0)||!e)&&console&&console.warn&&!this._warned&&(this._warned=!0,console.warn("Missing character from exported characters list: ",e,i,r)),t},getFontByName:function(t){for(var e=0,i=this.fonts.length;e<i;){if(this.fonts[e].fName===t)return this.fonts[e];e+=1}return this.fonts[0]},measureText:function(t,e,i){var r=this.getFontByName(e),n=t;if(!r.cache[n]){var a=r.helper;if(" "===t){var s=a.measureText("|"+t+"|"),o=a.measureText("||");r.cache[n]=(s-o)/100}else r.cache[n]=a.measureText(t)/100}return r.cache[n]*i},checkLoadedFonts:function(){var t,e,i,r=this.fonts.length,n=r;for(t=0;t<r;t+=1)this.fonts[t].loaded?n-=1:"n"===this.fonts[t].fOrigin||0===this.fonts[t].origin?this.fonts[t].loaded=!0:(e=this.fonts[t].monoCase.node,i=this.fonts[t].monoCase.w,e.offsetWidth!==i?(n-=1,this.fonts[t].loaded=!0):(e=this.fonts[t].sansCase.node,i=this.fonts[t].sansCase.w,e.offsetWidth!==i&&(n-=1,this.fonts[t].loaded=!0)),this.fonts[t].loaded&&(this.fonts[t].sansCase.parent.parentNode.removeChild(this.fonts[t].sansCase.parent),this.fonts[t].monoCase.parent.parentNode.removeChild(this.fonts[t].monoCase.parent)));0!==n&&Date.now()-this.initTime<5e3?setTimeout(this.checkLoadedFontsBinded,20):setTimeout(this.setIsLoadedBinded,10)},setIsLoaded:function(){this.isLoaded=!0}};return c.prototype=u,c}();function SlotManager(t){this.animationData=t}function slotFactory(t){return new SlotManager(t)}function RenderableElement(){}SlotManager.prototype.getProp=function(t){return this.animationData.slots&&this.animationData.slots[t.sid]?Object.assign(t,this.animationData.slots[t.sid].p):t},RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(t){-1===this.renderableComponents.indexOf(t)&&this.renderableComponents.push(t)},removeRenderableComponent:function(t){-1!==this.renderableComponents.indexOf(t)&&this.renderableComponents.splice(this.renderableComponents.indexOf(t),1)},prepareRenderableFrame:function(t){this.checkLayerLimits(t)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(t){this.data.ip-this.data.st<=t&&this.data.op-this.data.st>t?!0!==this.isInRange&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):!1!==this.isInRange&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var t,e=this.renderableComponents.length;for(t=0;t<e;t+=1)this.renderableComponents[t].renderFrame(this._isFirstFrame)},sourceRectAtTime:function(){return{top:0,left:0,width:100,height:100}},getLayerSize:function(){return 5===this.data.ty?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}}};var getBlendMode=(blendModeEnums={0:"source-over",1:"multiply",2:"screen",3:"overlay",4:"darken",5:"lighten",6:"color-dodge",7:"color-burn",8:"hard-light",9:"soft-light",10:"difference",11:"exclusion",12:"hue",13:"saturation",14:"color",15:"luminosity"},function(t){return blendModeEnums[t]||""}),blendModeEnums;function SliderEffect(t,e,i){this.p=PropertyFactory.getProp(e,t.v,0,0,i)}function AngleEffect(t,e,i){this.p=PropertyFactory.getProp(e,t.v,0,0,i)}function ColorEffect(t,e,i){this.p=PropertyFactory.getProp(e,t.v,1,0,i)}function PointEffect(t,e,i){this.p=PropertyFactory.getProp(e,t.v,1,0,i)}function LayerIndexEffect(t,e,i){this.p=PropertyFactory.getProp(e,t.v,0,0,i)}function MaskIndexEffect(t,e,i){this.p=PropertyFactory.getProp(e,t.v,0,0,i)}function CheckboxEffect(t,e,i){this.p=PropertyFactory.getProp(e,t.v,0,0,i)}function NoValueEffect(){this.p={}}function EffectsManager(t,e){var i,r=t.ef||[];this.effectElements=[];var n,a=r.length;for(i=0;i<a;i+=1)n=new GroupEffect(r[i],e),this.effectElements.push(n)}function GroupEffect(t,e){this.init(t,e)}function BaseElement(){}function FrameElement(){}function FootageElement(t,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(t.refId),this.footageData=e.imageLoader.getAsset(this.assetData),this.initBaseData(t,e,i)}function AudioElement(t,e,i){this.initFrame(),this.initRenderable(),this.assetData=e.getAssetData(t.refId),this.initBaseData(t,e,i),this._isPlaying=!1,this._canPlay=!1;var r=this.globalData.getAssetsPath(this.assetData);this.audio=this.globalData.audioController.createAudio(r),this._currentTime=0,this.globalData.audioController.addAudio(this),this._volumeMultiplier=1,this._volume=1,this._previousVolume=null,this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0},this.lv=PropertyFactory.getProp(this,t.au&&t.au.lv?t.au.lv:{k:[100]},1,.01,this)}function BaseRenderer(){}extendPrototype([DynamicPropertyContainer],GroupEffect),GroupEffect.prototype.getValue=GroupEffect.prototype.iterateDynamicProperties,GroupEffect.prototype.init=function(t,e){var i;this.data=t,this.effectElements=[],this.initDynamicPropertyContainer(e);var r,n=this.data.ef.length,a=this.data.ef;for(i=0;i<n;i+=1){switch(r=null,a[i].ty){case 0:r=new SliderEffect(a[i],e,this);break;case 1:r=new AngleEffect(a[i],e,this);break;case 2:r=new ColorEffect(a[i],e,this);break;case 3:r=new PointEffect(a[i],e,this);break;case 4:case 7:r=new CheckboxEffect(a[i],e,this);break;case 10:r=new LayerIndexEffect(a[i],e,this);break;case 11:r=new MaskIndexEffect(a[i],e,this);break;case 5:r=new EffectsManager(a[i],e);break;default:r=new NoValueEffect(a[i])}r&&this.effectElements.push(r)}},BaseElement.prototype={checkMasks:function(){if(!this.data.hasMask)return!1;for(var t=0,e=this.data.masksProperties.length;t<e;){if("n"!==this.data.masksProperties[t].mode&&!1!==this.data.masksProperties[t].cl)return!0;t+=1}return!1},initExpressions:function(){var t=getExpressionInterfaces();if(t){var e=t("layer"),i=t("effects"),r=t("shape"),n=t("text"),a=t("comp");this.layerInterface=e(this),this.data.hasMask&&this.maskManager&&this.layerInterface.registerMaskInterface(this.maskManager);var s=i.createEffectsInterface(this,this.layerInterface);this.layerInterface.registerEffectsInterface(s),0===this.data.ty||this.data.xt?this.compInterface=a(this):4===this.data.ty?(this.layerInterface.shapeInterface=r(this.shapesData,this.itemsData,this.layerInterface),this.layerInterface.content=this.layerInterface.shapeInterface):5===this.data.ty&&(this.layerInterface.textInterface=n(this),this.layerInterface.text=this.layerInterface.textInterface)}},setBlendMode:function(){var t=getBlendMode(this.data.bm);(this.baseElement||this.layerElement).style["mix-blend-mode"]=t},initBaseData:function(t,e,i){this.globalData=e,this.comp=i,this.data=t,this.layerId=createElementID(),this.data.sr||(this.data.sr=1),this.effectsManager=new EffectsManager(this.data,this,this.dynamicProperties)},getType:function(){return this.type},sourceRectAtTime:function(){}},FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(t,e){var i,r=this.dynamicProperties.length;for(i=0;i<r;i+=1)(e||this._isParent&&"transform"===this.dynamicProperties[i].propType)&&(this.dynamicProperties[i].getValue(),this.dynamicProperties[i]._mdf&&(this.globalData._mdf=!0,this._mdf=!0))},addDynamicProperty:function(t){-1===this.dynamicProperties.indexOf(t)&&this.dynamicProperties.push(t)}},FootageElement.prototype.prepareFrame=function(){},extendPrototype([RenderableElement,BaseElement,FrameElement],FootageElement),FootageElement.prototype.getBaseElement=function(){return null},FootageElement.prototype.renderFrame=function(){},FootageElement.prototype.destroy=function(){},FootageElement.prototype.initExpressions=function(){var t=getExpressionInterfaces();if(t){var e=t("footage");this.layerInterface=e(this)}},FootageElement.prototype.getFootageData=function(){return this.footageData},AudioElement.prototype.prepareFrame=function(t){if(this.prepareRenderableFrame(t,!0),this.prepareProperties(t,!0),this.tm._placeholder)this._currentTime=t/this.data.sr;else{var e=this.tm.v;this._currentTime=e}this._volume=this.lv.v[0];var i=this._volume*this._volumeMultiplier;this._previousVolume!==i&&(this._previousVolume=i,this.audio.volume(i))},extendPrototype([RenderableElement,BaseElement,FrameElement],AudioElement),AudioElement.prototype.renderFrame=function(){this.isInRange&&this._canPlay&&(this._isPlaying?(!this.audio.playing()||Math.abs(this._currentTime/this.globalData.frameRate-this.audio.seek())>.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(t){this.audio.rate(t)},AudioElement.prototype.volume=function(t){this._volumeMultiplier=t,this._previousVolume=t*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){},BaseRenderer.prototype.checkLayers=function(t){var e,i,r=this.layers.length;for(this.completeLayers=!0,e=r-1;e>=0;e-=1)this.elements[e]||(i=this.layers[e]).ip-i.st<=t-this.layers[e].st&&i.op-i.st>t-this.layers[e].st&&this.buildItem(e),this.completeLayers=!!this.elements[e]&&this.completeLayers;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(t){switch(t.ty){case 2:return this.createImage(t);case 0:return this.createComp(t);case 1:return this.createSolid(t);case 3:default:return this.createNull(t);case 4:return this.createShape(t);case 5:return this.createText(t);case 6:return this.createAudio(t);case 13:return this.createCamera(t);case 15:return this.createFootage(t)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(t){return new AudioElement(t,this.globalData,this)},BaseRenderer.prototype.createFootage=function(t){return new FootageElement(t,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var t,e=this.layers.length;for(t=0;t<e;t+=1)this.buildItem(t);this.checkPendingElements()},BaseRenderer.prototype.includeLayers=function(t){var e;this.completeLayers=!1;var i,r=t.length,n=this.layers.length;for(e=0;e<r;e+=1)for(i=0;i<n;){if(this.layers[i].id===t[e].id){this.layers[i]=t[e];break}i+=1}},BaseRenderer.prototype.setProjectInterface=function(t){this.globalData.projectInterface=t},BaseRenderer.prototype.initItems=function(){this.globalData.progressiveLoad||this.buildAllItems()},BaseRenderer.prototype.buildElementParenting=function(t,e,i){for(var r=this.elements,n=this.layers,a=0,s=n.length;a<s;)n[a].ind==e&&(r[a]&&!0!==r[a]?(i.push(r[a]),r[a].setAsParent(),void 0!==n[a].parent?this.buildElementParenting(t,n[a].parent,i):t.setHierarchy(i)):(this.buildItem(a),this.addPendingElement(t))),a+=1},BaseRenderer.prototype.addPendingElement=function(t){this.pendingElements.push(t)},BaseRenderer.prototype.searchExtraCompositions=function(t){var e,i=t.length;for(e=0;e<i;e+=1)if(t[e].xt){var r=this.createComp(t[e]);r.initExpressions(),this.globalData.projectInterface.registerComposition(r)}},BaseRenderer.prototype.getElementById=function(t){var e,i=this.elements.length;for(e=0;e<i;e+=1)if(this.elements[e].data.ind===t)return this.elements[e];return null},BaseRenderer.prototype.getElementByPath=function(t){var e,i=t.shift();if("number"==typeof i)e=this.elements[i];else{var r,n=this.elements.length;for(r=0;r<n;r+=1)if(this.elements[r].data.nm===i){e=this.elements[r];break}}return 0===t.length?e:e.getElementByPath(t)},BaseRenderer.prototype.setupGlobalData=function(t,e){this.globalData.fontManager=new FontManager,this.globalData.slotManager=slotFactory(t),this.globalData.fontManager.addChars(t.chars),this.globalData.fontManager.addFonts(t.fonts,e),this.globalData.getAssetData=this.animationItem.getAssetData.bind(this.animationItem),this.globalData.getAssetsPath=this.animationItem.getAssetsPath.bind(this.animationItem),this.globalData.imageLoader=this.animationItem.imagePreloader,this.globalData.audioController=this.animationItem.audioController,this.globalData.frameId=0,this.globalData.frameRate=t.fr,this.globalData.nm=t.nm,this.globalData.compSize={w:t.w,h:t.h}};var effectTypes={TRANSFORM_EFFECT:"transformEFfect"};function TransformElement(){}function MaskElement(t,e,i){this.data=t,this.element=e,this.globalData=i,this.storedData=[],this.masksProperties=this.data.masksProperties||[],this.maskElement=null;var r,n,a=this.globalData.defs,s=this.masksProperties?this.masksProperties.length:0;this.viewData=createSizedArray(s),this.solidPath="";var o,l,h,c,u,d,p=this.masksProperties,f=0,m=[],g=createElementID(),y="clipPath",v="clip-path";for(r=0;r<s;r+=1)if(("a"!==p[r].mode&&"n"!==p[r].mode||p[r].inv||100!==p[r].o.k||p[r].o.x)&&(y="mask",v="mask"),"s"!==p[r].mode&&"i"!==p[r].mode||0!==f?h=null:((h=createNS("rect")).setAttribute("fill","#ffffff"),h.setAttribute("width",this.element.comp.data.w||0),h.setAttribute("height",this.element.comp.data.h||0),m.push(h)),n=createNS("path"),"n"===p[r].mode)this.viewData[r]={op:PropertyFactory.getProp(this.element,p[r].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,p[r],3),elem:n,lastPath:""},a.appendChild(n);else{var b;if(f+=1,n.setAttribute("fill","s"===p[r].mode?"#000000":"#ffffff"),n.setAttribute("clip-rule","nonzero"),0!==p[r].x.k?(y="mask",v="mask",d=PropertyFactory.getProp(this.element,p[r].x,0,null,this.element),b=createElementID(),(c=createNS("filter")).setAttribute("id",b),(u=createNS("feMorphology")).setAttribute("operator","erode"),u.setAttribute("in","SourceGraphic"),u.setAttribute("radius","0"),c.appendChild(u),a.appendChild(c),n.setAttribute("stroke","s"===p[r].mode?"#000000":"#ffffff")):(u=null,d=null),this.storedData[r]={elem:n,x:d,expan:u,lastPath:"",lastOperator:"",filterId:b,lastRadius:0},"i"===p[r].mode){l=m.length;var x=createNS("g");for(o=0;o<l;o+=1)x.appendChild(m[o]);var C=createNS("mask");C.setAttribute("mask-type","alpha"),C.setAttribute("id",g+"_"+f),C.appendChild(n),a.appendChild(C),x.setAttribute("mask","url("+getLocationHref()+"#"+g+"_"+f+")"),m.length=0,m.push(x)}else m.push(n);p[r].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),this.viewData[r]={elem:n,lastPath:"",op:PropertyFactory.getProp(this.element,p[r].o,0,.01,this.element),prop:ShapePropertyFactory.getShapeProp(this.element,p[r],3),invRect:h},this.viewData[r].prop.k||this.drawPath(p[r],this.viewData[r].prop.v,this.viewData[r])}for(this.maskElement=createNS(y),s=m.length,r=0;r<s;r+=1)this.maskElement.appendChild(m[r]);f>0&&(this.maskElement.setAttribute("id",g),this.element.maskedElement.setAttribute(v,"url("+getLocationHref()+"#"+g+")"),a.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}TransformElement.prototype={initTransform:function(){var t=new Matrix;this.finalTransform={mProp:this.data.ks?TransformPropertyFactory.getTransformProperty(this,this.data.ks,this):{o:0},_matMdf:!1,_localMatMdf:!1,_opMdf:!1,mat:t,localMat:t,localOpacity:1},this.data.ao&&(this.finalTransform.mProp.autoOriented=!0),this.data.ty},renderTransform:function(){if(this.finalTransform._opMdf=this.finalTransform.mProp.o._mdf||this._isFirstFrame,this.finalTransform._matMdf=this.finalTransform.mProp._mdf||this._isFirstFrame,this.hierarchy){var t,e=this.finalTransform.mat,i=0,r=this.hierarchy.length;if(!this.finalTransform._matMdf)for(;i<r;){if(this.hierarchy[i].finalTransform.mProp._mdf){this.finalTransform._matMdf=!0;break}i+=1}if(this.finalTransform._matMdf)for(t=this.finalTransform.mProp.v.props,e.cloneFromProps(t),i=0;i<r;i+=1)e.multiply(this.hierarchy[i].finalTransform.mProp.v)}this.finalTransform._matMdf&&(this.finalTransform._localMatMdf=this.finalTransform._matMdf),this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v)},renderLocalTransform:function(){if(this.localTransforms){var t=0,e=this.localTransforms.length;if(this.finalTransform._localMatMdf=this.finalTransform._matMdf,!this.finalTransform._localMatMdf||!this.finalTransform._opMdf)for(;t<e;)this.localTransforms[t]._mdf&&(this.finalTransform._localMatMdf=!0),this.localTransforms[t]._opMdf&&!this.finalTransform._opMdf&&(this.finalTransform.localOpacity=this.finalTransform.mProp.o.v,this.finalTransform._opMdf=!0),t+=1;if(this.finalTransform._localMatMdf){var i=this.finalTransform.localMat;for(this.localTransforms[0].matrix.clone(i),t=1;t<e;t+=1){var r=this.localTransforms[t].matrix;i.multiply(r)}i.multiply(this.finalTransform.mat)}if(this.finalTransform._opMdf){var n=this.finalTransform.localOpacity;for(t=0;t<e;t+=1)n*=.01*this.localTransforms[t].opacity;this.finalTransform.localOpacity=n}}},searchEffectTransforms:function(){if(this.renderableEffectsManager){var t=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT);if(t.length){this.localTransforms=[],this.finalTransform.localMat=new Matrix;var e=0,i=t.length;for(e=0;e<i;e+=1)this.localTransforms.push(t[e])}}},globalToLocal:function(t){var e=[];e.push(this.finalTransform);for(var i,r=!0,n=this.comp;r;)n.finalTransform?(n.data.hasMask&&e.splice(0,0,n.finalTransform),n=n.comp):r=!1;var a,s=e.length;for(i=0;i<s;i+=1)a=e[i].mat.applyToPointArray(0,0,0),t=[t[0]-a[0],t[1]-a[1],0];return t},mHelper:new Matrix},MaskElement.prototype.getMaskProperty=function(t){return this.viewData[t].prop},MaskElement.prototype.renderFrame=function(t){var e,i=this.element.finalTransform.mat,r=this.masksProperties.length;for(e=0;e<r;e+=1)if((this.viewData[e].prop._mdf||t)&&this.drawPath(this.masksProperties[e],this.viewData[e].prop.v,this.viewData[e]),(this.viewData[e].op._mdf||t)&&this.viewData[e].elem.setAttribute("fill-opacity",this.viewData[e].op.v),"n"!==this.masksProperties[e].mode&&(this.viewData[e].invRect&&(this.element.finalTransform.mProp._mdf||t)&&this.viewData[e].invRect.setAttribute("transform",i.getInverseMatrix().to2dCSS()),this.storedData[e].x&&(this.storedData[e].x._mdf||t))){var n=this.storedData[e].expan;this.storedData[e].x.v<0?("erode"!==this.storedData[e].lastOperator&&(this.storedData[e].lastOperator="erode",this.storedData[e].elem.setAttribute("filter","url("+getLocationHref()+"#"+this.storedData[e].filterId+")")),n.setAttribute("radius",-this.storedData[e].x.v)):("dilate"!==this.storedData[e].lastOperator&&(this.storedData[e].lastOperator="dilate",this.storedData[e].elem.setAttribute("filter",null)),this.storedData[e].elem.setAttribute("stroke-width",2*this.storedData[e].x.v))}},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var t="M0,0 ";return t+=" h"+this.globalData.compSize.w,t+=" v"+this.globalData.compSize.h,t+=" h-"+this.globalData.compSize.w,t+=" v-"+this.globalData.compSize.h+" "},MaskElement.prototype.drawPath=function(t,e,i){var r,n,a=" M"+e.v[0][0]+","+e.v[0][1];for(n=e._length,r=1;r<n;r+=1)a+=" C"+e.o[r-1][0]+","+e.o[r-1][1]+" "+e.i[r][0]+","+e.i[r][1]+" "+e.v[r][0]+","+e.v[r][1];if(e.c&&n>1&&(a+=" C"+e.o[r-1][0]+","+e.o[r-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),i.lastPath!==a){var s="";i.elem&&(e.c&&(s=t.inv?this.solidPath+a:a),i.elem.setAttribute("d",s)),i.lastPath=a}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var t={createFilter:function(t,e){var i=createNS("filter");return i.setAttribute("id",t),!0!==e&&(i.setAttribute("filterUnits","objectBoundingBox"),i.setAttribute("x","0%"),i.setAttribute("y","0%"),i.setAttribute("width","100%"),i.setAttribute("height","100%")),i},createAlphaToLuminanceFilter:function(){var t=createNS("feColorMatrix");return t.setAttribute("type","matrix"),t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),t}};return t}(),featureSupport=function(){var t={maskType:!0,svgLumaHidden:!0,offscreenCanvas:"undefined"!=typeof OffscreenCanvas};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(t.maskType=!1),/firefox/i.test(navigator.userAgent)&&(t.svgLumaHidden=!1),t}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(t){var e,i,r="SourceGraphic",n=t.data.ef?t.data.ef.length:0,a=createElementID(),s=filtersFactory.createFilter(a,!0),o=0;for(this.filters=[],e=0;e<n;e+=1){i=null;var l=t.data.ef[e].ty;registeredEffects$1[l]&&(i=new(0,registeredEffects$1[l].effect)(s,t.effectsManager.effectElements[e],t,idPrefix+o,r),r=idPrefix+o,registeredEffects$1[l].countsAsEffect&&(o+=1)),i&&this.filters.push(i)}o&&(t.globalData.defs.appendChild(s),t.layerElement.setAttribute("filter","url("+getLocationHref()+"#"+a+")")),this.filters.length&&t.addRenderableComponent(this)}function registerEffect$1(t,e,i){registeredEffects$1[t]={effect:e,countsAsEffect:i}}function SVGBaseElement(){}function HierarchyElement(){}function RenderableDOMElement(){}function IImageElement(t,e,i){this.assetData=e.getAssetData(t.refId),this.assetData&&this.assetData.sid&&(this.assetData=e.slotManager.getProp(this.assetData)),this.initElement(t,e,i),this.sourceRect={top:0,left:0,width:this.assetData.w,height:this.assetData.h}}function ProcessedElement(t,e){this.elem=t,this.pos=e}function IShapeElement(){}SVGEffects.prototype.renderFrame=function(t){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(t)},SVGEffects.prototype.getEffects=function(t){var e,i=this.filters.length,r=[];for(e=0;e<i;e+=1)this.filters[e].type===t&&r.push(this.filters[e]);return r},SVGBaseElement.prototype={initRendererElement:function(){this.layerElement=createNS("g")},createContainerElements:function(){this.matteElement=createNS("g"),this.transformedElement=this.layerElement,this.maskedElement=this.layerElement,this._sizeChanged=!1;var t=null;if(this.data.td){this.matteMasks={};var e=createNS("g");e.setAttribute("id",this.layerId),e.appendChild(this.layerElement),t=e,this.globalData.defs.appendChild(e)}else this.data.tt?(this.matteElement.appendChild(this.layerElement),t=this.matteElement,this.baseElement=this.matteElement):this.baseElement=this.layerElement;if(this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),0===this.data.ty&&!this.data.hd){var i=createNS("clipPath"),r=createNS("path");r.setAttribute("d","M0,0 L"+this.data.w+",0 L"+this.data.w+","+this.data.h+" L0,"+this.data.h+"z");var n=createElementID();if(i.setAttribute("id",n),i.appendChild(r),this.globalData.defs.appendChild(i),this.checkMasks()){var a=createNS("g");a.setAttribute("clip-path","url("+getLocationHref()+"#"+n+")"),a.appendChild(this.layerElement),this.transformedElement=a,t?t.appendChild(this.transformedElement):this.baseElement=this.transformedElement}else this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+n+")")}0!==this.data.bm&&this.setBlendMode()},renderElement:function(){this.finalTransform._localMatMdf&&this.transformedElement.setAttribute("transform",this.finalTransform.localMat.to2dCSS()),this.finalTransform._opMdf&&this.transformedElement.setAttribute("opacity",this.finalTransform.localOpacity)},destroyBaseElement:function(){this.layerElement=null,this.matteElement=null,this.maskManager.destroy()},getBaseElement:function(){return this.data.hd?null:this.baseElement},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData),this.renderableEffectsManager=new SVGEffects(this),this.searchEffectTransforms()},getMatte:function(t){if(this.matteMasks||(this.matteMasks={}),!this.matteMasks[t]){var e,i,r,n,a=this.layerId+"_"+t;if(1===t||3===t){var s=createNS("mask");s.setAttribute("id",a),s.setAttribute("mask-type",3===t?"luminance":"alpha"),(r=createNS("use")).setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),s.appendChild(r),this.globalData.defs.appendChild(s),featureSupport.maskType||1!==t||(s.setAttribute("mask-type","luminance"),e=createElementID(),i=filtersFactory.createFilter(e),this.globalData.defs.appendChild(i),i.appendChild(filtersFactory.createAlphaToLuminanceFilter()),(n=createNS("g")).appendChild(r),s.appendChild(n),n.setAttribute("filter","url("+getLocationHref()+"#"+e+")"))}else if(2===t){var o=createNS("mask");o.setAttribute("id",a),o.setAttribute("mask-type","alpha");var l=createNS("g");o.appendChild(l),e=createElementID(),i=filtersFactory.createFilter(e);var h=createNS("feComponentTransfer");h.setAttribute("in","SourceGraphic"),i.appendChild(h);var c=createNS("feFuncA");c.setAttribute("type","table"),c.setAttribute("tableValues","1.0 0.0"),h.appendChild(c),this.globalData.defs.appendChild(i);var u=createNS("rect");u.setAttribute("width",this.comp.data.w),u.setAttribute("height",this.comp.data.h),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("fill","#ffffff"),u.setAttribute("opacity","0"),l.setAttribute("filter","url("+getLocationHref()+"#"+e+")"),l.appendChild(u),(r=createNS("use")).setAttributeNS("http://www.w3.org/1999/xlink","href","#"+this.layerId),l.appendChild(r),featureSupport.maskType||(o.setAttribute("mask-type","luminance"),i.appendChild(filtersFactory.createAlphaToLuminanceFilter()),n=createNS("g"),l.appendChild(u),n.appendChild(this.layerElement),l.appendChild(n)),this.globalData.defs.appendChild(o)}this.matteMasks[t]=a}return this.matteMasks[t]},setMatte:function(t){this.matteElement&&this.matteElement.setAttribute("mask","url("+getLocationHref()+"#"+t+")")}},HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(t){this.hierarchy=t},setAsParent:function(){this._isParent=!0},checkParenting:function(){void 0!==this.data.parent&&this.comp.buildElementParenting(this,this.data.parent,[])}},extendPrototype([RenderableElement,createProxyFunction({initElement:function(t,e,i){this.initFrame(),this.initBaseData(t,e,i),this.initTransform(t,e,i),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide()},hide:function(){this.hidden||this.isInRange&&!this.isTransparent||((this.baseElement||this.layerElement).style.display="none",this.hidden=!0)},show:function(){this.isInRange&&!this.isTransparent&&(this.data.hd||((this.baseElement||this.layerElement).style.display="block"),this.hidden=!1,this._isFirstFrame=!0)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},renderInnerContent:function(){},prepareFrame:function(t){this._mdf=!1,this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange),this.checkTransparency()},destroy:function(){this.innerElem=null,this.destroyBaseElement()}})],RenderableDOMElement),extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],IImageElement),IImageElement.prototype.createContent=function(){var t=this.globalData.getAssetsPath(this.assetData);this.innerElem=createNS("image"),this.innerElem.setAttribute("width",this.assetData.w+"px"),this.innerElem.setAttribute("height",this.assetData.h+"px"),this.innerElem.setAttribute("preserveAspectRatio",this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio),this.innerElem.setAttributeNS("http://www.w3.org/1999/xlink","href",t),this.layerElement.appendChild(this.innerElem)},IImageElement.prototype.sourceRectAtTime=function(){return this.sourceRect},IShapeElement.prototype={addShapeToModifiers:function(t){var e,i=this.shapeModifiers.length;for(e=0;e<i;e+=1)this.shapeModifiers[e].addShape(t)},isShapeInAnimatedModifiers:function(t){for(var e=this.shapeModifiers.length;0<e;)if(this.shapeModifiers[0].isAnimatedWithShape(t))return!0;return!1},renderModifiers:function(){if(this.shapeModifiers.length){var t,e=this.shapes.length;for(t=0;t<e;t+=1)this.shapes[t].sh.reset();for(t=(e=this.shapeModifiers.length)-1;t>=0&&!this.shapeModifiers[t].processShapes(this._isFirstFrame);t-=1);}},searchProcessedElement:function(t){for(var e=this.processedElements,i=0,r=e.length;i<r;){if(e[i].elem===t)return e[i].pos;i+=1}return 0},addProcessedElement:function(t,e){for(var i=this.processedElements,r=i.length;r;)if(i[r-=1].elem===t)return void(i[r].pos=e);i.push(new ProcessedElement(t,e))},prepareFrame:function(t){this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange)}};var lineCapEnum={1:"butt",2:"round",3:"square"},lineJoinEnum={1:"miter",2:"round",3:"bevel"};function SVGShapeData(t,e,i){this.caches=[],this.styles=[],this.transformers=t,this.lStr="",this.sh=i,this.lvl=e,this._isAnimated=!!i.k;for(var r=0,n=t.length;r<n;){if(t[r].mProps.dynamicProperties.length){this._isAnimated=!0;break}r+=1}}function SVGStyleData(t,e){this.data=t,this.type=t.ty,this.d="",this.lvl=e,this._mdf=!1,this.closed=!0===t.hd,this.pElem=createNS("path"),this.msElem=null}function DashProperty(t,e,i,r){var n;this.elem=t,this.frameId=-1,this.dataProps=createSizedArray(e.length),this.renderer=i,this.k=!1,this.dashStr="",this.dashArray=createTypedArray("float32",e.length?e.length-1:0),this.dashoffset=createTypedArray("float32",1),this.initDynamicPropertyContainer(r);var a,s=e.length||0;for(n=0;n<s;n+=1)a=PropertyFactory.getProp(t,e[n].v,0,0,this),this.k=a.k||this.k,this.dataProps[n]={n:e[n].n,p:a};this.k||this.getValue(!0),this._isAnimated=this.k}function SVGStrokeStyleData(t,e,i){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(t,e.o,0,.01,this),this.w=PropertyFactory.getProp(t,e.w,0,null,this),this.d=new DashProperty(t,e.d||{},"svg",this),this.c=PropertyFactory.getProp(t,e.c,1,255,this),this.style=i,this._isAnimated=!!this._isAnimated}function SVGFillStyleData(t,e,i){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.o=PropertyFactory.getProp(t,e.o,0,.01,this),this.c=PropertyFactory.getProp(t,e.c,1,255,this),this.style=i}function SVGNoStyleData(t,e,i){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.style=i}function GradientProperty(t,e,i){this.data=e,this.c=createTypedArray("uint8c",4*e.p);var r=e.k.k[0].s?e.k.k[0].s.length-4*e.p:e.k.k.length-4*e.p;this.o=createTypedArray("float32",r),this._cmdf=!1,this._omdf=!1,this._collapsable=this.checkCollapsable(),this._hasOpacity=r,this.initDynamicPropertyContainer(i),this.prop=PropertyFactory.getProp(t,e.k,1,null,this),this.k=this.prop.k,this.getValue(!0)}function SVGGradientFillStyleData(t,e,i){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.initGradientData(t,e,i)}function SVGGradientStrokeStyleData(t,e,i){this.initDynamicPropertyContainer(t),this.getValue=this.iterateDynamicProperties,this.w=PropertyFactory.getProp(t,e.w,0,null,this),this.d=new DashProperty(t,e.d||{},"svg",this),this.initGradientData(t,e,i),this._isAnimated=!!this._isAnimated}function ShapeGroupData(){this.it=[],this.prevViewData=[],this.gr=createNS("g")}function SVGTransformData(t,e,i){this.transform={mProps:t,op:e,container:i},this.elements=[],this._isAnimated=this.transform.mProps.dynamicProperties.length||this.transform.op.effectsSequence.length}SVGShapeData.prototype.setAsAnimated=function(){this._isAnimated=!0},SVGStyleData.prototype.reset=function(){this.d="",this._mdf=!1},DashProperty.prototype.getValue=function(t){if((this.elem.globalData.frameId!==this.frameId||t)&&(this.frameId=this.elem.globalData.frameId,this.iterateDynamicProperties(),this._mdf=this._mdf||t,this._mdf)){var e=0,i=this.dataProps.length;for("svg"===this.renderer&&(this.dashStr=""),e=0;e<i;e+=1)"o"!==this.dataProps[e].n?"svg"===this.renderer?this.dashStr+=" "+this.dataProps[e].p.v:this.dashArray[e]=this.dataProps[e].p.v:this.dashoffset[0]=this.dataProps[e].p.v}},extendPrototype([DynamicPropertyContainer],DashProperty),extendPrototype([DynamicPropertyContainer],SVGStrokeStyleData),extendPrototype([DynamicPropertyContainer],SVGFillStyleData),extendPrototype([DynamicPropertyContainer],SVGNoStyleData),GradientProperty.prototype.comparePoints=function(t,e){for(var i=0,r=this.o.length/2;i<r;){if(Math.abs(t[4*i]-t[4*e+2*i])>.01)return!1;i+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t<e;){if(!this.comparePoints(this.data.k.k[t].s,this.data.p))return!1;t+=1}else if(!this.comparePoints(this.data.k.k,this.data.p))return!1;return!0},GradientProperty.prototype.getValue=function(t){if(this.prop.getValue(),this._mdf=!1,this._cmdf=!1,this._omdf=!1,this.prop._mdf||t){var e,i,r,n=4*this.data.p;for(e=0;e<n;e+=1)i=e%4==0?100:255,r=Math.round(this.prop.v[e]*i),this.c[e]!==r&&(this.c[e]=r,this._cmdf=!t);if(this.o.length)for(n=this.prop.v.length,e=4*this.data.p;e<n;e+=1)i=e%2==0?100:1,r=e%2==0?Math.round(100*this.prop.v[e]):this.prop.v[e],this.o[e-4*this.data.p]!==r&&(this.o[e-4*this.data.p]=r,this._omdf=!t);this._mdf=!t}},extendPrototype([DynamicPropertyContainer],GradientProperty),SVGGradientFillStyleData.prototype.initGradientData=function(t,e,i){this.o=PropertyFactory.getProp(t,e.o,0,.01,this),this.s=PropertyFactory.getProp(t,e.s,1,null,this),this.e=PropertyFactory.getProp(t,e.e,1,null,this),this.h=PropertyFactory.getProp(t,e.h||{k:0},0,.01,this),this.a=PropertyFactory.getProp(t,e.a||{k:0},0,degToRads,this),this.g=new GradientProperty(t,e.g,this),this.style=i,this.stops=[],this.setGradientData(i.pElem,e),this.setGradientOpacity(e,i),this._isAnimated=!!this._isAnimated},SVGGradientFillStyleData.prototype.setGradientData=function(t,e){var i=createElementID(),r=createNS(1===e.t?"linearGradient":"radialGradient");r.setAttribute("id",i),r.setAttribute("spreadMethod","pad"),r.setAttribute("gradientUnits","userSpaceOnUse");var n,a,s,o=[];for(s=4*e.g.p,a=0;a<s;a+=4)n=createNS("stop"),r.appendChild(n),o.push(n);t.setAttribute("gf"===e.ty?"fill":"stroke","url("+getLocationHref()+"#"+i+")"),this.gf=r,this.cst=o},SVGGradientFillStyleData.prototype.setGradientOpacity=function(t,e){if(this.g._hasOpacity&&!this.g._collapsable){var i,r,n,a=createNS("mask"),s=createNS("path");a.appendChild(s);var o=createElementID(),l=createElementID();a.setAttribute("id",l);var h=createNS(1===t.t?"linearGradient":"radialGradient");h.setAttribute("id",o),h.setAttribute("spreadMethod","pad"),h.setAttribute("gradientUnits","userSpaceOnUse"),n=t.g.k.k[0].s?t.g.k.k[0].s.length:t.g.k.k.length;var c=this.stops;for(r=4*t.g.p;r<n;r+=2)(i=createNS("stop")).setAttribute("stop-color","rgb(255,255,255)"),h.appendChild(i),c.push(i);s.setAttribute("gf"===t.ty?"fill":"stroke","url("+getLocationHref()+"#"+o+")"),"gs"===t.ty&&(s.setAttribute("stroke-linecap",lineCapEnum[t.lc||2]),s.setAttribute("stroke-linejoin",lineJoinEnum[t.lj||2]),1===t.lj&&s.setAttribute("stroke-miterlimit",t.ml)),this.of=h,this.ms=a,this.ost=c,this.maskId=l,e.msElem=s}},extendPrototype([DynamicPropertyContainer],SVGGradientFillStyleData),extendPrototype([SVGGradientFillStyleData,DynamicPropertyContainer],SVGGradientStrokeStyleData);var buildShapeString=function(t,e,i,r){if(0===e)return"";var n,a=t.o,s=t.i,o=t.v,l=" M"+r.applyToPointStringified(o[0][0],o[0][1]);for(n=1;n<e;n+=1)l+=" C"+r.applyToPointStringified(a[n-1][0],a[n-1][1])+" "+r.applyToPointStringified(s[n][0],s[n][1])+" "+r.applyToPointStringified(o[n][0],o[n][1]);return i&&e&&(l+=" C"+r.applyToPointStringified(a[n-1][0],a[n-1][1])+" "+r.applyToPointStringified(s[0][0],s[0][1])+" "+r.applyToPointStringified(o[0][0],o[0][1]),l+="z"),l},SVGElementsRenderer=function(){var t=new Matrix,e=new Matrix;function i(t,e,i){(i||e.transform.op._mdf)&&e.transform.container.setAttribute("opacity",e.transform.op.v),(i||e.transform.mProps._mdf)&&e.transform.container.setAttribute("transform",e.transform.mProps.v.to2dCSS())}function r(){}function n(i,r,n){var a,s,o,l,h,c,u,d,p,f,m=r.styles.length,g=r.lvl;for(c=0;c<m;c+=1){if(l=r.sh._mdf||n,r.styles[c].lvl<g){for(d=e.reset(),p=g-r.styles[c].lvl,f=r.transformers.length-1;!l&&p>0;)l=r.transformers[f].mProps._mdf||l,p-=1,f-=1;if(l)for(p=g-r.styles[c].lvl,f=r.transformers.length-1;p>0;)d.multiply(r.transformers[f].mProps.v),p-=1,f-=1}else d=t;if(s=(u=r.sh.paths)._length,l){for(o="",a=0;a<s;a+=1)(h=u.shapes[a])&&h._length&&(o+=buildShapeString(h,h._length,h.c,d));r.caches[c]=o}else o=r.caches[c];r.styles[c].d+=!0===i.hd?"":o,r.styles[c]._mdf=l||r.styles[c]._mdf}}function a(t,e,i){var r=e.style;(e.c._mdf||i)&&r.pElem.setAttribute("fill","rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i)&&r.pElem.setAttribute("fill-opacity",e.o.v)}function s(t,e,i){o(t,e,i),l(0,e,i)}function o(t,e,i){var r,n,a,s,o,l=e.gf,h=e.g._hasOpacity,c=e.s.v,u=e.e.v;if(e.o._mdf||i){var d="gf"===t.ty?"fill-opacity":"stroke-opacity";e.style.pElem.setAttribute(d,e.o.v)}if(e.s._mdf||i){var p=1===t.t?"x1":"cx",f="x1"===p?"y1":"cy";l.setAttribute(p,c[0]),l.setAttribute(f,c[1]),h&&!e.g._collapsable&&(e.of.setAttribute(p,c[0]),e.of.setAttribute(f,c[1]))}if(e.g._cmdf||i){r=e.cst;var m=e.g.c;for(a=r.length,n=0;n<a;n+=1)(s=r[n]).setAttribute("offset",m[4*n]+"%"),s.setAttribute("stop-color","rgb("+m[4*n+1]+","+m[4*n+2]+","+m[4*n+3]+")")}if(h&&(e.g._omdf||i)){var g=e.g.o;for(a=(r=e.g._collapsable?e.cst:e.ost).length,n=0;n<a;n+=1)s=r[n],e.g._collapsable||s.setAttribute("offset",g[2*n]+"%"),s.setAttribute("stop-opacity",g[2*n+1])}if(1===t.t)(e.e._mdf||i)&&(l.setAttribute("x2",u[0]),l.setAttribute("y2",u[1]),h&&!e.g._collapsable&&(e.of.setAttribute("x2",u[0]),e.of.setAttribute("y2",u[1])));else if((e.s._mdf||e.e._mdf||i)&&(o=Math.sqrt(Math.pow(c[0]-u[0],2)+Math.pow(c[1]-u[1],2)),l.setAttribute("r",o),h&&!e.g._collapsable&&e.of.setAttribute("r",o)),e.e._mdf||e.h._mdf||e.a._mdf||i){o||(o=Math.sqrt(Math.pow(c[0]-u[0],2)+Math.pow(c[1]-u[1],2)));var y=Math.atan2(u[1]-c[1],u[0]-c[0]),v=e.h.v;v>=1?v=.99:v<=-1&&(v=-.99);var b=o*v,x=Math.cos(y+e.a.v)*b+c[0],C=Math.sin(y+e.a.v)*b+c[1];l.setAttribute("fx",x),l.setAttribute("fy",C),h&&!e.g._collapsable&&(e.of.setAttribute("fx",x),e.of.setAttribute("fy",C))}}function l(t,e,i){var r=e.style,n=e.d;n&&(n._mdf||i)&&n.dashStr&&(r.pElem.setAttribute("stroke-dasharray",n.dashStr),r.pElem.setAttribute("stroke-dashoffset",n.dashoffset[0])),e.c&&(e.c._mdf||i)&&r.pElem.setAttribute("stroke","rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i)&&r.pElem.setAttribute("stroke-opacity",e.o.v),(e.w._mdf||i)&&(r.pElem.setAttribute("stroke-width",e.w.v),r.msElem&&r.msElem.setAttribute("stroke-width",e.w.v))}return{createRenderFunction:function(t){switch(t.ty){case"fl":return a;case"gf":return o;case"gs":return s;case"st":return l;case"sh":case"el":case"rc":case"sr":return n;case"tr":return i;case"no":return r;default:return null}}}}();function SVGShapeElement(t,e,i){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(t,e,i),this.prevViewData=[]}function LetterProps(t,e,i,r,n,a){this.o=t,this.sw=e,this.sc=i,this.fc=r,this.m=n,this.p=a,this._mdf={o:!0,sw:!!e,sc:!!i,fc:!!r,m:!0,p:!0}}function TextProperty(t,e){this._frameId=initialDefaultFrame,this.pv="",this.v="",this.kf=!1,this._isFirstFrame=!0,this._mdf=!1,e.d&&e.d.sid&&(e.d=t.globalData.slotManager.getProp(e.d)),this.data=e,this.elem=t,this.comp=this.elem.comp,this.keysIndex=0,this.canResize=!1,this.minimumFontSize=1,this.effectsSequence=[],this.currentData={ascent:0,boxWidth:this.defaultBoxWidth,f:"",fStyle:"",fWeight:"",fc:"",j:"",justifyOffset:"",l:[],lh:0,lineWidths:[],ls:"",of:"",s:"",sc:"",sw:0,t:0,tr:0,sz:0,ps:null,fillColorAnim:!1,strokeColorAnim:!1,strokeWidthAnim:!1,yOffset:0,finalSize:0,finalText:[],finalLineHeight:0,__complete:!1},this.copyData(this.currentData,this.data.d.k[0].s),this.searchProperty()||this.completeTextData(this.currentData)}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var t,e,i,r,n=this.shapes.length,a=this.stylesList.length,s=[],o=!1;for(i=0;i<a;i+=1){for(r=this.stylesList[i],o=!1,s.length=0,t=0;t<n;t+=1)-1!==(e=this.shapes[t]).styles.indexOf(r)&&(s.push(e),o=e._isAnimated||o);s.length>1&&o&&this.setShapesAsAnimated(s)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,i=t.length;for(e=0;e<i;e+=1)t[e].setAsAnimated()},SVGShapeElement.prototype.createStyleElement=function(t,e){var i,r=new SVGStyleData(t,e),n=r.pElem;return"st"===t.ty?i=new SVGStrokeStyleData(this,t,r):"fl"===t.ty?i=new SVGFillStyleData(this,t,r):"gf"===t.ty||"gs"===t.ty?(i=new("gf"===t.ty?SVGGradientFillStyleData:SVGGradientStrokeStyleData)(this,t,r),this.globalData.defs.appendChild(i.gf),i.maskId&&(this.globalData.defs.appendChild(i.ms),this.globalData.defs.appendChild(i.of),n.setAttribute("mask","url("+getLocationHref()+"#"+i.maskId+")"))):"no"===t.ty&&(i=new SVGNoStyleData(this,t,r)),"st"!==t.ty&&"gs"!==t.ty||(n.setAttribute("stroke-linecap",lineCapEnum[t.lc||2]),n.setAttribute("stroke-linejoin",lineJoinEnum[t.lj||2]),n.setAttribute("fill-opacity","0"),1===t.lj&&n.setAttribute("stroke-miterlimit",t.ml)),2===t.r&&n.setAttribute("fill-rule","evenodd"),t.ln&&n.setAttribute("id",t.ln),t.cl&&n.setAttribute("class",t.cl),t.bm&&(n.style["mix-blend-mode"]=getBlendMode(t.bm)),this.stylesList.push(r),this.addToAnimatedContents(t,i),i},SVGShapeElement.prototype.createGroupElement=function(t){var e=new ShapeGroupData;return t.ln&&e.gr.setAttribute("id",t.ln),t.cl&&e.gr.setAttribute("class",t.cl),t.bm&&(e.gr.style["mix-blend-mode"]=getBlendMode(t.bm)),e},SVGShapeElement.prototype.createTransformElement=function(t,e){var i=TransformPropertyFactory.getTransformProperty(this,t,this),r=new SVGTransformData(i,i.o,e);return this.addToAnimatedContents(t,r),r},SVGShapeElement.prototype.createShapeElement=function(t,e,i){var r=4;"rc"===t.ty?r=5:"el"===t.ty?r=6:"sr"===t.ty&&(r=7);var n=new SVGShapeData(e,i,ShapePropertyFactory.getShapeProp(this,t,r,this));return this.shapes.push(n),this.addShapeToModifiers(n),this.addToAnimatedContents(t,n),n},SVGShapeElement.prototype.addToAnimatedContents=function(t,e){for(var i=0,r=this.animatedContents.length;i<r;){if(this.animatedContents[i].element===e)return;i+=1}this.animatedContents.push({fn:SVGElementsRenderer.createRenderFunction(t),element:e,data:t})},SVGShapeElement.prototype.setElementStyles=function(t){var e,i=t.styles,r=this.stylesList.length;for(e=0;e<r;e+=1)this.stylesList[e].closed||i.push(this.stylesList[e])},SVGShapeElement.prototype.reloadShapes=function(){var t;this._isFirstFrame=!0;var e=this.itemsData.length;for(t=0;t<e;t+=1)this.prevViewData[t]=this.itemsData[t];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes(),e=this.dynamicProperties.length,t=0;t<e;t+=1)this.dynamicProperties[t].getValue();this.renderModifiers()},SVGShapeElement.prototype.searchShapes=function(t,e,i,r,n,a,s){var o,l,h,c,u,d,p=[].concat(a),f=t.length-1,m=[],g=[];for(o=f;o>=0;o-=1){if((d=this.searchProcessedElement(t[o]))?e[o]=i[d-1]:t[o]._render=s,"fl"===t[o].ty||"st"===t[o].ty||"gf"===t[o].ty||"gs"===t[o].ty||"no"===t[o].ty)d?e[o].style.closed=!1:e[o]=this.createStyleElement(t[o],n),t[o]._render&&e[o].style.pElem.parentNode!==r&&r.appendChild(e[o].style.pElem),m.push(e[o].style);else if("gr"===t[o].ty){if(d)for(h=e[o].it.length,l=0;l<h;l+=1)e[o].prevViewData[l]=e[o].it[l];else e[o]=this.createGroupElement(t[o]);this.searchShapes(t[o].it,e[o].it,e[o].prevViewData,e[o].gr,n+1,p,s),t[o]._render&&e[o].gr.parentNode!==r&&r.appendChild(e[o].gr)}else"tr"===t[o].ty?(d||(e[o]=this.createTransformElement(t[o],r)),c=e[o].transform,p.push(c)):"sh"===t[o].ty||"rc"===t[o].ty||"el"===t[o].ty||"sr"===t[o].ty?(d||(e[o]=this.createShapeElement(t[o],p,n)),this.setElementStyles(e[o])):"tm"===t[o].ty||"rd"===t[o].ty||"ms"===t[o].ty||"pb"===t[o].ty||"zz"===t[o].ty||"op"===t[o].ty?(d?(u=e[o]).closed=!1:((u=ShapeModifiers.getModifier(t[o].ty)).init(this,t[o]),e[o]=u,this.shapeModifiers.push(u)),g.push(u)):"rp"===t[o].ty&&(d?(u=e[o]).closed=!0:(u=ShapeModifiers.getModifier(t[o].ty),e[o]=u,u.init(this,t,o,e),this.shapeModifiers.push(u),s=!1),g.push(u));this.addProcessedElement(t[o],o+1)}for(f=m.length,o=0;o<f;o+=1)m[o].closed=!0;for(f=g.length,o=0;o<f;o+=1)g[o].closed=!0},SVGShapeElement.prototype.renderInnerContent=function(){var t;this.renderModifiers();var e=this.stylesList.length;for(t=0;t<e;t+=1)this.stylesList[t].reset();for(this.renderShape(),t=0;t<e;t+=1)(this.stylesList[t]._mdf||this._isFirstFrame)&&(this.stylesList[t].msElem&&(this.stylesList[t].msElem.setAttribute("d",this.stylesList[t].d),this.stylesList[t].d="M0 0"+this.stylesList[t].d),this.stylesList[t].pElem.setAttribute("d",this.stylesList[t].d||"M0 0"))},SVGShapeElement.prototype.renderShape=function(){var t,e,i=this.animatedContents.length;for(t=0;t<i;t+=1)e=this.animatedContents[t],(this._isFirstFrame||e.element._isAnimated)&&!0!==e.data&&e.fn(e.data,e.element,this._isFirstFrame)},SVGShapeElement.prototype.destroy=function(){this.destroyBaseElement(),this.shapesData=null,this.itemsData=null},LetterProps.prototype.update=function(t,e,i,r,n,a){this._mdf.o=!1,this._mdf.sw=!1,this._mdf.sc=!1,this._mdf.fc=!1,this._mdf.m=!1,this._mdf.p=!1;var s=!1;return this.o!==t&&(this.o=t,this._mdf.o=!0,s=!0),this.sw!==e&&(this.sw=e,this._mdf.sw=!0,s=!0),this.sc!==i&&(this.sc=i,this._mdf.sc=!0,s=!0),this.fc!==r&&(this.fc=r,this._mdf.fc=!0,s=!0),this.m!==n&&(this.m=n,this._mdf.m=!0,s=!0),!a.length||this.p[0]===a[0]&&this.p[1]===a[1]&&this.p[4]===a[4]&&this.p[5]===a[5]&&this.p[12]===a[12]&&this.p[13]===a[13]||(this.p=a,this._mdf.p=!0,s=!0),s},TextProperty.prototype.defaultBoxWidth=[0,0],TextProperty.prototype.copyData=function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},TextProperty.prototype.setCurrentData=function(t){t.__complete||this.completeTextData(t),this.currentData=t,this.currentData.boxWidth=this.currentData.boxWidth||this.defaultBoxWidth,this._mdf=!0},TextProperty.prototype.searchProperty=function(){return this.searchKeyframes()},TextProperty.prototype.searchKeyframes=function(){return this.kf=this.data.d.k.length>1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||t){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,i=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{var r;this.lock=!0,this._mdf=!1;var n=this.effectsSequence.length,a=t||this.data.d.k[this.keysIndex].s;for(r=0;r<n;r+=1)a=i!==this.keysIndex?this.effectsSequence[r](a,a.t):this.effectsSequence[r](this.currentData,a.t);e!==a&&this.setCurrentData(a),this.v=this.currentData,this.pv=this.v,this.lock=!1,this.frameId=this.elem.globalData.frameId}}},TextProperty.prototype.getKeyframeValue=function(){for(var t=this.data.d.k,e=this.elem.comp.renderedFrame,i=0,r=t.length;i<=r-1&&!(i===r-1||t[i+1].t>e);)i+=1;return this.keysIndex!==i&&(this.keysIndex=i),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e,i,r=[],n=0,a=t.length,s=!1,o=!1,l="";n<a;)s=o,o=!1,e=t.charCodeAt(n),l=t.charAt(n),FontManager.isCombinedCharacter(e)?s=!0:e>=55296&&e<=56319?FontManager.isRegionalFlag(t,n)?l=t.substr(n,14):(i=t.charCodeAt(n+1))>=56320&&i<=57343&&(FontManager.isModifier(e,i)?(l=t.substr(n,2),s=!0):l=FontManager.isFlagEmoji(t.substr(n,4))?t.substr(n,4):t.substr(n,2)):e>56319?(i=t.charCodeAt(n+1),FontManager.isVariationSelector(e)&&(s=!0)):FontManager.isZeroWidthJoiner(e)&&(s=!0,o=!0),s?(r[r.length-1]+=l,s=!1):r.push(l),n+=l.length;return r},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e,i,r,n,a,s,o,l=this.elem.globalData.fontManager,h=this.data,c=[],u=0,d=h.m.g,p=0,f=0,m=0,g=[],y=0,v=0,b=l.getFontByName(t.f),x=0,C=getFontProperties(b);t.fWeight=C.weight,t.fStyle=C.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),i=t.finalText.length,t.finalLineHeight=t.lh;var _,T=t.tr/1e3*t.finalSize;if(t.sz)for(var A,S,P=!0,w=t.sz[0],M=t.sz[1];P;){A=0,y=0,i=(S=this.buildFinalText(t.t)).length,T=t.tr/1e3*t.finalSize;var E=-1;for(e=0;e<i;e+=1)_=S[e].charCodeAt(0),r=!1," "===S[e]?E=e:13!==_&&3!==_||(y=0,r=!0,A+=t.finalLineHeight||1.2*t.finalSize),l.chars?(o=l.getCharData(S[e],b.fStyle,b.fFamily),x=r?0:o.w*t.finalSize/100):x=l.measureText(S[e],t.f,t.finalSize),y+x>w&&" "!==S[e]?(-1===E?i+=1:e=E,A+=t.finalLineHeight||1.2*t.finalSize,S.splice(e,E===e?1:0,"\r"),E=-1,y=0):(y+=x,y+=T);A+=b.ascent*t.finalSize/100,this.canResize&&t.finalSize>this.minimumFontSize&&M<A?(t.finalSize-=1,t.finalLineHeight=t.finalSize*t.lh/t.s):(t.finalText=S,i=t.finalText.length,P=!1)}y=-T,x=0;var R,B=0;for(e=0;e<i;e+=1)if(r=!1,13===(_=(R=t.finalText[e]).charCodeAt(0))||3===_?(B=0,g.push(y),v=y>v?y:v,y=-2*T,n="",r=!0,m+=1):n=R,l.chars?(o=l.getCharData(R,b.fStyle,l.getFontByName(t.f).fFamily),x=r?0:o.w*t.finalSize/100):x=l.measureText(n,t.f,t.finalSize)," "===R?B+=x+T:(y+=x+T+B,B=0),c.push({l:x,an:x,add:p,n:r,anIndexes:[],val:n,line:m,animatorJustifyOffset:0}),2==d){if(p+=x,""===n||" "===n||e===i-1){for(""!==n&&" "!==n||(p-=x);f<=e;)c[f].an=p,c[f].ind=u,c[f].extra=x,f+=1;u+=1,p=0}}else if(3==d){if(p+=x,""===n||e===i-1){for(""===n&&(p-=x);f<=e;)c[f].an=p,c[f].ind=u,c[f].extra=x,f+=1;p=0,u+=1}}else c[u].ind=u,c[u].extra=0,u+=1;if(t.l=c,v=y>v?y:v,g.push(y),t.sz)t.boxWidth=t.sz[0],t.justifyOffset=0;else switch(t.boxWidth=v,t.j){case 1:t.justifyOffset=-t.boxWidth;break;case 2:t.justifyOffset=-t.boxWidth/2;break;default:t.justifyOffset=0}t.lineWidths=g;var k,D,I,L,O=h.a;s=O.length;var F=[];for(a=0;a<s;a+=1){for((k=O[a]).a.sc&&(t.strokeColorAnim=!0),k.a.sw&&(t.strokeWidthAnim=!0),(k.a.fc||k.a.fh||k.a.fs||k.a.fb)&&(t.fillColorAnim=!0),L=0,I=k.s.b,e=0;e<i;e+=1)(D=c[e]).anIndexes[a]=L,(1==I&&""!==D.val||2==I&&""!==D.val&&" "!==D.val||3==I&&(D.n||" "==D.val||e==i-1)||4==I&&(D.n||e==i-1))&&(1===k.s.rn&&F.push(L),L+=1);h.a[a].s.totalChars=L;var G,N=-1;if(1===k.s.rn)for(e=0;e<i;e+=1)N!=(D=c[e]).anIndexes[a]&&(N=D.anIndexes[a],G=F.splice(Math.floor(Math.random()*F.length),1)[0]),D.anIndexes[a]=G}t.yOffset=t.finalLineHeight||1.2*t.finalSize,t.ls=t.ls||0,t.ascent=b.ascent*t.finalSize/100},TextProperty.prototype.updateDocumentData=function(t,e){e=void 0===e?this.keysIndex:e;var i=this.copyData({},this.data.d.k[e].s);i=this.copyData(i,t),this.data.d.k[e].s=i,this.recalculate(e),this.setCurrentData(i),this.elem.addDynamicProperty(this)},TextProperty.prototype.recalculate=function(t){var e=this.data.d.k[t].s;e.__complete=!1,this.keysIndex=0,this._isFirstFrame=!0,this.getValue(e)},TextProperty.prototype.canResizeFont=function(t){this.canResize=t,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)},TextProperty.prototype.setMinimumFontSize=function(t){this.minimumFontSize=Math.floor(t)||1,this.recalculate(this.keysIndex),this.elem.addDynamicProperty(this)};var TextSelectorProp=function(){var t=Math.max,e=Math.min,i=Math.floor;function r(t,e){this._currentTextLength=-1,this.k=!1,this.data=e,this.elem=t,this.comp=t.comp,this.finalS=0,this.finalE=0,this.initDynamicPropertyContainer(t),this.s=PropertyFactory.getProp(t,e.s||{k:0},0,0,this),this.e="e"in e?PropertyFactory.getProp(t,e.e,0,0,this):{v:100},this.o=PropertyFactory.getProp(t,e.o||{k:0},0,0,this),this.xe=PropertyFactory.getProp(t,e.xe||{k:0},0,0,this),this.ne=PropertyFactory.getProp(t,e.ne||{k:0},0,0,this),this.sm=PropertyFactory.getProp(t,e.sm||{k:100},0,0,this),this.a=PropertyFactory.getProp(t,e.a,0,.01,this),this.dynamicProperties.length||this.getValue()}return r.prototype={getMult:function(r){this._currentTextLength!==this.elem.textProperty.currentData.l.length&&this.getValue();var n=0,a=0,s=1,o=1;this.ne.v>0?n=this.ne.v/100:a=-this.ne.v/100,this.xe.v>0?s=1-this.xe.v/100:o=1+this.xe.v/100;var l=BezierFactory.getBezierEasing(n,a,s,o).get,h=0,c=this.finalS,u=this.finalE,d=this.data.sh;if(2===d)h=l(h=u===c?r>=u?1:0:t(0,e(.5/(u-c)+(r-c)/(u-c),1)));else if(3===d)h=l(h=u===c?r>=u?0:1:1-t(0,e(.5/(u-c)+(r-c)/(u-c),1)));else if(4===d)u===c?h=0:(h=t(0,e(.5/(u-c)+(r-c)/(u-c),1)))<.5?h*=2:h=1-2*(h-.5),h=l(h);else if(5===d){if(u===c)h=0;else{var p=u-c,f=-p/2+(r=e(t(0,r+.5-c),u-c)),m=p/2;h=Math.sqrt(1-f*f/(m*m))}h=l(h)}else 6===d?(u===c?h=0:(r=e(t(0,r+.5-c),u-c),h=(1+Math.cos(Math.PI+2*Math.PI*r/(u-c)))/2),h=l(h)):(r>=i(c)&&(h=t(0,e(r-c<0?e(u,1)-(c-r):u-r,1))),h=l(h));if(100!==this.sm.v){var g=.01*this.sm.v;0===g&&(g=1e-8);var y=.5-.5*g;h<y?h=0:(h=(h-y)/g)>1&&(h=1)}return h*this.a.v},getValue:function(t){this.iterateDynamicProperties(),this._mdf=t||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,t&&2===this.data.r&&(this.e.v=this._currentTextLength);var e=2===this.data.r?1:100/this.data.totalChars,i=this.o.v/e,r=this.s.v/e+i,n=this.e.v/e+i;if(r>n){var a=r;r=n,n=a}this.finalS=r,this.finalE=n}},extendPrototype([DynamicPropertyContainer],r),{getTextSelectorProp:function(t,e,i){return new r(t,e)}}}();function TextAnimatorDataProperty(t,e,i){var r={propType:!1},n=PropertyFactory.getProp,a=e.a;this.a={r:a.r?n(t,a.r,0,degToRads,i):r,rx:a.rx?n(t,a.rx,0,degToRads,i):r,ry:a.ry?n(t,a.ry,0,degToRads,i):r,sk:a.sk?n(t,a.sk,0,degToRads,i):r,sa:a.sa?n(t,a.sa,0,degToRads,i):r,s:a.s?n(t,a.s,1,.01,i):r,a:a.a?n(t,a.a,1,0,i):r,o:a.o?n(t,a.o,0,.01,i):r,p:a.p?n(t,a.p,1,0,i):r,sw:a.sw?n(t,a.sw,0,0,i):r,sc:a.sc?n(t,a.sc,1,0,i):r,fc:a.fc?n(t,a.fc,1,0,i):r,fh:a.fh?n(t,a.fh,0,0,i):r,fs:a.fs?n(t,a.fs,0,.01,i):r,fb:a.fb?n(t,a.fb,0,.01,i):r,t:a.t?n(t,a.t,0,0,i):r},this.s=TextSelectorProp.getTextSelectorProp(t,e.s,i),this.s.t=e.s.t}function TextAnimatorProperty(t,e,i){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=t,this._renderType=e,this._elem=i,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(i)}function ITextElement(){}TextAnimatorProperty.prototype.searchProperties=function(){var t,e,i=this._textData.a.length,r=PropertyFactory.getProp;for(t=0;t<i;t+=1)e=this._textData.a[t],this._animatorsData[t]=new TextAnimatorDataProperty(this._elem,e,this);this._textData.p&&"m"in this._textData.p?(this._pathData={a:r(this._elem,this._textData.p.a,0,0,this),f:r(this._elem,this._textData.p.f,0,0,this),l:r(this._elem,this._textData.p.l,0,0,this),r:r(this._elem,this._textData.p.r,0,0,this),p:r(this._elem,this._textData.p.p,0,0,this),m:this._elem.maskManager.getMaskProperty(this._textData.p.m)},this._hasMaskedPath=!0):this._hasMaskedPath=!1,this._moreOptions.alignment=r(this._elem,this._textData.m.a,1,0,this)},TextAnimatorProperty.prototype.getMeasures=function(t,e){if(this.lettersChangedFlag=e,this._mdf||this._isFirstFrame||e||this._hasMaskedPath&&this._pathData.m._mdf){this._isFirstFrame=!1;var i,r,n,a,s,o,l,h,c,u,d,p,f,m,g,y,v,b,x,C=this._moreOptions.alignment.v,_=this._animatorsData,T=this._textData,A=this.mHelper,S=this._renderType,P=this.renderedLetters.length,w=t.l;if(this._hasMaskedPath){if(x=this._pathData.m,!this._pathData.n||this._pathData._mdf){var M,E=x.v;for(this._pathData.r.v&&(E=E.reverse()),s={tLength:0,segments:[]},a=E._length-1,y=0,n=0;n<a;n+=1)M=bez.buildBezierData(E.v[n],E.v[n+1],[E.o[n][0]-E.v[n][0],E.o[n][1]-E.v[n][1]],[E.i[n+1][0]-E.v[n+1][0],E.i[n+1][1]-E.v[n+1][1]]),s.tLength+=M.segmentLength,s.segments.push(M),y+=M.segmentLength;n=a,x.v.c&&(M=bez.buildBezierData(E.v[n],E.v[0],[E.o[n][0]-E.v[n][0],E.o[n][1]-E.v[n][1]],[E.i[0][0]-E.v[0][0],E.i[0][1]-E.v[0][1]]),s.tLength+=M.segmentLength,s.segments.push(M),y+=M.segmentLength),this._pathData.pi=s}if(s=this._pathData.pi,o=this._pathData.f.v,d=0,u=1,h=0,c=!0,m=s.segments,o<0&&x.v.c)for(s.tLength<Math.abs(o)&&(o=-Math.abs(o)%s.tLength),u=(f=m[d=m.length-1].points).length-1;o<0;)o+=f[u].partialLength,(u-=1)<0&&(u=(f=m[d-=1].points).length-1);p=(f=m[d].points)[u-1],g=(l=f[u]).partialLength}a=w.length,i=0,r=0;var R,B,k,D,I,L=1.2*t.finalSize*.714,O=!0;k=_.length;var F,G,N,j,$,U,V,W,z,H,Y,X,q=-1,K=o,Z=d,J=u,Q=-1,tt="",et=this.defaultPropsArray;if(2===t.j||1===t.j){var it=0,rt=0,nt=2===t.j?-.5:-1,at=0,st=!0;for(n=0;n<a;n+=1)if(w[n].n){for(it&&(it+=rt);at<n;)w[at].animatorJustifyOffset=it,at+=1;it=0,st=!0}else{for(B=0;B<k;B+=1)(R=_[B].a).t.propType&&(st&&2===t.j&&(rt+=R.t.v*nt),(I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars)).length?it+=R.t.v*I[0]*nt:it+=R.t.v*I*nt);st=!1}for(it&&(it+=rt);at<n;)w[at].animatorJustifyOffset=it,at+=1}for(n=0;n<a;n+=1){if(A.reset(),j=1,w[n].n)i=0,r+=t.yOffset,r+=O?1:0,o=K,O=!1,this._hasMaskedPath&&(u=J,p=(f=m[d=Z].points)[u-1],g=(l=f[u]).partialLength,h=0),tt="",Y="",z="",X="",et=this.defaultPropsArray;else{if(this._hasMaskedPath){if(Q!==w[n].line){switch(t.j){case 1:o+=y-t.lineWidths[w[n].line];break;case 2:o+=(y-t.lineWidths[w[n].line])/2}Q=w[n].line}q!==w[n].ind&&(w[q]&&(o+=w[q].extra),o+=w[n].an/2,q=w[n].ind),o+=C[0]*w[n].an*.005;var ot=0;for(B=0;B<k;B+=1)(R=_[B].a).p.propType&&((I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars)).length?ot+=R.p.v[0]*I[0]:ot+=R.p.v[0]*I),R.a.propType&&((I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars)).length?ot+=R.a.v[0]*I[0]:ot+=R.a.v[0]*I);for(c=!0,this._pathData.a.v&&(o=.5*w[0].an+(y-this._pathData.f.v-.5*w[0].an-.5*w[w.length-1].an)*q/(a-1),o+=this._pathData.f.v);c;)h+g>=o+ot||!f?(v=(o+ot-h)/l.partialLength,G=p.point[0]+(l.point[0]-p.point[0])*v,N=p.point[1]+(l.point[1]-p.point[1])*v,A.translate(-C[0]*w[n].an*.005,-C[1]*L*.01),c=!1):f&&(h+=l.partialLength,(u+=1)>=f.length&&(u=0,m[d+=1]?f=m[d].points:x.v.c?(u=0,f=m[d=0].points):(h-=l.partialLength,f=null)),f&&(p=l,g=(l=f[u]).partialLength));F=w[n].an/2-w[n].add,A.translate(-F,0,0)}else F=w[n].an/2-w[n].add,A.translate(-F,0,0),A.translate(-C[0]*w[n].an*.005,-C[1]*L*.01,0);for(B=0;B<k;B+=1)(R=_[B].a).t.propType&&(I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars),0===i&&0===t.j||(this._hasMaskedPath?I.length?o+=R.t.v*I[0]:o+=R.t.v*I:I.length?i+=R.t.v*I[0]:i+=R.t.v*I));for(t.strokeWidthAnim&&(U=t.sw||0),t.strokeColorAnim&&($=t.sc?[t.sc[0],t.sc[1],t.sc[2]]:[0,0,0]),t.fillColorAnim&&t.fc&&(V=[t.fc[0],t.fc[1],t.fc[2]]),B=0;B<k;B+=1)(R=_[B].a).a.propType&&((I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars)).length?A.translate(-R.a.v[0]*I[0],-R.a.v[1]*I[1],R.a.v[2]*I[2]):A.translate(-R.a.v[0]*I,-R.a.v[1]*I,R.a.v[2]*I));for(B=0;B<k;B+=1)(R=_[B].a).s.propType&&((I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars)).length?A.scale(1+(R.s.v[0]-1)*I[0],1+(R.s.v[1]-1)*I[1],1):A.scale(1+(R.s.v[0]-1)*I,1+(R.s.v[1]-1)*I,1));for(B=0;B<k;B+=1){if(R=_[B].a,I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars),R.sk.propType&&(I.length?A.skewFromAxis(-R.sk.v*I[0],R.sa.v*I[1]):A.skewFromAxis(-R.sk.v*I,R.sa.v*I)),R.r.propType&&(I.length?A.rotateZ(-R.r.v*I[2]):A.rotateZ(-R.r.v*I)),R.ry.propType&&(I.length?A.rotateY(R.ry.v*I[1]):A.rotateY(R.ry.v*I)),R.rx.propType&&(I.length?A.rotateX(R.rx.v*I[0]):A.rotateX(R.rx.v*I)),R.o.propType&&(I.length?j+=(R.o.v*I[0]-j)*I[0]:j+=(R.o.v*I-j)*I),t.strokeWidthAnim&&R.sw.propType&&(I.length?U+=R.sw.v*I[0]:U+=R.sw.v*I),t.strokeColorAnim&&R.sc.propType)for(W=0;W<3;W+=1)I.length?$[W]+=(R.sc.v[W]-$[W])*I[0]:$[W]+=(R.sc.v[W]-$[W])*I;if(t.fillColorAnim&&t.fc){if(R.fc.propType)for(W=0;W<3;W+=1)I.length?V[W]+=(R.fc.v[W]-V[W])*I[0]:V[W]+=(R.fc.v[W]-V[W])*I;R.fh.propType&&(V=I.length?addHueToRGB(V,R.fh.v*I[0]):addHueToRGB(V,R.fh.v*I)),R.fs.propType&&(V=I.length?addSaturationToRGB(V,R.fs.v*I[0]):addSaturationToRGB(V,R.fs.v*I)),R.fb.propType&&(V=I.length?addBrightnessToRGB(V,R.fb.v*I[0]):addBrightnessToRGB(V,R.fb.v*I))}}for(B=0;B<k;B+=1)(R=_[B].a).p.propType&&(I=_[B].s.getMult(w[n].anIndexes[B],T.a[B].s.totalChars),this._hasMaskedPath?I.length?A.translate(0,R.p.v[1]*I[0],-R.p.v[2]*I[1]):A.translate(0,R.p.v[1]*I,-R.p.v[2]*I):I.length?A.translate(R.p.v[0]*I[0],R.p.v[1]*I[1],-R.p.v[2]*I[2]):A.translate(R.p.v[0]*I,R.p.v[1]*I,-R.p.v[2]*I));if(t.strokeWidthAnim&&(z=U<0?0:U),t.strokeColorAnim&&(H="rgb("+Math.round(255*$[0])+","+Math.round(255*$[1])+","+Math.round(255*$[2])+")"),t.fillColorAnim&&t.fc&&(Y="rgb("+Math.round(255*V[0])+","+Math.round(255*V[1])+","+Math.round(255*V[2])+")"),this._hasMaskedPath){if(A.translate(0,-t.ls),A.translate(0,C[1]*L*.01+r,0),this._pathData.p.v){b=(l.point[1]-p.point[1])/(l.point[0]-p.point[0]);var lt=180*Math.atan(b)/Math.PI;l.point[0]<p.point[0]&&(lt+=180),A.rotate(-lt*Math.PI/180)}A.translate(G,N,0),o-=C[0]*w[n].an*.005,w[n+1]&&q!==w[n+1].ind&&(o+=w[n].an/2,o+=.001*t.tr*t.finalSize)}else{switch(A.translate(i,r,0),t.ps&&A.translate(t.ps[0],t.ps[1]+t.ascent,0),t.j){case 1:A.translate(w[n].animatorJustifyOffset+t.justifyOffset+(t.boxWidth-t.lineWidths[w[n].line]),0,0);break;case 2:A.translate(w[n].animatorJustifyOffset+t.justifyOffset+(t.boxWidth-t.lineWidths[w[n].line])/2,0,0)}A.translate(0,-t.ls),A.translate(F,0,0),A.translate(C[0]*w[n].an*.005,C[1]*L*.01,0),i+=w[n].l+.001*t.tr*t.finalSize}"html"===S?tt=A.toCSS():"svg"===S?tt=A.to2dCSS():et=[A.props[0],A.props[1],A.props[2],A.props[3],A.props[4],A.props[5],A.props[6],A.props[7],A.props[8],A.props[9],A.props[10],A.props[11],A.props[12],A.props[13],A.props[14],A.props[15]],X=j}P<=n?(D=new LetterProps(X,z,H,Y,tt,et),this.renderedLetters.push(D),P+=1,this.lettersChangedFlag=!0):(D=this.renderedLetters[n],this.lettersChangedFlag=D.update(X,z,H,Y,tt,et)||this.lettersChangedFlag)}}},TextAnimatorProperty.prototype.getValue=function(){this._elem.globalData.frameId!==this._frameId&&(this._frameId=this._elem.globalData.frameId,this.iterateDynamicProperties())},TextAnimatorProperty.prototype.mHelper=new Matrix,TextAnimatorProperty.prototype.defaultPropsArray=[],extendPrototype([DynamicPropertyContainer],TextAnimatorProperty),ITextElement.prototype.initElement=function(t,e,i){this.lettersChangedFlag=!0,this.initFrame(),this.initBaseData(t,e,i),this.textProperty=new TextProperty(this,t.t,this.dynamicProperties),this.textAnimator=new TextAnimatorProperty(t.t,this.renderType,this),this.initTransform(t,e,i),this.initHierarchy(),this.initRenderable(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),this.createContent(),this.hide(),this.textAnimator.searchProperties(this.dynamicProperties)},ITextElement.prototype.prepareFrame=function(t){this._mdf=!1,this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange)},ITextElement.prototype.createPathShape=function(t,e){var i,r,n=e.length,a="";for(i=0;i<n;i+=1)"sh"===e[i].ty&&(r=e[i].ks.k,a+=buildShapeString(r,r.i.length,!0,t));return a},ITextElement.prototype.updateDocumentData=function(t,e){this.textProperty.updateDocumentData(t,e)},ITextElement.prototype.canResizeFont=function(t){this.textProperty.canResizeFont(t)},ITextElement.prototype.setMinimumFontSize=function(t){this.textProperty.setMinimumFontSize(t)},ITextElement.prototype.applyTextPropertiesToMatrix=function(t,e,i,r,n){switch(t.ps&&e.translate(t.ps[0],t.ps[1]+t.ascent,0),e.translate(0,-t.ls,0),t.j){case 1:e.translate(t.justifyOffset+(t.boxWidth-t.lineWidths[i]),0,0);break;case 2:e.translate(t.justifyOffset+(t.boxWidth-t.lineWidths[i])/2,0,0)}e.translate(r,n,0)},ITextElement.prototype.buildColor=function(t){return"rgb("+Math.round(255*t[0])+","+Math.round(255*t[1])+","+Math.round(255*t[2])+")"},ITextElement.prototype.emptyProp=new LetterProps,ITextElement.prototype.destroy=function(){},ITextElement.prototype.validateText=function(){(this.textProperty._mdf||this.textProperty._isFirstFrame)&&(this.buildNewText(),this.textProperty._isFirstFrame=!1,this.textProperty._mdf=!1)};var emptyShapeData={shapes:[]};function SVGTextLottieElement(t,e,i){this.textSpans=[],this.renderType="svg",this.initElement(t,e,i)}function ISolidElement(t,e,i){this.initElement(t,e,i)}function NullElement(t,e,i){this.initFrame(),this.initBaseData(t,e,i),this.initFrame(),this.initTransform(t,e,i),this.initHierarchy()}function SVGRendererBase(){}function ICompElement(){}function SVGCompElement(t,e,i){this.layers=t.layers,this.supports3d=!0,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(t,e,i),this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0}}function SVGRenderer(t,e){this.animationItem=t,this.layers=null,this.renderedFrame=-1,this.svgElement=createNS("svg");var i="";if(e&&e.title){var r=createNS("title"),n=createElementID();r.setAttribute("id",n),r.textContent=e.title,this.svgElement.appendChild(r),i+=n}if(e&&e.description){var a=createNS("desc"),s=createElementID();a.setAttribute("id",s),a.textContent=e.description,this.svgElement.appendChild(a),i+=" "+s}i&&this.svgElement.setAttribute("aria-labelledby",i);var o=createNS("defs");this.svgElement.appendChild(o);var l=createNS("g");this.svgElement.appendChild(l),this.layerElement=l,this.renderConfig={preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",progressiveLoad:e&&e.progressiveLoad||!1,hideOnTransparent:!(e&&!1===e.hideOnTransparent),viewBoxOnly:e&&e.viewBoxOnly||!1,viewBoxSize:e&&e.viewBoxSize||!1,className:e&&e.className||"",id:e&&e.id||"",focusable:e&&e.focusable,filterSize:{width:e&&e.filterSize&&e.filterSize.width||"100%",height:e&&e.filterSize&&e.filterSize.height||"100%",x:e&&e.filterSize&&e.filterSize.x||"0%",y:e&&e.filterSize&&e.filterSize.y||"0%"},width:e&&e.width,height:e&&e.height,runExpressions:!e||void 0===e.runExpressions||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,defs:o,renderConfig:this.renderConfig},this.elements=[],this.pendingElements=[],this.destroyed=!1,this.rendererType="svg"}function ShapeTransformManager(){this.sequences={},this.sequenceList=[],this.transform_key_count=0}extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],SVGTextLottieElement),SVGTextLottieElement.prototype.createContent=function(){this.data.singleShape&&!this.globalData.fontManager.chars&&(this.textContainer=createNS("text"))},SVGTextLottieElement.prototype.buildTextContents=function(t){for(var e=0,i=t.length,r=[],n="";e<i;)t[e]===String.fromCharCode(13)||t[e]===String.fromCharCode(3)?(r.push(n),n=""):n+=t[e],e+=1;return r.push(n),r},SVGTextLottieElement.prototype.buildShapeData=function(t,e){if(t.shapes&&t.shapes.length){var i=t.shapes[0];if(i.it){var r=i.it[i.it.length-1];r.s&&(r.s.k[0]=e,r.s.k[1]=e)}}return t},SVGTextLottieElement.prototype.buildNewText=function(){var t,e;this.addDynamicProperty(this);var i=this.textProperty.currentData;this.renderedLetters=createSizedArray(i?i.l.length:0),i.fc?this.layerElement.setAttribute("fill",this.buildColor(i.fc)):this.layerElement.setAttribute("fill","rgba(0,0,0,0)"),i.sc&&(this.layerElement.setAttribute("stroke",this.buildColor(i.sc)),this.layerElement.setAttribute("stroke-width",i.sw)),this.layerElement.setAttribute("font-size",i.finalSize);var r=this.globalData.fontManager.getFontByName(i.f);if(r.fClass)this.layerElement.setAttribute("class",r.fClass);else{this.layerElement.setAttribute("font-family",r.fFamily);var n=i.fWeight,a=i.fStyle;this.layerElement.setAttribute("font-style",a),this.layerElement.setAttribute("font-weight",n)}this.layerElement.setAttribute("aria-label",i.t);var s,o=i.l||[],l=!!this.globalData.fontManager.chars;e=o.length;var h=this.mHelper,c=this.data.singleShape,u=0,d=0,p=!0,f=.001*i.tr*i.finalSize;if(!c||l||i.sz){var m,g=this.textSpans.length;for(t=0;t<e;t+=1){if(this.textSpans[t]||(this.textSpans[t]={span:null,childSpan:null,glyph:null}),!l||!c||0===t){if(s=g>t?this.textSpans[t].span:createNS(l?"g":"text"),g<=t){if(s.setAttribute("stroke-linecap","butt"),s.setAttribute("stroke-linejoin","round"),s.setAttribute("stroke-miterlimit","4"),this.textSpans[t].span=s,l){var y=createNS("g");s.appendChild(y),this.textSpans[t].childSpan=y}this.textSpans[t].span=s,this.layerElement.appendChild(s)}s.style.display="inherit"}if(h.reset(),c&&(o[t].n&&(u=-f,d+=i.yOffset,d+=p?1:0,p=!1),this.applyTextPropertiesToMatrix(i,h,o[t].line,u,d),u+=o[t].l||0,u+=f),l){var v;if(1===(m=this.globalData.fontManager.getCharData(i.finalText[t],r.fStyle,this.globalData.fontManager.getFontByName(i.f).fFamily)).t)v=new SVGCompElement(m.data,this.globalData,this);else{var b=emptyShapeData;m.data&&m.data.shapes&&(b=this.buildShapeData(m.data,i.finalSize)),v=new SVGShapeElement(b,this.globalData,this)}if(this.textSpans[t].glyph){var x=this.textSpans[t].glyph;this.textSpans[t].childSpan.removeChild(x.layerElement),x.destroy()}this.textSpans[t].glyph=v,v._debug=!0,v.prepareFrame(0),v.renderFrame(),this.textSpans[t].childSpan.appendChild(v.layerElement),1===m.t&&this.textSpans[t].childSpan.setAttribute("transform","scale("+i.finalSize/100+","+i.finalSize/100+")")}else c&&s.setAttribute("transform","translate("+h.props[12]+","+h.props[13]+")"),s.textContent=o[t].val,s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}c&&s&&s.setAttribute("d","")}else{var C=this.textContainer,_="start";switch(i.j){case 1:_="end";break;case 2:_="middle";break;default:_="start"}C.setAttribute("text-anchor",_),C.setAttribute("letter-spacing",f);var T=this.buildTextContents(i.finalText);for(e=T.length,d=i.ps?i.ps[1]+i.ascent:0,t=0;t<e;t+=1)(s=this.textSpans[t].span||createNS("tspan")).textContent=T[t],s.setAttribute("x",0),s.setAttribute("y",d),s.style.display="inherit",C.appendChild(s),this.textSpans[t]||(this.textSpans[t]={span:null,glyph:null}),this.textSpans[t].span=s,d+=i.finalLineHeight;this.layerElement.appendChild(C)}for(;t<this.textSpans.length;)this.textSpans[t].span.style.display="none",t+=1;this._sizeChanged=!0},SVGTextLottieElement.prototype.sourceRectAtTime=function(){if(this.prepareFrame(this.comp.renderedFrame-this.data.st),this.renderInnerContent(),this._sizeChanged){this._sizeChanged=!1;var t=this.layerElement.getBBox();this.bbox={top:t.y,left:t.x,width:t.width,height:t.height}}return this.bbox},SVGTextLottieElement.prototype.getValue=function(){var t,e,i=this.textSpans.length;for(this.renderedFrame=this.comp.renderedFrame,t=0;t<i;t+=1)(e=this.textSpans[t].glyph)&&(e.prepareFrame(this.comp.renderedFrame-this.data.st),e._mdf&&(this._mdf=!0))},SVGTextLottieElement.prototype.renderInnerContent=function(){if(this.validateText(),(!this.data.singleShape||this._mdf)&&(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag)){var t,e;this._sizeChanged=!0;var i,r,n,a=this.textAnimator.renderedLetters,s=this.textProperty.currentData.l;for(e=s.length,t=0;t<e;t+=1)s[t].n||(i=a[t],r=this.textSpans[t].span,(n=this.textSpans[t].glyph)&&n.renderFrame(),i._mdf.m&&r.setAttribute("transform",i.m),i._mdf.o&&r.setAttribute("opacity",i.o),i._mdf.sw&&r.setAttribute("stroke-width",i.sw),i._mdf.sc&&r.setAttribute("stroke",i.sc),i._mdf.fc&&r.setAttribute("fill",i.fc))}},extendPrototype([IImageElement],ISolidElement),ISolidElement.prototype.createContent=function(){var t=createNS("rect");t.setAttribute("width",this.data.sw),t.setAttribute("height",this.data.sh),t.setAttribute("fill",this.data.sc),this.layerElement.appendChild(t)},NullElement.prototype.prepareFrame=function(t){this.prepareProperties(t,!0)},NullElement.prototype.renderFrame=function(){},NullElement.prototype.getBaseElement=function(){return null},NullElement.prototype.destroy=function(){},NullElement.prototype.sourceRectAtTime=function(){},NullElement.prototype.hide=function(){},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement],NullElement),extendPrototype([BaseRenderer],SVGRendererBase),SVGRendererBase.prototype.createNull=function(t){return new NullElement(t,this.globalData,this)},SVGRendererBase.prototype.createShape=function(t){return new SVGShapeElement(t,this.globalData,this)},SVGRendererBase.prototype.createText=function(t){return new SVGTextLottieElement(t,this.globalData,this)},SVGRendererBase.prototype.createImage=function(t){return new IImageElement(t,this.globalData,this)},SVGRendererBase.prototype.createSolid=function(t){return new ISolidElement(t,this.globalData,this)},SVGRendererBase.prototype.configAnimation=function(t){this.svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.svgElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),this.renderConfig.viewBoxSize?this.svgElement.setAttribute("viewBox",this.renderConfig.viewBoxSize):this.svgElement.setAttribute("viewBox","0 0 "+t.w+" "+t.h),this.renderConfig.viewBoxOnly||(this.svgElement.setAttribute("width",t.w),this.svgElement.setAttribute("height",t.h),this.svgElement.style.width="100%",this.svgElement.style.height="100%",this.svgElement.style.transform="translate3d(0,0,0)",this.svgElement.style.contentVisibility=this.renderConfig.contentVisibility),this.renderConfig.width&&this.svgElement.setAttribute("width",this.renderConfig.width),this.renderConfig.height&&this.svgElement.setAttribute("height",this.renderConfig.height),this.renderConfig.className&&this.svgElement.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.svgElement.setAttribute("id",this.renderConfig.id),void 0!==this.renderConfig.focusable&&this.svgElement.setAttribute("focusable",this.renderConfig.focusable),this.svgElement.setAttribute("preserveAspectRatio",this.renderConfig.preserveAspectRatio),this.animationItem.wrapper.appendChild(this.svgElement);var e=this.globalData.defs;this.setupGlobalData(t,e),this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.data=t;var i=createNS("clipPath"),r=createNS("rect");r.setAttribute("width",t.w),r.setAttribute("height",t.h),r.setAttribute("x",0),r.setAttribute("y",0);var n=createElementID();i.setAttribute("id",n),i.appendChild(r),this.layerElement.setAttribute("clip-path","url("+getLocationHref()+"#"+n+")"),e.appendChild(i),this.layers=t.layers,this.elements=createSizedArray(t.layers.length)},SVGRendererBase.prototype.destroy=function(){var t;this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.layerElement=null,this.globalData.defs=null;var e=this.layers?this.layers.length:0;for(t=0;t<e;t+=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},SVGRendererBase.prototype.updateContainerSize=function(){},SVGRendererBase.prototype.findIndexByInd=function(t){var e=0,i=this.layers.length;for(e=0;e<i;e+=1)if(this.layers[e].ind===t)return e;return-1},SVGRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!e[t]&&99!==this.layers[t].ty){e[t]=!0;var i=this.createItem(this.layers[t]);if(e[t]=i,getExpressionsPlugin()&&(0===this.layers[t].ty&&this.globalData.projectInterface.registerComposition(i),i.initExpressions()),this.appendElementInPos(i,t),this.layers[t].tt){var r="tp"in this.layers[t]?this.findIndexByInd(this.layers[t].tp):t-1;if(-1===r)return;if(this.elements[r]&&!0!==this.elements[r]){var n=e[r].getMatte(this.layers[t].tt);i.setMatte(n)}else this.buildItem(r),this.addPendingElement(i)}}},SVGRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();if(t.checkParenting(),t.data.tt)for(var e=0,i=this.elements.length;e<i;){if(this.elements[e]===t){var r="tp"in t.data?this.findIndexByInd(t.data.tp):e-1,n=this.elements[r].getMatte(this.layers[e].tt);t.setMatte(n);break}e+=1}}},SVGRendererBase.prototype.renderFrame=function(t){if(this.renderedFrame!==t&&!this.destroyed){var e;null===t?t=this.renderedFrame:this.renderedFrame=t,this.globalData.frameNum=t,this.globalData.frameId+=1,this.globalData.projectInterface.currentFrame=t,this.globalData._mdf=!1;var i=this.layers.length;for(this.completeLayers||this.checkLayers(t),e=i-1;e>=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(t-this.layers[e].st);if(this.globalData._mdf)for(e=0;e<i;e+=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()}},SVGRendererBase.prototype.appendElementInPos=function(t,e){var i=t.getBaseElement();if(i){for(var r,n=0;n<e;)this.elements[n]&&!0!==this.elements[n]&&this.elements[n].getBaseElement()&&(r=this.elements[n].getBaseElement()),n+=1;r?this.layerElement.insertBefore(i,r):this.layerElement.appendChild(i)}},SVGRendererBase.prototype.hide=function(){this.layerElement.style.display="none"},SVGRendererBase.prototype.show=function(){this.layerElement.style.display="block"},extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement,RenderableDOMElement],ICompElement),ICompElement.prototype.initElement=function(t,e,i){this.initFrame(),this.initBaseData(t,e,i),this.initTransform(t,e,i),this.initRenderable(),this.initHierarchy(),this.initRendererElement(),this.createContainerElements(),this.createRenderableComponents(),!this.data.xt&&e.progressiveLoad||this.buildAllItems(),this.hide()},ICompElement.prototype.prepareFrame=function(t){if(this._mdf=!1,this.prepareRenderableFrame(t),this.prepareProperties(t,this.isInRange),this.isInRange||this.data.xt){if(this.tm._placeholder)this.renderedFrame=t/this.data.sr;else{var e=this.tm.v;e===this.data.op&&(e=this.data.op-1),this.renderedFrame=e}var i,r=this.elements.length;for(this.completeLayers||this.checkLayers(this.renderedFrame),i=r-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&(this.elements[i].prepareFrame(this.renderedFrame-this.layers[i].st),this.elements[i]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var t,e=this.layers.length;for(t=0;t<e;t+=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},ICompElement.prototype.setElements=function(t){this.elements=t},ICompElement.prototype.getElements=function(){return this.elements},ICompElement.prototype.destroyElements=function(){var t,e=this.layers.length;for(t=0;t<e;t+=1)this.elements[t]&&this.elements[t].destroy()},ICompElement.prototype.destroy=function(){this.destroyElements(),this.destroyBaseElement()},extendPrototype([SVGRendererBase,ICompElement,SVGBaseElement],SVGCompElement),SVGCompElement.prototype.createComp=function(t){return new SVGCompElement(t,this.globalData,this)},extendPrototype([SVGRendererBase],SVGRenderer),SVGRenderer.prototype.createComp=function(t){return new SVGCompElement(t,this.globalData,this)},ShapeTransformManager.prototype={addTransformSequence:function(t){var e,i=t.length,r="_";for(e=0;e<i;e+=1)r+=t[e].transform.key+"_";var n=this.sequences[r];return n||(n={transforms:[].concat(t),finalTransform:new Matrix,_mdf:!1},this.sequences[r]=n,this.sequenceList.push(n)),n},processSequence:function(t,e){for(var i=0,r=t.transforms.length,n=e;i<r&&!e;){if(t.transforms[i].transform.mProps._mdf){n=!0;break}i+=1}if(n)for(t.finalTransform.reset(),i=r-1;i>=0;i-=1)t.finalTransform.multiply(t.transforms[i].transform.mProps.v);t._mdf=n},processSequences:function(t){var e,i=this.sequenceList.length;for(e=0;e<i;e+=1)this.processSequence(this.sequenceList[e],t)},getNewKey:function(){return this.transform_key_count+=1,"_"+this.transform_key_count}};var lumaLoader=function(){var t="__lottie_element_luma_buffer",e=null,i=null,r=null;function n(){var n,a,s;e||(n=createNS("svg"),a=createNS("filter"),s=createNS("feColorMatrix"),a.setAttribute("id",t),s.setAttribute("type","matrix"),s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("values","0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0, 0.3, 0.3, 0.3, 0, 0"),a.appendChild(s),n.appendChild(a),n.setAttribute("id",t+"_svg"),featureSupport.svgLumaHidden&&(n.style.display="none"),r=n,document.body.appendChild(r),e=createTag("canvas"),(i=e.getContext("2d")).filter="url(#"+t+")",i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1))}return{load:n,get:function(r){return e||n(),e.width=r.width,e.height=r.height,i.filter="url(#"+t+")",e}}};function createCanvas(t,e){if(featureSupport.offscreenCanvas)return new OffscreenCanvas(t,e);var i=createTag("canvas");return i.width=t,i.height=e,i}var assetLoader={loadLumaCanvas:lumaLoader.load,getLumaCanvas:lumaLoader.get,createCanvas:createCanvas},registeredEffects={};function CVEffects(t){var e,i,r=t.data.ef?t.data.ef.length:0;for(this.filters=[],e=0;e<r;e+=1){i=null;var n=t.data.ef[e].ty;registeredEffects[n]&&(i=new(0,registeredEffects[n].effect)(t.effectsManager.effectElements[e],t)),i&&this.filters.push(i)}this.filters.length&&t.addRenderableComponent(this)}function registerEffect(t,e){registeredEffects[t]={effect:e}}function CVMaskElement(t,e){var i;this.data=t,this.element=e,this.masksProperties=this.data.masksProperties||[],this.viewData=createSizedArray(this.masksProperties.length);var r=this.masksProperties.length,n=!1;for(i=0;i<r;i+=1)"n"!==this.masksProperties[i].mode&&(n=!0),this.viewData[i]=ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[i],3);this.hasMasks=n,n&&this.element.addRenderableComponent(this)}function CVBaseElement(){}CVEffects.prototype.renderFrame=function(t){var e,i=this.filters.length;for(e=0;e<i;e+=1)this.filters[e].renderFrame(t)},CVEffects.prototype.getEffects=function(t){var e,i=this.filters.length,r=[];for(e=0;e<i;e+=1)this.filters[e].type===t&&r.push(this.filters[e]);return r},CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var t,e,i,r,n=this.element.finalTransform.mat,a=this.element.canvasContext,s=this.masksProperties.length;for(a.beginPath(),t=0;t<s;t+=1)if("n"!==this.masksProperties[t].mode){var o;this.masksProperties[t].inv&&(a.moveTo(0,0),a.lineTo(this.element.globalData.compSize.w,0),a.lineTo(this.element.globalData.compSize.w,this.element.globalData.compSize.h),a.lineTo(0,this.element.globalData.compSize.h),a.lineTo(0,0)),r=this.viewData[t].v,e=n.applyToPointArray(r.v[0][0],r.v[0][1],0),a.moveTo(e[0],e[1]);var l=r._length;for(o=1;o<l;o+=1)i=n.applyToTriplePoints(r.o[o-1],r.i[o],r.v[o]),a.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]);i=n.applyToTriplePoints(r.o[o-1],r.i[0],r.v[0]),a.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}this.element.globalData.renderer.save(!0),a.clip()}},CVMaskElement.prototype.getMaskProperty=MaskElement.prototype.getMaskProperty,CVMaskElement.prototype.destroy=function(){this.element=null};var operationsMap={1:"source-in",2:"source-out",3:"source-in",4:"source-out"};function CVShapeData(t,e,i,r){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var n,a=4;"rc"===e.ty?a=5:"el"===e.ty?a=6:"sr"===e.ty&&(a=7),this.sh=ShapePropertyFactory.getShapeProp(t,e,a,t);var s,o=i.length;for(n=0;n<o;n+=1)i[n].closed||(s={transforms:r.addTransformSequence(i[n].transforms),trNodes:[]},this.styledShapes.push(s),i[n].elements.push(s))}function CVShapeElement(t,e,i){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.itemsData=[],this.prevViewData=[],this.shapeModifiers=[],this.processedElements=[],this.transformsManager=new ShapeTransformManager,this.initElement(t,e,i)}function CVTextElement(t,e,i){this.textSpans=[],this.yOffset=0,this.fillColorAnim=!1,this.strokeColorAnim=!1,this.strokeWidthAnim=!1,this.stroke=!1,this.fill=!1,this.justifyOffset=0,this.currentRender=null,this.renderType="canvas",this.values={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",sWidth:0,fValue:""},this.initElement(t,e,i)}function CVImageElement(t,e,i){this.assetData=e.getAssetData(t.refId),this.img=e.imageLoader.getAsset(this.assetData),this.initElement(t,e,i)}function CVSolidElement(t,e,i){this.initElement(t,e,i)}function CanvasRendererBase(){}function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){var t;for(this.stack=[],this.cArrPos=0,this.cTr=new Matrix,t=0;t<15;t+=1){var e=new CanvasContext;this.stack[t]=e}this._length=15,this.nativeContext=null,this.transformMat=new Matrix,this.currentOpacity=1,this.currentFillStyle="",this.appliedFillStyle="",this.currentStrokeStyle="",this.appliedStrokeStyle="",this.currentLineWidth="",this.appliedLineWidth="",this.currentLineCap="",this.appliedLineCap="",this.currentLineJoin="",this.appliedLineJoin="",this.appliedMiterLimit="",this.currentMiterLimit=""}function CVCompElement(t,e,i){this.completeLayers=!1,this.layers=t.layers,this.pendingElements=[],this.elements=createSizedArray(this.layers.length),this.initElement(t,e,i),this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0}}function CanvasRenderer(t,e){this.animationItem=t,this.renderConfig={clearCanvas:!e||void 0===e.clearCanvas||e.clearCanvas,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||void 0===e.runExpressions||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}function HBaseElement(){}function HSolidElement(t,e,i){this.initElement(t,e,i)}function HShapeElement(t,e,i){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(t,e,i),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}function HTextElement(t,e,i){this.textSpans=[],this.textPaths=[],this.currentBBox={x:999999,y:-999999,h:0,w:0},this.renderType="svg",this.isMasked=!1,this.initElement(t,e,i)}function HCameraElement(t,e,i){this.initFrame(),this.initBaseData(t,e,i),this.initHierarchy();var r=PropertyFactory.getProp;if(this.pe=r(this,t.pe,0,0,this),t.ks.p.s?(this.px=r(this,t.ks.p.x,1,0,this),this.py=r(this,t.ks.p.y,1,0,this),this.pz=r(this,t.ks.p.z,1,0,this)):this.p=r(this,t.ks.p,1,0,this),t.ks.a&&(this.a=r(this,t.ks.a,1,0,this)),t.ks.or.k.length&&t.ks.or.k[0].to){var n,a=t.ks.or.k.length;for(n=0;n<a;n+=1)t.ks.or.k[n].to=null,t.ks.or.k[n].ti=null}this.or=r(this,t.ks.or,1,degToRads,this),this.or.sh=!0,this.rx=r(this,t.ks.rx,0,degToRads,this),this.ry=r(this,t.ks.ry,0,degToRads,this),this.rz=r(this,t.ks.rz,0,degToRads,this),this.mat=new Matrix,this._prevMat=new Matrix,this._isFirstFrame=!0,this.finalTransform={mProp:this}}function HImageElement(t,e,i){this.assetData=e.getAssetData(t.refId),this.initElement(t,e,i)}function HybridRendererBase(t,e){this.animationItem=t,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&!1===e.hideOnTransparent),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"}},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}function HCompElement(t,e,i){this.layers=t.layers,this.supports3d=!t.hasMask,this.completeLayers=!1,this.pendingElements=[],this.elements=this.layers?createSizedArray(this.layers.length):[],this.initElement(t,e,i),this.tm=t.tm?PropertyFactory.getProp(this,t.tm,0,e.frameRate,this):{_placeholder:!0}}function HybridRenderer(t,e){this.animationItem=t,this.layers=null,this.renderedFrame=-1,this.renderConfig={className:e&&e.className||"",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",hideOnTransparent:!(e&&!1===e.hideOnTransparent),filterSize:{width:e&&e.filterSize&&e.filterSize.width||"400%",height:e&&e.filterSize&&e.filterSize.height||"400%",x:e&&e.filterSize&&e.filterSize.x||"-100%",y:e&&e.filterSize&&e.filterSize.y||"-100%"},runExpressions:!e||void 0===e.runExpressions||e.runExpressions},this.globalData={_mdf:!1,frameNum:-1,renderConfig:this.renderConfig},this.pendingElements=[],this.elements=[],this.threeDElements=[],this.destroyed=!1,this.camera=null,this.supports3d=!0,this.rendererType="html"}CVBaseElement.prototype={createElements:function(){},initRendererElement:function(){},createContainerElements:function(){if(this.data.tt>=1){this.buffers=[];var t=this.globalData.canvasContext,e=assetLoader.createCanvas(t.canvas.width,t.canvas.height);this.buffers.push(e);var i=assetLoader.createCanvas(t.canvas.width,t.canvas.height);this.buffers.push(i),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var t=this.globalData;if(t.blendMode!==this.data.bm){t.blendMode=this.data.bm;var e=getBlendMode(this.data.bm);t.canvasContext.globalCompositeOperation=e}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){this.hidden||this.isInRange&&!this.isTransparent||(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(t){t.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var t=this.buffers[0].getContext("2d");this.clearCanvas(t),t.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var t=this.buffers[1],e=t.getContext("2d");if(this.clearCanvas(e),e.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform),this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1).renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var i=assetLoader.getLumaCanvas(this.canvasContext.canvas);i.getContext("2d").drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(i,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(t,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(t){if(!this.hidden&&!this.data.hd&&(1!==this.data.td||t)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var e=0===this.data.ty;this.prepareLayer(),this.globalData.renderer.save(e),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(e),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement,CVShapeData.prototype.setAsAnimated=SVGShapeData.prototype.setAsAnimated,extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement],CVShapeElement),CVShapeElement.prototype.initElement=RenderableDOMElement.prototype.initElement,CVShapeElement.prototype.transformHelper={opacity:1,_opMdf:!1},CVShapeElement.prototype.dashResetter=[],CVShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[])},CVShapeElement.prototype.createStyleElement=function(t,e){var i={data:t,type:t.ty,preTransforms:this.transformsManager.addTransformSequence(e),transforms:[],elements:[],closed:!0===t.hd},r={};if("fl"===t.ty||"st"===t.ty?(r.c=PropertyFactory.getProp(this,t.c,1,255,this),r.c.k||(i.co="rgb("+bmFloor(r.c.v[0])+","+bmFloor(r.c.v[1])+","+bmFloor(r.c.v[2])+")")):"gf"!==t.ty&&"gs"!==t.ty||(r.s=PropertyFactory.getProp(this,t.s,1,null,this),r.e=PropertyFactory.getProp(this,t.e,1,null,this),r.h=PropertyFactory.getProp(this,t.h||{k:0},0,.01,this),r.a=PropertyFactory.getProp(this,t.a||{k:0},0,degToRads,this),r.g=new GradientProperty(this,t.g,this)),r.o=PropertyFactory.getProp(this,t.o,0,.01,this),"st"===t.ty||"gs"===t.ty){if(i.lc=lineCapEnum[t.lc||2],i.lj=lineJoinEnum[t.lj||2],1==t.lj&&(i.ml=t.ml),r.w=PropertyFactory.getProp(this,t.w,0,null,this),r.w.k||(i.wi=r.w.v),t.d){var n=new DashProperty(this,t.d,"canvas",this);r.d=n,r.d.k||(i.da=r.d.dashArray,i.do=r.d.dashoffset[0])}}else i.r=2===t.r?"evenodd":"nonzero";return this.stylesList.push(i),r.style=i,r},CVShapeElement.prototype.createGroupElement=function(){return{it:[],prevViewData:[]}},CVShapeElement.prototype.createTransformElement=function(t){return{transform:{opacity:1,_opMdf:!1,key:this.transformsManager.getNewKey(),op:PropertyFactory.getProp(this,t.o,0,.01,this),mProps:TransformPropertyFactory.getTransformProperty(this,t,this)}}},CVShapeElement.prototype.createShapeElement=function(t){var e=new CVShapeData(this,t,this.stylesList,this.transformsManager);return this.shapes.push(e),this.addShapeToModifiers(e),e},CVShapeElement.prototype.reloadShapes=function(){var t;this._isFirstFrame=!0;var e=this.itemsData.length;for(t=0;t<e;t+=1)this.prevViewData[t]=this.itemsData[t];for(this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,!0,[]),e=this.dynamicProperties.length,t=0;t<e;t+=1)this.dynamicProperties[t].getValue();this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame)},CVShapeElement.prototype.addTransformToStyleList=function(t){var e,i=this.stylesList.length;for(e=0;e<i;e+=1)this.stylesList[e].closed||this.stylesList[e].transforms.push(t)},CVShapeElement.prototype.removeTransformFromStyleList=function(){var t,e=this.stylesList.length;for(t=0;t<e;t+=1)this.stylesList[t].closed||this.stylesList[t].transforms.pop()},CVShapeElement.prototype.closeStyles=function(t){var e,i=t.length;for(e=0;e<i;e+=1)t[e].closed=!0},CVShapeElement.prototype.searchShapes=function(t,e,i,r,n){var a,s,o,l,h,c,u=t.length-1,d=[],p=[],f=[].concat(n);for(a=u;a>=0;a-=1){if((l=this.searchProcessedElement(t[a]))?e[a]=i[l-1]:t[a]._shouldRender=r,"fl"===t[a].ty||"st"===t[a].ty||"gf"===t[a].ty||"gs"===t[a].ty)l?e[a].style.closed=!1:e[a]=this.createStyleElement(t[a],f),d.push(e[a].style);else if("gr"===t[a].ty){if(l)for(o=e[a].it.length,s=0;s<o;s+=1)e[a].prevViewData[s]=e[a].it[s];else e[a]=this.createGroupElement(t[a]);this.searchShapes(t[a].it,e[a].it,e[a].prevViewData,r,f)}else"tr"===t[a].ty?(l||(c=this.createTransformElement(t[a]),e[a]=c),f.push(e[a]),this.addTransformToStyleList(e[a])):"sh"===t[a].ty||"rc"===t[a].ty||"el"===t[a].ty||"sr"===t[a].ty?l||(e[a]=this.createShapeElement(t[a])):"tm"===t[a].ty||"rd"===t[a].ty||"pb"===t[a].ty||"zz"===t[a].ty||"op"===t[a].ty?(l?(h=e[a]).closed=!1:((h=ShapeModifiers.getModifier(t[a].ty)).init(this,t[a]),e[a]=h,this.shapeModifiers.push(h)),p.push(h)):"rp"===t[a].ty&&(l?(h=e[a]).closed=!0:(h=ShapeModifiers.getModifier(t[a].ty),e[a]=h,h.init(this,t,a,e),this.shapeModifiers.push(h),r=!1),p.push(h));this.addProcessedElement(t[a],a+1)}for(this.removeTransformFromStyleList(),this.closeStyles(d),u=p.length,a=0;a<u;a+=1)p[a].closed=!0},CVShapeElement.prototype.renderInnerContent=function(){this.transformHelper.opacity=1,this.transformHelper._opMdf=!1,this.renderModifiers(),this.transformsManager.processSequences(this._isFirstFrame),this.renderShape(this.transformHelper,this.shapesData,this.itemsData,!0)},CVShapeElement.prototype.renderShapeTransform=function(t,e){(t._opMdf||e.op._mdf||this._isFirstFrame)&&(e.opacity=t.opacity,e.opacity*=e.op.v,e._opMdf=!0)},CVShapeElement.prototype.drawLayer=function(){var t,e,i,r,n,a,s,o,l,h=this.stylesList.length,c=this.globalData.renderer,u=this.globalData.canvasContext;for(t=0;t<h;t+=1)if(("st"!==(o=(l=this.stylesList[t]).type)&&"gs"!==o||0!==l.wi)&&l.data._shouldRender&&0!==l.coOp&&0!==this.globalData.currentGlobalAlpha){for(c.save(),a=l.elements,"st"===o||"gs"===o?(c.ctxStrokeStyle("st"===o?l.co:l.grd),c.ctxLineWidth(l.wi),c.ctxLineCap(l.lc),c.ctxLineJoin(l.lj),c.ctxMiterLimit(l.ml||0)):c.ctxFillStyle("fl"===o?l.co:l.grd),c.ctxOpacity(l.coOp),"st"!==o&&"gs"!==o&&u.beginPath(),c.ctxTransform(l.preTransforms.finalTransform.props),i=a.length,e=0;e<i;e+=1){for("st"!==o&&"gs"!==o||(u.beginPath(),l.da&&(u.setLineDash(l.da),u.lineDashOffset=l.do)),n=(s=a[e].trNodes).length,r=0;r<n;r+=1)"m"===s[r].t?u.moveTo(s[r].p[0],s[r].p[1]):"c"===s[r].t?u.bezierCurveTo(s[r].pts[0],s[r].pts[1],s[r].pts[2],s[r].pts[3],s[r].pts[4],s[r].pts[5]):u.closePath();"st"!==o&&"gs"!==o||(c.ctxStroke(),l.da&&u.setLineDash(this.dashResetter))}"st"!==o&&"gs"!==o&&this.globalData.renderer.ctxFill(l.r),c.restore()}},CVShapeElement.prototype.renderShape=function(t,e,i,r){var n,a;for(a=t,n=e.length-1;n>=0;n-=1)"tr"===e[n].ty?(a=i[n].transform,this.renderShapeTransform(t,a)):"sh"===e[n].ty||"el"===e[n].ty||"rc"===e[n].ty||"sr"===e[n].ty?this.renderPath(e[n],i[n]):"fl"===e[n].ty?this.renderFill(e[n],i[n],a):"st"===e[n].ty?this.renderStroke(e[n],i[n],a):"gf"===e[n].ty||"gs"===e[n].ty?this.renderGradientFill(e[n],i[n],a):"gr"===e[n].ty?this.renderShape(a,e[n].it,i[n].it):e[n].ty;r&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(t,e){if(this._isFirstFrame||e._mdf||t.transforms._mdf){var i,r,n,a=t.trNodes,s=e.paths,o=s._length;a.length=0;var l=t.transforms.finalTransform;for(n=0;n<o;n+=1){var h=s.shapes[n];if(h&&h.v){for(r=h._length,i=1;i<r;i+=1)1===i&&a.push({t:"m",p:l.applyToPointArray(h.v[0][0],h.v[0][1],0)}),a.push({t:"c",pts:l.applyToTriplePoints(h.o[i-1],h.i[i],h.v[i])});1===r&&a.push({t:"m",p:l.applyToPointArray(h.v[0][0],h.v[0][1],0)}),h.c&&r&&(a.push({t:"c",pts:l.applyToTriplePoints(h.o[i-1],h.i[0],h.v[0])}),a.push({t:"z"}))}}t.trNodes=a}},CVShapeElement.prototype.renderPath=function(t,e){if(!0!==t.hd&&t._shouldRender){var i,r=e.styledShapes.length;for(i=0;i<r;i+=1)this.renderStyledShape(e.styledShapes[i],e.sh)}},CVShapeElement.prototype.renderFill=function(t,e,i){var r=e.style;(e.c._mdf||this._isFirstFrame)&&(r.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(r.coOp=e.o.v*i.opacity)},CVShapeElement.prototype.renderGradientFill=function(t,e,i){var r,n=e.style;if(!n.grd||e.g._mdf||e.s._mdf||e.e._mdf||1!==t.t&&(e.h._mdf||e.a._mdf)){var a,s=this.globalData.canvasContext,o=e.s.v,l=e.e.v;if(1===t.t)r=s.createLinearGradient(o[0],o[1],l[0],l[1]);else{var h=Math.sqrt(Math.pow(o[0]-l[0],2)+Math.pow(o[1]-l[1],2)),c=Math.atan2(l[1]-o[1],l[0]-o[0]),u=e.h.v;u>=1?u=.99:u<=-1&&(u=-.99);var d=h*u,p=Math.cos(c+e.a.v)*d+o[0],f=Math.sin(c+e.a.v)*d+o[1];r=s.createRadialGradient(p,f,0,o[0],o[1],h)}var m=t.g.p,g=e.g.c,y=1;for(a=0;a<m;a+=1)e.g._hasOpacity&&e.g._collapsable&&(y=e.g.o[2*a+1]),r.addColorStop(g[4*a]/100,"rgba("+g[4*a+1]+","+g[4*a+2]+","+g[4*a+3]+","+y+")");n.grd=r}n.coOp=e.o.v*i.opacity},CVShapeElement.prototype.renderStroke=function(t,e,i){var r=e.style,n=e.d;n&&(n._mdf||this._isFirstFrame)&&(r.da=n.dashArray,r.do=n.dashoffset[0]),(e.c._mdf||this._isFirstFrame)&&(r.co="rgb("+bmFloor(e.c.v[0])+","+bmFloor(e.c.v[1])+","+bmFloor(e.c.v[2])+")"),(e.o._mdf||i._opMdf||this._isFirstFrame)&&(r.coOp=e.o.v*i.opacity),(e.w._mdf||this._isFirstFrame)&&(r.wi=e.w.v)},CVShapeElement.prototype.destroy=function(){this.shapesData=null,this.globalData=null,this.canvasContext=null,this.stylesList.length=0,this.itemsData.length=0},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement],CVTextElement),CVTextElement.prototype.tHelper=createTag("canvas").getContext("2d"),CVTextElement.prototype.buildNewText=function(){var t=this.textProperty.currentData;this.renderedLetters=createSizedArray(t.l?t.l.length:0);var e=!1;t.fc?(e=!0,this.values.fill=this.buildColor(t.fc)):this.values.fill="rgba(0,0,0,0)",this.fill=e;var i=!1;t.sc&&(i=!0,this.values.stroke=this.buildColor(t.sc),this.values.sWidth=t.sw);var r,n,a,s,o,l,h,c,u,d,p,f,m=this.globalData.fontManager.getFontByName(t.f),g=t.l,y=this.mHelper;this.stroke=i,this.values.fValue=t.finalSize+"px "+this.globalData.fontManager.getFontByName(t.f).fFamily,n=t.finalText.length;var v=this.data.singleShape,b=.001*t.tr*t.finalSize,x=0,C=0,_=!0,T=0;for(r=0;r<n;r+=1){s=(a=this.globalData.fontManager.getCharData(t.finalText[r],m.fStyle,this.globalData.fontManager.getFontByName(t.f).fFamily))&&a.data||{},y.reset(),v&&g[r].n&&(x=-b,C+=t.yOffset,C+=_?1:0,_=!1),u=(h=s.shapes?s.shapes[0].it:[]).length,y.scale(t.finalSize/100,t.finalSize/100),v&&this.applyTextPropertiesToMatrix(t,y,g[r].line,x,C),p=createSizedArray(u-1);var A=0;for(c=0;c<u;c+=1)if("sh"===h[c].ty){for(l=h[c].ks.k.i.length,d=h[c].ks.k,f=[],o=1;o<l;o+=1)1===o&&f.push(y.applyToX(d.v[0][0],d.v[0][1],0),y.applyToY(d.v[0][0],d.v[0][1],0)),f.push(y.applyToX(d.o[o-1][0],d.o[o-1][1],0),y.applyToY(d.o[o-1][0],d.o[o-1][1],0),y.applyToX(d.i[o][0],d.i[o][1],0),y.applyToY(d.i[o][0],d.i[o][1],0),y.applyToX(d.v[o][0],d.v[o][1],0),y.applyToY(d.v[o][0],d.v[o][1],0));f.push(y.applyToX(d.o[o-1][0],d.o[o-1][1],0),y.applyToY(d.o[o-1][0],d.o[o-1][1],0),y.applyToX(d.i[0][0],d.i[0][1],0),y.applyToY(d.i[0][0],d.i[0][1],0),y.applyToX(d.v[0][0],d.v[0][1],0),y.applyToY(d.v[0][0],d.v[0][1],0)),p[A]=f,A+=1}v&&(x+=g[r].l,x+=b),this.textSpans[T]?this.textSpans[T].elem=p:this.textSpans[T]={elem:p},T+=1}},CVTextElement.prototype.renderInnerContent=function(){var t,e,i,r,n,a;this.validateText(),this.canvasContext.font=this.values.fValue,this.globalData.renderer.ctxLineCap("butt"),this.globalData.renderer.ctxLineJoin("miter"),this.globalData.renderer.ctxMiterLimit(4),this.data.singleShape||this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag);var s,o=this.textAnimator.renderedLetters,l=this.textProperty.currentData.l;e=l.length;var h,c,u=null,d=null,p=null,f=this.globalData.renderer;for(t=0;t<e;t+=1)if(!l[t].n){if((s=o[t])&&(f.save(),f.ctxTransform(s.p),f.ctxOpacity(s.o)),this.fill){for(s&&s.fc?u!==s.fc&&(f.ctxFillStyle(s.fc),u=s.fc):u!==this.values.fill&&(u=this.values.fill,f.ctxFillStyle(this.values.fill)),r=(h=this.textSpans[t].elem).length,this.globalData.canvasContext.beginPath(),i=0;i<r;i+=1)for(a=(c=h[i]).length,this.globalData.canvasContext.moveTo(c[0],c[1]),n=2;n<a;n+=6)this.globalData.canvasContext.bezierCurveTo(c[n],c[n+1],c[n+2],c[n+3],c[n+4],c[n+5]);this.globalData.canvasContext.closePath(),f.ctxFill()}if(this.stroke){for(s&&s.sw?p!==s.sw&&(p=s.sw,f.ctxLineWidth(s.sw)):p!==this.values.sWidth&&(p=this.values.sWidth,f.ctxLineWidth(this.values.sWidth)),s&&s.sc?d!==s.sc&&(d=s.sc,f.ctxStrokeStyle(s.sc)):d!==this.values.stroke&&(d=this.values.stroke,f.ctxStrokeStyle(this.values.stroke)),r=(h=this.textSpans[t].elem).length,this.globalData.canvasContext.beginPath(),i=0;i<r;i+=1)for(a=(c=h[i]).length,this.globalData.canvasContext.moveTo(c[0],c[1]),n=2;n<a;n+=6)this.globalData.canvasContext.bezierCurveTo(c[n],c[n+1],c[n+2],c[n+3],c[n+4],c[n+5]);this.globalData.canvasContext.closePath(),f.ctxStroke()}s&&this.globalData.renderer.restore()}},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVImageElement),CVImageElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVImageElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVImageElement.prototype.createContent=function(){if(this.img.width&&(this.assetData.w!==this.img.width||this.assetData.h!==this.img.height)){var t=createTag("canvas");t.width=this.assetData.w,t.height=this.assetData.h;var e,i,r=t.getContext("2d"),n=this.img.width,a=this.img.height,s=n/a,o=this.assetData.w/this.assetData.h,l=this.assetData.pr||this.globalData.renderConfig.imagePreserveAspectRatio;s>o&&"xMidYMid slice"===l||s<o&&"xMidYMid slice"!==l?e=(i=a)*o:i=(e=n)/o,r.drawImage(this.img,(n-e)/2,(a-i)/2,e,i,0,0,this.assetData.w,this.assetData.h),this.img=t}},CVImageElement.prototype.renderInnerContent=function(){this.canvasContext.drawImage(this.img,0,0)},CVImageElement.prototype.destroy=function(){this.img=null},extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement],CVSolidElement),CVSolidElement.prototype.initElement=SVGShapeElement.prototype.initElement,CVSolidElement.prototype.prepareFrame=IImageElement.prototype.prepareFrame,CVSolidElement.prototype.renderInnerContent=function(){this.globalData.renderer.ctxFillStyle(this.data.sc),this.globalData.renderer.ctxFillRect(0,0,this.data.sw,this.data.sh)},extendPrototype([BaseRenderer],CanvasRendererBase),CanvasRendererBase.prototype.createShape=function(t){return new CVShapeElement(t,this.globalData,this)},CanvasRendererBase.prototype.createText=function(t){return new CVTextElement(t,this.globalData,this)},CanvasRendererBase.prototype.createImage=function(t){return new CVImageElement(t,this.globalData,this)},CanvasRendererBase.prototype.createSolid=function(t){return new CVSolidElement(t,this.globalData,this)},CanvasRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,CanvasRendererBase.prototype.ctxTransform=function(t){1===t[0]&&0===t[1]&&0===t[4]&&1===t[5]&&0===t[12]&&0===t[13]||this.canvasContext.transform(t[0],t[1],t[4],t[5],t[12],t[13])},CanvasRendererBase.prototype.ctxOpacity=function(t){this.canvasContext.globalAlpha*=t<0?0:t},CanvasRendererBase.prototype.ctxFillStyle=function(t){this.canvasContext.fillStyle=t},CanvasRendererBase.prototype.ctxStrokeStyle=function(t){this.canvasContext.strokeStyle=t},CanvasRendererBase.prototype.ctxLineWidth=function(t){this.canvasContext.lineWidth=t},CanvasRendererBase.prototype.ctxLineCap=function(t){this.canvasContext.lineCap=t},CanvasRendererBase.prototype.ctxLineJoin=function(t){this.canvasContext.lineJoin=t},CanvasRendererBase.prototype.ctxMiterLimit=function(t){this.canvasContext.miterLimit=t},CanvasRendererBase.prototype.ctxFill=function(t){this.canvasContext.fill(t)},CanvasRendererBase.prototype.ctxFillRect=function(t,e,i,r){this.canvasContext.fillRect(t,e,i,r)},CanvasRendererBase.prototype.ctxStroke=function(){this.canvasContext.stroke()},CanvasRendererBase.prototype.reset=function(){this.renderConfig.clearCanvas?this.contextData.reset():this.canvasContext.restore()},CanvasRendererBase.prototype.save=function(){this.canvasContext.save()},CanvasRendererBase.prototype.restore=function(t){this.renderConfig.clearCanvas?(t&&(this.globalData.blendMode="source-over"),this.contextData.restore(t)):this.canvasContext.restore()},CanvasRendererBase.prototype.configAnimation=function(t){if(this.animationItem.wrapper){this.animationItem.container=createTag("canvas");var e=this.animationItem.container.style;e.width="100%",e.height="100%";var i="0px 0px 0px";e.transformOrigin=i,e.mozTransformOrigin=i,e.webkitTransformOrigin=i,e["-webkit-transform"]=i,e.contentVisibility=this.renderConfig.contentVisibility,this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d"),this.renderConfig.className&&this.animationItem.container.setAttribute("class",this.renderConfig.className),this.renderConfig.id&&this.animationItem.container.setAttribute("id",this.renderConfig.id)}else this.canvasContext=this.renderConfig.context;this.contextData.setContext(this.canvasContext),this.data=t,this.layers=t.layers,this.transformCanvas={w:t.w,h:t.h,sx:0,sy:0,tx:0,ty:0},this.setupGlobalData(t,document.body),this.globalData.canvasContext=this.canvasContext,this.globalData.renderer=this,this.globalData.isDashed=!1,this.globalData.progressiveLoad=this.renderConfig.progressiveLoad,this.globalData.transformCanvas=this.transformCanvas,this.elements=createSizedArray(t.layers.length),this.updateContainerSize()},CanvasRendererBase.prototype.updateContainerSize=function(t,e){var i,r,n,a;if(this.reset(),t?(i=t,r=e,this.canvasContext.canvas.width=i,this.canvasContext.canvas.height=r):(this.animationItem.wrapper&&this.animationItem.container?(i=this.animationItem.wrapper.offsetWidth,r=this.animationItem.wrapper.offsetHeight):(i=this.canvasContext.canvas.width,r=this.canvasContext.canvas.height),this.canvasContext.canvas.width=i*this.renderConfig.dpr,this.canvasContext.canvas.height=r*this.renderConfig.dpr),-1!==this.renderConfig.preserveAspectRatio.indexOf("meet")||-1!==this.renderConfig.preserveAspectRatio.indexOf("slice")){var s=this.renderConfig.preserveAspectRatio.split(" "),o=s[1]||"meet",l=s[0]||"xMidYMid",h=l.substr(0,4),c=l.substr(4);n=i/r,(a=this.transformCanvas.w/this.transformCanvas.h)>n&&"meet"===o||a<n&&"slice"===o?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=i/(this.transformCanvas.w/this.renderConfig.dpr)):(this.transformCanvas.sx=r/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.sy=r/(this.transformCanvas.h/this.renderConfig.dpr)),this.transformCanvas.tx="xMid"===h&&(a<n&&"meet"===o||a>n&&"slice"===o)?(i-this.transformCanvas.w*(r/this.transformCanvas.h))/2*this.renderConfig.dpr:"xMax"===h&&(a<n&&"meet"===o||a>n&&"slice"===o)?(i-this.transformCanvas.w*(r/this.transformCanvas.h))*this.renderConfig.dpr:0,this.transformCanvas.ty="YMid"===c&&(a>n&&"meet"===o||a<n&&"slice"===o)?(r-this.transformCanvas.h*(i/this.transformCanvas.w))/2*this.renderConfig.dpr:"YMax"===c&&(a>n&&"meet"===o||a<n&&"slice"===o)?(r-this.transformCanvas.h*(i/this.transformCanvas.w))*this.renderConfig.dpr:0}else"none"===this.renderConfig.preserveAspectRatio?(this.transformCanvas.sx=i/(this.transformCanvas.w/this.renderConfig.dpr),this.transformCanvas.sy=r/(this.transformCanvas.h/this.renderConfig.dpr),this.transformCanvas.tx=0,this.transformCanvas.ty=0):(this.transformCanvas.sx=this.renderConfig.dpr,this.transformCanvas.sy=this.renderConfig.dpr,this.transformCanvas.tx=0,this.transformCanvas.ty=0);this.transformCanvas.props=[this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1],this.ctxTransform(this.transformCanvas.props),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.closePath(),this.canvasContext.clip(),this.renderFrame(this.renderedFrame,!0)},CanvasRendererBase.prototype.destroy=function(){var t;for(this.renderConfig.clearCanvas&&this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),t=(this.layers?this.layers.length:0)-1;t>=0;t-=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if((this.renderedFrame!==t||!0!==this.renderConfig.clearCanvas||e)&&!this.destroyed&&-1!==t){var i;this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r=this.layers.length;for(this.completeLayers||this.checkLayers(t),i=r-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].prepareFrame(t-this.layers[i].st);if(this.globalData._mdf){for(!0===this.renderConfig.clearCanvas?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),i=r-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].renderFrame();!0!==this.renderConfig.clearCanvas&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!e[t]&&99!==this.layers[t].ty){var i=this.createItem(this.layers[t],this,this.globalData);e[t]=i,i.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;)this.pendingElements.pop().checkParenting()},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"},CVContextData.prototype.duplicate=function(){var t=2*this._length,e=0;for(e=this._length;e<t;e+=1)this.stack[e]=new CanvasContext;this._length=t},CVContextData.prototype.reset=function(){this.cArrPos=0,this.cTr.reset(),this.stack[this.cArrPos].opacity=1},CVContextData.prototype.restore=function(t){this.cArrPos-=1;var e,i=this.stack[this.cArrPos],r=i.transform,n=this.cTr.props;for(e=0;e<16;e+=1)n[e]=r[e];if(t){this.nativeContext.restore();var a=this.stack[this.cArrPos+1];this.appliedFillStyle=a.fillStyle,this.appliedStrokeStyle=a.strokeStyle,this.appliedLineWidth=a.lineWidth,this.appliedLineCap=a.lineCap,this.appliedLineJoin=a.lineJoin,this.appliedMiterLimit=a.miterLimit}this.nativeContext.setTransform(r[0],r[1],r[4],r[5],r[12],r[13]),(t||-1!==i.opacity&&this.currentOpacity!==i.opacity)&&(this.nativeContext.globalAlpha=i.opacity,this.currentOpacity=i.opacity),this.currentFillStyle=i.fillStyle,this.currentStrokeStyle=i.strokeStyle,this.currentLineWidth=i.lineWidth,this.currentLineCap=i.lineCap,this.currentLineJoin=i.lineJoin,this.currentMiterLimit=i.miterLimit},CVContextData.prototype.save=function(t){t&&this.nativeContext.save();var e=this.cTr.props;this._length<=this.cArrPos&&this.duplicate();var i,r=this.stack[this.cArrPos];for(i=0;i<16;i+=1)r.transform[i]=e[i];this.cArrPos+=1;var n=this.stack[this.cArrPos];n.opacity=r.opacity,n.fillStyle=r.fillStyle,n.strokeStyle=r.strokeStyle,n.lineWidth=r.lineWidth,n.lineCap=r.lineCap,n.lineJoin=r.lineJoin,n.miterLimit=r.miterLimit},CVContextData.prototype.setOpacity=function(t){this.stack[this.cArrPos].opacity=t},CVContextData.prototype.setContext=function(t){this.nativeContext=t},CVContextData.prototype.fillStyle=function(t){this.stack[this.cArrPos].fillStyle!==t&&(this.currentFillStyle=t,this.stack[this.cArrPos].fillStyle=t)},CVContextData.prototype.strokeStyle=function(t){this.stack[this.cArrPos].strokeStyle!==t&&(this.currentStrokeStyle=t,this.stack[this.cArrPos].strokeStyle=t)},CVContextData.prototype.lineWidth=function(t){this.stack[this.cArrPos].lineWidth!==t&&(this.currentLineWidth=t,this.stack[this.cArrPos].lineWidth=t)},CVContextData.prototype.lineCap=function(t){this.stack[this.cArrPos].lineCap!==t&&(this.currentLineCap=t,this.stack[this.cArrPos].lineCap=t)},CVContextData.prototype.lineJoin=function(t){this.stack[this.cArrPos].lineJoin!==t&&(this.currentLineJoin=t,this.stack[this.cArrPos].lineJoin=t)},CVContextData.prototype.miterLimit=function(t){this.stack[this.cArrPos].miterLimit!==t&&(this.currentMiterLimit=t,this.stack[this.cArrPos].miterLimit=t)},CVContextData.prototype.transform=function(t){this.transformMat.cloneFromProps(t);var e=this.cTr;this.transformMat.multiply(e),e.cloneFromProps(this.transformMat.props);var i=e.props;this.nativeContext.setTransform(i[0],i[1],i[4],i[5],i[12],i[13])},CVContextData.prototype.opacity=function(t){var e=this.stack[this.cArrPos].opacity;e*=t<0?0:t,this.stack[this.cArrPos].opacity!==e&&(this.currentOpacity!==t&&(this.nativeContext.globalAlpha=t,this.currentOpacity=t),this.stack[this.cArrPos].opacity=e)},CVContextData.prototype.fill=function(t){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fill(t)},CVContextData.prototype.fillRect=function(t,e,i,r){this.appliedFillStyle!==this.currentFillStyle&&(this.appliedFillStyle=this.currentFillStyle,this.nativeContext.fillStyle=this.appliedFillStyle),this.nativeContext.fillRect(t,e,i,r)},CVContextData.prototype.stroke=function(){this.appliedStrokeStyle!==this.currentStrokeStyle&&(this.appliedStrokeStyle=this.currentStrokeStyle,this.nativeContext.strokeStyle=this.appliedStrokeStyle),this.appliedLineWidth!==this.currentLineWidth&&(this.appliedLineWidth=this.currentLineWidth,this.nativeContext.lineWidth=this.appliedLineWidth),this.appliedLineCap!==this.currentLineCap&&(this.appliedLineCap=this.currentLineCap,this.nativeContext.lineCap=this.appliedLineCap),this.appliedLineJoin!==this.currentLineJoin&&(this.appliedLineJoin=this.currentLineJoin,this.nativeContext.lineJoin=this.appliedLineJoin),this.appliedMiterLimit!==this.currentMiterLimit&&(this.appliedMiterLimit=this.currentMiterLimit,this.nativeContext.miterLimit=this.appliedMiterLimit),this.nativeContext.stroke()},extendPrototype([CanvasRendererBase,ICompElement,CVBaseElement],CVCompElement),CVCompElement.prototype.renderInnerContent=function(){var t,e=this.canvasContext;for(e.beginPath(),e.moveTo(0,0),e.lineTo(this.data.w,0),e.lineTo(this.data.w,this.data.h),e.lineTo(0,this.data.h),e.lineTo(0,0),e.clip(),t=this.layers.length-1;t>=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},CVCompElement.prototype.destroy=function(){var t;for(t=this.layers.length-1;t>=0;t-=1)this.elements[t]&&this.elements[t].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)},extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)},HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),0!==this.data.bm&&this.setBlendMode()},renderElement:function(){var t=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var e=this.finalTransform.mat.toCSS();t.transform=e,t.webkitTransform=e}this.finalTransform._opMdf&&(t.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting,extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var t;this.data.hasMask?((t=createNS("rect")).setAttribute("width",this.data.sw),t.setAttribute("height",this.data.sh),t.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):((t=createTag("div")).style.width=this.data.sw+"px",t.style.height=this.data.sh+"px",t.style.backgroundColor=this.data.sc),this.layerElement.appendChild(t)},extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var t;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),t=this.svgElement;else{t=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;t.setAttribute("width",e.w),t.setAttribute("height",e.h),t.appendChild(this.shapesContainer),this.layerElement.appendChild(t)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=t},HShapeElement.prototype.getTransformedPoint=function(t,e){var i,r=t.length;for(i=0;i<r;i+=1)e=t[i].mProps.v.applyToPointArray(e[0],e[1],0);return e},HShapeElement.prototype.calculateShapeBoundingBox=function(t,e){var i,r,n,a,s,o=t.sh.v,l=t.transformers,h=o._length;if(!(h<=1)){for(i=0;i<h-1;i+=1)r=this.getTransformedPoint(l,o.v[i]),n=this.getTransformedPoint(l,o.o[i]),a=this.getTransformedPoint(l,o.i[i+1]),s=this.getTransformedPoint(l,o.v[i+1]),this.checkBounds(r,n,a,s,e);o.c&&(r=this.getTransformedPoint(l,o.v[i]),n=this.getTransformedPoint(l,o.o[i]),a=this.getTransformedPoint(l,o.i[0]),s=this.getTransformedPoint(l,o.v[0]),this.checkBounds(r,n,a,s,e))}},HShapeElement.prototype.checkBounds=function(t,e,i,r,n){this.getBoundsOfCurve(t,e,i,r);var a=this.shapeBoundingBox;n.x=bmMin(a.left,n.x),n.xMax=bmMax(a.right,n.xMax),n.y=bmMin(a.top,n.y),n.yMax=bmMax(a.bottom,n.yMax)},HShapeElement.prototype.shapeBoundingBox={left:0,right:0,top:0,bottom:0},HShapeElement.prototype.tempBoundingBox={x:0,xMax:0,y:0,yMax:0,width:0,height:0},HShapeElement.prototype.getBoundsOfCurve=function(t,e,i,r){for(var n,a,s,o,l,h,c,u=[[t[0],r[0]],[t[1],r[1]]],d=0;d<2;++d)a=6*t[d]-12*e[d]+6*i[d],n=-3*t[d]+9*e[d]-9*i[d]+3*r[d],s=3*e[d]-3*t[d],a|=0,s|=0,0==(n|=0)&&0===a||(0===n?(o=-s/a)>0&&o<1&&u[d].push(this.calculateF(o,t,e,i,r,d)):(l=a*a-4*s*n)>=0&&((h=(-a+bmSqrt(l))/(2*n))>0&&h<1&&u[d].push(this.calculateF(h,t,e,i,r,d)),(c=(-a-bmSqrt(l))/(2*n))>0&&c<1&&u[d].push(this.calculateF(c,t,e,i,r,d))));this.shapeBoundingBox.left=bmMin.apply(null,u[0]),this.shapeBoundingBox.top=bmMin.apply(null,u[1]),this.shapeBoundingBox.right=bmMax.apply(null,u[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,u[1])},HShapeElement.prototype.calculateF=function(t,e,i,r,n,a){return bmPow(1-t,3)*e[a]+3*bmPow(1-t,2)*t*i[a]+3*(1-t)*bmPow(t,2)*r[a]+bmPow(t,3)*n[a]},HShapeElement.prototype.calculateBoundingBox=function(t,e){var i,r=t.length;for(i=0;i<r;i+=1)t[i]&&t[i].sh?this.calculateShapeBoundingBox(t[i],e):t[i]&&t[i].it?this.calculateBoundingBox(t[i].it,e):t[i]&&t[i].style&&t[i].w&&this.expandStrokeBoundingBox(t[i].w,e)},HShapeElement.prototype.expandStrokeBoundingBox=function(t,e){var i=0;if(t.keyframes){for(var r=0;r<t.keyframes.length;r+=1){var n=t.keyframes[r].s;n>i&&(i=n)}i*=t.mult}else i=t.v*t.mult;e.x-=i,e.xMax+=i,e.y-=i,e.yMax+=i},HShapeElement.prototype.currentBoxContains=function(t){return this.currentBBox.x<=t.x&&this.currentBBox.y<=t.y&&this.currentBBox.width+this.currentBBox.x>=t.x+t.width&&this.currentBBox.height+this.currentBBox.y>=t.y+t.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var t=this.tempBoundingBox,e=999999;if(t.x=e,t.xMax=-e,t.y=e,t.yMax=-e,this.calculateBoundingBox(this.itemsData,t),t.width=t.xMax<t.x?0:t.xMax-t.x,t.height=t.yMax<t.y?0:t.yMax-t.y,this.currentBoxContains(t))return;var i=!1;if(this.currentBBox.w!==t.width&&(this.currentBBox.w=t.width,this.shapeCont.setAttribute("width",t.width),i=!0),this.currentBBox.h!==t.height&&(this.currentBBox.h=t.height,this.shapeCont.setAttribute("height",t.height),i=!0),i||this.currentBBox.x!==t.x||this.currentBBox.y!==t.y){this.currentBBox.w=t.width,this.currentBBox.h=t.height,this.currentBBox.x=t.x,this.currentBBox.y=t.y,this.shapeCont.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h);var r=this.shapeCont.style,n="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";r.transform=n,r.webkitTransform=n}}},extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement],HTextElement),HTextElement.prototype.createContent=function(){if(this.isMasked=this.checkMasks(),this.isMasked){this.renderType="svg",this.compW=this.comp.data.w,this.compH=this.comp.data.h,this.svgElement.setAttribute("width",this.compW),this.svgElement.setAttribute("height",this.compH);var t=createNS("g");this.maskedElement.appendChild(t),this.innerElem=t}else this.renderType="html",this.innerElem=this.layerElement;this.checkParenting()},HTextElement.prototype.buildNewText=function(){var t=this.textProperty.currentData;this.renderedLetters=createSizedArray(t.l?t.l.length:0);var e=this.innerElem.style,i=t.fc?this.buildColor(t.fc):"rgba(0,0,0,0)";e.fill=i,e.color=i,t.sc&&(e.stroke=this.buildColor(t.sc),e.strokeWidth=t.sw+"px");var r,n,a=this.globalData.fontManager.getFontByName(t.f);if(!this.globalData.fontManager.chars)if(e.fontSize=t.finalSize+"px",e.lineHeight=t.finalSize+"px",a.fClass)this.innerElem.className=a.fClass;else{e.fontFamily=a.fFamily;var s=t.fWeight,o=t.fStyle;e.fontStyle=o,e.fontWeight=s}var l,h,c,u=t.l;n=u.length;var d,p=this.mHelper,f="",m=0;for(r=0;r<n;r+=1){if(this.globalData.fontManager.chars?(this.textPaths[m]?l=this.textPaths[m]:((l=createNS("path")).setAttribute("stroke-linecap",lineCapEnum[1]),l.setAttribute("stroke-linejoin",lineJoinEnum[2]),l.setAttribute("stroke-miterlimit","4")),this.isMasked||(this.textSpans[m]?c=(h=this.textSpans[m]).children[0]:((h=createTag("div")).style.lineHeight=0,(c=createNS("svg")).appendChild(l),styleDiv(h)))):this.isMasked?l=this.textPaths[m]?this.textPaths[m]:createNS("text"):this.textSpans[m]?(h=this.textSpans[m],l=this.textPaths[m]):(styleDiv(h=createTag("span")),styleDiv(l=createTag("span")),h.appendChild(l)),this.globalData.fontManager.chars){var g,y=this.globalData.fontManager.getCharData(t.finalText[r],a.fStyle,this.globalData.fontManager.getFontByName(t.f).fFamily);if(g=y?y.data:null,p.reset(),g&&g.shapes&&g.shapes.length&&(d=g.shapes[0].it,p.scale(t.finalSize/100,t.finalSize/100),f=this.createPathShape(p,d),l.setAttribute("d",f)),this.isMasked)this.innerElem.appendChild(l);else{if(this.innerElem.appendChild(h),g&&g.shapes){document.body.appendChild(c);var v=c.getBBox();c.setAttribute("width",v.width+2),c.setAttribute("height",v.height+2),c.setAttribute("viewBox",v.x-1+" "+(v.y-1)+" "+(v.width+2)+" "+(v.height+2));var b=c.style,x="translate("+(v.x-1)+"px,"+(v.y-1)+"px)";b.transform=x,b.webkitTransform=x,u[r].yOffset=v.y-1}else c.setAttribute("width",1),c.setAttribute("height",1);h.appendChild(c)}}else if(l.textContent=u[r].val,l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),this.isMasked)this.innerElem.appendChild(l);else{this.innerElem.appendChild(h);var C=l.style,_="translate3d(0,"+-t.finalSize/1.2+"px,0)";C.transform=_,C.webkitTransform=_}this.isMasked?this.textSpans[m]=l:this.textSpans[m]=h,this.textSpans[m].style.display="block",this.textPaths[m]=l,m+=1}for(;m<this.textSpans.length;)this.textSpans[m].style.display="none",m+=1},HTextElement.prototype.renderInnerContent=function(){var t;if(this.validateText(),this.data.singleShape){if(!this._isFirstFrame&&!this.lettersChangedFlag)return;if(this.isMasked&&this.finalTransform._matMdf){this.svgElement.setAttribute("viewBox",-this.finalTransform.mProp.p.v[0]+" "+-this.finalTransform.mProp.p.v[1]+" "+this.compW+" "+this.compH),t=this.svgElement.style;var e="translate("+-this.finalTransform.mProp.p.v[0]+"px,"+-this.finalTransform.mProp.p.v[1]+"px)";t.transform=e,t.webkitTransform=e}}if(this.textAnimator.getMeasures(this.textProperty.currentData,this.lettersChangedFlag),this.lettersChangedFlag||this.textAnimator.lettersChangedFlag){var i,r,n,a,s,o=0,l=this.textAnimator.renderedLetters,h=this.textProperty.currentData.l;for(r=h.length,i=0;i<r;i+=1)h[i].n?o+=1:(a=this.textSpans[i],s=this.textPaths[i],n=l[o],o+=1,n._mdf.m&&(this.isMasked?a.setAttribute("transform",n.m):(a.style.webkitTransform=n.m,a.style.transform=n.m)),a.style.opacity=n.o,n.sw&&n._mdf.sw&&s.setAttribute("stroke-width",n.sw),n.sc&&n._mdf.sc&&s.setAttribute("stroke",n.sc),n.fc&&n._mdf.fc&&(s.setAttribute("fill",n.fc),s.style.color=n.fc));if(this.innerElem.getBBox&&!this.hidden&&(this._isFirstFrame||this._mdf)){var c=this.innerElem.getBBox();if(this.currentBBox.w!==c.width&&(this.currentBBox.w=c.width,this.svgElement.setAttribute("width",c.width)),this.currentBBox.h!==c.height&&(this.currentBBox.h=c.height,this.svgElement.setAttribute("height",c.height)),this.currentBBox.w!==c.width+2||this.currentBBox.h!==c.height+2||this.currentBBox.x!==c.x-1||this.currentBBox.y!==c.y-1){this.currentBBox.w=c.width+2,this.currentBBox.h=c.height+2,this.currentBBox.x=c.x-1,this.currentBBox.y=c.y-1,this.svgElement.setAttribute("viewBox",this.currentBBox.x+" "+this.currentBBox.y+" "+this.currentBBox.w+" "+this.currentBBox.h),t=this.svgElement.style;var u="translate("+this.currentBBox.x+"px,"+this.currentBBox.y+"px)";t.transform=u,t.webkitTransform=u}}}},extendPrototype([BaseElement,FrameElement,HierarchyElement],HCameraElement),HCameraElement.prototype.setup=function(){var t,e,i,r,n=this.comp.threeDElements.length;for(t=0;t<n;t+=1)if("3d"===(e=this.comp.threeDElements[t]).type){i=e.perspectiveElem.style,r=e.container.style;var a=this.pe.v+"px",s="0px 0px 0px",o="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";i.perspective=a,i.webkitPerspective=a,r.transformOrigin=s,r.mozTransformOrigin=s,r.webkitTransformOrigin=s,i.transform=o,i.webkitTransform=o}},HCameraElement.prototype.createElements=function(){},HCameraElement.prototype.hide=function(){},HCameraElement.prototype.renderFrame=function(){var t,e,i=this._isFirstFrame;if(this.hierarchy)for(e=this.hierarchy.length,t=0;t<e;t+=1)i=this.hierarchy[t].finalTransform.mProp._mdf||i;if(i||this.pe._mdf||this.p&&this.p._mdf||this.px&&(this.px._mdf||this.py._mdf||this.pz._mdf)||this.rx._mdf||this.ry._mdf||this.rz._mdf||this.or._mdf||this.a&&this.a._mdf){if(this.mat.reset(),this.hierarchy)for(t=e=this.hierarchy.length-1;t>=0;t-=1){var r=this.hierarchy[t].finalTransform.mProp;this.mat.translate(-r.p.v[0],-r.p.v[1],r.p.v[2]),this.mat.rotateX(-r.or.v[0]).rotateY(-r.or.v[1]).rotateZ(r.or.v[2]),this.mat.rotateX(-r.rx.v).rotateY(-r.ry.v).rotateZ(r.rz.v),this.mat.scale(1/r.s.v[0],1/r.s.v[1],1/r.s.v[2]),this.mat.translate(r.a.v[0],r.a.v[1],r.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var n;n=this.p?[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var a=Math.sqrt(Math.pow(n[0],2)+Math.pow(n[1],2)+Math.pow(n[2],2)),s=[n[0]/a,n[1]/a,n[2]/a],o=Math.sqrt(s[2]*s[2]+s[0]*s[0]),l=Math.atan2(s[1],o),h=Math.atan2(s[0],-s[2]);this.mat.rotateY(h).rotateX(-l)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var c=!this._prevMat.equals(this.mat);if((c||this.pe._mdf)&&this.comp.threeDElements){var u,d,p;for(e=this.comp.threeDElements.length,t=0;t<e;t+=1)if("3d"===(u=this.comp.threeDElements[t]).type){if(c){var f=this.mat.toCSS();(p=u.container.style).transform=f,p.webkitTransform=f}this.pe._mdf&&((d=u.perspectiveElem.style).perspective=this.pe.v+"px",d.webkitPerspective=this.pe.v+"px")}this.mat.clone(this._prevMat)}}this._isFirstFrame=!1},HCameraElement.prototype.prepareFrame=function(t){this.prepareProperties(t,!0)},HCameraElement.prototype.destroy=function(){},HCameraElement.prototype.getBaseElement=function(){return null},extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement],HImageElement),HImageElement.prototype.createContent=function(){var t=this.globalData.getAssetsPath(this.assetData),e=new Image;this.data.hasMask?(this.imageElem=createNS("image"),this.imageElem.setAttribute("width",this.assetData.w+"px"),this.imageElem.setAttribute("height",this.assetData.h+"px"),this.imageElem.setAttributeNS("http://www.w3.org/1999/xlink","href",t),this.layerElement.appendChild(this.imageElem),this.baseElement.setAttribute("width",this.assetData.w),this.baseElement.setAttribute("height",this.assetData.h)):this.layerElement.appendChild(e),e.crossOrigin="anonymous",e.src=t,this.data.ln&&this.baseElement.setAttribute("id",this.data.ln)},extendPrototype([BaseRenderer],HybridRendererBase),HybridRendererBase.prototype.buildItem=SVGRenderer.prototype.buildItem,HybridRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;)this.pendingElements.pop().checkParenting()},HybridRendererBase.prototype.appendElementInPos=function(t,e){var i=t.getBaseElement();if(i){var r=this.layers[e];if(r.ddd&&this.supports3d)this.addTo3dContainer(i,e);else if(this.threeDElements)this.addTo3dContainer(i,e);else{for(var n,a,s=0;s<e;)this.elements[s]&&!0!==this.elements[s]&&this.elements[s].getBaseElement&&(a=this.elements[s],n=(this.layers[s].ddd?this.getThreeDContainerByPos(s):a.getBaseElement())||n),s+=1;n?r.ddd&&this.supports3d||this.layerElement.insertBefore(i,n):r.ddd&&this.supports3d||this.layerElement.appendChild(i)}}},HybridRendererBase.prototype.createShape=function(t){return this.supports3d?new HShapeElement(t,this.globalData,this):new SVGShapeElement(t,this.globalData,this)},HybridRendererBase.prototype.createText=function(t){return this.supports3d?new HTextElement(t,this.globalData,this):new SVGTextLottieElement(t,this.globalData,this)},HybridRendererBase.prototype.createCamera=function(t){return this.camera=new HCameraElement(t,this.globalData,this),this.camera},HybridRendererBase.prototype.createImage=function(t){return this.supports3d?new HImageElement(t,this.globalData,this):new IImageElement(t,this.globalData,this)},HybridRendererBase.prototype.createSolid=function(t){return this.supports3d?new HSolidElement(t,this.globalData,this):new ISolidElement(t,this.globalData,this)},HybridRendererBase.prototype.createNull=SVGRenderer.prototype.createNull,HybridRendererBase.prototype.getThreeDContainerByPos=function(t){for(var e=0,i=this.threeDElements.length;e<i;){if(this.threeDElements[e].startPos<=t&&this.threeDElements[e].endPos>=t)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(t,e){var i,r,n=createTag("div");styleDiv(n);var a=createTag("div");if(styleDiv(a),"3d"===e){(i=n.style).width=this.globalData.compSize.w+"px",i.height=this.globalData.compSize.h+"px";var s="50% 50%";i.webkitTransformOrigin=s,i.mozTransformOrigin=s,i.transformOrigin=s;var o="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";(r=a.style).transform=o,r.webkitTransform=o}n.appendChild(a);var l={container:a,perspectiveElem:n,startPos:t,endPos:t,type:e};return this.threeDElements.push(l),l},HybridRendererBase.prototype.build3dContainers=function(){var t,e,i=this.layers.length,r="";for(t=0;t<i;t+=1)this.layers[t].ddd&&3!==this.layers[t].ty?("3d"!==r&&(r="3d",e=this.createThreeDContainer(t,"3d")),e.endPos=Math.max(e.endPos,t)):("2d"!==r&&(r="2d",e=this.createThreeDContainer(t,"2d")),e.endPos=Math.max(e.endPos,t));for(t=(i=this.threeDElements.length)-1;t>=0;t-=1)this.resizerElem.appendChild(this.threeDElements[t].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(t,e){for(var i=0,r=this.threeDElements.length;i<r;){if(e<=this.threeDElements[i].endPos){for(var n,a=this.threeDElements[i].startPos;a<e;)this.elements[a]&&this.elements[a].getBaseElement&&(n=this.elements[a].getBaseElement()),a+=1;n?this.threeDElements[i].container.insertBefore(t,n):this.threeDElements[i].container.appendChild(t);break}i+=1}},HybridRendererBase.prototype.configAnimation=function(t){var e=createTag("div"),i=this.animationItem.wrapper,r=e.style;r.width=t.w+"px",r.height=t.h+"px",this.resizerElem=e,styleDiv(e),r.transformStyle="flat",r.mozTransformStyle="flat",r.webkitTransformStyle="flat",this.renderConfig.className&&e.setAttribute("class",this.renderConfig.className),i.appendChild(e),r.overflow="hidden";var n=createNS("svg");n.setAttribute("width","1"),n.setAttribute("height","1"),styleDiv(n),this.resizerElem.appendChild(n);var a=createNS("defs");n.appendChild(a),this.data=t,this.setupGlobalData(t,n),this.globalData.defs=a,this.layers=t.layers,this.layerElement=this.resizerElem,this.build3dContainers(),this.updateContainerSize()},HybridRendererBase.prototype.destroy=function(){var t;this.animationItem.wrapper&&(this.animationItem.wrapper.innerText=""),this.animationItem.container=null,this.globalData.defs=null;var e=this.layers?this.layers.length:0;for(t=0;t<e;t+=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.destroyed=!0,this.animationItem=null},HybridRendererBase.prototype.updateContainerSize=function(){var t,e,i,r,n=this.animationItem.wrapper.offsetWidth,a=this.animationItem.wrapper.offsetHeight,s=n/a;this.globalData.compSize.w/this.globalData.compSize.h>s?(t=n/this.globalData.compSize.w,e=n/this.globalData.compSize.w,i=0,r=(a-this.globalData.compSize.h*(n/this.globalData.compSize.w))/2):(t=a/this.globalData.compSize.h,e=a/this.globalData.compSize.h,i=(n-this.globalData.compSize.w*(a/this.globalData.compSize.h))/2,r=0);var o=this.resizerElem.style;o.webkitTransform="matrix3d("+t+",0,0,0,0,"+e+",0,0,0,0,1,0,"+i+","+r+",0,1)",o.transform=o.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var t,e=this.globalData.compSize.w,i=this.globalData.compSize.h,r=this.threeDElements.length;for(t=0;t<r;t+=1){var n=this.threeDElements[t].perspectiveElem.style;n.webkitPerspective=Math.sqrt(Math.pow(e,2)+Math.pow(i,2))+"px",n.perspective=n.webkitPerspective}}},HybridRendererBase.prototype.searchExtraCompositions=function(t){var e,i=t.length,r=createTag("div");for(e=0;e<i;e+=1)if(t[e].xt){var n=this.createComp(t[e],r,this.globalData.comp,null);n.initExpressions(),this.globalData.projectInterface.registerComposition(n)}},extendPrototype([HybridRendererBase,ICompElement,HBaseElement],HCompElement),HCompElement.prototype._createBaseContainerElements=HCompElement.prototype.createContainerElements,HCompElement.prototype.createContainerElements=function(){this._createBaseContainerElements(),this.data.hasMask?(this.svgElement.setAttribute("width",this.data.w),this.svgElement.setAttribute("height",this.data.h),this.transformedElement=this.baseElement):this.transformedElement=this.layerElement},HCompElement.prototype.addTo3dContainer=function(t,e){for(var i,r=0;r<e;)this.elements[r]&&this.elements[r].getBaseElement&&(i=this.elements[r].getBaseElement()),r+=1;i?this.layerElement.insertBefore(t,i):this.layerElement.appendChild(t)},HCompElement.prototype.createComp=function(t){return this.supports3d?new HCompElement(t,this.globalData,this):new SVGCompElement(t,this.globalData,this)},extendPrototype([HybridRendererBase],HybridRenderer),HybridRenderer.prototype.createComp=function(t){return this.supports3d?new HCompElement(t,this.globalData,this):new SVGCompElement(t,this.globalData,this)};var CompExpressionInterface=function(t){function e(e){for(var i=0,r=t.layers.length;i<r;){if(t.layers[i].nm===e||t.layers[i].ind===e)return t.elements[i].layerInterface;i+=1}return null}return Object.defineProperty(e,"_name",{value:t.data.nm}),e.layer=e,e.pixelAspect=1,e.height=t.data.h||t.globalData.compSize.h,e.width=t.data.w||t.globalData.compSize.w,e.pixelAspect=1,e.frameDuration=1/t.globalData.frameRate,e.displayStartTime=0,e.numLayers=t.layers.length,e};function _typeof$2(t){return _typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$2(t)}function seedRandom(t,e){var i=this,r=256,n="random",a=e.pow(r,6),s=e.pow(2,52),o=2*s,l=r-1;function h(t){var e,i=t.length,n=this,a=0,s=n.i=n.j=0,o=n.S=[];for(i||(t=[i++]);a<r;)o[a]=a++;for(a=0;a<r;a++)o[a]=o[s=l&s+t[a%i]+(e=o[a])],o[s]=e;n.g=function(t){for(var e,i=0,a=n.i,s=n.j,o=n.S;t--;)e=o[a=l&a+1],i=i*r+o[l&(o[a]=o[s=l&s+e])+(o[s]=e)];return n.i=a,n.j=s,i}}function c(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function u(t,e){var i,r=[],n=_typeof$2(t);if(e&&"object"==n)for(i in t)try{r.push(u(t[i],e-1))}catch(t){}return r.length?r:"string"==n?t:t+"\0"}function d(t,e){for(var i,r=t+"",n=0;n<r.length;)e[l&n]=l&(i^=19*e[l&n])+r.charCodeAt(n++);return p(e)}function p(t){return String.fromCharCode.apply(0,t)}e["seed"+n]=function(l,f,m){var g=[],y=d(u((f=!0===f?{entropy:!0}:f||{}).entropy?[l,p(t)]:null===l?function(){try{var e=new Uint8Array(r);return(i.crypto||i.msCrypto).getRandomValues(e),p(e)}catch(e){var n=i.navigator,a=n&&n.plugins;return[+new Date,i,a,i.screen,p(t)]}}():l,3),g),v=new h(g),b=function(){for(var t=v.g(6),e=a,i=0;t<s;)t=(t+i)*r,e*=r,i=v.g(1);for(;t>=o;)t/=2,e/=2,i>>>=1;return(t+i)/e};return b.int32=function(){return 0|v.g(4)},b.quick=function(){return v.g(4)/4294967296},b.double=b,d(p(v.S),t),(f.pass||m||function(t,i,r,a){return a&&(a.S&&c(a,v),t.state=function(){return c(v,{})}),r?(e[n]=t,i):t})(b,y,"global"in f?f.global:this==e,f.state)},d(e.random(),t)}function initialize$2(t){seedRandom([],t)}var propTypes={SHAPE:"shape"};function _typeof$1(t){return _typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof$1(t)}var ExpressionManager=function(){var ob={},Math=BMMath,window=null,document=null,XMLHttpRequest=null,fetch=null,frames=null,_lottieGlobal={};function resetFrame(){_lottieGlobal={}}function $bm_isInstanceOfArray(t){return t.constructor===Array||t.constructor===Float32Array}function isNumerable(t,e){return"number"===t||e instanceof Number||"boolean"===t||"string"===t}function $bm_neg(t){var e=_typeof$1(t);if("number"===e||t instanceof Number||"boolean"===e)return-t;if($bm_isInstanceOfArray(t)){var i,r=t.length,n=[];for(i=0;i<r;i+=1)n[i]=-t[i];return n}return t.propType?t.v:-t}initialize$2(BMMath);var easeInBez=BezierFactory.getBezierEasing(.333,0,.833,.833,"easeIn").get,easeOutBez=BezierFactory.getBezierEasing(.167,.167,.667,1,"easeOut").get,easeInOutBez=BezierFactory.getBezierEasing(.33,0,.667,1,"easeInOut").get;function sum(t,e){var i=_typeof$1(t),r=_typeof$1(e);if(isNumerable(i,t)&&isNumerable(r,e)||"string"===i||"string"===r)return t+e;if($bm_isInstanceOfArray(t)&&isNumerable(r,e))return(t=t.slice(0))[0]+=e,t;if(isNumerable(i,t)&&$bm_isInstanceOfArray(e))return(e=e.slice(0))[0]=t+e[0],e;if($bm_isInstanceOfArray(t)&&$bm_isInstanceOfArray(e)){for(var n=0,a=t.length,s=e.length,o=[];n<a||n<s;)("number"==typeof t[n]||t[n]instanceof Number)&&("number"==typeof e[n]||e[n]instanceof Number)?o[n]=t[n]+e[n]:o[n]=void 0===e[n]?t[n]:t[n]||e[n],n+=1;return o}return 0}var add=sum;function sub(t,e){var i=_typeof$1(t),r=_typeof$1(e);if(isNumerable(i,t)&&isNumerable(r,e))return"string"===i&&(t=parseInt(t,10)),"string"===r&&(e=parseInt(e,10)),t-e;if($bm_isInstanceOfArray(t)&&isNumerable(r,e))return(t=t.slice(0))[0]-=e,t;if(isNumerable(i,t)&&$bm_isInstanceOfArray(e))return(e=e.slice(0))[0]=t-e[0],e;if($bm_isInstanceOfArray(t)&&$bm_isInstanceOfArray(e)){for(var n=0,a=t.length,s=e.length,o=[];n<a||n<s;)("number"==typeof t[n]||t[n]instanceof Number)&&("number"==typeof e[n]||e[n]instanceof Number)?o[n]=t[n]-e[n]:o[n]=void 0===e[n]?t[n]:t[n]||e[n],n+=1;return o}return 0}function mul(t,e){var i,r,n,a=_typeof$1(t),s=_typeof$1(e);if(isNumerable(a,t)&&isNumerable(s,e))return t*e;if($bm_isInstanceOfArray(t)&&isNumerable(s,e)){for(n=t.length,i=createTypedArray("float32",n),r=0;r<n;r+=1)i[r]=t[r]*e;return i}if(isNumerable(a,t)&&$bm_isInstanceOfArray(e)){for(n=e.length,i=createTypedArray("float32",n),r=0;r<n;r+=1)i[r]=t*e[r];return i}return 0}function div(t,e){var i,r,n,a=_typeof$1(t),s=_typeof$1(e);if(isNumerable(a,t)&&isNumerable(s,e))return t/e;if($bm_isInstanceOfArray(t)&&isNumerable(s,e)){for(n=t.length,i=createTypedArray("float32",n),r=0;r<n;r+=1)i[r]=t[r]/e;return i}if(isNumerable(a,t)&&$bm_isInstanceOfArray(e)){for(n=e.length,i=createTypedArray("float32",n),r=0;r<n;r+=1)i[r]=t/e[r];return i}return 0}function mod(t,e){return"string"==typeof t&&(t=parseInt(t,10)),"string"==typeof e&&(e=parseInt(e,10)),t%e}var $bm_sum=sum,$bm_sub=sub,$bm_mul=mul,$bm_div=div,$bm_mod=mod;function clamp(t,e,i){if(e>i){var r=i;i=e,e=r}return Math.min(Math.max(t,e),i)}function radiansToDegrees(t){return t/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(t){return t*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(t,e){if("number"==typeof t||t instanceof Number)return e=e||0,Math.abs(t-e);var i;e||(e=helperLengthArray);var r=Math.min(t.length,e.length),n=0;for(i=0;i<r;i+=1)n+=Math.pow(e[i]-t[i],2);return Math.sqrt(n)}function normalize(t){return div(t,length(t))}function rgbToHsl(t){var e,i,r=t[0],n=t[1],a=t[2],s=Math.max(r,n,a),o=Math.min(r,n,a),l=(s+o)/2;if(s===o)e=0,i=0;else{var h=s-o;switch(i=l>.5?h/(2-s-o):h/(s+o),s){case r:e=(n-a)/h+(n<a?6:0);break;case n:e=(a-r)/h+2;break;case a:e=(r-n)/h+4}e/=6}return[e,i,l,t[3]]}function hue2rgb(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function hslToRgb(t){var e,i,r,n=t[0],a=t[1],s=t[2];if(0===a)e=s,r=s,i=s;else{var o=s<.5?s*(1+a):s+a-s*a,l=2*s-o;e=hue2rgb(l,o,n+1/3),i=hue2rgb(l,o,n),r=hue2rgb(l,o,n-1/3)}return[e,i,r,t[3]]}function linear(t,e,i,r,n){if(void 0!==r&&void 0!==n||(r=e,n=i,e=0,i=1),i<e){var a=i;i=e,e=a}if(t<=e)return r;if(t>=i)return n;var s,o=i===e?0:(t-e)/(i-e);if(!r.length)return r+(n-r)*o;var l=r.length,h=createTypedArray("float32",l);for(s=0;s<l;s+=1)h[s]=r[s]+(n[s]-r[s])*o;return h}function random(t,e){if(void 0===e&&(void 0===t?(t=0,e=1):(e=t,t=void 0)),e.length){var i,r=e.length;t||(t=createTypedArray("float32",r));var n=createTypedArray("float32",r),a=BMMath.random();for(i=0;i<r;i+=1)n[i]=t[i]+a*(e[i]-t[i]);return n}return void 0===t&&(t=0),t+BMMath.random()*(e-t)}function createPath(t,e,i,r){var n,a=t.length,s=shapePool.newElement();s.setPathData(!!r,a);var o,l,h=[0,0];for(n=0;n<a;n+=1)o=e&&e[n]?e[n]:h,l=i&&i[n]?i[n]:h,s.setTripleAt(t[n][0],t[n][1],l[0]+t[n][0],l[1]+t[n][1],o[0]+t[n][0],o[1]+t[n][1],n,!0);return s}function initiateExpression(elem,data,property){function noOp(t){return t}if(!elem.globalData.renderConfig.runExpressions)return noOp;var val=data.x,needsVelocity=/velocity(?![\w\d])/.test(val),_needsRandom=-1!==val.indexOf("random"),elemType=elem.data.ty,transform,$bm_transform,content,effect,thisProperty=property;thisProperty.valueAtTime=thisProperty.getValueAtTime,Object.defineProperty(thisProperty,"value",{get:function(){return thisProperty.v}}),elem.comp.frameDuration=1/elem.comp.globalData.frameRate,elem.comp.displayStartTime=0;var inPoint=elem.data.ip/elem.comp.globalData.frameRate,outPoint=elem.data.op/elem.comp.globalData.frameRate,width=elem.data.sw?elem.data.sw:0,height=elem.data.sh?elem.data.sh:0,name=elem.data.nm,loopIn,loop_in,loopOut,loop_out,smooth,toWorld,fromWorld,fromComp,toComp,fromCompToSurface,position,rotation,anchorPoint,scale,thisLayer,thisComp,mask,valueAtTime,velocityAtTime,scoped_bm_rt,expression_function=eval("[function _expression_function(){"+val+";scoped_bm_rt=$bm_rt}]")[0],numKeys=property.kf?data.k.length:0,active=!this.data||!0!==this.data.hd,wiggle=function(t,e){var i,r,n=this.pv.length?this.pv.length:1,a=createTypedArray("float32",n),s=Math.floor(5*time);for(i=0,r=0;i<s;){for(r=0;r<n;r+=1)a[r]+=-e+2*e*BMMath.random();i+=1}var o=5*time,l=o-Math.floor(o),h=createTypedArray("float32",n);if(n>1){for(r=0;r<n;r+=1)h[r]=this.pv[r]+a[r]+(-e+2*e*BMMath.random())*l;return h}return this.pv+a[0]+(-e+2*e*BMMath.random())*l}.bind(this);function loopInDuration(t,e){return loopIn(t,e,!0)}function loopOutDuration(t,e){return loopOut(t,e,!0)}thisProperty.loopIn&&(loopIn=thisProperty.loopIn.bind(thisProperty),loop_in=loopIn),thisProperty.loopOut&&(loopOut=thisProperty.loopOut.bind(thisProperty),loop_out=loopOut),thisProperty.smooth&&(smooth=thisProperty.smooth.bind(thisProperty)),this.getValueAtTime&&(valueAtTime=this.getValueAtTime.bind(this)),this.getVelocityAtTime&&(velocityAtTime=this.getVelocityAtTime.bind(this));var comp=elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface),time,velocity,value,text,textIndex,textTotal,selectorValue;function lookAt(t,e){var i=[e[0]-t[0],e[1]-t[1],e[2]-t[2]],r=Math.atan2(i[0],Math.sqrt(i[1]*i[1]+i[2]*i[2]))/degToRads;return[-Math.atan2(i[1],i[2])/degToRads,r,0]}function easeOut(t,e,i,r,n){return applyEase(easeOutBez,t,e,i,r,n)}function easeIn(t,e,i,r,n){return applyEase(easeInBez,t,e,i,r,n)}function ease(t,e,i,r,n){return applyEase(easeInOutBez,t,e,i,r,n)}function applyEase(t,e,i,r,n,a){void 0===n?(n=i,a=r):e=(e-i)/(r-i),e>1?e=1:e<0&&(e=0);var s=t(e);if($bm_isInstanceOfArray(n)){var o,l=n.length,h=createTypedArray("float32",l);for(o=0;o<l;o+=1)h[o]=(a[o]-n[o])*s+n[o];return h}return(a-n)*s+n}function nearestKey(t){var e,i,r,n=data.k.length;if(data.k.length&&"number"!=typeof data.k[0])if(i=-1,(t*=elem.comp.globalData.frameRate)<data.k[0].t)i=1,r=data.k[0].t;else{for(e=0;e<n-1;e+=1){if(t===data.k[e].t){i=e+1,r=data.k[e].t;break}if(t>data.k[e].t&&t<data.k[e+1].t){t-data.k[e].t>data.k[e+1].t-t?(i=e+2,r=data.k[e+1].t):(i=e+1,r=data.k[e].t);break}}-1===i&&(i=e+1,r=data.k[e].t)}else i=0,r=0;var a={};return a.index=i,a.time=r/elem.comp.globalData.frameRate,a}function key(t){var e,i,r;if(!data.k.length||"number"==typeof data.k[0])throw new Error("The property has no keyframe at index "+t);t-=1,e={time:data.k[t].t/elem.comp.globalData.frameRate,value:[]};var n=Object.prototype.hasOwnProperty.call(data.k[t],"s")?data.k[t].s:data.k[t-1].e;for(r=n.length,i=0;i<r;i+=1)e[i]=n[i],e.value[i]=n[i];return e}function framesToTime(t,e){return e||(e=elem.comp.globalData.frameRate),t/e}function timeToFrames(t,e){return t||0===t||(t=time),e||(e=elem.comp.globalData.frameRate),t*e}function seedRandom(t){BMMath.seedrandom(randSeed+t)}function sourceRectAtTime(){return elem.sourceRectAtTime()}function substring(t,e){return"string"==typeof value?void 0===e?value.substring(t):value.substring(t,e):""}function substr(t,e){return"string"==typeof value?void 0===e?value.substr(t):value.substr(t,e):""}function posterizeTime(t){time=0===t?0:Math.floor(time*t)/t,value=valueAtTime(time)}var index=elem.data.ind,hasParent=!(!elem.hierarchy||!elem.hierarchy.length),parent,randSeed=Math.floor(1e6*Math.random()),globalData=elem.globalData;function executeExpression(t){return value=t,this.frameExpressionId===elem.globalData.frameId&&"textSelector"!==this.propType?value:("textSelector"===this.propType&&(textIndex=this.textIndex,textTotal=this.textTotal,selectorValue=this.selectorValue),thisLayer||(text=elem.layerInterface.text,thisLayer=elem.layerInterface,thisComp=elem.comp.compInterface,toWorld=thisLayer.toWorld.bind(thisLayer),fromWorld=thisLayer.fromWorld.bind(thisLayer),fromComp=thisLayer.fromComp.bind(thisLayer),toComp=thisLayer.toComp.bind(thisLayer),mask=thisLayer.mask?thisLayer.mask.bind(thisLayer):null,fromCompToSurface=fromComp),transform||(transform=elem.layerInterface("ADBE Transform Group"),$bm_transform=transform,transform&&(anchorPoint=transform.anchorPoint)),4!==elemType||content||(content=thisLayer("ADBE Root Vectors Group")),effect||(effect=thisLayer(4)),(hasParent=!(!elem.hierarchy||!elem.hierarchy.length))&&!parent&&(parent=elem.hierarchy[0].layerInterface),time=this.comp.renderedFrame/this.comp.globalData.frameRate,_needsRandom&&seedRandom(randSeed+time),needsVelocity&&(velocity=velocityAtTime(time)),expression_function(),this.frameExpressionId=elem.globalData.frameId,scoped_bm_rt=scoped_bm_rt.propType===propTypes.SHAPE?scoped_bm_rt.v:scoped_bm_rt)}return executeExpression.__preventDeadCodeRemoval=[$bm_transform,anchorPoint,time,velocity,inPoint,outPoint,width,height,name,loop_in,loop_out,smooth,toComp,fromCompToSurface,toWorld,fromWorld,mask,position,rotation,scale,thisComp,numKeys,active,wiggle,loopInDuration,loopOutDuration,comp,lookAt,easeOut,easeIn,ease,nearestKey,key,text,textIndex,textTotal,selectorValue,framesToTime,timeToFrames,sourceRectAtTime,substring,substr,posterizeTime,index,globalData],executeExpression}return ob.initiateExpression=initiateExpression,ob.__preventDeadCodeRemoval=[window,document,XMLHttpRequest,fetch,frames,$bm_neg,add,$bm_sum,$bm_sub,$bm_mul,$bm_div,$bm_mod,clamp,radians_to_degrees,degreesToRadians,degrees_to_radians,normalize,rgbToHsl,hslToRgb,linear,random,createPath,_lottieGlobal],ob.resetFrame=resetFrame,ob}(),Expressions=function(){var t={initExpressions:function(t){var e=0,i=[];t.renderer.compInterface=CompExpressionInterface(t.renderer),t.renderer.globalData.projectInterface.registerComposition(t.renderer),t.renderer.globalData.pushExpression=function(){e+=1},t.renderer.globalData.popExpression=function(){0==(e-=1)&&function(){var t,e=i.length;for(t=0;t<e;t+=1)i[t].release();i.length=0}()},t.renderer.globalData.registerExpressionProperty=function(t){-1===i.indexOf(t)&&i.push(t)}}};return t.resetFrame=ExpressionManager.resetFrame,t}(),MaskManagerInterface=function(){function t(t,e){this._mask=t,this._data=e}return Object.defineProperty(t.prototype,"maskPath",{get:function(){return this._mask.prop.k&&this._mask.prop.getValue(),this._mask.prop}}),Object.defineProperty(t.prototype,"maskOpacity",{get:function(){return this._mask.op.k&&this._mask.op.getValue(),100*this._mask.op.v}}),function(e){var i,r=createSizedArray(e.viewData.length),n=e.viewData.length;for(i=0;i<n;i+=1)r[i]=new t(e.viewData[i],e.masksProperties[i]);return function(t){for(i=0;i<n;){if(e.masksProperties[i].nm===t)return r[i];i+=1}return null}}}(),ExpressionPropertyInterface=function(){var t={pv:0,v:0,mult:1},e={pv:[0,0,0],v:[0,0,0],mult:1};function i(t,e,i){Object.defineProperty(t,"velocity",{get:function(){return e.getVelocityAtTime(e.comp.currentFrame)}}),t.numKeys=e.keyframes?e.keyframes.length:0,t.key=function(r){if(!t.numKeys)return 0;var n="";n="s"in e.keyframes[r-1]?e.keyframes[r-1].s:"e"in e.keyframes[r-2]?e.keyframes[r-2].e:e.keyframes[r-2].s;var a="unidimensional"===i?new Number(n):Object.assign({},n);return a.time=e.keyframes[r-1].t/e.elem.comp.globalData.frameRate,a.value="unidimensional"===i?n[0]:n,a},t.valueAtTime=e.getValueAtTime,t.speedAtTime=e.getSpeedAtTime,t.velocityAtTime=e.getVelocityAtTime,t.propertyGroup=e.propertyGroup}function r(){return t}return function(n){return n?"unidimensional"===n.propType?function(e){e&&"pv"in e||(e=t);var r=1/e.mult,n=e.pv*r,a=new Number(n);return a.value=n,i(a,e,"unidimensional"),function(){return e.k&&e.getValue(),n=e.v*r,a.value!==n&&((a=new Number(n)).value=n,i(a,e,"unidimensional")),a}}(n):function(t){t&&"pv"in t||(t=e);var r=1/t.mult,n=t.data&&t.data.l||t.pv.length,a=createTypedArray("float32",n),s=createTypedArray("float32",n);return a.value=s,i(a,t,"multidimensional"),function(){t.k&&t.getValue();for(var e=0;e<n;e+=1)s[e]=t.v[e]*r,a[e]=s[e];return a}}(n):r}}(),TransformExpressionInterface=function(t){function e(t){switch(t){case"scale":case"Scale":case"ADBE Scale":case 6:return e.scale;case"rotation":case"Rotation":case"ADBE Rotation":case"ADBE Rotate Z":case 10:return e.rotation;case"ADBE Rotate X":return e.xRotation;case"ADBE Rotate Y":return e.yRotation;case"position":case"Position":case"ADBE Position":case 2:return e.position;case"ADBE Position_0":return e.xPosition;case"ADBE Position_1":return e.yPosition;case"ADBE Position_2":return e.zPosition;case"anchorPoint":case"AnchorPoint":case"Anchor Point":case"ADBE AnchorPoint":case 1:return e.anchorPoint;case"opacity":case"Opacity":case 11:return e.opacity;default:return null}}var i,r,n,a;return Object.defineProperty(e,"rotation",{get:ExpressionPropertyInterface(t.r||t.rz)}),Object.defineProperty(e,"zRotation",{get:ExpressionPropertyInterface(t.rz||t.r)}),Object.defineProperty(e,"xRotation",{get:ExpressionPropertyInterface(t.rx)}),Object.defineProperty(e,"yRotation",{get:ExpressionPropertyInterface(t.ry)}),Object.defineProperty(e,"scale",{get:ExpressionPropertyInterface(t.s)}),t.p?a=ExpressionPropertyInterface(t.p):(i=ExpressionPropertyInterface(t.px),r=ExpressionPropertyInterface(t.py),t.pz&&(n=ExpressionPropertyInterface(t.pz))),Object.defineProperty(e,"position",{get:function(){return t.p?a():[i(),r(),n?n():0]}}),Object.defineProperty(e,"xPosition",{get:ExpressionPropertyInterface(t.px)}),Object.defineProperty(e,"yPosition",{get:ExpressionPropertyInterface(t.py)}),Object.defineProperty(e,"zPosition",{get:ExpressionPropertyInterface(t.pz)}),Object.defineProperty(e,"anchorPoint",{get:ExpressionPropertyInterface(t.a)}),Object.defineProperty(e,"opacity",{get:ExpressionPropertyInterface(t.o)}),Object.defineProperty(e,"skew",{get:ExpressionPropertyInterface(t.sk)}),Object.defineProperty(e,"skewAxis",{get:ExpressionPropertyInterface(t.sa)}),Object.defineProperty(e,"orientation",{get:ExpressionPropertyInterface(t.or)}),e},LayerExpressionInterface=function(){function t(t){var e=new Matrix;return void 0!==t?this._elem.finalTransform.mProp.getValueAtTime(t).clone(e):this._elem.finalTransform.mProp.applyToMatrix(e),e}function e(t,e){var i=this.getMatrix(e);return i.props[12]=0,i.props[13]=0,i.props[14]=0,this.applyPoint(i,t)}function i(t,e){var i=this.getMatrix(e);return this.applyPoint(i,t)}function r(t,e){var i=this.getMatrix(e);return i.props[12]=0,i.props[13]=0,i.props[14]=0,this.invertPoint(i,t)}function n(t,e){var i=this.getMatrix(e);return this.invertPoint(i,t)}function a(t,e){if(this._elem.hierarchy&&this._elem.hierarchy.length){var i,r=this._elem.hierarchy.length;for(i=0;i<r;i+=1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(t)}return t.applyToPointArray(e[0],e[1],e[2]||0)}function s(t,e){if(this._elem.hierarchy&&this._elem.hierarchy.length){var i,r=this._elem.hierarchy.length;for(i=0;i<r;i+=1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(t)}return t.inversePoint(e)}function o(t){var e=new Matrix;if(e.reset(),this._elem.finalTransform.mProp.applyToMatrix(e),this._elem.hierarchy&&this._elem.hierarchy.length){var i,r=this._elem.hierarchy.length;for(i=0;i<r;i+=1)this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(e);return e.inversePoint(t)}return e.inversePoint(t)}function l(){return[1,1,1,1]}return function(h){var c;function u(t){switch(t){case"ADBE Root Vectors Group":case"Contents":case 2:return u.shapeInterface;case 1:case 6:case"Transform":case"transform":case"ADBE Transform Group":return c;case 4:case"ADBE Effect Parade":case"effects":case"Effects":return u.effect;case"ADBE Text Properties":return u.textInterface;default:return null}}u.getMatrix=t,u.invertPoint=s,u.applyPoint=a,u.toWorld=i,u.toWorldVec=e,u.fromWorld=n,u.fromWorldVec=r,u.toComp=i,u.fromComp=o,u.sampleImage=l,u.sourceRectAtTime=h.sourceRectAtTime.bind(h),u._elem=h;var d=getDescriptor(c=TransformExpressionInterface(h.finalTransform.mProp),"anchorPoint");return Object.defineProperties(u,{hasParent:{get:function(){return h.hierarchy.length}},parent:{get:function(){return h.hierarchy[0].layerInterface}},rotation:getDescriptor(c,"rotation"),scale:getDescriptor(c,"scale"),position:getDescriptor(c,"position"),opacity:getDescriptor(c,"opacity"),anchorPoint:d,anchor_point:d,transform:{get:function(){return c}},active:{get:function(){return h.isInRange}}}),u.startTime=h.data.st,u.index=h.data.ind,u.source=h.data.refId,u.height=0===h.data.ty?h.data.h:100,u.width=0===h.data.ty?h.data.w:100,u.inPoint=h.data.ip/h.comp.globalData.frameRate,u.outPoint=h.data.op/h.comp.globalData.frameRate,u._name=h.data.nm,u.registerMaskInterface=function(t){u.mask=new MaskManagerInterface(t,h)},u.registerEffectsInterface=function(t){u.effect=t},u}}(),propertyGroupFactory=function(t,e){return function(i){return(i=void 0===i?1:i)<=0?t:e(i-1)}},PropertyInterface=function(t,e){var i={_name:t};return function(t){return(t=void 0===t?1:t)<=0?i:e(t-1)}},EffectsExpressionInterface=function(){var t={createEffectsInterface:function(t,i){if(t.effectsManager){var r,n=[],a=t.data.ef,s=t.effectsManager.effectElements.length;for(r=0;r<s;r+=1)n.push(e(a[r],t.effectsManager.effectElements[r],i,t));var o=t.data.ef||[],l=function(t){for(r=0,s=o.length;r<s;){if(t===o[r].nm||t===o[r].mn||t===o[r].ix)return n[r];r+=1}return null};return Object.defineProperty(l,"numProperties",{get:function(){return o.length}}),l}return null}};function e(t,r,n,a){function s(e){for(var i=t.ef,r=0,n=i.length;r<n;){if(e===i[r].nm||e===i[r].mn||e===i[r].ix)return 5===i[r].ty?h[r]:h[r]();r+=1}throw new Error}var o,l=propertyGroupFactory(s,n),h=[],c=t.ef.length;for(o=0;o<c;o+=1)5===t.ef[o].ty?h.push(e(t.ef[o],r.effectElements[o],r.effectElements[o].propertyGroup,a)):h.push(i(r.effectElements[o],t.ef[o].ty,a,l));return"ADBE Color Control"===t.mn&&Object.defineProperty(s,"color",{get:function(){return h[0]()}}),Object.defineProperties(s,{numProperties:{get:function(){return t.np}},_name:{value:t.nm},propertyGroup:{value:l}}),s.enabled=0!==t.en,s.active=s.enabled,s}function i(t,e,i,r){var n=ExpressionPropertyInterface(t.p);return t.p.setGroupProperty&&t.p.setGroupProperty(PropertyInterface("",r)),function(){return 10===e?i.comp.compInterface(t.p.v):n()}}return t}(),ShapePathInterface=function(t,e,i){var r=e.sh;function n(t){return"Shape"===t||"shape"===t||"Path"===t||"path"===t||"ADBE Vector Shape"===t||2===t?n.path:null}var a=propertyGroupFactory(n,i);return r.setGroupProperty(PropertyInterface("Path",a)),Object.defineProperties(n,{path:{get:function(){return r.k&&r.getValue(),r}},shape:{get:function(){return r.k&&r.getValue(),r}},_name:{value:t.nm},ix:{value:t.ix},propertyIndex:{value:t.ix},mn:{value:t.mn},propertyGroup:{value:i}}),n},ShapeExpressionInterface=function(){function t(t,s,d){var p,f=[],m=t?t.length:0;for(p=0;p<m;p+=1)"gr"===t[p].ty?f.push(e(t[p],s[p],d)):"fl"===t[p].ty?f.push(i(t[p],s[p],d)):"st"===t[p].ty?f.push(n(t[p],s[p],d)):"tm"===t[p].ty?f.push(a(t[p],s[p],d)):"tr"===t[p].ty||("el"===t[p].ty?f.push(o(t[p],s[p],d)):"sr"===t[p].ty?f.push(l(t[p],s[p],d)):"sh"===t[p].ty?f.push(ShapePathInterface(t[p],s[p],d)):"rc"===t[p].ty?f.push(h(t[p],s[p],d)):"rd"===t[p].ty?f.push(c(t[p],s[p],d)):"rp"===t[p].ty?f.push(u(t[p],s[p],d)):"gf"===t[p].ty?f.push(r(t[p],s[p],d)):f.push((t[p],s[p],function(){return null})));return f}function e(e,i,r){var n=function(t){switch(t){case"ADBE Vectors Group":case"Contents":case 2:return n.content;default:return n.transform}};n.propertyGroup=propertyGroupFactory(n,r);var a=function(e,i,r){var n,a=function(t){for(var e=0,i=n.length;e<i;){if(n[e]._name===t||n[e].mn===t||n[e].propertyIndex===t||n[e].ix===t||n[e].ind===t)return n[e];e+=1}return"number"==typeof t?n[t-1]:null};a.propertyGroup=propertyGroupFactory(a,r),n=t(e.it,i.it,a.propertyGroup),a.numProperties=n.length;var o=s(e.it[e.it.length-1],i.it[i.it.length-1],a.propertyGroup);return a.transform=o,a.propertyIndex=e.cix,a._name=e.nm,a}(e,i,n.propertyGroup),o=s(e.it[e.it.length-1],i.it[i.it.length-1],n.propertyGroup);return n.content=a,n.transform=o,Object.defineProperty(n,"_name",{get:function(){return e.nm}}),n.numProperties=e.np,n.propertyIndex=e.ix,n.nm=e.nm,n.mn=e.mn,n}function i(t,e,i){function r(t){return"Color"===t||"color"===t?r.color:"Opacity"===t||"opacity"===t?r.opacity:null}return Object.defineProperties(r,{color:{get:ExpressionPropertyInterface(e.c)},opacity:{get:ExpressionPropertyInterface(e.o)},_name:{value:t.nm},mn:{value:t.mn}}),e.c.setGroupProperty(PropertyInterface("Color",i)),e.o.setGroupProperty(PropertyInterface("Opacity",i)),r}function r(t,e,i){function r(t){return"Start Point"===t||"start point"===t?r.startPoint:"End Point"===t||"end point"===t?r.endPoint:"Opacity"===t||"opacity"===t?r.opacity:null}return Object.defineProperties(r,{startPoint:{get:ExpressionPropertyInterface(e.s)},endPoint:{get:ExpressionPropertyInterface(e.e)},opacity:{get:ExpressionPropertyInterface(e.o)},type:{get:function(){return"a"}},_name:{value:t.nm},mn:{value:t.mn}}),e.s.setGroupProperty(PropertyInterface("Start Point",i)),e.e.setGroupProperty(PropertyInterface("End Point",i)),e.o.setGroupProperty(PropertyInterface("Opacity",i)),r}function n(t,e,i){var r,n=propertyGroupFactory(h,i),a=propertyGroupFactory(l,n);function s(i){Object.defineProperty(l,t.d[i].nm,{get:ExpressionPropertyInterface(e.d.dataProps[i].p)})}var o=t.d?t.d.length:0,l={};for(r=0;r<o;r+=1)s(r),e.d.dataProps[r].p.setGroupProperty(a);function h(t){return"Color"===t||"color"===t?h.color:"Opacity"===t||"opacity"===t?h.opacity:"Stroke Width"===t||"stroke width"===t?h.strokeWidth:null}return Object.defineProperties(h,{color:{get:ExpressionPropertyInterface(e.c)},opacity:{get:ExpressionPropertyInterface(e.o)},strokeWidth:{get:ExpressionPropertyInterface(e.w)},dash:{get:function(){return l}},_name:{value:t.nm},mn:{value:t.mn}}),e.c.setGroupProperty(PropertyInterface("Color",n)),e.o.setGroupProperty(PropertyInterface("Opacity",n)),e.w.setGroupProperty(PropertyInterface("Stroke Width",n)),h}function a(t,e,i){function r(e){return e===t.e.ix||"End"===e||"end"===e?r.end:e===t.s.ix?r.start:e===t.o.ix?r.offset:null}var n=propertyGroupFactory(r,i);return r.propertyIndex=t.ix,e.s.setGroupProperty(PropertyInterface("Start",n)),e.e.setGroupProperty(PropertyInterface("End",n)),e.o.setGroupProperty(PropertyInterface("Offset",n)),r.propertyIndex=t.ix,r.propertyGroup=i,Object.defineProperties(r,{start:{get:ExpressionPropertyInterface(e.s)},end:{get:ExpressionPropertyInterface(e.e)},offset:{get:ExpressionPropertyInterface(e.o)},_name:{value:t.nm}}),r.mn=t.mn,r}function s(t,e,i){function r(e){return t.a.ix===e||"Anchor Point"===e?r.anchorPoint:t.o.ix===e||"Opacity"===e?r.opacity:t.p.ix===e||"Position"===e?r.position:t.r.ix===e||"Rotation"===e||"ADBE Vector Rotation"===e?r.rotation:t.s.ix===e||"Scale"===e?r.scale:t.sk&&t.sk.ix===e||"Skew"===e?r.skew:t.sa&&t.sa.ix===e||"Skew Axis"===e?r.skewAxis:null}var n=propertyGroupFactory(r,i);return e.transform.mProps.o.setGroupProperty(PropertyInterface("Opacity",n)),e.transform.mProps.p.setGroupProperty(PropertyInterface("Position",n)),e.transform.mProps.a.setGroupProperty(PropertyInterface("Anchor Point",n)),e.transform.mProps.s.setGroupProperty(PropertyInterface("Scale",n)),e.transform.mProps.r.setGroupProperty(PropertyInterface("Rotation",n)),e.transform.mProps.sk&&(e.transform.mProps.sk.setGroupProperty(PropertyInterface("Skew",n)),e.transform.mProps.sa.setGroupProperty(PropertyInterface("Skew Angle",n))),e.transform.op.setGroupProperty(PropertyInterface("Opacity",n)),Object.defineProperties(r,{opacity:{get:ExpressionPropertyInterface(e.transform.mProps.o)},position:{get:ExpressionPropertyInterface(e.transform.mProps.p)},anchorPoint:{get:ExpressionPropertyInterface(e.transform.mProps.a)},scale:{get:ExpressionPropertyInterface(e.transform.mProps.s)},rotation:{get:ExpressionPropertyInterface(e.transform.mProps.r)},skew:{get:ExpressionPropertyInterface(e.transform.mProps.sk)},skewAxis:{get:ExpressionPropertyInterface(e.transform.mProps.sa)},_name:{value:t.nm}}),r.ty="tr",r.mn=t.mn,r.propertyGroup=i,r}function o(t,e,i){function r(e){return t.p.ix===e?r.position:t.s.ix===e?r.size:null}var n=propertyGroupFactory(r,i);r.propertyIndex=t.ix;var a="tm"===e.sh.ty?e.sh.prop:e.sh;return a.s.setGroupProperty(PropertyInterface("Size",n)),a.p.setGroupProperty(PropertyInterface("Position",n)),Object.defineProperties(r,{size:{get:ExpressionPropertyInterface(a.s)},position:{get:ExpressionPropertyInterface(a.p)},_name:{value:t.nm}}),r.mn=t.mn,r}function l(t,e,i){function r(e){return t.p.ix===e?r.position:t.r.ix===e?r.rotation:t.pt.ix===e?r.points:t.or.ix===e||"ADBE Vector Star Outer Radius"===e?r.outerRadius:t.os.ix===e?r.outerRoundness:!t.ir||t.ir.ix!==e&&"ADBE Vector Star Inner Radius"!==e?t.is&&t.is.ix===e?r.innerRoundness:null:r.innerRadius}var n=propertyGroupFactory(r,i),a="tm"===e.sh.ty?e.sh.prop:e.sh;return r.propertyIndex=t.ix,a.or.setGroupProperty(PropertyInterface("Outer Radius",n)),a.os.setGroupProperty(PropertyInterface("Outer Roundness",n)),a.pt.setGroupProperty(PropertyInterface("Points",n)),a.p.setGroupProperty(PropertyInterface("Position",n)),a.r.setGroupProperty(PropertyInterface("Rotation",n)),t.ir&&(a.ir.setGroupProperty(PropertyInterface("Inner Radius",n)),a.is.setGroupProperty(PropertyInterface("Inner Roundness",n))),Object.defineProperties(r,{position:{get:ExpressionPropertyInterface(a.p)},rotation:{get:ExpressionPropertyInterface(a.r)},points:{get:ExpressionPropertyInterface(a.pt)},outerRadius:{get:ExpressionPropertyInterface(a.or)},outerRoundness:{get:ExpressionPropertyInterface(a.os)},innerRadius:{get:ExpressionPropertyInterface(a.ir)},innerRoundness:{get:ExpressionPropertyInterface(a.is)},_name:{value:t.nm}}),r.mn=t.mn,r}function h(t,e,i){function r(e){return t.p.ix===e?r.position:t.r.ix===e?r.roundness:t.s.ix===e||"Size"===e||"ADBE Vector Rect Size"===e?r.size:null}var n=propertyGroupFactory(r,i),a="tm"===e.sh.ty?e.sh.prop:e.sh;return r.propertyIndex=t.ix,a.p.setGroupProperty(PropertyInterface("Position",n)),a.s.setGroupProperty(PropertyInterface("Size",n)),a.r.setGroupProperty(PropertyInterface("Rotation",n)),Object.defineProperties(r,{position:{get:ExpressionPropertyInterface(a.p)},roundness:{get:ExpressionPropertyInterface(a.r)},size:{get:ExpressionPropertyInterface(a.s)},_name:{value:t.nm}}),r.mn=t.mn,r}function c(t,e,i){function r(e){return t.r.ix===e||"Round Corners 1"===e?r.radius:null}var n=propertyGroupFactory(r,i),a=e;return r.propertyIndex=t.ix,a.rd.setGroupProperty(PropertyInterface("Radius",n)),Object.defineProperties(r,{radius:{get:ExpressionPropertyInterface(a.rd)},_name:{value:t.nm}}),r.mn=t.mn,r}function u(t,e,i){function r(e){return t.c.ix===e||"Copies"===e?r.copies:t.o.ix===e||"Offset"===e?r.offset:null}var n=propertyGroupFactory(r,i),a=e;return r.propertyIndex=t.ix,a.c.setGroupProperty(PropertyInterface("Copies",n)),a.o.setGroupProperty(PropertyInterface("Offset",n)),Object.defineProperties(r,{copies:{get:ExpressionPropertyInterface(a.c)},offset:{get:ExpressionPropertyInterface(a.o)},_name:{value:t.nm}}),r.mn=t.mn,r}return function(e,i,r){var n;function a(t){if("number"==typeof t)return 0===(t=void 0===t?1:t)?r:n[t-1];for(var e=0,i=n.length;e<i;){if(n[e]._name===t)return n[e];e+=1}return null}return a.propertyGroup=propertyGroupFactory(a,(function(){return r})),n=t(e,i,a.propertyGroup),a.numProperties=n.length,a._name="Contents",a}}(),TextExpressionInterface=function(t){var e;function i(t){return"ADBE Text Document"===t?i.sourceText:null}return Object.defineProperty(i,"sourceText",{get:function(){t.textProperty.getValue();var i=t.textProperty.currentData.t;return e&&i===e.value||((e=new String(i)).value=i||new String(i),Object.defineProperty(e,"style",{get:function(){return{fillColor:t.textProperty.currentData.fc}}})),e}}),i};function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}var FootageInterface=(dataInterfaceFactory=function(t){function e(t){return"Outline"===t?e.outlineInterface():null}return e._name="Outline",e.outlineInterface=function(t){var e="",i=t.getFootageData();function r(t){if(i[t])return e=t,"object"===_typeof(i=i[t])?r:i;var n=t.indexOf(e);if(-1!==n){var a=parseInt(t.substr(n+e.length),10);return"object"===_typeof(i=i[a])?r:i}return""}return function(){return e="",i=t.getFootageData(),r}}(t),e},function(t){function e(t){return"Data"===t?e.dataInterface:null}return e._name="Data",e.dataInterface=dataInterfaceFactory(t),e}),dataInterfaceFactory,interfaces={layer:LayerExpressionInterface,effects:EffectsExpressionInterface,comp:CompExpressionInterface,shape:ShapeExpressionInterface,text:TextExpressionInterface,footage:FootageInterface};function getInterface(t){return interfaces[t]||null}var expressionHelpers={searchExpressions:function(t,e,i){e.x&&(i.k=!0,i.x=!0,i.initiateExpression=ExpressionManager.initiateExpression,i.effectsSequence.push(i.initiateExpression(t,e,i).bind(i)))},getSpeedAtTime:function(t){var e=this.getValueAtTime(t),i=this.getValueAtTime(t+-.01),r=0;if(e.length){var n;for(n=0;n<e.length;n+=1)r+=Math.pow(i[n]-e[n],2);r=100*Math.sqrt(r)}else r=0;return r},getVelocityAtTime:function(t){if(void 0!==this.vel)return this.vel;var e,i,r=-.001,n=this.getValueAtTime(t),a=this.getValueAtTime(t+r);if(n.length)for(e=createTypedArray("float32",n.length),i=0;i<n.length;i+=1)e[i]=(a[i]-n[i])/r;else e=(a-n)/r;return e},getValueAtTime:function(t){return t*=this.elem.globalData.frameRate,(t-=this.offsetTime)!==this._cachingAtTime.lastFrame&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastFrame<t?this._cachingAtTime.lastIndex:0,this._cachingAtTime.value=this.interpolateValue(t,this._cachingAtTime),this._cachingAtTime.lastFrame=t),this._cachingAtTime.value},getStaticValueAtTime:function(){return this.pv},setGroupProperty:function(t){this.propertyGroup=t}};function addPropertyDecorator(){function t(t,e,i){if(!this.k||!this.keyframes)return this.pv;t=t?t.toLowerCase():"";var r,n,a,s,o,l=this.comp.renderedFrame,h=this.keyframes,c=h[h.length-1].t;if(l<=c)return this.pv;if(i?n=c-(r=e?Math.abs(c-this.elem.comp.globalData.frameRate*e):Math.max(0,c-this.elem.data.ip)):((!e||e>h.length-1)&&(e=h.length-1),r=c-(n=h[h.length-1-e].t)),"pingpong"===t){if(Math.floor((l-n)/r)%2!=0)return this.getValueAtTime((r-(l-n)%r+n)/this.comp.globalData.frameRate,0)}else{if("offset"===t){var u=this.getValueAtTime(n/this.comp.globalData.frameRate,0),d=this.getValueAtTime(c/this.comp.globalData.frameRate,0),p=this.getValueAtTime(((l-n)%r+n)/this.comp.globalData.frameRate,0),f=Math.floor((l-n)/r);if(this.pv.length){for(s=(o=new Array(u.length)).length,a=0;a<s;a+=1)o[a]=(d[a]-u[a])*f+p[a];return o}return(d-u)*f+p}if("continue"===t){var m=this.getValueAtTime(c/this.comp.globalData.frameRate,0),g=this.getValueAtTime((c-.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(s=(o=new Array(m.length)).length,a=0;a<s;a+=1)o[a]=m[a]+(m[a]-g[a])*((l-c)/this.comp.globalData.frameRate)/5e-4;return o}return m+(l-c)/.001*(m-g)}}return this.getValueAtTime(((l-n)%r+n)/this.comp.globalData.frameRate,0)}function e(t,e,i){if(!this.k)return this.pv;t=t?t.toLowerCase():"";var r,n,a,s,o,l=this.comp.renderedFrame,h=this.keyframes,c=h[0].t;if(l>=c)return this.pv;if(i?n=c+(r=e?Math.abs(this.elem.comp.globalData.frameRate*e):Math.max(0,this.elem.data.op-c)):((!e||e>h.length-1)&&(e=h.length-1),r=(n=h[e].t)-c),"pingpong"===t){if(Math.floor((c-l)/r)%2==0)return this.getValueAtTime(((c-l)%r+c)/this.comp.globalData.frameRate,0)}else{if("offset"===t){var u=this.getValueAtTime(c/this.comp.globalData.frameRate,0),d=this.getValueAtTime(n/this.comp.globalData.frameRate,0),p=this.getValueAtTime((r-(c-l)%r+c)/this.comp.globalData.frameRate,0),f=Math.floor((c-l)/r)+1;if(this.pv.length){for(s=(o=new Array(u.length)).length,a=0;a<s;a+=1)o[a]=p[a]-(d[a]-u[a])*f;return o}return p-(d-u)*f}if("continue"===t){var m=this.getValueAtTime(c/this.comp.globalData.frameRate,0),g=this.getValueAtTime((c+.001)/this.comp.globalData.frameRate,0);if(this.pv.length){for(s=(o=new Array(m.length)).length,a=0;a<s;a+=1)o[a]=m[a]+(m[a]-g[a])*(c-l)/.001;return o}return m+(m-g)*(c-l)/.001}}return this.getValueAtTime((r-((c-l)%r+c))/this.comp.globalData.frameRate,0)}function i(t,e){if(!this.k)return this.pv;if(t=.5*(t||.4),(e=Math.floor(e||5))<=1)return this.pv;var i,r,n=this.comp.renderedFrame/this.comp.globalData.frameRate,a=n-t,s=e>1?(n+t-a)/(e-1):1,o=0,l=0;for(i=this.pv.length?createTypedArray("float32",this.pv.length):0;o<e;){if(r=this.getValueAtTime(a+o*s),this.pv.length)for(l=0;l<this.pv.length;l+=1)i[l]+=r[l];else i+=r;o+=1}if(this.pv.length)for(l=0;l<this.pv.length;l+=1)i[l]/=e;else i/=e;return i}function r(t){this._transformCachingAtTime||(this._transformCachingAtTime={v:new Matrix});var e=this._transformCachingAtTime.v;if(e.cloneFromProps(this.pre.props),this.appliedTransformations<1){var i=this.a.getValueAtTime(t);e.translate(-i[0]*this.a.mult,-i[1]*this.a.mult,i[2]*this.a.mult)}if(this.appliedTransformations<2){var r=this.s.getValueAtTime(t);e.scale(r[0]*this.s.mult,r[1]*this.s.mult,r[2]*this.s.mult)}if(this.sk&&this.appliedTransformations<3){var n=this.sk.getValueAtTime(t),a=this.sa.getValueAtTime(t);e.skewFromAxis(-n*this.sk.mult,a*this.sa.mult)}if(this.r&&this.appliedTransformations<4){var s=this.r.getValueAtTime(t);e.rotate(-s*this.r.mult)}else if(!this.r&&this.appliedTransformations<4){var o=this.rz.getValueAtTime(t),l=this.ry.getValueAtTime(t),h=this.rx.getValueAtTime(t),c=this.or.getValueAtTime(t);e.rotateZ(-o*this.rz.mult).rotateY(l*this.ry.mult).rotateX(h*this.rx.mult).rotateZ(-c[2]*this.or.mult).rotateY(c[1]*this.or.mult).rotateX(c[0]*this.or.mult)}if(this.data.p&&this.data.p.s){var u=this.px.getValueAtTime(t),d=this.py.getValueAtTime(t);if(this.data.p.z){var p=this.pz.getValueAtTime(t);e.translate(u*this.px.mult,d*this.py.mult,-p*this.pz.mult)}else e.translate(u*this.px.mult,d*this.py.mult,0)}else{var f=this.p.getValueAtTime(t);e.translate(f[0]*this.p.mult,f[1]*this.p.mult,-f[2]*this.p.mult)}return e}function n(){return this.v.clone(new Matrix)}var a=TransformPropertyFactory.getTransformProperty;TransformPropertyFactory.getTransformProperty=function(t,e,i){var s=a(t,e,i);return s.dynamicProperties.length?s.getValueAtTime=r.bind(s):s.getValueAtTime=n.bind(s),s.setGroupProperty=expressionHelpers.setGroupProperty,s};var s=PropertyFactory.getProp;PropertyFactory.getProp=function(r,n,a,o,l){var h=s(r,n,a,o,l);h.kf?h.getValueAtTime=expressionHelpers.getValueAtTime.bind(h):h.getValueAtTime=expressionHelpers.getStaticValueAtTime.bind(h),h.setGroupProperty=expressionHelpers.setGroupProperty,h.loopOut=t,h.loopIn=e,h.smooth=i,h.getVelocityAtTime=expressionHelpers.getVelocityAtTime.bind(h),h.getSpeedAtTime=expressionHelpers.getSpeedAtTime.bind(h),h.numKeys=1===n.a?n.k.length:0,h.propertyIndex=n.ix;var c=0;return 0!==a&&(c=createTypedArray("float32",1===n.a?n.k[0].s.length:n.k.length)),h._cachingAtTime={lastFrame:initialDefaultFrame,lastIndex:0,value:c},expressionHelpers.searchExpressions(r,n,h),h.k&&l.addDynamicProperty(h),h};var o=ShapePropertyFactory.getConstructorFunction(),l=ShapePropertyFactory.getKeyframedConstructorFunction();function h(){}h.prototype={vertices:function(t,e){this.k&&this.getValue();var i,r=this.v;void 0!==e&&(r=this.getValueAtTime(e,0));var n=r._length,a=r[t],s=r.v,o=createSizedArray(n);for(i=0;i<n;i+=1)o[i]="i"===t||"o"===t?[a[i][0]-s[i][0],a[i][1]-s[i][1]]:[a[i][0],a[i][1]];return o},points:function(t){return this.vertices("v",t)},inTangents:function(t){return this.vertices("i",t)},outTangents:function(t){return this.vertices("o",t)},isClosed:function(){return this.v.c},pointOnPath:function(t,e){var i=this.v;void 0!==e&&(i=this.getValueAtTime(e,0)),this._segmentsLength||(this._segmentsLength=bez.getSegmentsLength(i));for(var r,n=this._segmentsLength,a=n.lengths,s=n.totalLength*t,o=0,l=a.length,h=0;o<l;){if(h+a[o].addedLength>s){var c=o,u=i.c&&o===l-1?0:o+1,d=(s-h)/a[o].addedLength;r=bez.getPointInSegment(i.v[c],i.v[u],i.o[c],i.i[u],d,a[o]);break}h+=a[o].addedLength,o+=1}return r||(r=i.c?[i.v[0][0],i.v[0][1]]:[i.v[i._length-1][0],i.v[i._length-1][1]]),r},vectorOnPath:function(t,e,i){1==t?t=this.v.c:0==t&&(t=.999);var r=this.pointOnPath(t,e),n=this.pointOnPath(t+.001,e),a=n[0]-r[0],s=n[1]-r[1],o=Math.sqrt(Math.pow(a,2)+Math.pow(s,2));return 0===o?[0,0]:"tangent"===i?[a/o,s/o]:[-s/o,a/o]},tangentOnPath:function(t,e){return this.vectorOnPath(t,e,"tangent")},normalOnPath:function(t,e){return this.vectorOnPath(t,e,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([h],o),extendPrototype([h],l),l.prototype.getValueAtTime=function(t){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shapePool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),t*=this.elem.globalData.frameRate,(t-=this.offsetTime)!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime<t?this._caching.lastIndex:0,this._cachingAtTime.lastTime=t,this.interpolateShape(t,this._cachingAtTime.shapeValue,this._cachingAtTime)),this._cachingAtTime.shapeValue},l.prototype.initiateExpression=ExpressionManager.initiateExpression;var c=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(t,e,i,r,n){var a=c(t,e,i,r,n);return a.propertyIndex=e.ix,a.lock=!1,3===i?expressionHelpers.searchExpressions(t,e.pt,a):4===i&&expressionHelpers.searchExpressions(t,e.ks,a),a.k&&t.addDynamicProperty(a),a}}function initialize$1(){addPropertyDecorator()}function addDecorator(){TextProperty.prototype.getExpressionValue=function(t,e){var i=this.calculateExpression(e);if(t.t!==i){var r={};return this.copyData(r,t),r.t=i.toString(),r.__complete=!1,r}return t},TextProperty.prototype.searchProperty=function(){var t=this.searchKeyframes(),e=this.searchExpressions();return this.kf=t||e,this.kf},TextProperty.prototype.searchExpressions=function(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function(t,e){var i,r,n=createNS("feMerge");for(n.setAttribute("result",t),r=0;r<e.length;r+=1)(i=createNS("feMergeNode")).setAttribute("in",e[r]),n.appendChild(i),n.appendChild(i);return n}};var linearFilterValue="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0";function SVGTintFilter(t,e,i,r,n){this.filterManager=e;var a=createNS("feColorMatrix");a.setAttribute("type","matrix"),a.setAttribute("color-interpolation-filters","linearRGB"),a.setAttribute("values",linearFilterValue+" 1 0"),this.linearFilter=a,a.setAttribute("result",r+"_tint_1"),t.appendChild(a),(a=createNS("feColorMatrix")).setAttribute("type","matrix"),a.setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),a.setAttribute("result",r+"_tint_2"),t.appendChild(a),this.matrixFilter=a;var s=this.createMergeNode(r,[n,r+"_tint_1",r+"_tint_2"]);t.appendChild(s)}function SVGFillFilter(t,e,i,r){this.filterManager=e;var n=createNS("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","sRGB"),n.setAttribute("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"),n.setAttribute("result",r),t.appendChild(n),this.matrixFilter=n}function SVGStrokeEffect(t,e,i){this.initialized=!1,this.filterManager=e,this.elem=i,this.paths=[]}function SVGTritoneFilter(t,e,i,r){this.filterManager=e;var n=createNS("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("color-interpolation-filters","linearRGB"),n.setAttribute("values","0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"),t.appendChild(n);var a=createNS("feComponentTransfer");a.setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("result",r),this.matrixFilter=a;var s=createNS("feFuncR");s.setAttribute("type","table"),a.appendChild(s),this.feFuncR=s;var o=createNS("feFuncG");o.setAttribute("type","table"),a.appendChild(o),this.feFuncG=o;var l=createNS("feFuncB");l.setAttribute("type","table"),a.appendChild(l),this.feFuncB=l,t.appendChild(a)}function SVGProLevelsFilter(t,e,i,r){this.filterManager=e;var n=this.filterManager.effectElements,a=createNS("feComponentTransfer");(n[10].p.k||0!==n[10].p.v||n[11].p.k||1!==n[11].p.v||n[12].p.k||1!==n[12].p.v||n[13].p.k||0!==n[13].p.v||n[14].p.k||1!==n[14].p.v)&&(this.feFuncR=this.createFeFunc("feFuncR",a)),(n[17].p.k||0!==n[17].p.v||n[18].p.k||1!==n[18].p.v||n[19].p.k||1!==n[19].p.v||n[20].p.k||0!==n[20].p.v||n[21].p.k||1!==n[21].p.v)&&(this.feFuncG=this.createFeFunc("feFuncG",a)),(n[24].p.k||0!==n[24].p.v||n[25].p.k||1!==n[25].p.v||n[26].p.k||1!==n[26].p.v||n[27].p.k||0!==n[27].p.v||n[28].p.k||1!==n[28].p.v)&&(this.feFuncB=this.createFeFunc("feFuncB",a)),(n[31].p.k||0!==n[31].p.v||n[32].p.k||1!==n[32].p.v||n[33].p.k||1!==n[33].p.v||n[34].p.k||0!==n[34].p.v||n[35].p.k||1!==n[35].p.v)&&(this.feFuncA=this.createFeFunc("feFuncA",a)),(this.feFuncR||this.feFuncG||this.feFuncB||this.feFuncA)&&(a.setAttribute("color-interpolation-filters","sRGB"),t.appendChild(a)),(n[3].p.k||0!==n[3].p.v||n[4].p.k||1!==n[4].p.v||n[5].p.k||1!==n[5].p.v||n[6].p.k||0!==n[6].p.v||n[7].p.k||1!==n[7].p.v)&&((a=createNS("feComponentTransfer")).setAttribute("color-interpolation-filters","sRGB"),a.setAttribute("result",r),t.appendChild(a),this.feFuncRComposed=this.createFeFunc("feFuncR",a),this.feFuncGComposed=this.createFeFunc("feFuncG",a),this.feFuncBComposed=this.createFeFunc("feFuncB",a))}function SVGDropShadowEffect(t,e,i,r,n){var a=e.container.globalData.renderConfig.filterSize,s=e.data.fs||a;t.setAttribute("x",s.x||a.x),t.setAttribute("y",s.y||a.y),t.setAttribute("width",s.width||a.width),t.setAttribute("height",s.height||a.height),this.filterManager=e;var o=createNS("feGaussianBlur");o.setAttribute("in","SourceAlpha"),o.setAttribute("result",r+"_drop_shadow_1"),o.setAttribute("stdDeviation","0"),this.feGaussianBlur=o,t.appendChild(o);var l=createNS("feOffset");l.setAttribute("dx","25"),l.setAttribute("dy","0"),l.setAttribute("in",r+"_drop_shadow_1"),l.setAttribute("result",r+"_drop_shadow_2"),this.feOffset=l,t.appendChild(l);var h=createNS("feFlood");h.setAttribute("flood-color","#00ff00"),h.setAttribute("flood-opacity","1"),h.setAttribute("result",r+"_drop_shadow_3"),this.feFlood=h,t.appendChild(h);var c=createNS("feComposite");c.setAttribute("in",r+"_drop_shadow_3"),c.setAttribute("in2",r+"_drop_shadow_2"),c.setAttribute("operator","in"),c.setAttribute("result",r+"_drop_shadow_4"),t.appendChild(c);var u=this.createMergeNode(r,[r+"_drop_shadow_4",n]);t.appendChild(u)}extendPrototype([SVGComposableEffect],SVGTintFilter),SVGTintFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,r=this.filterManager.effectElements[2].p.v/100;this.linearFilter.setAttribute("values",linearFilterValue+" "+r+" 0"),this.matrixFilter.setAttribute("values",i[0]-e[0]+" 0 0 0 "+e[0]+" "+(i[1]-e[1])+" 0 0 0 "+e[1]+" "+(i[2]-e[2])+" 0 0 0 "+e[2]+" 0 0 0 1 0")}},SVGFillFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=this.filterManager.effectElements[2].p.v,i=this.filterManager.effectElements[6].p.v;this.matrixFilter.setAttribute("values","0 0 0 0 "+e[0]+" 0 0 0 0 "+e[1]+" 0 0 0 0 "+e[2]+" 0 0 0 "+i+" 0")}},SVGStrokeEffect.prototype.initialize=function(){var t,e,i,r,n=this.elem.layerElement.children||this.elem.layerElement.childNodes;for(1===this.filterManager.effectElements[1].p.v?(r=this.elem.maskManager.masksProperties.length,i=0):r=1+(i=this.filterManager.effectElements[0].p.v-1),(e=createNS("g")).setAttribute("fill","none"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke-dashoffset",1);i<r;i+=1)t=createNS("path"),e.appendChild(t),this.paths.push({p:t,m:i});if(3===this.filterManager.effectElements[10].p.v){var a=createNS("mask"),s=createElementID();a.setAttribute("id",s),a.setAttribute("mask-type","alpha"),a.appendChild(e),this.elem.globalData.defs.appendChild(a);var o=createNS("g");for(o.setAttribute("mask","url("+getLocationHref()+"#"+s+")");n[0];)o.appendChild(n[0]);this.elem.layerElement.appendChild(o),this.masker=a,e.setAttribute("stroke","#fff")}else if(1===this.filterManager.effectElements[10].p.v||2===this.filterManager.effectElements[10].p.v){if(2===this.filterManager.effectElements[10].p.v)for(n=this.elem.layerElement.children||this.elem.layerElement.childNodes;n.length;)this.elem.layerElement.removeChild(n[0]);this.elem.layerElement.appendChild(e),this.elem.layerElement.removeAttribute("mask"),e.setAttribute("stroke","#fff")}this.initialized=!0,this.pathMasker=e},SVGStrokeEffect.prototype.renderFrame=function(t){var e;this.initialized||this.initialize();var i,r,n=this.paths.length;for(e=0;e<n;e+=1)if(-1!==this.paths[e].m&&(i=this.elem.maskManager.viewData[this.paths[e].m],r=this.paths[e].p,(t||this.filterManager._mdf||i.prop._mdf)&&r.setAttribute("d",i.lastPath),t||this.filterManager.effectElements[9].p._mdf||this.filterManager.effectElements[4].p._mdf||this.filterManager.effectElements[7].p._mdf||this.filterManager.effectElements[8].p._mdf||i.prop._mdf)){var a;if(0!==this.filterManager.effectElements[7].p.v||100!==this.filterManager.effectElements[8].p.v){var s=.01*Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v),o=.01*Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v),l=r.getTotalLength();a="0 0 0 "+l*s+" ";var h,c=l*(o-s),u=1+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v*.01,d=Math.floor(c/u);for(h=0;h<d;h+=1)a+="1 "+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v*.01+" ";a+="0 "+10*l+" 0 0"}else a="1 "+2*this.filterManager.effectElements[4].p.v*this.filterManager.effectElements[9].p.v*.01;r.setAttribute("stroke-dasharray",a)}if((t||this.filterManager.effectElements[4].p._mdf)&&this.pathMasker.setAttribute("stroke-width",2*this.filterManager.effectElements[4].p.v),(t||this.filterManager.effectElements[6].p._mdf)&&this.pathMasker.setAttribute("opacity",this.filterManager.effectElements[6].p.v),(1===this.filterManager.effectElements[10].p.v||2===this.filterManager.effectElements[10].p.v)&&(t||this.filterManager.effectElements[3].p._mdf)){var p=this.filterManager.effectElements[3].p.v;this.pathMasker.setAttribute("stroke","rgb("+bmFloor(255*p[0])+","+bmFloor(255*p[1])+","+bmFloor(255*p[2])+")")}},SVGTritoneFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,r=this.filterManager.effectElements[2].p.v,n=r[0]+" "+i[0]+" "+e[0],a=r[1]+" "+i[1]+" "+e[1],s=r[2]+" "+i[2]+" "+e[2];this.feFuncR.setAttribute("tableValues",n),this.feFuncG.setAttribute("tableValues",a),this.feFuncB.setAttribute("tableValues",s)}},SVGProLevelsFilter.prototype.createFeFunc=function(t,e){var i=createNS(t);return i.setAttribute("type","table"),e.appendChild(i),i},SVGProLevelsFilter.prototype.getTableValue=function(t,e,i,r,n){for(var a,s,o=0,l=Math.min(t,e),h=Math.max(t,e),c=Array.call(null,{length:256}),u=0,d=n-r,p=e-t;o<=256;)s=(a=o/256)<=l?p<0?n:r:a>=h?p<0?r:n:r+d*Math.pow((a-t)/p,1/i),c[u]=s,u+=1,o+=256/255;return c.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e,i=this.filterManager.effectElements;this.feFuncRComposed&&(t||i[3].p._mdf||i[4].p._mdf||i[5].p._mdf||i[6].p._mdf||i[7].p._mdf)&&(e=this.getTableValue(i[3].p.v,i[4].p.v,i[5].p.v,i[6].p.v,i[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(t||i[10].p._mdf||i[11].p._mdf||i[12].p._mdf||i[13].p._mdf||i[14].p._mdf)&&(e=this.getTableValue(i[10].p.v,i[11].p.v,i[12].p.v,i[13].p.v,i[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(t||i[17].p._mdf||i[18].p._mdf||i[19].p._mdf||i[20].p._mdf||i[21].p._mdf)&&(e=this.getTableValue(i[17].p.v,i[18].p.v,i[19].p.v,i[20].p.v,i[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(t||i[24].p._mdf||i[25].p._mdf||i[26].p._mdf||i[27].p._mdf||i[28].p._mdf)&&(e=this.getTableValue(i[24].p.v,i[25].p.v,i[26].p.v,i[27].p.v,i[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(t||i[31].p._mdf||i[32].p._mdf||i[33].p._mdf||i[34].p._mdf||i[35].p._mdf)&&(e=this.getTableValue(i[31].p.v,i[32].p.v,i[33].p.v,i[34].p.v,i[35].p.v),this.feFuncA.setAttribute("tableValues",e))}},extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){if((t||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),t||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(255*e[0]),Math.round(255*e[1]),Math.round(255*e[2])))}if((t||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),t||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var i=this.filterManager.effectElements[3].p.v,r=(this.filterManager.effectElements[2].p.v-90)*degToRads,n=i*Math.cos(r),a=i*Math.sin(r);this.feOffset.setAttribute("dx",n),this.feOffset.setAttribute("dy",a)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(t,e,i){this.initialized=!1,this.filterManager=e,this.filterElem=t,this.elem=i,i.matteElement=createNS("g"),i.matteElement.appendChild(i.layerElement),i.matteElement.appendChild(i.transformedElement),i.baseElement=i.matteElement}function SVGGaussianBlurEffect(t,e,i,r){t.setAttribute("x","-100%"),t.setAttribute("y","-100%"),t.setAttribute("width","300%"),t.setAttribute("height","300%"),this.filterManager=e;var n=createNS("feGaussianBlur");n.setAttribute("result",r),t.appendChild(n),this.feGaussianBlur=n}function TransformEffect(){}function SVGTransformEffect(t,e){this.init(e)}function CVTransformEffect(t){this.init(t)}return SVGMatte3Effect.prototype.findSymbol=function(t){for(var e=0,i=_svgMatteSymbols.length;e<i;){if(_svgMatteSymbols[e]===t)return _svgMatteSymbols[e];e+=1}return null},SVGMatte3Effect.prototype.replaceInParent=function(t,e){var i=t.layerElement.parentNode;if(i){for(var r,n=i.children,a=0,s=n.length;a<s&&n[a]!==t.layerElement;)a+=1;a<=s-2&&(r=n[a+1]);var o=createNS("use");o.setAttribute("href","#"+e),r?i.insertBefore(o,r):i.appendChild(o)}},SVGMatte3Effect.prototype.setElementAsMask=function(t,e){if(!this.findSymbol(e)){var i=createElementID(),r=createNS("mask");r.setAttribute("id",e.layerId),r.setAttribute("mask-type","alpha"),_svgMatteSymbols.push(e);var n=t.globalData.defs;n.appendChild(r);var a=createNS("symbol");a.setAttribute("id",i),this.replaceInParent(e,i),a.appendChild(e.layerElement),n.appendChild(a);var s=createNS("use");s.setAttribute("href","#"+i),r.appendChild(s),e.data.hd=!1,e.show()}t.setMatte(e.layerId)},SVGMatte3Effect.prototype.initialize=function(){for(var t=this.filterManager.effectElements[0].p.v,e=this.elem.comp.elements,i=0,r=e.length;i<r;)e[i]&&e[i].data.ind===t&&this.setElementAsMask(this.elem,e[i]),i+=1;this.initialized=!0},SVGMatte3Effect.prototype.renderFrame=function(){this.initialized||this.initialize()},SVGGaussianBlurEffect.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e=.3*this.filterManager.effectElements[0].p.v,i=this.filterManager.effectElements[1].p.v,r=3==i?0:e,n=2==i?0:e;this.feGaussianBlur.setAttribute("stdDeviation",r+" "+n);var a=1==this.filterManager.effectElements[2].p.v?"wrap":"duplicate";this.feGaussianBlur.setAttribute("edgeMode",a)}},TransformEffect.prototype.init=function(t){this.effectsManager=t,this.type=effectTypes.TRANSFORM_EFFECT,this.matrix=new Matrix,this.opacity=-1,this._mdf=!1,this._opMdf=!1},TransformEffect.prototype.renderFrame=function(t){if(this._opMdf=!1,this._mdf=!1,t||this.effectsManager._mdf){var e=this.effectsManager.effectElements,i=e[0].p.v,r=e[1].p.v,n=1===e[2].p.v,a=e[3].p.v,s=n?a:e[4].p.v,o=e[5].p.v,l=e[6].p.v,h=e[7].p.v;this.matrix.reset(),this.matrix.translate(-i[0],-i[1],i[2]),this.matrix.scale(.01*s,.01*a,1),this.matrix.rotate(-h*degToRads),this.matrix.skewFromAxis(-o*degToRads,(l+90)*degToRads),this.matrix.translate(r[0],r[1],0),this._mdf=!0,this.opacity!==e[8].p.v&&(this.opacity=e[8].p.v,this._opMdf=!0)}},extendPrototype([TransformEffect],SVGTransformEffect),extendPrototype([TransformEffect],CVTransformEffect),registerRenderer("canvas",CanvasRenderer),registerRenderer("html",HybridRenderer),registerRenderer("svg",SVGRenderer),ShapeModifiers.registerModifier("tm",TrimModifier),ShapeModifiers.registerModifier("pb",PuckerAndBloatModifier),ShapeModifiers.registerModifier("rp",RepeaterModifier),ShapeModifiers.registerModifier("rd",RoundCornersModifier),ShapeModifiers.registerModifier("zz",ZigZagModifier),ShapeModifiers.registerModifier("op",OffsetPathModifier),setExpressionsPlugin(Expressions),setExpressionInterfaces(getInterface),initialize$1(),initialize(),registerEffect$1(20,SVGTintFilter,!0),registerEffect$1(21,SVGFillFilter,!0),registerEffect$1(22,SVGStrokeEffect,!1),registerEffect$1(23,SVGTritoneFilter,!0),registerEffect$1(24,SVGProLevelsFilter,!0),registerEffect$1(25,SVGDropShadowEffect,!0),registerEffect$1(28,SVGMatte3Effect,!1),registerEffect$1(29,SVGGaussianBlurEffect,!0),registerEffect$1(35,SVGTransformEffect,!1),registerEffect(35,CVTransformEffect),lottie},module.exports=factory())})(lottie,lottie.exports);var lottieExports=lottie.exports,bodymovin=getDefaultExportFromCjs(lottieExports);class Lottie extends Rect{constructor(t){super(t),this.type="lottie",this.renderNextFrame=()=>{this.stage.renderNextFrame()},this.numberType=LOTTIE_NUMBER_TYPE,this.initLottieWeb(this.attribute.data)}setAttributes(t,e,i){return t.data&&this.initLottieWeb(t.data),super.setAttributes(t,e,i)}setAttribute(t,e,i,r){return"data"===t&&this.initLottieWeb(e),super.setAttribute(t,e,i,r)}getGraphicTheme(){return getTheme(this).rect}initLottieWeb(t){if("browser"!==vglobal.env)return;this.lottieInstance&&this.releaseLottieInstance();const e=this.getGraphicTheme(),{width:i=e.width,height:r=e.height}=this.attribute,n=vglobal.createCanvas({width:i,height:r,dpr:vglobal.devicePixelRatio}),a={rendererSettings:{context:n.getContext("2d")},animType:"canvas",loop:!0};"string"==typeof t?a.path=t:a.animationData=t,this.lottieInstance=bodymovin.loadAnimation(a),this.canvas=n,this.lottieInstance.addEventListener("drawnFrame",this.renderNextFrame)}release(){super.release(),this.releaseLottieInstance()}releaseLottieInstance(){this.lottieInstance.removeEventListener("drawnFrame",this.renderNextFrame),this.lottieInstance.destroy(),this.lottieInstance=null}}function createLottie(t){return new Lottie(t)}Lottie.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR;var __decorate$1=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s},__metadata=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param=function(t,e){return function(i,r){e(i,r,t)}};let DefaultCanvasLottiePicker=class extends RectPickerBase{constructor(t){super(),this.canvasRenderer=t}};DefaultCanvasLottiePicker=__decorate$1([injectable(),__param(0,inject(RectRender)),__metadata("design:paramtypes",[Object])],DefaultCanvasLottiePicker);let loadLottiePick=!1;const lottieCanvasPickModule=new ContainerModule(((t,e,i,r)=>{loadLottiePick||(loadLottiePick=!0,t(CanvasLottiePicker).to(DefaultCanvasLottiePicker).inSingletonScope(),t(CanvasPickerContribution).toService(CanvasLottiePicker))}));var __decorate=function(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};let DefaultCanvasLottieRender=class extends exports.DefaultCanvasRectRender{constructor(){super(...arguments),this.numberType=LOTTIE_NUMBER_TYPE}drawShape(t,e,i,r,n,a,s,o){const l=s||(()=>this._drawShape.call(this,t,e,i,r,n,a));super.drawShape(t,e,i,r,n,a,l,o)}_drawShape(t,e,i,r,n,a){var s;const o=null!==(s=this.tempTheme)&&void 0!==s?s:getTheme(t,null==a?void 0:a.theme).rect,{x:l=o.x,y:h=o.y}=t.attribute;e.setCommonStyle(t,t.attribute,l-i,h-r,o);const c=t.canvas;if(c){const t=e.createPattern(c,"no-repeat"),n=e.dpr;t.setTransform&&t.setTransform(new DOMMatrix([1/n,0,0,1/n,i,r])),e.fillStyle=t}e.fill()}};DefaultCanvasLottieRender=__decorate([injectable()],DefaultCanvasLottieRender);let loadLottieModule=!1;const lottieModule=new ContainerModule((t=>{loadLottieModule||(loadLottieModule=!0,t(DefaultCanvasLottieRender).toSelf().inSingletonScope(),t(GraphicRender).toService(DefaultCanvasLottieRender))})),browser=isBrowserEnv();function _registerArc(){_registerArc.__loaded||(_registerArc.__loaded=!0,registerArcGraphic(),container.load(arcModule),container.load(browser?arcCanvasPickModule:arcMathPickModule))}_registerArc.__loaded=!1;const registerArc=_registerArc;function _registerArc3d(){_registerArc3d.__loaded||(_registerArc3d.__loaded=!0,registerArc3dGraphic(),registerDirectionalLight(),registerOrthoCamera(),container.load(arc3dModule),container.load(arc3dCanvasPickModule))}_registerArc3d.__loaded=!1;const registerArc3d=_registerArc3d;function _registerArea(){_registerArea.__loaded||(_registerArea.__loaded=!0,registerAreaGraphic(),container.load(areaModule),container.load(browser?areaCanvasPickModule:areaMathPickModule))}_registerArea.__loaded=!1;const registerArea=_registerArea;function _registerCircle(){_registerCircle.__loaded||(_registerCircle.__loaded=!0,registerCircleGraphic(),container.load(circleModule),container.load(browser?circleCanvasPickModule:circleMathPickModule))}_registerCircle.__loaded=!1;const registerCircle=_registerCircle;function _registerGlyph(){_registerGlyph.__loaded||(_registerGlyph.__loaded=!0,registerGlyphGraphic(),container.load(glyphModule),container.load(browser?glyphCanvasPickModule:glyphMathPickModule))}_registerGlyph.__loaded=!1;const registerGlyph=_registerGlyph;function _registerGroup(){_registerGroup.__loaded||(_registerGroup.__loaded=!0,registerGroupGraphic())}_registerGroup.__loaded=!1;const registerGroup=_registerGroup;function _registerImage(){_registerImage.__loaded||(_registerImage.__loaded=!0,registerImageGraphic(),container.load(imageModule),container.load(browser?imageCanvasPickModule:imageMathPickModule))}_registerImage.__loaded=!1;const registerImage=_registerImage;function _registerLine(){_registerLine.__loaded||(_registerLine.__loaded=!0,registerLineGraphic(),container.load(lineModule),container.load(browser?lineCanvasPickModule:lineMathPickModule))}_registerLine.__loaded=!1;const registerLine=_registerLine;function _registerPath(){_registerPath.__loaded||(_registerPath.__loaded=!0,registerPathGraphic(),container.load(pathModule),container.load(browser?pathCanvasPickModule:pathMathPickModule))}_registerPath.__loaded=!1;const registerPath=_registerPath;function _registerPolygon(){_registerPolygon.__loaded||(_registerPolygon.__loaded=!0,registerPolygonGraphic(),container.load(polygonModule),container.load(browser?polygonCanvasPickModule:polygonMathPickModule))}_registerPolygon.__loaded=!1;const registerPolygon=_registerPolygon;function _registerPyramid3d(){_registerPyramid3d.__loaded||(_registerPyramid3d.__loaded=!0,registerPyramid3dGraphic(),registerDirectionalLight(),registerOrthoCamera(),container.load(pyramid3dModule),container.load(pyramid3dCanvasPickModule))}_registerPyramid3d.__loaded=!1;const registerPyramid3d=_registerPyramid3d;function _registerRect(){_registerRect.__loaded||(_registerRect.__loaded=!0,registerRectGraphic(),container.load(rectModule),container.load(browser?rectCanvasPickModule:rectMathPickModule))}_registerRect.__loaded=!1;const registerRect=_registerRect;function _registerRect3d(){_registerRect3d.__loaded||(_registerRect3d.__loaded=!0,registerRect3dGraphic(),container.load(rect3dModule),container.load(rect3dCanvasPickModule))}_registerRect3d.__loaded=!1;const registerRect3d=_registerRect3d;function _registerRichtext(){_registerRichtext.__loaded||(_registerRichtext.__loaded=!0,registerRichtextGraphic(),container.load(richtextModule),container.load(browser?richtextCanvasPickModule:richTextMathPickModule))}_registerRichtext.__loaded=!1;const registerRichtext=_registerRichtext;function _registerShadowRoot(){_registerShadowRoot.__loaded||(_registerShadowRoot.__loaded=!0,registerShadowRootGraphic())}_registerShadowRoot.__loaded=!1;const registerShadowRoot=_registerShadowRoot;function _registerSymbol(){_registerSymbol.__loaded||(_registerSymbol.__loaded=!0,registerSymbolGraphic(),container.load(symbolModule),container.load(browser?symbolCanvasPickModule:symbolMathPickModule))}_registerSymbol.__loaded=!1;const registerSymbol=_registerSymbol;function _registerText(){_registerText.__loaded||(_registerText.__loaded=!0,registerTextGraphic(),container.load(textModule),container.load(browser?textCanvasPickModule:textMathPickModule))}_registerText.__loaded=!1;const registerText=_registerText;function _registerWrapText(){_registerWrapText.__loaded||(_registerWrapText.__loaded=!0,registerWrapTextGraphic())}_registerWrapText.__loaded=!1;const registerWrapText=_registerWrapText,roughModule=_roughModule,version="0.21.5-vstory.1";preLoadAllModule(),isBrowserEnv()?loadBrowserEnv(container):isNodeEnv()&&loadNodeEnv(container),registerArc(),registerArc3d(),registerArea(),registerCircle(),registerGlyph(),registerGroup(),registerImage(),registerLine(),registerPath(),registerPolygon(),registerPyramid3d(),registerRect(),registerRect3d(),registerRichtext(),registerShadowRoot(),registerSymbol(),registerText(),registerWrapText(),registerFlexLayoutPlugin(),registerViewTransform3dPlugin(),registerHtmlAttributePlugin(),registerReactAttributePlugin(),registerDirectionalLight(),registerOrthoCamera(),exports.ACustomAnimate=ACustomAnimate,exports.ARC3D_NUMBER_TYPE=ARC3D_NUMBER_TYPE,exports.ARC_NUMBER_TYPE=ARC_NUMBER_TYPE,exports.AREA_NUMBER_TYPE=AREA_NUMBER_TYPE,exports.Animate=Animate,exports.AnimateGroup=AnimateGroup,exports.AnimateGroup1=AnimateGroup1,exports.Application=Application,exports.Arc=Arc,exports.Arc3d=Arc3d,exports.Arc3dRender=Arc3dRender,exports.ArcRender=ArcRender,exports.ArcRenderContribution=ArcRenderContribution,exports.Area=Area,exports.AreaRender=AreaRender,exports.AreaRenderContribution=AreaRenderContribution,exports.AttributeAnimate=AttributeAnimate,exports.AutoEnablePlugins=AutoEnablePlugins,exports.BaseCanvas=BaseCanvas,exports.BaseRender=BaseRender,exports.Basis=Basis,exports.BeforeRenderConstribution=BeforeRenderConstribution,exports.BoundsContext=BoundsContext,exports.BoundsPicker=BoundsPicker,exports.CIRCLE_NUMBER_TYPE=CIRCLE_NUMBER_TYPE,exports.Canvas3DDrawItemInterceptor=Canvas3DDrawItemInterceptor,exports.CanvasArc3dPicker=CanvasArc3dPicker,exports.CanvasArcPicker=CanvasArcPicker,exports.CanvasAreaPicker=CanvasAreaPicker,exports.CanvasCirclePicker=CanvasCirclePicker,exports.CanvasFactory=CanvasFactory,exports.CanvasGlyphPicker=CanvasGlyphPicker,exports.CanvasGroupPicker=CanvasGroupPicker,exports.CanvasImagePicker=CanvasImagePicker,exports.CanvasLinePicker=CanvasLinePicker,exports.CanvasLottiePicker=CanvasLottiePicker,exports.CanvasPathPicker=CanvasPathPicker,exports.CanvasPickerContribution=CanvasPickerContribution,exports.CanvasPolygonPicker=CanvasPolygonPicker,exports.CanvasPyramid3dPicker=CanvasPyramid3dPicker,exports.CanvasRect3dPicker=CanvasRect3dPicker,exports.CanvasRectPicker=CanvasRectPicker,exports.CanvasRichTextPicker=CanvasRichTextPicker,exports.CanvasSymbolPicker=CanvasSymbolPicker,exports.CanvasTextLayout=CanvasTextLayout,exports.CanvasTextPicker=CanvasTextPicker,exports.CbAnimate=CbAnimate,exports.Circle=Circle,exports.CircleRender=CircleRender,exports.CircleRenderContribution=CircleRenderContribution,exports.ClipAngleAnimate=ClipAngleAnimate,exports.ClipDirectionAnimate=ClipDirectionAnimate,exports.ClipGraphicAnimate=ClipGraphicAnimate,exports.ClipRadiusAnimate=ClipRadiusAnimate,exports.ColorInterpolate=ColorInterpolate,exports.ColorStore=ColorStore,exports.CommonRenderContribution=CommonRenderContribution,exports.Container=Container,exports.ContainerModule=ContainerModule,exports.Context2dFactory=Context2dFactory,exports.ContributionProvider=ContributionProvider,exports.CurveContext=CurveContext,exports.CustomEvent=CustomEvent,exports.CustomPath2D=CustomPath2D,exports.CustomSymbolClass=CustomSymbolClass,exports.DEFAULT_TEXT_FONT_FAMILY=DEFAULT_TEXT_FONT_FAMILY,exports.DebugDrawItemInterceptorContribution=DebugDrawItemInterceptorContribution,exports.DefaultArcAllocate=DefaultArcAllocate,exports.DefaultArcAttribute=DefaultArcAttribute,exports.DefaultArcRenderContribution=DefaultArcRenderContribution,exports.DefaultAreaAllocate=DefaultAreaAllocate,exports.DefaultAreaAttribute=DefaultAreaAttribute,exports.DefaultAreaTextureRenderContribution=DefaultAreaTextureRenderContribution,exports.DefaultAttribute=DefaultAttribute,exports.DefaultBaseBackgroundRenderContribution=DefaultBaseBackgroundRenderContribution,exports.DefaultBaseTextureRenderContribution=DefaultBaseTextureRenderContribution,exports.DefaultCanvasAllocate=DefaultCanvasAllocate,exports.DefaultCircleAllocate=DefaultCircleAllocate,exports.DefaultCircleAttribute=DefaultCircleAttribute,exports.DefaultCircleRenderContribution=DefaultCircleRenderContribution,exports.DefaultConnectAttribute=DefaultConnectAttribute,exports.DefaultDebugAttribute=DefaultDebugAttribute,exports.DefaultFillStyle=DefaultFillStyle,exports.DefaultGlyphAttribute=DefaultGlyphAttribute,exports.DefaultGraphicAllocate=DefaultGraphicAllocate,exports.DefaultGraphicMemoryManager=DefaultGraphicMemoryManager,exports.DefaultGroupAttribute=DefaultGroupAttribute,exports.DefaultGroupBackgroundRenderContribution=DefaultGroupBackgroundRenderContribution,exports.DefaultImageAttribute=DefaultImageAttribute,exports.DefaultImageBackgroundRenderContribution=DefaultImageBackgroundRenderContribution,exports.DefaultImageRenderContribution=DefaultImageRenderContribution,exports.DefaultLayout=DefaultLayout,exports.DefaultLineAllocate=DefaultLineAllocate,exports.DefaultLineAttribute=DefaultLineAttribute,exports.DefaultMat4Allocate=DefaultMat4Allocate,exports.DefaultMatrixAllocate=DefaultMatrixAllocate,exports.DefaultMorphingAnimateConfig=DefaultMorphingAnimateConfig,exports.DefaultPathAllocate=DefaultPathAllocate,exports.DefaultPathAttribute=DefaultPathAttribute,exports.DefaultPickStyle=DefaultPickStyle,exports.DefaultPolygonAttribute=DefaultPolygonAttribute,exports.DefaultRect3dAttribute=DefaultRect3dAttribute,exports.DefaultRectAllocate=DefaultRectAllocate,exports.DefaultRectAttribute=DefaultRectAttribute,exports.DefaultRectRenderContribution=DefaultRectRenderContribution,exports.DefaultRichTextAttribute=DefaultRichTextAttribute,exports.DefaultRichTextIconAttribute=DefaultRichTextIconAttribute,exports.DefaultStateAnimateConfig=DefaultStateAnimateConfig,exports.DefaultStrokeStyle=DefaultStrokeStyle,exports.DefaultStyle=DefaultStyle,exports.DefaultSymbolAllocate=DefaultSymbolAllocate,exports.DefaultSymbolAttribute=DefaultSymbolAttribute,exports.DefaultSymbolClipRangeStrokeRenderContribution=DefaultSymbolClipRangeStrokeRenderContribution,exports.DefaultSymbolRenderContribution=DefaultSymbolRenderContribution,exports.DefaultTextAllocate=DefaultTextAllocate,exports.DefaultTextAttribute=DefaultTextAttribute,exports.DefaultTextStyle=DefaultTextStyle,exports.DefaultTicker=DefaultTicker,exports.DefaultTimeline=DefaultTimeline,exports.DefaultTransform=DefaultTransform,exports.DirectionalLight=DirectionalLight,exports.DragNDrop=DragNDrop,exports.DrawContribution=DrawContribution,exports.DrawItemInterceptor=DrawItemInterceptor,exports.DynamicLayerHandlerContribution=DynamicLayerHandlerContribution,exports.Easing=Easing,exports.EnvContribution=EnvContribution,exports.EventManager=EventManager,exports.EventSystem=EventSystem,exports.EventTarget=EventTarget,exports.FORMAT_ELEMENT_COMMAND=FORMAT_ELEMENT_COMMAND,exports.FORMAT_TEXT_COMMAND=FORMAT_TEXT_COMMAND,exports.Factory=Factory,exports.FadeInPlus=FadeInPlus,exports.FederatedEvent=FederatedEvent,exports.FederatedMouseEvent=FederatedMouseEvent,exports.FederatedPointerEvent=FederatedPointerEvent,exports.FederatedWheelEvent=FederatedWheelEvent,exports.FlexLayoutPlugin=FlexLayoutPlugin,exports.Fragment=Fragment,exports.GLYPH_NUMBER_TYPE=GLYPH_NUMBER_TYPE,exports.GRAPHIC_UPDATE_TAG_KEY=GRAPHIC_UPDATE_TAG_KEY,exports.GROUP_NUMBER_TYPE=GROUP_NUMBER_TYPE,exports.Generator=Generator,exports.Gesture=Gesture,exports.GlobalPickerService=GlobalPickerService,exports.Glyph=Glyph,exports.GlyphRender=GlyphRender,exports.Graphic=Graphic,exports.GraphicAnimate=GraphicAnimate,exports.GraphicCreator=GraphicCreator$1,exports.GraphicPicker=GraphicPicker,exports.GraphicRender=GraphicRender,exports.GraphicService=GraphicService,exports.GraphicUtil=GraphicUtil,exports.Group=Group,exports.GroupFadeIn=GroupFadeIn,exports.GroupFadeOut=GroupFadeOut,exports.GroupRender=GroupRender,exports.GroupRenderContribution=GroupRenderContribution,exports.HtmlAttributePlugin=HtmlAttributePlugin,exports.IMAGE_NUMBER_TYPE=IMAGE_NUMBER_TYPE,exports.Image=Image$1,exports.ImageRender=ImageRender,exports.ImageRenderContribution=ImageRenderContribution,exports.IncreaseCount=IncreaseCount,exports.IncrementalDrawContribution=IncrementalDrawContribution,exports.InputText=InputText,exports.InteractiveDrawItemInterceptorContribution=InteractiveDrawItemInterceptorContribution,exports.InteractiveSubRenderContribution=InteractiveSubRenderContribution,exports.LINE_NUMBER_TYPE=LINE_NUMBER_TYPE,exports.Layer=Layer,exports.LayerService=LayerService,exports.Line=Line$1,exports.LineRender=LineRender,exports.Linear=Linear,exports.LinearClosed=LinearClosed,exports.Lottie=Lottie,exports.ManualTickHandler=ManualTickHandler,exports.ManualTicker=ManualTicker,exports.Mat4Allocate=Mat4Allocate,exports.MathArcPicker=MathArcPicker,exports.MathAreaPicker=MathAreaPicker,exports.MathCirclePicker=MathCirclePicker,exports.MathGlyphPicker=MathGlyphPicker,exports.MathImagePicker=MathImagePicker,exports.MathLinePicker=MathLinePicker,exports.MathPathPicker=MathPathPicker,exports.MathPickerContribution=MathPickerContribution,exports.MathPolygonPicker=MathPolygonPicker,exports.MathRectPicker=MathRectPicker,exports.MathSymbolPicker=MathSymbolPicker,exports.MathTextPicker=MathTextPicker,exports.MatrixAllocate=MatrixAllocate,exports.Meteor=Meteor,exports.MonotoneX=MonotoneX,exports.MonotoneY=MonotoneY,exports.MorphingPath=MorphingPath,exports.MotionPath=MotionPath,exports.MultiToOneMorphingPath=MultiToOneMorphingPath,exports.NOWORK_ANIMATE_ATTR=NOWORK_ANIMATE_ATTR,exports.Node=Node,exports.OrthoCamera=OrthoCamera,exports.PATH_NUMBER_TYPE=PATH_NUMBER_TYPE,exports.POLYGON_NUMBER_TYPE=POLYGON_NUMBER_TYPE,exports.PURE_STYLE_KEY=PURE_STYLE_KEY,exports.PYRAMID3D_NUMBER_TYPE=PYRAMID3D_NUMBER_TYPE,exports.Path=Path,exports.PathRender=PathRender,exports.PathRenderContribution=PathRenderContribution,exports.PickItemInterceptor=PickItemInterceptor,exports.PickServiceInterceptor=PickServiceInterceptor,exports.PickerService=PickerService,exports.PluginService=PluginService,exports.Polygon=Polygon,exports.PolygonRender=PolygonRender,exports.PolygonRenderContribution=PolygonRenderContribution,exports.Pyramid3d=Pyramid3d,exports.Pyramid3dRender=Pyramid3dRender,exports.RAFTickHandler=RAFTickHandler,exports.REACT_TO_CANOPUS_EVENTS=REACT_TO_CANOPUS_EVENTS,exports.REACT_TO_CANOPUS_EVENTS_LIST=REACT_TO_CANOPUS_EVENTS_LIST,exports.RECT3D_NUMBER_TYPE=RECT3D_NUMBER_TYPE,exports.RECT_NUMBER_TYPE=RECT_NUMBER_TYPE,exports.RICHTEXT_NUMBER_TYPE=RICHTEXT_NUMBER_TYPE,exports.RafBasedSTO=RafBasedSTO,exports.ReactAttributePlugin=ReactAttributePlugin,exports.Rect=Rect,exports.Rect3DRender=Rect3DRender,exports.Rect3d=Rect3d,exports.RectRender=RectRender,exports.RectRenderContribution=RectRenderContribution,exports.ReflectSegContext=ReflectSegContext,exports.RenderSelector=RenderSelector,exports.RenderService=RenderService,exports.ResourceLoader=ResourceLoader,exports.RichText=RichText,exports.RichTextEditPlugin=RichTextEditPlugin,exports.RichTextRender=RichTextRender,exports.RotateBySphereAnimate=RotateBySphereAnimate,exports.SVG_ATTRIBUTE_MAP=SVG_ATTRIBUTE_MAP,exports.SVG_ATTRIBUTE_MAP_KEYS=SVG_ATTRIBUTE_MAP_KEYS,exports.SVG_PARSE_ATTRIBUTE_MAP=SVG_PARSE_ATTRIBUTE_MAP,exports.SVG_PARSE_ATTRIBUTE_MAP_KEYS=SVG_PARSE_ATTRIBUTE_MAP_KEYS,exports.SYMBOL_NUMBER_TYPE=SYMBOL_NUMBER_TYPE,exports.SegContext=SegContext,exports.ShadowRoot=ShadowRoot,exports.ShadowRootDrawItemInterceptorContribution=ShadowRootDrawItemInterceptorContribution,exports.Stage=Stage,exports.StaticLayerHandlerContribution=StaticLayerHandlerContribution,exports.Step=Step$1,exports.StreamLight=StreamLight,exports.SubAnimate=SubAnimate,exports.Symbol=Symbol$1,exports.SymbolRender=SymbolRender,exports.SymbolRenderContribution=SymbolRenderContribution,exports.TEXT_NUMBER_TYPE=TEXT_NUMBER_TYPE,exports.TagPointsUpdate=TagPointsUpdate,exports.Text=Text,exports.TextMeasureContribution=TextMeasureContribution,exports.TextRender=TextRender,exports.TextRenderContribution=TextRenderContribution,exports.Theme=Theme,exports.TimeOutTickHandler=TimeOutTickHandler,exports.TransformUtil=TransformUtil,exports.VArc=VArc,exports.VArc3d=VArc3d,exports.VArea=VArea,exports.VCircle=VCircle,exports.VGlobal=VGlobal,exports.VGlyph=VGlyph,exports.VGroup=VGroup,exports.VImage=VImage,exports.VLine=VLine,exports.VPath=VPath,exports.VPolygon=VPolygon,exports.VPyramid3d=VPyramid3d,exports.VRect=VRect,exports.VRect3d=VRect3d,exports.VRichText=VRichText,exports.VSymbol=VSymbol,exports.VText=VText,exports.VWindow=VWindow,exports.ViewTransform3dPlugin=ViewTransform3dPlugin,exports.VirtualLayerHandlerContribution=VirtualLayerHandlerContribution,exports.WILDCARD=WILDCARD,exports.WindowHandlerContribution=WindowHandlerContribution,exports.WrapText=WrapText,exports.XMLParser=XMLParser,exports._calculateLineHeight=_calculateLineHeight,exports._interpolateColor=_interpolateColor,exports._registerArc=_registerArc,exports.addArcToBezierPath=addArcToBezierPath$1,exports.addAttributeToPrototype=addAttributeToPrototype,exports.alignBezierCurves=alignBezierCurves,exports.alignSubpath=alignSubpath,exports.application=application,exports.applyTransformOnBezierCurves=applyTransformOnBezierCurves,exports.arc3dCanvasPickModule=arc3dCanvasPickModule,exports.arc3dModule=arc3dModule,exports.arcCanvasPickModule=arcCanvasPickModule,exports.arcMathPickModule=arcMathPickModule,exports.arcModule=arcModule,exports.areaCanvasPickModule=areaCanvasPickModule,exports.areaMathPickModule=areaMathPickModule,exports.areaModule=areaModule,exports.bezier=bezier,exports.bezierCurversToPath=bezierCurversToPath,exports.binarySplitPolygon=binarySplitPolygon,exports.bindContributionProvider=bindContributionProvider,exports.bindContributionProviderNoSingletonScope=bindContributionProviderNoSingletonScope,exports.boundStroke=boundStroke,exports.browserEnvModule=browserEnvModule,exports.builtInSymbolStrMap=builtInSymbolStrMap,exports.builtinSymbols=builtinSymbols,exports.builtinSymbolsMap=builtinSymbolsMap,exports.calcLineCache=calcLineCache,exports.calculateArcCornerRadius=calculateArcCornerRadius,exports.calculateLineHeight=calculateLineHeight,exports.canvasAllocate=canvasAllocate,exports.centroidOfSubpath=centroidOfSubpath,exports.circleBounds=circleBounds,exports.circleCanvasPickModule=circleCanvasPickModule,exports.circleMathPickModule=circleMathPickModule,exports.circleModule=circleModule,exports.clock=clock,exports.cloneGraphic=cloneGraphic,exports.colorEqual=colorEqual,exports.colorStringInterpolationToStr=colorStringInterpolationToStr,exports.container=container,exports.cornerTangents=cornerTangents,exports.createArc=createArc,exports.createArc3d=createArc3d,exports.createArea=createArea,exports.createCircle=createCircle,exports.createColor=createColor,exports.createConicalGradient=createConicalGradient,exports.createGlyph=createGlyph,exports.createGroup=createGroup,exports.createImage=createImage,exports.createImageElement=createImageElement$1,exports.createLine=createLine,exports.createLottie=createLottie,exports.createMat4=createMat4,exports.createPath=createPath,exports.createPolygon=createPolygon,exports.createPyramid3d=createPyramid3d,exports.createRect=createRect,exports.createRect3d=createRect3d,exports.createRectPath=createRectPath,exports.createRichText=createRichText,exports.createShadowRoot=createShadowRoot,exports.createStage=createStage,exports.createSymbol=createSymbol,exports.createText=createText,exports.createWrapText=createWrapText,exports.cubicCalc=cubicCalc,exports.cubicLength=cubicLength,exports.cubicPointAt=cubicPointAt,exports.cubicSubdivide=cubicSubdivide,exports.decodeReactDom=decodeReactDom,exports.defaultArcAllocate=defaultArcAllocate,exports.defaultArcBackgroundRenderContribution=defaultArcBackgroundRenderContribution,exports.defaultArcRenderContribution=defaultArcRenderContribution,exports.defaultArcTextureRenderContribution=defaultArcTextureRenderContribution,exports.defaultAreaAllocate=defaultAreaAllocate,exports.defaultBaseBackgroundRenderContribution=defaultBaseBackgroundRenderContribution,exports.defaultBaseTextureRenderContribution=defaultBaseTextureRenderContribution,exports.defaultCircleAllocate=defaultCircleAllocate,exports.defaultCircleBackgroundRenderContribution=defaultCircleBackgroundRenderContribution,exports.defaultCircleRenderContribution=defaultCircleRenderContribution,exports.defaultCircleTextureRenderContribution=defaultCircleTextureRenderContribution,exports.defaultGraphicMemoryManager=defaultGraphicMemoryManager,exports.defaultGroupBackgroundRenderContribution=defaultGroupBackgroundRenderContribution,exports.defaultImageBackgroundRenderContribution=defaultImageBackgroundRenderContribution,exports.defaultImageRenderContribution=defaultImageRenderContribution,exports.defaultLineAllocate=defaultLineAllocate,exports.defaultPathAllocate=defaultPathAllocate,exports.defaultRectAllocate=defaultRectAllocate,exports.defaultRectBackgroundRenderContribution=defaultRectBackgroundRenderContribution,exports.defaultRectRenderContribution=defaultRectRenderContribution,exports.defaultRectTextureRenderContribution=defaultRectTextureRenderContribution,exports.defaultSymbolAllocate=defaultSymbolAllocate,exports.defaultSymbolBackgroundRenderContribution=defaultSymbolBackgroundRenderContribution,exports.defaultSymbolClipRangeStrokeRenderContribution=defaultSymbolClipRangeStrokeRenderContribution,exports.defaultSymbolRenderContribution=defaultSymbolRenderContribution,exports.defaultSymbolTextureRenderContribution=defaultSymbolTextureRenderContribution,exports.defaultTextAllocate=defaultTextAllocate,exports.defaultTicker=defaultTicker,exports.defaultTimeline=defaultTimeline,exports.drawArc=drawArc,exports.drawArcPath=drawArcPath$1,exports.drawAreaSegments=drawAreaSegments,exports.drawIncrementalAreaSegments=drawIncrementalAreaSegments,exports.drawIncrementalSegments=drawIncrementalSegments,exports.drawSegments=drawSegments,exports.enumCommandMap=enumCommandMap,exports.feishuEnvModule=feishuEnvModule,exports.fillVisible=fillVisible,exports.findBestMorphingRotation=findBestMorphingRotation,exports.findNextGraphic=findNextGraphic,exports.flatten_simplify=flatten_simplify,exports.foreach=foreach,exports.foreachAsync=foreachAsync,exports.genBasisSegments=genBasisSegments,exports.genBasisTypeSegments=genBasisTypeSegments,exports.genLinearClosedSegments=genLinearClosedSegments,exports.genLinearClosedTypeSegments=genLinearClosedTypeSegments,exports.genLinearSegments=genLinearSegments,exports.genLinearTypeSegments=genLinearTypeSegments,exports.genMonotoneXSegments=genMonotoneXSegments,exports.genMonotoneXTypeSegments=genMonotoneXTypeSegments,exports.genMonotoneYSegments=genMonotoneYSegments,exports.genMonotoneYTypeSegments=genMonotoneYTypeSegments,exports.genNumberType=genNumberType,exports.genStepSegments=genStepSegments,exports.genStepTypeSegments=genStepTypeSegments,exports.generatorPathEasingFunc=generatorPathEasingFunc,exports.getAttributeFromDefaultAttrList=getAttributeFromDefaultAttrList,exports.getConicGradientAt=getConicGradientAt,exports.getCurrentEnv=getCurrentEnv,exports.getExtraModelMatrix=getExtraModelMatrix,exports.getModelMatrix=getModelMatrix,exports.getRichTextBounds=getRichTextBounds,exports.getScaledStroke=getScaledStroke,exports.getTextBounds=getTextBounds,exports.getTheme=getTheme,exports.getThemeFromGroup=getThemeFromGroup,exports.globalTheme=globalTheme,exports.glyphCanvasPickModule=glyphCanvasPickModule,exports.glyphMathPickModule=glyphMathPickModule,exports.glyphModule=glyphModule,exports.graphicCreator=graphicCreator,exports.graphicService=graphicService,exports.graphicUtil=graphicUtil,exports.harmonyEnvModule=harmonyEnvModule,exports.identityMat4=identityMat4,exports.imageCanvasPickModule=imageCanvasPickModule,exports.imageMathPickModule=imageMathPickModule,exports.imageModule=imageModule,exports.incrementalAddTo=incrementalAddTo,exports.initAllEnv=initAllEnv,exports.initBrowserEnv=initBrowserEnv,exports.initFeishuEnv=initFeishuEnv,exports.initHarmonyEnv=initHarmonyEnv,exports.initLynxEnv=initLynxEnv,exports.initNodeEnv=initNodeEnv,exports.initTTEnv=initTTEnv,exports.initTaroEnv=initTaroEnv,exports.initWxEnv=initWxEnv,exports.inject=inject,exports.injectable=injectable,exports.interpolateColor=interpolateColor,exports.interpolateGradientConicalColor=interpolateGradientConicalColor,exports.interpolateGradientLinearColor=interpolateGradientLinearColor,exports.interpolateGradientRadialColor=interpolateGradientRadialColor,exports.interpolatePureColorArray=interpolatePureColorArray,exports.intersect=intersect,exports.isBrowserEnv=isBrowserEnv,exports.isNodeEnv=isNodeEnv,exports.isSvg=isSvg,exports.isTransformKey=isTransformKey,exports.isXML=isXML,exports.jsx=jsx,exports.layerService=layerService,exports.lineCanvasPickModule=lineCanvasPickModule,exports.lineMathPickModule=lineMathPickModule,exports.lineModule=lineModule,exports.loadAllEnv=loadAllEnv,exports.loadAllModule=loadAllModule,exports.loadBrowserEnv=loadBrowserEnv,exports.loadFeishuEnv=loadFeishuEnv,exports.loadHarmonyEnv=loadHarmonyEnv,exports.loadLynxEnv=loadLynxEnv,exports.loadNodeEnv=loadNodeEnv,exports.loadTTEnv=loadTTEnv,exports.loadTaroEnv=loadTaroEnv,exports.loadWxEnv=loadWxEnv,exports.lookAt=lookAt,exports.lottieCanvasPickModule=lottieCanvasPickModule,exports.lottieModule=lottieModule,exports.lynxEnvModule=lynxEnvModule,exports.mat3Tomat4=mat3Tomat4,exports.mat4Allocate=mat4Allocate,exports.matrixAllocate=matrixAllocate,exports.morphPath=morphPath,exports.multiInject=multiInject,exports.multiToOneMorph=multiToOneMorph,exports.multiplyMat4Mat3=multiplyMat4Mat3,exports.multiplyMat4Mat4=multiplyMat4Mat4,exports.named=named,exports.newThemeObj=newThemeObj,exports.nodeEnvModule=nodeEnvModule,exports.oneToMultiMorph=oneToMultiMorph,exports.ortho=ortho,exports.parsePadding=parsePadding,exports.parseStroke=parseStroke,exports.parseSvgPath=parseSvgPath,exports.pathCanvasPickModule=pathCanvasPickModule,exports.pathMathPickModule=pathMathPickModule,exports.pathModule=pathModule,exports.pathToBezierCurves=pathToBezierCurves,exports.point=point$3,exports.pointEqual=pointEqual,exports.pointInterpolation=pointInterpolation,exports.pointInterpolationHighPerformance=pointInterpolationHighPerformance,exports.pointsEqual=pointsEqual,exports.pointsInterpolation=pointsInterpolation,exports.polygonCanvasPickModule=polygonCanvasPickModule,exports.polygonMathPickModule=polygonMathPickModule,exports.polygonModule=polygonModule,exports.preLoadAllModule=preLoadAllModule,exports.pyramid3dCanvasPickModule=pyramid3dCanvasPickModule,exports.pyramid3dModule=pyramid3dModule,exports.quadCalc=quadCalc,exports.quadLength=quadLength,exports.quadPointAt=quadPointAt,exports.rafBasedSto=rafBasedSto,exports.rect3dCanvasPickModule=rect3dCanvasPickModule,exports.rect3dModule=rect3dModule,exports.rectCanvasPickModule=rectCanvasPickModule,exports.rectFillVisible=rectFillVisible,exports.rectMathPickModule=rectMathPickModule,exports.rectModule=rectModule,exports.rectStrokeVisible=rectStrokeVisible,exports.recursiveCallBinarySplit=recursiveCallBinarySplit,exports.registerArc=registerArc,exports.registerArc3d=registerArc3d,exports.registerArc3dGraphic=registerArc3dGraphic,exports.registerArcGraphic=registerArcGraphic,exports.registerArea=registerArea,exports.registerAreaGraphic=registerAreaGraphic,exports.registerCircle=registerCircle,exports.registerCircleGraphic=registerCircleGraphic,exports.registerDirectionalLight=registerDirectionalLight,exports.registerFlexLayoutPlugin=registerFlexLayoutPlugin,exports.registerGlyph=registerGlyph,exports.registerGlyphGraphic=registerGlyphGraphic,exports.registerGroup=registerGroup,exports.registerGroupGraphic=registerGroupGraphic,exports.registerHtmlAttributePlugin=registerHtmlAttributePlugin,exports.registerImage=registerImage,exports.registerImageGraphic=registerImageGraphic,exports.registerLine=registerLine,exports.registerLineGraphic=registerLineGraphic,exports.registerOrthoCamera=registerOrthoCamera,exports.registerPath=registerPath,exports.registerPathGraphic=registerPathGraphic,exports.registerPolygon=registerPolygon,exports.registerPolygonGraphic=registerPolygonGraphic,exports.registerPyramid3d=registerPyramid3d,exports.registerPyramid3dGraphic=registerPyramid3dGraphic,exports.registerReactAttributePlugin=registerReactAttributePlugin,exports.registerRect=registerRect,exports.registerRect3d=registerRect3d,exports.registerRect3dGraphic=registerRect3dGraphic,exports.registerRectGraphic=registerRectGraphic,exports.registerRichtext=registerRichtext,exports.registerRichtextGraphic=registerRichtextGraphic,exports.registerShadowRoot=registerShadowRoot,exports.registerShadowRootGraphic=registerShadowRootGraphic,exports.registerSymbol=registerSymbol,exports.registerSymbolGraphic=registerSymbolGraphic,exports.registerText=registerText,exports.registerTextGraphic=registerTextGraphic,exports.registerViewTransform3dPlugin=registerViewTransform3dPlugin,exports.registerWrapText=registerWrapText,exports.registerWrapTextGraphic=registerWrapTextGraphic,exports.renderCommandList=renderCommandList,exports.rewriteProto=rewriteProto,exports.richTextMathPickModule=richTextMathPickModule,exports.richtextCanvasPickModule=richtextCanvasPickModule,exports.richtextModule=richtextModule,exports.rotateX=rotateX,exports.rotateY=rotateY,exports.rotateZ=rotateZ,exports.roughModule=roughModule,exports.runFill=runFill,exports.runStroke=runStroke,exports.scaleMat4=scaleMat4,exports.segments=segments,exports.shouldUseMat4=shouldUseMat4,exports.snapLength=snapLength,exports.splitArc=splitArc,exports.splitArea=splitArea,exports.splitCircle=splitCircle,exports.splitGraphic=splitGraphic,exports.splitLine=splitLine,exports.splitPath=splitPath,exports.splitPolygon=splitPolygon,exports.splitRect=splitRect,exports.splitToGrids=splitToGrids,exports.strCommandMap=strCommandMap,exports.strokeVisible=strokeVisible,exports.symbolCanvasPickModule=symbolCanvasPickModule,exports.symbolMathPickModule=symbolMathPickModule,exports.symbolModule=symbolModule,exports.taroEnvModule=taroEnvModule,exports.textAttributesToStyle=textAttributesToStyle,exports.textCanvasPickModule=textCanvasPickModule,exports.textDrawOffsetX=textDrawOffsetX,exports.textDrawOffsetY=textDrawOffsetY,exports.textLayoutOffsetY=textLayoutOffsetY,exports.textMathPickModule=textMathPickModule,exports.textModule=textModule,exports.transformKeys=transformKeys,exports.transformMat4=transformMat4,exports.transformUtil=transformUtil,exports.translate=translate,exports.ttEnvModule=ttEnvModule,exports.version=version,exports.verticalLayout=verticalLayout,exports.vglobal=vglobal,exports.waitForAllSubLayers=waitForAllSubLayers,exports.wrapCanvas=wrapCanvas,exports.wrapContext=wrapContext,exports.wxEnvModule=wxEnvModule,exports.xul=xul}));
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"),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)}},V=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())}))};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)}loadFont(t,e,i){return V(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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 Y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var X={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}(X);var $=Y(X.exports);var q=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`;var K=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||q(t,"Boolean")};var Z=t=>"function"==typeof t;var J=t=>null==t;var Q=t=>null!=t;var et=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var it=t=>"object"==typeof t&&null!==t;var nt=function(t){if(!it(t)||!q(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 rt=t=>void 0===t;var st=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||q(t,"String")};var at=t=>Array.isArray?Array.isArray(t):q(t,"Array");var ot=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var ht=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||q(t,"Number")};var lt=t=>ht(t)&&Number.isFinite(t);var ct=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var ut=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 dt=Object.prototype.hasOwnProperty;var pt=(t,e)=>null!=t&&dt.call(t,e);function ft(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(Q(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];!Q(r[a])||"object"!=typeof r[a]||n&&at(t[a])?vt(t,a,r[a]):gt(t,e,a,i,n)}}}}function gt(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(at(a)){if(n)o=[];else if(at(s))o=s;else if(ot(s)){o=new Array(s.length);let t=-1;const e=s.length;for(;++t<e;)o[t]=s[t]}}else nt(a)?(o=null!=s?s:{},"function"!=typeof s&&"object"==typeof s||(o={})):h=!1;h&&ft(o,a,n,r),vt(t,i,o)}function vt(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 mt(t,e){if(!at(t)||!at(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 yt="undefined"!=typeof console;function bt(t,e,i){const n=[e].concat([].slice.call(i));yt&&console[t].apply(console,n)}var xt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(xt||(xt={}));class wt{static getInstance(t,e){return wt._instance&&ht(t)?wt._instance.level(t):wt._instance||(wt._instance=new wt(t,e)),wt._instance}static setInstance(t){return wt._instance=t}static setInstanceLevel(t){wt._instance?wt._instance.level(t):wt._instance=new wt(t)}static clearInstance(){wt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xt.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>=xt.Info}canLogDebug(){return this._level>=xt.Debug}canLogError(){return this._level>=xt.Error}canLogWarn(){return this._level>=xt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return this._level>=xt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):bt(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>=xt.Warn&&bt(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>=xt.Info&&bt(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>=xt.Debug&&bt(this._method||"log","DEBUG",e),this}}wt._instance=null;const St=1e-10,At=1e-10;function Tt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:St,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:At)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}var Ct=function(t,e,i){return t<e?e:t>i?i:t};const _t=1e-12,Bt=Math.PI,Pt=Bt/2,Rt=2*Bt,Mt=2*Math.PI,Et=Math.abs,kt=Math.atan2,Ot=Math.cos,Lt=Math.max,It=Math.min,Dt=Math.sin,jt=Math.sqrt,Ut=Math.pow;function Wt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Nt(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 Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Ft(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class zt{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 zt(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 ht(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return ht(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 Ht{static distancePP(t,e){return jt(Ut(t.x-e.x,2)+Ut(t.y-e.y,2))}static distanceNN(t,e,i,n){return jt(Ut(t-i,2)+Ut(e-n,2))}static distancePN(t,e,i){return jt(Ut(e-t.x,2)+Ut(i-t.y,2))}static pointAtPP(t,e,i){return new zt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Vt(t){return t*(Math.PI/180)}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Rt;)t+=Rt;else if(t>0)for(;t>Rt;)t-=Rt;return t};function Xt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function $t(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function qt(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($t(r,e,t),$t(s,n,i),function(t,e){return Et(t[0]-e[0])+Et(t[1]-e[1])<1e-12}(r,s))return!0;$t(a,i,t);const o=Gt(a,s)/Gt(r,s);return o>=0&&o<=1&&[t[0]+r[0]*o,t[1]+r[1]*o]}var Kt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Kt||(Kt={}));const Zt=(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 Jt(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}=Zt(t,e,!0);return!(n>h||r<o||s>c||a<l)}return!0}function Qt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function te(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 ee(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ie(t,e){const i=e?Vt(t.angle):t.angle,n=ee(t);return[te({x:t.x1,y:t.y1},i,n),te({x:t.x2,y:t.y1},i,n),te({x:t.x2,y:t.y2},i,n),te({x:t.x1,y:t.y2},i,n)]}function ne(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 re=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 se(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 ae{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(),Q(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=Q(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(J(this._canvas)&&(Q(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),J(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&Q(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),J(this._context)&&Q(this._canvas)){const t=this._canvas.getContext("2d");Q(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!J(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(st(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(J(t))return{width:0,height:0};if(J(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);J(r)&&ae.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),J(r)&&["F","W"].includes(re(n))&&(r=this._measureFullSizeChar()),J(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height),!J(r.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=r.fontBoundingBoxAscent),!J(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(re(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(J(t))return s;if(at(t)){const a=t.filter(Q).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(J(this._numberCharSize)){const t=this._standardMethod(ae.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ae.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return J(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ae.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(J(this._letterCharSize)){const t=this._standardMethod(ae.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ae.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return Q(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){Q(this._canvas)&&(this._canvas=null),Q(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}ae.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ae.NUMBERS_CHAR_SET="0123456789",ae.FULL_SIZE_CHAR="字";function oe(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 he{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new he(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 at(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 oe(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 le extends he{}class ce extends he{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=ie(t,i),s=ie(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=ee(t),h=ee(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?Vt(t.angle):t.angle;let g=i?Vt(90-t.angle):t.angle+Pt;const v=i?Vt(e.angle):e.angle;let m=i?Vt(90-e.angle):e.angle+Pt;g>Mt&&(g-=Mt),m>Mt&&(m-=Mt);const y=(t,e,i,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(Qt(r,i)+Qt(r,n))/2>Qt(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 ue{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 ue,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 ue;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 ue(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 de{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 pe(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 fe(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 ge=/^#([0-9a-f]{3,8})$/,ve={transparent:4294967040},me={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 ye(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function be(t){return ht(t)?new Te(t>>16,t>>8&255,255&t,1):at(t)?new Te(t[0],t[1],t[2]):new Te(255,255,255)}function xe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function we(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Se=(t,e)=>{const i=ge.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Te((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?be(t):8===e?new Te(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ae{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ae(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ae(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Ae?t:new Ae(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(Q(ve[t]))return function(t){return ht(t)?new Te(t>>>24,t>>>16&255,t>>>8&255,255&t):at(t)?new Te(t[0],t[1],t[2],t[3]):new Te(255,255,255,1)}(ve[t]);if(Q(me[t]))return be(me[t]);const e=`${t}`.trim().toLowerCase(),i=Se(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 Te(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=pe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Te(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ae.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Te(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=fe(this.color.r,this.color.g,this.color.b),s=pe(J(t)?r.h:Ct(t,0,360),J(e)?r.s:e>=0&&e<=1?100*e:e,J(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new Te(s.r,s.g,s.b,n),this}setRGB(t,e,i){return!J(t)&&(this.color.r=t),!J(e)&&(this.color.g=e),!J(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Se(e,!0);return null!=i?i:this}setColorName(t){const e=me[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 Ae(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=xe(t.color.r),this.color.g=xe(t.color.g),this.color.b=xe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=we(t.color.r),this.color.g=we(t.color.g),this.color.b=we(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Te{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)),Q(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ye(this.r)+ye(this.g)+ye(this.b)+(1===this.opacity?"":ye(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}=fe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}const Ce=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),_e=Rt-1e-8;class Be{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,r,s){if(Math.abs(r-n)>_e)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%=Rt)<0&&(n+=Rt),(r%=Rt)<0&&(r+=Rt),r<n&&(s=!s,a=n,n=r,r=a),s)for(r-=Rt,a=n-n%Pt,o=0;o<4&&a>r;++o,a-=Pt)f(a);else for(a=n-n%Pt+Pt,o=0;o<4&&a<r;++o,a+=Pt)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 Pe{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 Re=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Me={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7},Ee={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ke,Oe,Le,Ie,De,je;function Ue(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(ke=e[t],Oe=ke.slice(1),Le=ke[0],i=[Le],n=Oe.match(Re),null!==n){for(let t=0,e=n.length;t<e;t++)Ie=n[t],De=parseFloat(Ie),Number.isNaN(De)||i.push(De);if(je=Me[Le],i.length-1>je){let t,e=Le;for(let n=1,s=i.length;n<s;n+=je){t=[e];for(let e=n,r=n+je;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 We,Ne,Ge,Fe,ze,He,Ve,Ye;function Xe(t,e,i,n,r,s,a,o,h){const l=Vt(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+=Rt:P>0&&0===s&&(P-=Rt);const R=Math.ceil(Math.abs(P/(Pt+.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 $e(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 qe(t,e,i,n){const r=Xe(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=$e(r[e]);t.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5])}}t.UpdateTag=void 0,(We=t.UpdateTag||(t.UpdateTag={}))[We.NONE=0]="NONE",We[We.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",We[We.UPDATE_SHAPE=2]="UPDATE_SHAPE",We[We.CLEAR_SHAPE=253]="CLEAR_SHAPE",We[We.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",We[We.INIT=179]="INIT",We[We.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",We[We.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",We[We.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",We[We.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",We[We.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",We[We.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",We[We.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",We[We.CLEAR_LAYOUT=127]="CLEAR_LAYOUT",t.IContainPointMode=void 0,(Ne=t.IContainPointMode||(t.IContainPointMode={}))[Ne.GLOBAL=1]="GLOBAL",Ne[Ne.LOCAL=16]="LOCAL",Ne[Ne.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",Ne[Ne.LOCAL_ACCURATE=48]="LOCAL_ACCURATE",t.AttributeUpdateType=void 0,(Ge=t.AttributeUpdateType||(t.AttributeUpdateType={}))[Ge.INIT=0]="INIT",Ge[Ge.DEFAULT=1]="DEFAULT",Ge[Ge.STATE=2]="STATE",Ge[Ge.ANIMATE_BIND=10]="ANIMATE_BIND",Ge[Ge.ANIMATE_PLAY=11]="ANIMATE_PLAY",Ge[Ge.ANIMATE_START=12]="ANIMATE_START",Ge[Ge.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",Ge[Ge.ANIMATE_END=14]="ANIMATE_END",Ge[Ge.TRANSLATE=20]="TRANSLATE",Ge[Ge.TRANSLATE_TO=21]="TRANSLATE_TO",Ge[Ge.SCALE=22]="SCALE",Ge[Ge.SCALE_TO=23]="SCALE_TO",Ge[Ge.ROTATE=24]="ROTATE",Ge[Ge.ROTATE_TO=25]="ROTATE_TO",t.AnimateStatus=void 0,(Fe=t.AnimateStatus||(t.AnimateStatus={}))[Fe.INITIAL=0]="INITIAL",Fe[Fe.RUNNING=1]="RUNNING",Fe[Fe.PAUSED=2]="PAUSED",Fe[Fe.END=3]="END",t.AnimateMode=void 0,(ze=t.AnimateMode||(t.AnimateMode={}))[ze.NORMAL=0]="NORMAL",ze[ze.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY",t.AnimateStepType=void 0,(He=t.AnimateStepType||(t.AnimateStepType={})).wait="wait",He.from="from",He.to="to",He.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,(Ve=t.CurveTypeEnum||(t.CurveTypeEnum={}))[Ve.CubicBezierCurve=0]="CubicBezierCurve",Ve[Ve.QuadraticBezierCurve=1]="QuadraticBezierCurve",Ve[Ve.ArcCurve=2]="ArcCurve",Ve[Ve.LineCurve=3]="LineCurve",Ve[Ve.EllipseCurve=4]="EllipseCurve",Ve[Ve.MoveCurve=5]="MoveCurve",t.BaseRenderContributionTime=void 0,(Ye=t.BaseRenderContributionTime||(t.BaseRenderContributionTime={}))[Ye.beforeFillStroke=0]="beforeFillStroke",Ye[Ye.afterFillStroke=1]="afterFillStroke";const Ke=(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)}},Ze=[(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 Je(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];Ze[h[0]](h,e,i,n,r,s,a)}}class Qe{getLength(t){return null!=t?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function ti(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+=Ht.distanceNN(s,a,o,h)}return i/2}function ei(t,e,i,n,r){return ti([t.x,e.x,i.x,n.x],[t.y,e.y,i.y,n.y])}function ii(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 ni(t,e,i,n,r){const s=ii(t.x,e.x,i.x,n.x,r),a=ii(t.y,e.y,i.y,n.y,r);return new zt(s,a)}function ri(t,e){const{p0:i,p1:n,p2:r,p3:s}=t,a=ni(i,n,r,s,e),o=Ht.pointAtPP(i,n,e),h=Ht.pointAtPP(n,r,e),l=Ht.pointAtPP(r,s,e),c=Ht.pointAtPP(o,h,e),u=Ht.pointAtPP(h,l,e);return[new si(i,o,c,a),new si(a,u,l,s)]}class si extends Qe{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 ni(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?ei(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(e){return e===t.Direction.ROW?Et(this.p0.x-this.p3.x):e===t.Direction.COLUMN?Et(this.p0.y-this.p3.y):0}getAngleAt(t){const e=Lt(t-.01,0),i=It(t+.01,1),n=this.getPointAt(e),r=this.getPointAt(i);return kt(r.y-n.y,r.x-n.x)}}function ai(t,e){const{p0:i,p1:n}=t,r=Ht.pointAtPP(i,n,e);return[new oi(i,r),new oi(r,n)]}class oi extends Qe{constructor(e,i){super(),this.type=t.CurveTypeEnum.LineCurve,this.p0=e,this.p1=i}getPointAt(t){if(!1!==this.defined)return Ht.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=kt(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()?Ht.distancePP(this.p0,this.p1):60}calcProjLength(e){return e===t.Direction.ROW?Et(this.p0.x-this.p1.x):e===t.Direction.COLUMN?Et(this.p0.y-this.p1.y):0}}class hi{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 si(new zt(this._lastX,this._lastY),new zt(t,e),new zt(i,n),new zt(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 oi(new zt(this._lastX,this._lastY),new zt(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 Et(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 Et(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 hi{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 ci(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 ui(e,i,n){const r=null!=i?i:Et(n[n.length-1].x-n[0].x)>Et(n[n.length-1].y-n[0].y)?t.Direction.ROW:t.Direction.COLUMN;return"monotoneY"===e?new li(e,r):new hi(e,r)}class di{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 pi(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=ui("linear",i,t);return fi(new di(r,n),t),r}function fi(t,e){return ci(t,e)}function gi(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 vi{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&&gi(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:gi(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 mi(t,e){return ci(t,e)}function yi(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 pi(t,e);const r=ui("basis",i,t);return mi(new vi(r,n),t),r}function bi(t){return t<0?-1:1}function xi(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(bi(s)+bi(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function wi(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Si(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 Ai{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:Si(this,this._t0,wi(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,Si(this,wi(this,e=xi(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Si(this,this._t0,e=xi(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 Ti extends Ai{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Ci(t,e){return ci(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 pi(t,e);const r=ui("monotoneX",i,t);return Ci(new Ai(r,n),t),r}function Bi(t,e){return ci(t,e)}function Pi(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 pi(t,e);const r=ui("monotoneY",i,t);return Bi(new Ti(r,n),t),r}let Ri=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 Mi(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 hi("step",null!=r?r:Et(e[e.length-1].x-e[0].x)>Et(e[e.length-1].y-e[0].y)?t.Direction.ROW:t.Direction.COLUMN);return Ei(new Ri(a,i,s),e),a}function Ei(t,e){return ci(t,e)}class ki extends di{lineEnd(){this.context.closePath()}}function Oi(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=ui("linear",i,t);return Li(new ki(r,n),t),r}function Li(t,e){return ci(t,e)}function Ii(t,e,i,n,r){let s=t._x1,a=t._y1,o=t._x2,h=t._y2;if(t._l01_a>_t){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>_t){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 Di(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 pi(i,r);const o=ui(t,s,i);return ci(new e(o,n,a),i),o}}const ji=Di("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:Ii(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 Ui=Di("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:Ii(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 Wi(t,e,i){var n,r;switch(e){case"linear":default:return pi(t,i);case"basis":return yi(t,i);case"monotoneX":return _i(t,i);case"monotoneY":return Pi(t,i);case"step":return Mi(t,.5,i);case"stepBefore":return Mi(t,0,i);case"stepAfter":return Mi(t,1,i);case"catmullRom":return ji(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"catmullRomClosed":return Ui(t,null!==(r=null==i?void 0:i.curveTension)&&void 0!==r?r:.5,i);case"linearClosed":return Oi(t,i)}}class Ni extends Pe{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Be(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Ee.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Ee.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([Ee.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([Ee.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([Ee.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([Ee.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([Ee.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([Ee.A,t,e,i,n,r,s]),this._ctx&&this._ctx.arc(t,e,i,n,r,s),this}closePath(){return this.commandList.push([Ee.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[Ee.M]=t=>`M${t[1]} ${t[2]}`,t[Ee.L]=t=>`L${t[1]} ${t[2]}`,t[Ee.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Ee.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Ee.A]=t=>{const e=[];Ke(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[Ee.R]=t=>`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Ee.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=Ue(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=Wi(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[Ee.M]=this.moveToTransform,t[Ee.L]=this.lineToTransform,t[Ee.Q]=this.quadraticCurveToTransform,t[Ee.C]=this.bezierCurveToTransform,t[Ee.AT]=this.arcToTransform,t[Ee.E]=this.ellipseTransform,t[Ee.R]=this.rectTransform,t[Ee.A]=this.arcTransform,t[Ee.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=Fi(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":qe(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":qe(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 Ee.L:this.lineToTransform(a,e,i,n,r);break;case Ee.M:this.moveToTransform(a,e,i,n,r);break;case Ee.C:this.bezierCurveToTransform(a,e,i,n,r);break;case Ee.Q:this.quadraticCurveToTransform(a,e,i,n,r);break;case Ee.A:this.arcToTransform(a,e,i,n,r);break;case Ee.E:this.ellipseTransform(a,e,i,n,r);break;case Ee.R:this.rectTransform(a,e,i,n,r);break;case Ee.AT:this.arcToTransform(a,e,i,n,r);break;case Ee.Z:this.closePath()}}else this.commandList=t.map((t=>t.slice()))}_updateBounds(){this.bounds.clear(),Je(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 Et(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 Et(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 Gi=["l",0,0,0,0,0,0,0];function Fi(t,e,i){const n=Gi[0]=t[0];if("a"===n||"A"===n)Gi[1]=e*t[1],Gi[2]=i*t[2],Gi[3]=t[3],Gi[4]=t[4],Gi[5]=t[5],Gi[6]=e*t[6],Gi[7]=i*t[7];else if("h"===n||"H"===n)Gi[1]=e*t[1];else if("v"===n||"V"===n)Gi[1]=i*t[1];else for(let n=1,r=t.length;n<r;++n)Gi[n]=(n%2==1?e:i)*t[n];return Gi}const zi={alignSelf:"auto"},Hi={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 ue},Vi={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},Yi={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},Xi=Object.assign({outerBorder:Object.assign(Object.assign({},Yi),{distance:0}),innerBorder:Object.assign(Object.assign({},Yi),{distance:0})},Yi),$i={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},qi={pickStrokeBuffer:0},Ki=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},Vi),Xi),zi),qi),Zi={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},Ji={_debug_bounds:!1},Qi=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},Ji),Ki),Hi);const tn=Object.assign(Object.assign({},Qi),{startAngle:0,endAngle:Mt,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),en=Object.assign(Object.assign(Object.assign({},Qi),Zi),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),nn=Object.assign(Object.assign({},Qi),{radius:1,startAngle:0,endAngle:Mt}),rn=Object.assign(Object.assign({},Qi),{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}),sn=Object.assign(Object.assign({},Qi),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),an=Object.assign(Object.assign(Object.assign({},Qi),Zi),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),on=Object.assign(Object.assign({},Qi),{path:new Ni,fillStrokeOrder:1,customPath:()=>{wt.getInstance().warn("空函数")}}),hn=Object.assign(Object.assign({},Qi),{points:[],cornerRadius:0,closePath:!0}),ln=Object.assign(Object.assign({},Qi),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0}),cn=Object.assign(Object.assign({},Qi),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0}),un=Object.assign(Object.assign({},Qi),{symbolType:"circle",size:10,keepDirIn3d:!0}),dn=Object.assign(Object.assign(Object.assign({},Qi),$i),{strokeBoundsBuffer:0,keepDirIn3d:!0}),pn=Object.assign(Object.assign(Object.assign({},Qi),$i),{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}),fn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Qi),{fill:!0,cornerRadius:0}),gn=Object.assign(Object.assign({},fn),{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 vn{}const mn=new vn,yn=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 bn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(bn.IsGradientStr(t))try{const e=yn(t)[0];if(e){if("linear"===e.type)return bn.ParseLinear(e);if("radial"===e.type)return bn.ParseRadial(e);if("conic"===e.type)return bn.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,n=Bt/2,r=parseFloat(e.value)/180*Bt-n;return{gradient:"conical",x:.5,y:.5,startAngle:r,endAngle:r+Mt,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=Bt/2;let r="angular"===e.type?parseFloat(e.value)/180*Bt:0;for(;r<0;)r+=Mt;for(;r>=Mt;)r-=Mt;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<Bt?(s=0,a=0,o=Math.cos(r-n),h=Math.sin(r-n)):r<Bt+n?(s=1,a=0,o=s-Math.sin(r-Bt),h=Math.cos(r-Bt)):(s=1,o=s-Math.cos(r-n-Bt),h-=Math.sin(r-n-Bt)),{gradient:"linear",x0:s,y0:a,x1:o,y1:h,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function xn(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 wn(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(at(e))for(let t=0;t<e.length&&(r=e[t],!r);t++);else r=e;if(r=bn.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 Sn={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"}},An=!0,Tn=!1,Cn=/\w|\(|\)|-/,_n=/[.?!,;:/,。?!、;:]/,Bn=/\S/,Pn=(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 Rn(t,e,i,n,r){if(!e||e<=0)return 0;const s=mn.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=Mn(t,a)),a}function Mn(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e;for(;Cn.test(t[n-1])&&Cn.test(t[n])||_n.test(t[n]);)if(n--,n<=0)return i?En(t,e):e;return n}function En(t,e){let i=e;for(;Cn.test(t[i-1])&&Cn.test(t[i])||_n.test(t[i]);)if(i++,i>=t.length)return i;return i}function kn(t,e){const i=mn.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 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};let Ln=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=dn.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:$i.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:$i.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:$i.fontSize;return{ascent:.79*i,descent:.21*i}}measureTextBoundLeftRightEstimate(t){var e;const i=null!==(e=t.fontSize)&&void 0!==e?e:$i.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=Mn(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=Mn(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){wt.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=Mn(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}};Ln=On([g()],Ln);var In=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 Dn=Symbol.for("TextMeasureContribution");t.DefaultTextMeasureContribution=class extends Ln{},t.DefaultTextMeasureContribution=In([g()],t.DefaultTextMeasureContribution);const jn=new E,Un=Symbol.for("CanvasFactory"),Wn=Symbol.for("Context2dFactory");function Nn(t){return jn.getNamed(Un,mn.global.env)(t)}const Gn=1e-4,Fn=Math.sqrt(3),zn=1/3;function Hn(t){return t>-nr&&t<nr}function Vn(t){return t>nr||t<-nr}const Yn=[0,0],Xn=[0,0],$n=[0,0];function qn(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Kn(t,e,i,n){const r=1-n;return r*(r*t+2*n*e)+n*n*i}function Zn(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 Jn(t){return(t%=Mt)<0&&(t+=Mt),t}function Qn(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;Yn[0]=a,Yn[1]=o;for(let a=0;a<1;a+=.05){Xn[0]=Kn(t,i,r,a),Xn[1]=Kn(e,n,s,a);const o=qn(Yn,Xn);o<u&&(l=a,u=o)}u=1/0;for(let a=0;a<32&&!(c<Gn);a++){const a=l-c,o=l+c;Xn[0]=Kn(t,i,r,a),Xn[1]=Kn(e,n,s,a);const h=qn(Xn,Yn);if(a>=0&&h<u)l=a,u=h;else{$n[0]=Kn(t,i,r,o),$n[1]=Kn(e,n,s,o);const a=qn($n,Yn);o<=1&&a<u?(l=o,u=a):c*=.5}}return h&&(h[0]=Kn(t,i,r,l),h[1]=Kn(e,n,s,l)),Math.sqrt(u)}(t,e,i,n,r,s,o,h,null)<=l/2}function tr(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;Yn[0]=h,Yn[1]=l;for(let h=0;h<1;h+=.05)Xn[0]=Zn(t,i,r,a,h),Xn[1]=Zn(e,n,s,o,h),p=qn(Yn,Xn),p<m&&(g=h,m=p);m=1/0;for(let h=0;h<32&&!(v<Gn);h++)u=g-v,d=g+v,Xn[0]=Zn(t,i,r,a,u),Xn[1]=Zn(e,n,s,o,u),p=qn(Xn,Yn),u>=0&&p<m?(g=u,m=p):($n[0]=Zn(t,i,r,a,d),$n[1]=Zn(e,n,s,o,d),f=qn($n,Yn),d<=1&&f<m?(g=d,m=f):v*=.5);return c&&(c[0]=Zn(t,i,r,a,g),c[1]=Zn(e,n,s,o,g)),Math.sqrt(m)}(t,e,i,n,r,s,a,o,l,c,null)<=u/2}function er(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)%Mt<1e-4)return!0;if(s){const t=n;n=Jn(r),r=Jn(t)}else n=Jn(n),r=Jn(r);n>r&&(r+=Mt);let u=Math.atan2(h,o);return u<0&&(u+=Mt),u>=n&&u<=r||u+Mt>=n&&u+Mt<=r}function ir(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 nr=1e-4;function rr(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(Hn(a)){if(Vn(s)){const t=-o/s;t>=0&&t<=1&&(r[h++]=t)}}else{const t=s*s-4*a*o;if(Hn(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 sr=[-1,-1,-1],ar=[-1,-1];function or(){const t=ar[0];ar[0]=ar[1],ar[1]=t}function hr(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(Hn(c)&&Hn(u))if(Hn(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(Hn(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,zn):Math.pow(i,zn),n=n<0?-Math.pow(-n,zn):Math.pow(n,zn);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+Fn*Math.sin(e)))/(3*a),l=(-o+i*(n-Fn*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,sr);if(0===c)return 0;let u=0,d=-1,p=0,f=0;for(let l=0;l<c;l++){const c=sr[l],g=0===c||1===c?.5:1;Zn(t,i,r,a,c)<h||(d<0&&(d=rr(e,n,s,o,ar),ar[1]<ar[0]&&d>1&&or(),p=Zn(e,n,s,o,ar[0]),d>1&&(f=Zn(e,n,s,o,ar[1]))),2===d?c<ar[0]?u+=p<e?g:-g:c<ar[1]?u+=f<p?g:-g:u+=o<f?g:-g:c<ar[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 h=function(t,e,i,n,r){const s=t-2*e+i,a=2*(e-t),o=t-n;let h=0;if(Hn(s)){if(Vn(a)){const t=-o/a;t>=0&&t<=1&&(r[h++]=t)}}else{const t=a*a-4*s*o;if(Hn(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,sr);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=Kn(e,n,s,l);for(let n=0;n<h;n++){const h=0===sr[n]||1===sr[n]?.5:1;Kn(t,i,r,sr[n])<a||(sr[n]<l?o+=c<e?h:-h:o+=s<c?h:-h)}return o}const c=0===sr[0]||1===sr[0]?.5:1;return Kn(t,i,r,sr[0])<a?0:s<e?c:-c}function cr(t,e,i,n,r,s,a,o){if((o-=e)>i||o<-i)return 0;const h=Math.sqrt(i*i-o*o);sr[0]=-h,sr[1]=h;const l=Math.abs(n-r);if(l<1e-4)return 0;if(l>=Mt-1e-4){n=0,r=Mt;const e=s?1:-1;return a>=sr[0]+t&&a<=sr[1]+t?e:0}if(n>r){const t=n;n=r,r=t}n<0&&(n+=Mt,r+=Mt);let c=0;for(let e=0;e<2;e++){const i=sr[e];if(i+t>a){let t=Math.atan2(o,i),e=s?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=r||t+Mt>=n&&t+Mt<=r)&&(t>Bt/2&&t<1.5*Bt&&(e=-e),c+=e)}}return c}function ur(t){return Math.round(t/Bt*1e8)/1e8%2*Bt}function dr(t,e){let i=ur(t[0]);i<0&&(i+=Mt);const n=i-t[0];let r=t[1];r+=n,!e&&r-i>=Mt?r=i+Mt:e&&i-r>=Mt?r=i-Mt:!e&&i>r?r=i+(Mt-ur(i-r)):e&&i<r&&(r=i-(Mt-ur(r-i))),t[0]=i,t[1]=r}const pr=[0,0];function fr(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]===Ee.M&&t>1&&(i||(l+=ne(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;pr[0]=S,pr[1]=A,dr(pr,Boolean(a[6])),S=pr[0],A=pr[1];const T=S,C=A-S,_=!!(1-(a[6]?0:1)),B=(n-v)*y/y+v;switch(g){case Ee.M:d=v,p=m,c=d,u=p;break;case Ee.L:if(i){if(ir(c,u,v,m,e,n,r))return!0}else l+=ne(c,u,v,m,n,r)||0;c=v,u=m;break;case Ee.C:if(i){if(tr(c,u,v,m,y,b,x,w,e,n,r))return!0}else l+=hr(c,u,v,m,y,b,x,w,n,r)||0;c=x,u=w;break;case Ee.Q:if(i){if(Qn(c,u,v,m,y,b,e,n,r))return!0}else l+=lr(c,u,v,m,y,b,n,r)||0;c=y,u=b;break;case Ee.A:if(o=Math.cos(T)*y+v,h=Math.sin(T)*y+m,f?(d=o,p=h):l+=ne(c,u,o,h,n,r),i){if(er(v,m,y,T,T+C,_,e,B,r))return!0}else l+=cr(v,m,y,T,T+C,_,B,r);c=Math.cos(T+C)*y+v,u=Math.sin(T+C)*y+m;break;case Ee.R:if(d=c=v,p=u=m,o=d+y,h=p+b,i){if(ir(d,p,o,p,e,n,r)||ir(o,p,o,h,e,n,r)||ir(o,h,d,h,e,n,r)||ir(d,h,d,p,e,n,r))return!0}else l+=ne(o,p,o,h,n,r),l+=ne(d,h,d,p,n,r);break;case Ee.Z:if(i){if(ir(c,u,d,p,e,n,r))return!0}else l+=ne(c,u,d,p,n,r);c=d,u=p}}return i||function(t,e){return Math.abs(t-e)<nr}(u,p)||(l+=ne(c,u,d,p,n,r)||0),0!==l}class gr{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=Nn(Object.assign({nativeCanvas:mn.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=Nn(Object.assign({nativeCanvas:mn.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 vr=new gr;var mr=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},yr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const br=Symbol.for("VWindow"),xr=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&&(jn.getNamed(xr,t.env).configure(this,t),this.actived=!0)},this._uid=e.GenAutoIncrementId(),this.global=mn.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&&Tt(this.width,t.width())&&Tt(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=mr([g(),yr("design:paramtypes",[])],t.DefaultWindow);var wr,Sr=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},Ar=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tr=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=mn.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=vr.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:$i.fontSize};return this.global.measureTextMethod=r,s}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ae(Object.assign({defaultFontParams:{fontFamily:$i.fontFamily,fontSize:$i.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ae.ALPHABET_CHAR_SET+ae.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const n=jn.get(br),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=Sr([g(),Tr(0,p(k)),Tr(0,v(Dn)),Ar("design:paramtypes",[Object])],t.DefaultGraphicUtil),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(wr||(wr={}));const Cr=new ue;t.DefaultTransformUtil=class{constructor(){this.matrix=new ue}init(t){return this.mode=wr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=wr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(Cr.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(Cr.a,Cr.b,Cr.c,Cr.d,Cr.e,Cr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Cr.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(Cr.a,Cr.b,Cr.c,Cr.d,Cr.e,Cr.f),this}scale(t,e,i){return this.mode===wr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===wr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Cr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Cr.a,Cr.b,Cr.c,Cr.d,Cr.e,Cr.f),this}translate(t,e){return this.mode===wr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===wr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}},t.DefaultTransformUtil=Sr([g(),Ar("design:paramtypes",[])],t.DefaultTransformUtil);const _r={arc:tn,area:en,circle:nn,line:an,path:on,symbol:un,text:dn,rect:ln,polygon:hn,richtext:pn,richtextIcon:gn,image:fn,group:rn,glyph:sn},Br=Object.keys(_r);function Pr(){return{arc:Object.assign({},_r.arc),area:Object.assign({},_r.area),circle:Object.assign({},_r.circle),line:Object.assign({},_r.line),path:Object.assign({},_r.path),symbol:Object.assign({},_r.symbol),text:Object.assign({},_r.text),rect:Object.assign({},_r.rect),polygon:Object.assign({},_r.polygon),richtext:Object.assign({},_r.richtext),richtextIcon:Object.assign({},_r.richtextIcon),image:Object.assign({},_r.image),group:Object.assign({},_r.group),glyph:Object.assign({},_r.glyph)}}function Rr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Mr=Pr();class Er{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Br.forEach((t=>{this._defaultTheme[t]=Object.create(Mr[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,wt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Br.forEach((n=>{const r=Object.create(Mr[n]);t&&t[n]&&Rr(r,t[n]),i[n]&&Rr(r,i[n]),e[n]&&Rr(r,e[n]),this.combinedTheme[n]=r})),e.common&&Br.forEach((t=>{Rr(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 kr=new Er;function Or(t,e){return t.glyphHost?Or(t.glyphHost):e?(t.isContainer,e):Lr(t)||t.attachedThemeGraphic&&Or(t.attachedThemeGraphic)||kr.getTheme()}function Lr(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)):kr.getTheme()}return null}var Ir=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 Dr extends ${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 Ir(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&&wt.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=K(i,!0)&&i||et(i)&&i.capture,r=et(i)&&i.once,s=Z(e)?void 0:e;return t=n?`${t}capture`:t,e=Z(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=K(i,!0)&&i||et(i)&&i.capture,r=Z(e)?void 0:e;t=n?`${t}capture`:t,e=Z(e)?e:e.handleEvent;const s=et(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 et(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 jr{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=jr.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&&Z(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&&Z(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class Ur extends jr{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 Wr extends Ur{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 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.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 Nr extends Ur{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 Nr(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}}Nr.DOM_DELTA_PIXEL=0,Nr.DOM_DELTA_LINE=1,Nr.DOM_DELTA_PAGE=2;class Gr extends jr{constructor(t,e){super(),this.type=t,this.detail=e}}const Fr="object"==typeof performance&&performance.now?performance:Date;function zr(t){return"mouse"===t||"pen"===t}class Hr{constructor(t,e){this.dispatch=new $,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(t,e)=>{if(!(t instanceof Wr))return void wt.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(zr(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 Wr))return void wt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(t,t.type,e),s=zr(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 Wr))return void wt.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=zr(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 Wr))return void wt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=zr(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 Wr))return void wt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=Fr.now(),r=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if(zr(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(zr(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,zr(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 Wr))return void wt.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"):zr(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 Nr))return void wt.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 wt.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(Wr);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(Nr);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(Wr);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 Wr&&e instanceof Wr&&(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 Ur&&e instanceof Ur&&(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=Fr.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 Vr={dispatchEvent(t){var e;if(!(t instanceof jr))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 Gr(t,e))}},Yr={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class Xr{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 Hr(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 Wr,this.rootWheelEvent=new Nr,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&&st(t)&&!pt(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];rt(n.button)&&(n.button=0),rt(n.buttons)&&(n.buttons=1),rt(n.isPrimary)&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),rt(n.width)&&(n.width=n.radiusX||1),rt(n.height)&&(n.height=n.radiusY||1),rt(n.tiltX)&&(n.tiltX=0),rt(n.tiltY)&&(n.tiltY=0),rt(n.pointerType)&&(n.pointerType="touch"),rt(n.pointerId)&&(n.pointerId=n.identifier||0),rt(n.pressure)&&(n.pressure=n.force||.5),rt(n.twist)&&(n.twist=0),rt(n.tangentialPressure)&&(n.tangentialPressure=0),rt(n.layerX)&&(n.layerX=n.offsetX=n.clientX),rt(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;rt(i.isPrimary)&&(i.isPrimary=!0),rt(i.width)&&(i.width=1),rt(i.height)&&(i.height=1),rt(i.tiltX)&&(i.tiltX=0),rt(i.tiltY)&&(i.tiltY=0),rt(i.pointerType)&&(i.pointerType="mouse"),rt(i.pointerId)&&(i.pointerId=1),rt(i.pressure)&&(i.pressure=.5),rt(i.twist)&&(i.twist=0),rt(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=Yr[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Fr.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 $r;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}($r||($r={}));class qr{static Avaliable(){return!!mn.global.getRequestAnimationFrame()}avaliable(){return qr.Avaliable()}tick(t,e){mn.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class Kr{static Avaliable(){return!0}avaliable(){return Kr.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 Zr extends ${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===$r.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=$r.INITIAL,mn.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),mn.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:qr},{mode:"timeout",cons:Kr}];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 qr;break;case"timeout":t=new Kr;break;default:wt.getInstance().warn("非法的计时器模式"),t=new qr}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!==$r.INITIAL&&(this.status=$r.PAUSE,!0)}resume(){return this.status!==$r.INITIAL&&(this.status=$r.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===$r.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===$r.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=$r.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=$r.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}trySyncTickStatus(){this.status===$r.RUNNING&&this._handlerTick()}}class Jr{constructor(){this.time=0}static Avaliable(){return!0}avaliable(){return Jr.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 Qr{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-Qr.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Qr.bounceIn(2*t):.5*Qr.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}Qr.quadIn=Qr.getPowIn(2),Qr.quadOut=Qr.getPowOut(2),Qr.quadInOut=Qr.getPowInOut(2),Qr.cubicIn=Qr.getPowIn(3),Qr.cubicOut=Qr.getPowOut(3),Qr.cubicInOut=Qr.getPowInOut(3),Qr.quartIn=Qr.getPowIn(4),Qr.quartOut=Qr.getPowOut(4),Qr.quartInOut=Qr.getPowInOut(4),Qr.quintIn=Qr.getPowIn(5),Qr.quintOut=Qr.getPowOut(5),Qr.quintInOut=Qr.getPowInOut(5),Qr.backIn=Qr.getBackIn(1.7),Qr.backOut=Qr.getBackOut(1.7),Qr.backInOut=Qr.getBackInOut(1.7),Qr.elasticIn=Qr.getElasticIn(1,.3),Qr.elasticOut=Qr.getElasticOut(1,.3),Qr.elasticInOut=Qr.getElasticInOut(1,.3*1.5);class ts{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 es=new ts;class is{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 ns extends is{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class rs{constructor(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.GenAutoIncrementId(),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:es,r=arguments.length>2?arguments[2]:void 0;this.id=i,this.timeline=n,this.status=t.AnimateStatus.INITIAL,this.tailAnimate=new ss(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=Lt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){rs.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]:rs.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 ns((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,n,r,s){const a=rs.interpolateMap.get(t)||rs.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 ss(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()}}rs.mode=t.AnimateMode.NORMAL,rs.interpolateMap=new Map;class ss{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 as(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?Qr[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?Qr[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 as(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 wt.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 as{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 os={duration:200,easing:"cubicOut"},hs={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 cs=[!1,!1,!1,!1],us=t=>{var e;let i=!0;if(K(t,!0)){for(let n=0;n<4;n++)cs[n]=t,i&&(i=!(null!==(e=cs[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)cs[e]=!!t[e],i&&(i=!!cs[e]);else cs[0]=!1,cs[1]=!1,cs[2]=!1,cs[3]=!1;return{isFullStroke:i,stroke:cs}},ds=[0,0,0,0],ps=t=>t?at(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ds[0]=t[0],ds[2]=t[0],ds[1]=t[1],ds[3]=t[1],ds):t:t:0,fs=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],gs=[1,2,3,0,1,2,3,0];function vs(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;fs[0].x=i,fs[1].y=i,fs[2].x=-i,fs[3].y=-i;const r=Math.ceil(t/Pt)%4,s=Math.ceil(e/Pt)%4;if(n.add(Ot(t)*i,Dt(t)*i),n.add(Ot(e)*i,Dt(e)*i),r!==s||e-t>Bt){let t=!1;for(let e=0;e<gs.length;e++)if(t||r!==gs[e]){if(t&&s===gs[e])break;if(t){const t=fs[gs[e]];n.add(t.x,t.y)}}else{t=!0;const e=fs[r];n.add(e.x,e.y)}}}function ms(t,e){return t.x===e.x&&t.y===e.y&&t.x1===e.x1&&t.y1===e.y1&&t.defined===e.defined}function ys(t,e,i){const{x:n,y:r}=Nt(t.x,t.y,e.x,e.y,i),{x:s,y:a}=Nt(t.x1,t.y1,e.x1,e.y1,i),o=new zt(n,r,s,a);return o.defined=e.defined,o}function bs(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 zt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<e.length;r++)n[r]=ys(t[r],e[r],i)}else{n=e.map((t=>{const e=new zt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let r=0;r<t.length;r++)n[r]=ys(t[r],e[r],i)}return n}const xs=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],ws=t=>xs.includes(t);function Ss(t,e){if(at(t)){let i;for(let n=0;n<t.length&&void 0===i;n++)i=t[n][e];return i}return t[e]}class As{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:As.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)}}As.TimeOut=1e3/60;const Ts=new As,Cs=(t,e)=>st(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t,_s=(t,e)=>{const i=Cs(t,e);return isNaN(i)?i:Math.max(e,i)};var Bs;!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"}(Bs||(Bs={}));class Ps extends is{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 Rs(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 Ms(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;Rs(e,n,h,p,a,r),Rs(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 Es(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 ks(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 Os(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 Ls(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 Is(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=Os(o),c=Os(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=ks(o));const m=6*Ls(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 Ds(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]=Ms(o,h),i=l,n=c):(c=Es(n,o),l=o):(l=Es(i,h),c=h),r.push(l),s.push(c)}return[r,s]}const js=(t,e,i,n,r)=>{Tt(e,n)&&Tt(i,r)||t.push(e,i,n,r,n,r)};function Us(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],[Ee.L,Ee.C,Ee.Q].includes(i[0])&&(n=[a,o])),i[0]){case Ee.M:r=a=i[1],s=o=i[2],h(a,o);break;case Ee.L:l=i[1],c=i[2],js(n,r,s,l,c),r=l,s=c;break;case Ee.C:n.push(i[1],i[2],i[3],i[4],r=i[5],s=i[6]);break;case Ee.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 Ee.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)):js(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);Ke(n,i,r,t,e,u,d)}break}case Ee.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=!Tt(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)):js(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(Ke(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 Ee.R:a=r=i[1],o=s=i[2],l=a+i[3],c=o+i[4],h(l,o),js(n,l,o,l,c),js(n,l,c,a,c),js(n,a,c,a,o),js(n,a,o,l,o);break;case Ee.AT:{const t=i[1],e=i[2],h=i[3],l=i[4],c=i[5],u=Ht.distancePP({x:r,y:s},{x:t,y:e}),d=Ht.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=Ht.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,js(n,r,s,a,o),r=t+x*(h-t)/d,s=e+x*(l-e)/d;const w=Xt({x:y,y:b},{x:a,y:o}),S=Xt({x:y,y:b},{x:r,y:s});Ke(n,w,S,y,b,c,c);break}case Ee.Z:n&&js(n,r,s,a,o),r=a,s=o}}return n&&n.length>2&&i.push(n),i}function Ws(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 Ns(t){const e=new Ni;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 Gs=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=J(t.width)?t.x1-t.x:t.width,i=J(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 Fs(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 zs=(t,e)=>{const{width:i,height:n}=Gs(t.attribute),r=Fs(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},Hs=(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=Fs(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},Vs=(t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),r=t.getComputedAttribute("radius"),s=Math.abs(i-n),a=Fs(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},Ys=(t,e)=>{const i=t.filter((t=>!1!==t.defined&&ht(t.x)&&ht(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},Xs=(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&&ht(t.x)&&ht(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 Js(s,e,l),l},$s=(t,e)=>{const i=t.attribute,n=i.points;if(n)return Ys(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 Ys(t,e)}return[]};const qs=t=>t.map((t=>({x:t.x,y:t.y}))),Ks=(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=qt([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[qs(t),qs(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]},Zs=t=>{const e=new he;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 Ks(t,{x:n,y:e.y1},{x:n,y:e.y2})}const r=e.y1+n/2;return Ks(t,{x:e.x1,y:r},{x:e.x2,y:r})},Js=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),r=Zs(t);Js(r[0],n,i),Js(r[1],e-n,i)}},Qs=(t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:qs(i)}];const n=[];return Js(i,e,n),n},ta=(t,e)=>{const i=Us(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:Ns(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]});Js(e,t===n-1?a:s,r),a-=s}return r};var ea;t.ColorType=void 0,(ea=t.ColorType||(t.ColorType={}))[ea.Color255=0]="Color255",ea[ea.Color1=1]="Color1";class ia{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=ia.store1[e];if(t)return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n;const i=Ae.parseColorString(e);if(i){const t=[i.r/255,i.g/255,i.b/255,i.opacity];ia.store1[e]=t,ia.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=ia.store255[e];if(r)return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n;const s=Ae.parseColorString(e);return s&&(ia.store1[e]=[s.r/255,s.g/255,s.b/255,s.opacity],ia.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(ia.store1[e])return;ia.store1[e]=n,ia.store255[e]=[Math.floor(255*n[0]),Math.floor(255*n[1]),Math.floor(255*n[2]),Math.floor(255*n[3])]}else{if(ia.store255[e])return;ia.store255[e]=n,ia.store1[e]=[n[0]/255,n[1]/255,n[2]/255,n[3]]}}}function na(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&ht(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 ra(t,e,i,n,r){return Array.isArray(t)&&!ht(t[0])||Array.isArray(e)&&!ht(e[0])?new Array(4).fill(0).map(((r,s)=>sa(at(t)?t[s]:t,at(e)?e[s]:e,i,n))):sa(t,e,i,n,r)}function sa(e,i,n,r,s){if(!e||!i)return e&&na(e)||i&&na(i)||!1;let a,o,h=!1,l=!1;if(Array.isArray(e)?a=e:"string"==typeof e?a=ia.Get(e,t.ColorType.Color255):h=!0,Array.isArray(i)?o=i:"string"==typeof i?o=ia.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:na(a)})))});return h?ra(t,o,n,r,s):ra(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 aa(t,r,n);if("radial"===t.gradient)return oa(t,r,n);if("conical"===t.gradient)return ha(t,r,n)}return!1}return s&&s(a,o),na(la(a,o,n),r)}function aa(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:da(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:"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:da(n[e].color,r[e].color,i),offset:n[e].offset+(r[e].offset-n[e].offset)*i})))}}function ha(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:da(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]}ia.store255={},ia.store1={};const ca=[0,0,0,0],ua=[0,0,0,0];function da(e,i,n){return ia.Get(e,t.ColorType.Color255,ca),ia.Get(i,t.ColorType.Color255,ua),`rgba(${Math.round(ca[0]+(ua[0]-ca[0])*n)},${Math.round(ca[1]+(ua[1]-ca[1])*n)},${Math.round(ca[2]+(ua[2]-ca[2])*n)},${ca[3]+(ua[3]-ca[3])*n})`}const pa=(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=ra(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},fa=(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}}},ga=(t,e,i)=>{const n=t?Us(t):[],r=Us(e);i&&n&&(i.fromTransform&&Ws(n,i.fromTransform.clone().getInverse()),Ws(n,i.toTransfrom));const[s,a]=Ds(n,r);return t?Is(s,a,10,Math.PI):a.map(((t,e)=>({from:s[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},va=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ma=(e,i)=>{if(!e||!i)return null;const n=[];let r=!1;return Object.keys(e).forEach((s=>{if(!va.includes(s))return;const a=i[s];J(a)||J(e[s])||a===e[s]||("fill"===s||"stroke"===s?n.push({from:"string"==typeof e[s]?ia.Get(e[s],t.ColorType.Color255):e[s],to:"string"==typeof a?ia.Get(a,t.ColorType.Color255):a,key:s}):n.push({from:e[s],to:a,key:s}),r=!0)})),r?n:null};class ya extends is{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;fa(this.morphingData,r,e),this.otherAttrs&&this.otherAttrs.length&&pa(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ba=(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=ga(null===(r=null==t?void 0:t.toCustomPath)||void 0===r?void 0:r.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),l=ma(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 ya({morphingData:h,otherAttrs:l},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:hs.duration,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:hs.easing)),c};class xa extends is{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;fa(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&&pa(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const wa=t=>{const e={};return Object.keys(t).forEach((i=>{ws(i)||(e[i]=t[i])})),e},Sa=(t,e,i)=>{const n=wa(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=mn.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});r.appendChild(i),e.push(i)}))}},Aa=(t,e,i)=>{const n=[],r=i?null:wa(t.attribute),s=t.toCustomPath();for(let t=0;t<e;t++){const t={path:(new Ni).fromCustomPath2D(s)};n.push(mn.graphicService.creator.path(i?t:Object.assign({},r,t)))}return i&&Sa(t,n,e),n},Ta=(t,e,i)=>{const n=[],r=i?null:wa(t.attribute);if("rect"===t.type)zs(t,e).forEach((t=>{n.push(mn.graphicService.creator.rect(i?t:Object.assign({},r,t)))}));else if("arc"===t.type)Hs(t,e).forEach((t=>{n.push(mn.graphicService.creator.arc(i?t:Object.assign({},r,t)))}));else if("circle"===t.type)Vs(t,e).forEach((t=>{n.push(mn.graphicService.creator.arc(i?t:Object.assign({},r,t)))}));else if("line"===t.type){const s=$s(t,e),a={size:10,symbolType:"circle"};s.forEach((t=>{n.push(mn.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},r,t,a)))}))}else"polygon"===t.type?Qs(t,e).forEach((t=>{n.push(mn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))})):"area"===t.type?Xs(t,e).forEach((t=>{n.push(mn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))})):"path"===t.type&&ta(t,e).forEach((t=>{"path"in t?n.push(mn.graphicService.creator.path(i?t:Object.assign({},r,t))):n.push(mn.graphicService.creator.polygon(i?t:Object.assign({},r,t)))}));return i&&Sa(t,n,e),n};class Ca{static GetImage(t,e){var i;const n=Ca.cache.get(t);n?"fail"===n.loadState?mn.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):Ca.loadImage(t,e)}static GetSvg(t,e){var i;let n=Ca.cache.get(t);n?"fail"===n.loadState?mn.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"},Ca.cache.set(t,n),n.dataPromise=mn.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=Ca.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"},Ca.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=mn.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=mn.global.loadBlob(t):"json"===e&&(i.dataPromise=mn.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Ca.isLoading&&Ca.toLoadAueue.length){Ca.isLoading=!0;const t=Ca.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:n}=t,r={type:"image",loadState:"init"};if(Ca.cache.set(i,r),r.dataPromise=mn.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((()=>{Ca.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ca.loading()})).catch((t=>{console.error(t),Ca.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Ca.loading()}))}}),0)}static loadImage(t,e){const i=_a(t,Ca.toLoadAueue);if(-1!==i)return Ca.toLoadAueue[i].marks.push(e),void Ca.loading();Ca.toLoadAueue.push({url:t,marks:[e]}),Ca.loading()}static improveImageLoading(t){const e=_a(t,Ca.toLoadAueue);if(-1!==e){const t=Ca.toLoadAueue.splice(e,1);Ca.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function _a(t,e){for(let i=0;i<e.length;i++)if(e[i].url===t)return i;return-1}Ca.cache=new Map,Ca.isLoading=!1,Ca.toLoadAueue=[],Ca.onLoadSuccessCb=[];const Ba=new ue,Pa=new le,Ra=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Ma=["x","y"],Ea=["scaleX","scaleY"],ka=["angle"],Oa=new zt,La={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 Ia extends Dr{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const n=e[i];Object.defineProperty(Ia.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;Oa.x=r+(null!==(i=t.scrollX)&&void 0!==i?i:0),Oa.y=s+(null!==(n=t.scrollY)&&void 0!==n?n:0)}else Oa.x=r,Oa.y=s;return Oa}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;mn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return mn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new ce),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=ps(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 Be(t);return Je(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 ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&mn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&t.UpdateTag.UPDATE_BOUNDS)&&mn.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 zt(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):J(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]:Ra;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]:Ra;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,Ma,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?mn.transformUtil.fromMatrix(h,h).translate(e,i):(o.x=(null!==(n=o.x)&&void 0!==n?n:Hi.x)+e,o.y=(null!==(r=o.y)&&void 0!==r?r:Hi.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,Ma,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,Ea,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 ue,h.postMatrix=t),mn.transformUtil.fromMatrix(t,t).scale(e,i,n)}else h.scaleX=(null!==(r=h.scaleX)&&void 0!==r?r:Hi.scaleX)*e,h.scaleY=(null!==(s=h.scaleY)&&void 0!==s?s:Hi.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,Ea,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,ka,r);s&&(delete s.angle,this._setAttributes(s,!1,r));const a=this.attribute;if(i){let{postMatrix:t}=this.attribute;t||(t=new ue,a.postMatrix=t),mn.transformUtil.fromMatrix(t,t).rotate(e,i)}else a.angle=(null!==(n=a.angle)&&void 0!==n?n:Hi.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,ka,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 rs(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||(mn.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)&&(!!J(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:os.duration,null!==(h=null===(o=this.stateAnimateConfig)||void 0===o?void 0:o.easing)&&void 0!==h?h:os.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();pt(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 Pa.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Pa),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=Hi.x,y:e=Hi.y,scaleX:i=Hi.scaleX,scaleY:n=Hi.scaleY,angle:r=Hi.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=Ot(a),g=Dt(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),mn.transformUtil.fromMatrix(a,a).scale(i,n,{x:h[0],y:h[1]})}const c=this.getOffsetXY(Hi);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ba.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),mn.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=ra(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=ra(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=ra(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:mn.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 st(t,!0)?this.pathProxy=(new Ni).fromString(t):this.pathProxy=new Ni,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")?(Ca.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(ct(t)||t.includes("/")||ut(t))&&(Ca.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):et(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",mn.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const r=new Gr(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)}}}Ia.mixin(Vr);class Da{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 ja(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r+e.length-1}function Ua(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 Wa=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class Na{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,Wa),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 Da("!xml");let i=e,n="",r="";for(let s=0;s<t.length;s++)if("<"===t[s])if("/"===t[s+1]){const e=ja(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=Ua(t,s,!1,"?>").closeIndex+1;else if("!--"===t.substr(s+1,3))s=ja(t,"--\x3e",s+4,"Comment is not closed.");else{const a=Ua(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 Da(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 Da(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 Ga(t,e){return Fa(t)}function Fa(t,e){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=za(r);if(void 0!==s&&r[s]){const t=Fa(r[s]);n=t,Object.keys(n).length,r[":@"]&&Ha(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 za(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function Ha(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 Va{constructor(t){this.options=Object.assign({},Va.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;return Ga(new Na(this.options).parseXml(t),this.options)}}function Ya(t){return t.startsWith("<svg")||t.startsWith("<?xml")}function Xa(t){return t.startsWith("<")}Va.defaultOptions={};var $a=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 qa(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 Ka=0;function Za(){return Ka++}var Ja;function Qa(e){const i=[];let n=0,r="";for(let s=0;s<e.length;s++)io(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,(Ja=t.TextDirection||(t.TextDirection={}))[Ja.HORIZONTAL=0]="HORIZONTAL",Ja[Ja.VERTICAL=1]="VERTICAL";const to=new Map;["…","(",")","—","【","】","「","」","《","》"].forEach((t=>to.set(t,!0)));const eo=new Map;function io(t){if(to.has(t))return!0;if(eo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}function no(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=>eo.set(t,!0)));const ro=Za(),so=Za(),ao=Za(),oo=Za(),ho=Za(),lo=Za(),co=Za(),uo=Za(),po=Za(),fo=Za(),go=Za(),vo=Za(),mo=Za(),yo=Za(),bo=Za(),xo=Za(),wo=Symbol.for("GraphicService"),So=Symbol.for("GraphicCreator"),Ao={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity"},To=Object.keys(Ao),Co={"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"},_o=Object.keys(Co);var Bo;t.GroupUpdateAABBBoundsMode=void 0,(Bo=t.GroupUpdateAABBBoundsMode||(t.GroupUpdateAABBBoundsMode={}))[Bo.LESS_GROUP=0]="LESS_GROUP",Bo[Bo.MORE_GROUP=1]="MORE_GROUP";class Po extends Ia{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 Er),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Er)}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 zt(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;mn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),mn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=Hi.x,y:e=Hi.y,dx:i=Hi.dx,dy:n=Hi.dy,scaleX:r=Hi.scaleX,scaleY:s=Hi.scaleY,angle:a=Hi.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 Or(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 mn.graphicService.updateTempAABBBounds(i),mn.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(),mn.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),mn.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,mn.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{mn.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),mn.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=mn.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new Po(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Po.NOWORK_ANIMATE_ATTR}}function Ro(t){return new Po(t)}Po.NOWORK_ANIMATE_ATTR=La;class Mo extends Po{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 Er,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=>{mn.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=>{mn.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 Eo=Symbol.for("TransformUtil"),ko=Symbol.for("GraphicUtil"),Oo=Symbol.for("LayerService"),Lo=Symbol.for("StaticLayerHandlerContribution"),Io=Symbol.for("DynamicLayerHandlerContribution"),Do=Symbol.for("VirtualLayerHandlerContribution");var jo,Uo=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},Wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};t.DefaultLayerService=jo=class{static GenerateLayerId(){return`${jo.idprefix}_${jo.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=mn.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?jn.get(Lo):"dynamic"===t?jn.get(Io):jn.get(Do),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 Mo(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:n,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:jo.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=jo=Uo([g(),Wo("design:paramtypes",[])],t.DefaultLayerService);var No=new i((e=>{e(W).to(t.DefaultGlobal).inSingletonScope(),e(br).to(t.DefaultWindow),e(ko).to(t.DefaultGraphicUtil).inSingletonScope(),e(Eo).to(t.DefaultTransformUtil).inSingletonScope(),e(Oo).to(t.DefaultLayerService).inSingletonScope()}));function Go(t,e){return!(!t&&!e)}function Fo(t,e){let i;return i=at(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function zo(t,e,i){return i&&t*e>0}function Ho(t,e,i,n,r){return r&&t*e>0&&0!==i&&0!==n}function Vo(t,e){return t*e>0}function Yo(t,e,i,n){return t*e>0&&0!==i&&0!==n}function Xo(t,e,i,n,r,s,a,o){if(!t.pathProxy)return!1;const h=Or(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=zo(u,d,l),b=Vo(u,f),x=Go(l),w=Fo(c,p);if(!g)return!0;if(!x&&!w)return!0;if(!(y||b||a||o))return!0;e.beginPath();return Je(("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 $o(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<_t?[]:(d=(c*(e-s)-u*(t-r))/d,[t+d*h,e+d*l])}function qo(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 Ko(t,e,i,n,r){const s=Et(i-e),a=t.getParsedCornerRadius(),o=at(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*Ot(c),A=r*Dt(c),T=n*Ot(d),C=n*Dt(d);let _,B,P,R;if((b>_t||y>_t)&&(_=r*Ot(u),B=r*Dt(u),P=n*Ot(p),R=n*Dt(p),s<Bt)){const t=$o(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/Dt(function(t){return t>1?0:t<-1?Bt:Math.acos(t)}((e*s+i*a)/(jt(e*e+i*i)*jt(s*s+a*a)))/2),h=jt(t[0]*t[0]+t[1]*t[1]);w=It(b,(n-h)/(o-1)),x=It(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 Zo(t,e,i,n,r,s,a){const{startAngle:o,endAngle:h}=t.getParsedAngle(),l=Et(h-o),c=h>o;let u=!1;if(r<s){const t=r;r=s,s=t}if(r<=_t)e.moveTo(i,n);else if(l>=Mt-_t)e.moveTo(i+r*Ot(o),n+r*Dt(o)),e.arc(i,n,r,o,h,!c),s>_t&&(e.moveTo(i+s*Ot(h),n+s*Dt(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}=Ko(t,o,h,s,r);if(l<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,n+p),u=!0;else if(v>_t){const t=It(m,v),s=It(y,v),o=qo(f,g,d,p,r,t,Number(c)),h=qo(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,kt(o.y01,o.x01),kt(h.y01,h.x01),!c)):e.moveTo(i+o.cx+v*Ot(kt(h.y01,h.x01)),n+o.cy+v*Dt(kt(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,kt(o.y01,o.x01),kt(o.y11,o.x11),!c),e.arc(i,n,r,kt(o.cy+o.y11,o.cx+o.x11),kt(h.cy+h.y11,h.cx+h.x11),!c),s>0&&e.arc(i+h.cx,n+h.cy,s,kt(h.y11,h.x11),kt(h.y01,h.x01),!c)):s>0?e.moveTo(i+h.cx+s*Ot(kt(h.y01,h.x01)),n+h.cy+s*Dt(kt(h.y01,h.x01))):e.moveTo(i+x,n+r*Dt(C))}else!a||a[0]?(e.moveTo(i+d,n+p),e.arc(i,n,r,T,C,!c)):e.moveTo(i+r*Ot(C),n+r*Dt(C));if(!(s>_t)||B<.001)!a||a[1]?e.lineTo(i+S,n+A):e.moveTo(i+S,n+A),u=!0;else if(_>_t){const t=It(M,_),r=It(E,_),o=qo(S,A,x,w,s,-r,Number(c)),h=qo(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=kt(h.y01,h.x01);!a||a[2]?e.arc(i+o.cx,n+o.cy,_,kt(o.y01,o.x01),t,!c):e.moveTo(i+o.cx+Ot(t),n+o.cy+Dt(t))}else!a||a[2]?(r>0&&e.arc(i+o.cx,n+o.cy,r,kt(o.y01,o.x01),kt(o.y11,o.x11),!c),e.arc(i,n,s,kt(o.cy+o.y11,o.cx+o.x11),kt(h.cy+h.y11,h.cx+h.x11),c),t>0&&e.arc(i+h.cx,n+h.cy,t,kt(h.y11,h.x11),kt(h.y01,h.x01),!c)):t>0?e.moveTo(i+h.cx+t*Ot(kt(h.y01,h.x01)),n+h.cy+t*Dt(kt(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*Ot(R),n+s*Dt(R))}return a?a[3]&&e.lineTo(i+r*Ot(o),n+r*Dt(o)):e.closePath(),u}class Jo{static GetCanvas(){try{return Jo.canvas||(Jo.canvas=mn.global.createCanvas({})),Jo.canvas}catch(t){return null}}static GetCtx(){if(!Jo.ctx){const t=Jo.GetCanvas();Jo.ctx=t.getContext("2d")}return Jo.ctx}}class Qo extends de{static getInstance(){return Qo._instance||(Qo._instance=new Qo),Qo._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=Jo.GetCanvas(),n=Jo.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 Qo(r,s),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class th{static GetSize(t){for(let e=0;e<th.ImageSize.length;e++)if(th.ImageSize[e]>=t)return th.ImageSize[e];return t}static Get(t,e,i,n,r,s,a){const o=th.GenKey(t,e,i,n,r),h=th.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=th.GenKey(t,e,i,n,r);th.cache[h]?th.cache[h].push({width:a,height:o,pattern:s}):th.cache[h]=[{width:a,height:o,pattern:s}]}static GenKey(t,e,i,n,r){return`${e},${i},${n},${r},${t.join()}`}}function eh(t,e,i,n){const{stops:r,startAngle:s,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;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),ra(o.color,h.color,l,!1)}function ih(t,e,i,n,r,s,a,o,h){const l=Math.floor(180*r/Math.PI),c=Jo.GetCanvas(),u=Jo.GetCtx();if(!u)return null;const d=th.GetSize(o),p=th.GetSize(h);let f=th.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=Qo.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&&th.Set(e,i,n,s,a,f,d,p),f}th.cache={},th.ImageSize=[20,40,80,160,320,640,1280,2560];const nh=Symbol.for("ArcRenderContribution"),rh=Symbol.for("AreaRenderContribution"),sh=Symbol.for("CircleRenderContribution"),ah=Symbol.for("GroupRenderContribution"),oh=Symbol.for("ImageRenderContribution"),hh=Symbol.for("PathRenderContribution"),lh=Symbol.for("PolygonRenderContribution"),ch=Symbol.for("RectRenderContribution"),uh=Symbol.for("SymbolRenderContribution"),dh=Symbol.for("TextRenderContribution"),ph=Symbol.for("CommonRenderContribution"),fh=Symbol.for("InteractiveSubRenderContribution");function gh(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function vh(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 mh(t){const e={},i=t=>/^\d+(\.\d+)?$/.test(`${t}`)?`${t}px`:`${t}`;return["textAlign","fontFamily","fontVariant","fontStyle","fontWeight"].forEach((i=>{t[i]&&(e[Ce(i)]=t[i])})),["fontSize","lineHeight"].forEach((n=>{const r=Ce(n);J(t[n])||(e[r]=i(t[n]))})),Q(t.maxLineWidth)&&(e["max-width"]=i(t.maxLineWidth)),t.underline?e["text-decoration"]="underline":t.lineThrough&&(e["text-decoration"]="line-through"),t.fill&&st(t.fill)&&(e.color=t.fill),e}function yh(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 bh(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 xh(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 wh(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 Sh(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 Ah(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 Th(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 Ch(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 _h(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)<_t&&Math.abs(g-w)<_t&&Math.abs(v-S)<_t?yh(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 Bh(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 Ph(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 Rh=Symbol.for("MatrixAllocate"),Mh=Symbol.for("Mat4Allocate");function Eh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class kh{constructor(){this.pools=[]}allocate(t,e,i,n,r,s){if(!this.pools.length)return new ue(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 ue(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 Oh{constructor(){this.pools=[]}static identity(t){return yh(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 Oh.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 Lh=new kh,Ih=new Oh;var Dh=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},jh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uh=function(t,e){return function(i,n){e(i,n,t)}};function Wh(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(yh(t),Sh(t,t,[r+o,s+h,a+l]),Sh(t,t,[y[0],y[1],y[2]]),bh(t,t,f),xh(t,t,p),Sh(t,t,[-y[0],-y[1],y[2]]),Th(t,t,[c,u,d]),g){const i=Ih.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]}Sh(i,i,[n[0],n[1],0]),wh(i,i,g),Sh(i,i,[-n[0],-n[1],0]),Ch(t,t,i)}}function Nh(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 Be(t);return Je(i.commandList,n,0,0),!0}updateHTMLTextAABBBounds(t,e,i,n){const{textAlign:r,textBaseline:s}=t;if(null!=t.forceBoundsHeight){const e=ht(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),n=vh(s,e,e);i.set(i.x1,n,i.x2,n+e)}if(null!=t.forceBoundsWidth){const e=ht(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),n=gh(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){qa(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;qa(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&&oe(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),mn.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=Dh([g(),Uh(0,p(So)),jh("design:paramtypes",[Object])],t.DefaultGraphicService);const Gh={x:0,y:0,z:0,lastModelMatrix:null};class Fh{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=zo(o,h,r),p=Vo(o,c),f=Go(r,s),g=Fo(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;Gh.x=r,Gh.y=s,Gh.z=a,Gh.lastModelMatrix=u;const p=d&&(n||Nh(t)),f=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===h&&0===l&&!c;if(p){const n=Ih.allocate(),r=Ih.allocate();Wh(r,t,e),Ch(n,u||n,r),Gh.x=0,Gh.y=0,Gh.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),Ih.free(r)}if(f&&!u){const n=t.getOffsetXY(e);Gh.x+=n.x,Gh.y+=n.y,Gh.z=a,i.setTransformForCurrent()}else if(p)Gh.x=0,Gh.y=0,Gh.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const n=t.getOffsetXY(e);Gh.x+=n.x,Gh.y+=n.y,this.transformWithoutTranslate(i,Gh.x,Gh.y,Gh.z,o,h,l)}else i.transformFromMatrix(t.transMatrix,!0),Gh.x=0,Gh.y=0,Gh.z=0;return Gh}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,Xo(t,s,h,l,0,r)||(this.drawShape(t,s,h,l,n,r),this.z=0,s.modelMatrix!==u&&Ih.free(s.modelMatrix),s.modelMatrix=u),s.highPerformanceRestore()}}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)}};class Yh{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=Or(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=vr.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),vr.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 Xh=new Yh;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=zh([g(),Vh(0,p(k)),Vh(0,v(fh)),Hh("design:paramtypes",[Object])],t.DefaultBaseInteractiveRenderContribution);class $h{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=vr.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])),vr.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,Mt),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 qh=new $h;class Kh{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:xn(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(),Zo(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 Zh=new Kh,Jh=qh,Qh=Xh;class tl{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:xn(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 el=new tl,il=qh,nl=Xh;class rl extends Yh{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 sl=new rl,al=Bt/2;function ol(t,e,i,n,r,s,a){let o;if(n<0&&(e+=n,n=-n),r<0&&(i+=r,r=-r),ht(s,!0))o=[s=Et(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=Et(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Et(t[0]),i=Et(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Et(o[0]),o[1]=Et(o[1]),o[2]=Et(o[2]),o[3]=Et(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]),!mt(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],-al,0,!1)}if(a&&a[1]?a[1](m[0],m[1],b[0],b[1]):t.lineTo(b[0],b[1]),!mt(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,al,!1)}if(a&&a[2]?a[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!mt(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],al,Bt,!1)}if(a&&a[3]?a[3](w[0],w[1],g[0],g[1]):t.lineTo(g[0],g[1]),!mt(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],Bt,Bt+al,!1)}return!a&&t.closePath(),t}var hl=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 ll{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:xn(e,l,e.dpr),d=i+o*c,p=n+o*c,f=2*c;if(0===v||at(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*f,_-o*f)):(e.beginPath(),ol(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=hl([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||at(m)&&m.every((t=>0===t)))){let r,s=0;return ol(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=hl([g()],t.SplitRectAfterRenderContribution);const cl=new ll,ul=qh,dl=Xh;class pl extends ll{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 fl=new pl,gl=Xh;class vl{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:xn(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 ml=new vl,yl=qh,bl=Xh;class xl extends $h{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:Ss(h,"texture")),textureColor:b=(null!==(f=t.attribute.textureColor)&&void 0!==f?f:Ss(h,"textureColor")),textureSize:x=(null!==(g=t.attribute.textureSize)&&void 0!==g?g:Ss(h,"textureSize")),texturePadding:w=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:Ss(h,"texturePadding"))}=m;y&&this.drawTexture(y,t,e,i,n,h,b,x,w)}}var wl=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},Sl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Al=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasArcRender=class extends Fh{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=ro,this.builtinContributions=[Zh,Qh,Jh],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}=Ko(t,c,u,s,r);if(b>_t){const t=It(x,b),s=It(w,b),a=qo(m,y,g,v,r,t,Number(d)),o=qo(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,kt(a.y01,a.x01),kt(o.y01,o.x01),!d);else{const t=u-h-.03,a=kt(o.y11,o.x11);e.arc(i,n,r,t,a,!d),s>0&&e.arc(i+o.cx,n+o.cy,s,kt(o.y11,o.x11),kt(o.y01,o.x01),!d)}}else e.moveTo(i+g,n+v);if(!(s>_t)||P<.001)e.lineTo(i+C,n+_),p=!0;else if(B>_t){const t=It(M,B),r=It(E,B),a=qo(C,_,A,T,s,-r,Number(d)),o=qo(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=kt(o.y01,o.x01);e.arc(i+a.cx,n+a.cy,B,kt(a.y01,a.x01),t,!d)}else{r>0&&e.arc(i+a.cx,n+a.cy,r,kt(a.y01,a.x01),kt(a.y11,a.x11),!d);const t=kt(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*Ot(R),n+s*Dt(R));return p}drawShape(t,e,i,n,r,s,a,o){const h=Or(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 _=(K(w)&&w||w[0])&&"conical"===l.gradient;if(_){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Et(n-i)<Mt-_t&&(C=e||0,l.startAngle-=C,l.endAngle-=C)}let B=!1;const{isFullStroke:P,stroke:R}=us(c);if(m||P){e.beginPath(),Zo(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(),Zo(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())),(K(w)&&w||w[1])&&S){const{startAngle:s,endAngle:l}=t.getParsedAngle();if(Et(l-s)>=Mt-_t){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=eh(0,0,l,r);a||zo&&(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=Or(t,null==n?void 0:n.theme).arc;this._draw(t,r,!1,i,n)}},t.DefaultCanvasArcRender=wl([g(),Al(0,p(k)),Al(0,v(nh)),Sl("design:paramtypes",[Object])],t.DefaultCanvasArcRender);var Tl=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},Cl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_l=function(t,e){return function(i,n){e(i,n,t)}};function Bl(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]=ri(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 Pl(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:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=h:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),n){l=!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&&(l=!n,t.lineTo(d.x+r,d.y+s,a))}return l}function Rl(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=Pl(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),Bl(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=Pl(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),Bl(e,i,It(r,1),s),u=!1}}}function Ml(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 El(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 Fh{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=oo,this.builtinContributions=[el,nl,il],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const h=Or(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=Or(t,null==n?void 0:n.theme).circle;this._draw(t,r,!1,i,n)}},t.DefaultCanvasCircleRender=Tl([g(),_l(0,p(k)),_l(0,v(sh)),Cl("design:paramtypes",[Object])],t.DefaultCanvasCircleRender);var kl=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 Ol(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),Ll(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),Ll(e,t,i,r),t.length=0,i.length=0)}n=h})),Ll(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?(Il(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]))}Il(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=Et(d.x-u[0].p0.x),f=Et(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),Ll(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),Ll(e,y,b,r),y.length=0,b.length=0)}x=n}else{let s=null,a=null;m!==n.defined?(m?(Il(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?ri(s,o)[0]:ai(s,o)[0],a=a.p2&&a.p3?ri(a,1-o)[1]:ai(a,1-o)[1]),s.defined=m,a.defined=m,y.push(s),b.push(a)),s=null,a=null}}a?Ll(e,y,b,r):Il(e,y,b,r)}function Ll(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 Il(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),Bl(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),Bl(t,h,1,n),o=!1):o=!0}t.closePath()}t.DefaultCanvasLineRender=class extends Fh{constructor(){super(...arguments),this.numberType=uo}draw(t,e,i,n){const r=Or(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;Rl(t.camera?t:t.nativeContext,e,h,l,{offsetX:c,offsetY:u,offsetZ:x}),d.cache&&!at(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(at(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(),Rl(t.camera?t:t.nativeContext,e,h,l,{offsetX:c,offsetY:u,offsetZ:x,drawConnect:!0,mode:A,zeroX:T,zeroY:C});const g=[];at(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=Or(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=Wi(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=Wi(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],It(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=kl([g()],t.DefaultCanvasLineRender);const Dl=new xl,jl=Xh;var Ul=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)},Nl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasAreaRender=class extends Fh{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=ao,this.builtinContributions=[Dl,jl],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(at(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=Or(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=Wi(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=Wi(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=Wi(e,P,{curveTension:x}),r=Wi(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],It(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=Or(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&&(at(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"),at(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=Et(R.x-M.x),O=Et(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,Ol(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;at(n)&&(n[0]||n[2])&&!1===n[1]&&(e.beginPath(),Rl(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=Ul([g(),Nl(0,p(k)),Nl(0,v(rh)),Wl("design:paramtypes",[Object])],t.DefaultCanvasAreaRender);const Gl=qh,Fl=Xh;var zl=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},Hl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasPathRender=class extends Fh{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=po,this.builtinContributions=[Fl,Gl],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:Or(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)Je(t.pathShape.commandList,e,i,n,1,1,g);else{Je((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=Or(t,null==n?void 0:n.theme).path;this.tempTheme=r,this._draw(t,r,!1,i,n),this.tempTheme=null}},t.DefaultCanvasPathRender=zl([g(),Vl(0,p(k)),Vl(0,v(hh)),Hl("design:paramtypes",[Object])],t.DefaultCanvasPathRender);var Yl=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},Xl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$l=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasRectRender=class extends Fh{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=vo,this.builtinContributions=[cl,dl,ul],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var h;const l=null!==(h=this.tempTheme)&&void 0!==h?h:Or(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 _=Ho(f,g,T,C,c),B=Yo(f,m,T,C),P=Go(c,u),R=Fo(d,v);if(!t.valid||!y)return;if(!P&&!R)return;if(!(_||B||a||o||u))return;0===p||at(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,n,T,C)):(e.beginPath(),ol(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=Or(t,null==n?void 0:n.theme).rect;this.tempTheme=r,this._draw(t,r,!1,i,n),this.tempTheme=null}},t.DefaultCanvasRectRender=Yl([g(),$l(0,p(k)),$l(0,v(ch)),Xl("design:paramtypes",[Object])],t.DefaultCanvasRectRender);var ql=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},Kl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zl=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultCanvasSymbolRender=class extends Fh{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=bo,this.builtinContributions=[ml,bl,yl],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var h;const l=Or(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,at(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=Or(t,null==n?void 0:n.theme).symbol;this._draw(t,r,!1,i,n)}},t.DefaultCanvasSymbolRender=ql([g(),Zl(0,p(k)),Zl(0,v(uh)),Kl("design:paramtypes",[Object])],t.DefaultCanvasSymbolRender);const Jl=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 Ql=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=Ql.CreateGraphic("text",{})),tc.initAttributes(t),tc.AABBBounds}const nc=new class extends Yh{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=et(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=Jl.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,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?(ol(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&&Jl.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 Fh{constructor(t){super(),this.textRenderContribitions=t,this.numberType=xo,this.builtinContributions=[nc],this.init(t)}drawShape(t,e,i,n,r,s,a,o){var h,l,c;const u=Or(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=_s(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=Lh.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Lh.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=Lt(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=Or(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=!J(c),y=m?c.width:i.clipedWidth,b=m?0:gh(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=rc([g(),ac(0,p(k)),ac(0,v(dh)),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 hc(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 lc(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=qh,dc=Xh;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 Fh{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=fo,this.builtinContributions=[dc,uc],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const h=Or(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||at(c)&&c.every((t=>0===t))?hc(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 hc(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=lc(u,d),x=lc(p,f),w=Math.min(b,x);y>w&&(y=w,m=w*v);const S=cc(l,y,b,u,d),A=cc(l,y,x,p,f),T=2*l.x-S.x-A.x,C=2*l.y-S.y-A.y,_=lc(T,C),B=cc(l,lc(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=Or(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(lh)),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,h){const l=Or(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,_=Ho(p,m,f,g,c),B=Yo(p,y,f,g),P=Go(c,u),R=Fo(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||at(b)&&b.every((t=>0===t))?(i.beginPath(),i.rect(n,r,f,g)):(i.beginPath(),ol(i,n,r,f,g,b));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(sl));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=Or(t,null==n?void 0:n.theme).group,l=r.modelMatrix;if(r.camera){const e=Ih.allocate(),i=Ih.allocate();Wh(i,t,h),Ch(e,l||e,i),r.modelMatrix=e,Ih.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&&Ih.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=vc([g(),yc(0,p(k)),yc(0,v(ah)),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 Fh{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=co,this.builtinContributions=[fl,gl],this.init(t)}drawShape(t,e,i,n,r,s,a,o){const h=Or(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;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;let T=!1;0===g||at(g)&&g.every((t=>0===t))||(e.beginPath(),ol(e,i,n,l,c,g),e.save(),e.clip(),T=!0),this.beforeRenderStep(t,e,i,n,w,!1,b,!1,h,r,a),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h);const C=()=>{if(w)if(a)a(e,t.attribute,h);else if(b){e.setCommonStyle(t,t.attribute,i,n,h);let r=0;if("repeat"===u&&(r|=1),"repeat"===d&&(r|=2),r){const t=e.createPattern(A.data,Sc[r]);e.fillStyle=t,e.translate(i,n,!0),e.fillRect(0,0,l,c),e.translate(-i,-n,!0)}else e.drawImage(A.data,i,n,l,c)}},_=()=>{S&&(o?o(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,p-i,f-n,h),e.stroke()))};v?(_(),C()):(C(),_()),this.afterRenderStep(t,e,i,n,w,!1,b,!1,h,r,a),T&&e.restore()}draw(t,e,i){const{image:n}=t.attribute;if(!n||!t.resources)return;const r=t.resources.get(n);if("loading"===r.state&&st(n))return void Ca.improveImageLoading(n);if("success"!==r.state)return;const{context:s}=e.drawParams;if(!s)return;const a=Or(t).image;this._draw(t,a,!1,i)}},t.DefaultCanvasImageRender=bc([g(),wc(0,p(k)),wc(0,v(oh)),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===so,!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+=Mt;for(;o<0;)o+=Mt;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;if(s.highPerformanceSave(),s.transformFromMatrix(t.transMatrix,!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,Lh.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=Ql.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 h=Ih.allocate();Ah(h,o);const l=s.modelMatrix;if(l){if(h){const t=Ih.allocate();s.modelMatrix=Ch(t,l,h)}}else s.modelMatrix=h;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!==l&&Ih.free(s.modelMatrix),s.modelMatrix=l,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"),hu=Symbol.for("GlobalPickerService"),lu=(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",...Ra];class uu extends Ia{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=oo}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 Or(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}=mn.graphicService.updateTempAABBBounds(i);return lu(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2),mn.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>Mt-_t?i.set(-s,-s,s,s):vs(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 Ni;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=La;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: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 fu=["text","maxLineWidth","maxWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...Ra];class gu extends Ia{get font(){const t=this.getGraphicTheme();return this._font||(this._font=se(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=xo,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return at(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Or(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=te(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}=mn.graphicService.updateTempAABBBounds(i),{scaleX:s=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:h=e.strokeBoundsBuffer}=t;if(o){qa(r,o/Math.abs(s+a),!0,h),i.union(r)}return mn.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||mn.graphicService.updateHTMLTextAABBBounds(t,e,i),oe(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=mn.graphicUtil.textMeasure,S=new pu(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=mn.graphicUtil.textMeasure,T={fontSize:h,fontWeight:f,fontFamily:s,lineHeight:S},C=new pu(s,T,A),_=at(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=mn.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=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=Lt(e,a)}));const t=gh(y,a),e=this.cache.verticalList.length*m,i=vh(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=>Qa(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=Lt(e,a)}));const w=gh(y,a),S=this.cache.verticalList.length*m,A=vh(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=_s(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},La),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 at(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=_s(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=mn.graphicUtil.textMeasure,A=new pu(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<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(ht(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 ht(t)?t:Math.min(t[0],t[1])}}function wu(t,e,i,n,r){return r?t.arc(i,n,e,0,Rt,!1,r):t.arc(i,n,e,0,Rt),!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(Rt/10)*ku,Lu=-Math.cos(Rt/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=Rt*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 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=jt(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=jt(3)/2,Yu=1/jt(12);function Xu(t,e,i,n){const r=e/2,s=e*Yu,a=r,o=e*Yu+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(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*h-Vu*l+i,Vu*h+Hu*l+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*h+Vu*l+i,Hu*l-Vu*h+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=jt(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 hd(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 ld=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 hd(t,this.parseSize(e)/4,i,n)}drawOffset(t,e,i,n,r){return hd(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 ht(e)?bd(t,e,i,n):yd(t,e,i,n)}drawOffset(t,e,i,n,r){return ht(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,at(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(),Je(r.path.commandList,t,i,n,e,e),a&&a(r.path,r.attribute)})),!1):(Je(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 ht(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,ld,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",...Ra];let Pd=class t extends Ia{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=bo}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return at(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===Ya(i)){const e=new Va,{svg:n}=e.parse(i);if(!n)return null;const r=at(n.path)?n.path:[n.path];_d.clear();const s=[];r.forEach((t=>{const e=(new Ni).fromString(t.d),i={};_o.forEach((e=>{t[e]&&(i[Co[e]]=t[e])})),s.push({path:e,attribute:i}),_d.union(e.bounds)}));const a=_d.width(),o=_d.height(),h=1/Lt(a,o);return s.forEach((t=>t.path.transform(0,0,h,h))),this._parsedPath=new Sd(i,s,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}const r=(new Ni).fromString(i),s=r.bounds.width(),a=r.bounds.height(),o=1/Lt(s,a);return r.transform(0,0,o,o),this._parsedPath=new Sd(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Or(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}=mn.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;qa(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 mn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:n=e.size}=t;if(at(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=at(e)?e:[e,e];return t.path?(new Ni).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ni).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},La);const Md=["segments","points","curveType","curveTension",...Ra];let Ed=class t extends Ia{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=uo}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=bs(i,n,e))}getGraphicTheme(){return Or(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),mn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return mn.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 Ni,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},La);const Od=["width","x1","y1","height","cornerRadius",...Ra];class Ld extends Ia{constructor(t){super(t),this.type="rect",this.numberType=vo}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Or(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}=mn.graphicService.updateTempAABBBounds(i);return lu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),mn.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}=Gs(t),s=new Ni;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=La;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=mo}findFace(){const t={polygons:[],vertices:[],edges:[]},e=this.getGraphicTheme(),{x1:i,y1:n,x:r,y:s,length:a=It(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<Dd.length;e++){const i=Dd[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 jd.NOWORK_ANIMATE_ATTR}}function Ud(t){return new jd(t)}jd.NOWORK_ANIMATE_ATTR=La;class Wd extends Ia{constructor(t){super(t),this.type="glyph",this.numberType=ho,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 Or(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=La;class Gd{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=Sn[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 Fd{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const n=_s(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}=kn(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}=kn(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=Rn(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}=kn(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=Rn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:n}=kn(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const zd=["width","height","image",...Ra];class Hd extends Ia{constructor(t){super(t),this.type="image",this.numberType=co,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 Or(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}=mn.graphicService.updateTempAABBBounds(i);return lu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),mn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return fn[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},La);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=ps(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(at(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=ps(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=fn.width,height:e=fn.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=Sn[this.direction],this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Fd){const e=Bn.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 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}=kn(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||Tn;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,Pn(t,e)})(t,e.character),function(t,e,i){const n=e&&e.fill||An;if(!n)return void(t.globalAlpha=0);const{fillOpacity:r=1,opacity:s=1}=e;t.globalAlpha=r*s,t.fillStyle=i?wn(t,n,{AABBBounds:i}):n,Pn(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}=kn(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=Sn[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=Rn(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",...Ra];class Kd extends Ia{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=yo,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:pn.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:pn.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:pn.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:pn.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:pn.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:pn.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:pn.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:pn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Or(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),mn.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||mn.graphicService.updateHTMLTextAABBBounds(t,e,i),mn.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: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 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(ht(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,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 $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 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 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},La);const Jd=["path","customPath",...Ra];class Qd extends Ia{constructor(t){super(t),this.type="path",this.numberType=po}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 Ni?e.path:(J(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ni?this.cache:t.path)}getGraphicTheme(){return Or(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:n,tb2:r}=mn.graphicService.updateTempAABBBounds(i);lu(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:s=e.lineJoin}=t;return mn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;st(t.path,!0)?this.cache=(new Ni).fromString(t.path):t.customPath&&(this.cache=new Ni,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jd)}needUpdateTag(t){return super.needUpdateTag(t,Jd)}toCustomPath(){return(new Ni).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},La);const ep=["segments","points","curveType","curveTension",...Ra];class ip extends Ia{constructor(t){super(t),this.type="area",this.numberType=ao}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 Or(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),mn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return mn.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=bs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,ep)}needUpdateTag(t){return super.needUpdateTag(t,ep)}toCustomPath(){const t=new Ni,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},La);const rp=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ra];class sp extends Ia{constructor(t){super(t),this.type="arc",this.numberType=ro}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(ht(t,!0)?t:a*parseFloat(t)/100,a/2);if(at(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=Yt(e),i=e+s,n&&Et(s)<Mt-_t){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>_t&&o>_t)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=jt(a*a+o*o)}=this.attribute,l=Et(e-t);let c=t,u=e,d=t,p=e;const f=s/2;let g=l,v=l;if(f>_t&&h>_t){const i=e>t?1:-1;let n=Wt(Number(h)/o*Dt(f)),r=Wt(Number(h)/a*Dt(f));return(g-=2*n)>_t?(n*=i,d+=n,p-=n):(g=0,d=p=(t+e)/2),(v-=2*r)>_t?(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 Or(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}=mn.graphicService.updateTempAABBBounds(i);lu(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2);const{lineJoin:a=e.lineJoin}=t;return mn.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<=_t?i.set(0,0,0,0):Math.abs(o-h)>Mt-_t?i.set(-n,-n,n,n):(vs(h,o,n,i),vs(h,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),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(n=r.outerPadding)&&void 0!==n?n:0);const l=Et(a-s),c=a>s;if(h<o){const t=h;h=o,o=t}const u=new Ni;if(h<=_t)u.moveTo(0,0);else if(l>=Mt-_t)u.moveTo(0+h*Ot(s),0+h*Dt(s)),u.arc(0,0,h,s,a,!c),o>_t&&(u.moveTo(0+o*Ot(a),0+o*Dt(a)),u.arc(0,0,o,a,s,c));else{const t=h*Ot(s),e=h*Dt(s),i=o*Ot(a),n=o*Dt(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 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},La);class op extends sp{constructor(t){super(t),this.type="arc3d",this.numberType=so}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),mn.graphicService.updateTempAABBBounds(i),mn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getNoWorkAnimateAttr(){return op.NOWORK_ANIMATE_ATTR}}function hp(t){return new op(t)}op.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},La);const lp=["points","cornerRadius",...Ra];class cp extends Ia{constructor(t){super(t),this.type="polygon",this.numberType=fo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Or(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),mn.graphicService.updateTempAABBBounds(i);const{lineJoin:n=e.lineJoin}=t;return mn.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=bs(i,n,e))}needUpdateTags(t){return super.needUpdateTags(t,lp)}needUpdateTag(t){return super.needUpdateTag(t,lp)}toCustomPath(){const t=this.attribute.points,e=new Ni;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=La;class dp extends cp{constructor(t){super(t),this.type="pyramid3d",this.numberType=go}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)})),mn.graphicService.updateTempAABBBounds(i),mn.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=Ht.distancePP(i[t].p,i[t+1].p);i[t].d=e,i[t+1].d=e,r=Lt(r,e);const a=Ht.distancePP(i[s].p,i[s+1].p);i[s].d=a,i[s+1].d=a,r=Lt(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=La;class fp extends Po{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 h=null===(s=Or(t))||void 0===s?void 0:s[t.type],{shadowPickMode:l=(null==h?void 0:h.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Lh.allocateByObj(a),d=new zt(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=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 zt(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(hu).toSelf(),e(au).toService(hu)),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(wo).to(t.DefaultGraphicService).inSingletonScope(),e(So).toConstantValue(Ql)}));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&&jn.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(Dn).to(t.DefaultTextMeasureContribution).inSingletonScope(),L(e,Dn)})),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=mn.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=Nn({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(Lo).toService(Ep)}));var Op=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 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 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 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 he,this.backupDirtyBounds=new he,this.global=mn.global,this.layerService=mn.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}=Zt(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:Qi.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Qi.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Lh.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,Qi.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&&!Jt(t.AABBBounds,this.dirtyBounds,!1))return;let r,s=i;if(this.useDirtyBounds){r=Jl.allocateByObj(this.dirtyBounds);const e=t.transMatrix;s=Lh.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,Qi.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),Jl.free(r),Lh.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||jn.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 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=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=Lh.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&&!Jt(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 wt.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=wn(e,s,{AABBBounds:{x1:0,y1:0,x2:0+o,y2:0+h}},0,0),e.fillRect(0,0,o,h)}}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=uo}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=Or(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=zo(d,p,c),y=Vo(d,f),b=Go(c),x=Fo(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(),Ml(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=ao}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=Or(t).area,{fill:c=l.fill,fillOpacity:u=l.fillOpacity,opacity:d=l.opacity,visible:p=l.visible}=t.attribute,f=zo(d,u,c),g=Go(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(),El(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{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"}(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:Qi.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Qi.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,Qi.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,Qi.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(Yh).toSelf().inSingletonScope(),e($h).toSelf().inSingletonScope(),e(Fc).to(Gp),e(Ac).to(Zp),e(Rc).to(t.DefaultCanvasGroupRender).inSingletonScope(),e(Pc).toService(Rc),L(e,ah),e(t.DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(),L(e,fh),L(e,Pc),e(t.CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(),e(Yc).toService(t.CommonDrawItemInterceptorContribution),L(e,Yc)}));function Qp(){Qp.__loaded||(Qp.__loaded=!0,jn.load(No),jn.load(bp),jn.load(ru),jn.load(yp),jn.load(_p),function(t){t.load(Bp),t.load(Pp),t.load(kp)}(jn),function(t){t.load(Jp)}(jn))}Qp.__loaded=!1,Qp();const tf=jn.get(W);mn.global=tf;const ef=jn.get(ko);mn.graphicUtil=ef;const nf=jn.get(Eo);mn.transformUtil=nf;const rf=jn.get(wo);mn.graphicService=rf;const sf=jn.get(Oo);mn.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,mn.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),mn.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),mn.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));mn.graphicService.hooks.onAttributeUpdate.taps=e(mn.graphicService.hooks.onAttributeUpdate.taps),mn.graphicService.hooks.onSetStage.taps=e(mn.graphicService.hooks.onSetStage.taps),mn.graphicService.hooks.onRemove.taps=e(mn.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=mn.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=mn.global.getRequestAnimationFrame();this.rafId=t((()=>{mn.global.devicePixelRatio!==this.dpr&&(this.dpr=mn.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=mn.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class hf{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,mn.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))})),mn.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){mn.graphicService.hooks.onAddIncremental.taps=mn.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),mn.graphicService.hooks.onClearIncremental.taps=mn.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,mn.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 lf=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()})),mn.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&&(lf.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(lf,t.parent&&t.parent.globalTransMatrix)))})),mn.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))})),mn.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),mn.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){mn.graphicService.hooks.beforeUpdateAABBBounds.taps=mn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),mn.graphicService.hooks.afterUpdateAABBBounds.taps=mn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),mn.graphicService.hooks.clearAABBBounds.taps=mn.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)),mn.graphicService.hooks.onRemove.taps=mn.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const uf=new Zr;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=mn.global&&mn.global.env;return t?"browser"===t:df}function gf(){pf();const t=mn.global&&mn.global.env;return t?"node"===t:!df}uf.addTimeline(es),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 Po{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 Er,this.hooks={beforeRender:new j(["stage"]),afterRender:new j(["stage"])},this.global=mn.global,!this.global.env&&ff()&&this.global.setEnv("browser"),this.window=jn.get(br),this.renderService=jn.get(iu),this.pluginService=jn.get(wp),this.layerService=jn.get(Oo),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 ts,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&st(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 Xr(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=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 hf))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new he;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 zt(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=jn.get(br),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=jn.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 ue(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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this.path=new Ni,this._clearMatrix=new ue(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 Lh.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Lh.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Lh.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 fr(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=xn(this,this.lineWidth,this.dpr);return function(t,e,i,n){return fr(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=>Lh.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: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)}}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},_f=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())}))};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}}loadFont(t,e,i){return _f(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}},t.BaseEnvContribution=Cf([g()],t.BaseEnvContribution);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},Pf=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 ue(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=Bf([g(),Pf("design:paramtypes",[])],t.BaseWindowHandlerContribution);class Rf{constructor(e,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=e,this.color=i,this.colorRgb=ia.Get(i,t.ColorType.Color1),this.ambient=n;const r=jt(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=It(Lt((e[0]*n[0]+e[1]*n[1]+e[2]*n[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=st(i)?ia.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 Mf=()=>{vf.registerPlugin("DirectionalLight",Rf)};class Ef{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=Ih.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=Ih.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return _h(this._viewMatrixCached,t,e,i),this._vp||(this._vp=Ih.allocate()),this._vp=Ch(this._vp,this.getProjectionMatrix(),this.getViewMatrix()),this._viewMatrixCached}getProjectionMatrix(){return this._projectionMatrixCached||(this._projectionMatrixCached=Ih.allocate()),this._projectionMatrixCached}forceGetProjectionMatrix(){this._projectionMatrixCached||(this._projectionMatrixCached=Ih.allocate());const{left:t,top:e,right:i,bottom:n}=this._params;return Bh(this._projectionMatrixCached,t,i,n,e,0,-2e6),this._vp||(this._vp=Ih.allocate()),this._vp=Ch(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 Ph(n,[t,e,i],this._viewMatrixCached),n}vp(t,e,i){const n=[0,0,0],{pos:r}=this._params.viewParams;Ph(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 kf=()=>{vf.registerPlugin("OrthoCamera",Ef)};var Of=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},Lf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},If=function(t,e){return function(i,n){e(i,n,t)}};t.DefaultPickService=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=mn.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 ue(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=Ih.allocate();if(Ah(i,e),a){if(i){const t=Ih.allocate();s.modelMatrix=Ch(t,a,i),Ih.free(i)}}else Ah(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&&Ih.free(s.modelMatrix),s.modelMatrix=a,r}}const o=t.transMatrix,h=Lh.allocateByObj(i),l=new zt(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||Ip(t,Qi.zIndex,(s=>{if(s.isContainer){const i=new zt(e.x,e.y),a=Or(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 zt(e.x,e.y);h.transformPoint(a,a);const o=Or(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&&Ih.free(s.modelMatrix),s.modelMatrix=a,r.graphic||r.group||!d||t.stage.camera||(r.group=t),Lh.free(h),r}selectPicker(t){return this.pickerMap.get(t.numberType)||null}},t.DefaultPickService=Of([g(),If(0,p(k)),If(0,v(mp)),Lf("design:paramtypes",[Object])],t.DefaultPickService);var Df=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},jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function Uf(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=mn.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 ue(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 zt(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 zt(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=Df([g(),jf("design:paramtypes",[])],t.DefaultGlobalPickerService);class Wf{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=Uf(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=Uf(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=Uf(i,n);const s=this.selectionStartCursorIdx-n;r=Uf(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 Nf{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 Gf="FORMAT_TEXT_COMMAND";class Ff{constructor(){this.pools=[]}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}}class zf extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.rect(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.rect(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Hf=new zf;class Vf extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.arc(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.arc(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Yf=new Vf;class Xf extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.area(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.area(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const $f=new Xf;class qf extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.circle(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.circle(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Kf=new qf;class Zf extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.line(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.line(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const Jf=new Zf;class Qf extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.path(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.path(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const tg=new Qf;class eg extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.symbol(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.symbol(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const ig=new eg;class ng extends Ff{allocate(t){if(!this.pools.length)return mn.graphicService.creator.text(t);const e=this.pools.pop();return e.initAttributes(t),e}allocateByObj(t){if(!this.pools.length)return mn.graphicService.creator.text(t.attribute);const e=this.pools.pop();return e.initAttributes(t.attribute),e}}const rg=new ng;class sg{constructor(){this.map={text:rg,symbol:ig}}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 ag=new sg;let og=!1;const hg=new i((e=>{og||(og=!0,e(t.DefaultCanvasArcRender).toSelf().inSingletonScope(),e(Tc).to(t.DefaultCanvasArcRender).inSingletonScope(),e(Pc).toService(Tc),e(nh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,nh))}));let lg=!1;const cg=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(ch).toService(t.SplitRectAfterRenderContribution),e(ch).toService(t.SplitRectBeforeRenderContribution),e(ch).toService(t.DefaultBaseInteractiveRenderContribution),L(e,ch))}));let ug=!1;const dg=new i((e=>{ug||(ug=!0,e(t.DefaultCanvasLineRender).toSelf().inSingletonScope(),e(zp).toSelf().inSingletonScope(),e(Mc).to(t.DefaultCanvasLineRender).inSingletonScope(),e(Pc).toService(Mc))}));let pg=!1;const fg=new i((e=>{pg||(pg=!0,e(t.DefaultCanvasAreaRender).toSelf().inSingletonScope(),e(_c).to(t.DefaultCanvasAreaRender).inSingletonScope(),e(Pc).toService(_c),e(rh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,rh),e(Vp).toSelf().inSingletonScope())}));let gg=!1;const vg=new i((e=>{gg||(gg=!0,e(t.DefaultCanvasSymbolRender).toSelf().inSingletonScope(),e(Ic).to(t.DefaultCanvasSymbolRender).inSingletonScope(),e(Pc).toService(Ic),e(uh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,uh))}));let mg=!1;const yg=new i((e=>{mg||(mg=!0,e(t.DefaultCanvasCircleRender).toSelf().inSingletonScope(),e(Bc).to(t.DefaultCanvasCircleRender).inSingletonScope(),e(Pc).toService(Bc),e(sh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,sh))}));let bg=!1;const xg=new i((e=>{bg||(bg=!0,e(Dc).to(t.DefaultCanvasTextRender).inSingletonScope(),e(Pc).toService(Dc),e(dh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,dh))}));let wg=!1;const Sg=new i((e=>{wg||(wg=!0,e(t.DefaultCanvasPathRender).toSelf().inSingletonScope(),e(Ec).to(t.DefaultCanvasPathRender).inSingletonScope(),e(Pc).toService(Ec),e(hh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,hh))}));let Ag=!1;const Tg=new i((e=>{Ag||(Ag=!0,e(kc).to(t.DefaultCanvasPolygonRender).inSingletonScope(),e(Pc).toService(kc),e(lh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,lh))}));var Cg=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 _g=class{constructor(){this.numberType=ho}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=Or(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:s})})),r.highPerformanceRestore()}};_g=Cg([g()],_g);let Bg=!1;const Pg=new i((t=>{Bg||(Bg=!0,t(Wc).to(_g).inSingletonScope(),t(Pc).toService(Wc))}));var Rg=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},Mg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Eg=class extends Fh{constructor(){super(),this.numberType=yo,this.builtinContributions=[nc],this.init()}drawShape(t,e,i,n,r){const s=Or(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=zo(o,h,!0),u=zo(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,s),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=Or(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(),ol(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=Or(t).richtext;this._draw(t,n,!1,i)}};Eg=Rg([g(),Mg("design:paramtypes",[])],Eg);let kg=!1;const Og=new i((t=>{kg||(kg=!0,t(jc).to(Eg).inSingletonScope(),t(Pc).toService(jc))}));let Lg=!1;const Ig=new i((e=>{Lg||(Lg=!0,e(Nc).to(t.DefaultCanvasImageRender).inSingletonScope(),e(Pc).toService(Nc),e(oh).toService(t.DefaultBaseInteractiveRenderContribution),L(e,oh))}));class Dg extends Fh{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=ia.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 jg=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 Ug=class extends Dg{constructor(){super(...arguments),this.type="rect3d",this.numberType=mo}drawShape(t,e,i,n,r,s,a,o){var h;const l=Or(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=Ho(v,m,w,S,c),C=Yo(v,b,w,S),_=Go(c),B=Fo(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=Or(t).rect;this._draw(t,n,!1,i)}};Ug=jg([g()],Ug);let Wg=!1;const Ng=new i((t=>{Wg||(Wg=!0,t(Lc).to(Ug).inSingletonScope(),t(Pc).toService(Lc))}));var Gg=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 Fg=class extends Fh{constructor(){super(...arguments),this.numberType=so}drawShape(e,i,n,r,s,a,o,h){var l;const c=Or(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=ia.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=Et(h-o),c=h>o;let u=!1;if(s<a){const t=s;s=a,a=t}if(s<=_t)e.moveTo(i,n,r);else if(l>=Mt-_t)e.moveTo(i+s*Ot(o),n+s*Dt(o),r),e.arc(i,n,s,o,h,!c,r),a>_t&&(e.moveTo(i+a*Ot(h),n+a*Dt(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*Ot(p),y=s*Dt(p),b=a*Ot(g),x=a*Dt(g);l<.001?u=!0:(e.moveTo(i+m,n+y,r),e.arc(i,n,s,p,f,!c,r)),!(a>_t)||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,Mt,!0,_.top),i.clip()),i.beginPath(),function(t,e,i,n,r,s,a,o){const{startAngle:h,endAngle:l}=t.getParsedAngle(),c=Et(l-h),u=l>h;let d=!1;if(a<=_t)e.moveTo(i,n,r);else if(c>=Mt-_t)e.moveTo(i+a*Ot(h),n+a*Dt(h),r),e.arc(i,n,a,h,l,!u,r),e.lineTo(i+a*Ot(l),n+a*Dt(l),s),e.arc(i,n,a,l,h,u,s);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(h,l),f=a*Ot(c),g=a*Dt(c),v=a*Ot(p),m=a*Dt(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=Or(t,null==n?void 0:n.theme).arc;this._draw(t,r,!1,i,n)}};Fg=Gg([g()],Fg);let zg=!1;const Hg=new i((t=>{zg||(zg=!0,t(Cc).to(Fg).inSingletonScope(),t(Pc).toService(Cc))}));var Vg=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 Yg=class extends Dg{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=go}drawShape(t,e,i,n,r,s,a,o){var h;const l=Or(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=Or(t).polygon;this._draw(t,n,!1,i)}};Yg=Vg([g()],Yg);let Xg=!1;const $g=new i((t=>{Xg||(Xg=!0,t(Uc).to(Yg).inSingletonScope(),t(Pc).toService(Uc))}));function qg(){Ql.RegisterGraphicCreator("arc",ap)}function Kg(){Ql.RegisterGraphicCreator("arc3d",hp)}function Zg(){Ql.RegisterGraphicCreator("area",np)}function Jg(){Ql.RegisterGraphicCreator("circle",du)}function Qg(){Ql.RegisterGraphicCreator("glyph",Nd)}function tv(){Ql.RegisterGraphicCreator("group",Ro)}function ev(){Ql.RegisterGraphicCreator("image",Vd)}function iv(){Ql.RegisterGraphicCreator("line",kd)}function nv(){Ql.RegisterGraphicCreator("path",tp)}function rv(){Ql.RegisterGraphicCreator("polygon",up)}function sv(){Ql.RegisterGraphicCreator("pyramid3d",pp)}function av(){Ql.RegisterGraphicCreator("rect",Id)}function ov(){Ql.RegisterGraphicCreator("rect3d",Ud)}function hv(){Ql.RegisterGraphicCreator("richtext",Zd)}function lv(){Ql.RegisterGraphicCreator("symbol",Rd)}function cv(){Ql.RegisterGraphicCreator("text",vu)}function uv(){Ql.RegisterGraphicCreator("shadowRoot",gp)}function dv(){Ql.RegisterGraphicCreator("wrapText",bu)}class pv{constructor(){this.name="HtmlAttributePlugin",this.activeEvent="onRegister",this._uid=e.GenAutoIncrementId(),this.key=this.name+this._uid,this.htmlMap={},this.renderId=0,this.onWheel=t=>{try{const e=new t.constructor(t.type,t);this.pluginService.stage.window.getContext().getCanvas().nativeCanvas.dispatchEvent(e)}catch(t){return}}}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(e=>{e&&e===this.pluginService.stage&&this.drawHTML([...t.stage.getChildren()])}))}deactivate(t){t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),mn.graphicService.hooks.onRemove.unTap(this.key),mn.graphicService.hooks.onRelease.unTap(this.key),this.release()}getWrapContainer(t,e,i){let n;return n=e?"string"==typeof e?mn.global.getElementById(e):e:t.window.getContainer(),{wrapContainer:mn.global.createDom(Object.assign({tagName:"div",parent:n},i)),nativeContainer:n}}parseDefaultStyleFromGraphic(t){return mh("text"===t.type&&t.attribute?t.attribute:Or(t).text)}getTransformOfText(t){const e=Or(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,penetrateEventList:a=[]}=r;let o=this.parseDefaultStyleFromGraphic(t);o.display=!1!==t.attribute.visible?"block":"none",o.pointerEvents=!0===s?"all":s||"none","none"!==o.pointerEvents&&(this.removeWrapContainerEventListener(i),a.forEach((t=>{"wheel"===t&&i.addEventListener("wheel",this.onWheel)}))),i.style.position||(i.style.position="absolute",n.style.position="relative");let h=0,l=0;const c=t.globalAABBBounds;let u=r.anchorType;if(J(u)&&(u="text"===t.type?"position":"boundsLeftTop"),"boundsLeftTop"===u&&(u="top-left"),"position"===u||c.empty()){const e=t.globalTransMatrix;h=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 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}})(c,u);h=t.x,l=t.y}const d=mn.global.getElementTopLeft(n,!1),p=e.window.getTopLeft(!1),f=e.viewBox,g=h+p.left-d.left+f.x1,v=l+p.top-d.top+f.y1;if(o.left=`${g}px`,o.top=`${v}px`,"text"===t.type&&"position"===u&&(o=Object.assign(Object.assign({},o),this.getTransformOfText(t))),Z(r.style)){const e=r.style({top:v,left:g,width:c.width(),height:c.height()},t,i);e&&(o=Object.assign(Object.assign({},o),e))}else et(r.style)?o=Object.assign(Object.assign({},o),r.style):st(r.style)&&r.style&&(o=Object.assign(Object.assign({},o),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)));mn.global.updateDom(i,{width:r.width,height:r.width,style:o})}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"===mn.global.env&&(t.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Qi.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Qi.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&&mn.global.removeDom(e),this.htmlMap[t]=null}removeWrapContainerEventListener(t){t.removeEventListener("wheel",this.onWheel)}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=J(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"===mn.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 fv=()=>{vf.registerPlugin("HtmlAttributePlugin",pv)};class gv extends pv{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?mn.global.getRequestAnimationFrame()((()=>{e.unmount()})):n&&n(),i&&mn.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=J(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 vv=()=>{vf.registerPlugin("ReactAttributePlugin",gv)};class mv{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 yv=()=>{vf.registerPlugin("ViewTransform3dPlugin",mv)},bv=new le;class xv{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=Or(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,mn.graphicService.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),t.stage&&t.stage===this.pluginService.stage&&this.tryLayout(t,!1)})),mn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&bv.copy(n)})),mn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,r)=>{e&&e===this.pluginService.stage&&t.isContainer&&!this.skipBoundsTrigger&&(bv.equals(i)||this.tryLayout(t,!1))})),mn.graphicService.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t,!1)}))}deactivate(t){mn.graphicService.hooks.onAttributeUpdate.taps=mn.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),mn.graphicService.hooks.beforeUpdateAABBBounds.taps=mn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),mn.graphicService.hooks.afterUpdateAABBBounds.taps=mn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),mn.graphicService.hooks.onSetStage.taps=mn.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const wv=()=>{vf.registerPlugin("FlexLayoutPlugin",xv)};function Sv(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 Av(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 Tv(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)Sv(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)Sv(e,r,-i);!function(t,e,i){const n=[];t.forEach((t=>n.push(...t))),Sv(n,e,i)}(s,r,-i)}return s}class Cv{constructor(t){this.helper=t}fillPolygons(t,e){return this._fillPolygons(t,e)}_fillPolygons(t,e){const i=Tv(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 _v extends Cv{fillPolygons(t,e){let i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.max(i,.1);const n=Tv(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)Av([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 Bv extends Cv{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 Pv{constructor(t){this.helper=t}fillPolygons(t,e){const i=Tv(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=Av(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 Rv{constructor(t){this.helper=t}fillPolygons(t,e){const i=Tv(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=Av(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 Mv{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=Tv(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=Av(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 Ev={};class kv{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const Ov={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 Lv(t,e){return t.type===e}function Iv(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(;!Lv(s,2);){let a=0;const o=[];if("BOD"===n){if("M"!==s.text&&"m"!==s.text)return Iv("M0,0"+t);r++,a=Ov[s.text],n=s.text}else Lv(s,1)?a=Ov[n]:(r++,a=Ov[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(!Lv(e,1))throw new Error("Param not a number: "+n+","+e.text);o[o.length]=+e.text}if("number"!=typeof Ov[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 Dv(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 jv(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||(Wv(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 Uv(t,e,i){return[t*Math.cos(i)-e*Math.sin(i),t*Math.sin(i)+e*Math.cos(i)]}function Wv(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]=Uv(t,e,-c),[i,n]=Uv(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=Wv(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=Uv(d[e][0],d[e][1],c),n=Uv(d[e+1][0],d[e+1][1],c),r=Uv(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 Nv={randOffset:function(t,e){return Kv(t,e)},randOffsetWithRange:function(t,e,i){return qv(t,e,i)},ellipse:function(t,e,i,n,r){return Hv(t,e,r,zv(i,n,r)).opset},doubleLineOps:function(t,e,i,n,r){return Zv(t,e,i,n,r,!0)}};function Gv(t,e,i,n,r){return{type:"path",ops:Zv(t,e,i,n,r)}}function Fv(t,e,i){const n=(t||[]).length;if(n>2){const r=[];for(let e=0;e<n-1;e++)r.push(...Zv(t[e][0],t[e][1],t[e+1][0],t[e+1][1],i));return e&&r.push(...Zv(t[n-1][0],t[n-1][1],t[0][0],t[0][1],i)),{type:"path",ops:r}}return 2===n?Gv(t[0][0],t[0][1],t[1][0],t[1][1],i):{type:"path",ops:[]}}function zv(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+=Kv(a*h,i),o+=Kv(o*h,i),{increment:s,rx:a,ry:o}}function Hv(t,e,i,n){const[r,s]=em(n.increment,t,e,n.rx,n.ry,1,n.increment*qv(.1,qv(.4,1,i),i),i);let a=tm(r,null,i);if(!i.disableMultiStroke&&0!==i.roughness){const[r]=em(n.increment,t,e,n.rx,n.ry,1.5,0,i),s=tm(r,null,i);a=a.concat(s)}return{estimatedPoints:s,opset:{type:"path",ops:a}}}function Vv(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+=Kv(.01*u,h),d+=Kv(.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=im(v,l,c,u,d,p,f,1,h);if(!h.disableMultiStroke){const t=im(v,l,c,u,d,p,f,1.5,h);m.push(...t)}return a&&(o?m.push(...Zv(l,c,l+u*Math.cos(p),c+d*Math.sin(p),h),...Zv(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 Yv(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]+Kv(t,e),n[0][1]+Kv(t,e)]});for(let s=1;s<r;s++)i.push({op:"lineTo",data:[n[s][0]+Kv(t,e),n[s][1]+Kv(t,e)]})}}return{type:"fillPath",ops:i}}function Xv(t,e){return function(t,e){let i=t.fillStyle||"hachure";if(!Ev[i])switch(i){case"zigzag":Ev[i]||(Ev[i]=new _v(e));break;case"cross-hatch":Ev[i]||(Ev[i]=new Bv(e));break;case"dots":Ev[i]||(Ev[i]=new Pv(e));break;case"dashed":Ev[i]||(Ev[i]=new Rv(e));break;case"zigzag-line":Ev[i]||(Ev[i]=new Mv(e));break;default:i="hachure",Ev[i]||(Ev[i]=new Cv(e))}return Ev[i]}(e,Nv).fillPolygons(t,e)}function $v(t){return t.randomizer||(t.randomizer=new kv(t.seed||0)),t.randomizer.next()}function qv(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return i.roughness*n*($v(i)*(e-t)+t)}function Kv(t,e){return qv(-t,t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function Zv(t,e,i,n,r){const s=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?r.disableMultiStrokeFill:r.disableMultiStroke,a=Jv(t,e,i,n,r,!0,!1);if(s)return a;const o=Jv(t,e,i,n,r,!0,!0);return a.concat(o)}function Jv(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*$v(r);let p=r.bowing*r.maxRandomnessOffset*(n-e)/200,f=r.bowing*r.maxRandomnessOffset*(t-i)/200;p=Kv(p,r,l),f=Kv(f,r,l);const g=[],v=()=>Kv(u,r,l),m=()=>Kv(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:Kv(c,r,l)),e+(y?0:Kv(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 Qv(t,e,i){const n=[];n.push([t[0][0]+Kv(e,i),t[0][1]+Kv(e,i)]),n.push([t[0][0]+Kv(e,i),t[0][1]+Kv(e,i)]);for(let r=1;r<t.length;r++)n.push([t[r][0]+Kv(e,i),t[r][1]+Kv(e,i)]),r===t.length-1&&n.push([t[r][0]+Kv(e,i),t[r][1]+Kv(e,i)]);return tm(n,null,i)}function tm(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]+Kv(t,i),e[1]+Kv(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(...Zv(t[0][0],t[0][1],t[1][0],t[1][1],i));return r}function em(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=Kv(.5,o)-Math.PI/2;l.push([Kv(s,o)+e+.9*n*Math.cos(c-t),Kv(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=[Kv(s,o)+e+n*Math.cos(a),Kv(s,o)+i+r*Math.sin(a)];h.push(t),l.push(t)}l.push([Kv(s,o)+e+n*Math.cos(c+2*Math.PI+.5*a),Kv(s,o)+i+r*Math.sin(c+2*Math.PI+.5*a)]),l.push([Kv(s,o)+e+.98*n*Math.cos(c+a),Kv(s,o)+i+.98*r*Math.sin(c+a)]),l.push([Kv(s,o)+e+.9*n*Math.cos(c+.5*a),Kv(s,o)+i+.9*r*Math.sin(c+.5*a)])}return[l,h]}function im(t,e,i,n,r,s,a,o,h){const l=s+Kv(.1,h),c=[];c.push([Kv(o,h)+e+.9*n*Math.cos(l-t),Kv(o,h)+i+.9*r*Math.sin(l-t)]);for(let s=l;s<=a;s+=t)c.push([Kv(o,h)+e+n*Math.cos(s),Kv(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)]),tm(c,null,h)}function nm(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:Kv(l[0],o)),a[1]+(d?0:Kv(l[0],o))]}),c=d?[r,s]:[r+Kv(l[p],o),s+Kv(l[p],o)],h.push({op:"bcurveTo",data:[t+Kv(l[p],o),e+Kv(l[p],o),i+Kv(l[p],o),n+Kv(l[p],o),c[0],c[1]]});return h}function rm(t){return[...t]}function sm(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function am(t,e,i){const n=sm(e,i);if(0===n)return sm(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)),sm(t,om(e,i,r))}function om(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i]}function hm(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(sm(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=om(s,a,n),c=om(a,o,n),u=om(o,h,n),d=om(l,c,n),p=om(c,u,n),f=om(d,p,n);hm([s,l,d,f],0,i,r),hm([f,p,u,h],0,i,r)}var s,a;return r}function lm(t,e){return cm(t,0,t.length,e)}function cm(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=am(t[n],a,o);e>h&&(h=e,l=n)}return Math.sqrt(h)>n?(cm(t,e,l+1,n,s),cm(t,l,i,n,s)):(s.length||s.push(a),s.push(o)),s}function um(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++)hm(t,3*i,e,n);return i&&i>0?cm(n,0,n.length,i):n}const dm="none";class pm{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",[Gv(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 Fv(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(Yv([r],s)):a.push(Xv([r],s))}return s.stroke!==dm&&a.push(o),this._d("rectangle",a,s)}ellipse(t,e,i,n,r){const s=this._o(r),a=[],o=zv(i,n,s),h=Hv(t,e,s,o);if(s.fill)if("solid"===s.fillStyle){const i=Hv(t,e,s,o).opset;i.type="fillPath",a.push(i)}else a.push(Xv([h.estimatedPoints],s));return s.stroke!==dm&&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",[Fv(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=Vv(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=Vv(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+=Kv(.01*l,a),c+=Kv(.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]),Xv([f],a)}(t,e,i,n,r,s,h));return h.stroke!==dm&&l.push(c),this._d("arc",l,h)}curve(t,e){const i=this._o(e),n=[],r=function(t,e){let i=Qv(t,1*(1+.2*e.roughness),e);if(!e.disableMultiStroke){const n=Qv(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!==dm&&t.length>=3){const e=um(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(rm(t[0]),rm(t[1]),rm(t[2]),rm(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(rm(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(Yv([e],i)):n.push(Xv([e],i))}return i.stroke!==dm&&n.push(r),this._d("curve",n,i)}polygon(t,e){const i=this._o(e),n=[],r=Fv(t,!0,i);return i.fill&&("solid"===i.fillStyle?n.push(Yv([t],i)):n.push(Xv([t],i))),i.stroke!==dm&&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!==dm,s=i.stroke!==dm,a=!!(i.simplification&&i.simplification<1),o=function(t,e,i){const n=jv(Dv(Iv(t))),r=[];let s=[],a=[0,0],o=[];const h=()=>{o.length>=4&&s.push(...um(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=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(Yv(o,i)):n.push(Xv(o,i))),s&&(a?o.forEach((t=>{n.push(Fv(t,!1,i))})):n.push(function(t,e){const i=jv(Dv(Iv(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:Kv(t,e))))}),s=[a[0],a[1]],r=[a[0],a[1]];break}case"L":n.push(...Zv(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(...nm(t,i,r,o,h,l,s,e)),s=[h,l];break}case"Z":n.push(...Zv(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:dm};break;case"fillPath":e={d:this.opsToPath(t),stroke:dm,strokeWidth:0,fill:i.fill||dm};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||dm,strokeWidth:i,fill:dm}}}class fm{constructor(t,e){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new pm(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 gm=(t,e)=>new fm(t,e);const vm={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 mm{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 ym=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},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,n){e(i,n,t)}};let wm=class extends mm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="arc",this.numberType=ro}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=gm(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 Ni,{fill:u=o.fill,stroke:d=o.stroke,lineWidth:p=o.lineWidth,outerRadius:f=o.outerRadius,innerRadius:g=o.innerRadius,maxRandomnessOffset:v=vm.maxRandomnessOffset,roughness:m=vm.roughness,bowing:y=vm.bowing,curveFitting:b=vm.curveFitting,curveTightness:x=vm.curveTightness,curveStepCount:w=vm.curveStepCount,fillStyle:S=vm.fillStyle,fillWeight:A=vm.fillWeight,hachureAngle:T=vm.hachureAngle,hachureGap:C=vm.hachureGap,simplification:_=vm.simplification,dashOffset:B=vm.dashOffset,dashGap:P=vm.dashGap,zigzagOffset:R=vm.zigzagOffset,seed:M=vm.seed,fillLineDash:E=vm.fillLineDash,fillLineDashOffset:k=vm.fillLineDashOffset,disableMultiStroke:O=vm.disableMultiStroke,disableMultiStrokeFill:L=vm.disableMultiStrokeFill,preserveVertices:I=vm.preserveVertices,fixedDecimalPlaceDigits:D=vm.fixedDecimalPlaceDigits}=t.attribute;Zo(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()}};wm=ym([g(),xm(0,p(t.DefaultCanvasArcRender)),bm("design:paramtypes",[Object])],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};let Am=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=gm(g,{}),m=new Ni;Ol(m,e,h,{offsetX:l,offsetY:c});const{maxRandomnessOffset:y=vm.maxRandomnessOffset,roughness:b=vm.roughness,bowing:x=vm.bowing,curveFitting:w=vm.curveFitting,curveTightness:S=vm.curveTightness,curveStepCount:A=vm.curveStepCount,fillStyle:T=vm.fillStyle,fillWeight:C=vm.fillWeight,hachureAngle:_=vm.hachureAngle,hachureGap:B=vm.hachureGap,simplification:P=vm.simplification,dashOffset:R=vm.dashOffset,dashGap:M=vm.dashGap,zigzagOffset:E=vm.zigzagOffset,seed:k=vm.seed,fillLineDash:O=vm.fillLineDash,fillLineDashOffset:L=vm.fillLineDashOffset,disableMultiStroke:I=vm.disableMultiStroke,disableMultiStrokeFill:D=vm.disableMultiStrokeFill,preserveVertices:j=vm.preserveVertices,fixedDecimalPlaceDigits:U=vm.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}};Am=Sm([g()],Am);var Tm=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},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_m=function(t,e){return function(i,n){e(i,n,t)}};let Bm=class extends mm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="circle",this.numberType=oo}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=gm(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})}};Bm=Tm([g(),_m(0,p(t.DefaultCanvasCircleRender)),Cm("design:paramtypes",[Object])],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};let Rm=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=gm(g,{}),m=new Ni;Rl(t.camera?t:t.nativeContext,e,h,l,{offsetX:c,offsetY:u});const{maxRandomnessOffset:y=vm.maxRandomnessOffset,roughness:b=vm.roughness,bowing:x=vm.bowing,curveFitting:w=vm.curveFitting,curveTightness:S=vm.curveTightness,curveStepCount:A=vm.curveStepCount,fillStyle:T=vm.fillStyle,fillWeight:C=vm.fillWeight,hachureAngle:_=vm.hachureAngle,hachureGap:B=vm.hachureGap,simplification:P=vm.simplification,dashOffset:R=vm.dashOffset,dashGap:M=vm.dashGap,zigzagOffset:E=vm.zigzagOffset,seed:k=vm.seed,fillLineDash:O=vm.fillLineDash,fillLineDashOffset:L=vm.fillLineDashOffset,disableMultiStroke:I=vm.disableMultiStroke,disableMultiStrokeFill:D=vm.disableMultiStrokeFill,preserveVertices:j=vm.preserveVertices,fixedDecimalPlaceDigits:U=vm.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}};Rm=Pm([g()],Rm);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},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},km=function(t,e){return function(i,n){e(i,n,t)}};let Om=class extends mm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="path",this.numberType=po}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=gm(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=vm.maxRandomnessOffset,roughness:p=vm.roughness,bowing:f=vm.bowing,curveFitting:g=vm.curveFitting,curveTightness:v=vm.curveTightness,curveStepCount:m=vm.curveStepCount,fillStyle:y=vm.fillStyle,fillWeight:b=vm.fillWeight,hachureAngle:x=vm.hachureAngle,hachureGap:w=vm.hachureGap,simplification:S=vm.simplification,dashOffset:A=vm.dashOffset,dashGap:T=vm.dashGap,zigzagOffset:C=vm.zigzagOffset,seed:_=vm.seed,fillLineDash:B=vm.fillLineDash,fillLineDashOffset:P=vm.fillLineDashOffset,disableMultiStroke:R=vm.disableMultiStroke,disableMultiStrokeFill:M=vm.disableMultiStrokeFill,preserveVertices:E=vm.preserveVertices,fixedDecimalPlaceDigits:k=vm.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()}};Om=Mm([g(),km(0,p(t.DefaultCanvasPathRender)),Em("design:paramtypes",[Object])],Om);var Lm=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},Im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dm=function(t,e){return function(i,n){e(i,n,t)}};let jm=class extends mm{constructor(t){super(),this.canvasRenderer=t,this.style="rough",this.type="rect",this.numberType=vo}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=gm(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=vm.maxRandomnessOffset,roughness:y=vm.roughness,bowing:b=vm.bowing,curveFitting:x=vm.curveFitting,curveTightness:w=vm.curveTightness,curveStepCount:S=vm.curveStepCount,fillStyle:A=vm.fillStyle,fillWeight:T=vm.fillWeight,hachureAngle:C=vm.hachureAngle,hachureGap:_=vm.hachureGap,simplification:B=vm.simplification,dashOffset:P=vm.dashOffset,dashGap:R=vm.dashGap,zigzagOffset:M=vm.zigzagOffset,seed:E=vm.seed,fillLineDash:k=vm.fillLineDash,fillLineDashOffset:O=vm.fillLineDashOffset,disableMultiStroke:L=vm.disableMultiStroke,disableMultiStrokeFill:I=vm.disableMultiStrokeFill,preserveVertices:D=vm.preserveVertices,fixedDecimalPlaceDigits:j=vm.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()}};jm=Lm([g(),Dm(0,p(t.DefaultCanvasRectRender)),Im("design:paramtypes",[Object])],jm);var Um=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},Wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,n){e(i,n,t)}};let Gm=class extends Fh{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bo,this.style="rough"}draw(t,e,i,n){const{context:r}=i;if(!r)return;const s=r.canvas.nativeCanvas,a=gm(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=vm.maxRandomnessOffset,roughness:w=vm.roughness,bowing:S=vm.bowing,curveFitting:A=vm.curveFitting,curveTightness:T=vm.curveTightness,curveStepCount:C=vm.curveStepCount,fillStyle:_=vm.fillStyle,fillWeight:B=vm.fillWeight,hachureAngle:P=vm.hachureAngle,hachureGap:R=vm.hachureGap,simplification:M=vm.simplification,dashOffset:E=vm.dashOffset,dashGap:k=vm.dashGap,zigzagOffset:O=vm.zigzagOffset,seed:L=vm.seed,fillLineDash:I=vm.fillLineDash,fillLineDashOffset:D=vm.fillLineDashOffset,disableMultiStroke:j=vm.disableMultiStroke,disableMultiStrokeFill:U=vm.disableMultiStrokeFill,preserveVertices:W=vm.preserveVertices,fixedDecimalPlaceDigits:N=vm.fixedDecimalPlaceDigits}=t.attribute;let G="";if(p.drawToSvgPath)G=p.drawToSvgPath(y,l,c);else{const t=new Ni;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)}};Gm=Um([g(),Nm(0,p(t.DefaultCanvasSymbolRender)),Wm("design:paramtypes",[Object])],Gm);var Fm=new i((t=>{t(Bm).toSelf().inSingletonScope(),t(Pc).to(Bm),t(jm).toSelf().inSingletonScope(),t(Pc).to(jm),t(Om).toSelf().inSingletonScope(),t(Pc).to(Om),t(Gm).toSelf().inSingletonScope(),t(Pc).to(Gm),t(Rm).toSelf().inSingletonScope(),t(Pc).to(Rm),t(Am).toSelf().inSingletonScope(),t(Pc).to(Am),t(wm).toSelf().inSingletonScope(),t(Pc).to(wm)}));const zm=Symbol.for("MathPickerContribution"),Hm=Symbol.for("MathArcPicker"),Vm=Symbol.for("MathAreaPicker"),Ym=Symbol.for("MathCirclePicker"),Xm=Symbol.for("MathImagePicker"),$m=Symbol.for("MathLinePicker"),qm=Symbol.for("MathPathPicker"),Km=Symbol.for("MathRectPicker"),Zm=Symbol.for("MathSymbolPicker"),Jm=Symbol.for("MathTextPicker"),Qm=Symbol.for("MathPolygonPicker"),ty=Symbol.for("MathGlyphPicker"),ey=Symbol.for("CanvasArcPicker"),iy=Symbol.for("CanvasArc3dPicker"),ny=Symbol.for("CanvasAreaPicker"),ry=Symbol.for("CanvasCirclePicker"),sy=Symbol.for("CanvasImagePicker"),ay=Symbol.for("CanvasLinePicker"),oy=Symbol.for("CanvasPathPicker"),hy=Symbol.for("CanvasRectPicker"),ly=Symbol.for("CanvasRect3dPicker"),cy=Symbol.for("CanvasSymbolPicker"),uy=Symbol.for("CanvasTextPicker"),dy=Symbol.for("CanvasPolygonPicker"),py=Symbol.for("CanvasPyramid3dPicker"),fy=Symbol.for("CanvasRichTextPicker"),gy=Symbol.for("CanvasGlyphPicker"),vy=Symbol.for("CanvasGroupPicker"),my=Symbol.for("CanvasPickerContribution"),yy={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"},by=Object.keys(yy);function xy(t){return Ql.richtext(t?t.attribute:{})}xy.Text=function(t){return Object.assign({type:"rich/text"},t)},xy.Image=function(t){return Object.assign({type:"rich/image"},t)};var wy=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 Sy(t,e){if(at(t))return t.forEach((t=>Sy(t,e)));e.push(t)}const Ay=Po;function Ty(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=yy[i];n&&t.on(n,e[i])})):"richtext"===t.type&&(t.attribute.textConfig=i.map((t=>Ty(t))).filter((t=>t))),n}(o,t.props,n);return h||(r&&(o.stateProxy=r),o.id=s,o.name=a,Cy(n,o),o)}function Cy(t,e){at(t)?t.forEach((t=>{if(at(t))Cy(t,e);else{const i=Ty(t);i&&i.type&&e.add(i)}})):t&&e.add(Ty(t))}const _y=(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"},By=(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 Py=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},Ry=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const My=[0,0,0];let Ey=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({},Vi),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Xi),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},$i),{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this._clearMatrix=new ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&wt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(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 Lh.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&&(Lh.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Lh.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-=Mt;else for(;i<e;)i+=Mt;const h=Bt/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&&(Ph(My,[t,e,a],this.modelMatrix),t=My[0],e=My[1],o=My[2],Ph(My,[i,n,a],this.modelMatrix),i=My[0],n=My[1],h=My[2],Ph(My,[r,s,a],this.modelMatrix),r=My[0],s=My[1],a=My[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&&(Ph(My,[t,e,i],this.modelMatrix),t=My[0],e=My[1],i=My[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&&(Ph(My,[t,e,i],this.modelMatrix),t=My[0],e=My[1],i=My[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&&(Ph(My,[t,e,r],this.modelMatrix),t=My[0],e=My[1],s=My[2],Ph(My,[i,n,r],this.modelMatrix),i=My[0],n=My[1],r=My[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=ih(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&&(Ph(My,[t,e,i],this.modelMatrix),t=My[0],e=My[1],i=My[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&&(Ph(My,[t,e,i],this.modelMatrix),t=My[0],e=My[1],i=My[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(Ph(My,[e,i,n],this.modelMatrix),e=My[0],i=My[1],n=My[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]:mn.global.measureTextMethod;var i,n;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=mn.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const r=null!==(i=this.fontFamily)&&void 0!==i?i:$i.fontFamily,s=null!==(n=this.fontSize)&&void 0!==n?n:$i.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&&(Ph(My,[e,i,n],this.modelMatrix),e=My[0],i=My[1],n=My[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=wn(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:xn(this,a,this.dpr),s.strokeStyle=wn(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=se(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=se(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=>Lh.free(t))),this.stack.length=0}};Ey.env="browser",Ey=Py([g(),Ry("design:paramtypes",[Object,Number])],Ey);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},Oy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ly=class extends Tf{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=mn.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Ey(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 Iy(t,e){return new i((i=>{i(Un).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Wn).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Ly.env="browser",Ly=ky([g(),Oy("design:paramtypes",[Object])],Ly);const Dy=Iy(Ly,Ey);var jy=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},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wy=function(t,e){return function(i,n){e(i,n,t)}};let Ny=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=vr.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}};Ny=jy([g(),Wy(0,p(k)),Wy(0,v(my)),Wy(1,p(Fc)),Wy(2,p(k)),Wy(2,v(mp)),Uy("design:paramtypes",[Object,Object,Object])],Ny);var Gy=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 Fy=class{constructor(){this.type="group",this.numberType=lo}contains(t,e,i){return!1}};Fy=Gy([g()],Fy);const zy=new i(((t,e,i,n)=>{zy.__vloaded||(zy.__vloaded=!0,t(vy).to(Fy).inSingletonScope(),t(my).toService(vy),L(t,my))}));zy.__vloaded=!1;var Hy=zy;const Vy=new i(((t,e,i,n)=>{i(Ny)||t(Ny).toSelf().inSingletonScope(),i(au)?n(au).toService(Ny):t(au).toService(Ny)}));function Yy(t){t.load(Hy),t.load(Vy)}var Xy,$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},qy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ky=Xy=class extends t.BaseWindowHandlerContribution{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Xy.idprefix}_${Xy.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=mn.global,this.viewBox=new le,this.modelMatrix=new ue(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:Xy.GenerateCanvasId(),canvasControled:!0};this.canvas=new Ly(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 Ly({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)}};Ky.env="browser",Ky.idprefix="visactor_window",Ky.prefix_count=0,Ky=Xy=$y([g(),qy("design:paramtypes",[])],Ky);const Zy=new i((t=>{t(Ky).toSelf(),t(xr).toDynamicValue((t=>t.container.get(Ky))).whenTargetNamed(Ky.env)}));var Jy=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},Qy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tb=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 eb{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 ib(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)/(lt(h)?h:1),y:(i-a.top)/(lt(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 eb(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&&(st(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=st(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(n)}return n}loadImage(t){return ib(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ib(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}}loadFont(t,e,i){return tb(this,void 0,void 0,(function*(){return new FontFace(t,st(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}},t.BrowserEnvContribution=Jy([g(),Qy("design:paramtypes",[])],t.BrowserEnvContribution);const nb=new i((e=>{nb.isBrowserBound||(nb.isBrowserBound=!0,e(t.BrowserEnvContribution).toSelf().inSingletonScope(),e(U).toService(t.BrowserEnvContribution))}));function rb(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];rb.__loaded||(rb.__loaded=!0,t.load(nb),t.load(Dy),t.load(Zy),e&&Yy(t))}nb.isBrowserBound=!1,rb.__loaded=!1;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};let ab=class extends Ey{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}};ab.env="feishu",ab=sb([g()],ab);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},hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lb=class extends Tf{constructor(t){super(t)}init(){this._context=new ab(this,this._dpr)}release(){}};lb.env="feishu",lb=ob([g(),hb("design:paramtypes",[Object])],lb);const cb=Iy(lb,ab);var ub=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},db=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 fb=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 lb(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 lb({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()}};fb.env="feishu",fb=ub([g(),pb(0,p(W)),db("design:paramtypes",[Object])],fb);const gb=new i((t=>{t(fb).toSelf(),t(xr).toDynamicValue((t=>t.container.get(fb))).whenTargetNamed(fb.env)}));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},mb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yb=function(t,e){return function(i,n){e(i,n,t)}};let bb=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}};bb=vb([g(),yb(0,p(k)),yb(0,v(zm)),yb(1,p(k)),yb(1,v(mp)),mb("design:paramtypes",[Object,Object])],bb);const xb=new i((t=>{xb.__vloaded||(xb.__vloaded=!0,L(t,zm))}));xb.__vloaded=!1;var wb=xb;class Sb{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:xn(n,s+a,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}}var Ab=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},Tb=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 _b=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ro}};_b=Ab([g(),Cb(0,p(Tc)),Tb("design:paramtypes",[Object])],_b);let Bb=!1;const Pb=new i(((t,e,i,n)=>{Bb||(Bb=!0,t(Hm).to(_b).inSingletonScope(),t(zm).toService(Hm))}));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},Mb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eb=function(t,e){return function(i,n){e(i,n,t)}};let kb=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ao}};kb=Rb([g(),Eb(0,p(_c)),Mb("design:paramtypes",[Object])],kb);let Ob=!1;const Lb=new i(((t,e,i,n)=>{Ob||(Ob=!0,t(Vm).to(kb).inSingletonScope(),t(zm).toService(Vm))}));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},Db=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 Ub=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=oo}};Ub=Ib([g(),jb(0,p(Bc)),Db("design:paramtypes",[Object])],Ub);let Wb=!1;const Nb=new i(((t,e,i,n)=>{Wb||(Wb=!0,t(Ym).to(Ub).inSingletonScope(),t(zm).toService(Ym))}));class Gb{constructor(){this.type="glyph",this.numberType=ho}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 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},zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hb=function(t,e){return function(i,n){e(i,n,t)}};let Vb=class extends Gb{constructor(t){super(),this.canvasRenderer=t}};Vb=Fb([g(),Hb(0,p(Wc)),zb("design:paramtypes",[Object])],Vb);let Yb=!1;const Xb=new i(((t,e,i,n)=>{Yb||(Yb=!0,t(ty).to(Vb).inSingletonScope(),t(Vb).toService(ty))}));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};let qb=class{constructor(){this.type="image",this.numberType=co}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};qb=$b([g()],qb);let Kb=!1;const Zb=new i(((t,e,i,n)=>{Kb||(Kb=!0,t(Xm).to(qb).inSingletonScope(),t(qb).toService(Xm))}));var Jb=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},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,n){e(i,n,t)}};let ex=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=uo}};ex=Jb([g(),tx(0,p(Mc)),Qb("design:paramtypes",[Object])],ex);let ix=!1;const nx=new i(((t,e,i,n)=>{ix||(ix=!0,t($m).to(ex).inSingletonScope(),t(zm).toService($m))}));var rx=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},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,n){e(i,n,t)}};let ox=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=fo}};ox=rx([g(),ax(0,p(kc)),sx("design:paramtypes",[Object])],ox);let hx=!1;const lx=new i(((t,e,i,n)=>{hx||(hx=!0,t(Qm).to(ox).inSingletonScope(),t(zm).toService(Qm))}));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},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dx=function(t,e){return function(i,n){e(i,n,t)}};let px=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=po}};px=cx([g(),dx(0,p(Ec)),ux("design:paramtypes",[Object])],px);let fx=!1;const gx=new i(((t,e,i,n)=>{fx||(fx=!0,t(qm).to(px).inSingletonScope(),t(zm).toService(qm))})),vx=new le;class mx{constructor(){this.type="rect",this.numberType=vo}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||ht(s,!0)&&0!==s||at(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:xn(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;vx.setValue(i.x1,i.y1,i.x2,i.y2),vx.expand(-s/2),l=!vx.containsPoint(e)}}return n.highPerformanceRestore(),l}}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},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,n){e(i,n,t)}};let Sx=class extends mx{constructor(t){super(),this.canvasRenderer=t}};Sx=yx([g(),xx(0,p(Oc)),bx("design:paramtypes",[Object])],Sx);let Ax=!1;const Tx=new i(((t,e,i,n)=>{Ax||(Ax=!0,t(Km).to(Sx).inSingletonScope(),t(zm).toService(Km))}));let Cx=!1;const _x=new i(((t,e,i,n)=>{Cx||(Cx=!0,t(Xm).to(qb).inSingletonScope(),t(qb).toService(Xm))}));var Bx=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},Px=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 Mx=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bo}};Mx=Bx([g(),Rx(0,p(Ic)),Px("design:paramtypes",[Object])],Mx);let Ex=!1;const kx=new i(((t,e,i,n)=>{Ex||(Ex=!0,t(Zm).to(Mx).inSingletonScope(),t(zm).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};let Lx=class{constructor(){this.type="text",this.numberType=xo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Lx=Ox([g()],Lx);let Ix=!1;const Dx=new i(((t,e,i,n)=>{Ix||(Ix=!0,t(Jm).to(Lx).inSingletonScope(),t(zm).toService(Jm))})),jx=new i(((t,e,i,n)=>{i(bb)||t(bb).toSelf().inSingletonScope(),i(au)?n(au).toService(bb):t(au).toService(bb)}));function Ux(t){t.load(wb),t.load(jx),t.load(Pb),t.load(Lb),t.load(Nb),t.load(Xb),t.load(Zb),t.load(nx),t.load(lx),t.load(gx),t.load(Tx),t.load(_x),t.load(kx),t.load(Dx)}class Wx{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 Nx{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 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},Fx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zx=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 Wx(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 Ts.call(t)}}getCancelAnimationFrame(){return t=>{Ts.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}};zx=Gx([g(),Fx("design:paramtypes",[])],zx);const Hx=new i((t=>{Hx.isFeishuBound||(Hx.isFeishuBound=!0,t(zx).toSelf().inSingletonScope(),t(U).toService(zx))}));function Vx(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Vx.__loaded||(Vx.__loaded=!0,t.load(Hx),t.load(cb),t.load(gb),e&&Ux(t))}Hx.isFeishuBound=!1,Vx.__loaded=!1;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};let Xx=class extends Ey{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:xn(this,h,this.dpr),s.strokeStyle=wn(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]:mn.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,mn.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)}))})))}};Xx.env="lynx",Xx=Yx([g()],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)};let Kx=class extends Tf{constructor(t){super(t)}init(){this._context=new Xx(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(){}};Kx.env="lynx",Kx=$x([g(),qx("design:paramtypes",[Object])],Kx);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},Jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qx=function(t,e){return function(i,n){e(i,n,t)}};let tw=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 Kx(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 Kx({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()}};tw.env="lynx",tw=Zx([g(),Qx(0,p(W)),Jx("design:paramtypes",[Object])],tw);const ew=new i((t=>{t(tw).toSelf(),t(xr).toDynamicValue((t=>t.container.get(tw))).whenTargetNamed(tw.env)})),iw=Iy(Kx,Xx);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},rw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let sw=!1;try{sw=!!lynx.createCanvasNG}catch(t){}let aw=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=sw?lynx.createCanvasNG(e):lynx.createCanvas(e),sw&&h.attachToCanvasView(e)),h.width=t.width*o,h.height=t.height*o;const l=h.getContext("2d"),c=new Nx(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 Nx(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 Ts.call(t)}}getCancelAnimationFrame(){return t=>{Ts.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(){}};aw=nw([g(),rw("design:paramtypes",[])],aw);const ow=new i((t=>{ow.isLynxBound||(ow.isLynxBound=!0,t(aw).toSelf().inSingletonScope(),t(U).toService(aw))}));function hw(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];hw.__loaded||(hw.__loaded=!0,t.load(ow),t.load(iw),t.load(ew),e&&Ux(t))}ow.isLynxBound=!1,hw.__loaded=!1;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 Ey{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};uw.env="node",uw=lw([g(),cw("design:paramtypes",[Object,Number])],uw);var dw=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},pw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let fw=class extends Tf{constructor(t){super(t)}init(){this._context=new uw(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&Z(this._nativeCanvas.release)&&this._nativeCanvas.release()}};fw.env="node",fw=dw([g(),pw("design:paramtypes",[Object])],fw);const gw=Iy(fw,uw);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},mw=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 bw=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 fw(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 fw({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){}};bw.env="node",bw=vw([g(),yw(0,p(W)),mw("design:paramtypes",[Object])],bw);const xw=new i((t=>{t(bw).toSelf(),t(xr).toDynamicValue((t=>t.container.get(bw))).whenTargetNamed(bw.env)}));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 Sw=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 Ts.call(t)}}getCancelAnimationFrame(){return t=>{Ts.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};Sw=ww([g()],Sw);const Aw=new i((t=>{Aw.isNodeBound||(Aw.isNodeBound=!0,t(Sw).toSelf().inSingletonScope(),t(U).toService(Sw))}));function Tw(t){Tw.__loaded||(Tw.__loaded=!0,t.load(Aw),t.load(gw),t.load(xw))}Aw.isNodeBound=!1,Tw.__loaded=!1;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};let _w=class extends Ey{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(wn(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:xn(this,h,this.dpr)),s.setStrokeStyle(wn(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=se(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=se(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)}};_w.env="taro",_w=Cw([g()],_w);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},Pw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Rw=class extends Tf{constructor(t){super(t)}init(){this._context=new _w(this,this._dpr)}release(){}};Rw.env="taro",Rw=Bw([g(),Pw("design:paramtypes",[Object])],Rw);const Mw=Iy(Rw,_w);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},kw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ow=function(t,e){return function(i,n){e(i,n,t)}};let Lw=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 Rw(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 Rw({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()}};Lw.env="taro",Lw=Ew([g(),Ow(0,p(W)),kw("design:paramtypes",[Object])],Lw);const Iw=new i((t=>{t(Lw).toSelf(),t(xr).toDynamicValue((t=>t.container.get(Lw))).whenTargetNamed(Lw.env)}));var Dw=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},jw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Uw=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 Wx(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(){}};Uw=Dw([g(),jw("design:paramtypes",[])],Uw);const Ww=new i((t=>{Ww.isTaroBound||(Ww.isTaroBound=!0,t(Uw).toSelf().inSingletonScope(),t(U).toService(Uw))}));function Nw(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Nw.__loaded||(Nw.__loaded=!0,t.load(Ww),t.load(Mw),t.load(Iw),e&&Ux(t))}Ww.isTaroBound=!1,Nw.__loaded=!1;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};let Fw=class extends Ey{draw(){}createPattern(t,e){return null}};Fw.env="wx",Fw=Gw([g()],Fw);var zw=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},Hw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Vw=class extends Tf{constructor(t){super(t)}init(){this._context=new Fw(this,this._dpr)}release(){}};Vw.env="wx",Vw=zw([g(),Hw("design:paramtypes",[Object])],Vw);const Yw=Iy(Vw,Fw);var Xw=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)},qw=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="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 Vw(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 Vw({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()}};Kw.env="wx",Kw=Xw([g(),qw(0,p(W)),$w("design:paramtypes",[Object])],Kw);const Zw=new i((t=>{t(Kw).toSelf(),t(xr).toDynamicValue((t=>t.container.get(Kw))).whenTargetNamed(Kw.env)}));var Jw=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},Qw=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=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 eS=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 tS(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 Ts.call(t)}}getCancelAnimationFrame(){return t=>{Ts.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}};eS=Jw([g(),Qw("design:paramtypes",[])],eS);const iS=new i((t=>{iS._isWxBound||(iS._isWxBound=!0,t(eS).toSelf().inSingletonScope(),t(U).toService(eS))}));function nS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];nS.__loaded||(nS.__loaded=!0,t.load(iS),t.load(Yw),t.load(Zw),e&&Ux(t))}function rS(t){sS(t)}function sS(t){sS.__loaded||(sS.__loaded=!0,rb(t,!1),Vx(t,!1),hw(t,!1),Tw(t),Nw(t,!1),nS(t,!1),Yy(t),tf.hooks.onSetEnv.tap("loadMathPicker",((e,i)=>{"browser"!==i&&Ux(t)})))}iS._isWxBound=!1,nS.__loaded=!1,sS.__loaded=!1;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};let oS=class extends ab{};oS.env="tt",oS=aS([g()],oS);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},lS=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 oS(this,this._dpr)}release(){}};cS.env="tt",cS=hS([g(),lS("design:paramtypes",[Object])],cS);const uS=Iy(cS,oS);var dS=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},pS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,n){e(i,n,t)}};let gS=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 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}let r=t.dpr;null==r&&(r=e.width/i),this.canvas=new cS({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()}};gS.env="tt",gS=dS([g(),fS(0,p(W)),pS("design:paramtypes",[Object])],gS);const vS=new i((t=>{t(gS).toSelf(),t(xr).toDynamicValue((t=>t.container.get(gS))).whenTargetNamed(gS.env)}));var mS=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},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=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 xS=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 bS(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 Ts.call(t)}}getCancelAnimationFrame(){return t=>{Ts.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}};xS=mS([g(),yS("design:paramtypes",[])],xS);const wS=new i((t=>{wS.isTTBound||(wS.isTTBound=!0,t(xS).toSelf().inSingletonScope(),t(U).toService(xS))}));function SS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];SS.__loaded||(SS.__loaded=!0,t.load(wS),t.load(uS),t.load(vS),e&&Ux(t))}wS.isTTBound=!1,SS.__loaded=!1;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};let TS=class extends Ey{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:xn(this,h,this.dpr),s.strokeStyle=wn(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]:mn.global.measureTextMethod;return this.setTransform(1,0,0,1,0,0,!0,mn.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:se(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:se(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(){}};TS.env="harmony",TS=AS([g()],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)};let BS=class extends Tf{constructor(t){super(t)}init(){this._context=new TS(this,this._dpr)}resize(t,e){}release(){}};BS.env="harmony",BS=CS([g(),_S("design:paramtypes",[Object])],BS);var PS=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},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MS=function(t,e){return function(i,n){e(i,n,t)}};class ES{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 kS=class extends t.BaseWindowHandlerContribution{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new ES}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 BS(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 BS({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()}};kS.env="harmony",kS=PS([g(),MS(0,p(W)),RS("design:paramtypes",[Object])],kS);const OS=new i((t=>{t(kS).toSelf(),t(xr).toDynamicValue((t=>t.container.get(kS))).whenTargetNamed(kS.env)})),LS=Iy(BS,TS);var IS=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},DS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jS=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 As(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 Wx({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(){}};jS=IS([g(),DS("design:paramtypes",[])],jS);const US=new i((t=>{US.isHarmonyBound||(US.isHarmonyBound=!0,t(jS).toSelf().inSingletonScope(),t(U).toService(jS))}));function WS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];WS.__loaded||(WS.__loaded=!0,t.load(US),t.load(LS),t.load(OS),e&&Ux(t))}US.isHarmonyBound=!1,WS.__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},GS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FS=function(t,e){return function(i,n){e(i,n,t)}};let zS=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ro}};zS=NS([g(),FS(0,p(Tc)),GS("design:paramtypes",[Object])],zS);let HS=!1;const VS=new i(((t,e,i,n)=>{HS||(HS=!0,t(ey).to(zS).inSingletonScope(),t(my).toService(ey))}));var YS=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},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$S=function(t,e){return function(i,n){e(i,n,t)}};let qS=class extends mx{constructor(t){super(),this.canvasRenderer=t}};qS=YS([g(),$S(0,p(Oc)),XS("design:paramtypes",[Object])],qS);let KS=!1;const ZS=new i(((t,e,i,n)=>{KS||(KS=!0,t(hy).to(qS).inSingletonScope(),t(my).toService(hy))}));class JS extends Fh{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:xn(n,r+s,n.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,n.modelMatrix!==l&&Ih.free(n.modelMatrix),n.modelMatrix=l,n.highPerformanceRestore(),u}}var QS=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},tA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eA=function(t,e){return function(i,n){e(i,n,t)}};let iA=class extends JS{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=uo}};iA=QS([g(),eA(0,p(Mc)),tA("design:paramtypes",[Object])],iA);let nA=!1;const rA=new i(((t,e,i,n)=>{nA||(nA=!0,t(ay).to(iA).inSingletonScope(),t(my).toService(ay))}));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)},oA=function(t,e){return function(i,n){e(i,n,t)}};let hA=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=ao}};hA=sA([g(),oA(0,p(_c)),aA("design:paramtypes",[Object])],hA);let lA=!1;const cA=new i(((t,e,i,n)=>{lA||(lA=!0,t(ny).to(hA).inSingletonScope(),t(my).toService(ny))}));class uA extends Fh{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&&Ih.free(n.modelMatrix),n.modelMatrix=l,n.highPerformanceRestore(),u}}var dA=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)},fA=function(t,e){return function(i,n){e(i,n,t)}};let gA=class extends uA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=bo}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:xn(n,r+s,n.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==c&&Ih.free(n.modelMatrix),n.modelMatrix=c,n.highPerformanceRestore(),d}};gA=dA([g(),fA(0,p(Ic)),pA("design:paramtypes",[Object])],gA);let vA=!1;const mA=new i(((t,e,i,n)=>{vA||(vA=!0,t(cy).to(gA).inSingletonScope(),t(my).toService(cy))}));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},bA=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 wA=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=oo}};wA=yA([g(),xA(0,p(Bc)),bA("design:paramtypes",[Object])],wA);let SA=!1;const AA=new i(((t,e,i,n)=>{SA||(SA=!0,t(ry).to(wA).inSingletonScope(),t(my).toService(ry))}));var TA=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)},_A=function(t,e){return function(i,n){e(i,n,t)}};let BA=class extends uA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=xo}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=vh(a,d,r),m=gh(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&&Ih.free(n.modelMatrix),n.modelMatrix=d,n.highPerformanceRestore(),f}};BA=TA([g(),_A(0,p(Dc)),CA("design:paramtypes",[Object])],BA);let PA=!1;const RA=new i(((t,e,i,n)=>{PA||(PA=!0,t(uy).to(BA).inSingletonScope(),t(my).toService(uy))}));var MA=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},EA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kA=function(t,e){return function(i,n){e(i,n,t)}};let OA=class extends JS{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=po}};OA=MA([g(),kA(0,p(Ec)),EA("design:paramtypes",[Object])],OA);let LA=!1;const IA=new i(((t,e,i,n)=>{LA||(LA=!0,t(oy).to(OA).inSingletonScope(),t(my).toService(oy))}));var DA=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},jA=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 WA=class extends Sb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=fo}};WA=DA([g(),UA(0,p(kc)),jA("design:paramtypes",[Object])],WA);let NA=!1;const GA=new i(((t,e,i,n)=>{NA||(NA=!0,t(dy).to(WA).inSingletonScope(),t(my).toService(dy))}));var FA=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},zA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HA=function(t,e){return function(i,n){e(i,n,t)}};let VA=class extends Gb{constructor(t){super(),this.canvasRenderer=t}};VA=FA([g(),HA(0,p(Wc)),zA("design:paramtypes",[Object])],VA);let YA=!1;const XA=new i(((t,e,i,n)=>{YA||(YA=!0,t(gy).to(VA).inSingletonScope(),t(my).toService(gy))}));var $A=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},qA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KA=function(t,e){return function(i,n){e(i,n,t)}};let ZA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=yo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};ZA=$A([g(),KA(0,p(jc)),qA("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new i(((t,e,i,n)=>{JA||(JA=!0,t(fy).to(ZA).inSingletonScope(),t(my).toService(fy))}));var tT=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 eT=class{constructor(){this.type="image",this.numberType=co}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};eT=tT([g()],eT);let iT=!1;const nT=new i(((t,e,i,n)=>{iT||(iT=!0,t(sy).to(eT).inSingletonScope(),t(my).toService(sy))}));var rT=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},sT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aT=function(t,e){return function(i,n){e(i,n,t)}};let oT=class extends uA{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=mo,this.themeType="rect"}};oT=rT([g(),aT(0,p(Lc)),sT("design:paramtypes",[Object])],oT);let hT=!1;const lT=new i(((t,e,i,n)=>{hT||(hT=!0,t(ly).to(oT).inSingletonScope(),t(my).toService(ly))}));var cT=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},uT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dT=function(t,e){return function(i,n){e(i,n,t)}};let pT=class extends uA{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=so,this.themeType="arc"}};pT=cT([g(),dT(0,p(Cc)),uT("design:paramtypes",[Object])],pT);let fT=!1;const gT=new i(((t,e,i,n)=>{fT||(fT=!0,t(iy).to(pT).inSingletonScope(),t(my).toService(iy))}));var vT=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},mT=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yT=function(t,e){return function(i,n){e(i,n,t)}};let bT=class extends uA{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=go,this.themeType="polygon"}};bT=vT([g(),yT(0,p(Uc)),mT("design:paramtypes",[Object])],bT);let xT=!1;const wT=new i(((t,e,i,n)=>{xT||(xT=!0,t(py).to(bT).inSingletonScope(),t(my).toService(py))})),ST=ff();function AT(){AT.__loaded||(AT.__loaded=!0,qg(),jn.load(hg),jn.load(ST?VS:Pb))}AT.__loaded=!1;const TT=AT;function CT(){CT.__loaded||(CT.__loaded=!0,Kg(),Mf(),kf(),jn.load(Hg),jn.load(gT))}CT.__loaded=!1;const _T=CT;function BT(){BT.__loaded||(BT.__loaded=!0,Zg(),jn.load(fg),jn.load(ST?cA:Lb))}BT.__loaded=!1;const PT=BT;function RT(){RT.__loaded||(RT.__loaded=!0,Jg(),jn.load(yg),jn.load(ST?AA:Nb))}RT.__loaded=!1;const MT=RT;function ET(){ET.__loaded||(ET.__loaded=!0,Qg(),jn.load(Pg),jn.load(ST?XA:Xb))}ET.__loaded=!1;const kT=ET;function OT(){OT.__loaded||(OT.__loaded=!0,tv())}OT.__loaded=!1;const LT=OT;function IT(){IT.__loaded||(IT.__loaded=!0,ev(),jn.load(Ig),jn.load(ST?nT:Zb))}IT.__loaded=!1;const DT=IT;function jT(){jT.__loaded||(jT.__loaded=!0,iv(),jn.load(dg),jn.load(ST?rA:nx))}jT.__loaded=!1;const UT=jT;function WT(){WT.__loaded||(WT.__loaded=!0,nv(),jn.load(Sg),jn.load(ST?IA:gx))}WT.__loaded=!1;const NT=WT;function GT(){GT.__loaded||(GT.__loaded=!0,rv(),jn.load(Tg),jn.load(ST?GA:lx))}GT.__loaded=!1;const FT=GT;function zT(){zT.__loaded||(zT.__loaded=!0,sv(),Mf(),kf(),jn.load($g),jn.load(wT))}zT.__loaded=!1;const HT=zT;function VT(){VT.__loaded||(VT.__loaded=!0,av(),jn.load(cg),jn.load(ST?ZS:Tx))}VT.__loaded=!1;const YT=VT;function XT(){XT.__loaded||(XT.__loaded=!0,ov(),jn.load(Ng),jn.load(lT))}XT.__loaded=!1;const $T=XT;function qT(){qT.__loaded||(qT.__loaded=!0,hv(),jn.load(Og),jn.load(ST?QA:_x))}qT.__loaded=!1;const KT=qT;function ZT(){ZT.__loaded||(ZT.__loaded=!0,uv())}ZT.__loaded=!1;const JT=ZT;function QT(){QT.__loaded||(QT.__loaded=!0,lv(),jn.load(vg),jn.load(ST?mA:kx))}QT.__loaded=!1;const tC=QT;function eC(){eC.__loaded||(eC.__loaded=!0,cv(),jn.load(xg),jn.load(ST?RA:Dx))}eC.__loaded=!1;const iC=eC;function nC(){nC.__loaded||(nC.__loaded=!0,dv())}nC.__loaded=!1;const rC=nC,sC=Fm;Qp(),ff()?rb(jn):gf()&&Tw(jn),TT(),_T(),PT(),MT(),kT(),LT(),DT(),UT(),NT(),FT(),HT(),YT(),$T(),KT(),JT(),tC(),iC(),rC(),wv(),yv(),fv(),vv(),Mf(),kf(),t.ACustomAnimate=is,t.ARC3D_NUMBER_TYPE=so,t.ARC_NUMBER_TYPE=ro,t.AREA_NUMBER_TYPE=ao,t.Animate=rs,t.AnimateGroup=class extends is{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?Qr[r]:r;e=s(e),n.onUpdate(t,e,i)})),this.updating=!1)}},t.AnimateGroup1=class extends is{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?Qr[r]:r;e=s(e),n.onUpdate(t,e,i)})),this.updating=!1)}},t.Application=vn,t.Arc=sp,t.Arc3d=op,t.Arc3dRender=Cc,t.ArcRender=Tc,t.ArcRenderContribution=nh,t.Area=ip,t.AreaRender=_c,t.AreaRenderContribution=rh,t.AttributeAnimate=class extends is{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=Fh,t.Basis=vi,t.BeforeRenderConstribution=nu,t.BoundsContext=Be,t.BoundsPicker=ou,t.CIRCLE_NUMBER_TYPE=oo,t.Canvas3DDrawItemInterceptor=Jc,t.CanvasArc3dPicker=iy,t.CanvasArcPicker=ey,t.CanvasAreaPicker=ny,t.CanvasCirclePicker=ry,t.CanvasFactory=Un,t.CanvasGlyphPicker=gy,t.CanvasGroupPicker=vy,t.CanvasImagePicker=sy,t.CanvasLinePicker=ay,t.CanvasPathPicker=oy,t.CanvasPickerContribution=my,t.CanvasPolygonPicker=dy,t.CanvasPyramid3dPicker=py,t.CanvasRect3dPicker=ly,t.CanvasRectPicker=hy,t.CanvasRichTextPicker=fy,t.CanvasSymbolPicker=cy,t.CanvasTextLayout=pu,t.CanvasTextPicker=uy,t.CbAnimate=ns,t.Circle=uu,t.CircleRender=Bc,t.CircleRenderContribution=sh,t.ClipAngleAnimate=class extends Ps{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=mn.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 Ps{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=mn.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=Ps,t.ClipRadiusAnimate=class extends Ps{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=mn.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=Qo,t.ColorStore=ia,t.CommonRenderContribution=ph,t.Container=E,t.ContainerModule=i,t.Context2dFactory=Wn,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 oi(new zt(this._lastX,this._lastY),new zt(t,e))}quadraticCurveTo(t,e,i,n){throw new Error("CurveContext不支持调用quadraticCurveTo")}bezierCurveTo(t,e,i,n,r,s){const a=new si(new zt(this._lastX,this._lastY),new zt(t,e),new zt(i,n),new zt(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=Gr,t.CustomPath2D=Ni,t.CustomSymbolClass=Sd,t.DEFAULT_TEXT_FONT_FAMILY=N,t.DebugDrawItemInterceptorContribution=Kc,t.DefaultArcAllocate=Vf,t.DefaultArcAttribute=tn,t.DefaultArcRenderContribution=Kh,t.DefaultAreaAllocate=Xf,t.DefaultAreaAttribute=en,t.DefaultAreaTextureRenderContribution=xl,t.DefaultAttribute=Qi,t.DefaultBaseBackgroundRenderContribution=Yh,t.DefaultBaseTextureRenderContribution=$h,t.DefaultCanvasAllocate=gr,t.DefaultCircleAllocate=qf,t.DefaultCircleAttribute=nn,t.DefaultCircleRenderContribution=tl,t.DefaultConnectAttribute=Zi,t.DefaultDebugAttribute=Ji,t.DefaultFillStyle=Vi,t.DefaultGlyphAttribute=sn,t.DefaultGraphicAllocate=Ff,t.DefaultGraphicMemoryManager=sg,t.DefaultGroupAttribute=rn,t.DefaultGroupBackgroundRenderContribution=rl,t.DefaultImageAttribute=fn,t.DefaultImageRenderContribution=pl,t.DefaultLayout=zi,t.DefaultLineAllocate=Zf,t.DefaultLineAttribute=an,t.DefaultMat4Allocate=Oh,t.DefaultMatrixAllocate=kh,t.DefaultMorphingAnimateConfig=hs,t.DefaultPathAllocate=Qf,t.DefaultPathAttribute=on,t.DefaultPickStyle=qi,t.DefaultPolygonAttribute=hn,t.DefaultRect3dAttribute=cn,t.DefaultRectAllocate=zf,t.DefaultRectAttribute=ln,t.DefaultRectRenderContribution=ll,t.DefaultRichTextAttribute=pn,t.DefaultRichTextIconAttribute=gn,t.DefaultStateAnimateConfig=os,t.DefaultStrokeStyle=Xi,t.DefaultStyle=Ki,t.DefaultSymbolAllocate=eg,t.DefaultSymbolAttribute=un,t.DefaultSymbolRenderContribution=vl,t.DefaultTextAllocate=ng,t.DefaultTextAttribute=dn,t.DefaultTextStyle=$i,t.DefaultTicker=Zr,t.DefaultTimeline=ts,t.DefaultTransform=Hi,t.DirectionalLight=Rf,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=Io,t.EnvContribution=U,t.EventManager=Hr,t.EventSystem=Xr,t.EventTarget=Vr,t.FORMAT_ELEMENT_COMMAND="FORMAT_ELEMENT_COMMAND",t.FORMAT_TEXT_COMMAND=Gf,t.Factory=vf,t.FadeInPlus=class extends is{constructor(t,e,i,n,r){super(t,e,i,n,r);const{direction:s=Bs.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 Bs.RIGHT_TO_LEFT:this.rightToLeft(t,e,i);break;case Bs.TOP_TO_BOTTOM:this.topToBottom(t,e,i);break;case Bs.BOTTOM_TO_TOP:this.bottomToTop(t,e,i);break;case Bs.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=jr,t.FederatedMouseEvent=Ur,t.FederatedPointerEvent=Wr,t.FederatedWheelEvent=Nr,t.FlexLayoutPlugin=xv,t.Fragment=Ay,t.GLYPH_NUMBER_TYPE=ho,t.GRAPHIC_UPDATE_TAG_KEY=Ra,t.GROUP_NUMBER_TYPE=lo,t.Generator=e,t.Gesture=class extends ${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=Fr.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=By(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=Fr.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||_y(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=By(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=Fr.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=By(i,r),a=s/t;if(a>this.config.swipe.velocity&&s>this.config.swipe.threshold)return e.velocity=a,e.direction=_y(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=Fr.now()-i>this.config.press.time&&By(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=mn.global.getRequestAnimationFrame()((()=>{mn.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){if(!this.element)return;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=hu,t.Glyph=Wd,t.GlyphRender=Wc,t.Graphic=Ia,t.GraphicAnimate=class extends is{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=So,t.GraphicPicker=su,t.GraphicRender=Pc,t.GraphicService=wo,t.GraphicUtil=ko,t.Group=Po,t.GroupFadeIn=class extends is{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 is{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=ah,t.HtmlAttributePlugin=pv,t.IMAGE_NUMBER_TYPE=co,t.Image=Hd,t.ImageRender=Nc,t.ImageRenderContribution=oh,t.IncreaseCount=class extends is{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=ht(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=ht(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(Ft(this.fromNumber),Ft(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 is{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||at(this.toText))this.valid=!1;else{this.toText=this.toText.toString();const t=this.target.attachShadow(),e=mn.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=Zc,t.InteractiveSubRenderContribution=fh,t.LINE_NUMBER_TYPE=uo,t.Layer=Mo,t.LayerService=Oo,t.Line=Ed,t.LineRender=Mc,t.Linear=di,t.LinearClosed=ki,t.ManualTickHandler=Jr,t.ManualTicker=class extends Zr{set mode(t){this.setupTickHandler()}get mode(){return this._mode}initHandler(){return this.mode="manual",null}setupTickHandler(){const t=new Jr;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=Mh,t.MathArcPicker=Hm,t.MathAreaPicker=Vm,t.MathCirclePicker=Ym,t.MathGlyphPicker=ty,t.MathImagePicker=Xm,t.MathLinePicker=$m,t.MathPathPicker=qm,t.MathPickerContribution=zm,t.MathPolygonPicker=Qm,t.MathRectPicker=Km,t.MathSymbolPicker=Zm,t.MathTextPicker=Jm,t.MatrixAllocate=Rh,t.Meteor=class extends is{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 zt(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=Ai,t.MonotoneY=Ti,t.MorphingPath=ya,t.MotionPath=class extends is{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=xa,t.NOWORK_ANIMATE_ATTR=La,t.Node=Dr,t.OrthoCamera=Ef,t.PATH_NUMBER_TYPE=po,t.POLYGON_NUMBER_TYPE=fo,t.PURE_STYLE_KEY=["stroke","opacity","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","miterLimit","fill","fillOpacity"],t.PYRAMID3D_NUMBER_TYPE=go,t.Path=Qd,t.PathRender=Ec,t.PathRenderContribution=hh,t.PickItemInterceptor=mp,t.PickerService=au,t.PluginService=wp,t.Polygon=cp,t.PolygonRender=kc,t.PolygonRenderContribution=lh,t.Pyramid3d=dp,t.Pyramid3dRender=Uc,t.RAFTickHandler=qr,t.REACT_TO_CANOPUS_EVENTS=yy,t.REACT_TO_CANOPUS_EVENTS_LIST=by,t.RECT3D_NUMBER_TYPE=mo,t.RECT_NUMBER_TYPE=vo,t.RICHTEXT_NUMBER_TYPE=yo,t.RafBasedSTO=As,t.ReactAttributePlugin=gv,t.Rect=Ld,t.Rect3DRender=Lc,t.Rect3d=jd,t.RectRender=Oc,t.RectRenderContribution=ch,t.ReflectSegContext=li,t.RenderSelector=Gc,t.RenderService=iu,t.ResourceLoader=Ca,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(Gf,[this.formatTextCommandCb]),this.updateCbs=[]}getSelection(){return this.selectionStartCursorIdx&&this.curCursorIdx&&this.selectionStartCursorIdx!==this.curCursorIdx&&this.currRt?new Nf(this.selectionStartCursorIdx,this.curCursorIdx,Uf(this.currRt.attribute.textConfig,this.selectionStartCursorIdx),Uf(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)):et(t)&&a.forEach((e=>function(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e<i;)ft(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 Wf,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(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=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=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=Ro({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&&st(t.text)&&this.splitText(t.text).length>1)))))){const e=[];t.attribute.textConfig.forEach((t=>{const i=this.splitText(t.text.toString());if(st(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 is{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=Mt-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+Bt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z,s&&s(i)}},t.SVG_ATTRIBUTE_MAP=Ao,t.SVG_ATTRIBUTE_MAP_KEYS=To,t.SVG_PARSE_ATTRIBUTE_MAP=Co,t.SVG_PARSE_ATTRIBUTE_MAP_KEYS=_o,t.SYMBOL_NUMBER_TYPE=bo,t.SegContext=hi,t.ShadowRoot=fp,t.ShadowRootDrawItemInterceptorContribution=qc,t.Stage=yf,t.StaticLayerHandlerContribution=Lo,t.Step=Ri,t.StreamLight=class extends is{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=mn.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=n,n.pathProxy=new Ni,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=mn.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]=ri(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]=ri(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+=Ht.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=Ht.distancePP(o[t],o[t-1]);if(p<c&&p+e>c&&d.push(Ht.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),p<u&&p+e>u){d.push(Ht.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=ss,t.Symbol=Pd,t.SymbolRender=Ic,t.SymbolRenderContribution=uh,t.TEXT_NUMBER_TYPE=xo,t.TagPointsUpdate=class extends is{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=Ct(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 zt(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=ys(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=Dn,t.TextRender=Dc,t.TextRenderContribution=dh,t.Theme=Er,t.TimeOutTickHandler=Kr,t.TransformUtil=Eo,t.VArc=function(t){return Ql.arc(t?t.attribute:{})},t.VArc3d=function(t){return Ql.arc3d(t?t.attribute:{})},t.VArea=function(t){return Ql.area(t?t.attribute:{})},t.VCircle=function(t){return Ql.circle(t?t.attribute:{})},t.VGlobal=W,t.VGlyph=function(t){return Ql.glyph(t?t.attribute:{})},t.VGroup=function(t){return Ql.group(t?t.attribute:{})},t.VImage=function(t){return Ql.image(t?t.attribute:{})},t.VLine=function(t){return Ql.line(t?t.attribute:{})},t.VPath=function(t){return Ql.path(t?t.attribute:{})},t.VPolygon=function(t){return Ql.polygon(t?t.attribute:{})},t.VPyramid3d=function(t){return Ql.pyramid3d(t?t.attribute:{})},t.VRect=function(t){return Ql.rect(t?t.attribute:{})},t.VRect3d=function(t){return Ql.rect3d(t?t.attribute:{})},t.VRichText=xy,t.VSymbol=function(t){return Ql.symbol(t?t.attribute:{})},t.VText=function(t){return Ql.text(t?t.attribute:{})},t.VWindow=br,t.ViewTransform3dPlugin=mv,t.VirtualLayerHandlerContribution=Do,t.WILDCARD="*",t.WindowHandlerContribution=xr,t.WrapText=yu,t.XMLParser=Va,t._calculateLineHeight=Cs,t._interpolateColor=sa,t._registerArc=AT,t.addArcToBezierPath=Ke,t.addAttributeToPrototype=function(t,e,i){i.forEach((i=>{e.prototype[i]=t[i]}))},t.alignBezierCurves=Ds,t.alignSubpath=Ms,t.application=mn,t.applyTransformOnBezierCurves=Ws,t.arc3dCanvasPickModule=gT,t.arc3dModule=Hg,t.arcCanvasPickModule=VS,t.arcMathPickModule=Pb,t.arcModule=hg,t.areaCanvasPickModule=cA,t.areaMathPickModule=Lb,t.areaModule=fg,t.bezier=$e,t.bezierCurversToPath=Ns,t.binarySplitPolygon=Zs,t.bindContributionProvider=L,t.bindContributionProviderNoSingletonScope=I,t.boundStroke=qa,t.browserEnvModule=nb,t.builtInSymbolStrMap=Cd,t.builtinSymbols=Ad,t.builtinSymbolsMap=Td,t.calcLineCache=Wi,t.calculateArcCornerRadius=Ko,t.calculateLineHeight=_s,t.canvasAllocate=vr,t.centroidOfSubpath=Os,t.circleBounds=vs,t.circleCanvasPickModule=AA,t.circleMathPickModule=Nb,t.circleModule=yg,t.clock=Fr,t.cloneGraphic=Aa,t.colorEqual=function(t,e){const i=Ae.parseColorString(t),n=Ae.parseColorString(e);return!(!i||!n)&&i.r===n.r&&i.g===n.g&&i.b===n.b&&i.opacity===n.opacity},t.colorStringInterpolationToStr=da,t.container=jn,t.cornerTangents=qo,t.createArc=ap,t.createArc3d=hp,t.createArea=np,t.createCircle=du,t.createColor=wn,t.createConicalGradient=ih,t.createGlyph=Nd,t.createGroup=Ro,t.createImage=Vd,t.createImageElement=ib,t.createLine=kd,t.createMat4=Eh,t.createPath=tp,t.createPolygon=up,t.createPyramid3d=pp,t.createRect=Id,t.createRect3d=Ud,t.createRectPath=ol,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=ii,t.cubicLength=ei,t.cubicPointAt=ni,t.cubicSubdivide=Rs,t.decodeReactDom=Ty,t.defaultArcAllocate=Yf,t.defaultArcBackgroundRenderContribution=Qh,t.defaultArcRenderContribution=Zh,t.defaultArcTextureRenderContribution=Jh,t.defaultAreaAllocate=$f,t.defaultBaseBackgroundRenderContribution=Xh,t.defaultBaseTextureRenderContribution=qh,t.defaultCircleAllocate=Kf,t.defaultCircleBackgroundRenderContribution=nl,t.defaultCircleRenderContribution=el,t.defaultCircleTextureRenderContribution=il,t.defaultGraphicMemoryManager=ag,t.defaultGroupBackgroundRenderContribution=sl,t.defaultImageBackgroundRenderContribution=gl,t.defaultImageRenderContribution=fl,t.defaultLineAllocate=Jf,t.defaultPathAllocate=tg,t.defaultRectAllocate=Hf,t.defaultRectBackgroundRenderContribution=dl,t.defaultRectRenderContribution=cl,t.defaultRectTextureRenderContribution=ul,t.defaultSymbolAllocate=ig,t.defaultSymbolBackgroundRenderContribution=bl,t.defaultSymbolRenderContribution=ml,t.defaultSymbolTextureRenderContribution=yl,t.defaultTextAllocate=rg,t.defaultTicker=uf,t.defaultTimeline=es,t.drawArc=qe,t.drawArcPath=Zo,t.drawAreaSegments=Ol,t.drawIncrementalAreaSegments=El,t.drawIncrementalSegments=Ml,t.drawPathProxy=Xo,t.drawSegments=Rl,t.enumCommandMap=Ee,t.feishuEnvModule=Hx,t.fillVisible=zo,t.findBestMorphingRotation=Is,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,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=Ip,t.foreachAsync=Dp,t.genBasisSegments=yi,t.genBasisTypeSegments=mi,t.genLinearClosedSegments=Oi,t.genLinearClosedTypeSegments=Li,t.genLinearSegments=pi,t.genLinearTypeSegments=fi,t.genMonotoneXSegments=_i,t.genMonotoneXTypeSegments=Ci,t.genMonotoneYSegments=Pi,t.genMonotoneYTypeSegments=Bi,t.genNumberType=Za,t.genStepSegments=Mi,t.genStepTypeSegments=Ei,t.getAttributeFromDefaultAttrList=Ss,t.getConicGradientAt=eh,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]+=gh(t,i.clipedWidth)}a[0]+=t,a[1]+=e;const o=Ih.allocate();return Sh(o,o,[a[0],a[1],0]),r&&bh(o,o,r),n&&xh(o,o,n),Sh(o,o,[-a[0],-a[1],0]),o},t.getModelMatrix=Wh,t.getRichTextBounds=function(t){return ec||(ec=Ql.CreateGraphic("richtext",{})),ec.setAttributes(t),ec.AABBBounds},t.getScaledStroke=xn,t.getTextBounds=ic,t.getTheme=Or,t.getThemeFromGroup=Lr,t.globalTheme=kr,t.glyphCanvasPickModule=XA,t.glyphMathPickModule=Xb,t.glyphModule=Pg,t.graphicCreator=Ql,t.graphicService=rf,t.graphicUtil=ef,t.harmonyEnvModule=US,t.identityMat4=yh,t.imageCanvasPickModule=nT,t.imageMathPickModule=Zb,t.imageModule=Ig,t.incrementalAddTo=function(t,e){t.incrementalAppendChild(e)},t.initAllEnv=function(){rS(jn)},t.initBrowserEnv=function(){rb(jn)},t.initFeishuEnv=function(){Vx(jn)},t.initHarmonyEnv=function(){WS(jn)},t.initLynxEnv=function(){hw(jn)},t.initNodeEnv=function(){Tw(jn)},t.initTTEnv=function(){SS(jn)},t.initTaroEnv=function(){Nw(jn)},t.initWxEnv=function(){nS(jn)},t.inject=p,t.injectable=g,t.interpolateColor=ra,t.interpolateGradientConicalColor=ha,t.interpolateGradientLinearColor=aa,t.interpolateGradientRadialColor=oa,t.interpolatePureColorArray=la,t.intersect=$o,t.isBrowserEnv=ff,t.isNodeEnv=gf,t.isSvg=Ya,t.isTransformKey=ws,t.isXML=Xa,t.jsx=function(t,e){const i=e||{},{key:n,name:r,id:s,attribute:a,stateProxy:o}=i,h=wy(i,["key","name","id","attribute","stateProxy"]);let l=t;st(t)&&(l=Ql[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&&Sy(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=yy[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=sf,t.lineCanvasPickModule=rA,t.lineMathPickModule=nx,t.lineModule=dg,t.loadAllEnv=rS,t.loadAllModule=sS,t.loadBrowserEnv=rb,t.loadFeishuEnv=Vx,t.loadHarmonyEnv=WS,t.loadLynxEnv=hw,t.loadNodeEnv=Tw,t.loadTTEnv=SS,t.loadTaroEnv=Nw,t.loadWxEnv=nS,t.lookAt=_h,t.lynxEnvModule=ow,t.mat3Tomat4=Ah,t.mat4Allocate=Ih,t.matrixAllocate=Lh,t.morphPath=ba,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)?Aa:null!==(r=null==n?void 0:n.splitPath)&&void 0!==r?r:Ta)(i,o.length,!0),l=i.attribute;i.setAttribute("visible",!1);const c=o.map(((t,e)=>ga(t.toCustomPath(),h[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:h[e].globalTransMatrix}))),u=o.map(((t,e)=>ma(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 ya({morphingData:c[i],saveOnEnd:!0,otherAttrs:u[i]},null!==(s=n.duration)&&void 0!==s?s:hs.duration,null!==(h=n.easing)&&void 0!==h?h:hs.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 xa({morphingData:c,otherAttrs:u},null!==(s=null==n?void 0:n.duration)&&void 0!==s?s:hs.duration,null!==(a=null==n?void 0:n.easing)&&void 0!==a?a:hs.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=Ch,t.named=v,t.newThemeObj=Pr,t.nodeEnvModule=Aw,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)?Aa:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:Ta)(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);ba(o,e,Object.assign({},i,{onEnd:h,delay:l}),t.globalTransMatrix)}))},t.ortho=Bh,t.parsePadding=ps,t.parseStroke=us,t.parseSvgPath=Ue,t.pathCanvasPickModule=IA,t.pathMathPickModule=gx,t.pathModule=Sg,t.pathToBezierCurves=Us,t.point=gi,t.pointEqual=ms,t.pointInterpolation=ys,t.pointInterpolationHighPerformance=function(t,e,i,n){const{x:r,y:s}=Nt(t.x,t.y,e.x,e.y,i),{x:a,y:o}=Nt(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)=>ms(t,e[i]))):!Number.isNaN(t.x+t.y)&&ms(t,e))},t.pointsInterpolation=bs,t.polygonCanvasPickModule=GA,t.polygonMathPickModule=lx,t.polygonModule=Tg,t.preLoadAllModule=Qp,t.pyramid3dCanvasPickModule=wT,t.pyramid3dModule=$g,t.rafBasedSto=Ts,t.rect3dCanvasPickModule=lT,t.rect3dModule=Ng,t.rectCanvasPickModule=ZS,t.rectFillVisible=Ho,t.rectMathPickModule=Tx,t.rectModule=cg,t.rectStrokeVisible=Yo,t.recursiveCallBinarySplit=Js,t.registerArc=TT,t.registerArc3d=_T,t.registerArc3dGraphic=Kg,t.registerArcGraphic=qg,t.registerArea=PT,t.registerAreaGraphic=Zg,t.registerCircle=MT,t.registerCircleGraphic=Jg,t.registerDirectionalLight=Mf,t.registerFlexLayoutPlugin=wv,t.registerGlyph=kT,t.registerGlyphGraphic=Qg,t.registerGroup=LT,t.registerGroupGraphic=tv,t.registerHtmlAttributePlugin=fv,t.registerImage=DT,t.registerImageGraphic=ev,t.registerLine=UT,t.registerLineGraphic=iv,t.registerOrthoCamera=kf,t.registerPath=NT,t.registerPathGraphic=nv,t.registerPolygon=FT,t.registerPolygonGraphic=rv,t.registerPyramid3d=HT,t.registerPyramid3dGraphic=sv,t.registerReactAttributePlugin=vv,t.registerRect=YT,t.registerRect3d=$T,t.registerRect3dGraphic=ov,t.registerRectGraphic=av,t.registerRichtext=KT,t.registerRichtextGraphic=hv,t.registerShadowRoot=JT,t.registerShadowRootGraphic=uv,t.registerSymbol=tC,t.registerSymbolGraphic=lv,t.registerText=iC,t.registerTextGraphic=cv,t.registerViewTransform3dPlugin=yv,t.registerWrapText=rC,t.registerWrapTextGraphic=dv,t.renderCommandList=Je,t.rewriteProto=function(t,e){Object.setPrototypeOf(t,e)},t.richTextMathPickModule=_x,t.richtextCanvasPickModule=QA,t.richtextModule=Og,t.rotateX=bh,t.rotateY=xh,t.rotateZ=wh,t.roughModule=sC,t.runFill=Go,t.runStroke=Fo,t.scaleMat4=Th,t.segments=Xe,t.shouldUseMat4=Nh,t.snapLength=ti,t.splitArc=Hs,t.splitArea=Xs,t.splitCircle=Vs,t.splitGraphic=Ta,t.splitLine=$s,t.splitPath=ta,t.splitPolygon=Qs,t.splitRect=zs,t.splitToGrids=Fs,t.strCommandMap=["arc","arcTo","bezierCurveTo","closePath","ellipse","lineTo","moveTo","quadraticCurveTo","rect"],t.strokeVisible=Vo,t.symbolCanvasPickModule=mA,t.symbolMathPickModule=kx,t.symbolModule=vg,t.taroEnvModule=Ww,t.textAttributesToStyle=mh,t.textCanvasPickModule=RA,t.textDrawOffsetX=gh,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=vh,t.textMathPickModule=Dx,t.textModule=xg,t.transformKeys=xs,t.transformMat4=Ph,t.transformUtil=nf,t.translate=Sh,t.ttEnvModule=wS,t.version="0.21.5",t.verticalLayout=Qa,t.vglobal=tf,t.waitForAllSubLayers=function(t){return $a(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{mn.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=Nn,t.wrapContext=function(t,e){return jn.getNamed(Wn,mn.global.env)(t,e)},t.wxEnvModule=iS,t.xul=function(t){const e=at(t)?t[0]:t,i=[];if(!e)return i;if(!0===Xa(e)){const t=(new Va).parse(e);t.tc&&Object.keys(t.tc).forEach((e=>{"text"===e?i.push(function(t){const e={text:""};no(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};no(t,e);const i=e.image;return i&&(e.image=i.replaceAll("&quot",'"').replaceAll("&lt","<").replaceAll("&gt",">")),e}(t.tc[e]))}))}return i}}));