@visactor/vrender
Version:
## Description
1 lines • 1.26 MB
JavaScript
!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=g(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=g(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 g(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=(this._bindingDictionary.get(s)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:s,metadata:e,bindings:l};n.push(t)}}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,ContributionStore.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function bindContributionProvider(t,e){t(ContributionProvider).toDynamicValue((({container:t})=>new ContributionProviderCache(e,t))).inSingletonScope().whenTargetNamed(e)}function bindContributionProviderNoSingletonScope(t,e){t(ContributionProvider).toDynamicValue((({container:t})=>new ContributionProviderCache(e,t))).whenTargetNamed(e)}class ContributionStore{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ContributionStore.store=new Map;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(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}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";class Application{}const application=new Application;let idx=0;class PerformanceRAF{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=application.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++idx,t),this.tryRunAnimationFrameNextFrame(),idx}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class EventListenerManager{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const r=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,r),this._nativeAddEventListener(t,r,i)}removeEventListener(t,e,i){var r;if(!e)return;const n=null===(r=this._listenerMap.get(t))||void 0===r?void 0:r.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}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$1n=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)}},__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 extends EventListenerManager{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Generator.GenAutoIncrementId(),this.hooks={onSetEnv:new SyncHook(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new PerformanceRAF);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}},exports.DefaultGlobal=__decorate$1N([injectable(),__param$Z(0,inject(ContributionProvider)),__param$Z(0,named(EnvContribution)),__metadata$1n("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 AnimateMode,AnimateStepType,AnimateStatus;exports.AnimateMode=void 0,AnimateMode=exports.AnimateMode||(exports.AnimateMode={}),AnimateMode[AnimateMode.NORMAL=0]="NORMAL",AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY",exports.STATUS=void 0,function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(exports.STATUS||(exports.STATUS={})),exports.AnimateStepType=void 0,AnimateStepType=exports.AnimateStepType||(exports.AnimateStepType={}),AnimateStepType.wait="wait",AnimateStepType.from="from",AnimateStepType.to="to",AnimateStepType.customAnimate="customAnimate",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";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=(t,e=!1)=>e?"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=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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$1=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||isType$1(t,"Number")};var isNumber$2=isNumber$1;const isValidNumber=t=>isNumber$2(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,i=!1,r=!1){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,r=!1,n=!1){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,...e){let i=-1;const r=e.length;for(;++i<r;)baseMerge(t,e[i],!0);return t}function objToString(t){return Object.prototype.toString.call(t)}function objectKeys(t){return Object.keys(t)}function isEqual(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(objToString(t)!==objToString(e))return!1;if(isFunction$1(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(isArray$1(t)){if(t.length!==e.length)return!1;for(let r=t.length-1;r>=0;r--)if(!isEqual(t[r],e[r],i))return!1;return!0}if(!isPlainObject$1(t))return!1;const r=objectKeys(t),n=objectKeys(e);if(r.length!==n.length)return!1;r.sort(),n.sort();for(let t=r.length-1;t>=0;t--)if(r[t]!=n[t])return!1;for(let n=r.length-1;n>=0;n--){const a=r[n];if(!isEqual(t[a],e[a],i))return!1}return!0}function keys(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}function defaults(t,e,i){const r=keys(e);for(let n=0;n<r.length;n++){const a=r[n];(i?null!=e[a]:null==t[a])&&(t[a]=e[a])}return t}function mixin(t,e,i=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const r=Object.getOwnPropertyNames(e);for(let n=0;n<r.length;n++){const a=r[n];"constructor"!==a&&(i?null!=e[a]:null==t[a])&&(t[a]=e[a])}}else defaults(t,e,i)}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$2(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(t=LoggerLevel.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=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(...t){var e;return this._level>=LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):log(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=LoggerLevel.Warn&&log(this._method||"warn","WARN",t),this}info(...t){return this._level>=LoggerLevel.Info&&log(this._method||"log","INFO",t),this}debug(...t){return this._level>=LoggerLevel.Debug&&log(this._method||"log","DEBUG",t),this}}Logger._instance=null;const DEFAULT_ABSOLUTE_TOLERATE=1e-10,DEFAULT_RELATIVE_TOLERATE=1e-10;function isNumberClose(t,e,i=DEFAULT_RELATIVE_TOLERATE,r=DEFAULT_ABSOLUTE_TOLERATE){const n=r,a=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,a)}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}class Point{constructor(t=0,e=0,i,r){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$2(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return isNumber$2(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=(t=0)=>{if(t<0)for(;t<-tau;)t+=tau;else if(t>0)for(;t>tau;)t-=tau;return t},clampAngleByRadian=clampRadian;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({x:t,y:e},i,r={x:0,y:0}){return{x:(t-r.x)*Math.cos(i)-(e-r.y)*Math.sin(i)+r.x,y:(t-r.x)*Math.sin(i)+(e-r.y)*Math.cos(i)+r.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,i=!1){const r=toRect(t,i),n=toRect(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y],s=a(getCenterPoint(t),getCenterPoint(e)),o=a(r[0],r[1]),l=a(r[1],r[2]),h=a(n[0],n[1]),c=a(n[1],n[2]),u=i?degreeToRadian(t.angle):t.angle;let d=i?degreeToRadian(90-t.angle):t.angle+halfPi$1;const p=i?degreeToRadian(e.angle):e.angle;let f=i?degreeToRadian(90-e.angle):e.angle+halfPi$1;d>pi2&&(d-=pi2),f>pi2&&(f-=pi2);const g=(t,e,i,r)=>{const n=[Math.cos(e),Math.sin(e)];return t+(getProjectionRadius(n,i)+getProjectionRadius(n,r))/2>getProjectionRadius(n,s)};return g((t.x2-t.x1)/2,u,h,c)&&g((t.y2-t.y1)/2,d,h,c)&&g((e.x2-e.x1)/2,p,o,l)&&g((e.y2-e.y1)/2,f,o,l)}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,e={},i){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:g=o}=this._userSpec;if(isString$1(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=o*t}return{fontStyle:n,fontVariant:a,fontFamily:l,fontSize:o,fontWeight:s,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(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(t=0,e=0,i=0,r=0){return this.x1=t,this.y1=e,this.x2=i,this.y2=r,this}set(t=0,e=0,i=0,r=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(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return 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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,r=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(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return 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,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return isRotateAABBIntersect(this,t)}setValue(t=0,e=0,i=0,r=0,n=0){return super.setValue(t,e,i,r),this.angle=n,this}clone(){return new OBBBounds(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[rotatePoint({x:this.x1,y:this.y1},this.angle,t),rotatePoint({x:this.x2,y:this.y1},this.angle,t),rotatePoint({x:this.x1,y:this.y2},this.angle,t),rotatePoint({x:this.x2,y:this.y2},this.a