@netless/appliance-plugin 1.1.27-beta.0 → 1.1.27-beta.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/cdn/cdn.js +1 -1
- package/cdn/{fullWorker-Cg7DZp.js → fullWorker-UEPot1.js} +1 -1
- package/cdn/{subWorker-fjkZCu.js → subWorker-Bk-jdj.js} +1 -1
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +1 -1
- package/dist/collector/base.d.ts +3 -1
- package/dist/collector/collector.d.ts +18 -3
- package/dist/collector/types.d.ts +36 -0
- package/dist/component/textEditor/manager.d.ts +3 -3
- package/dist/core/enum.d.ts +5 -1
- package/dist/core/mainEngine.d.ts +1 -1
- package/dist/core/types.d.ts +2 -1
- package/dist/core/worker/fullWorkerLocal.d.ts +1 -1
- package/dist/fullWorker.js +1 -1
- package/dist/{index-Cu9h5yfb.mjs → index-BGfSGw0D.mjs} +3 -4
- package/dist/{index-D5nbMHLx.mjs → index-DZw2OTFM.mjs} +2368 -2026
- package/dist/index-hLjff8-8.js +1 -0
- package/dist/index-ndo-AIFJ.js +1 -0
- package/dist/plugin/baseViewContainerManager.d.ts +3 -3
- package/dist/plugin/types.d.ts +9 -0
- package/dist/subWorker.js +1 -1
- package/dist/undo/index.d.ts +17 -27
- package/dist/undo/proxyArray.d.ts +37 -0
- package/package.json +1 -1
- package/dist/index-CbuqW7uM.js +0 -1
- package/dist/index-HCPuaUi7.js +0 -1
package/cdn/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-UEPot1.js",e="/subWorker-Bk-jdj.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
|
|
@@ -396,7 +396,7 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
396
396
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
397
397
|
n&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
398
398
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
399
|
-
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,kT=qu;function HT(i){return i!=null&&kT(i.length)&&!GT(i);}var gl=HT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,kC=Sl,HC=qi;function KC(i,e,t){var r=e(i);return HC(i)?r:kC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=jn,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=jn,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=jn,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=jn,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Si,Oi=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Oi(rl),SI=Oi(nl),xI=Oi(il),TI=Oi(sl),CI=Oi(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,kI=UI,HI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return HI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return kI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=Hu,zO=hx,$O=Zu,jO=tC,GO=mC,kO=yC,HO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return HO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return kO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(S){c.add(qs(S,e,t,S,i,s));}):n2(i)&&i.forEach(function(S,I){c.set(I,qs(S,e,t,I,i,s));});var A=h?f?JO:ZO:f?a2:o2,C=m?void 0:A(i);return zO(C||i,function(S,I){C&&(I=S,S=i[I]),$O(c,I,qs(S,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.27-beta.0",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ci(r),"L").concat(ci(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ui(r,n);return e?"M".concat(ui(i[0],i[1]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2]),"T").concat(s).concat(ui(i[t-1],i[0])).concat(ui(i[0],i[1]),"Z"):"M".concat(ci(i[0]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ci(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var A=l==null?void 0:l.getBoundingClientRect();return A&&(t=Zt(t,{x:Math.floor(A.x-Mr.SafeBorderPadding),y:Math.floor(A.y-Mr.SafeBorderPadding),w:Math.floor(A.width+Mr.SafeBorderPadding*2),h:Math.floor(A.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var A=c.getAttribute("scale");A=[A[0]*T,A[1]*T];var C=c.parent.parent,S=c.getAttribute("translate"),_I30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},A,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_I30.appendChild(_d30);var g=_I30.parent;g.render();var p=_I30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d30,g),C.removeChild(g),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,E),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=x.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,g),C.removeChild(g),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I30.worldScaling});ut&&r.append(ut),Lr(_d30,g),C.removeChild(g),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(A,C){return C%2?A-r[1]:A-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var A=_ref164.detail;var C=A.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var A=_ref165.detail;var C=A.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,A=r.thickness;var C;var S=c&&fr(c)||n.get(t.name);if(!S)return;er(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var g=[S.op[0],S.op[1]];Ll(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _g6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(S.rect,_g6),S.rect=C;}else{var _g7=Mr.getRectFromLayer(I,t.name);S.rect=_g7||S.rect;}}else if(er(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)C=Hh(S.rect,h),S.rect=C;else{var _g8=Mr.getRectFromLayer(I,t.name);S.rect=_g8||S.rect;}if(T){var _g9=T.get(t.name);if(_g9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_g9[_x37][0],S.op[_p10+1]=_g9[_x37][1];}if(A&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=A),s&&!(m&&y&&c)){if(f){var _g10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_g10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(er(h)){var _g11=S.op;if(JA(_g11,S.centerPos,h),S.op=_g11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)QA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
399
|
+
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,kT=qu;function HT(i){return i!=null&&kT(i.length)&&!GT(i);}var gl=HT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,kC=Sl,HC=qi;function KC(i,e,t){var r=e(i);return HC(i)?r:kC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=jn,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=jn,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=jn,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=jn,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Si,Oi=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Oi(rl),SI=Oi(nl),xI=Oi(il),TI=Oi(sl),CI=Oi(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,kI=UI,HI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return HI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return kI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=Hu,zO=hx,$O=Zu,jO=tC,GO=mC,kO=yC,HO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return HO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return kO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(S){c.add(qs(S,e,t,S,i,s));}):n2(i)&&i.forEach(function(S,I){c.set(I,qs(S,e,t,I,i,s));});var A=h?f?JO:ZO:f?a2:o2,C=m?void 0:A(i);return zO(C||i,function(S,I){C&&(I=S,S=i[I]),$O(c,I,qs(S,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.27-beta.2",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ci(r),"L").concat(ci(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ui(r,n);return e?"M".concat(ui(i[0],i[1]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2]),"T").concat(s).concat(ui(i[t-1],i[0])).concat(ui(i[0],i[1]),"Z"):"M".concat(ci(i[0]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ci(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var A=l==null?void 0:l.getBoundingClientRect();return A&&(t=Zt(t,{x:Math.floor(A.x-Mr.SafeBorderPadding),y:Math.floor(A.y-Mr.SafeBorderPadding),w:Math.floor(A.width+Mr.SafeBorderPadding*2),h:Math.floor(A.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var A=c.getAttribute("scale");A=[A[0]*T,A[1]*T];var C=c.parent.parent,S=c.getAttribute("translate"),_I30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},A,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_I30.appendChild(_d30);var g=_I30.parent;g.render();var p=_I30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d30,g),C.removeChild(g),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,E),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=x.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,g),C.removeChild(g),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I30.worldScaling});ut&&r.append(ut),Lr(_d30,g),C.removeChild(g),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(A,C){return C%2?A-r[1]:A-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var A=_ref164.detail;var C=A.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var A=_ref165.detail;var C=A.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,A=r.thickness;var C;var S=c&&fr(c)||n.get(t.name);if(!S)return;er(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var g=[S.op[0],S.op[1]];Ll(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _g6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(S.rect,_g6),S.rect=C;}else{var _g7=Mr.getRectFromLayer(I,t.name);S.rect=_g7||S.rect;}}else if(er(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)C=Hh(S.rect,h),S.rect=C;else{var _g8=Mr.getRectFromLayer(I,t.name);S.rect=_g8||S.rect;}if(T){var _g9=T.get(t.name);if(_g9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_g9[_x37][0],S.op[_p10+1]=_g9[_x37][1];}if(A&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=A),s&&!(m&&y&&c)){if(f){var _g10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_g10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(er(h)){var _g11=S.op;if(JA(_g11,S.centerPos,h),S.op=_g11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)QA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
400
400
|
compressToUint8Array:function compressToUint8Array(f){for(var h=l.compress(f),m=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);m[u*2]=T>>>8,m[u*2+1]=T%256;}return m;},//decompress from uint8array (UCS-2 big endian format)
|
|
401
401
|
decompressFromUint8Array:function decompressFromUint8Array(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),m=0,u=h.length;m<u;m++)h[m]=f[m*2]*256+f[m*2+1];var y=[];return h.forEach(function(T){y.push(t(T));}),l.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
402
402
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
|
@@ -396,7 +396,7 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
396
396
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
397
397
|
n&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
398
398
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
399
|
-
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,kT=qu;function HT(i){return i!=null&&kT(i.length)&&!GT(i);}var gl=HT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,kC=Sl,HC=qi;function KC(i,e,t){var r=e(i);return HC(i)?r:kC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=jn,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=jn,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=jn,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=jn,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Si,Oi=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Oi(rl),SI=Oi(nl),xI=Oi(il),TI=Oi(sl),CI=Oi(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,kI=UI,HI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return HI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return kI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=Hu,zO=hx,$O=Zu,jO=tC,GO=mC,kO=yC,HO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return HO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return kO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(S){c.add(qs(S,e,t,S,i,s));}):n2(i)&&i.forEach(function(S,I){c.set(I,qs(S,e,t,I,i,s));});var A=h?f?JO:ZO:f?a2:o2,C=m?void 0:A(i);return zO(C||i,function(S,I){C&&(I=S,S=i[I]),$O(c,I,qs(S,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.27-beta.0",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ci(r),"L").concat(ci(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ui(r,n);return e?"M".concat(ui(i[0],i[1]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2]),"T").concat(s).concat(ui(i[t-1],i[0])).concat(ui(i[0],i[1]),"Z"):"M".concat(ci(i[0]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ci(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var A=l==null?void 0:l.getBoundingClientRect();return A&&(t=Zt(t,{x:Math.floor(A.x-Mr.SafeBorderPadding),y:Math.floor(A.y-Mr.SafeBorderPadding),w:Math.floor(A.width+Mr.SafeBorderPadding*2),h:Math.floor(A.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var A=c.getAttribute("scale");A=[A[0]*T,A[1]*T];var C=c.parent.parent,S=c.getAttribute("translate"),_I30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},A,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_I30.appendChild(_d30);var g=_I30.parent;g.render();var p=_I30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d30,g),C.removeChild(g),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,E),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=x.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,g),C.removeChild(g),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I30.worldScaling});ut&&r.append(ut),Lr(_d30,g),C.removeChild(g),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(A,C){return C%2?A-r[1]:A-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var A=_ref164.detail;var C=A.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var A=_ref165.detail;var C=A.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,A=r.thickness;var C;var S=c&&fr(c)||n.get(t.name);if(!S)return;er(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var g=[S.op[0],S.op[1]];Ll(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _g6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(S.rect,_g6),S.rect=C;}else{var _g7=Mr.getRectFromLayer(I,t.name);S.rect=_g7||S.rect;}}else if(er(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)C=Hh(S.rect,h),S.rect=C;else{var _g8=Mr.getRectFromLayer(I,t.name);S.rect=_g8||S.rect;}if(T){var _g9=T.get(t.name);if(_g9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_g9[_x37][0],S.op[_p10+1]=_g9[_x37][1];}if(A&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=A),s&&!(m&&y&&c)){if(f){var _g10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_g10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(er(h)){var _g11=S.op;if(JA(_g11,S.centerPos,h),S.op=_g11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)QA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
399
|
+
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,kT=qu;function HT(i){return i!=null&&kT(i.length)&&!GT(i);}var gl=HT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,kC=Sl,HC=qi;function KC(i,e,t){var r=e(i);return HC(i)?r:kC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=jn,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=jn,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=jn,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=jn,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Si,Oi=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Oi(rl),SI=Oi(nl),xI=Oi(il),TI=Oi(sl),CI=Oi(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,kI=UI,HI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return HI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return kI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=Hu,zO=hx,$O=Zu,jO=tC,GO=mC,kO=yC,HO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return HO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return kO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(S){c.add(qs(S,e,t,S,i,s));}):n2(i)&&i.forEach(function(S,I){c.set(I,qs(S,e,t,I,i,s));});var A=h?f?JO:ZO:f?a2:o2,C=m?void 0:A(i);return zO(C||i,function(S,I){C&&(I=S,S=i[I]),$O(c,I,qs(S,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.27-beta.2",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ci(r),"L").concat(ci(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ui(r,n);return e?"M".concat(ui(i[0],i[1]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2]),"T").concat(s).concat(ui(i[t-1],i[0])).concat(ui(i[0],i[1]),"Z"):"M".concat(ci(i[0]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ci(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var A=l==null?void 0:l.getBoundingClientRect();return A&&(t=Zt(t,{x:Math.floor(A.x-Mr.SafeBorderPadding),y:Math.floor(A.y-Mr.SafeBorderPadding),w:Math.floor(A.width+Mr.SafeBorderPadding*2),h:Math.floor(A.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var A=c.getAttribute("scale");A=[A[0]*T,A[1]*T];var C=c.parent.parent,S=c.getAttribute("translate"),_I30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},A,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_I30.appendChild(_d30);var g=_I30.parent;g.render();var p=_I30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d30,g),C.removeChild(g),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,E),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=x.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,g),C.removeChild(g),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I30.worldScaling});ut&&r.append(ut),Lr(_d30,g),C.removeChild(g),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(A,C){return C%2?A-r[1]:A-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var A=_ref164.detail;var C=A.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var A=_ref165.detail;var C=A.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,A=r.thickness;var C;var S=c&&fr(c)||n.get(t.name);if(!S)return;er(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var g=[S.op[0],S.op[1]];Ll(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _g6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(S.rect,_g6),S.rect=C;}else{var _g7=Mr.getRectFromLayer(I,t.name);S.rect=_g7||S.rect;}}else if(er(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)C=Hh(S.rect,h),S.rect=C;else{var _g8=Mr.getRectFromLayer(I,t.name);S.rect=_g8||S.rect;}if(T){var _g9=T.get(t.name);if(_g9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_g9[_x37][0],S.op[_p10+1]=_g9[_x37][1];}if(A&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=A),s&&!(m&&y&&c)){if(f){var _g10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_g10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(er(h)){var _g11=S.op;if(JA(_g11,S.centerPos,h),S.op=_g11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)QA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
400
400
|
compressToUint8Array:function compressToUint8Array(f){for(var h=l.compress(f),m=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);m[u*2]=T>>>8,m[u*2+1]=T%256;}return m;},//decompress from uint8array (UCS-2 big endian format)
|
|
401
401
|
decompressFromUint8Array:function decompressFromUint8Array(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),m=0,u=h.length;m<u;m++)h[m]=f[m*2]*256+f[m*2+1];var y=[];return h.forEach(function(T){y.push(t(T));}),l.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
402
402
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
package/dist/appliance-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-ndo-AIFJ.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.ApplianceSigleWrapper=e.ApplianceSigleWrapper;exports.ApplianceSinglePlugin=e.ApplianceSinglePlugin;exports.AutoDrawPlugin=e.AutoDrawPlugin;exports.Cursor_Hover_Id=e.Cursor_Hover_Id;exports.ECanvasShowType=e.ECanvasShowType;exports.EDataType=e.EDataType;exports.EForceStopReason=e.EForceStopReason;exports.EImageType=e.EImageType;exports.EMatrixrRelationType=e.EMatrixrRelationType;exports.EOperationType=e.EOperationType;exports.EPostMessageType=e.EPostMessageType;exports.ERenderFilterType=e.ERenderFilterType;exports.EScaleType=e.EScaleType;exports.EStrokeType=e.EStrokeType;exports.EToolsKey=e.EToolsKey;exports.ElayerType=e.ElayerType;exports.EmitEventType=e.EmitEventType;exports.EventMessageType=e.EventMessageType;exports.EvevtWorkState=e.EvevtWorkState;exports.EvevtWorkType=e.EvevtWorkType;exports.InternalMsgEmitterType=e.InternalMsgEmitterType;exports.Main_View_Id=e.Main_View_Id;exports.Plugin=e.Plugin;exports.ShapeType=e.ShapeType;exports.Task_Time_Interval=e.Task_Time_Interval;exports.fullWorkerUrl=e.fullWorker;exports.subWorkerUrl=e.subWorker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ae as s, a8 as p, ab as r, aa as t, a9 as l, am as i, a0 as n, U as o, o as E, af as T, l as y, E as g, aj as v, n as u, ak as c, m as k, t as m, k as S, ah as A, a2 as M, ag as _, q as I, ai as P, ad as W, R as d, al as R, ac as f, a3 as h, a6 as w, a7 as C } from "./index-
|
|
1
|
+
import { ae as s, a8 as p, ab as r, aa as t, a9 as l, am as i, a0 as n, U as o, o as E, af as T, l as y, E as g, aj as v, n as u, ak as c, m as k, t as m, k as S, ah as A, a2 as M, ag as _, q as I, ai as P, ad as W, R as d, al as R, ac as f, a3 as h, a6 as w, a7 as C } from "./index-DZw2OTFM.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveContainerType,
|
|
4
4
|
p as ApplianceMultiPlugin,
|
package/dist/collector/base.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AppliancePluginLike } from "../plugin/types";
|
|
2
2
|
import { IworkId } from "../core";
|
|
3
3
|
import { BaseApplianceManager } from "../plugin/baseApplianceManager";
|
|
4
|
-
import { ISerializableAuthData } from "./types";
|
|
4
|
+
import { ISerializableAuthData, ISerializableUndoRedoStackViewData } from "./types";
|
|
5
5
|
export declare abstract class BaseCollector<T> {
|
|
6
6
|
plugin: AppliancePluginLike;
|
|
7
7
|
uid: string;
|
|
@@ -9,10 +9,12 @@ export declare abstract class BaseCollector<T> {
|
|
|
9
9
|
abstract storage: T;
|
|
10
10
|
protected abstract namespace: string;
|
|
11
11
|
protected abstract authSpace: string;
|
|
12
|
+
protected abstract globalUndoRedoStackSpace: string;
|
|
12
13
|
readonly control: BaseApplianceManager;
|
|
13
14
|
constructor(control: BaseApplianceManager, plugin: AppliancePluginLike);
|
|
14
15
|
getNamespaceData(): T;
|
|
15
16
|
getAuthSpaceData(): ISerializableAuthData;
|
|
17
|
+
getGlobalUndoRedoStackData(): ISerializableUndoRedoStackViewData;
|
|
16
18
|
getUidFromKey(key: string): string;
|
|
17
19
|
isLocalId(key: string): boolean;
|
|
18
20
|
getLocalId(key: string): string;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { EOperationType, ERenderFilterType } from "../core/enum";
|
|
2
|
-
import { BaseCollectorReducerAction, Diff, DiffAuthPage, DiffAuthRender, ISerializableAuthData, ISerializableStorageData, ISerializableStorageViewData, ScenePath, Uid, ViewId, WorkId } from "./types";
|
|
2
|
+
import { BaseCollectorReducerAction, Diff, DiffAuthPage, DiffAuthRender, ISerializableAuthData, ISerializableStorageData, ISerializableStorageViewData, ISerializableUndoRedoStackViewData, ISerializableUndoStackId, ScenePath, Uid, ViewId, WorkId, DiffGlobalUndoRedoStack } from "./types";
|
|
3
3
|
import { BaseCollector } from "./base";
|
|
4
4
|
import type { _SetTrue, AppliancePluginLike } from "../plugin/types";
|
|
5
5
|
import { BaseApplianceManager } from "../plugin/baseApplianceManager";
|
|
6
|
+
import { IUndoStackItem } from "../undo";
|
|
7
|
+
import { EProxyArrayOperationType } from "../undo/proxyArray";
|
|
6
8
|
/**
|
|
7
9
|
* 服务端事件/状态同步收集器
|
|
8
10
|
*/
|
|
9
11
|
export declare class Collector extends BaseCollector<ISerializableStorageViewData> {
|
|
10
|
-
protected authSpace: string;
|
|
11
|
-
protected namespace: string;
|
|
12
12
|
static namespace: string;
|
|
13
13
|
static authSpace: string;
|
|
14
|
+
static globalUndoRedoStackSpace: string;
|
|
15
|
+
protected namespace: string;
|
|
16
|
+
protected authSpace: string;
|
|
17
|
+
protected globalUndoRedoStackSpace: string;
|
|
14
18
|
static componentsLimits: number[];
|
|
15
19
|
serviceStorage: ISerializableStorageViewData;
|
|
16
20
|
storage: ISerializableStorageViewData;
|
|
17
21
|
authStorage: ISerializableAuthData;
|
|
22
|
+
globalUndoRedoStackStorage: ISerializableUndoRedoStackViewData;
|
|
18
23
|
private stateDisposer;
|
|
19
24
|
private authDisposer;
|
|
20
25
|
private asyncClockState;
|
|
@@ -61,6 +66,16 @@ export declare class Collector extends BaseCollector<ISerializableStorageViewDat
|
|
|
61
66
|
private syncStorageKey;
|
|
62
67
|
keyTransformWorkId(key: string): string;
|
|
63
68
|
destroy(): void;
|
|
69
|
+
private transformToSerializableUndoStackItemData;
|
|
70
|
+
dispatchUndoTicker(action: {
|
|
71
|
+
operation: EOperationType;
|
|
72
|
+
syncType: EProxyArrayOperationType;
|
|
73
|
+
viewId: ViewId;
|
|
74
|
+
undoTickerId: ISerializableUndoStackId;
|
|
75
|
+
data: IUndoStackItem;
|
|
76
|
+
}): void;
|
|
77
|
+
addGlobalUndoRedoStackListener(callBack: (diffGlobalUndoRedoStack: DiffGlobalUndoRedoStack) => void): void;
|
|
78
|
+
private diffGlobalUndoRedoStackFun;
|
|
64
79
|
dispatchPageAuth(action: {
|
|
65
80
|
operation: EOperationType;
|
|
66
81
|
viewId: ViewId;
|
|
@@ -54,6 +54,7 @@ export interface INormalPushMsg {
|
|
|
54
54
|
viewId?: string;
|
|
55
55
|
scenePath?: string;
|
|
56
56
|
isActive?: string;
|
|
57
|
+
needUndoTicker?: number;
|
|
57
58
|
}
|
|
58
59
|
export interface INormalStorageData {
|
|
59
60
|
[key: string]: IStorageValueItem | undefined;
|
|
@@ -67,6 +68,41 @@ export type ViewId = string;
|
|
|
67
68
|
export type WorkId = string;
|
|
68
69
|
export type ScenePath = string;
|
|
69
70
|
export type Uid = string | "localSelf";
|
|
71
|
+
export type UndoStackId = number;
|
|
72
|
+
export type ISerializableUndoStackId = `${UndoStackId}-${Uid}`;
|
|
73
|
+
export declare enum EUndoDataType {
|
|
74
|
+
Draw = 1,
|
|
75
|
+
Delete = 2,
|
|
76
|
+
Update = 3
|
|
77
|
+
}
|
|
78
|
+
export interface ISerializableUndoDataType {
|
|
79
|
+
dataType: EUndoDataType;
|
|
80
|
+
data: BaseCollectorReducerAction | [BaseCollectorReducerAction, BaseCollectorReducerAction];
|
|
81
|
+
}
|
|
82
|
+
export declare type DiffGlobalUndoRedoStack = {
|
|
83
|
+
[K in keyof ISerializableUndoRedoStackViewData]?: DiffViewGlobalUndoRedoData;
|
|
84
|
+
};
|
|
85
|
+
export declare type DiffViewGlobalUndoRedoData = {
|
|
86
|
+
oldValue?: ISerializableUndoRedoStackData;
|
|
87
|
+
newValue?: ISerializableUndoRedoStackData;
|
|
88
|
+
};
|
|
89
|
+
export type ISerializableUndoStackItemDataType = {
|
|
90
|
+
[key: WorkId]: ISerializableUndoDataType;
|
|
91
|
+
};
|
|
92
|
+
export type ISerializableUndoStackItemData = {
|
|
93
|
+
data: ISerializableUndoStackItemDataType;
|
|
94
|
+
scenePath: string;
|
|
95
|
+
};
|
|
96
|
+
export type ISerializableUndoStackType = {
|
|
97
|
+
[key: ISerializableUndoStackId]: ISerializableUndoStackItemData;
|
|
98
|
+
};
|
|
99
|
+
export type ISerializableUndoRedoStackData = {
|
|
100
|
+
undoStack: ISerializableUndoStackType;
|
|
101
|
+
redoStack: ISerializableUndoStackType;
|
|
102
|
+
};
|
|
103
|
+
export type ISerializableUndoRedoStackViewData = {
|
|
104
|
+
[key: ViewId]: ISerializableUndoRedoStackData;
|
|
105
|
+
};
|
|
70
106
|
export interface BaseEventCollectorReducerAction {
|
|
71
107
|
type?: EventMessageType;
|
|
72
108
|
uid?: string;
|
|
@@ -24,7 +24,7 @@ export interface TextEditorManager {
|
|
|
24
24
|
/** 校验是否删除空文本或事失焦 */
|
|
25
25
|
checkEmptyTextBlur(): void;
|
|
26
26
|
/** 激活文本编辑组件 */
|
|
27
|
-
active(workId: string, undoTickerId?: number
|
|
27
|
+
active(workId: string, undoTickerId?: number): void;
|
|
28
28
|
/** 不激活文本编辑组件 */
|
|
29
29
|
unActive(blurId: string): void;
|
|
30
30
|
/** 创建文本来源于main */
|
|
@@ -101,9 +101,9 @@ export declare class TextEditorManagerImpl implements TextEditorManager {
|
|
|
101
101
|
onCameraChange(cameraOpt: ICameraOpt, viewId: string): void;
|
|
102
102
|
onServiceDerive(data: IWorkerMessage): void;
|
|
103
103
|
updateForViewEdited(activeId: string, info: TextEditorInfo): void;
|
|
104
|
-
active(workId: string, undoTickerId?: number
|
|
104
|
+
active(workId: string, undoTickerId?: number): void;
|
|
105
105
|
unActive(blurId: string): void;
|
|
106
|
-
addUndoTicker(undoTickerId: number
|
|
106
|
+
addUndoTicker(undoTickerId: number, viewId: string): void;
|
|
107
107
|
createTextForMasterController(params: TextEditorInfo & {
|
|
108
108
|
workId: string;
|
|
109
109
|
viewId: string;
|
package/dist/core/enum.d.ts
CHANGED
|
@@ -195,7 +195,11 @@ export declare enum EOperationType {
|
|
|
195
195
|
/** 清空场景下的所有页面*/
|
|
196
196
|
clearViewScenePath = "clearViewScenePath",
|
|
197
197
|
/** 清空view */
|
|
198
|
-
clearView = "clearView"
|
|
198
|
+
clearView = "clearView",
|
|
199
|
+
/** 同步UndoStack */
|
|
200
|
+
syncUndoStack = "syncUndoStack",
|
|
201
|
+
/** 同步RodoStack */
|
|
202
|
+
syncRedoStack = "syncRedoStack"
|
|
199
203
|
}
|
|
200
204
|
/**
|
|
201
205
|
* 笔记过滤 操作类型
|
|
@@ -206,7 +206,7 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
206
206
|
getConsumeCount(): number;
|
|
207
207
|
setWorkerTasksqueueCount(num: number): void;
|
|
208
208
|
collectorSyncData(sp: IMainMessage[]): void;
|
|
209
|
-
foceUndoTickerEnd(id:
|
|
209
|
+
foceUndoTickerEnd(id: number, viewId: string): void;
|
|
210
210
|
private collectorAsyncData;
|
|
211
211
|
private onLocalEventEnd;
|
|
212
212
|
private onLocalEventDoing;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -206,6 +206,7 @@ export interface IMainMessage extends INormalPushMsg {
|
|
|
206
206
|
isLockSentEventCursor?: boolean;
|
|
207
207
|
nextTasks?: IMainMessage[];
|
|
208
208
|
setFontFaceResult?: boolean;
|
|
209
|
+
needUndoTicker?: number;
|
|
209
210
|
[key: string]: any;
|
|
210
211
|
}
|
|
211
212
|
export interface IMainMessageRenderData {
|
|
@@ -257,7 +258,7 @@ export interface IUpdateSelectorPropsType {
|
|
|
257
258
|
/** 平滑同步 */
|
|
258
259
|
smoothSync?: boolean;
|
|
259
260
|
/** 记录撤销重做id */
|
|
260
|
-
needUndoTicker?: number
|
|
261
|
+
needUndoTicker?: number;
|
|
261
262
|
}
|
|
262
263
|
export interface IUpdateSelectorCallbackPropsType {
|
|
263
264
|
res?: IMainMessage;
|
|
@@ -47,7 +47,7 @@ export declare class LocalWorkForFullWorker extends LocalWork {
|
|
|
47
47
|
ops?: string;
|
|
48
48
|
}>;
|
|
49
49
|
smoothSync?: boolean;
|
|
50
|
-
needUndoTicker?: number
|
|
50
|
+
needUndoTicker?: number;
|
|
51
51
|
}) => void;
|
|
52
52
|
}): Promise<IMainMessage | undefined>;
|
|
53
53
|
blurSelector(data?: IWorkerMessage): Promise<void>;
|
package/dist/fullWorker.js
CHANGED
|
@@ -396,7 +396,7 @@ _inherits(l,_r$default22);return _createClass(l,[{key:"texture",get:function get
|
|
|
396
396
|
h=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
397
397
|
n&&(h=="offset"||h=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
398
398
|
s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||// Skip index properties.
|
|
399
|
-
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,kT=qu;function HT(i){return i!=null&&kT(i.length)&&!GT(i);}var gl=HT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,kC=Sl,HC=qi;function KC(i,e,t){var r=e(i);return HC(i)?r:kC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=jn,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=jn,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=jn,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=jn,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Si,Oi=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Oi(rl),SI=Oi(nl),xI=Oi(il),TI=Oi(sl),CI=Oi(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,kI=UI,HI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return HI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return kI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=Hu,zO=hx,$O=Zu,jO=tC,GO=mC,kO=yC,HO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return HO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return kO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(S){c.add(qs(S,e,t,S,i,s));}):n2(i)&&i.forEach(function(S,I){c.set(I,qs(S,e,t,I,i,s));});var A=h?f?JO:ZO:f?a2:o2,C=m?void 0:A(i);return zO(C||i,function(S,I){C&&(I=S,S=i[I]),$O(c,I,qs(S,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.27-beta.0",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ci(r),"L").concat(ci(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ui(r,n);return e?"M".concat(ui(i[0],i[1]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2]),"T").concat(s).concat(ui(i[t-1],i[0])).concat(ui(i[0],i[1]),"Z"):"M".concat(ci(i[0]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ci(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var A=l==null?void 0:l.getBoundingClientRect();return A&&(t=Zt(t,{x:Math.floor(A.x-Mr.SafeBorderPadding),y:Math.floor(A.y-Mr.SafeBorderPadding),w:Math.floor(A.width+Mr.SafeBorderPadding*2),h:Math.floor(A.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var A=c.getAttribute("scale");A=[A[0]*T,A[1]*T];var C=c.parent.parent,S=c.getAttribute("translate"),_I30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},A,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_I30.appendChild(_d30);var g=_I30.parent;g.render();var p=_I30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d30,g),C.removeChild(g),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,E),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=x.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,g),C.removeChild(g),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I30.worldScaling});ut&&r.append(ut),Lr(_d30,g),C.removeChild(g),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(A,C){return C%2?A-r[1]:A-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var A=_ref164.detail;var C=A.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var A=_ref165.detail;var C=A.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,A=r.thickness;var C;var S=c&&fr(c)||n.get(t.name);if(!S)return;er(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var g=[S.op[0],S.op[1]];Ll(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _g6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(S.rect,_g6),S.rect=C;}else{var _g7=Mr.getRectFromLayer(I,t.name);S.rect=_g7||S.rect;}}else if(er(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)C=Hh(S.rect,h),S.rect=C;else{var _g8=Mr.getRectFromLayer(I,t.name);S.rect=_g8||S.rect;}if(T){var _g9=T.get(t.name);if(_g9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_g9[_x37][0],S.op[_p10+1]=_g9[_x37][1];}if(A&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=A),s&&!(m&&y&&c)){if(f){var _g10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_g10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(er(h)){var _g11=S.op;if(JA(_g11,S.centerPos,h),S.op=_g11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)QA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
399
|
+
AT(h,f)))&&l.push(h);return l;}var th=RT,bT=Object.prototype;function DT(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||bT;return i===t;}var vl=DT;function NT(i,e){return function(t){return i(e(t));};}var eh=NT,BT=eh,WT=BT(Object.keys,Object),FT=WT,UT=vl,YT=FT,XT=Object.prototype,zT=XT.hasOwnProperty;function $T(i){if(!UT(i))return YT(i);var e=[];for(var t in Object(i))zT.call(i,t)&&t!="constructor"&&e.push(t);return e;}var jT=$T,GT=ju,kT=qu;function HT(i){return i!=null&&kT(i.length)&&!GT(i);}var gl=HT,KT=th,VT=jT,ZT=gl;function JT(i){return ZT(i)?KT(i):VT(i);}var ml=JT,QT=yo,qT=ml;function _T(i,e){return i&&QT(e,qT(e),i);}var tC=_T;function eC(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e;}var rC=eC,nC=Qi,iC=vl,sC=rC,oC=Object.prototype,aC=oC.hasOwnProperty;function lC(i){if(!nC(i))return sC(i);var e=iC(i),t=[];for(var r in i)r=="constructor"&&(e||!aC.call(i,r))||t.push(r);return t;}var fC=lC,cC=th,uC=fC,hC=gl;function dC(i){return hC(i)?cC(i,!0):uC(i);}var yl=dC,pC=yo,vC=yl;function gC(i,e){return i&&pC(e,vC(e),i);}var mC=gC,ro={exports:{}};ro.exports;(function(i,e){var t=_r,r=e&&!e.nodeType&&e,n=r&&!0&&i&&!i.nodeType&&i,s=n&&n.exports===r,c=s?t.Buffer:void 0,l=c?c.allocUnsafe:void 0;function f(h,m){if(m)return h.slice();var u=h.length,y=l?l(u):new h.constructor(u);return h.copy(y),y;}i.exports=f;})(ro,ro.exports);var yC=ro.exports;function PC(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e;}var SC=PC;function xC(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var c=i[t];e(c,t,i)&&(s[n++]=c);}return s;}var rh=xC;function TC(){return[];}var nh=TC,CC=rh,IC=nh,OC=Object.prototype,wC=OC.propertyIsEnumerable,qc=Object.getOwnPropertySymbols,AC=qc?function(i){return i==null?[]:(i=Object(i),CC(qc(i),function(e){return wC.call(i,e);}));}:IC,Pl=AC,EC=yo,MC=Pl;function LC(i,e){return EC(i,MC(i),e);}var RC=LC;function bC(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i;}var Sl=bC,DC=eh,NC=DC(Object.getPrototypeOf,Object),ih=NC,BC=Sl,WC=ih,FC=Pl,UC=nh,YC=Object.getOwnPropertySymbols,XC=YC?function(i){for(var e=[];i;)BC(e,FC(i)),i=WC(i);return e;}:UC,sh=XC,zC=yo,$C=sh;function jC(i,e){return zC(i,$C(i),e);}var GC=jC,kC=Sl,HC=qi;function KC(i,e,t){var r=e(i);return HC(i)?r:kC(r,t(i));}var oh=KC,VC=oh,ZC=Pl,JC=ml;function QC(i){return VC(i,JC,ZC);}var ah=QC,qC=oh,_C=sh,tI=yl;function eI(i){return qC(i,tI,_C);}var rI=eI,nI=jn,iI=_r,sI=nI(iI,"DataView"),oI=sI,aI=jn,lI=_r,fI=aI(lI,"Promise"),cI=fI,uI=jn,hI=_r,dI=uI(hI,"Set"),lh=dI,pI=jn,vI=_r,gI=pI(vI,"WeakMap"),mI=gI,rl=oI,nl=hl,il=cI,sl=lh,ol=mI,fh=Si,Oi=Gu,_c="[object Map]",yI="[object Object]",tu="[object Promise]",eu="[object Set]",ru="[object WeakMap]",nu="[object DataView]",PI=Oi(rl),SI=Oi(nl),xI=Oi(il),TI=Oi(sl),CI=Oi(ol),zn=fh;(rl&&zn(new rl(new ArrayBuffer(1)))!=nu||nl&&zn(new nl())!=_c||il&&zn(il.resolve())!=tu||sl&&zn(new sl())!=eu||ol&&zn(new ol())!=ru)&&(zn=function zn(i){var e=fh(i),t=e==yI?i.constructor:void 0,r=t?Oi(t):"";if(r)switch(r){case PI:return nu;case SI:return _c;case xI:return tu;case TI:return eu;case CI:return ru;}return e;});var So=zn,II=Object.prototype,OI=II.hasOwnProperty;function wI(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&OI.call(i,"index")&&(t.index=i.index,t.input=i.input),t;}var AI=wI,EI=_r,MI=EI.Uint8Array,ch=MI,iu=ch;function LI(i){var e=new i.constructor(i.byteLength);return new iu(e).set(new iu(i)),e;}var xl=LI,RI=xl;function bI(i,e){var t=e?RI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength);}var DI=bI,NI=/\w*$/;function BI(i){var e=new i.constructor(i.source,NI.exec(i));return e.lastIndex=i.lastIndex,e;}var WI=BI,su=Ji,ou=su?su.prototype:void 0,au=ou?ou.valueOf:void 0;function FI(i){return au?Object(au.call(i)):{};}var UI=FI,YI=xl;function XI(i,e){var t=e?YI(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length);}var zI=XI,$I=xl,jI=DI,GI=WI,kI=UI,HI=zI,KI="[object Boolean]",VI="[object Date]",ZI="[object Map]",JI="[object Number]",QI="[object RegExp]",qI="[object Set]",_I="[object String]",tO="[object Symbol]",eO="[object ArrayBuffer]",rO="[object DataView]",nO="[object Float32Array]",iO="[object Float64Array]",sO="[object Int8Array]",oO="[object Int16Array]",aO="[object Int32Array]",lO="[object Uint8Array]",fO="[object Uint8ClampedArray]",cO="[object Uint16Array]",uO="[object Uint32Array]";function hO(i,e,t){var r=i.constructor;switch(e){case eO:return $I(i);case KI:case VI:return new r(+i);case rO:return jI(i,t);case nO:case iO:case sO:case oO:case aO:case lO:case fO:case cO:case uO:return HI(i,t);case ZI:return new r();case JI:case _I:return new r(i);case QI:return GI(i);case qI:return new r();case tO:return kI(i);}}var dO=hO,pO=Qi,lu=Object.create,vO=/* @__PURE__ */function(){function i(){}return function(e){if(!pO(e))return{};if(lu)return lu(e);i.prototype=e;var t=new i();return i.prototype=void 0,t;};}(),gO=vO,mO=gO,yO=ih,PO=vl;function SO(i){return typeof i.constructor=="function"&&!PO(i)?mO(yO(i)):{};}var xO=SO,TO=So,CO=pn,IO="[object Map]";function OO(i){return CO(i)&&TO(i)==IO;}var wO=OO,AO=wO,EO=Po,fu=pl,cu=fu&&fu.isMap,MO=cu?EO(cu):AO,LO=MO,RO=So,bO=pn,DO="[object Set]";function NO(i){return bO(i)&&RO(i)==DO;}var BO=NO,WO=BO,FO=Po,uu=pl,hu=uu&&uu.isSet,UO=hu?FO(hu):WO,uh=UO,YO=/* @__PURE__ */Ln(uh),XO=Hu,zO=hx,$O=Zu,jO=tC,GO=mC,kO=yC,HO=SC,KO=RC,VO=GC,ZO=ah,JO=rI,QO=So,qO=AI,_O=dO,t2=xO,e2=qi,r2=dl,n2=LO,i2=Qi,s2=uh,o2=ml,a2=yl,l2=1,f2=2,c2=4,hh="[object Arguments]",u2="[object Array]",h2="[object Boolean]",d2="[object Date]",p2="[object Error]",dh="[object Function]",v2="[object GeneratorFunction]",g2="[object Map]",m2="[object Number]",ph="[object Object]",y2="[object RegExp]",P2="[object Set]",S2="[object String]",x2="[object Symbol]",T2="[object WeakMap]",C2="[object ArrayBuffer]",I2="[object DataView]",O2="[object Float32Array]",w2="[object Float64Array]",A2="[object Int8Array]",E2="[object Int16Array]",M2="[object Int32Array]",L2="[object Uint8Array]",R2="[object Uint8ClampedArray]",b2="[object Uint16Array]",D2="[object Uint32Array]",Ye={};Ye[hh]=Ye[u2]=Ye[C2]=Ye[I2]=Ye[h2]=Ye[d2]=Ye[O2]=Ye[w2]=Ye[A2]=Ye[E2]=Ye[M2]=Ye[g2]=Ye[m2]=Ye[ph]=Ye[y2]=Ye[P2]=Ye[S2]=Ye[x2]=Ye[L2]=Ye[R2]=Ye[b2]=Ye[D2]=!0;Ye[p2]=Ye[dh]=Ye[T2]=!1;function qs(i,e,t,r,n,s){var c,l=e&l2,f=e&f2,h=e&c2;if(t&&(c=n?t(i,r,n,s):t(i)),c!==void 0)return c;if(!i2(i))return i;var m=e2(i);if(m){if(c=qO(i),!l)return HO(i,c);}else{var u=QO(i),y=u==dh||u==v2;if(r2(i))return kO(i,l);if(u==ph||u==hh||y&&!n){if(c=f||y?{}:t2(i),!l)return f?VO(i,GO(c,i)):KO(i,jO(c,i));}else{if(!Ye[u])return n?i:{};c=_O(i,u,l);}}s||(s=new XO());var T=s.get(i);if(T)return T;s.set(i,c),s2(i)?i.forEach(function(S){c.add(qs(S,e,t,S,i,s));}):n2(i)&&i.forEach(function(S,I){c.set(I,qs(S,e,t,I,i,s));});var A=h?f?JO:ZO:f?a2:o2,C=m?void 0:A(i);return zO(C||i,function(S,I){C&&(I=S,S=i[I]),$O(c,I,qs(S,e,t,I,i,s));}),c;}var N2=qs,B2=N2,W2=1,F2=4;function U2(i){return B2(i,W2|F2);}var Y2=U2,fr=/* @__PURE__ */Ln(Y2);var vh="1.1.27-beta.2",X2="@netless/appliance-plugin";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var i=window.__netlessUA||"";i+=" ".concat(X2,"@").concat(vh),window.__netlessUA=i;}var vr={useWorker:"auto",useSimple:!1,syncOpt:{interval:300,smoothSync:!0},cursor:{enable:!0,expirationTime:5e3,moveDelayTime:100},bufferSize:{full:2e4,sub:600},bezier:{enable:!0,maxDrawCount:1/0,combineUnitTime:300},pencilEraser:{useBitMap:!0,maxImageWidth:1920,maxImageHeight:1920,maxCombineTime:500},strokeWidth:{min:1,max:10},textEditor:{showFloatBar:!0,canSelectorSwitch:!0,rightBoundBreak:!1,extendFontFaces:[],loadFontFacesTimeout:1e4},longDottedStroke:{lineCap:"round",segment:1,gap:2},dottedStroke:{lineCap:"round",segment:1,gap:2},normalStroke:{lineCap:"round"},undoRedo:{enableGlobal:!1,maxStackLength:20}};function En(i){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=i.length;if(t<2)return"";var r=i[0],n=i[1];if(t===2)return"M".concat(ci(r),"L").concat(ci(n));var s="";for(var c=2,l=t-1;c<l;c++)r=i[c],n=i[c+1],s+=ui(r,n);return e?"M".concat(ui(i[0],i[1]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2]),"T").concat(s).concat(ui(i[t-1],i[0])).concat(ui(i[0],i[1]),"Z"):"M".concat(ci(i[0]),"Q").concat(ci(i[1])).concat(ui(i[1],i[2])).concat(i.length>3?"T":"").concat(s,"L").concat(ci(i[t-1]));}var Mr=/*#__PURE__*/function(){function Mr(e){_classCallCheck(this,Mr);dt(this,"maxImageWidth",vr.pencilEraser.maxImageWidth);dt(this,"maxImageHeight",vr.pencilEraser.maxImageHeight);dt(this,"syncUnitTime",vr.syncOpt.interval);dt(this,"vNodes");dt(this,"drawLayer");dt(this,"fullLayer");dt(this,"workId");dt(this,"isDelete",!1);var t=e.vNodes,r=e.fullLayer,n=e.drawLayer,s=e.workId,c=e.toolsOpt;this.vNodes=t,this.fullLayer=r,this.drawLayer=n,this.workId=s,this.syncUnitTime=c.syncUnitTime||this.syncUnitTime;}return _createClass(Mr,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return e.reduce(function(r,n){var s=r[r.length-1];return(n&&!s||n&&s&&!n.isNear(s,t))&&r.push(n),r;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(e){this.workId=e;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(e){var n,s,c;this.workOptions=e,this.syncUnitTime=e.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),r=t&&((s=this.vNodes)==null?void 0:s.get(t))||void 0;t&&r&&(r.opt=e,(c=this.vNodes)==null||c.setInfo(t,r));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(e){var n,s;var t;var r=(n=this.workId)==null?void 0:n.toString();if(r&&e){var c=this.fullLayer.getElementsByName(r)||this.drawLayer&&this.drawLayer.getElementsByName(r)||[];if(c.length!==1)return;var l=c[0],f=e.pos,h=e.zIndex,m=e.scale,u=e.angle,y=e.translate,T={};er(h)&&(T.zIndex=h),f&&(T.pos=[f[0],f[1]]),m&&(T.scale=m),u&&(T.rotate=u),y&&(T.translate=y),l.attr(T);var A=l==null?void 0:l.getBoundingClientRect();return A&&(t=Zt(t,{x:Math.floor(A.x-Mr.SafeBorderPadding),y:Math.floor(A.y-Mr.SafeBorderPadding),w:Math.floor(A.width+Mr.SafeBorderPadding*2),h:Math.floor(A.height+Mr.SafeBorderPadding*2)})),(s=this.vNodes)==null||s.setInfo(r,{rect:t,centerPos:f}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(e,t){var r=e.group,n=e.eraserlines,s=e.pos,c=e.layer,l=c.parent;if(t)try{var h=(c.renderer.glRenderer||c.renderer.canvasRenderer).options.displayRatio,m=r.getBoundingClientRect(),u=m.width*h*c.worldScaling[0],y=m.height*h*c.worldScaling[1];var T=1;(u>this.maxImageWidth||y>this.maxImageHeight)&&(T=Math.min(this.maxImageWidth/u,this.maxImageHeight/y));var A=c.getAttribute("scale");A=[A[0]*T,A[1]*T];var C=c.parent.parent,S=c.getAttribute("translate"),_I30=this.createVmRenderNode("".concat(this.workId,"_bitMapLayer"),C,{offscreen:l.offscreen,width:l.width,height:l.height,contextType:"2d",autoRender:!1,bufferSize:500},A,S),_d30=r.cloneNode(!0);if(!n||!n.length)return;this.addEraserlines(_d30,n,s,!1),_I30.appendChild(_d30);var g=_I30.parent;g.render();var p=_I30.renderer.canvasRenderer,x=p.context;if(!x)return;var E=p.options.displayRatio,R=_d30.getBoundingClientRect(),D={x:R.x,y:R.y,w:R.width,h:R.height},U={x:0,y:0,w:C.width,h:C.height};if(Zi(D,U)===Tr.outside){Lr(_d30,g),C.removeChild(g),this.isDelete=!0;return;}var W=fr(D);W.x=Math.floor(Math.max(D.x,0)),W.y=Math.floor(Math.max(D.y,0)),W.w=Math.min(D.x+D.w,C.width)-W.x,W.h=Math.min(D.y+D.h,C.height)-W.y;var Y=this.getGroupRect(W,E),B=Y.x,N=Y.y,G=Y.w,J=Y.h;var tt=x.getImageData(B,N,G,J);if(this.isTransparentRectByCanvas(tt)){Lr(_d30,g),C.removeChild(g),this.isDelete=!0,tt=null;return;}Lr(r,l);var ut=this.createSpriteNode({imageData:tt,safariRect:W,originRect:D,worldScaling:_I30.worldScaling});ut&&r.append(ut),Lr(_d30,g),C.removeChild(g),l.deleteTexture(tt),tt=null;}catch(f){console.error("[BaseShapeTool] drawEraserlines error:",f);return;}}},{key:"createVmRenderNode",value:function createVmRenderNode(e,t,r,n,s){var c=r.width,l=r.height,f="bitMap-".concat(e),h=t.layer(f,r),m=new mr({anchor:[0.5,0.5],pos:[c*0.5,l*0.5],size:[c,l],name:"viewport",id:e});return m.setAttribute("scale",n),m.setAttribute("translate",s),h.append(m),m;}},{key:"getGroupRect",value:function getGroupRect(e,t){var r=Math.floor(e.x*t),n=Math.floor(e.y*t),s=Math.floor(e.w*t),c=Math.floor(e.h*t);return{x:r,y:n,w:s,h:c};}},{key:"addEraserlines",value:function addEraserlines(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;var _iterator13=_createForOfIteratorHelper(t),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var c=s.thickness,l=s.op;var _iterator14=_createForOfIteratorHelper(l),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var f=_step14.value;var h=f.map(function(A,C){return C%2?A-r[1]:A-r[0];}),m=this.computEraserPoints(h,c),u=En(m,!0),y={pos:[0,0],d:u,fillColor:"rgba(0,0,0,1)"},T=new Mn(y);T.addEventListener("beforerender",function(_ref164){var A=_ref164.detail;var C=A.context;n?C.blendFuncSeparate(C.ZERO,C.ZERO,C.ZERO,C.ZERO):C.globalCompositeOperation="destination-out";}),T.addEventListener("afterrender",function(_ref165){var A=_ref165.detail;var C=A.context;n?C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA):C.globalCompositeOperation="source-over";}),e.append(T);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"isTransparentRectByCanvas",value:function isTransparentRectByCanvas(e){var t=!0;for(var r=0;r<e.data.length;r+=4)if(e.data[r+3]!==0){t=!1;break;}return t;}},{key:"createSpriteNode",value:function createSpriteNode(e){var t=e.imageData,r=e.worldScaling,n=e.safariRect,s=e.originRect;var c;if(typeof OffscreenCanvas=="function"){c=new OffscreenCanvas(t.width,t.height);var m=c.getContext("2d");m&&m.putImageData(t,0,0);}else if((typeof document==="undefined"?"undefined":_typeof(document))<"u"){c=document.createElement("canvas"),c.width=t.width,c.height=t.height;var _m4=c.getContext("2d");_m4&&_m4.putImageData(t,0,0);}if(!c)return console.warn("Failed to create imageEraserBitmap Sprite"),null;var l=[Math.floor(s.w/r[0]),Math.floor(s.h/r[1])],f=[Math.floor((n.x-s.x)/r[0]),Math.floor((n.y-s.y)/r[1]),Math.floor(n.w/r[0]),Math.floor(n.h/r[1])],h={name:"eraserTexture",anchor:[0.5,0.5],pos:[0,0],size:l,texture:c,textureRect:f};return new Yu(h);}},{key:"computEraserPoints",value:function computEraserPoints(e,t){var r=Math.ceil(t/2);return e.length===2?this.computDot(e,r):this.computLine(e,r);}},{key:"computDot",value:function computDot(e,t){var r=new Jt(e[0],e[1]);return Jt.GetDotStroke(r,t,8);}},{key:"computLine",value:function computLine(e,t){var r=[],n=[];var s,c;for(var l=0;l<e.length;l+=2){var f=new Jt(e[l],e[l+1]);var h=void 0;if(l==e.length-2){var m=new Jt(e[l-2],e[l-1]);h=pt.Sub(f,m).uni(),s=f;}else{l===0&&(c=f);var _m5=new Jt(e[l+2],e[l+3]);h=pt.Sub(_m5,f).uni();}if(h){var _m6=pt.Per(h).mul(t);r.push(Jt.Sub(f,_m6)),n.push(Jt.Add(f,_m6));}}if(s&&c){var _l3=Jt.GetSemicircleStroke(s,r[r.length-1],-1,8),_f4=Jt.GetSemicircleStroke(c,n[0],-1,8);return r.concat(_l3,n.reverse(),_f4);}return[];}},{key:"replace",value:function replace(e,t,r){var _this61=this;var s;if(!t){r&&e.append(r);return;}var n=e.getElementsByName(t);if(n.length){var _iterator15=_createForOfIteratorHelper(n),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var c=_step15.value;r?iE(r,c,e):(c.remove(),_pr(c,e.parent));}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}else r&&e.append(r);this.fullLayer!==this.drawLayer&&(this.fullLayer===e?(s=this.drawLayer)==null||s.getElementsByName(t).forEach(function(l){var f;l.remove(),_pr(l,(f=_this61.drawLayer)==null?void 0:f.parent);}):this.fullLayer.getElementsByName(t).forEach(function(l){l.remove(),_pr(l,_this61.fullLayer.parent);}));}},{key:"removeDrawCountNodes",value:function removeDrawCountNodes(e,t){var r=[];e.getElementsByName(this.workId).forEach(function(n){n.id&&t&&Number(n.id)<t&&r.push(n);});for(var _i2=0,_r3=r;_i2<_r3.length;_i2++){var n=_r3[_i2];n.remove(),_pr(n,e.parent);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(e){var d;var t=e.node,r=e.opt,n=e.vNodes,s=e.willSerializeData,c=e.targetNode,l=r.zIndex,f=r.translate,h=r.angle,m=r.originPoint,u=r.scenePoint,y=r.scale,T=r.pointMap,A=r.thickness;var C;var S=c&&fr(c)||n.get(t.name);if(!S)return;er(l)&&(t.setAttribute("zIndex",l),S.opt.zIndex=l);var I=t.parent;if(I){if(m&&y&&c){var g=[S.op[0],S.op[1]];Ll(S.op,u,y,f);var p=[S.op[0],S.op[1]],x=[p[0]-g[0],p[1]-g[1]];if(S.centerPos=[S.centerPos[0]+x[0],S.centerPos[1]+x[1]],S.opt.translate=void 0,S.opt.scale=void 0,S.opt.eraserlines)for(var E=0;E<S.opt.eraserlines.length;E++){var _S$opt$eraserlines$E=S.opt.eraserlines[E],R=_S$opt$eraserlines$E.op,D=_S$opt$eraserlines$E.thickness;S.opt.eraserlines[E].thickness=Math.round(D*Math.max(y[0],y[1]));for(var U=0;U<R.length;U++)Rl(R[U],u,y,f);}}else if(f){if(t.setAttribute("translate",f),S.opt.translate=f,c){var _g6=[f[0]*I.worldScaling[0],f[1]*I.worldScaling[1]];C=Vi(S.rect,_g6),S.rect=C;}else{var _g7=Mr.getRectFromLayer(I,t.name);S.rect=_g7||S.rect;}}else if(er(h))if(t.setAttribute("rotate",h),S.opt.rotate=h,c)C=Hh(S.rect,h),S.rect=C;else{var _g8=Mr.getRectFromLayer(I,t.name);S.rect=_g8||S.rect;}if(T){var _g9=T.get(t.name);if(_g9)for(var _p10=0,_x37=0;_p10<S.op.length;_p10+=3,_x37++)S.op[_p10]=_g9[_x37][0],S.op[_p10+1]=_g9[_x37][1];}if(A&&(d=S==null?void 0:S.opt)!=null&&d.thickness&&(S.opt.thickness=A),s&&!(m&&y&&c)){if(f){var _g10=S.op.map(function(p,x){var E=x%3;return E===0?p+f[0]:E===1?p+f[1]:p;});if(S.op=_g10,S.centerPos=[S.centerPos[0]+f[0],S.centerPos[1]+f[1]],S!=null&&S.opt&&(S.opt.translate=void 0),S.opt.eraserlines)for(var _p11=0;_p11<S.opt.eraserlines.length;_p11++){var _x38=S.opt.eraserlines[_p11].op;for(var _E7=0;_E7<_x38.length;_E7++){var _R3=_x38[_E7].map(function(D,U){return U%2?D+f[1]:D+f[0];});S.opt.eraserlines[_p11].op[_E7]=_R3;}}}else if(er(h)){var _g11=S.op;if(JA(_g11,S.centerPos,h),S.op=_g11,S!=null&&S.opt&&(S.opt.rotate=void 0),S.opt.eraserlines)for(var _p12=0;_p12<S.opt.eraserlines.length;_p12++){var _x39=S.opt.eraserlines[_p12].op;for(var _E8=0;_E8<_x39.length;_E8++)QA(_x39[_E8],S.centerPos,h);}}}S&&n.setInfo(t.name,S);}}},{key:"getCenterPos",value:function getCenterPos(e,t){var r=t.worldPosition,n=t.worldScaling;return[(e.x+e.w/2-r[0])/n[0],(e.y+e.h/2-r[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(e,t){var r=e.getElementsByName(t)[0];if(r){var n=r.getBoundingClientRect();return{x:Math.floor(n.x-Mr.SafeBorderPadding),y:Math.floor(n.y-Mr.SafeBorderPadding),w:Math.floor(n.width+Mr.SafeBorderPadding*2),h:Math.floor(n.height+Mr.SafeBorderPadding*2)};}}},{key:"isWillRefresh",value:function isWillRefresh(e){var t=e.toolsType,r=e.opt,n=e.node,s=e.updateOpt,c=e.willSerializeData;return!!(c&&(s.angle||s.translate)||s.thickness&&r.thickness&&r.thickness!==s.thickness||s.strokeType&&r.strokeType&&r.strokeType!==s.strokeType||s.originPoint&&s.scenePoint&&s.scale||s.pointMap&&s.pointMap.has(n.name)||t===Tt.Text&&(s.fontSize||s.translate||s.textInfos&&s.textInfos.get(n.name))||t===Tt.Image&&(s.angle||s.translate||s.scale||s.strokeColor&&s.type===cl.Iconify)||t===s.toolsType&&s.willRefresh||r.eraserlines&&r.eraserlines.length&&(s.strokeColor||s.fillColor));}}]);}();dt(Mr,"SafeBorderPadding",10);var $t=Mr;var Tl=Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50}),Object.freeze({width:48,height:74})]);var Cl={exports:{}};Cl.exports;(function(i){var e=function(){var t=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",s={};function c(f,h){if(!s[f]){s[f]={};for(var m=0;m<f.length;m++)s[f][f.charAt(m)]=m;}return s[f][h];}var l={compressToBase64:function compressToBase64(f){if(f==null)return"";var h=l._compress(f,6,function(m){return r.charAt(m);});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"=";}},decompressFromBase64:function decompressFromBase64(f){return f==null?"":f==""?null:l._decompress(f.length,32,function(h){return c(r,f.charAt(h));});},compressToUTF16:function compressToUTF16(f){return f==null?"":l._compress(f,15,function(h){return t(h+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(f){return f==null?"":f==""?null:l._decompress(f.length,16384,function(h){return f.charCodeAt(h)-32;});},//compress into uint8array (UCS-2 big endian format)
|
|
400
400
|
compressToUint8Array:function compressToUint8Array(f){for(var h=l.compress(f),m=new Uint8Array(h.length*2),u=0,y=h.length;u<y;u++){var T=h.charCodeAt(u);m[u*2]=T>>>8,m[u*2+1]=T%256;}return m;},//decompress from uint8array (UCS-2 big endian format)
|
|
401
401
|
decompressFromUint8Array:function decompressFromUint8Array(f){if(f==null)return l.decompress(f);for(var h=new Array(f.length/2),m=0,u=h.length;m<u;m++)h[m]=f[m*2]*256+f[m*2+1];var y=[];return h.forEach(function(T){y.push(t(T));}),l.decompress(y.join(""));},//compress into a string that is already URI encoded
|
|
402
402
|
compressToEncodedURIComponent:function compressToEncodedURIComponent(f){return f==null?"":l._compress(f,6,function(h){return n.charAt(h);});},//decompress from an output of compressToEncodedURIComponent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var $e = Object.defineProperty;
|
|
2
2
|
var _e = (S, i, t) => i in S ? $e(S, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : S[i] = t;
|
|
3
3
|
var y = (S, i, t) => _e(S, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import { g as Kt, _ as Te, i as Vt, p as kt, a as St, D as J, c as E, b as Rt, E as _t, d as st, P as O, V as I, s as Qt, e as Jt, f as Nt, h as ve, r as Ge, j as He, k as T, l as Gt, m as X, n as w, o as D, q as A, t as z, u as tt, v as _, w as jt, x as qe, y as je, z as Ze, A as Ke, B as Ve, C as Qe, F as Je, G as ts, S as $, H as es, I as ae, J as Wt, K as Pe, T as At, L as yt, M as ss, N as Ie, O as os, Q as is, R as ct, U as G, W as ut, X as rs, Y as ns, Z as as, $ as cs, a0 as bt, a1 as ls, a2 as U, a3 as ce, a4 as le, a5 as hs } from "./index-
|
|
4
|
+
import { g as Kt, _ as Te, i as Vt, p as kt, a as St, D as J, c as E, b as Rt, E as _t, d as st, P as O, V as I, s as Qt, e as Jt, f as Nt, h as ve, r as Ge, j as He, k as T, l as Gt, m as X, n as w, o as D, q as A, t as z, u as tt, v as _, w as jt, x as qe, y as je, z as Ze, A as Ke, B as Ve, C as Qe, F as Je, G as ts, S as $, H as es, I as ae, J as Wt, K as Pe, T as At, L as yt, M as ss, N as Ie, O as os, Q as is, R as ct, U as G, W as ut, X as rs, Y as ns, Z as as, $ as cs, a0 as bt, a1 as ls, a2 as U, a3 as ce, a4 as le, a5 as hs } from "./index-DZw2OTFM.mjs";
|
|
5
5
|
import { Group as K, Path as wt, Sprite as We, Rect as he, Polyline as ht, Ellipse as ps, Label as ds, Scene as te, Layer as us } from "spritejs";
|
|
6
6
|
import rt from "clipper-lib";
|
|
7
7
|
import ee from "lineclip";
|
|
@@ -11,7 +11,6 @@ import { cloneDeep as Le, xor as fs, isNumber as Bt, isEqual as pe } from "lodas
|
|
|
11
11
|
import "white-web-sdk";
|
|
12
12
|
import "react-dom";
|
|
13
13
|
import "react";
|
|
14
|
-
import "eventemitter2";
|
|
15
14
|
var ms = Te, ys = Vt, ws = "[object Number]";
|
|
16
15
|
function gs(S) {
|
|
17
16
|
return typeof S == "number" || ys(S) && ms(S) == ws;
|
|
@@ -9587,7 +9586,7 @@ class So {
|
|
|
9587
9586
|
this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), H(this.fullLayer, this.fullLayer.parent), this.scene.remove();
|
|
9588
9587
|
}
|
|
9589
9588
|
}
|
|
9590
|
-
class
|
|
9589
|
+
class Do {
|
|
9591
9590
|
constructor(i) {
|
|
9592
9591
|
y(this, "mainThreadMap", /* @__PURE__ */ new Map());
|
|
9593
9592
|
y(this, "snapshotThread");
|
|
@@ -9688,5 +9687,5 @@ class Mo {
|
|
|
9688
9687
|
}
|
|
9689
9688
|
}
|
|
9690
9689
|
export {
|
|
9691
|
-
|
|
9690
|
+
Do as MainThreadManagerImpl
|
|
9692
9691
|
};
|