@leafer-ui/worker 1.6.0 → 1.6.2

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/worker.js CHANGED
@@ -2592,7 +2592,11 @@ var LeaferUI = (function (exports) {
2592
2592
  const point = {};
2593
2593
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
2594
2594
  return point;
2595
- }
2595
+ },
2596
+ getDerivative(t, fromV, v1, v2, toV) {
2597
+ const o = 1 - t;
2598
+ return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
2599
+ },
2596
2600
  };
2597
2601
  const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
2598
2602
 
@@ -3773,8 +3777,11 @@ var LeaferUI = (function (exports) {
3773
3777
  load(onSuccess, onError) {
3774
3778
  if (!this.loading) {
3775
3779
  this.loading = true;
3780
+ let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
3781
+ if (onProgress)
3782
+ loadImage = loadImageWithProgress;
3776
3783
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3777
- return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
3784
+ return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
3778
3785
  this.error = e;
3779
3786
  this.onComplete(false);
3780
3787
  });
@@ -3799,6 +3806,9 @@ var LeaferUI = (function (exports) {
3799
3806
  this.view = img;
3800
3807
  this.onComplete(true);
3801
3808
  }
3809
+ onProgress(progress) {
3810
+ this.progress = progress;
3811
+ }
3802
3812
  onComplete(isSuccess) {
3803
3813
  let odd;
3804
3814
  this.waitComplete.forEach((item, index) => {
@@ -4264,13 +4274,20 @@ var LeaferUI = (function (exports) {
4264
4274
  if (leaf.isBranch) {
4265
4275
  const { children } = leaf;
4266
4276
  for (let i = 0, len = children.length; i < len; i++) {
4267
- updateAllWorldOpacity$1(children[i]);
4277
+ updateAllWorldOpacity(children[i]);
4268
4278
  }
4269
4279
  }
4270
4280
  },
4271
- updateAllChange(leaf) {
4272
- updateAllWorldOpacity$1(leaf);
4281
+ updateChange(leaf) {
4282
+ const layout = leaf.__layout;
4283
+ if (layout.stateStyleChanged)
4284
+ leaf.updateState();
4285
+ if (layout.opacityChanged)
4286
+ updateAllWorldOpacity(leaf);
4273
4287
  leaf.__updateChange();
4288
+ },
4289
+ updateAllChange(leaf) {
4290
+ updateChange$1(leaf);
4274
4291
  if (leaf.isBranch) {
4275
4292
  const { children } = leaf;
4276
4293
  for (let i = 0, len = children.length; i < len; i++) {
@@ -4406,7 +4423,7 @@ var LeaferUI = (function (exports) {
4406
4423
  }
4407
4424
  };
4408
4425
  const L = LeafHelper;
4409
- const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
4426
+ const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L;
4410
4427
  function getTempLocal(t, world) {
4411
4428
  t.__layout.update();
4412
4429
  return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
@@ -6128,7 +6145,7 @@ var LeaferUI = (function (exports) {
6128
6145
  }
6129
6146
  }
6130
6147
 
6131
- const version = "1.6.0";
6148
+ const version = "1.6.2";
6132
6149
 
6133
6150
  class LeaferCanvas extends LeaferCanvasBase {
6134
6151
  get allowBackgroundColor() { return true; }
@@ -6313,7 +6330,7 @@ var LeaferUI = (function (exports) {
6313
6330
  }
6314
6331
  }
6315
6332
 
6316
- const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateAllWorldOpacity } = LeafHelper;
6333
+ const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
6317
6334
  const { pushAllChildBranch, pushAllParent } = BranchHelper;
6318
6335
  function updateMatrix(updateList, levelList) {
6319
6336
  let layout;
@@ -6356,15 +6373,7 @@ var LeaferUI = (function (exports) {
6356
6373
  });
6357
6374
  }
6358
6375
  function updateChange(updateList) {
6359
- let layout;
6360
- updateList.list.forEach(leaf => {
6361
- layout = leaf.__layout;
6362
- if (layout.opacityChanged)
6363
- updateAllWorldOpacity(leaf);
6364
- if (layout.stateStyleChanged)
6365
- setTimeout(() => layout.stateStyleChanged && leaf.updateState());
6366
- leaf.__updateChange();
6367
- });
6376
+ updateList.list.forEach(updateOneChange);
6368
6377
  }
6369
6378
 
6370
6379
  const { worldBounds } = LeafBoundsHelper;
@@ -6585,6 +6594,15 @@ var LeaferUI = (function (exports) {
6585
6594
  }
6586
6595
  checkRender() {
6587
6596
  if (this.running) {
6597
+ const { target } = this;
6598
+ if (target.isApp) {
6599
+ target.emit(RenderEvent.CHILD_START, target);
6600
+ target.children.forEach(leafer => {
6601
+ leafer.renderer.FPS = this.FPS;
6602
+ leafer.renderer.checkRender();
6603
+ });
6604
+ target.emit(RenderEvent.CHILD_END, target);
6605
+ }
6588
6606
  if (this.changed && this.canvas.view)
6589
6607
  this.render();
6590
6608
  this.target.emit(RenderEvent.NEXT);
@@ -6670,7 +6688,7 @@ var LeaferUI = (function (exports) {
6670
6688
  bounds.spread(Renderer.clipSpread).ceil();
6671
6689
  canvas.clearWorld(bounds, true);
6672
6690
  canvas.clipWorld(bounds, true);
6673
- this.__render(bounds, block.includes(this.target.__world), realBounds);
6691
+ this.__render(bounds, realBounds);
6674
6692
  canvas.restore();
6675
6693
  Run.end(t);
6676
6694
  }
@@ -6679,12 +6697,12 @@ var LeaferUI = (function (exports) {
6679
6697
  const { canvas } = this;
6680
6698
  canvas.save();
6681
6699
  canvas.clear();
6682
- this.__render(canvas.bounds, true);
6700
+ this.__render(canvas.bounds);
6683
6701
  canvas.restore();
6684
6702
  Run.end(t);
6685
6703
  }
6686
- __render(bounds, includes, realBounds) {
6687
- const { canvas } = this, options = includes ? { includes } : { bounds, includes };
6704
+ __render(bounds, realBounds) {
6705
+ const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
6688
6706
  if (this.needFill)
6689
6707
  canvas.fillWorld(bounds, this.config.fill);
6690
6708
  if (Debug.showRepaint)
@@ -6711,22 +6729,14 @@ var LeaferUI = (function (exports) {
6711
6729
  }
6712
6730
  __requestRender() {
6713
6731
  const target = this.target;
6714
- if (target.parentApp)
6715
- return target.parentApp.renderer.update(false);
6716
- if (this.requestTime)
6732
+ if (this.requestTime || !target)
6717
6733
  return;
6734
+ if (target.parentApp)
6735
+ return target.parentApp.requestRender(false);
6718
6736
  const requestTime = this.requestTime = Date.now();
6719
6737
  Platform.requestRender(() => {
6720
6738
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
6721
6739
  this.requestTime = 0;
6722
- if (target.isApp) {
6723
- target.emit(RenderEvent.CHILD_START, target);
6724
- target.children.forEach(leafer => {
6725
- leafer.renderer.FPS = this.FPS;
6726
- leafer.renderer.checkRender();
6727
- });
6728
- target.emit(RenderEvent.CHILD_END, target);
6729
- }
6730
6740
  this.checkRender();
6731
6741
  });
6732
6742
  }
@@ -7208,13 +7218,11 @@ var LeaferUI = (function (exports) {
7208
7218
  setFontWeight(value) {
7209
7219
  if (typeof value === 'string') {
7210
7220
  this.__setInput('fontWeight', value);
7211
- this._fontWeight = fontWeightMap[value] || 400;
7212
- }
7213
- else {
7214
- if (this.__input)
7215
- this.__removeInput('fontWeight');
7216
- this._fontWeight = value;
7221
+ value = fontWeightMap[value] || 400;
7217
7222
  }
7223
+ else if (this.__input)
7224
+ this.__removeInput('fontWeight');
7225
+ this._fontWeight = value;
7218
7226
  }
7219
7227
  setBoxStyle(value) {
7220
7228
  let t = this.__leaf, box = t.__box;
@@ -7541,6 +7549,9 @@ var LeaferUI = (function (exports) {
7541
7549
  else
7542
7550
  drawer.rect(x, y, width, height);
7543
7551
  }
7552
+ drawImagePlaceholder(canvas, _image) {
7553
+ Paint.fill(this.__.placeholderColor, this, canvas);
7554
+ }
7544
7555
  animate(_keyframe, _options, _type, _isTemp) {
7545
7556
  return Plugin.need('animate');
7546
7557
  }
@@ -7777,6 +7788,9 @@ var LeaferUI = (function (exports) {
7777
7788
  __decorate([
7778
7789
  effectType()
7779
7790
  ], exports.UI.prototype, "filter", void 0);
7791
+ __decorate([
7792
+ surfaceType()
7793
+ ], exports.UI.prototype, "placeholderColor", void 0);
7780
7794
  __decorate([
7781
7795
  dataType({})
7782
7796
  ], exports.UI.prototype, "data", void 0);
@@ -8607,10 +8621,11 @@ var LeaferUI = (function (exports) {
8607
8621
  get ready() { return this.image ? this.image.ready : false; }
8608
8622
  constructor(data) {
8609
8623
  super(data);
8610
- this.on(ImageEvent.LOADED, (e) => {
8611
- if (e.attrName === 'fill' && e.attrValue.url === this.url)
8612
- this.image = e.image;
8613
- });
8624
+ this.on_(ImageEvent.LOADED, this.__onLoaded, this);
8625
+ }
8626
+ __onLoaded(e) {
8627
+ if (e.attrName === 'fill' && e.attrValue.url === this.url)
8628
+ this.image = e.image;
8614
8629
  }
8615
8630
  destroy() {
8616
8631
  this.image = null;
@@ -8724,7 +8739,7 @@ var LeaferUI = (function (exports) {
8724
8739
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
8725
8740
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
8726
8741
  data.__clipText = textOverflow !== 'show' && !data.__autoSize;
8727
- data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8742
+ data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
8728
8743
  }
8729
8744
  __updateBoxBounds() {
8730
8745
  const data = this.__;
@@ -8822,6 +8837,9 @@ var LeaferUI = (function (exports) {
8822
8837
  __decorate([
8823
8838
  boundsType('')
8824
8839
  ], exports.Text.prototype, "text", void 0);
8840
+ __decorate([
8841
+ boundsType('')
8842
+ ], exports.Text.prototype, "placeholder", void 0);
8825
8843
  __decorate([
8826
8844
  boundsType('caption')
8827
8845
  ], exports.Text.prototype, "fontFamily", void 0);
@@ -9697,8 +9715,7 @@ var LeaferUI = (function (exports) {
9697
9715
  if (this.downData) {
9698
9716
  const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
9699
9717
  if (canDrag) {
9700
- if (this.waitTap || this.longPressTimer)
9701
- this.pointerWaitCancel();
9718
+ this.pointerWaitCancel();
9702
9719
  this.waitRightTap = false;
9703
9720
  }
9704
9721
  this.dragger.checkDrag(data, canDrag);
@@ -9980,9 +9997,11 @@ var LeaferUI = (function (exports) {
9980
9997
  this.waitTap = true;
9981
9998
  }
9982
9999
  tapWaitCancel() {
9983
- clearTimeout(this.tapTimer);
9984
- this.waitTap = false;
9985
- this.tapCount = 0;
10000
+ if (this.waitTap) {
10001
+ clearTimeout(this.tapTimer);
10002
+ this.waitTap = false;
10003
+ this.tapCount = 0;
10004
+ }
9986
10005
  }
9987
10006
  longPressWait(data) {
9988
10007
  clearTimeout(this.longPressTimer);
@@ -10002,8 +10021,10 @@ var LeaferUI = (function (exports) {
10002
10021
  return hasLong;
10003
10022
  }
10004
10023
  longPressWaitCancel() {
10005
- clearTimeout(this.longPressTimer);
10006
- this.longPressed = false;
10024
+ if (this.longPressTimer) {
10025
+ clearTimeout(this.longPressTimer);
10026
+ this.longPressed = false;
10027
+ }
10007
10028
  }
10008
10029
  __onResize() {
10009
10030
  const { dragOut } = this.m;
@@ -10244,8 +10265,10 @@ var LeaferUI = (function (exports) {
10244
10265
  };
10245
10266
 
10246
10267
  function fillText(ui, canvas) {
10247
- let row, data = ui.__.__textDrawData;
10248
- const { rows, decorationY } = data;
10268
+ const data = ui.__, { rows, decorationY } = data.__textDrawData;
10269
+ if (data.__isPlacehold && data.placeholderColor)
10270
+ canvas.fillStyle = data.placeholderColor;
10271
+ let row;
10249
10272
  for (let i = 0, len = rows.length; i < len; i++) {
10250
10273
  row = rows[i];
10251
10274
  if (row.text)
@@ -10254,7 +10277,7 @@ var LeaferUI = (function (exports) {
10254
10277
  row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
10255
10278
  }
10256
10279
  if (decorationY) {
10257
- const { decorationColor, decorationHeight } = data;
10280
+ const { decorationColor, decorationHeight } = data.__textDrawData;
10258
10281
  if (decorationColor)
10259
10282
  canvas.fillStyle = decorationColor;
10260
10283
  rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
@@ -10263,38 +10286,44 @@ var LeaferUI = (function (exports) {
10263
10286
 
10264
10287
  function fill(fill, ui, canvas) {
10265
10288
  canvas.fillStyle = fill;
10266
- ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
10289
+ fillPathOrText(ui, canvas);
10267
10290
  }
10268
10291
  function fills(fills, ui, canvas) {
10269
10292
  let item;
10270
- const { windingRule, __font } = ui.__;
10271
10293
  for (let i = 0, len = fills.length; i < len; i++) {
10272
10294
  item = fills[i];
10273
- if (item.image && PaintImage.checkImage(ui, canvas, item, !__font))
10274
- continue;
10275
- if (item.style) {
10276
- canvas.fillStyle = item.style;
10277
- if (item.transform) {
10278
- canvas.save();
10279
- canvas.transform(item.transform);
10280
- if (item.blendMode)
10281
- canvas.blendMode = item.blendMode;
10282
- __font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
10283
- canvas.restore();
10295
+ if (item.image) {
10296
+ if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
10297
+ continue;
10298
+ if (!item.style) {
10299
+ if (!i && item.image.isPlacehold)
10300
+ ui.drawImagePlaceholder(canvas, item.image);
10301
+ continue;
10284
10302
  }
10285
- else {
10286
- if (item.blendMode) {
10287
- canvas.saveBlendMode(item.blendMode);
10288
- __font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
10289
- canvas.restoreBlendMode();
10290
- }
10291
- else {
10292
- __font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
10293
- }
10303
+ }
10304
+ canvas.fillStyle = item.style;
10305
+ if (item.transform) {
10306
+ canvas.save();
10307
+ canvas.transform(item.transform);
10308
+ if (item.blendMode)
10309
+ canvas.blendMode = item.blendMode;
10310
+ fillPathOrText(ui, canvas);
10311
+ canvas.restore();
10312
+ }
10313
+ else {
10314
+ if (item.blendMode) {
10315
+ canvas.saveBlendMode(item.blendMode);
10316
+ fillPathOrText(ui, canvas);
10317
+ canvas.restoreBlendMode();
10294
10318
  }
10319
+ else
10320
+ fillPathOrText(ui, canvas);
10295
10321
  }
10296
10322
  }
10297
10323
  }
10324
+ function fillPathOrText(ui, canvas) {
10325
+ ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
10326
+ }
10298
10327
 
10299
10328
  function strokeText(stroke, ui, canvas) {
10300
10329
  const { strokeAlign } = ui.__;
@@ -10534,6 +10563,7 @@ var LeaferUI = (function (exports) {
10534
10563
  compute,
10535
10564
  fill,
10536
10565
  fills,
10566
+ fillPathOrText,
10537
10567
  fillText,
10538
10568
  stroke,
10539
10569
  strokes,
@@ -10726,6 +10756,13 @@ var LeaferUI = (function (exports) {
10726
10756
  onLoadError(ui, event, error);
10727
10757
  leafPaint.loadId = null;
10728
10758
  });
10759
+ if (ui.placeholderColor)
10760
+ setTimeout(() => {
10761
+ if (!(image.ready || image.isPlacehold)) {
10762
+ image.isPlacehold = true;
10763
+ ui.forceUpdate('surface');
10764
+ }
10765
+ }, 100);
10729
10766
  }
10730
10767
  return leafPaint;
10731
10768
  }
@@ -11936,4 +11973,7 @@ var LeaferUI = (function (exports) {
11936
11973
  return exports;
11937
11974
 
11938
11975
  })({});
11939
- //# sourceMappingURL=worker.js.map
11976
+
11977
+ function Leafer(opt) { return new LeaferUI.Leafer(opt); }
11978
+ Object.setPrototypeOf(Leafer, LeaferUI);
11979
+ Leafer.prototype = LeaferUI.Leafer.prototype;
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),n=require("@leafer-ui/draw");class i extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:a}=t.FileHelper;function r(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((i,r)=>{t.convertToBlob({type:a(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)})).catch((t=>{r(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:a(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,i)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then((t=>{n(t)})).catch((t=>{i(t)}))},a.onerror=t=>i(t),a.send()}))},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new i(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):s.indexOf("Safari")>-1&&-1===s.indexOf("Chrome")&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateAllWorldOpacity:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:g,updateAllChange:_}=t.LeafHelper,y=t.Debug.get("Layouter");class w{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=t.LayoutEvent,f=this.getBlocks(a);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(r,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||d(i[t])}d(n)}}))}(this.__levelList),function(t){let e;t.list.forEach((t=>{e=t.__layout,e.opacityChanged&&h(t),e.stateStyleChanged&&setTimeout((()=>e.stateStyleChanged&&t.updateState())),t.__updateChange()}))}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:r}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),w.fullLayout(n),s.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(a,s,this.times)),n.emitEvent(new t.LayoutEvent(r,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const m=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){this.running&&(this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT))}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,m.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,m.error(t)}m.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return m.warn("rendering");if(this.times>3)return m.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)})))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),r=new t.Bounds(a);i.save(),a.spread(v.clipSpread).ceil(),i.clearWorld(a,!0),i.clipWorld(a,!0),this.__render(a,e.includes(this.target.__world),r),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds,!0),n.restore(),t.Run.end(e)}__render(e,n,i){const{canvas:a}=this,r=n?{includes:n}:{bounds:e,includes:n};this.needFill&&a.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(a,e),this.target.__render(a,r),this.renderBounds=i=i||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=i:this.totalBounds.add(i),a.updateRender(i)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=this.target;if(e.parentApp)return e.parentApp.renderer.update(!1);if(this.requestTime)return;const n=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-n))),this.requestTime=0,e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||m.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,n,i){n||(n=0),i||(i={});const a=i.through||!1,r=i.ignoreHittable||!1,s=i.target||this.target;this.exclude=i.exclude||null,this.point={x:e.x,y:e.y,radiusX:n,radiusY:n},this.findList=new t.LeafList(i.findList),i.findList||this.hitBranch(s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,i.bottomList,r),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),a?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}getBestMatchLeaf(e,n,i){if(e.length){let n;this.findList=new t.LeafList;const{x:a,y:r}=this.point,s={x:a,y:r,radiusX:0,radiusY:0};for(let a=0,r=e.length;a<r;a++)if(n=e[a],(i||t.LeafHelper.worldHittable(n))&&(this.hitChild(n,s),this.findList.length))return this.findList.list[0]}if(n)for(let t=0,e=n.length;t<e;t++)if(this.hitChild(n[t].target,this.point,n[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const n=new t.LeafList;for(;e;)n.add(e),e=e.parent;return this.target&&n.add(this.target),n}getHitablePath(e){const n=this.getPath(e&&e.hittable?e:null);let i,a=new t.LeafList;for(let t=n.list.length-1;t>-1&&(i=n.list[t],i.__.hittable)&&(a.addAt(i,0),i.__.hitChildren);t--);return a}getThroughPath(e){const n=new t.LeafList,i=[];for(let t=e.length-1;t>-1;t--)i.push(this.getPath(e[t]));let a,r,s;for(let t=0,e=i.length;t<e;t++){a=i[t],r=i[t+1];for(let t=0,e=a.length;t<e&&(s=a.list[t],!r||!r.has(s));t++)n.add(s)}return n}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let n,i;const{point:a}=this;for(let r=t.length-1;r>-1;r--)n=t[r],!n.__.visible||e&&!n.__.mask||(i=!!n.__.hitRadius||x(n.__world,a),n.isBranch?(i||n.__ignoreHitWorld)&&(this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&this.hitChild(n,a)):i&&this.hitChild(n,a))}hitChild(t,e,n){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:i}=t;if(i&&i.__hasMask&&!t.__.mask&&!i.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(n||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,n){this.config={},n&&(this.config=t.DataHelper.default(n,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,n,i){const{target:a,picker:r}=this;return t.Platform.backgrounder&&a&&a.updateLayout(),r.getByPoint(e,n,i)}getBy(e,n,i,a){return this.finder?this.finder.getBy(e,n,i,a):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){let n,i=t.__.__textDrawData;const{rows:a,decorationY:r}=i;for(let t=0,i=a.length;t<i;t++)n=a[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.fillText(t.char,t.x,n.y)}));if(r){const{decorationColor:t,decorationHeight:n}=i;t&&(e.fillStyle=t),a.forEach((t=>r.forEach((i=>e.fillRect(t.x,t.y+i,t.width,n)))))}}function L(t,e,n){const{strokeAlign:i}=e.__,a="string"!=typeof t;switch(i){case"center":n.setStroke(a?void 0:t,e.__.strokeWidth,e.__),a?P(t,!0,e,n):k(e,n);break;case"inside":R("inside",t,a,e,n);break;case"outside":R("outside",t,a,e,n)}}function R(t,e,n,i,a){const{__strokeWidth:r,__font:s}=i.__,o=a.getSameCanvas(!0,!0);o.setStroke(n?void 0:e,2*r,i.__),o.font=s,n?P(e,!0,i,o):k(i,o),o.blendMode="outside"===t?"destination-out":"destination-in",E(i,o),o.blendMode="normal",i.__worldFlipped?a.copyWorldByReset(o,i.__nowWorld):a.copyWorldToInner(o,i.__nowWorld,i.__layout.renderBounds),o.recycle(i.__nowWorld)}function k(t,e){let n,i=t.__.__textDrawData;const{rows:a,decorationY:r}=i;for(let t=0,i=a.length;t<i;t++)n=a[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)}));if(r){const{decorationHeight:t}=i;a.forEach((n=>r.forEach((i=>e.strokeRect(n.x,n.y+i,n.width,t)))))}}function P(t,e,i,a){let r;for(let s=0,o=t.length;s<o;s++)r=t[s],r.image&&n.PaintImage.checkImage(i,a,r,!1)||r.style&&(a.strokeStyle=r.style,r.blendMode?(a.saveBlendMode(r.blendMode),e?k(i,a):a.stroke(),a.restoreBlendMode()):e?k(i,a):a.stroke())}function S(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>new B(t,e)}),t.Platform.layout=w.fullLayout;const{getSpread:C,getOuterOf:A,getByMove:W,getIntersectData:O}=t.BoundsHelper;let M;function T(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:a}=i.__layout;switch(e.type){case"solid":let{type:r,blendMode:s,color:o,opacity:l}=e;return{type:r,blendMode:s,style:n.ColorConvert.string(o,l)};case"image":return n.PaintImage.image(i,t,e,a,!M||!M[e.url]);case"linear":return n.PaintGradient.linearGradient(e,a);case"radial":return n.PaintGradient.radialGradient(e,a);case"angular":return n.PaintGradient.conicGradient(e,a);default:return void 0!==e.r?{type:"solid",style:n.ColorConvert.string(e)}:void 0}}const I={compute:function(t,e){const i=e.__,a=[];let r,s=i.__input[t];s instanceof Array||(s=[s]),M=n.PaintImage.recycleImage(t,i);for(let n,i=0,r=s.length;i<r;i++)n=T(t,s[i],e),n&&a.push(n);i["_"+t]=a.length?a:void 0,a.length&&a[0].image&&(r=a[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=r:i.__pixelStroke=r},fill:function(t,e,n){n.fillStyle=t,e.__.__font?E(e,n):e.__.windingRule?n.fill(e.__.windingRule):n.fill()},fills:function(t,e,i){let a;const{windingRule:r,__font:s}=e.__;for(let o=0,l=t.length;o<l;o++)a=t[o],a.image&&n.PaintImage.checkImage(e,i,a,!s)||a.style&&(i.fillStyle=a.style,a.transform?(i.save(),i.transform(a.transform),a.blendMode&&(i.blendMode=a.blendMode),s?E(e,i):r?i.fill(r):i.fill(),i.restore()):a.blendMode?(i.saveBlendMode(a.blendMode),s?E(e,i):r?i.fill(r):i.fill(),i.restoreBlendMode()):s?E(e,i):r?i.fill(r):i.fill())},fillText:E,stroke:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:r,__font:s}=i;if(a)if(s)L(t,e,n);else switch(r){case"center":n.setStroke(t,a,i),n.stroke(),i.__useArrow&&S(e,n);break;case"inside":n.save(),n.setStroke(t,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const r=n.getSameCanvas(!0,!0);r.setStroke(t,2*a,i),e.__drawRenderPath(r),r.stroke(),i.windingRule?r.clip(i.windingRule):r.clip(),r.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(r,e.__nowWorld):n.copyWorldToInner(r,e.__nowWorld,e.__layout.renderBounds),r.recycle(e.__nowWorld)}},strokes:function(t,e,n){const i=e.__,{__strokeWidth:a,strokeAlign:r,__font:s}=i;if(a)if(s)L(t,e,n);else switch(r){case"center":n.setStroke(void 0,a,i),P(t,!1,e,n),i.__useArrow&&S(e,n);break;case"inside":n.save(),n.setStroke(void 0,2*a,i),i.windingRule?n.clip(i.windingRule):n.clip(),P(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:r}=e.__layout,s=n.getSameCanvas(!0,!0);e.__drawRenderPath(s),s.setStroke(void 0,2*a,i),P(t,!1,e,s),i.windingRule?s.clip(i.windingRule):s.clip(),s.clearWorld(r),e.__worldFlipped?n.copyWorldByReset(s,e.__nowWorld):n.copyWorldToInner(s,e.__nowWorld,r),s.recycle(e.__nowWorld)}},strokeText:L,drawTextStroke:k,shape:function(t,e,n){const i=e.getSameCanvas(),a=t.__nowWorld;let r,s,o,l,{scaleX:d,scaleY:h}=a;if(d<0&&(d=-d),h<0&&(h=-h),e.bounds.includes(a))l=i,r=o=a;else{const{renderShapeSpread:i}=t.__layout,c=O(i?C(e.bounds,d===h?i*d:[i*h,i*d]):e.bounds,a);s=e.bounds.getFitMatrix(c);let{a:u,d:f}=s;if(s.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,n),d*=u,h*=f),o=A(a,s),r=W(o,-s.e,-s.f),n.matrix){const{matrix:t}=n;s.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:s.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:s,bounds:r,worldCanvas:l,shapeBounds:o,scaleX:d,scaleY:h}}};let D={};const{get:H,rotateOfOuter:F,translate:G,scaleOfOuter:j,scale:Y,rotate:z}=t.MatrixHelper;function q(t,e,n,i,a,r,s){const o=H();G(o,e.x+n,e.y+i),Y(o,a,r),s&&F(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o}function N(t,e,n,i,a,r,s){const o=H();G(o,e.x+n,e.y+i),a&&Y(o,a,r),s&&z(o,s),t.transform=o}function U(t,e,n,i,a,r,s,o,l,d){const h=H();if(l)if("center"===d)F(h,{x:n/2,y:i/2},l);else switch(z(h,l),l){case 90:G(h,i,0);break;case 180:G(h,n,i);break;case 270:G(h,0,n)}D.x=e.x+a,D.y=e.y+r,G(h,D.x,D.y),s&&j(h,D,s,o),t.transform=h}const{get:X,translate:V}=t.MatrixHelper,Q=new t.Bounds,Z={},K={};function $(t,e,n,i){const{blendMode:a,changeful:r,sync:s}=n;a&&(t.blendMode=a),r&&(t.changeful=r),s&&(t.sync=s),t.data=J(n,i,e)}function J(e,n,i){let{width:a,height:r}=i;e.padding&&(n=Q.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:s,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,repeat:f,filters:p}=e,g=n.width===a&&n.height===r,_={mode:o},y="center"!==l&&(u||0)%180==90,w=y?r:a,m=y?a:r;let v,x,b=0,B=0;if(o&&"cover"!==o&&"fit"!==o)(h||c)&&(t.MathHelper.getScaleData(h,c,i,K),v=K.scaleX,x=K.scaleY);else if(!g||u){const t=n.width/w,e=n.height/m;v=x="fit"===o?Math.min(t,e):Math.max(t,e),b+=(n.width-a*v)/2,B+=(n.height-r*x)/2}if(l){const e={x:b,y:B,width:w,height:m};v&&(e.width*=v,e.height*=x),t.AlignHelper.toPoint(l,e,n,Z,!0),b+=Z.x,B+=Z.y}switch(d&&(b+=d.x,B+=d.y),o){case"stretch":g||(a=n.width,r=n.height);break;case"normal":case"clip":(b||B||v||u)&&N(_,n,b,B,v,x,u);break;case"repeat":(!g||v||u)&&U(_,n,a,r,b,B,v,x,u,l),f||(_.repeat="repeat");break;default:v&&q(_,n,b,B,v,x,u)}return _.transform||(n.x||n.y)&&(_.transform=X(),V(_.transform,n.x,n.y)),v&&"stretch"!==o&&(_.scaleX=v,_.scaleY=x),_.width=a,_.height=r,s&&(_.opacity=s),p&&(_.filters=p),f&&(_.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),_}let tt,et=new t.Bounds;const{isSame:nt}=t.BoundsHelper;function it(t,e,n,i,a,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||$(a,i,n,r),!0}function at(e,n){ot(e,t.ImageEvent.LOAD,n)}function rt(e,n){ot(e,t.ImageEvent.LOADED,n)}function st(e,n,i){n.error=i,e.forceUpdate("surface"),ot(e,t.ImageEvent.ERROR,n)}function ot(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function lt(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:dt,scale:ht,copy:ct}=t.MatrixHelper,{ceil:ut,abs:ft}=Math;function pt(e,n,i){let{scaleX:a,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const s=a+"-"+r+"-"+i;if(n.patternId===s||e.destroyed)return!1;{a=ft(a),r=ft(r);const{image:e,data:o}=n;let l,d,{width:h,height:c,scaleX:u,scaleY:f,transform:p,repeat:g}=o;u&&(d=dt(),ct(d,p),ht(d,1/u,1/f),a*=u,r*=f),a*=i,r*=i,h*=a,c*=r;const _=h*c;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}_>y&&(l=Math.sqrt(_/y)),l&&(a/=l,r/=l,h/=l,c/=l),u&&(a/=u,r/=f),(p||1!==a||1!==r)&&(d||(d=dt(),p&&ct(d,p)),ht(d,1/a,1/r));const w=e.getCanvas(ut(h)||1,ut(c)||1,o.opacity,o.filters),m=e.getPattern(w,g||t.Platform.origin.noRepeat||"no-repeat",d,n);return n.style=m,n.patternId=s,!0}}function gt(t,e,n,i){return new(n||(n=Promise))((function(a,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,o)}l((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:_t}=Math;const yt={image:function(e,n,i,a,r){let s,o;const l=t.ImageManager.get(i);return tt&&i===tt.paint&&nt(a,tt.boxBounds)?s=tt.leafPaint:(s={type:i.type,image:l},tt=l.use>1?{leafPaint:s,paint:i,boxBounds:et.set(a)}:null),(r||l.loading)&&(o={image:l,attrName:n,attrValue:i}),l.ready?(it(e,n,i,l,s,a),r&&(at(e,o),rt(e,o))):l.error?r&&st(e,o,l.error):(r&&(lt(e,!0),at(e,o)),s.loadId=l.load((()=>{lt(e,!1),e.destroyed||(it(e,n,i,l,s,a)&&(l.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),rt(e,o)),s.loadId=null}),(t=>{lt(e,!1),st(e,o,t),s.loadId=null}))),s},checkImage:function(e,i,a,r){const{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:l}=i,{data:d}=a;if(!d||a.patternId===s+"-"+o+"-"+l&&!n.Export.running)return!1;if(r)if(d.repeat)r=!1;else if(!(a.changeful||t.ResizeEvent.isResizing(e)||n.Export.running)){let{width:e,height:n}=d;e*=_t(s)*l,n*=_t(o)*l,d.scaleX&&(e*=d.scaleX,n*=d.scaleY),r=e*n>t.Platform.image.maxCacheSize}return r?(function(t,e,n,i){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),n.blendMode&&(e.blendMode=n.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(n.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,i,a,d),!0):(!a.style||a.sync||n.Export.running?pt(e,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add((()=>gt(this,void 0,void 0,(function*(){a.patternTask=null,i.bounds.hit(e.__nowWorld)&&pt(e,a,l),e.forceUpdate("surface")}))),300)),!1)},createPattern:pt,recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let a,r,s,o,l;for(let d=0,h=i.length;d<h;d++)a=i[d],r=a.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,t.ImageManager.recycle(r),r.loading&&(o||(o=n.__input&&n.__input[e]||[],o instanceof Array||(o=[o])),r.unload(i[d].loadId,!o.some((t=>t.url===l)))));return s}return null},createData:$,getPatternData:J,fillOrFitMode:q,clipMode:N,repeatMode:U},{toPoint:wt}=t.AroundHelper,mt={},vt={};function xt(t,e,i){if(e){let a;for(let r=0,s=e.length;r<s;r++)a=e[r],"string"==typeof a?t.addColorStop(r/(s-1),n.ColorConvert.string(a,i)):t.addColorStop(a.offset,n.ColorConvert.string(a.color,i))}}const{getAngle:bt,getDistance:Bt}=t.PointHelper,{get:Et,rotateOfOuter:Lt,scaleOfOuter:Rt}=t.MatrixHelper,{toPoint:kt}=t.AroundHelper,Pt={},St={};function Ct(t,e,n,i,a){let r;const{width:s,height:o}=t;if(s!==o||i){const t=bt(e,n);r=Et(),a?(Rt(r,e,s/o*(i||1),1),Lt(r,e,t+90)):(Rt(r,e,1,s/o*(i||1)),Lt(r,e,t))}return r}const{getDistance:At}=t.PointHelper,{toPoint:Wt}=t.AroundHelper,Ot={},Mt={};const Tt={linearGradient:function(e,n){let{from:i,to:a,type:r,blendMode:s,opacity:o}=e;wt(i||"top",n,mt),wt(a||"bottom",n,vt);const l=t.Platform.canvas.createLinearGradient(mt.x,mt.y,vt.x,vt.y);xt(l,e.stops,o);const d={type:r,style:l};return s&&(d.blendMode=s),d},radialGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,blendMode:o,stretch:l}=e;kt(i||"center",n,Pt),kt(a||"bottom",n,St);const d=t.Platform.canvas.createRadialGradient(Pt.x,Pt.y,0,Pt.x,Pt.y,Bt(Pt,St));xt(d,e.stops,s);const h={type:r,style:d},c=Ct(n,Pt,St,l,!0);return c&&(h.transform=c),o&&(h.blendMode=o),h},conicGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,blendMode:o,stretch:l}=e;Wt(i||"center",n,Ot),Wt(a||"bottom",n,Mt);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Ot.x,Ot.y):t.Platform.canvas.createRadialGradient(Ot.x,Ot.y,0,Ot.x,Ot.y,At(Ot,Mt));xt(d,e.stops,s);const h={type:r,style:d},c=Ct(n,Ot,Mt,l||1,t.Platform.conicGradientRotate90);return c&&(h.transform=c),o&&(h.blendMode=o),h},getTransform:Ct},{copy:It,toOffsetOutBounds:Dt}=t.BoundsHelper,Ht={},Ft={};function Gt(e,n,i,a){const{bounds:r,shapeBounds:s}=a;if(t.Platform.fullImageShadow){if(It(Ht,e.bounds),Ht.x+=n.x-s.x,Ht.y+=n.y-s.y,i){const{matrix:t}=a;Ht.x-=(r.x+(t?t.e:0)+r.width/2)*(i-1),Ht.y-=(r.y+(t?t.f:0)+r.height/2)*(i-1),Ht.width*=i,Ht.height*=i}e.copyWorld(a.canvas,e.bounds,Ht)}else i&&(It(Ht,n),Ht.x-=n.width/2*(i-1),Ht.y-=n.height/2*(i-1),Ht.width*=i,Ht.height*=i),e.copyWorld(a.canvas,s,i?Ht:n)}const{toOffsetOutBounds:jt}=t.BoundsHelper,Yt={};const zt={shadow:function(t,e,i){let a,r;const{__nowWorld:s,__layout:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;Dt(h,Ft),l.forEach(((l,_)=>{p.setWorldShadow(Ft.offsetX+l.x*u,Ft.offsetY+l.y*f,l.blur*u,n.ColorConvert.string(l.color)),r=l.spread?1+2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Gt(p,Ft,r,i),a=h,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,h,s,"copy"),a=s),d?p.copyWorld(d,s,s,"destination-out"):p.copyWorld(i.canvas,c,h,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,a,s,l.blendMode):e.copyWorldToInner(p,a,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(a,!0)})),p.recycle(a)},innerShadow:function(t,e,i){let a,r;const{__nowWorld:s,__layout:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;jt(h,Yt),l.forEach(((l,_)=>{p.save(),p.setWorldShadow(Yt.offsetX+l.x*u,Yt.offsetY+l.y*f,l.blur*u),r=l.spread?1-2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Gt(p,Yt,r,i),p.restore(),d?(p.copyWorld(p,h,s,"copy"),p.copyWorld(d,s,s,"source-out"),a=s):(p.copyWorld(i.canvas,c,h,"source-out"),a=h),p.fillWorld(a,n.ColorConvert.string(l.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,a,s,l.blendMode):e.copyWorldToInner(p,a,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(a,!0)})),p.recycle(a)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:qt}=t.LeafBoundsHelper;function Nt(t,e,n,i,a,r){switch(e){case"grayscale":a.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,n,i){const a=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,a),i.recycle(a),Xt(t,e,n,1)}(t,n,i,a);break;case"opacity-path":Xt(t,n,i,r);break;case"path":n.restore()}}function Ut(t){return t.getSameCanvas(!1,!0)}function Xt(t,e,n,i){const a=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,a),n.recycle(a)}n.Group.prototype.__renderMask=function(t,e){let n,i,a,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++)n=l[d],o=n.__.mask,o&&(s&&(Nt(this,s,t,a,i,r),i=a=null),"path"===o||"clipping-path"===o?(n.opacity<1?(s="opacity-path",r=n.opacity,a||(a=Ut(t))):(s="path",t.save()),n.__clip(a||t,e)):(s="grayscale"===o?"grayscale":"alpha",i||(i=Ut(t)),a||(a=Ut(t)),n.__render(i,e)),"clipping"!==o&&"clipping-path"!==o)||qt(n,e)||n.__render(a||t,e);Nt(this,s,t,a,i,r)};const Vt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Qt=Vt+"_#~&*+\\=|≮≯≈≠=…",Zt=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function Kt(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const $t=Kt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Jt=Kt("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),te=Kt(Vt),ee=Kt(Qt),ne=Kt("- —/~|┆·");var ie;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(ie||(ie={}));const{Letter:ae,Single:re,Before:se,After:oe,Symbol:le,Break:de}=ie;function he(t){return $t[t]?ae:ne[t]?de:Jt[t]?se:te[t]?oe:ee[t]?le:Zt.test(t)?re:ae}const ce={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let r=a-1;r>-1&&(n=e[r].data[0]," "===n.char);r--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function ue(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:fe}=ce,{Letter:pe,Single:ge,Before:_e,After:ye,Symbol:we,Break:me}=ie;let ve,xe,be,Be,Ee,Le,Re,ke,Pe,Se,Ce,Ae,We,Oe,Me,Te,Ie,De=[];function He(t,e){Pe&&!ke&&(ke=Pe),ve.data.push({char:t,width:e}),be+=e}function Fe(){Be+=be,ve.width=be,xe.words.push(ve),ve={data:[]},be=0}function Ge(){Oe&&(Me.paraNumber++,xe.paraStart=!0,Oe=!1),Pe&&(xe.startCharSize=ke,xe.endCharSize=Pe,ke=0),xe.width=Be,Te.width?fe(xe):Ie&&je(),De.push(xe),xe={words:[]},Be=0}function je(){Be>(Me.maxWidth||0)&&(Me.maxWidth=Be)}const{top:Ye,right:ze,bottom:qe,left:Ne}=t.Direction4;function Ue(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const Xe={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let a=0,r=0,s=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=i;h&&(s?(a=h[Ne],s-=h[ze]+h[Ne]):i.autoSizeAlign||(a=h[Ne]),o?(r=h[Ye],o-=h[Ye]+h[qe]):i.autoSizeAlign||(r=h[Ye]));const c={bounds:{x:a,y:r,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){Me=e,De=e.rows,Te=e.bounds,Ie=!Te.width&&!i.autoSizeAlign;const{__letterSpacing:a,paraIndent:r,textCase:s}=i,{canvas:o}=t.Platform,{width:l,height:d}=Te;if(l||d||a||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;Oe=!0,Ce=null,ke=Re=Pe=be=Be=0,ve={data:[]},xe={words:[]};for(let i=0,d=n.length;i<d;i++)Le=n[i],"\n"===Le?(be&&Fe(),xe.paraEnd=!0,Ge(),Oe=!0):(Se=he(Le),Se===pe&&"none"!==s&&(Le=ue(Le,s,!be)),Re=o.measureText(Le).width,a&&(a<0&&(Pe=Re),Re+=a),Ae=Se===ge&&(Ce===ge||Ce===pe)||Ce===ge&&Se!==ye,We=!(Se!==_e&&Se!==ge||Ce!==we&&Ce!==ye),Ee=Oe&&r?l-r:l,t&&l&&Be+be+Re>Ee&&(e?(be&&Fe(),Be&&Ge()):(We||(We=Se===pe&&Ce==ye),Ae||We||Se===me||Se===_e||Se===ge||be+Re>Ee?(be&&Fe(),Be&&Ge()):Be&&Ge()))," "===Le&&!0!==Oe&&Be+be===0||(Se===me?(" "===Le&&be&&Fe(),He(Le,Re),Fe()):Ae||We?(be&&Fe(),He(Le,Re)):He(Le,Re)),Ce=Se);be&&Fe(),Be&&Ge(),De.length>0&&(De[De.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Me.paraNumber++,Be=o.measureText(t).width,De.push({x:r||0,text:t,width:Be,paraStart:!0}),Ie&&je()}))}(c,e,i),h&&function(t,e,n,i,a){if(!i&&n.autoSizeAlign)switch(n.textAlign){case"left":Ue(e,"x",t[Ne]);break;case"right":Ue(e,"x",-t[ze])}if(!a&&n.autoSizeAlign)switch(n.verticalAlign){case"top":Ue(e,"y",t[Ye]);break;case"bottom":Ue(e,"y",-t[qe])}}(h,c,i,s,o),function(t,e){const{rows:n,bounds:i}=t,a=n.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=i,y=r*a+(c?c*(t.paraNumber-1):0),w=s;if(l&&y>_)y=Math.max(_,r),a>1&&(t.overflow=a);else if(_||u)switch(h){case"middle":p+=(_-y)/2;break;case"bottom":p+=_-y}w+=p;let m,v,x,b=g||u?g:t.maxWidth;for(let s=0,h=a;s<h;s++){if(m=n[s],m.x=f,m.width<g||m.width>g&&!l)switch(d){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&c&&s>0&&(w+=c),m.y=w,w+=r,t.overflow>s&&w>y&&(m.isOverflow=!0,t.overflow=s+1),v=m.x,x=m.width,o<0&&(m.width<0?(x=-m.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<i.x&&(i.x=v),x>i.width&&(i.width=x),l&&g&&g<x&&(m.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=p,i.height=y}(c,i),function(t,e,n){const{rows:i}=t,{textAlign:a,paraIndent:r,letterSpacing:s}=e;let o,l,d,h,c,u;i.forEach((t=>{t.words&&(d=r&&t.paraStart?r:0,u=t.words.length,l=n&&("justify"===a||"both"===a)&&u>1?(n-t.width-d)/(u-1):0,h=s||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach(((e,n)=>{1===h?(c={char:"",x:o},o=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,n,i){return t.forEach((t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==a||n===u-1||(o+=l,t.width+=l)}))),t.words=null)}))}(c,i,s),c.overflow&&function(e,n,i,a){if(!a)return;const{rows:r,overflow:s}=e;let{textOverflow:o}=n;if(r.splice(s),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=i+a-d;("none"===n.textWrap?r:[r[s-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<h));i--){if(l<h&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,i,a,s),"none"!==l&&function(t,e){let i;const{fontSize:a,textDecoration:r}=e;switch(t.decorationHeight=a/11,"object"==typeof r?(i=r.type,r.color&&(t.decorationColor=n.ColorConvert.string(r.color))):i=r,i){case"under":t.decorationY=[.15*a];break;case"delete":t.decorationY=[.35*-a];break;case"under-delete":t.decorationY=[.15*a,.35*-a]}}(c,i),c}};const Ve={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let a=void 0===t.a?1:t.a;i&&(a*=e);const r=t.r+","+t.g+","+t.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(n.TextConvert,Xe),Object.assign(n.ColorConvert,Ve),Object.assign(n.Paint,I),Object.assign(n.PaintImage,yt),Object.assign(n.PaintGradient,Tt),Object.assign(n.Effect,zt),Object.assign(t.Creator,{interaction:(t,n,i,a)=>new e.InteractionBase(t,n,i,a),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),r(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=w,exports.LeaferCanvas=i,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=r,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
1
+ "use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),n=require("@leafer-ui/draw");class i extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:r}=t.FileHelper;function a(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((i,a)=>{t.convertToBlob({type:r(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>a(t),e.readAsDataURL(t)})).catch((t=>{a(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:r(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,i)=>{let r=new XMLHttpRequest;r.open("GET",t.Platform.image.getRealURL(e),!0),r.responseType="blob",r.onload=()=>{createImageBitmap(r.response).then((t=>{n(t)})).catch((t=>{i(t)}))},r.onerror=t=>i(t),r.send()}))},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new i(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):s.indexOf("Safari")>-1&&-1===s.indexOf("Chrome")&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.PropertyEvent.CHANGE,this.__onAttrChange,this),e.on_([t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this),e.on_(t.WatchEvent.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:g,updateAllChange:_}=t.LeafHelper,y=t.Debug.get("Layouter");class w{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:r}=this,{BEFORE:a,LAYOUT:s,AFTER:o}=t.LayoutEvent,f=this.getBlocks(r);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(a,f,this.times)),this.extraBlock=null,r.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(r,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||d(i[t])}d(n)}}))}(this.__levelList),function(t){t.list.forEach(h)}(r),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:r,AFTER:a}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),w.fullLayout(n),s.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(r,s,this.times)),n.emitEvent(new t.LayoutEvent(a,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.LayoutEvent.REQUEST,this.layout,this),e.on_(t.LayoutEvent.AGAIN,this.layoutAgain,this),e.on_(t.WatchEvent.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const m=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,m.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,m.error(t)}m.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return m.warn("rendering");if(this.times>3)return m.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)})))}clipRender(e){const n=t.Run.start("PartRender"),{canvas:i}=this,r=e.getIntersect(i.bounds),a=new t.Bounds(r);i.save(),r.spread(v.clipSpread).ceil(),i.clearWorld(r,!0),i.clipWorld(r,!0),this.__render(r,a),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds),n.restore(),t.Run.end(e)}__render(e,n){const{canvas:i}=this,r=e.includes(this.target.__world),a=r?{includes:r}:{bounds:e,includes:r};this.needFill&&i.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(i,e),this.target.__render(i,a),this.renderBounds=n=n||e,this.renderOptions=a,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),i.updateRender(n)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const n=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-n))),this.requestTime=0,this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||m.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){const{target:e}=this;this.__eventIds=[e.on_(t.RenderEvent.REQUEST,this.update,this),e.on_(t.LayoutEvent.END,this.__onLayoutEnd,this),e.on_(t.RenderEvent.AGAIN,this.renderAgain,this),e.on_(t.ResizeEvent.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,n,i){n||(n=0),i||(i={});const r=i.through||!1,a=i.ignoreHittable||!1,s=i.target||this.target;this.exclude=i.exclude||null,this.point={x:e.x,y:e.y,radiusX:n,radiusY:n},this.findList=new t.LeafList(i.findList),i.findList||this.hitBranch(s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,i.bottomList,a),d=a?this.getPath(l):this.getHitablePath(l);return this.clear(),r?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}getBestMatchLeaf(e,n,i){if(e.length){let n;this.findList=new t.LeafList;const{x:r,y:a}=this.point,s={x:r,y:a,radiusX:0,radiusY:0};for(let r=0,a=e.length;r<a;r++)if(n=e[r],(i||t.LeafHelper.worldHittable(n))&&(this.hitChild(n,s),this.findList.length))return this.findList.list[0]}if(n)for(let t=0,e=n.length;t<e;t++)if(this.hitChild(n[t].target,this.point,n[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const n=new t.LeafList;for(;e;)n.add(e),e=e.parent;return this.target&&n.add(this.target),n}getHitablePath(e){const n=this.getPath(e&&e.hittable?e:null);let i,r=new t.LeafList;for(let t=n.list.length-1;t>-1&&(i=n.list[t],i.__.hittable)&&(r.addAt(i,0),i.__.hitChildren);t--);return r}getThroughPath(e){const n=new t.LeafList,i=[];for(let t=e.length-1;t>-1;t--)i.push(this.getPath(e[t]));let r,a,s;for(let t=0,e=i.length;t<e;t++){r=i[t],a=i[t+1];for(let t=0,e=r.length;t<e&&(s=r.list[t],!a||!a.has(s));t++)n.add(s)}return n}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let n,i;const{point:r}=this;for(let a=t.length-1;a>-1;a--)n=t[a],!n.__.visible||e&&!n.__.mask||(i=!!n.__.hitRadius||x(n.__world,r),n.isBranch?(i||n.__ignoreHitWorld)&&(this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&this.hitChild(n,r)):i&&this.hitChild(n,r))}hitChild(t,e,n){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:i}=t;if(i&&i.__hasMask&&!t.__.mask&&!i.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(n||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,n){this.config={},n&&(this.config=t.DataHelper.default(n,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,n,i){const{target:r,picker:a}=this;return t.Platform.backgrounder&&r&&r.updateLayout(),a.getByPoint(e,n,i)}getBy(e,n,i,r){return this.finder?this.finder.getBy(e,n,i,r):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){const n=t.__,{rows:i,decorationY:r}=n.__textDrawData;let a;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,n=i.length;t<n;t++)a=i[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach((t=>{e.fillText(t.char,t.x,a.y)}));if(r){const{decorationColor:t,decorationHeight:a}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach((t=>r.forEach((n=>e.fillRect(t.x,t.y+n,t.width,a)))))}}function L(t,e){t.__.__font?E(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function R(t,e,n){const{strokeAlign:i}=e.__,r="string"!=typeof t;switch(i){case"center":n.setStroke(r?void 0:t,e.__.strokeWidth,e.__),r?S(t,!0,e,n):P(e,n);break;case"inside":k("inside",t,r,e,n);break;case"outside":k("outside",t,r,e,n)}}function k(t,e,n,i,r){const{__strokeWidth:a,__font:s}=i.__,o=r.getSameCanvas(!0,!0);o.setStroke(n?void 0:e,2*a,i.__),o.font=s,n?S(e,!0,i,o):P(i,o),o.blendMode="outside"===t?"destination-out":"destination-in",E(i,o),o.blendMode="normal",i.__worldFlipped?r.copyWorldByReset(o,i.__nowWorld):r.copyWorldToInner(o,i.__nowWorld,i.__layout.renderBounds),o.recycle(i.__nowWorld)}function P(t,e){let n,i=t.__.__textDrawData;const{rows:r,decorationY:a}=i;for(let t=0,i=r.length;t<i;t++)n=r[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)}));if(a){const{decorationHeight:t}=i;r.forEach((n=>a.forEach((i=>e.strokeRect(n.x,n.y+i,n.width,t)))))}}function S(t,e,i,r){let a;for(let s=0,o=t.length;s<o;s++)a=t[s],a.image&&n.PaintImage.checkImage(i,r,a,!1)||a.style&&(r.strokeStyle=a.style,a.blendMode?(r.saveBlendMode(a.blendMode),e?P(i,r):r.stroke(),r.restoreBlendMode()):e?P(i,r):r.stroke())}function C(t,e){t.__.dashPattern&&(e.beginPath(),t.__drawPathByData(e,t.__.__pathForArrow),e.dashPattern=null,e.stroke())}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new w(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>new B(t,e)}),t.Platform.layout=w.fullLayout;const{getSpread:A,getOuterOf:W,getByMove:O,getIntersectData:M}=t.BoundsHelper;let T;function I(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:r}=i.__layout;switch(e.type){case"solid":let{type:a,blendMode:s,color:o,opacity:l}=e;return{type:a,blendMode:s,style:n.ColorConvert.string(o,l)};case"image":return n.PaintImage.image(i,t,e,r,!T||!T[e.url]);case"linear":return n.PaintGradient.linearGradient(e,r);case"radial":return n.PaintGradient.radialGradient(e,r);case"angular":return n.PaintGradient.conicGradient(e,r);default:return void 0!==e.r?{type:"solid",style:n.ColorConvert.string(e)}:void 0}}const D={compute:function(t,e){const i=e.__,r=[];let a,s=i.__input[t];s instanceof Array||(s=[s]),T=n.PaintImage.recycleImage(t,i);for(let n,i=0,a=s.length;i<a;i++)n=I(t,s[i],e),n&&r.push(n);i["_"+t]=r.length?r:void 0,r.length&&r[0].image&&(a=r[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=a:i.__pixelStroke=a},fill:function(t,e,n){n.fillStyle=t,L(e,n)},fills:function(t,e,i){let r;for(let a=0,s=t.length;a<s;a++){if(r=t[a],r.image){if(n.PaintImage.checkImage(e,i,r,!e.__.__font))continue;if(!r.style){!a&&r.image.isPlacehold&&e.drawImagePlaceholder(i,r.image);continue}}i.fillStyle=r.style,r.transform?(i.save(),i.transform(r.transform),r.blendMode&&(i.blendMode=r.blendMode),L(e,i),i.restore()):r.blendMode?(i.saveBlendMode(r.blendMode),L(e,i),i.restoreBlendMode()):L(e,i)}},fillPathOrText:L,fillText:E,stroke:function(t,e,n){const i=e.__,{__strokeWidth:r,strokeAlign:a,__font:s}=i;if(r)if(s)R(t,e,n);else switch(a){case"center":n.setStroke(t,r,i),n.stroke(),i.__useArrow&&C(e,n);break;case"inside":n.save(),n.setStroke(t,2*r,i),i.windingRule?n.clip(i.windingRule):n.clip(),n.stroke(),n.restore();break;case"outside":const a=n.getSameCanvas(!0,!0);a.setStroke(t,2*r,i),e.__drawRenderPath(a),a.stroke(),i.windingRule?a.clip(i.windingRule):a.clip(),a.clearWorld(e.__layout.renderBounds),e.__worldFlipped?n.copyWorldByReset(a,e.__nowWorld):n.copyWorldToInner(a,e.__nowWorld,e.__layout.renderBounds),a.recycle(e.__nowWorld)}},strokes:function(t,e,n){const i=e.__,{__strokeWidth:r,strokeAlign:a,__font:s}=i;if(r)if(s)R(t,e,n);else switch(a){case"center":n.setStroke(void 0,r,i),S(t,!1,e,n),i.__useArrow&&C(e,n);break;case"inside":n.save(),n.setStroke(void 0,2*r,i),i.windingRule?n.clip(i.windingRule):n.clip(),S(t,!1,e,n),n.restore();break;case"outside":const{renderBounds:a}=e.__layout,s=n.getSameCanvas(!0,!0);e.__drawRenderPath(s),s.setStroke(void 0,2*r,i),S(t,!1,e,s),i.windingRule?s.clip(i.windingRule):s.clip(),s.clearWorld(a),e.__worldFlipped?n.copyWorldByReset(s,e.__nowWorld):n.copyWorldToInner(s,e.__nowWorld,a),s.recycle(e.__nowWorld)}},strokeText:R,drawTextStroke:P,shape:function(t,e,n){const i=e.getSameCanvas(),r=t.__nowWorld;let a,s,o,l,{scaleX:d,scaleY:h}=r;if(d<0&&(d=-d),h<0&&(h=-h),e.bounds.includes(r))l=i,a=o=r;else{const{renderShapeSpread:i}=t.__layout,c=M(i?A(e.bounds,d===h?i*d:[i*h,i*d]):e.bounds,r);s=e.bounds.getFitMatrix(c);let{a:u,d:f}=s;if(s.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,n),d*=u,h*=f),o=W(r,s),a=O(o,-s.e,-s.f),n.matrix){const{matrix:t}=n;s.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:s.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:s,bounds:a,worldCanvas:l,shapeBounds:o,scaleX:d,scaleY:h}}};let H={};const{get:F,rotateOfOuter:G,translate:j,scaleOfOuter:Y,scale:z,rotate:q}=t.MatrixHelper;function U(t,e,n,i,r,a,s){const o=F();j(o,e.x+n,e.y+i),z(o,r,a),s&&G(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o}function N(t,e,n,i,r,a,s){const o=F();j(o,e.x+n,e.y+i),r&&z(o,r,a),s&&q(o,s),t.transform=o}function X(t,e,n,i,r,a,s,o,l,d){const h=F();if(l)if("center"===d)G(h,{x:n/2,y:i/2},l);else switch(q(h,l),l){case 90:j(h,i,0);break;case 180:j(h,n,i);break;case 270:j(h,0,n)}H.x=e.x+r,H.y=e.y+a,j(h,H.x,H.y),s&&Y(h,H,s,o),t.transform=h}const{get:V,translate:Q}=t.MatrixHelper,Z=new t.Bounds,K={},$={};function J(t,e,n,i){const{blendMode:r,changeful:a,sync:s}=n;r&&(t.blendMode=r),a&&(t.changeful=a),s&&(t.sync=s),t.data=tt(n,i,e)}function tt(e,n,i){let{width:r,height:a}=i;e.padding&&(n=Z.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");const{opacity:s,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,repeat:f,filters:p}=e,g=n.width===r&&n.height===a,_={mode:o},y="center"!==l&&(u||0)%180==90,w=y?a:r,m=y?r:a;let v,x,b=0,B=0;if(o&&"cover"!==o&&"fit"!==o)(h||c)&&(t.MathHelper.getScaleData(h,c,i,$),v=$.scaleX,x=$.scaleY);else if(!g||u){const t=n.width/w,e=n.height/m;v=x="fit"===o?Math.min(t,e):Math.max(t,e),b+=(n.width-r*v)/2,B+=(n.height-a*x)/2}if(l){const e={x:b,y:B,width:w,height:m};v&&(e.width*=v,e.height*=x),t.AlignHelper.toPoint(l,e,n,K,!0),b+=K.x,B+=K.y}switch(d&&(b+=d.x,B+=d.y),o){case"stretch":g||(r=n.width,a=n.height);break;case"normal":case"clip":(b||B||v||u)&&N(_,n,b,B,v,x,u);break;case"repeat":(!g||v||u)&&X(_,n,r,a,b,B,v,x,u,l),f||(_.repeat="repeat");break;default:v&&U(_,n,b,B,v,x,u)}return _.transform||(n.x||n.y)&&(_.transform=V(),Q(_.transform,n.x,n.y)),v&&"stretch"!==o&&(_.scaleX=v,_.scaleY=x),_.width=r,_.height=a,s&&(_.opacity=s),p&&(_.filters=p),f&&(_.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),_}let et,nt=new t.Bounds;const{isSame:it}=t.BoundsHelper;function rt(t,e,n,i,r,a){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||J(r,i,n,a),!0}function at(e,n){lt(e,t.ImageEvent.LOAD,n)}function st(e,n){lt(e,t.ImageEvent.LOADED,n)}function ot(e,n,i){n.error=i,e.forceUpdate("surface"),lt(e,t.ImageEvent.ERROR,n)}function lt(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function dt(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:ht,scale:ct,copy:ut}=t.MatrixHelper,{ceil:ft,abs:pt}=Math;function gt(e,n,i){let{scaleX:r,scaleY:a}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const s=r+"-"+a+"-"+i;if(n.patternId===s||e.destroyed)return!1;{r=pt(r),a=pt(a);const{image:e,data:o}=n;let l,d,{width:h,height:c,scaleX:u,scaleY:f,transform:p,repeat:g}=o;u&&(d=ht(),ut(d,p),ct(d,1/u,1/f),r*=u,a*=f),r*=i,a*=i,h*=r,c*=a;const _=h*c;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}_>y&&(l=Math.sqrt(_/y)),l&&(r/=l,a/=l,h/=l,c/=l),u&&(r/=u,a/=f),(p||1!==r||1!==a)&&(d||(d=ht(),p&&ut(d,p)),ct(d,1/r,1/a));const w=e.getCanvas(ft(h)||1,ft(c)||1,o.opacity,o.filters),m=e.getPattern(w,g||t.Platform.origin.noRepeat||"no-repeat",d,n);return n.style=m,n.patternId=s,!0}}function _t(t,e,n,i){return new(n||(n=Promise))((function(r,a){function s(t){try{l(i.next(t))}catch(t){a(t)}}function o(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,o)}l((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:yt}=Math;const wt={image:function(e,n,i,r,a){let s,o;const l=t.ImageManager.get(i);return et&&i===et.paint&&it(r,et.boxBounds)?s=et.leafPaint:(s={type:i.type,image:l},et=l.use>1?{leafPaint:s,paint:i,boxBounds:nt.set(r)}:null),(a||l.loading)&&(o={image:l,attrName:n,attrValue:i}),l.ready?(rt(e,n,i,l,s,r),a&&(at(e,o),st(e,o))):l.error?a&&ot(e,o,l.error):(a&&(dt(e,!0),at(e,o)),s.loadId=l.load((()=>{dt(e,!1),e.destroyed||(rt(e,n,i,l,s,r)&&(l.hasOpacityPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),st(e,o)),s.loadId=null}),(t=>{dt(e,!1),ot(e,o,t),s.loadId=null})),e.placeholderColor&&setTimeout((()=>{l.ready||l.isPlacehold||(l.isPlacehold=!0,e.forceUpdate("surface"))}),100)),s},checkImage:function(e,i,r,a){const{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:l}=i,{data:d}=r;if(!d||r.patternId===s+"-"+o+"-"+l&&!n.Export.running)return!1;if(a)if(d.repeat)a=!1;else if(!(r.changeful||t.ResizeEvent.isResizing(e)||n.Export.running)){let{width:e,height:n}=d;e*=yt(s)*l,n*=yt(o)*l,d.scaleX&&(e*=d.scaleX,n*=d.scaleY),a=e*n>t.Platform.image.maxCacheSize}return a?(function(t,e,n,i){e.save(),t.windingRule?e.clip(t.windingRule):e.clip(),n.blendMode&&(e.blendMode=n.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(n.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,i,r,d),!0):(!r.style||r.sync||n.Export.running?gt(e,r,l):r.patternTask||(r.patternTask=t.ImageManager.patternTasker.add((()=>_t(this,void 0,void 0,(function*(){r.patternTask=null,i.bounds.hit(e.__nowWorld)&&gt(e,r,l),e.forceUpdate("surface")}))),300)),!1)},createPattern:gt,recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let r,a,s,o,l;for(let d=0,h=i.length;d<h;d++)r=i[d],a=r.image,l=a&&a.url,l&&(s||(s={}),s[l]=!0,t.ImageManager.recycle(a),a.loading&&(o||(o=n.__input&&n.__input[e]||[],o instanceof Array||(o=[o])),a.unload(i[d].loadId,!o.some((t=>t.url===l)))));return s}return null},createData:J,getPatternData:tt,fillOrFitMode:U,clipMode:N,repeatMode:X},{toPoint:mt}=t.AroundHelper,vt={},xt={};function bt(t,e,i){if(e){let r;for(let a=0,s=e.length;a<s;a++)r=e[a],"string"==typeof r?t.addColorStop(a/(s-1),n.ColorConvert.string(r,i)):t.addColorStop(r.offset,n.ColorConvert.string(r.color,i))}}const{getAngle:Bt,getDistance:Et}=t.PointHelper,{get:Lt,rotateOfOuter:Rt,scaleOfOuter:kt}=t.MatrixHelper,{toPoint:Pt}=t.AroundHelper,St={},Ct={};function At(t,e,n,i,r){let a;const{width:s,height:o}=t;if(s!==o||i){const t=Bt(e,n);a=Lt(),r?(kt(a,e,s/o*(i||1),1),Rt(a,e,t+90)):(kt(a,e,1,s/o*(i||1)),Rt(a,e,t))}return a}const{getDistance:Wt}=t.PointHelper,{toPoint:Ot}=t.AroundHelper,Mt={},Tt={};const It={linearGradient:function(e,n){let{from:i,to:r,type:a,blendMode:s,opacity:o}=e;mt(i||"top",n,vt),mt(r||"bottom",n,xt);const l=t.Platform.canvas.createLinearGradient(vt.x,vt.y,xt.x,xt.y);bt(l,e.stops,o);const d={type:a,style:l};return s&&(d.blendMode=s),d},radialGradient:function(e,n){let{from:i,to:r,type:a,opacity:s,blendMode:o,stretch:l}=e;Pt(i||"center",n,St),Pt(r||"bottom",n,Ct);const d=t.Platform.canvas.createRadialGradient(St.x,St.y,0,St.x,St.y,Et(St,Ct));bt(d,e.stops,s);const h={type:a,style:d},c=At(n,St,Ct,l,!0);return c&&(h.transform=c),o&&(h.blendMode=o),h},conicGradient:function(e,n){let{from:i,to:r,type:a,opacity:s,blendMode:o,stretch:l}=e;Ot(i||"center",n,Mt),Ot(r||"bottom",n,Tt);const d=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Mt.x,Mt.y):t.Platform.canvas.createRadialGradient(Mt.x,Mt.y,0,Mt.x,Mt.y,Wt(Mt,Tt));bt(d,e.stops,s);const h={type:a,style:d},c=At(n,Mt,Tt,l||1,t.Platform.conicGradientRotate90);return c&&(h.transform=c),o&&(h.blendMode=o),h},getTransform:At},{copy:Dt,toOffsetOutBounds:Ht}=t.BoundsHelper,Ft={},Gt={};function jt(e,n,i,r){const{bounds:a,shapeBounds:s}=r;if(t.Platform.fullImageShadow){if(Dt(Ft,e.bounds),Ft.x+=n.x-s.x,Ft.y+=n.y-s.y,i){const{matrix:t}=r;Ft.x-=(a.x+(t?t.e:0)+a.width/2)*(i-1),Ft.y-=(a.y+(t?t.f:0)+a.height/2)*(i-1),Ft.width*=i,Ft.height*=i}e.copyWorld(r.canvas,e.bounds,Ft)}else i&&(Dt(Ft,n),Ft.x-=n.width/2*(i-1),Ft.y-=n.height/2*(i-1),Ft.width*=i,Ft.height*=i),e.copyWorld(r.canvas,s,i?Ft:n)}const{toOffsetOutBounds:Yt}=t.BoundsHelper,zt={};const qt={shadow:function(t,e,i){let r,a;const{__nowWorld:s,__layout:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;Ht(h,Gt),l.forEach(((l,_)=>{p.setWorldShadow(Gt.offsetX+l.x*u,Gt.offsetY+l.y*f,l.blur*u,n.ColorConvert.string(l.color)),a=l.spread?1+2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,jt(p,Gt,a,i),r=h,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,h,s,"copy"),r=s),d?p.copyWorld(d,s,s,"destination-out"):p.copyWorld(i.canvas,c,h,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,r,s,l.blendMode):e.copyWorldToInner(p,r,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(r,!0)})),p.recycle(r)},innerShadow:function(t,e,i){let r,a;const{__nowWorld:s,__layout:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;Yt(h,zt),l.forEach(((l,_)=>{p.save(),p.setWorldShadow(zt.offsetX+l.x*u,zt.offsetY+l.y*f,l.blur*u),a=l.spread?1-2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,jt(p,zt,a,i),p.restore(),d?(p.copyWorld(p,h,s,"copy"),p.copyWorld(d,s,s,"source-out"),r=s):(p.copyWorld(i.canvas,c,h,"source-out"),r=h),p.fillWorld(r,n.ColorConvert.string(l.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,r,s,l.blendMode):e.copyWorldToInner(p,r,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(r,!0)})),p.recycle(r)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Ut}=t.LeafBoundsHelper;function Nt(t,e,n,i,r,a){switch(e){case"grayscale":r.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,n,i){const r=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,r),i.recycle(r),Vt(t,e,n,1)}(t,n,i,r);break;case"opacity-path":Vt(t,n,i,a);break;case"path":n.restore()}}function Xt(t){return t.getSameCanvas(!1,!0)}function Vt(t,e,n,i){const r=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,r),n.recycle(r)}n.Group.prototype.__renderMask=function(t,e){let n,i,r,a,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++)n=l[d],o=n.__.mask,o&&(s&&(Nt(this,s,t,r,i,a),i=r=null),"path"===o||"clipping-path"===o?(n.opacity<1?(s="opacity-path",a=n.opacity,r||(r=Xt(t))):(s="path",t.save()),n.__clip(r||t,e)):(s="grayscale"===o?"grayscale":"alpha",i||(i=Xt(t)),r||(r=Xt(t)),n.__render(i,e)),"clipping"!==o&&"clipping-path"!==o)||Ut(n,e)||n.__render(r||t,e);Nt(this,s,t,r,i,a)};const Qt=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Zt=Qt+"_#~&*+\\=|≮≯≈≠=…",Kt=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function $t(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Jt=$t("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),te=$t("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),ee=$t(Qt),ne=$t(Zt),ie=$t("- —/~|┆·");var re;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(re||(re={}));const{Letter:ae,Single:se,Before:oe,After:le,Symbol:de,Break:he}=re;function ce(t){return Jt[t]?ae:ie[t]?he:te[t]?oe:ee[t]?le:ne[t]?de:Kt.test(t)?se:ae}const ue={trimRight(t){const{words:e}=t;let n,i=0,r=e.length;for(let a=r-1;a>-1&&(n=e[a].data[0]," "===n.char);a--)i++,t.width-=n.width;i&&e.splice(r-i,i)}};function fe(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:pe}=ue,{Letter:ge,Single:_e,Before:ye,After:we,Symbol:me,Break:ve}=re;let xe,be,Be,Ee,Le,Re,ke,Pe,Se,Ce,Ae,We,Oe,Me,Te,Ie,De,He=[];function Fe(t,e){Se&&!Pe&&(Pe=Se),xe.data.push({char:t,width:e}),Be+=e}function Ge(){Ee+=Be,xe.width=Be,be.words.push(xe),xe={data:[]},Be=0}function je(){Me&&(Te.paraNumber++,be.paraStart=!0,Me=!1),Se&&(be.startCharSize=Pe,be.endCharSize=Se,Pe=0),be.width=Ee,Ie.width?pe(be):De&&Ye(),He.push(be),be={words:[]},Ee=0}function Ye(){Ee>(Te.maxWidth||0)&&(Te.maxWidth=Ee)}const{top:ze,right:qe,bottom:Ue,left:Ne}=t.Direction4;function Xe(t,e,n){const{bounds:i,rows:r}=t;i[e]+=n;for(let t=0;t<r.length;t++)r[t][e]+=n}const Ve={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let r=0,a=0,s=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=i;h&&(s?(r=h[Ne],s-=h[qe]+h[Ne]):i.autoSizeAlign||(r=h[Ne]),o?(a=h[ze],o-=h[ze]+h[Ue]):i.autoSizeAlign||(a=h[ze]));const c={bounds:{x:r,y:a,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){Te=e,He=e.rows,Ie=e.bounds,De=!Ie.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:a,textCase:s}=i,{canvas:o}=t.Platform,{width:l,height:d}=Ie;if(l||d||r||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;Me=!0,Ae=null,Pe=ke=Se=Be=Ee=0,xe={data:[]},be={words:[]};for(let i=0,d=n.length;i<d;i++)Re=n[i],"\n"===Re?(Be&&Ge(),be.paraEnd=!0,je(),Me=!0):(Ce=ce(Re),Ce===ge&&"none"!==s&&(Re=fe(Re,s,!Be)),ke=o.measureText(Re).width,r&&(r<0&&(Se=ke),ke+=r),We=Ce===_e&&(Ae===_e||Ae===ge)||Ae===_e&&Ce!==we,Oe=!(Ce!==ye&&Ce!==_e||Ae!==me&&Ae!==we),Le=Me&&a?l-a:l,t&&l&&Ee+Be+ke>Le&&(e?(Be&&Ge(),Ee&&je()):(Oe||(Oe=Ce===ge&&Ae==we),We||Oe||Ce===ve||Ce===ye||Ce===_e||Be+ke>Le?(Be&&Ge(),Ee&&je()):Ee&&je()))," "===Re&&!0!==Me&&Ee+Be===0||(Ce===ve?(" "===Re&&Be&&Ge(),Fe(Re,ke),Ge()):We||Oe?(Be&&Ge(),Fe(Re,ke)):Fe(Re,ke)),Ae=Ce);Be&&Ge(),Ee&&je(),He.length>0&&(He[He.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Te.paraNumber++,Ee=o.measureText(t).width,He.push({x:a||0,text:t,width:Ee,paraStart:!0}),De&&Ye()}))}(c,e,i),h&&function(t,e,n,i,r){if(!i&&n.autoSizeAlign)switch(n.textAlign){case"left":Xe(e,"x",t[Ne]);break;case"right":Xe(e,"x",-t[qe])}if(!r&&n.autoSizeAlign)switch(n.verticalAlign){case"top":Xe(e,"y",t[ze]);break;case"bottom":Xe(e,"y",-t[Ue])}}(h,c,i,s,o),function(t,e){const{rows:n,bounds:i}=t,r=n.length,{__lineHeight:a,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=i,y=a*r+(c?c*(t.paraNumber-1):0),w=s;if(l&&y>_)y=Math.max(_,a),r>1&&(t.overflow=r);else if(_||u)switch(h){case"middle":p+=(_-y)/2;break;case"bottom":p+=_-y}w+=p;let m,v,x,b=g||u?g:t.maxWidth;for(let s=0,h=r;s<h;s++){if(m=n[s],m.x=f,m.width<g||m.width>g&&!l)switch(d){case"center":m.x+=(b-m.width)/2;break;case"right":m.x+=b-m.width}m.paraStart&&c&&s>0&&(w+=c),m.y=w,w+=a,t.overflow>s&&w>y&&(m.isOverflow=!0,t.overflow=s+1),v=m.x,x=m.width,o<0&&(m.width<0?(x=-m.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<i.x&&(i.x=v),x>i.width&&(i.width=x),l&&g&&g<x&&(m.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=p,i.height=y}(c,i),function(t,e,n){const{rows:i}=t,{textAlign:r,paraIndent:a,letterSpacing:s}=e;let o,l,d,h,c,u;i.forEach((t=>{t.words&&(d=a&&t.paraStart?a:0,u=t.words.length,l=n&&("justify"===r||"both"===r)&&u>1?(n-t.width-d)/(u-1):0,h=s||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach(((e,n)=>{1===h?(c={char:"",x:o},o=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,n,i){return t.forEach((t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==r||n===u-1||(o+=l,t.width+=l)}))),t.words=null)}))}(c,i,s),c.overflow&&function(e,n,i,r){if(!r)return;const{rows:a,overflow:s}=e;let{textOverflow:o}=n;if(a.splice(s),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=i+r-d;("none"===n.textWrap?a:[a[s-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<h));i--){if(l<h&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,i,r,s),"none"!==l&&function(t,e){let i;const{fontSize:r,textDecoration:a}=e;switch(t.decorationHeight=r/11,"object"==typeof a?(i=a.type,a.color&&(t.decorationColor=n.ColorConvert.string(a.color))):i=a,i){case"under":t.decorationY=[.15*r];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r,.35*-r]}}(c,i),c}};const Qe={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let r=void 0===t.a?1:t.a;i&&(r*=e);const a=t.r+","+t.g+","+t.b;return 1===r?"rgb("+a+")":"rgba("+a+","+r+")"}};Object.assign(n.TextConvert,Ve),Object.assign(n.ColorConvert,Qe),Object.assign(n.Paint,D),Object.assign(n.PaintImage,wt),Object.assign(n.PaintGradient,It),Object.assign(n.Effect,qt),Object.assign(t.Creator,{interaction:(t,n,i,r)=>new e.InteractionBase(t,n,i,r),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),a(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=w,exports.LeaferCanvas=i,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=a,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
2
2
  //# sourceMappingURL=worker.min.cjs.map