@netless/appliance-plugin 1.0.0-beta.6 → 1.0.0-beta.7

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.
Files changed (35) hide show
  1. package/cdn/cdn.js +1 -1
  2. package/cdn/fullWorker-DWcTwv.js +566 -0
  3. package/cdn/subWorker-FlDrsS.js +566 -0
  4. package/dist/appliance-plugin.js +1 -1
  5. package/dist/appliance-plugin.mjs +1 -1
  6. package/dist/component/textEditor/manager.d.ts +2 -3
  7. package/dist/core/enum.d.ts +1 -2
  8. package/dist/core/mainEngine.d.ts +22 -7
  9. package/dist/core/mainThread/snapshotThread.d.ts +4 -5
  10. package/dist/core/mainThread/subLocalThread.d.ts +3 -2
  11. package/dist/core/msgEvent/scaleNode/forMain.d.ts +2 -0
  12. package/dist/core/tools/arrow.d.ts +0 -1
  13. package/dist/core/tools/base.d.ts +2 -2
  14. package/dist/core/tools/ellipse.d.ts +0 -1
  15. package/dist/core/tools/image.d.ts +1 -0
  16. package/dist/core/tools/pencil.d.ts +2 -2
  17. package/dist/core/tools/star.d.ts +0 -1
  18. package/dist/core/tools/text.d.ts +7 -4
  19. package/dist/core/types.d.ts +3 -0
  20. package/dist/core/utils/math.d.ts +3 -0
  21. package/dist/core/utils/spriteNode.d.ts +2 -2
  22. package/dist/core/worker/base.d.ts +1 -1
  23. package/dist/core/worker/subWorkerLocal.d.ts +1 -1
  24. package/dist/core/worker/workerManager.d.ts +0 -1
  25. package/dist/fullWorker.js +11 -11
  26. package/dist/index-AejjET4H.js +1 -0
  27. package/dist/index-BIIqscm6.js +1 -0
  28. package/dist/{index-Dlzsqo2o.mjs → index-CPErIqdS.mjs} +1378 -1367
  29. package/dist/{index-BLC7eY_o.mjs → index-_y5mc2yg.mjs} +3059 -2954
  30. package/dist/subWorker.js +11 -11
  31. package/package.json +1 -1
  32. package/cdn/fullWorker-DHFoEJ.js +0 -566
  33. package/cdn/subWorker-Bp0J0h.js +0 -566
  34. package/dist/index-Bm7SZAO2.js +0 -1
  35. package/dist/index-Bu8mJran.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";var Fo=Object.defineProperty;var Qo=(o,t,e)=>t in o?Fo(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var f=(o,t,e)=>(Qo(o,typeof t!="symbol"?t+"":t,e),e);const K=require("white-web-sdk");require("spritejs");const eo=require("lz-string");require("lineclip");const to=require("eventemitter2"),q=require("lodash"),Vt=require("react-dom"),h=require("react"),st=require("react-draggable"),Ho=require("re-resizable"),Zo="/fullWorker.js",Vo="/subWorker.js";var V=(o=>(o.selector="selector",o.clicker="clicker",o.laserPointer="laserPointer",o.pencil="pencil",o.rectangle="rectangle",o.ellipse="ellipse",o.shape="shape",o.eraser="eraser",o.pencilEraser="pencilEraser",o.text="text",o.straight="straight",o.arrow="arrow",o.hand="hand",o.laserPen="laserPen",o))(V||{}),Gt=(o=>(o[o.pedding=0]="pedding",o[o.mounted=1]="mounted",o[o.update=2]="update",o[o.unmounted=3]="unmounted",o))(Gt||{}),Mt=(o=>(o.Normal="Normal",o.Stroke="Stroke",o.Dotted="Dotted",o.LongDotted="LongDotted",o))(Mt||{}),ze=(o=>(o.Triangle="triangle",o.Rhombus="rhombus",o.Pentagram="pentagram",o.SpeechBalloon="speechBalloon",o.Star="star",o.Polygon="polygon",o))(ze||{}),x=(o=>(o.None="None",o.ShowFloatBar="ShowFloatBar",o.ZIndexFloatBar="ZIndexFloatBar",o.DeleteNode="DeleteNode",o.CopyNode="CopyNode",o.ZIndexActive="ZIndexActive",o.ZIndexNode="ZIndexNode",o.RotateNode="RotateNode",o.SetColorNode="SetColorNode",o.TranslateNode="TranslateNode",o.ScaleNode="ScaleNode",o.OriginalEvent="OriginalEvent",o.CreateScene="CreateScene",o.ActiveCursor="ActiveCursor",o.MoveCursor="MoveCursor",o.CommandEditor="CommandEditor",o.SetEditorData="SetEditorData",o.SetFontStyle="SetFontStyle",o.SetPoint="SetPoint",o.SetLock="SetLock",o.SetShapeOpt="SetShapeOpt",o))(x||{}),$=(o=>(o.DisplayState="DisplayState",o.FloatBar="FloatBar",o.CanvasSelector="CanvasSelector",o.MainEngine="MainEngine",o.DisplayContainer="DisplayContainer",o.Cursor="Cursor",o.TextEditor="TextEditor",o.BindMainView="BindMainView",o.MountMainView="MountMainView",o.MountAppView="MountAppView",o))($||{}),io=(o=>(o[o.MainView=0]="MainView",o[o.Plugin=1]="Plugin",o[o.Both=2]="Both",o))(io||{}),N=(o=>(o[o.Pencil=1]="Pencil",o[o.Eraser=2]="Eraser",o[o.Selector=3]="Selector",o[o.Clicker=4]="Clicker",o[o.Arrow=5]="Arrow",o[o.Hand=6]="Hand",o[o.LaserPen=7]="LaserPen",o[o.Text=8]="Text",o[o.Straight=9]="Straight",o[o.Rectangle=10]="Rectangle",o[o.Ellipse=11]="Ellipse",o[o.Star=12]="Star",o[o.Triangle=13]="Triangle",o[o.Rhombus=14]="Rhombus",o[o.Polygon=15]="Polygon",o[o.SpeechBalloon=16]="SpeechBalloon",o[o.Image=17]="Image",o))(N||{}),G=(o=>(o[o.Local=1]="Local",o[o.Service=2]="Service",o[o.Worker=3]="Worker",o))(G||{}),C=(o=>(o[o.Pending=0]="Pending",o[o.Start=1]="Start",o[o.Doing=2]="Doing",o[o.Done=3]="Done",o[o.Freeze=4]="Freeze",o[o.Unwritable=5]="Unwritable",o))(C||{}),D=(o=>(o[o.None=0]="None",o[o.Init=1]="Init",o[o.UpdateCamera=2]="UpdateCamera",o[o.UpdateTools=3]="UpdateTools",o[o.CreateWork=4]="CreateWork",o[o.DrawWork=5]="DrawWork",o[o.FullWork=6]="FullWork",o[o.UpdateNode=7]="UpdateNode",o[o.RemoveNode=8]="RemoveNode",o[o.Clear=9]="Clear",o[o.Select=10]="Select",o[o.Destroy=11]="Destroy",o[o.Snapshot=12]="Snapshot",o[o.BoundingBox=13]="BoundingBox",o[o.Cursor=14]="Cursor",o[o.TextUpdate=15]="TextUpdate",o[o.GetTextActive=16]="GetTextActive",o[o.TasksQueue=17]="TasksQueue",o[o.CursorHover=18]="CursorHover",o))(D||{}),Nt=(o=>(o.Webgl2="webgl2",o.Webgl="webgl",o.Canvas2d="2d",o))(Nt||{}),De=(o=>(o[o.None=0]="None",o[o.Bg=1]="Bg",o[o.ServiceFloat=2]="ServiceFloat",o[o.Float=3]="Float",o[o.TopFloat=4]="TopFloat",o))(De||{}),Qe=(o=>(o[o.Cursor=1]="Cursor",o[o.TextCreate=2]="TextCreate",o))(Qe||{}),Fe=(o=>(o[o.Top=1]="Top",o[o.Bottom=2]="Bottom",o))(Fe||{}),ge=(o=>(o[o.none=1]="none",o[o.all=2]="all",o[o.both=3]="both",o[o.proportional=4]="proportional",o))(ge||{});const Go={linear:o=>o,easeInQuad:o=>o*o,easeOutQuad:o=>o*(2-o),easeInOutQuad:o=>o<.5?2*o*o:-1+(4-2*o)*o,easeInCubic:o=>o*o*o,easeOutCubic:o=>--o*o*o+1,easeInOutCubic:o=>o<.5?4*o*o*o:(o-1)*(2*o-2)*(2*o-2)+1,easeInQuart:o=>o*o*o*o,easeOutQuart:o=>1- --o*o*o*o,easeInOutQuart:o=>o<.5?8*o*o*o*o:1-8*--o*o*o*o,easeInQuint:o=>o*o*o*o*o,easeOutQuint:o=>1+--o*o*o*o*o,easeInOutQuint:o=>o<.5?16*o*o*o*o*o:1+16*--o*o*o*o*o,easeInSine:o=>1-Math.cos(o*Math.PI/2),easeOutSine:o=>Math.sin(o*Math.PI/2),easeInOutSine:o=>-(Math.cos(Math.PI*o)-1)/2,easeInExpo:o=>o<=0?0:Math.pow(2,10*o-10),easeOutExpo:o=>o>=1?1:1-Math.pow(2,-10*o),easeInOutExpo:o=>o<=0?0:o>=1?1:o<.5?Math.pow(2,20*o-10)/2:(2-Math.pow(2,-20*o+10))/2};class S{constructor(t=0,e=0,i=1){this.x=t,this.y=e,this.z=i}get XY(){return[this.x,this.y]}setz(t){return this.z=t,this}setXY(t=this.x,e=this.y){return this.x=t,this.y=e,this}set(t=this.x,e=this.y,i=this.z){return this.x=t,this.y=e,this.z=i,this}setTo({x:t=0,y:e=0,z:i=1}){return this.x=t,this.y=e,this.z=i,this}rot(t){if(t===0)return this;const{x:e,y:i}=this,n=Math.sin(t),s=Math.cos(t);return this.x=e*s-i*n,this.y=e*n+i*s,this}rotWith(t,e){if(e===0)return this;const i=this.x-t.x,n=this.y-t.y,s=Math.sin(e),r=Math.cos(e);return this.x=t.x+(i*r-n*s),this.y=t.y+(i*s+n*r),this}clone(){const{x:t,y:e,z:i}=this;return new S(t,e,i)}sub(t){return this.x-=t.x,this.y-=t.y,this}subXY(t,e){return this.x-=t,this.y-=e,this}subScalar(t){return this.x-=t,this.y-=t,this}add(t){return this.x+=t.x,this.y+=t.y,this}addXY(t,e){return this.x+=t,this.y+=e,this}addScalar(t){return this.x+=t,this.y+=t,this}clamp(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),e!==void 0&&(this.x=Math.min(this.x,e),this.y=Math.min(this.y,e)),this}div(t){return this.x/=t,this.y/=t,this}divV(t){return this.x/=t.x,this.y/=t.y,this}mul(t){return this.x*=t,this.y*=t,this}mulV(t){return this.x*=t.x,this.y*=t.y,this}abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this}nudge(t,e){const i=S.Tan(t,this);return this.add(i.mul(e))}neg(){return this.x*=-1,this.y*=-1,this}cross(t){return this.x=this.y*t.z-this.z*t.y,this.y=this.z*t.x-this.x*t.z,this}dpr(t){return S.Dpr(this,t)}cpr(t){return S.Cpr(this,t)}len2(){return S.Len2(this)}len(){return S.Len(this)}pry(t){return S.Pry(this,t)}per(){const{x:t,y:e}=this;return this.x=e,this.y=-t,this}uni(){return S.Uni(this)}tan(t){return S.Tan(this,t)}dist(t){return S.Dist(this,t)}distanceToLineSegment(t,e){return S.DistanceToLineSegment(t,e,this)}slope(t){return S.Slope(this,t)}snapToGrid(t){return this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this}angle(t){return S.Angle(this,t)}toAngle(){return S.ToAngle(this)}lrp(t,e){return this.x=this.x+(t.x-this.x)*e,this.y=this.y+(t.y-this.y)*e,this}equals(t,e){return S.Equals(this,t,e)}equalsXY(t,e){return S.EqualsXY(this,t,e)}norm(){const t=this.len();return this.x=t===0?0:this.x/t,this.y=t===0?0:this.y/t,this}toFixed(){return S.ToFixed(this)}toString(){return S.ToString(S.ToFixed(this))}toJson(){return S.ToJson(this)}toArray(){return S.ToArray(this)}static Add(t,e){return new S(t.x+e.x,t.y+e.y)}static AddXY(t,e,i){return new S(t.x+e,t.y+i)}static Sub(t,e){return new S(t.x-e.x,t.y-e.y)}static SubXY(t,e,i){return new S(t.x-e,t.y-i)}static AddScalar(t,e){return new S(t.x+e,t.y+e)}static SubScalar(t,e){return new S(t.x-e,t.y-e)}static Div(t,e){return new S(t.x/e,t.y/e)}static Mul(t,e){return new S(t.x*e,t.y*e)}static DivV(t,e){return new S(t.x/e.x,t.y/e.y)}static MulV(t,e){return new S(t.x*e.x,t.y*e.y)}static Neg(t){return new S(-t.x,-t.y)}static Per(t){return new S(t.y,-t.x)}static Dist2(t,e){return S.Sub(t,e).len2()}static Abs(t){return new S(Math.abs(t.x),Math.abs(t.y))}static Dist(t,e){return Math.hypot(t.y-e.y,t.x-e.x)}static Dpr(t,e){return t.x*e.x+t.y*e.y}static Cross(t,e){return new S(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z)}static Cpr(t,e){return t.x*e.y-e.x*t.y}static Len2(t){return t.x*t.x+t.y*t.y}static Len(t){return Math.hypot(t.x,t.y)}static Pry(t,e){return S.Dpr(t,e)/S.Len(e)}static Uni(t){return S.Div(t,S.Len(t))}static Tan(t,e){return S.Uni(S.Sub(t,e))}static Min(t,e){return new S(Math.min(t.x,e.x),Math.min(t.y,e.y))}static Max(t,e){return new S(Math.max(t.x,e.x),Math.max(t.y,e.y))}static From(t){return new S().add(t)}static FromArray(t){return new S(t[0],t[1])}static Rot(t,e=0){const i=Math.sin(e),n=Math.cos(e);return new S(t.x*n-t.y*i,t.x*i+t.y*n)}static RotWith(t,e,i){const n=t.x-e.x,s=t.y-e.y,r=Math.sin(i),a=Math.cos(i);return new S(e.x+(n*a-s*r),e.y+(n*r+s*a))}static NearestPointOnLineThroughPoint(t,e,i){return S.Mul(e,S.Sub(i,t).pry(e)).add(t)}static NearestPointOnLineSegment(t,e,i,n=!0){const s=S.Tan(e,t),r=S.Add(t,S.Mul(s,S.Sub(i,t).pry(s)));if(n){if(r.x<Math.min(t.x,e.x))return S.Cast(t.x<e.x?t:e);if(r.x>Math.max(t.x,e.x))return S.Cast(t.x>e.x?t:e);if(r.y<Math.min(t.y,e.y))return S.Cast(t.y<e.y?t:e);if(r.y>Math.max(t.y,e.y))return S.Cast(t.y>e.y?t:e)}return r}static DistanceToLineThroughPoint(t,e,i){return S.Dist(i,S.NearestPointOnLineThroughPoint(t,e,i))}static DistanceToLineSegment(t,e,i,n=!0){return S.Dist(i,S.NearestPointOnLineSegment(t,e,i,n))}static Snap(t,e=1){return new S(Math.round(t.x/e)*e,Math.round(t.y/e)*e)}static Cast(t){return t instanceof S?t:S.From(t)}static Slope(t,e){return t.x===e.y?NaN:(t.y-e.y)/(t.x-e.x)}static Angle(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}static Lrp(t,e,i){return S.Sub(e,t).mul(i).add(t)}static Med(t,e){return new S((t.x+e.x)/2,(t.y+e.y)/2)}static Equals(t,e,i=1e-4){return Math.abs(t.x-e.x)<i&&Math.abs(t.y-e.y)<i}static EqualsXY(t,e,i){return t.x===e&&t.y===i}static EqualsXYZ(t,e,i=1e-4){return S.Equals(t,e,i)&&Math.abs((t.z||0)-(e.z||0))<i}static Clockwise(t,e,i){return(i.x-t.x)*(e.y-t.y)-(e.x-t.x)*(i.y-t.y)<0}static Rescale(t,e){const i=S.Len(t);return new S(e*t.x/i,e*t.y/i)}static ScaleWithOrigin(t,e,i){return S.Sub(t,i).mul(e).add(i)}static ScaleWOrigin(t,e,i){return S.Sub(t,i).mulV(e).add(i)}static ToFixed(t,e=2){return new S(+t.x.toFixed(e),+t.y.toFixed(e),+t.z.toFixed(e))}static Nudge(t,e,i){return S.Add(t,S.Tan(e,t).mul(i))}static ToString(t){return`${t.x}, ${t.y}`}static ToAngle(t){let e=Math.atan2(t.y,t.x);return e<0&&(e+=Math.PI*2),e}static FromAngle(t,e=1){return new S(Math.cos(t)*e,Math.sin(t)*e)}static ToArray(t){return[t.x,t.y,t.z]}static ToJson(t){const{x:e,y:i,z:n}=t;return{x:e,y:i,z:n}}static Average(t){const e=t.length,i=new S(0,0);for(let n=0;n<e;n++)i.add(t[n]);return i.div(e)}static Clamp(t,e,i){return i===void 0?new S(Math.min(Math.max(t.x,e)),Math.min(Math.max(t.y,e))):new S(Math.min(Math.max(t.x,e),i),Math.min(Math.max(t.y,e),i))}static PointsBetween(t,e,i=6){const n=[];for(let s=0;s<i;s++){const r=Go.easeInQuad(s/(i-1)),a=S.Lrp(t,e,r);a.z=Math.min(1,.5+Math.abs(.5-Jo(r))*.65),n.push(a)}return n}static SnapToGrid(t,e=8){return new S(Math.round(t.x/e)*e,Math.round(t.y/e)*e)}}const Jo=o=>o<.5?2*o*o:-1+(4-2*o)*o;class ie extends S{constructor(t=0,e=0,i=0,n={x:0,y:0},s=0,r=0){super(t,e,i),this.x=t,this.y=e,this.z=i,this.v=n,this.t=s,this.a=r}get timestamp(){return this.t}get pressure(){return this.z}get angleNum(){return this.a}get XY(){return[this.x,this.y]}setA(t){this.a=t}setT(t){this.t=t}setv(t){return this.v={x:t.x,y:t.y},this}set(t=this.x,e=this.y,i=this.z,n=this.v,s=this.t,r=this.a){return this.x=t,this.y=e,this.z=i,this.v=n,this.t=s,this.a=r,this}clone(){const{x:t,y:e,z:i,v:n,t:s,a:r}=this,a={x:n.x,y:n.y};return new ie(t,e,i,a,s,r)}distance(t){return ie.GetDistance(this,t)}isNear(t,e){return ie.IsNear(this,t,e)}getAngleByPoints(t,e){return ie.GetAngleByPoints(t,this,e)}static Sub(t,e){return new ie(t.x-e.x,t.y-e.y)}static Add(t,e){return new ie(t.x+e.x,t.y+e.y)}static GetDistance(t,e){return ie.Len(t.clone().sub(e))}static GetAngleByPoints(t,e,i){const n=e.x-t.x,s=i.x-e.x,r=e.y-t.y,a=i.y-e.y;let c=0;const l=Math.sqrt(n*n+r*r),u=Math.sqrt(s*s+a*a);if(l&&u){const M=n*s+r*a;c=Math.acos(M/(l*u)),c=c/Math.PI*180;let d=n*a-r*s;d=d>0?1:-1,c=180+d*c}return c}static IsNear(t,e,i){return ie.Len(t.clone().sub(e))<i}static RotWith(t,e,i,n=2){const s=t.x-e.x,r=t.y-e.y,a=Math.sin(i),c=Math.cos(i),l=Math.pow(10,n),u=Math.floor((e.x+(s*c-r*a))*l)/l,M=Math.floor((e.y+(s*a+r*c))*l)/l;return new ie(u,M)}static GetDotStroke(t,e,i=16){const n=new S(1,1),s=Math.PI+.001,r=ie.Add(t,ie.Sub(t,n).uni().per().mul(-e)),a=[];for(let c=1/i,l=c;l<=1;l+=c)a.push(ie.RotWith(r,t,s*2*l));return a}static GetSemicircleStroke(t,e,i=-1,n=8){const s=i*(Math.PI+.001),r=[];for(let a=1/n,c=a;c<=1;c+=a)r.push(ie.RotWith(e,t,s*c));return r}}var at=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function He(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ko=typeof at=="object"&&at&&at.Object===Object&&at,oo=Ko,qo=oo,_o=typeof self=="object"&&self&&self.Object===Object&&self,Xo=qo||_o||Function("return this")(),xe=Xo,en=xe,tn=en.Symbol,mt=tn,ui=mt,no=Object.prototype,on=no.hasOwnProperty,nn=no.toString,ot=ui?ui.toStringTag:void 0;function sn(o){var t=on.call(o,ot),e=o[ot];try{o[ot]=void 0;var i=!0}catch{}var n=nn.call(o);return i&&(t?o[ot]=e:delete o[ot]),n}var rn=sn,an=Object.prototype,cn=an.toString;function ln(o){return cn.call(o)}var hn=ln,di=mt,un=rn,dn=hn,gn="[object Null]",Mn="[object Undefined]",gi=di?di.toStringTag:void 0;function pn(o){return o==null?o===void 0?Mn:gn:gi&&gi in Object(o)?un(o):dn(o)}var Ze=pn;function fn(o){return o!=null&&typeof o=="object"}var Oe=fn,yn=Ze,In=Oe,vn="[object Number]";function wn(o){return typeof o=="number"||In(o)&&yn(o)==vn}var Nn=wn;const ae=He(Nn);function mn(){this.__data__=[],this.size=0}var Tn=mn;function zn(o,t){return o===t||o!==o&&t!==t}var Jt=zn,Cn=Jt;function jn(o,t){for(var e=o.length;e--;)if(Cn(o[e][0],t))return e;return-1}var Tt=jn,Sn=Tt,xn=Array.prototype,Dn=xn.splice;function Ln(o){var t=this.__data__,e=Sn(t,o);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():Dn.call(t,e,1),--this.size,!0}var kn=Ln,An=Tt;function bn(o){var t=this.__data__,e=An(t,o);return e<0?void 0:t[e][1]}var En=bn,On=Tt;function Yn(o){return On(this.__data__,o)>-1}var Pn=Yn,Rn=Tt;function Wn(o,t){var e=this.__data__,i=Rn(e,o);return i<0?(++this.size,e.push([o,t])):e[i][1]=t,this}var Un=Wn,$n=Tn,Bn=kn,Fn=En,Qn=Pn,Hn=Un;function _e(o){var t=-1,e=o==null?0:o.length;for(this.clear();++t<e;){var i=o[t];this.set(i[0],i[1])}}_e.prototype.clear=$n;_e.prototype.delete=Bn;_e.prototype.get=Fn;_e.prototype.has=Qn;_e.prototype.set=Hn;var zt=_e,Zn=zt;function Vn(){this.__data__=new Zn,this.size=0}var Gn=Vn;function Jn(o){var t=this.__data__,e=t.delete(o);return this.size=t.size,e}var Kn=Jn;function qn(o){return this.__data__.get(o)}var _n=qn;function Xn(o){return this.__data__.has(o)}var es=Xn;function ts(o){var t=typeof o;return o!=null&&(t=="object"||t=="function")}var Re=ts,is=Ze,os=Re,ns="[object AsyncFunction]",ss="[object Function]",rs="[object GeneratorFunction]",as="[object Proxy]";function cs(o){if(!os(o))return!1;var t=is(o);return t==ss||t==rs||t==ns||t==as}var so=cs,ls=xe,hs=ls["__core-js_shared__"],us=hs,kt=us,Mi=function(){var o=/[^.]+$/.exec(kt&&kt.keys&&kt.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}();function ds(o){return!!Mi&&Mi in o}var gs=ds,Ms=Function.prototype,ps=Ms.toString;function fs(o){if(o!=null){try{return ps.call(o)}catch{}try{return o+""}catch{}}return""}var ro=fs,ys=so,Is=gs,vs=Re,ws=ro,Ns=/[\\^$.*+?()[\]{}|]/g,ms=/^\[object .+?Constructor\]$/,Ts=Function.prototype,zs=Object.prototype,Cs=Ts.toString,js=zs.hasOwnProperty,Ss=RegExp("^"+Cs.call(js).replace(Ns,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xs(o){if(!vs(o)||Is(o))return!1;var t=ys(o)?Ss:ms;return t.test(ws(o))}var Ds=xs;function Ls(o,t){return o==null?void 0:o[t]}var ks=Ls,As=Ds,bs=ks;function Es(o,t){var e=bs(o,t);return As(e)?e:void 0}var Ve=Es,Os=Ve,Ys=xe,Ps=Os(Ys,"Map"),Kt=Ps,Rs=Ve,Ws=Rs(Object,"create"),Ct=Ws,pi=Ct;function Us(){this.__data__=pi?pi(null):{},this.size=0}var $s=Us;function Bs(o){var t=this.has(o)&&delete this.__data__[o];return this.size-=t?1:0,t}var Fs=Bs,Qs=Ct,Hs="__lodash_hash_undefined__",Zs=Object.prototype,Vs=Zs.hasOwnProperty;function Gs(o){var t=this.__data__;if(Qs){var e=t[o];return e===Hs?void 0:e}return Vs.call(t,o)?t[o]:void 0}var Js=Gs,Ks=Ct,qs=Object.prototype,_s=qs.hasOwnProperty;function Xs(o){var t=this.__data__;return Ks?t[o]!==void 0:_s.call(t,o)}var er=Xs,tr=Ct,ir="__lodash_hash_undefined__";function or(o,t){var e=this.__data__;return this.size+=this.has(o)?0:1,e[o]=tr&&t===void 0?ir:t,this}var nr=or,sr=$s,rr=Fs,ar=Js,cr=er,lr=nr;function Xe(o){var t=-1,e=o==null?0:o.length;for(this.clear();++t<e;){var i=o[t];this.set(i[0],i[1])}}Xe.prototype.clear=sr;Xe.prototype.delete=rr;Xe.prototype.get=ar;Xe.prototype.has=cr;Xe.prototype.set=lr;var hr=Xe,fi=hr,ur=zt,dr=Kt;function gr(){this.size=0,this.__data__={hash:new fi,map:new(dr||ur),string:new fi}}var Mr=gr;function pr(o){var t=typeof o;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?o!=="__proto__":o===null}var fr=pr,yr=fr;function Ir(o,t){var e=o.__data__;return yr(t)?e[typeof t=="string"?"string":"hash"]:e.map}var jt=Ir,vr=jt;function wr(o){var t=vr(this,o).delete(o);return this.size-=t?1:0,t}var Nr=wr,mr=jt;function Tr(o){return mr(this,o).get(o)}var zr=Tr,Cr=jt;function jr(o){return Cr(this,o).has(o)}var Sr=jr,xr=jt;function Dr(o,t){var e=xr(this,o),i=e.size;return e.set(o,t),this.size+=e.size==i?0:1,this}var Lr=Dr,kr=Mr,Ar=Nr,br=zr,Er=Sr,Or=Lr;function et(o){var t=-1,e=o==null?0:o.length;for(this.clear();++t<e;){var i=o[t];this.set(i[0],i[1])}}et.prototype.clear=kr;et.prototype.delete=Ar;et.prototype.get=br;et.prototype.has=Er;et.prototype.set=Or;var ao=et,Yr=zt,Pr=Kt,Rr=ao,Wr=200;function Ur(o,t){var e=this.__data__;if(e instanceof Yr){var i=e.__data__;if(!Pr||i.length<Wr-1)return i.push([o,t]),this.size=++e.size,this;e=this.__data__=new Rr(i)}return e.set(o,t),this.size=e.size,this}var $r=Ur,Br=zt,Fr=Gn,Qr=Kn,Hr=_n,Zr=es,Vr=$r;function tt(o){var t=this.__data__=new Br(o);this.size=t.size}tt.prototype.clear=Fr;tt.prototype.delete=Qr;tt.prototype.get=Hr;tt.prototype.has=Zr;tt.prototype.set=Vr;var co=tt;function Gr(o,t){for(var e=-1,i=o==null?0:o.length;++e<i&&t(o[e],e,o)!==!1;);return o}var Jr=Gr,Kr=Ve,qr=function(){try{var o=Kr(Object,"defineProperty");return o({},"",{}),o}catch{}}(),_r=qr,yi=_r;function Xr(o,t,e){t=="__proto__"&&yi?yi(o,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):o[t]=e}var lo=Xr,ea=lo,ta=Jt,ia=Object.prototype,oa=ia.hasOwnProperty;function na(o,t,e){var i=o[t];(!(oa.call(o,t)&&ta(i,e))||e===void 0&&!(t in o))&&ea(o,t,e)}var ho=na,sa=ho,ra=lo;function aa(o,t,e,i){var n=!e;e||(e={});for(var s=-1,r=t.length;++s<r;){var a=t[s],c=i?i(e[a],o[a],a,e,o):void 0;c===void 0&&(c=o[a]),n?ra(e,a,c):sa(e,a,c)}return e}var St=aa;function ca(o,t){for(var e=-1,i=Array(o);++e<o;)i[e]=t(e);return i}var la=ca,ha=Ze,ua=Oe,da="[object Arguments]";function ga(o){return ua(o)&&ha(o)==da}var Ma=ga,Ii=Ma,pa=Oe,uo=Object.prototype,fa=uo.hasOwnProperty,ya=uo.propertyIsEnumerable,Ia=Ii(function(){return arguments}())?Ii:function(o){return pa(o)&&fa.call(o,"callee")&&!ya.call(o,"callee")},va=Ia,wa=Array.isArray,xt=wa,pt={exports:{}};function Na(){return!1}var ma=Na;pt.exports;(function(o,t){var e=xe,i=ma,n=t&&!t.nodeType&&t,s=n&&!0&&o&&!o.nodeType&&o,r=s&&s.exports===n,a=r?e.Buffer:void 0,c=a?a.isBuffer:void 0,l=c||i;o.exports=l})(pt,pt.exports);var qt=pt.exports,Ta=9007199254740991,za=/^(?:0|[1-9]\d*)$/;function Ca(o,t){var e=typeof o;return t=t??Ta,!!t&&(e=="number"||e!="symbol"&&za.test(o))&&o>-1&&o%1==0&&o<t}var ja=Ca,Sa=9007199254740991;function xa(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Sa}var go=xa,Da=Ze,La=go,ka=Oe,Aa="[object Arguments]",ba="[object Array]",Ea="[object Boolean]",Oa="[object Date]",Ya="[object Error]",Pa="[object Function]",Ra="[object Map]",Wa="[object Number]",Ua="[object Object]",$a="[object RegExp]",Ba="[object Set]",Fa="[object String]",Qa="[object WeakMap]",Ha="[object ArrayBuffer]",Za="[object DataView]",Va="[object Float32Array]",Ga="[object Float64Array]",Ja="[object Int8Array]",Ka="[object Int16Array]",qa="[object Int32Array]",_a="[object Uint8Array]",Xa="[object Uint8ClampedArray]",ec="[object Uint16Array]",tc="[object Uint32Array]",te={};te[Va]=te[Ga]=te[Ja]=te[Ka]=te[qa]=te[_a]=te[Xa]=te[ec]=te[tc]=!0;te[Aa]=te[ba]=te[Ha]=te[Ea]=te[Za]=te[Oa]=te[Ya]=te[Pa]=te[Ra]=te[Wa]=te[Ua]=te[$a]=te[Ba]=te[Fa]=te[Qa]=!1;function ic(o){return ka(o)&&La(o.length)&&!!te[Da(o)]}var oc=ic;function nc(o){return function(t){return o(t)}}var _t=nc,ft={exports:{}};ft.exports;(function(o,t){var e=oo,i=t&&!t.nodeType&&t,n=i&&!0&&o&&!o.nodeType&&o,s=n&&n.exports===i,r=s&&e.process,a=function(){try{var c=n&&n.require&&n.require("util").types;return c||r&&r.binding&&r.binding("util")}catch{}}();o.exports=a})(ft,ft.exports);var Xt=ft.exports,sc=oc,rc=_t,vi=Xt,wi=vi&&vi.isTypedArray,ac=wi?rc(wi):sc,Mo=ac,cc=la,lc=va,hc=xt,uc=qt,dc=ja,gc=Mo,Mc=Object.prototype,pc=Mc.hasOwnProperty;function fc(o,t){var e=hc(o),i=!e&&lc(o),n=!e&&!i&&uc(o),s=!e&&!i&&!n&&gc(o),r=e||i||n||s,a=r?cc(o.length,String):[],c=a.length;for(var l in o)(t||pc.call(o,l))&&!(r&&(l=="length"||n&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||dc(l,c)))&&a.push(l);return a}var po=fc,yc=Object.prototype;function Ic(o){var t=o&&o.constructor,e=typeof t=="function"&&t.prototype||yc;return o===e}var ei=Ic;function vc(o,t){return function(e){return o(t(e))}}var fo=vc,wc=fo,Nc=wc(Object.keys,Object),mc=Nc,Tc=ei,zc=mc,Cc=Object.prototype,jc=Cc.hasOwnProperty;function Sc(o){if(!Tc(o))return zc(o);var t=[];for(var e in Object(o))jc.call(o,e)&&e!="constructor"&&t.push(e);return t}var xc=Sc,Dc=so,Lc=go;function kc(o){return o!=null&&Lc(o.length)&&!Dc(o)}var yo=kc,Ac=po,bc=xc,Ec=yo;function Oc(o){return Ec(o)?Ac(o):bc(o)}var ti=Oc,Yc=St,Pc=ti;function Rc(o,t){return o&&Yc(t,Pc(t),o)}var Wc=Rc;function Uc(o){var t=[];if(o!=null)for(var e in Object(o))t.push(e);return t}var $c=Uc,Bc=Re,Fc=ei,Qc=$c,Hc=Object.prototype,Zc=Hc.hasOwnProperty;function Vc(o){if(!Bc(o))return Qc(o);var t=Fc(o),e=[];for(var i in o)i=="constructor"&&(t||!Zc.call(o,i))||e.push(i);return e}var Gc=Vc,Jc=po,Kc=Gc,qc=yo;function _c(o){return qc(o)?Jc(o,!0):Kc(o)}var ii=_c,Xc=St,el=ii;function tl(o,t){return o&&Xc(t,el(t),o)}var il=tl,yt={exports:{}};yt.exports;(function(o,t){var e=xe,i=t&&!t.nodeType&&t,n=i&&!0&&o&&!o.nodeType&&o,s=n&&n.exports===i,r=s?e.Buffer:void 0,a=r?r.allocUnsafe:void 0;function c(l,u){if(u)return l.slice();var M=l.length,d=a?a(M):new l.constructor(M);return l.copy(d),d}o.exports=c})(yt,yt.exports);var ol=yt.exports;function nl(o,t){var e=-1,i=o.length;for(t||(t=Array(i));++e<i;)t[e]=o[e];return t}var sl=nl;function rl(o,t){for(var e=-1,i=o==null?0:o.length,n=0,s=[];++e<i;){var r=o[e];t(r,e,o)&&(s[n++]=r)}return s}var al=rl;function cl(){return[]}var Io=cl,ll=al,hl=Io,ul=Object.prototype,dl=ul.propertyIsEnumerable,Ni=Object.getOwnPropertySymbols,gl=Ni?function(o){return o==null?[]:(o=Object(o),ll(Ni(o),function(t){return dl.call(o,t)}))}:hl,oi=gl,Ml=St,pl=oi;function fl(o,t){return Ml(o,pl(o),t)}var yl=fl;function Il(o,t){for(var e=-1,i=t.length,n=o.length;++e<i;)o[n+e]=t[e];return o}var vo=Il,vl=fo,wl=vl(Object.getPrototypeOf,Object),wo=wl,Nl=vo,ml=wo,Tl=oi,zl=Io,Cl=Object.getOwnPropertySymbols,jl=Cl?function(o){for(var t=[];o;)Nl(t,Tl(o)),o=ml(o);return t}:zl,No=jl,Sl=St,xl=No;function Dl(o,t){return Sl(o,xl(o),t)}var Ll=Dl,kl=vo,Al=xt;function bl(o,t,e){var i=t(o);return Al(o)?i:kl(i,e(o))}var mo=bl,El=mo,Ol=oi,Yl=ti;function Pl(o){return El(o,Yl,Ol)}var To=Pl,Rl=mo,Wl=No,Ul=ii;function $l(o){return Rl(o,Ul,Wl)}var Bl=$l,Fl=Ve,Ql=xe,Hl=Fl(Ql,"DataView"),Zl=Hl,Vl=Ve,Gl=xe,Jl=Vl(Gl,"Promise"),Kl=Jl,ql=Ve,_l=xe,Xl=ql(_l,"Set"),eh=Xl,th=Ve,ih=xe,oh=th(ih,"WeakMap"),nh=oh,Yt=Zl,Pt=Kt,Rt=Kl,Wt=eh,Ut=nh,zo=Ze,it=ro,mi="[object Map]",sh="[object Object]",Ti="[object Promise]",zi="[object Set]",Ci="[object WeakMap]",ji="[object DataView]",rh=it(Yt),ah=it(Pt),ch=it(Rt),lh=it(Wt),hh=it(Ut),We=zo;(Yt&&We(new Yt(new ArrayBuffer(1)))!=ji||Pt&&We(new Pt)!=mi||Rt&&We(Rt.resolve())!=Ti||Wt&&We(new Wt)!=zi||Ut&&We(new Ut)!=Ci)&&(We=function(o){var t=zo(o),e=t==sh?o.constructor:void 0,i=e?it(e):"";if(i)switch(i){case rh:return ji;case ah:return mi;case ch:return Ti;case lh:return zi;case hh:return Ci}return t});var Dt=We,uh=Object.prototype,dh=uh.hasOwnProperty;function gh(o){var t=o.length,e=new o.constructor(t);return t&&typeof o[0]=="string"&&dh.call(o,"index")&&(e.index=o.index,e.input=o.input),e}var Mh=gh,ph=xe,fh=ph.Uint8Array,Co=fh,Si=Co;function yh(o){var t=new o.constructor(o.byteLength);return new Si(t).set(new Si(o)),t}var ni=yh,Ih=ni;function vh(o,t){var e=t?Ih(o.buffer):o.buffer;return new o.constructor(e,o.byteOffset,o.byteLength)}var wh=vh,Nh=/\w*$/;function mh(o){var t=new o.constructor(o.source,Nh.exec(o));return t.lastIndex=o.lastIndex,t}var Th=mh,xi=mt,Di=xi?xi.prototype:void 0,Li=Di?Di.valueOf:void 0;function zh(o){return Li?Object(Li.call(o)):{}}var Ch=zh,jh=ni;function Sh(o,t){var e=t?jh(o.buffer):o.buffer;return new o.constructor(e,o.byteOffset,o.length)}var xh=Sh,Dh=ni,Lh=wh,kh=Th,Ah=Ch,bh=xh,Eh="[object Boolean]",Oh="[object Date]",Yh="[object Map]",Ph="[object Number]",Rh="[object RegExp]",Wh="[object Set]",Uh="[object String]",$h="[object Symbol]",Bh="[object ArrayBuffer]",Fh="[object DataView]",Qh="[object Float32Array]",Hh="[object Float64Array]",Zh="[object Int8Array]",Vh="[object Int16Array]",Gh="[object Int32Array]",Jh="[object Uint8Array]",Kh="[object Uint8ClampedArray]",qh="[object Uint16Array]",_h="[object Uint32Array]";function Xh(o,t,e){var i=o.constructor;switch(t){case Bh:return Dh(o);case Eh:case Oh:return new i(+o);case Fh:return Lh(o,e);case Qh:case Hh:case Zh:case Vh:case Gh:case Jh:case Kh:case qh:case _h:return bh(o,e);case Yh:return new i;case Ph:case Uh:return new i(o);case Rh:return kh(o);case Wh:return new i;case $h:return Ah(o)}}var eu=Xh,tu=Re,ki=Object.create,iu=function(){function o(){}return function(t){if(!tu(t))return{};if(ki)return ki(t);o.prototype=t;var e=new o;return o.prototype=void 0,e}}(),ou=iu,nu=ou,su=wo,ru=ei;function au(o){return typeof o.constructor=="function"&&!ru(o)?nu(su(o)):{}}var cu=au,lu=Dt,hu=Oe,uu="[object Map]";function du(o){return hu(o)&&lu(o)==uu}var gu=du,Mu=gu,pu=_t,Ai=Xt,bi=Ai&&Ai.isMap,fu=bi?pu(bi):Mu,yu=fu,Iu=Dt,vu=Oe,wu="[object Set]";function Nu(o){return vu(o)&&Iu(o)==wu}var mu=Nu,Tu=mu,zu=_t,Ei=Xt,Oi=Ei&&Ei.isSet,Cu=Oi?zu(Oi):Tu,ju=Cu,Su=co,xu=Jr,Du=ho,Lu=Wc,ku=il,Au=ol,bu=sl,Eu=yl,Ou=Ll,Yu=To,Pu=Bl,Ru=Dt,Wu=Mh,Uu=eu,$u=cu,Bu=xt,Fu=qt,Qu=yu,Hu=Re,Zu=ju,Vu=ti,Gu=ii,Ju=1,Ku=2,qu=4,jo="[object Arguments]",_u="[object Array]",Xu="[object Boolean]",ed="[object Date]",td="[object Error]",So="[object Function]",id="[object GeneratorFunction]",od="[object Map]",nd="[object Number]",xo="[object Object]",sd="[object RegExp]",rd="[object Set]",ad="[object String]",cd="[object Symbol]",ld="[object WeakMap]",hd="[object ArrayBuffer]",ud="[object DataView]",dd="[object Float32Array]",gd="[object Float64Array]",Md="[object Int8Array]",pd="[object Int16Array]",fd="[object Int32Array]",yd="[object Uint8Array]",Id="[object Uint8ClampedArray]",vd="[object Uint16Array]",wd="[object Uint32Array]",ee={};ee[jo]=ee[_u]=ee[hd]=ee[ud]=ee[Xu]=ee[ed]=ee[dd]=ee[gd]=ee[Md]=ee[pd]=ee[fd]=ee[od]=ee[nd]=ee[xo]=ee[sd]=ee[rd]=ee[ad]=ee[cd]=ee[yd]=ee[Id]=ee[vd]=ee[wd]=!0;ee[td]=ee[So]=ee[ld]=!1;function gt(o,t,e,i,n,s){var r,a=t&Ju,c=t&Ku,l=t&qu;if(e&&(r=n?e(o,i,n,s):e(o)),r!==void 0)return r;if(!Hu(o))return o;var u=Bu(o);if(u){if(r=Wu(o),!a)return bu(o,r)}else{var M=Ru(o),d=M==So||M==id;if(Fu(o))return Au(o,a);if(M==xo||M==jo||d&&!n){if(r=c||d?{}:$u(o),!a)return c?Ou(o,ku(r,o)):Eu(o,Lu(r,o))}else{if(!ee[M])return n?o:{};r=Uu(o,M,a)}}s||(s=new Su);var g=s.get(o);if(g)return g;s.set(o,r),Zu(o)?o.forEach(function(p){r.add(gt(p,t,e,p,o,s))}):Qu(o)&&o.forEach(function(p,I){r.set(I,gt(p,t,e,I,o,s))});var v=l?c?Pu:Yu:c?Gu:Vu,y=u?void 0:v(o);return xu(y||o,function(p,I){y&&(I=p,p=o[I]),Du(r,I,gt(p,t,e,I,o,s))}),r}var Do=gt,Nd=Do,md=1,Td=4;function zd(o){return Nd(o,md|Td)}var Cd=zd;const re=He(Cd);function Lo(o){return JSON.parse(eo.decompress(o))}function ko(o){return eo.compress(JSON.stringify(o))}const ye=Object.keys,je="++",k="selector",Ao="all";var jd="__lodash_hash_undefined__";function Sd(o){return this.__data__.set(o,jd),this}var xd=Sd;function Dd(o){return this.__data__.has(o)}var Ld=Dd,kd=ao,Ad=xd,bd=Ld;function It(o){var t=-1,e=o==null?0:o.length;for(this.__data__=new kd;++t<e;)this.add(o[t])}It.prototype.add=It.prototype.push=Ad;It.prototype.has=bd;var Ed=It;function Od(o,t){for(var e=-1,i=o==null?0:o.length;++e<i;)if(t(o[e],e,o))return!0;return!1}var Yd=Od;function Pd(o,t){return o.has(t)}var Rd=Pd,Wd=Ed,Ud=Yd,$d=Rd,Bd=1,Fd=2;function Qd(o,t,e,i,n,s){var r=e&Bd,a=o.length,c=t.length;if(a!=c&&!(r&&c>a))return!1;var l=s.get(o),u=s.get(t);if(l&&u)return l==t&&u==o;var M=-1,d=!0,g=e&Fd?new Wd:void 0;for(s.set(o,t),s.set(t,o);++M<a;){var v=o[M],y=t[M];if(i)var p=r?i(y,v,M,t,o,s):i(v,y,M,o,t,s);if(p!==void 0){if(p)continue;d=!1;break}if(g){if(!Ud(t,function(I,w){if(!$d(g,w)&&(v===I||n(v,I,e,i,s)))return g.push(w)})){d=!1;break}}else if(!(v===y||n(v,y,e,i,s))){d=!1;break}}return s.delete(o),s.delete(t),d}var bo=Qd;function Hd(o){var t=-1,e=Array(o.size);return o.forEach(function(i,n){e[++t]=[n,i]}),e}var Zd=Hd;function Vd(o){var t=-1,e=Array(o.size);return o.forEach(function(i){e[++t]=i}),e}var Gd=Vd,Yi=mt,Pi=Co,Jd=Jt,Kd=bo,qd=Zd,_d=Gd,Xd=1,eg=2,tg="[object Boolean]",ig="[object Date]",og="[object Error]",ng="[object Map]",sg="[object Number]",rg="[object RegExp]",ag="[object Set]",cg="[object String]",lg="[object Symbol]",hg="[object ArrayBuffer]",ug="[object DataView]",Ri=Yi?Yi.prototype:void 0,At=Ri?Ri.valueOf:void 0;function dg(o,t,e,i,n,s,r){switch(e){case ug:if(o.byteLength!=t.byteLength||o.byteOffset!=t.byteOffset)return!1;o=o.buffer,t=t.buffer;case hg:return!(o.byteLength!=t.byteLength||!s(new Pi(o),new Pi(t)));case tg:case ig:case sg:return Jd(+o,+t);case og:return o.name==t.name&&o.message==t.message;case rg:case cg:return o==t+"";case ng:var a=qd;case ag:var c=i&Xd;if(a||(a=_d),o.size!=t.size&&!c)return!1;var l=r.get(o);if(l)return l==t;i|=eg,r.set(o,t);var u=Kd(a(o),a(t),i,n,s,r);return r.delete(o),u;case lg:if(At)return At.call(o)==At.call(t)}return!1}var gg=dg,Wi=To,Mg=1,pg=Object.prototype,fg=pg.hasOwnProperty;function yg(o,t,e,i,n,s){var r=e&Mg,a=Wi(o),c=a.length,l=Wi(t),u=l.length;if(c!=u&&!r)return!1;for(var M=c;M--;){var d=a[M];if(!(r?d in t:fg.call(t,d)))return!1}var g=s.get(o),v=s.get(t);if(g&&v)return g==t&&v==o;var y=!0;s.set(o,t),s.set(t,o);for(var p=r;++M<c;){d=a[M];var I=o[d],w=t[d];if(i)var m=r?i(w,I,d,t,o,s):i(I,w,d,o,t,s);if(!(m===void 0?I===w||n(I,w,e,i,s):m)){y=!1;break}p||(p=d=="constructor")}if(y&&!p){var T=o.constructor,z=t.constructor;T!=z&&"constructor"in o&&"constructor"in t&&!(typeof T=="function"&&T instanceof T&&typeof z=="function"&&z instanceof z)&&(y=!1)}return s.delete(o),s.delete(t),y}var Ig=yg,bt=co,vg=bo,wg=gg,Ng=Ig,Ui=Dt,$i=xt,Bi=qt,mg=Mo,Tg=1,Fi="[object Arguments]",Qi="[object Array]",ct="[object Object]",zg=Object.prototype,Hi=zg.hasOwnProperty;function Cg(o,t,e,i,n,s){var r=$i(o),a=$i(t),c=r?Qi:Ui(o),l=a?Qi:Ui(t);c=c==Fi?ct:c,l=l==Fi?ct:l;var u=c==ct,M=l==ct,d=c==l;if(d&&Bi(o)){if(!Bi(t))return!1;r=!0,u=!1}if(d&&!u)return s||(s=new bt),r||mg(o)?vg(o,t,e,i,n,s):wg(o,t,c,e,i,n,s);if(!(e&Tg)){var g=u&&Hi.call(o,"__wrapped__"),v=M&&Hi.call(t,"__wrapped__");if(g||v){var y=g?o.value():o,p=v?t.value():t;return s||(s=new bt),n(y,p,e,i,s)}}return d?(s||(s=new bt),Ng(o,t,e,i,n,s)):!1}var jg=Cg,Sg=jg,Zi=Oe;function Eo(o,t,e,i,n){return o===t?!0:o==null||t==null||!Zi(o)&&!Zi(t)?o!==o&&t!==t:Sg(o,t,e,i,Eo,n)}var xg=Eo,Dg=xg;function Lg(o,t){return Dg(o,t)}var kg=Lg;const ce=He(kg);var Ag=Ze,bg=Oe,Eg="[object Boolean]";function Og(o){return o===!0||o===!1||bg(o)&&Ag(o)==Eg}var Yg=Og;const we=He(Yg);function Pg(o,t){if(o&&t){const e=Math.min(o.x,t.x),i=Math.min(o.y,t.y),n=Math.max(o.x+o.w,t.x+t.w),s=Math.max(o.y+o.h,t.y+t.h),r=n-e,a=s-i;return{x:e,y:i,w:r,h:a}}return t||o}function Oo(o,t){if(o&&t){const e=Math.min(o.originX,t.originX),i=Math.min(o.originY,t.originY),n=Math.max(o.originX+o.width,t.originX+t.width),s=Math.max(o.originY+o.height,t.originY+t.height),r=n-e,a=s-i;return{originX:e,originY:i,width:r,height:a}}return t||o}function si(o,t=0){const e={x:0,y:0,w:0,h:0};let i=1/0,n=1/0,s=-1/0,r=-1/0;return o.forEach(a=>{const[c,l]=a.XY;i=Math.min(i,c-t),n=Math.min(n,l-t),s=Math.max(s,c+t),r=Math.max(r,l+t)}),e.x=i,e.y=n,e.w=s-i,e.h=r-n,e}function Rg(o,t){return!(o.x+o.w<t.x||o.x>t.x+t.w||o.y+o.h<t.y||o.y>t.y+t.h)}function Wg(o,t){return{x:o.x+t[0],y:o.y+t[1],w:o.w,h:o.h}}function Ug(o,t){const e=new S(o.x,o.y),i=new S(o.x+o.w,o.y),n=new S(o.x+o.w,o.y+o.h),s=new S(o.x,o.y+o.h),r=new S(o.x+o.w/2,o.y+o.h/2),a=Math.PI*t/180,c=S.RotWith(e,r,a),l=S.RotWith(i,r,a),u=S.RotWith(n,r,a),M=S.RotWith(s,r,a);return si([c,l,u,M])}function $g(o,t){const e=new S(o.x,o.y),i=new S(o.x+o.w,o.y),n=new S(o.x+o.w,o.y+o.h),s=new S(o.x,o.y+o.h),r=new S(o.x+o.w/2,o.y+o.h/2),a=new S(t[0],t[1]),c=S.ScaleWOrigin(e,a,r),l=S.ScaleWOrigin(i,a,r),u=S.ScaleWOrigin(n,a,r),M=S.ScaleWOrigin(s,a,r);return si([c,l,u,M])}function Bg(o,t,e){const i=new S(t[0],t[1]);for(let n=0;n<o.length;n+=3){const s=new S(o[n],o[n+1]),r=Math.PI*e/180,a=S.RotWith(s,i,r);o[n]=a.x,o[n+1]=a.y}}function Fg(o,t,e){const i=new S(t[0],t[1]);for(let n=0;n<o.length;n+=3){const s=new S(o[n],o[n+1]),r=new S(e[0],e[1]);if(n<o.length-3){const c=new S(o[n+3],o[n+4]),l=S.Tan(c,s).per().mul(o[n+2]).mulV(r).len();o[n+2]=l}else if(n===o.length-3){const c=new S(o[n-3],o[n-2]),l=S.Tan(s,c).per().mul(o[n+2]).mulV(r).len();o[n+2]=l}const a=S.ScaleWOrigin(s,r,i);o[n]=a.x,o[n+1]=a.y}}function Yo(o,t){return o[0]>=t.x&&o[0]<=t.x+t.w&&o[1]>=t.y&&o[1]<=t.y+t.h}function Qg(o,t){const e=o<=t?1:o/t,i=t<=o?1:t/o;return[e,i]}function Hg(o){return`${vt(o.x)},${vt(o.y)} `}function Zg(o,t){return`${vt((o.x+t.x)/2)},${vt((o.y+t.y)/2)} `}function vt(o){return+o.toFixed(4)}const qe=(o,t)=>new Promise(function(e){window.requestIdleCallback?requestIdleCallback(()=>{e(1)},{timeout:t}):setTimeout(()=>{e(2)},t)}).then(function(){o()},()=>{o()}),Pe=o=>{const t=(o==null?void 0:o.webkitBackingStorePixelRatio)||(o==null?void 0:o.mozBackingStorePixelRatio)||(o==null?void 0:o.msBackingStorePixelRatio)||(o==null?void 0:o.oBackingStorePixelRatio)||(o==null?void 0:o.backingStorePixelRatio)||1;return Math.max(1,(window.devicePixelRatio||1)/t)};class Po{constructor(t){f(this,"plugin");f(this,"uid");this.plugin=t,this.uid=t.displayer.uid}getNamespaceData(){var t;return K.toJS((t=this.plugin)==null?void 0:t.attributes[this.namespace])||{}}getUidFromKey(t){return t.split(je).length===2&&t.split(je)[0]||this.uid}isLocalId(t){return t.split(je).length===1}getLocalId(t){return t.split(je)[1]}isSelector(t){return this.getLocalId(t)===k}}const be=class be extends Po{constructor(e,i){super(e);f(this,"namespace");f(this,"serviceStorage",{});f(this,"storage",{});f(this,"stateDisposer");f(this,"asyncClockState",!1);be.syncInterval=(i||be.syncInterval)*.5,this.namespace=be.namespace,this.serviceStorage=this.getNamespaceData(),this.storage=re(this.serviceStorage)}getViewIdBySecenPath(e){const i=this.getNamespaceData();for(const[n,s]of Object.entries(i))for(const r of Object.keys(s))if(r===e)return n}getScenePathData(e){const i=this.getNamespaceData();for(const n of Object.values(i))for(const s of Object.keys(n))if(s===e)return re(n[s])}getStorageData(e,i){const n=this.getNamespaceData();return n[e]&&re(n[e][i])||void 0}hasSelector(e,i){const n=this.storage&&this.storage[e]&&this.storage[e][i];return!!(n&&Object.keys(n).find(s=>this.isOwn(s)&&this.getLocalId(s)===k))}addStorageStateListener(e){this.stateDisposer=K.autorun(async()=>{const i=this.getNamespaceData(),n=this.diffFun(this.serviceStorage,i);this.serviceStorage=i;for(const[s,r]of Object.entries(n))if(r&&r.newValue===void 0){const{viewId:a,scenePath:c}=r;a&&c&&this.storage[a]&&delete this.storage[a][c][s]}else if(r&&r.newValue){const{viewId:a,scenePath:c}=r;this.storage[a]||(this.storage[a]={}),this.storage[a][c]||(this.storage[a][c]={}),this.storage[a][c][s]=re(r.newValue)}Object.keys(n).length>0&&e(n)})}removeStorageStateListener(){this.stateDisposer&&this.stateDisposer()}diffFun(e,i){const n=ye(e),s=ye(i),r={};for(const a of n){if(ce(e[a],i[a]))continue;const c=this.diffFunByscenePath(e[a]||{},i[a]||{},a);Object.assign(r,c)}for(const a of s)if(!n.includes(a)){const c=this.diffFunByscenePath(e[a]||{},i[a]||{},a);Object.assign(r,c)}return r}diffFunByscenePath(e,i,n){const s=ye(e),r=ye(i),a={};for(const c of s){if(ce(e[c],i[c]))continue;const l=this.diffFunByKeys(e[c]||{},i[c]||{},c,n);Object.assign(a,l)}for(const c of r)if(!s.includes(c)){const l=this.diffFunByKeys(e[c]||{},i[c]||{},c,n);Object.assign(a,l)}return a}diffFunByKeys(e,i,n,s){const r=ye(e),a=ye(i),c={};for(const l of r){if(a.includes(l)){if(ce(e[l],i[l]))continue;c[l]={oldValue:e[l],newValue:i[l],viewId:s,scenePath:n};continue}c[l]={oldValue:e[l],newValue:void 0,viewId:s,scenePath:n}}for(const l of a)r.includes(l)||(c[l]={oldValue:void 0,newValue:i[l],viewId:s,scenePath:n});return c}transformKey(e){return this.uid+je+e}isOwn(e){return e.split(je)[0]===this.uid}dispatch(e){const{type:i,workId:n,ops:s,index:r,opt:a,toolsType:c,removeIds:l,updateNodeOpt:u,op:M,selectIds:d,isSync:g,scenePath:v,viewId:y}=e;if(y)switch(i){case D.Clear:const p={};v&&this.storage[y]&&this.storage[y][v]?(delete this.storage[y][v],this.setState(p,{isSync:g,viewId:y,scenePath:v})):this.storage[y]&&(delete this.storage[y],this.setState(p,{isSync:g,viewId:y,scenePath:""}));break;case D.CreateWork:if(v&&n&&c&&a){const z=this.isLocalId(n.toString())?this.transformKey(n):n;this.updateValue(z.toString(),{type:D.CreateWork,workId:n,toolsType:c,opt:a},{isSync:g,viewId:y,scenePath:v})}break;case D.DrawWork:if(v&&n&&typeof r=="number"&&(M!=null&&M.length)){const z=this.isLocalId(n.toString())?this.transformKey(n):n,j=this.storage[y]&&this.storage[y][v]&&this.storage[y][v][z]||void 0,E=r?((j==null?void 0:j.op)||[]).slice(0,r).concat(M):M||(j==null?void 0:j.op);j&&E&&this.updateValue(z.toString(),{...j,type:D.DrawWork,op:E,index:r},{isSync:g,viewId:y,scenePath:v})}break;case D.FullWork:if(v&&n){const z=this.isLocalId(n.toString())?this.transformKey(n):n,j=this.storage[y]&&this.storage[y][v]&&this.storage[y][v][z]||void 0,E=u||(j==null?void 0:j.updateNodeOpt),b=c||(j==null?void 0:j.toolsType),P=a||(j==null?void 0:j.opt),U=s||(j==null?void 0:j.ops);b&&P&&this.updateValue(z.toString(),{type:D.FullWork,updateNodeOpt:E,workId:z,toolsType:b,opt:P,ops:U},{isSync:g,viewId:y,scenePath:v})}break;case D.RemoveNode:if(v&&(l!=null&&l.length)){const z=l.map(j=>this.isLocalId(j+"")?this.transformKey(j):j);this.storage[y]&&this.storage[y][v]&&Object.keys(this.storage[y][v]).map(j=>{z!=null&&z.includes(j)&&this.updateValue(j,void 0,{isSync:g,viewId:y,scenePath:v})})}break;case D.UpdateNode:if(v&&n&&(u||s||a)){const z=this.isLocalId(n.toString())?this.transformKey(n):n,j=this.storage[y]&&this.storage[y][v]&&this.storage[y][v][z]||void 0;j&&(j.updateNodeOpt=u,(s||M)&&(j.ops=s,j.op=M),a&&(j.opt=a),j.type=D.FullWork,this.updateValue(z.toString(),j,{isSync:g,viewId:y,scenePath:v}))}break;case D.Select:if(!v)return;let I;d!=null&&d.length&&(I=d.map(z=>this.isLocalId(z+"")?this.transformKey(z):z));const w=this.transformKey(k),m=this.storage[y]&&this.storage[y][v]&&this.storage[y][v][w]||void 0,T=a||(m==null?void 0:m.opt);I&&this.checkOtherSelector(w,I,{isSync:g,viewId:y,scenePath:v}),this.updateValue(w,I&&{type:D.Select,toolsType:N.Selector,opt:T,selectIds:I},{isSync:g,viewId:y,scenePath:v});break}}checkOtherSelector(e,i,n){const{viewId:s,scenePath:r}=n;for(const a of Object.keys(this.storage[s][r]))if(a!==e&&this.getLocalId(a)===k){const c=this.storage[s][r][a];if(c&&c.selectIds){const l=c.selectIds.filter(u=>!i.includes(u));l.length>0&&(c.selectIds=l),this.updateValue(a,l.length&&c||void 0,n)}}}setState(e,i){const{viewId:n,scenePath:s}=i,r=ye(e);for(let a=0;a<r.length;a++){const c=r[a],l=e[c];typeof l<"u"?(this.storage[n]||(this.storage[n]={}),this.storage[n][s]||(this.storage[n][s]={}),this.storage[n][s][c]=l):delete this.storage[n][s][c]}this.runSyncService(i)}updateValue(e,i,n){const{viewId:s,scenePath:r}=n;i===void 0?delete this.storage[s][r][e]:(this.storage[s]||(this.storage[s]={}),this.storage[s][r]||(this.storage[s][r]={}),this.storage[s][r][e]=i),this.runSyncService(n)}runSyncService(e){this.asyncClockState||(this.asyncClockState=!0,setTimeout(()=>{e.isSync?(this.asyncClockState=!1,this.syncSerivice(e.isAfterUpdate)):qe(()=>{this.asyncClockState=!1,this.syncSerivice(e.isAfterUpdate)},be.syncInterval)},e!=null&&e.isSync?0:be.syncInterval))}syncSerivice(e=!1){const i=ye(this.serviceStorage),n=ye(this.storage),s=new Map;for(const r of i){if(!n.includes(r)){s.set(r,void 0);continue}ce(this.serviceStorage[r],this.storage[r])||this.syncViewData(r,e)}for(const r of n)i.includes(r)||s.set(r,this.storage[r]);if(s.size>5)this.syncStorageView(this.storage,e);else for(const[r,a]of s.entries())this.syncUpdataView(r,a,e)}syncViewData(e,i=!1){const n=ye(this.serviceStorage[e]),s=ye(this.storage[e]),r=new Map;for(const a of n){if(!s.includes(a)){r.set(a,void 0);continue}ce(this.serviceStorage[e][a],this.storage[e][a])||this.syncScenePathData(e,a,i)}for(const a of s)n.includes(a)||r.set(a,this.storage[e][a]);if(r.size>5)this.syncStorageScenePath(e,this.storage[e],i);else for(const[a,c]of r.entries())this.syncUpdataScenePath(e,a,c,i)}syncScenePathData(e,i,n=!1){const s=ye(this.serviceStorage[e][i]),r=ye(this.storage[e][i]),a=new Map;for(const c of s){if(!r.includes(c)){a.set(c,void 0);continue}ce(this.serviceStorage[e][i][c],this.storage[e][i][c])||a.set(c,this.storage[e][i][c])}for(const c of r)s.includes(c)||a.set(c,this.storage[e][i][c]);if(a.size>5)this.syncStorageKey(e,i,this.storage[e][i],n);else for(const[c,l]of a.entries())this.syncUpdataKey(e,i,c,l,n)}syncUpdataView(e,i,n=!1){var r;Object.keys(this.serviceStorage).length?(n||(i===void 0?delete this.serviceStorage[e]:this.serviceStorage[e]=re(i)),(r=this.plugin)==null||r.updateAttributes([this.namespace,e],i)):this.syncStorageView(this.storage,n)}syncStorageView(e,i=!1){var n;i||e&&(this.serviceStorage=re(e)),(n=this.plugin)==null||n.updateAttributes([this.namespace],e)}syncUpdataScenePath(e,i,n,s=!1){var a;Object.keys(this.serviceStorage[e]).length?(s||(n===void 0?delete this.serviceStorage[e][i]:this.serviceStorage[e][i]=n),(a=this.plugin)==null||a.updateAttributes([this.namespace,e,i],n)):this.syncStorageScenePath(e,this.storage[e],s)}syncStorageScenePath(e,i,n=!1){var s;n||i&&(this.serviceStorage[e]=i),(s=this.plugin)==null||s.updateAttributes([this.namespace,e],i)}syncUpdataKey(e,i,n,s,r=!1){var c;Object.keys(this.serviceStorage[e][i]).length?(r||(s===void 0?delete this.serviceStorage[e][i][n]:this.serviceStorage[e][i][n]=s),(c=this.plugin)==null||c.updateAttributes([this.namespace,e,i,n],s)):this.syncStorageKey(e,i,this.storage[e][i],r)}syncStorageKey(e,i,n,s=!1){var r;s||(this.serviceStorage[e][i]=n),(r=this.plugin)==null||r.updateAttributes([this.namespace,e,i],n)}keyTransformWorkId(e){const i=e.split(je);return i.length===2?i[1]:e}destroy(){this.removeStorageStateListener(),this.serviceStorage={},this.storage={}}};f(be,"namespace","PluginState"),f(be,"syncInterval",500);let $t=be;class Vg{constructor(){f(this,"roomMembers",[]);f(this,"onChangeHooks",new Set)}setRoomMembers(t){this.executChangeUidHook(this.roomMembers,t),this.roomMembers=t}executChangeUidHook(t,e){const i={online:e.map(n=>{var s;return((s=n.payload)==null?void 0:s.uid)||n.session}),offline:t.map(n=>{var s;return((s=n.payload)==null?void 0:s.uid)||n.session})};this.onChangeHooks.forEach(n=>n(i))}getRoomMember(t){return this.roomMembers.find(e=>{var i;return((i=e.payload)==null?void 0:i.uid)===t})}isOnLine(t){return!this.getRoomMember(t)}onUidChangeHook(t){this.onChangeHooks.add(t)}destroy(){this.onChangeHooks.clear()}}var Se=(o=>(o[o.Text=1]="Text",o[o.Shape=2]="Shape",o))(Se||{});const pe=class pe{createProxy(t){const e=new Proxy(t,{get(i,n,s){const r=pe.interceptors.hasOwnProperty(n)?pe.interceptors:i;return Reflect.get(r,n,s)}});return pe.proxyToRaw.set(e,t),e}};f(pe,"proxyToRaw",new WeakMap),f(pe,"interceptors",{entries(...t){return pe.proxyToRaw.get(this).entries(...t)},forEach(...t){return pe.proxyToRaw.get(this).forEach(...t)},size(){return pe.proxyToRaw.get(this).size},get(t){return pe.proxyToRaw.get(this).get(t)},set(t,e){return pe.proxyToRaw.get(this).set(t,e)},delete(t,e){return pe.proxyToRaw.get(this).delete(t)},clear(){return pe.proxyToRaw.get(this).clear()}});let Ue=pe;class Gg{constructor(t){f(this,"internalMsgEmitter");f(this,"control");f(this,"editors");f(this,"activeId");f(this,"proxyMap");f(this,"taskqueue",new Map);const{control:e,internalMsgEmitter:i}=t;this.control=e,this.internalMsgEmitter=i;const n=new Map;this.proxyMap=new Ue;const s=this,r=Ue.interceptors.set;Ue.interceptors.set=function(c,l){return s.interceptors.set(c,l),r.call(this,c,l)};const a=Ue.interceptors.delete;Ue.interceptors.delete=function(c,l){return s.interceptors.delete(c,l),a.call(this,c)},this.editors=this.proxyMap.createProxy(n)}get collector(){return this.control.collector}filterEditor(t){const e=new Map;return this.editors.forEach((i,n)=>{i.viewId===t&&e.set(n,i)}),e}get interceptors(){return{set:(t,e)=>{var g,v,y,p,I,w,m,T;if(!this.collector)return!0;const{viewId:i,scenePath:n,canSync:s,canWorker:r,type:a,opt:c,dataType:l}=e;if(!r&&!s)return!0;const M=((g=this.collector)==null?void 0:g.isLocalId(t))?(v=this.collector)==null?void 0:v.transformKey(t):t,d=((y=this.collector)==null?void 0:y.storage[i])&&this.collector.storage[i][n]&&this.collector.storage[i][n][M]||void 0;d?d.toolsType===N.Text&&(r&&(this.control.worker.queryTaskBatchData({workId:t,msgType:D.UpdateNode}).forEach(z=>{var j;(j=this.control.worker)==null||j.taskBatchData.delete(z)}),(m=this.control.worker)==null||m.taskBatchData.add({workId:t,msgType:D.UpdateNode,dataType:l||G.Local,toolsType:N.Text,opt:c,viewId:i,scenePath:n}),(T=this.control.worker)==null||T.runAnimation()),s&&qe(()=>{var z;(z=this.collector)==null||z.dispatch({type:D.UpdateNode,workId:t,toolsType:N.Text,opt:c,viewId:i,scenePath:n})},this.control.worker.maxLastSyncTime)):a===Se.Text&&(s&&((p=this.collector)==null||p.dispatch({type:c.text&&D.FullWork||D.CreateWork,workId:t,toolsType:N.Text,opt:c,isSync:!0,viewId:i,scenePath:n})),r&&((I=this.control.worker)==null||I.taskBatchData.add({workId:t,msgType:c.text&&D.FullWork||D.CreateWork,dataType:l||G.Local,toolsType:N.Text,opt:c,viewId:i,scenePath:n}),(w=this.control.worker)==null||w.runAnimation()))},delete:t=>{var a,c;if(!this.collector)return!0;const e=this.editors.get(t);if(!e)return!0;const{viewId:i,scenePath:n,canSync:s,canWorker:r}=e;if(!r&&!s)return!0;r&&((a=this.control.worker)==null||a.taskBatchData.add({workId:t,toolsType:N.Text,msgType:D.RemoveNode,dataType:G.Local,viewId:i,scenePath:n}),(c=this.control.worker)==null||c.runAnimation()),s&&qe(()=>{var l;(l=this.collector)==null||l.dispatch({type:D.RemoveNode,removeIds:[t],toolsType:N.Text,viewId:i,scenePath:n})},this.control.worker.maxLastSyncTime)},clear(){return!0}}}computeTextActive(t,e){var s,r,a,c;const i=(s=this.control.viewContainerManager)==null?void 0:s.transformToScenePoint(t,e),n=(r=this.control.viewContainerManager)==null?void 0:r.getCurScenePath(e);e&&n&&((a=this.control.worker)==null||a.taskBatchData.add({msgType:D.GetTextActive,dataType:G.Local,op:i,viewId:e,scenePath:n}),(c=this.control.worker)==null||c.runAnimation())}checkEmptyTextBlur(){if(this.activeId){const t=this.editors.get(this.activeId);(t==null?void 0:t.opt.text)&&(t==null?void 0:t.opt.text.replace(/\s*,/g,""))?this.unActive():this.delete(this.activeId,!0,!0)}}onCameraChange(t,e){var i,n;for(const[s,r]of this.editors.entries())if(r.viewId===e){const{boxPoint:a,boxSize:c}=r.opt,l=a&&((i=this.control.viewContainerManager)==null?void 0:i.transformToOriginPoint(a,r.viewId)),u=(n=this.control.viewContainerManager)==null?void 0:n.getCurScenePath(e);if(u&&e){const M={x:l&&l[0]||0,y:l&&l[1]||0,w:c&&c[0]||0,h:c&&c[1]||0,opt:r.opt,scale:t.scale,type:Se.Text,viewId:e,scenePath:u,canWorker:!1,canSync:!1};this.editors.set(s,M),this.control.viewContainerManager.setActiveTextEditor(e,this.activeId)}}}onServiceDerive(t){var v,y;const{workId:e,opt:i,msgType:n,viewId:s,scenePath:r,dataType:a}=t;if(!e||!s||!r)return;const c=e.toString();if(n===D.RemoveNode){console.log("onServiceDerive-d",c),this.delete(c,!0,!0);return}const{boxPoint:l,boxSize:u}=i,M=l&&((v=this.control.viewContainerManager)==null?void 0:v.transformToOriginPoint(l,s)),d=this.control.viewContainerManager.getView(s),g={x:M&&M[0]||0,y:M&&M[1]||0,w:u&&u[0]||0,h:u&&u[1]||0,opt:i,type:Se.Text,canWorker:!0,canSync:!1,dataType:a,scale:((y=d==null?void 0:d.cameraOpt)==null?void 0:y.scale)||1,viewId:s,scenePath:r};this.editors.set(c,g),a===G.Service&&i.workState===C.Done&&this.activeId===c&&(this.activeId=void 0),console.log("onServiceDerive---1",c,g.opt.text,g.opt.uid,this.activeId,a),this.control.viewContainerManager.setActiveTextEditor(s,this.activeId)}updateForViewEdited(t,e){var n;this.editors.set(t,e);const i=(n=this.taskqueue.get(t))==null?void 0:n.resolve;i&&i(e)}active(t){var i;const e=this.editors.get(t);e&&e.viewId&&(e.opt.workState=C.Start,e.opt.uid=(i=this.collector)==null?void 0:i.uid,this.activeId=t,e.canWorker=!0,e.canSync=!0,this.editors.set(t,e),this.control.viewContainerManager.setActiveTextEditor(e.viewId,this.activeId))}unActive(){const t=this.activeId&&this.editors.get(this.activeId);t&&t.viewId&&this.activeId&&(t.opt.workState=C.Done,t.opt.uid=void 0,t.canWorker=!0,t.canSync=!0,this.editors.set(this.activeId,t),this.activeId=void 0,this.control.viewContainerManager.setActiveTextEditor(t.viewId,this.activeId))}createTextForMasterController(t,e){var r;const{workId:i,isActive:n,...s}=t;e&&this.internalMsgEmitter.emit("addUndoTicker",e,s.viewId),s.opt.zIndex=this.getMaxZIndex()+1,s.opt.uid=(r=this.collector)==null?void 0:r.uid,n&&(this.activeId=i),s.dataType=G.Local,s.canWorker=!0,s.canSync=!0,this.editors.set(i,s),this.control.viewContainerManager.setActiveTextEditor(s.viewId,this.activeId)}updateTextForMasterController(t,e){var r;const{workId:i,...n}=t;e&&this.internalMsgEmitter.emit("addUndoTicker",e,n.viewId);const s=this.editors.get(i)||{};n.opt&&(n.opt.uid=(r=this.collector)==null?void 0:r.uid),n.dataType=G.Local,this.editors.set(i,{...s,...n}),this.control.viewContainerManager.setActiveTextEditor(n.viewId,this.activeId)}async updateTextControllerWithEffectAsync(t,e){var l;const{workId:i,...n}=t;e&&this.internalMsgEmitter.emit("addUndoTicker",e,n.viewId);const s=this.editors.get(i)||{};if(n.opt&&(n.opt.uid=(l=this.collector)==null?void 0:l.uid),n.dataType=G.Local,this.editors.set(i,{...s,...n}),this.control.viewContainerManager.setActiveTextEditor(n.viewId,this.activeId),this.taskqueue.has(i))return;const r=setTimeout(()=>{var M;const u=(M=this.taskqueue.get(i))==null?void 0:M.resolve;u&&u(void 0)},20),a=await new Promise(u=>{this.taskqueue.set(i,{resolve:u,clocker:r})}),c=this.taskqueue.get(i);return c&&(c.clocker&&clearTimeout(c.clocker),this.taskqueue.delete(i)),this.taskqueue.delete(i),a}updateTextForWorker(t,e){const{workId:i,isActive:n,...s}=t;e&&this.internalMsgEmitter.emit("addUndoTicker",e,s.viewId);const a={...this.editors.get(i)||{},...s};if(a.waitWorker&&delete a.waitWorker,n){a.canWorker=!1,a.canSync=!1,this.editors.set(i,a),this.active(i);return}this.editors.set(i,a),this.control.viewContainerManager.setActiveTextEditor(s.viewId,this.activeId)}get(t){return this.editors.get(t)}delete(t,e,i){const n=this.editors.get(t);if(n){const s=n.viewId;n.canSync=e,n.canWorker=i,this.editors.delete(t),this.activeId===t&&(this.activeId=void 0),this.control.viewContainerManager.setActiveTextEditor(s,this.activeId)}}deleteBatch(t,e,i){const n=new Set;for(const s of t){const r=this.editors.get(s);if(r){const a=r.viewId;r.canSync=e,r.canWorker=i,this.editors.delete(s),this.activeId===s&&(this.activeId=void 0),n.add(a)}}for(const s of n)this.control.viewContainerManager.setActiveTextEditor(s,this.activeId)}clear(t,e){this.editors.forEach((i,n)=>{i.viewId===t&&(e&&(i.canSync=!1),i.canWorker=!1,this.editors.delete(n))}),this.activeId=void 0,this.control.viewContainerManager.setActiveTextEditor(t,this.activeId)}destory(){this.editors.clear(),this.activeId=void 0}getMaxZIndex(){let t=0;return this.editors.forEach(e=>{e.opt.zIndex&&e.opt.zIndex>t&&(t=e.opt.zIndex)}),t}}const Ee=class Ee extends Po{constructor(e,i){super(e);f(this,"serviceStorage",{});f(this,"storage",{});f(this,"stateDisposer");f(this,"asyncClockTimer");f(this,"namespace");this.namespace=Ee.namespace,Ee.syncInterval=(i||Ee.syncInterval)*.5,this.serviceStorage=this.getNamespaceData(),this.storage=re(this.serviceStorage)}addStorageStateListener(e){this.stateDisposer=K.autorun(async()=>{const i=this.getNamespaceData(),n=this.getDiffMap(this.serviceStorage,i);this.serviceStorage=i,n.size&&e(n)})}getDiffMap(e,i){const n=new Map;for(const[s,r]of Object.entries(i))s!==this.uid&&(r&&ce(e[s],r)||r&&n.set(s,r));return n}removeStorageStateListener(){this.stateDisposer&&this.stateDisposer()}transformKey(e){return this.uid+je+e}isOwn(e){return e===this.uid}dispatch(e){const{type:i,op:n,isSync:s,viewId:r}=e;switch(i){case Qe.Cursor:n&&this.pushValue(this.uid,{type:Qe.Cursor,op:n,viewId:r},{isSync:s});break}}pushValue(e,i,n){var s;this.storage[e]||(this.storage[e]=[]),(s=this.storage[e])==null||s.push(i),this.runSyncService(n)}clearValue(e){var n;this.storage[e]=void 0,Object.keys(this.serviceStorage).length&&((n=this.plugin)==null||n.updateAttributes([this.namespace,e],void 0))}runSyncService(e){this.asyncClockTimer||(this.asyncClockTimer=setTimeout(()=>{e!=null&&e.isSync?(this.asyncClockTimer=void 0,this.syncSerivice()):qe(()=>{this.asyncClockTimer=void 0,this.syncSerivice()},Ee.syncInterval)},e!=null&&e.isSync?0:Ee.syncInterval))}syncSerivice(){var i;Object.keys(this.serviceStorage).length?Object.keys(this.storage).forEach(n=>{var s;(s=this.plugin)==null||s.updateAttributes([this.namespace,n],this.storage[n])}):(i=this.plugin)==null||i.updateAttributes(this.namespace,this.storage),this.storage={}}destroy(){this.removeStorageStateListener(),this.storage={},this.serviceStorage={}}};f(Ee,"syncInterval",100),f(Ee,"namespace","PluginEvent");let Bt=Ee;class Jg{constructor(t){f(this,"expirationTime",5e3);f(this,"internalMsgEmitter");f(this,"control");f(this,"eventCollector");f(this,"roomMember");f(this,"animationId");f(this,"removeTimerId");f(this,"asyncEndInfo");f(this,"animationPointWorkers",new Map);f(this,"animationDrawWorkers",new Map);f(this,"cursorInfoMap",new Map);const{control:e,internalMsgEmitter:i}=t;this.internalMsgEmitter=i,this.control=e,this.roomMember=e.roomMember}activeCollector(){var t,e;this.control.plugin&&(this.eventCollector=new Bt(this.control.plugin,Math.min(((e=(t=this.control.pluginOptions)==null?void 0:t.syncOpt)==null?void 0:e.interval)||100,100)),this.eventCollector.addStorageStateListener(i=>{i.forEach((n,s)=>{var r;if(((r=this.eventCollector)==null?void 0:r.uid)!==s){const a=new Map;n==null||n.forEach(c=>{if(c&&c.type===Qe.Cursor&&c.op&&c.viewId){const l=[];for(let u=0;u<c.op.length;u+=2){const M=c.op[u],d=c.op[u+1];if(ae(M)&&ae(d)){const g=this.control.viewContainerManager.transformToOriginPoint([M,d],c.viewId);l.push(g[0],g[1])}else l.push(M,d)}a.set(c.viewId,l)}}),a.size&&(this.activePointWorkShape(s,a),this.runAnimation())}})}))}onFocusViewChange(){const t=this.control.viewContainerManager.focuedViewId;for(const i of this.animationDrawWorkers.keys()){const n=this.getUidAndviewId(i).uid,s=this.getUidAndviewId(i).viewId;s!==t&&this.activeDrawWorkShape(n,[void 0,void 0],C.Done,s)}const e=new Map;for(const i of this.animationPointWorkers.keys()){const n=this.getUidAndviewId(i).uid,s=this.getUidAndviewId(i).viewId;if(s!==t){const r=e.get(n)||new Map;r.set(s,[void 0,void 0]),e.set(n,r)}}if(e.size)for(const[i,n]of e.entries())this.activePointWorkShape(i,n);this.runAnimation()}activePointWorkShape(t,e){var n;if(this.roomMember.getRoomMember(t))for(const[s,r]of e.entries()){const a=this.getKey(t,s);let c=!1;const l=this.control.viewContainerManager.getAllViews().map(M=>M==null?void 0:M.id);for(const M of l)if(M&&M!==s){const d=this.getKey(t,M),g=this.animationDrawWorkers.get(d);if((g==null?void 0:g.workState)===C.Start||(g==null?void 0:g.workState)===C.Doing||!1){c=!0;break}else if(this.removeTimerId&&(clearTimeout(this.removeTimerId),this.removeTimerId=void 0),g)this.activeDrawWorkShape(t,[void 0,void 0],C.Done,M),this.runAnimation();else{const y=this.animationPointWorkers.get(d);if(y)y.animationWorkData=[void 0,void 0],y.animationIndex=0,y.freeze=!1;else{const p={animationIndex:0,animationWorkData:[void 0,void 0],freeze:!1};this.animationPointWorkers.set(d,p)}}}const u=this.animationPointWorkers.get(a);if(r){if(!u){const M={animationIndex:0,animationWorkData:r,freeze:c};(n=this.animationPointWorkers)==null||n.set(a,M);return}u.animationWorkData=r,u.animationIndex=0,u.freeze=c}}}getKey(t,e){return`${t}${je}${e}`}getUidAndviewId(t){const[e,i]=t.split(je);return{uid:e,viewId:i}}animationCursor(){this.animationId=void 0;const t=Date.now();this.animationPointWorkers.forEach((e,i)=>{const{uid:n,viewId:s}=this.getUidAndviewId(i);if(e.freeze)return;const a=e.animationIndex,c=this.roomMember.getRoomMember(n);if(c){e.animationWorkData.length-1>a&&(e.animationIndex=a+2);const l=e.animationWorkData[a],u=e.animationWorkData[a+1],M=this.cursorInfoMap.get(s)||new Map;ae(l)&&ae(u)?M.set(c.memberId,{x:l,y:u,roomMember:c,timestamp:t}):M.has(c.memberId)&&M.delete(c.memberId),M.size?this.cursorInfoMap.set(s,M):this.cursorInfoMap.has(s)&&(this.cursorInfoMap.delete(s),this.internalMsgEmitter.emit([$.Cursor,s],[])),e.animationWorkData.length-1<=e.animationIndex&&this.animationPointWorkers.delete(i)}}),this.animationDrawWorkers.forEach((e,i)=>{const{uid:n,viewId:s}=this.getUidAndviewId(i),r=e.animationIndex,a=this.roomMember.getRoomMember(n);if(a){e.animationWorkData.length-1>r&&(e.animationIndex=r+2);const c=e.animationWorkData[r],l=e.animationWorkData[r+1],u=this.cursorInfoMap.get(s)||new Map;ae(c)&&ae(l)?u.set(a.memberId,{x:c,y:l,roomMember:a,timestamp:t}):u.has(a.memberId)&&u.delete(a.memberId),u.size?this.cursorInfoMap.set(s,u):this.cursorInfoMap.has(s)&&(this.cursorInfoMap.delete(s),this.internalMsgEmitter.emit([$.Cursor,s],[])),e.animationWorkData.length-1<=e.animationIndex&&this.animationDrawWorkers.delete(i)}});for(const[e,i]of this.cursorInfoMap)if(i){const n=[],s=[];for(const[r,a]of i.entries()){const{timestamp:c,...l}=a;c+this.expirationTime<t?s.push(r):n.push(l)}if(s.length)for(const r of s)i.delete(r);i.size?this.cursorInfoMap.set(e,i):this.cursorInfoMap.delete(e),this.internalMsgEmitter.emit([$.Cursor,e],n)}(this.animationPointWorkers.size||this.animationDrawWorkers.size||this.cursorInfoMap.size)&&this.runAnimation()}activeDrawWorkShape(t,e,i,n){var c,l;if(!this.roomMember.getRoomMember(t))return;const r=this.getKey(t,n);if(i===C.Start){const u=this.animationPointWorkers.get(r);if(u)u.animationWorkData=[],u.animationIndex=0,u.freeze=!0;else{const M={animationIndex:0,animationWorkData:[],freeze:!0};(c=this.animationDrawWorkers)==null||c.set(r,M)}}else if(i===C.Done){const u=this.animationPointWorkers.get(r);u&&(u.freeze=!1)}const a=this.animationDrawWorkers.get(r);if(e){if(!a){const u={animationIndex:0,animationWorkData:e,workState:i};(l=this.animationDrawWorkers)==null||l.set(r,u);return}a.animationWorkData=e,a.animationIndex=0,a.workState=i}}runAnimation(){this.animationId||(this.animationId=requestAnimationFrame(this.animationCursor.bind(this)))}sendEvent(t,e){var i;(i=this.eventCollector)==null||i.dispatch({type:Qe.Cursor,op:ae(t[0])&&ae(t[1])&&this.control.viewContainerManager.transformToScenePoint(t,e)||[void 0,void 0],viewId:e})}collectServiceCursor(t){const{op:e,uid:i,workState:n,viewId:s}=t;if(i&&e&&n&&s){const r=this.control.viewContainerManager.focuedViewId;if(n===C.Done){if(s!==r){this.activeDrawWorkShape(i,[void 0,void 0],n,s),this.runAnimation();return}this.removeTimerId&&(clearTimeout(this.removeTimerId),this.removeTimerId=void 0,this.asyncEndInfo&&this.asyncEndInfo.viewId!==s&&this.asyncEndInfo.uid===i&&this.activeDrawWorkShape(i,[void 0,void 0],C.Done,this.asyncEndInfo.viewId)),this.asyncEndInfo={uid:i,viewId:s},this.removeTimerId=setTimeout(()=>{this.removeTimerId=void 0,this.activeDrawWorkShape(i,[void 0,void 0],C.Done,s),this.runAnimation()},this.expirationTime)}if(ae(e[0])&&ae(e[1])){const a=this.control.viewContainerManager.transformToOriginPoint(e,s);this.activeDrawWorkShape(i,a,n,s)}this.runAnimation()}}unabled(){var t;(t=this.eventCollector)==null||t.dispatch({type:Qe.Cursor,op:[void 0,void 0],viewId:this.control.viewContainerManager.focuedViewId})}destroy(){var t;(t=this.eventCollector)==null||t.destroy()}}class me{constructor(){f(this,"emtType");f(this,"control");f(this,"mainEngine")}static dispatch(t,e,i){var n;(n=Ne.InternalMsgEmitter)==null||n.emit([t,e],i)}get serviceColloctor(){return this.control.collector}registerForMainEngine(t,e){return this.emtType=t,this.control=e,this.mainEngine=e.worker,this.mainEngine.internalMsgEmitter.on([this.emtType,this.emitEventType],this.collect.bind(this)),this}destroy(){this.emtType&&this.mainEngine&&this.mainEngine.internalMsgEmitter.off([this.emtType,this.emitEventType],this.collect.bind(this))}collectForLocalWorker(t){var e,i,n;for(const[s,r]of t)(e=this.mainEngine)==null||e.queryTaskBatchData(r).forEach(a=>{var c;(c=this.mainEngine)==null||c.taskBatchData.delete(a)}),(i=this.mainEngine)==null||i.taskBatchData.add(s);(n=this.mainEngine)==null||n.runAnimation()}collectForServiceWorker(t){qe(()=>{t.forEach(e=>{var i;(i=this.serviceColloctor)==null||i.dispatch(e)})},this.mainEngine.maxLastSyncTime)}}class Kg extends me{constructor(){super(...arguments);f(this,"emitEventType",x.CopyNode)}collect(e){var c;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,viewId:n}=e,s=this.control.viewContainerManager.getView(n);if(!(s!=null&&s.displayer))return;const r=s.focusScenePath,a=Date.now();this.mainEngine.internalMsgEmitter.emit("addUndoTicker",a,n);for(const l of i){const u=l.toString(),d=this.serviceColloctor.isLocalId(u)?this.serviceColloctor.transformKey(l):u,g=(c=this.serviceColloctor.getStorageData(n,r))==null?void 0:c[d];if(g){if(l===k){const v=g&&this.copySelector({viewId:n,store:g});v&&this.pasteSelector({...v,viewId:n,scenePath:r,undoTickerId:a});break}if(g.toolsType===N.Text&&g.opt&&g.opt.workState&&g.opt.workState!==C.Done){const v=g&&this.copyText({viewId:n,store:g});v&&this.pasteText({...v,viewId:n,scenePath:r,key:d,store:g,undoTickerId:a});break}}}}copyText(e){const{viewId:i,store:n}=e,s=this.control.viewContainerManager.getView(i);if(!this.serviceColloctor||!s)return;const r=s==null?void 0:s.cameraOpt,a=r&&[r.centerX,r.centerY],c=n.opt,l=c.boxPoint&&c.boxSize&&[c.boxPoint[0]+c.boxSize[0]/2,c.boxPoint[1]+c.boxSize[1]/2];return{bgCenter:a,textCenter:l}}pasteText(e){var p,I;const{bgCenter:i,textCenter:n,store:s,key:r,viewId:a,scenePath:c,undoTickerId:l}=e,u=this.control.viewContainerManager.getView(a);if(!this.serviceColloctor||!u)return;const M=Math.floor(Math.random()*30+1),d=((p=u.cameraOpt)==null?void 0:p.scale)||1,g=i&&n&&[i[0]-n[0]+M,i[1]-n[1]+M]||[M/d,M/d],y=(this.serviceColloctor.isLocalId(r)?r:this.serviceColloctor.getLocalId(r.toString()))+"-"+l;if(s.toolsType===N.Text&&s.opt){const w=s.opt;if(w&&w.boxPoint&&w.text){w.workState=C.Done;const m=w.boxPoint;w.boxPoint=[m[0]+g[0],m[1]+g[1]],w.workState=C.Done;const T=this.control.viewContainerManager.transformToOriginPoint(w.boxPoint,a);this.control.textEditorManager.createTextForMasterController({workId:y,x:T[0],y:T[1],opt:w,scale:((I=u.cameraOpt)==null?void 0:I.scale)||1,type:Se.Text,isActive:!1,viewId:a,scenePath:c}),this.collectForServiceWorker([{...s,opt:w,type:D.FullWork,workId:y,viewId:a,scenePath:c}])}}}copySelector(e){var y,p,I,w,m,T,z,j,E;const{viewId:i,store:n}=e,s=this.control.viewContainerManager.getView(i),r=n.selectIds;if(!this.serviceColloctor||!(r!=null&&r.length)||!s)return;const a=new Map,c={offset:{x:0,y:0},cameraOpt:{centerX:((y=s.cameraOpt)==null?void 0:y.centerX)||0,centerY:((p=s.cameraOpt)==null?void 0:p.centerY)||0,scale:((I=s.cameraOpt)==null?void 0:I.scale)||1}},l=this.control.hasOffscreenCanvas()&&((w=s.displayer.canvasBgRef.current)==null?void 0:w.getBoundingClientRect())||((m=s.displayer.canvasContainerRef.current)==null?void 0:m.getBoundingClientRect()),u=(z=(T=s.displayer)==null?void 0:T.floatBarRef.current)==null?void 0:z.getBoundingClientRect(),M=l&&[l.x+l.width/2,l.y+l.height/2],d=u&&[u.x+u.width/2,u.y+u.height/2],g=M&&s.viewData&&s.viewData.convertToPointInWorld({x:M[0],y:M[1]}),v=d&&s.viewData&&s.viewData.convertToPointInWorld({x:d[0],y:d[1]});g&&v&&(c.offset={x:g.x-v.x,y:g.y-v.y});for(const b of r){const P=(E=(j=this.serviceColloctor)==null?void 0:j.getStorageData(s.id,s.focusScenePath))==null?void 0:E[b];P&&a.set(b,P)}return{copyStores:a,copyCoordInfo:c}}pasteSelector(e){var y;const{copyStores:i,copyCoordInfo:n,viewId:s,scenePath:r,undoTickerId:a}=e,c=this.control.viewContainerManager.getView(s);if(!i.size||!this.serviceColloctor||!c)return;const{offset:l,cameraOpt:u}=n,M=Math.floor(Math.random()*30+1),d=[l.x+M,l.y+M],g=[],v=[];for(const[p,I]of i.entries()){const m=(this.serviceColloctor.isLocalId(p)?p:this.serviceColloctor.getLocalId(p.toString()))+"-"+a,T={useAnimation:!1};if(I.toolsType===N.Text&&I.opt){const z=I.opt;if(z&&z.boxPoint&&z.text){z.workState=C.Done;const j=z.boxPoint;z.boxPoint=[j[0]+d[0],j[1]+d[1]],z.workState=C.Done;const E=this.control.viewContainerManager.transformToOriginPoint(z.boxPoint,s);this.control.textEditorManager.createTextForMasterController({workId:m,x:E[0],y:E[1],opt:z,scale:((y=c.cameraOpt)==null?void 0:y.scale)||1,type:Se.Text,isActive:!1,viewId:s,scenePath:r})}v.push({...I,opt:z,type:D.FullWork,workId:m,viewId:s,scenePath:r});continue}if(I.toolsType===N.Image&&(I.opt.uuid=m,I.opt.centerX=I.opt.centerX+d[0],I.opt.centerY=I.opt.centerY+d[1]),I.ops){const z=Lo(I.ops).map((E,b)=>{const P=b%3;return P===0?E+d[0]:P===1?E+d[1]:E}),j=ko(z);I.ops=j}v.push({...I,updateNodeOpt:T,type:D.FullWork,workId:m,viewId:s,scenePath:r}),g.push([{...I,updateNodeOpt:T,workId:m,msgType:D.FullWork,dataType:G.Local,emitEventType:x.CopyNode,willSyncService:!1,willRefresh:!0,viewId:s},{workId:m,msgType:D.FullWork,emitEventType:x.CopyNode}])}g.length&&this.collectForLocalWorker(g),v.length&&this.collectForServiceWorker(v)}}function Lt(o,t,e){return"#"+((o<<16)+(t<<8)+e).toString(16).padStart(6,"0")}function he(o,t=1){return"rgba("+parseInt("0x"+o.slice(1,3))+","+parseInt("0x"+o.slice(3,5))+","+parseInt("0x"+o.slice(5,7))+","+t+")"}function lt(o,t,e,i=1){return`rgba(${o},${t},${e},${i})`}function ri(o){const t=o.split(","),e=parseInt(t[0].split("(")[1]),i=parseInt(t[1]),n=parseInt(t[2]),s=Number(t[3].split(")")[0]);return[Lt(e,i,n),s]}function ht(o){const t=o.split(","),e=parseInt(t[0].split("(")[1]),i=parseInt(t[1]),n=parseInt(t[2]),s=Number(t[3].split(")")[0]);return[e,i,n,s]}function Vi(o){return o==="transparent"}class qg extends me{constructor(){super(...arguments);f(this,"emitEventType",x.SetColorNode);f(this,"undoTickerId")}setTextColor(e,i,n,s){const{fontColor:r,fontBgColor:a}=n;i.opt&&(r&&(i.opt.fontColor=r),a&&(i.opt.fontColor=a),this.control.textEditorManager.updateTextForMasterController({workId:e,opt:i.opt,viewId:s,canSync:!0,canWorker:!0}))}collect(e){if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,strokeColor:n,fillColor:s,fontColor:r,fontBgColor:a,viewId:c,workState:l}=e,u=this.control.viewContainerManager.getView(c);if(!(u!=null&&u.displayer))return;const M=u.focusScenePath,d=[...i],g=this.serviceColloctor.storage,v=[],y={};for((l===C.Start||!this.undoTickerId&&l===C.Done)&&(this.undoTickerId=Date.now(),this.mainEngine.internalMsgEmitter.emit("addUndoTicker",this.undoTickerId,c));d.length;){const p=d.pop();if(!p)continue;const I=p.toString(),w=this.serviceColloctor.isLocalId(I),m=w?this.serviceColloctor.transformKey(p):I;let T=I;!w&&this.serviceColloctor.isOwn(T)&&(T=this.serviceColloctor.getLocalId(T));const z=g[c][M][m]||void 0;if(z){const j=z.updateNodeOpt||{};if(r||a){if(r){j.fontColor=r;const[b,P,U,O]=ht(r);y.textColor=[b,P,U],y.textOpacity=O}if(a){j.fontBgColor=a;const[b,P,U,O]=ht(a);y.textBgColor=[b,P,U],y.textBgOpacity=O}if(z.toolsType===N.Text&&z.opt&&l!==C.Start){this.setTextColor(T,re(z),j,c),l===C.Done&&(this.undoTickerId=void 0);continue}}if(n){j.strokeColor=n;const[b,P,U,O]=ht(n);y.strokeColor=[b,P,U],y.strokeOpacity=O}if(s)if(j.fillColor=Vi(s)?"transparent":s,Vi(s))y.fillColor=void 0,y.fillOpacity=void 0;else{const[b,P,U,O]=ht(s);y.fillColor=[b,P,U],y.fillOpacity=O}const E={workId:T,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:j,emitEventType:this.emitEventType,willRefresh:!0,willRefreshSelector:!0,willSyncService:!0,textUpdateForWoker:!0,viewId:c};v.push([E,{workId:T,msgType:D.UpdateNode,emitEventType:this.emitEventType}])}}v.length&&(l===C.Done&&(this.undoTickerId=void 0),this.collectForLocalWorker(v)),Object.keys(y).length&&setTimeout(()=>{var p;(p=this.control.room)==null||p.setMemberState(y)},0)}}class _g extends me{constructor(){super(...arguments);f(this,"emitEventType",x.ZIndexNode);f(this,"zIndexMap",new Map)}clearZIndex(e){this.zIndexMap.delete(e)}getMinZIndex(e){var i;return((i=this.zIndexMap.get(e))==null?void 0:i.min)||0}getMaxZIndex(e){var i;return((i=this.zIndexMap.get(e))==null?void 0:i.max)||0}setMaxZIndex(e,i){const n=this.getMinZIndex(i);this.zIndexMap.set(i,{min:n,max:e})}setMinZIndex(e,i){const n=this.getMaxZIndex(i);this.zIndexMap.set(i,{min:e,max:n})}addMaxLayer(e){const i=this.getMaxZIndex(e)+1;this.setMaxZIndex(i,e)}addMinLayer(e){const i=this.getMinZIndex(e)-1;this.setMinZIndex(i,e)}correct(e){const i=e.sort((n,s)=>n[1]-s[1]);for(let n=1;n<i.length;n++){const s=i[n][1],r=i[n-1][1];s<=r&&(i[n][1]=r+1)}return i}collect(e){if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,layer:n,viewId:s}=e,r=this.control.viewContainerManager.getView(s);if(!(r!=null&&r.displayer))return;const a=r.focusScenePath,c=[...i],l=this.serviceColloctor.storage,u=[],M=[];for(;c.length;){const g=c.pop();if(!g)continue;const v=g.toString(),y=this.serviceColloctor.isLocalId(v),p=y?this.serviceColloctor.transformKey(g):v;let I=v;!y&&this.serviceColloctor.isOwn(I)&&(I=this.serviceColloctor.getLocalId(I));const w=re(l[s][a][p]);let m;if(w&&I===k){if(w.selectIds){M.push(...w.selectIds),M.sort((E,b)=>{var O,Q,B,_;const P=((Q=(O=l[d(E,this.serviceColloctor)])==null?void 0:O.opt)==null?void 0:Q.zIndex)||0,U=((_=(B=l[d(E,this.serviceColloctor)])==null?void 0:B.opt)==null?void 0:_.zIndex)||0;return P>U?1:E<b?-1:0});const T=w.updateNodeOpt||{};T.zIndexLayer=n;const z={workId:g,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:T,emitEventType:this.emitEventType,willRefreshSelector:!0,willSyncService:!0,viewId:s},j=new Map;n===Fe.Top?(this.addMaxLayer(s),m=this.getMaxZIndex(s)):(this.addMinLayer(s),m=this.getMinZIndex(s)),M.forEach(E=>{var O,Q,B;const b=(O=this.serviceColloctor)==null?void 0:O.isLocalId(E);let P=b&&((Q=this.serviceColloctor)==null?void 0:Q.transformKey(E))||E;const U=l[s][a][P];!b&&((B=this.serviceColloctor)!=null&&B.isOwn(P))&&(P=this.serviceColloctor.getLocalId(P)),T.zIndex=m,U!=null&&U.opt&&(U.opt.zIndex=m),U!=null&&U.opt&&j.set(P,{updateNodeOpt:U.updateNodeOpt,opt:U.opt})}),z.selectStore=j,z.willSerializeData=!0,u.push([z,{workId:g,msgType:D.UpdateNode,emitEventType:this.emitEventType}])}continue}}u.length&&this.collectForLocalWorker(u);function d(g,v){return v.isLocalId(g)&&v.transformKey(g)||g}}}class Xg extends me{constructor(){super(...arguments);f(this,"emitEventType",x.TranslateNode);f(this,"undoTickerId");f(this,"cachePosition")}collect(e){var g;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,position:n,workState:s,viewId:r}=e,a=this.control.viewContainerManager.getView(r);if(!(a!=null&&a.displayer))return;const c=a.focusScenePath,l=[...i],u=(g=this.serviceColloctor)==null?void 0:g.storage,M=[],d=s===C.Start&&Date.now()||void 0;for(d&&(this.undoTickerId=d,this.mainEngine.internalMsgEmitter.emit("addUndoTicker",d,r));l.length;){const v=l.pop();if(!v)continue;const y=v.toString(),p=this.serviceColloctor.isLocalId(y),I=p&&this.serviceColloctor.transformKey(v)||y;let w=y;!p&&this.serviceColloctor.isOwn(w)&&(w=this.serviceColloctor.getLocalId(w));const m=u[r][c][I];if(m&&w===k){if(m.selectIds&&(s===C.Start&&(this.cachePosition=n),this.cachePosition)){const T=m.updateNodeOpt||{};T.translate=[n.x-this.cachePosition.x,n.y-this.cachePosition.y],T.workState=s;const z={workId:v,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:T,emitEventType:this.emitEventType,willSyncService:!0,textUpdateForWoker:!0,viewId:r};s===C.Done&&(z.textUpdateForWoker=!0,z.willSerializeData=!0,z.undoTickerId=this.undoTickerId,this.cachePosition=void 0),M.push([z,{workId:v,msgType:D.UpdateNode,emitEventType:this.emitEventType}])}continue}}s===C.Start?this.mainEngine.unWritable():s===C.Done&&this.mainEngine.abled(),M.length&&this.collectForLocalWorker(M)}}class eM extends me{constructor(){super(...arguments);f(this,"emitEventType",x.DeleteNode)}collect(e){if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,viewId:n}=e,s=this.control.viewContainerManager.getView(n);if(!(s!=null&&s.displayer))return;const r=s.focusScenePath,a=this.serviceColloctor.storage,c=[...i],l=[],u=[],M=Date.now();for(;c.length;){const d=c.pop();if(!d)continue;const g=d.toString(),v=this.serviceColloctor.isLocalId(g),y=v?this.serviceColloctor.transformKey(d):g,p=a[n][r][y];if(p){let I=g;if(!v&&this.serviceColloctor.isOwn(I)&&(I=this.serviceColloctor.getLocalId(I)),p.toolsType===N.Text){this.control.textEditorManager.delete(I,!0,!0);continue}u.push(I)}}u.length&&(l.push([{msgType:D.RemoveNode,emitEventType:x.DeleteNode,removeIds:u,dataType:G.Local,willSyncService:!0,willRefresh:!0,viewId:n},void 0]),this.mainEngine.internalMsgEmitter.emit("addUndoTicker",M,n),this.collectForLocalWorker(l))}}class tM extends me{constructor(){super(...arguments);f(this,"emitEventType",x.ScaleNode);f(this,"targetBox",new Map);f(this,"targetText",new Map);f(this,"cacheTextInfo",new Map)}async collect(e){var v,y,p,I,w,m;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,box:n,workState:s,viewId:r,dir:a}=e,c=this.control.viewContainerManager.getView(r);if(!(c!=null&&c.displayer))return;const l=c.focusScenePath,u=[...i],M=(v=this.serviceColloctor)==null?void 0:v.storage,d=[],g=s===C.Start&&Date.now()||void 0;for(g&&this.mainEngine.internalMsgEmitter.emit("addUndoTicker",g,r);u.length;){const T=u.pop();if(!T)continue;const z=T.toString(),j=this.serviceColloctor.isLocalId(z),E=j&&this.serviceColloctor.transformKey(T)||z;let b=z;!j&&this.serviceColloctor.isOwn(b)&&(b=this.serviceColloctor.getLocalId(b));const P=M[r][l][E];if(P&&b===k&&P.selectIds){const U=P.updateNodeOpt||{};if(U.dir=a,U.box=n,U.workState=s,s===C.Start&&n){this.cacheTextInfo.clear();for(const Q of P.selectIds){const B=(y=this.serviceColloctor)==null?void 0:y.isLocalId(Q),_=B&&((p=this.serviceColloctor)==null?void 0:p.transformKey(Q))||Q;let oe=_;!B&&((I=this.serviceColloctor)!=null&&I.isOwn(_))&&(oe=this.serviceColloctor.getLocalId(_));const X=this.control.textEditorManager.get(oe);X&&s===C.Start&&this.targetText.set(oe,re(X))}this.targetText.size&&this.targetBox.set(b,n)}if(this.targetText.size&&s!==C.Start){const Q=this.targetBox.get(b);if(Q){const B=[n.w/Q.w,n.h/Q.h];for(const[_,oe]of this.targetText.entries()){const{opt:X}=oe,H=Math.floor(X.fontSize*B[0]),J=this.cacheTextInfo.get(_),W=!J&&X.fontSize!==H||J&&J.fontSize!==H||!1;if((w=this.control.textEditorManager.get(_))==null?void 0:w.waitWorker){console.log("showFloatBar--1");return}const R=(m=this.control.textEditorManager.get(_))==null?void 0:m.opt;if(W&&R&&X.boxSize&&X.boxPoint){const F=await this.control.textEditorManager.updateTextControllerWithEffectAsync({workId:_,opt:{...R,fontSize:H},viewId:r,canSync:!1,canWorker:!1,waitWorker:!0});F&&this.cacheTextInfo.set(_,{fontSize:F.opt.fontSize,boxSize:F.opt.boxSize,boxPoint:F.opt.boxPoint})}}U.textInfos=this.cacheTextInfo}}const O={workId:T,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:U,emitEventType:this.emitEventType,willRefreshSelector:!0,willSyncService:!0,viewId:r};s===C.Done&&(O.willSerializeData=!0,this.targetBox.delete(b),this.targetText.clear()),d.push([O,{workId:T,msgType:D.UpdateNode,emitEventType:this.emitEventType}]);continue}}s===C.Start?this.mainEngine.unWritable():s===C.Done&&this.mainEngine.abled(),d.length&&this.collectForLocalWorker(d)}}class iM extends me{constructor(){super(...arguments);f(this,"emitEventType",x.RotateNode);f(this,"cacheOriginRotate",0)}collect(e){var g,v,y,p,I;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,angle:n,workState:s,viewId:r}=e,a=this.control.viewContainerManager.getView(r);if(!(a!=null&&a.displayer))return;const c=a.focusScenePath,l=[...i],u=(g=this.serviceColloctor)==null?void 0:g.storage,M=[],d=s===C.Start&&Date.now()||void 0;for(d&&this.mainEngine.internalMsgEmitter.emit("addUndoTicker",d,r);l.length;){const w=l.pop();if(!w)continue;const m=w.toString(),T=this.serviceColloctor.isLocalId(m),z=T&&this.serviceColloctor.transformKey(w)||m;let j=m;!T&&this.serviceColloctor.isOwn(j)&&(j=this.serviceColloctor.getLocalId(j));const E=u[r][c][z];if(E&&j===k){if(((v=E.selectIds)==null?void 0:v.length)===1){const b=E.selectIds[0];if(s===C.Start){const Q=((y=this.serviceColloctor)==null?void 0:y.isLocalId(b))&&((p=this.serviceColloctor)==null?void 0:p.transformKey(b))||b,B=u[r][c][Q];this.cacheOriginRotate=((I=B==null?void 0:B.opt)==null?void 0:I.rotate)||0}const P=E.updateNodeOpt||{};P.angle=(n+this.cacheOriginRotate)%360,P.workState=s;const U={workId:w,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:P,emitEventType:this.emitEventType,willRefreshSelector:!1,willSyncService:!0,viewId:r};s===C.Done&&(U.willRefreshSelector=!0,U.willSerializeData=!0,this.cacheOriginRotate=0),M.push([U,{workId:w,msgType:D.UpdateNode,emitEventType:this.emitEventType}])}continue}}s===C.Start?this.mainEngine.unWritable():s===C.Done&&this.mainEngine.abled(),M.length&&this.collectForLocalWorker(M)}}function oM(o){switch(o){case N.Text:return Se.Text;case N.SpeechBalloon:case N.Star:case N.Ellipse:case N.Rectangle:case N.Triangle:case N.Rhombus:case N.Polygon:return Se.Shape}}class nM extends me{constructor(){super(...arguments);f(this,"emitEventType",x.SetFontStyle)}setTextStyle(e,i,n,s){const{bold:r,underline:a,lineThrough:c,italic:l,fontSize:u}=n;if(i.toolsType){const M=oM(i.toolsType);M===Se.Text&&(i.opt&&(r&&(i.opt.bold=r),we(a)&&(i.opt.underline=a),we(c)&&(i.opt.lineThrough=c),l&&(i.opt.italic=l),u&&(i.opt.fontSize=u)),this.control.textEditorManager.updateTextForMasterController({workId:e,opt:i.opt,viewId:s,canSync:!0,canWorker:!0})),Se.Shape}}collect(e){var p,I,w,m;if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,bold:n,italic:s,lineThrough:r,underline:a,viewId:c,fontSize:l}=e,u=this.control.viewContainerManager.getView(c);if(!(u!=null&&u.displayer))return;const M=u.focusScenePath,d=[...i],g=this.serviceColloctor.storage,v={},y=Date.now();for(this.mainEngine.internalMsgEmitter.emit("addUndoTicker",y,c);d.length;){const T=d.pop();if(!T)continue;const z=T.toString(),j=this.serviceColloctor.isLocalId(z),E=j?this.serviceColloctor.transformKey(T):z;let b=z;!j&&this.serviceColloctor.isOwn(b)&&(b=this.serviceColloctor.getLocalId(b));const P=g[c][M][E]||void 0;if(P){const U=P.updateNodeOpt||{};if(n&&(U.bold=n,v.bold=n==="bold"),s&&(U.italic=s,v.italic=s==="italic"),we(r)&&(U.lineThrough=r,v.lineThrough=r),we(a)&&(U.underline=a,v.underline=a),l&&(U.fontSize=l,v.textSize=l),P.toolsType===N.Text&&P.opt){this.setTextStyle(b,re(P),U,c);continue}if(P&&b===k&&((p=P.selectIds)!=null&&p.length))for(const O of P.selectIds){const Q=(I=this.serviceColloctor)==null?void 0:I.isLocalId(O);let B=Q&&((w=this.serviceColloctor)==null?void 0:w.transformKey(O))||O;const _=g[c][M][B]||void 0;if(!Q&&((m=this.serviceColloctor)!=null&&m.isOwn(B))&&(B=this.serviceColloctor.getLocalId(B)),_&&_.toolsType===N.Text&&P.opt){this.setTextStyle(B,re(_),U,c);continue}}}}Object.keys(v).length&&setTimeout(()=>{var T;(T=this.control.room)==null||T.setMemberState(v)},0)}}class sM extends me{constructor(){super(...arguments);f(this,"emitEventType",x.SetPoint);f(this,"undoTickerId")}collect(e){var w;if(!this.serviceColloctor||!this.mainEngine)return;const{workId:i,pointMap:n,workState:s,viewId:r}=e,a=this.control.viewContainerManager.getView(r);if(!(a!=null&&a.displayer))return;const c=a.focusScenePath,l=(w=this.serviceColloctor)==null?void 0:w.storage,u=[],M=s===C.Start&&Date.now()||void 0;M&&(this.undoTickerId=M,this.mainEngine.internalMsgEmitter.emit("addUndoTicker",M,r));const d=i;if(!d)return;const g=d.toString(),v=this.serviceColloctor.isLocalId(g),y=v&&this.serviceColloctor.transformKey(d)||g;let p=g;!v&&this.serviceColloctor.isOwn(p)&&(p=this.serviceColloctor.getLocalId(p));const I=l[r][c][y];if(I&&p===k&&I.selectIds){const m=I.updateNodeOpt||{};m.pointMap=n,m.workState=s;const T={workId:d,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:m,emitEventType:this.emitEventType,willRefreshSelector:!0,willSyncService:!0,viewId:r};s===C.Done&&(T.undoTickerId=this.undoTickerId),u.push([T,{workId:d,msgType:D.UpdateNode,emitEventType:this.emitEventType}])}s===C.Start?this.mainEngine.unWritable():s===C.Done&&this.mainEngine.abled(),u.length&&this.collectForLocalWorker(u)}}class rM extends me{constructor(){super(...arguments);f(this,"emitEventType",x.SetLock)}collect(e){if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,isLocked:n,viewId:s}=e,r=this.control.viewContainerManager.getView(s);if(!(r!=null&&r.displayer))return;const a=r.focusScenePath,c=[...i],l=this.serviceColloctor.storage,u=[],M=Date.now();for(;c.length;){const d=c.pop();if(!d)continue;const g=d.toString(),v=this.serviceColloctor.isLocalId(g),y=v?this.serviceColloctor.transformKey(d):g;let p=g;!v&&this.serviceColloctor.isOwn(p)&&(p=this.serviceColloctor.getLocalId(p));const I=l[s][a][y]||void 0;if(I){const w=I.updateNodeOpt||{};w.isLocked=n;const m={workId:p,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:w,emitEventType:this.emitEventType,willRefresh:!0,willRefreshSelector:!0,willSyncService:!0,viewId:s};u.push([m,{workId:p,msgType:D.UpdateNode,emitEventType:this.emitEventType}])}}this.mainEngine.internalMsgEmitter.emit("addUndoTicker",M,s),u.length&&this.collectForLocalWorker(u)}}class aM extends me{constructor(){super(...arguments);f(this,"emitEventType",x.SetShapeOpt)}collect(e){if(!this.serviceColloctor||!this.mainEngine)return;const{workIds:i,viewId:n,...s}=e,r=this.control.viewContainerManager.getView(n);if(!(r!=null&&r.displayer))return;const a=r.focusScenePath,c=[...i],l=this.serviceColloctor.storage,u=[],M=Date.now();for(;c.length;){const d=c.pop();if(!d)continue;const g=d.toString(),v=this.serviceColloctor.isLocalId(g),y=v?this.serviceColloctor.transformKey(d):g;let p=g;!v&&this.serviceColloctor.isOwn(p)&&(p=this.serviceColloctor.getLocalId(p));const I=l[n][a][y]||void 0;if(I){const w={...I.updateNodeOpt,...s,willRefresh:!0};if(I&&p===k){const m={workId:p,msgType:D.UpdateNode,dataType:G.Local,updateNodeOpt:w,emitEventType:this.emitEventType,willRefresh:!0,willRefreshSelector:!0,willSyncService:!0,viewId:n};u.push([m,{workId:p,msgType:D.UpdateNode,emitEventType:this.emitEventType}])}}}u.length&&(this.mainEngine.internalMsgEmitter.emit("addUndoTicker",M,n),this.collectForLocalWorker(u))}}class Z{constructor(t){f(this,"builders",new Map);this.builders=new Map(t.map(e=>[e,this.build(e)]))}build(t){switch(t){case x.TranslateNode:return new Xg;case x.ZIndexNode:return new _g;case x.CopyNode:return new Kg;case x.SetColorNode:return new qg;case x.DeleteNode:return new eM;case x.ScaleNode:return new tM;case x.RotateNode:return new iM;case x.SetFontStyle:return new nM;case x.SetPoint:return new sM;case x.SetLock:return new rM;case x.SetShapeOpt:return new aM}}getBuilder(t){return this.builders.get(t)}registerForMainEngine(t,e){return this.builders.forEach(i=>{i&&i.registerForMainEngine(t,e)}),this}destroy(){this.builders.forEach(t=>{t&&t.destroy()})}static emitMethod(t,e,i){me.dispatch(t,e,i)}}class cM{constructor(){f(this,"maxLastSyncTime",500)}setCurrentToolsData(t){this.currentToolsData=t}getCurrentToolsData(){return this.currentToolsData}setCurrentLocalWorkData(t){this.currentLocalWorkData=t}getWorkId(){return this.currentLocalWorkData.workId}getWorkState(){return this.currentLocalWorkData.workState}}class lM extends cM{constructor(e){var s,r;super();f(this,"isActive",!1);f(this,"currentToolsData");f(this,"currentLocalWorkData");f(this,"control");f(this,"internalMsgEmitter");f(this,"taskBatchData",new Set);f(this,"fullWorker");f(this,"subWorker");f(this,"fullWorkerUrl");f(this,"subWorkerUrl");f(this,"methodBuilder");f(this,"zIndexNodeMethod");f(this,"subWorkerDrawCount",0);f(this,"wokerDrawCount",0);f(this,"maxDrawCount",0);f(this,"cacheDrawCount",0);f(this,"reRenders",[]);f(this,"localWorkViewId");f(this,"localPointsBatchData",[]);f(this,"tasksqueue",new Map);f(this,"useTasksqueue",!1);f(this,"useTasksClockId");f(this,"mianTasksqueueCount");f(this,"workerTasksqueueCount");f(this,"snapshotMap",new Map);f(this,"boundingRectMap",new Map);f(this,"clearAllResolve");f(this,"delayWorkStateToDone");f(this,"delayWorkStateToDoneResolve");f(this,"animationId");f(this,"tmpImageConfigMap",new Map);f(this,"mainThread");const{control:i,internalMsgEmitter:n}=e;this.control=i,this.maxLastSyncTime=(((r=(s=this.control.pluginOptions)==null?void 0:s.syncOpt)==null?void 0:r.interval)||this.maxLastSyncTime)*.5,this.fullWorkerUrl=this.control.pluginOptions.cdn.fullWorkerUrl,this.subWorkerUrl=this.control.pluginOptions.cdn.subWorkerUrl,this.internalMsgEmitter=n,this.currentLocalWorkData={workState:C.Pending}}get viewContainerManager(){return this.control.viewContainerManager}get collector(){return this.control.collector}get isRunSubWork(){var i;const e=(i=this.currentToolsData)==null?void 0:i.toolsType;return e===N.Pencil||e===N.LaserPen||e===N.Arrow||e===N.Straight||e===N.Ellipse||e===N.Rectangle||e===N.Star||e===N.Polygon||e===N.SpeechBalloon}get isCanDrawWork(){var i;const e=(i=this.currentToolsData)==null?void 0:i.toolsType;return e===N.Pencil||e===N.LaserPen||e===N.Arrow||e===N.Straight||e===N.Ellipse||e===N.Rectangle||e===N.Star||e===N.Polygon||e===N.SpeechBalloon||e===N.Triangle||e===N.Rhombus}get isUseZIndex(){var i;const e=(i=this.currentToolsData)==null?void 0:i.toolsType;return e===N.Pencil||e===N.Arrow||e===N.Straight||e===N.Ellipse||e===N.Rectangle||e===N.Star||e===N.Polygon||e===N.SpeechBalloon||e===N.Text||e===N.Image}get isCanRecordUndoRedo(){var i;const e=(i=this.currentToolsData)==null?void 0:i.toolsType;return e===N.Pencil||e===N.Eraser||e===N.Arrow||e===N.Straight||e===N.Ellipse||e===N.Rectangle||e===N.Star||e===N.Polygon||e===N.SpeechBalloon||e===N.Text||e===N.Image}get isCanSentCursor(){var i;const e=(i=this.currentToolsData)==null?void 0:i.toolsType;return e===N.Pencil||e===N.Text||e===N.LaserPen||e===N.Arrow||e===N.Straight||e===N.Ellipse||e===N.Rectangle||e===N.Star||e===N.Polygon||e===N.SpeechBalloon||e===N.Triangle||e===N.Rhombus}async init(){await this.on(),this.internalMsgEmitterListener(),this.isActive=!0}async on(){if(!this.control.hasOffscreenCanvas()){console.info("no OffscreenCanvas");const{MainThreadManagerImpl:e}=await Promise.resolve().then(()=>require("./index-Bm7SZAO2.js"));this.mainThread=new e(this);return}if(!this.fullWorkerUrl||!this.subWorkerUrl){console.error("no worker url config");return}this.fullWorker=new Worker(this.fullWorkerUrl,{type:"classic"}),this.subWorker=new Worker(this.subWorkerUrl,{type:"classic"}),this.fullWorker.onmessage=e=>{if(e.data){const{render:i,sp:n,drawCount:s,workerTasksqueueCount:r}=e.data;if(r&&(this.workerTasksqueueCount=r),n!=null&&n.length&&this.collectorSyncData(n),!s&&(i!=null&&i.length)){this.viewContainerManager.render(i);return}s&&(this.wokerDrawCount=s,this.wokerDrawCount<1/0?this.maxDrawCount=Math.max(this.maxDrawCount,this.wokerDrawCount):(this.maxDrawCount=0,this.clearReRenders()),i!=null&&i.length&&(this.viewContainerManager.render(i),this.wokerDrawCount<=this.subWorkerDrawCount&&this.reRenders.length&&(this.viewContainerManager.render(this.reRenders.map(a=>({...a,isUnClose:!1}))),this.reRenders.length=0)))}},this.subWorker.onmessage=e=>{if(e.data){const{render:i,drawCount:n,sp:s}=e.data;if(s!=null&&s.length&&this.collectorSyncData(s),!n&&(i!=null&&i.length)){this.viewContainerManager.render(i);return}n&&(this.subWorkerDrawCount=n,this.wokerDrawCount<1/0&&(this.maxDrawCount=Math.max(this.maxDrawCount,this.subWorkerDrawCount)),i!=null&&i.length&&(this.subWorkerDrawCount>this.wokerDrawCount?i.forEach(r=>{r.imageBitmap&&(r.isUnClose=!0,this.reRenders.push(r))}):this.reRenders.length&&this.clearReRenders(),this.wokerDrawCount<1/0&&this.viewContainerManager.render(i)))}}}clearReRenders(){this.reRenders.length&&(this.reRenders.forEach(e=>{var i;e.imageBitmap&&((i=e.imageBitmap)==null||i.close())}),this.reRenders.length=0)}setMaxDrawCount(e){this.maxDrawCount=e}setWorkerTasksqueueCount(e){this.workerTasksqueueCount=e}collectorSyncData(e){var n,s;let i=!1;for(const r of e){const{type:a,selectIds:c,opt:l,selectRect:u,strokeColor:M,fillColor:d,willSyncService:g,isSync:v,imageBitmap:y,canvasHeight:p,canvasWidth:I,rect:w,op:m,canTextEdit:T,points:z,selectorColor:j,canRotate:E,scaleType:b,textOpt:P,toolsType:U,workId:O,viewId:Q,dataType:B,canLock:_,isLocked:oe,shapeOpt:X,toolsTypes:H}=r;if(!Q){console.error("collectorSyncData",r);return}const J=r.scenePath||this.viewContainerManager.getCurScenePath(Q);switch(a){case D.Select:{const W=c!=null&&c.length?{...u,selectIds:c,canvasHeight:p,canvasWidth:I,points:z}:void 0;W&&(l!=null&&l.strokeColor)&&(W.selectorColor=l.strokeColor),W&&j&&(W.selectorColor=j),W&&M&&(W.strokeColor=M),W&&(l!=null&&l.fillColor)&&(W.fillColor=l.fillColor),W&&d&&(W.fillColor=d),W&&we(E)&&(W.canRotate=E),W&&b&&(W.scaleType=b),W&&T&&(W.canTextEdit=T),W&&P&&(W.textOpt=P),W&&we(_)&&(W.canLock=_),W&&we(oe)&&(W.isLocked=oe),W&&X&&(W.shapeOpt=X),W&&H&&(W.toolsTypes=H),Q&&this.viewContainerManager.showFloatBar(Q,!!W,W),g&&((n=this.collector)==null||n.dispatch({type:a,selectIds:c,opt:l,isSync:v,viewId:Q,scenePath:J}));break}case D.Snapshot:if(y&&J){const W=this.snapshotMap.get(J);W&&W(y)}break;case D.BoundingBox:if(w&&J){const W=this.boundingRectMap.get(J);W&&W(w)}break;case D.Cursor:m&&this.control.cursor.collectServiceCursor({...r});break;case D.Clear:Q&&this.viewContainerManager.showFloatBar(Q,!1),Q&&this.clearAllResolve&&this.clearAllResolve(Q);break;case D.TextUpdate:if(U===N.Text&&O&&Q){const W=this.viewContainerManager.transformToOriginPoint((l==null?void 0:l.boxPoint)||[0,0],Q),Y=(l==null?void 0:l.boxSize)||[0,0],R=(s=this.viewContainerManager.getView(Q))==null?void 0:s.cameraOpt;l?this.control.textEditorManager.updateTextForWorker({x:W[0],y:W[1],w:Y[0],h:Y[1],scale:(R==null?void 0:R.scale)||1,workId:O,opt:l,dataType:B,viewId:Q,canSync:g||!1,canWorker:!1}):this.control.textEditorManager.delete(O,g||!1,!1)}break;case D.GetTextActive:U===N.Text&&O&&Q&&this.control.textEditorManager.updateTextForWorker({workId:O,isActive:!0,viewId:Q,dataType:G.Local,canWorker:!1,canSync:!0},Date.now());break;default:i=!0;break}}i&&qe(()=>{this.collectorAsyncData(e)},this.maxLastSyncTime)}collectorAsyncData(e){var i,n,s,r;for(const a of e){const{type:c,op:l,workId:u,index:M,removeIds:d,ops:g,opt:v,updateNodeOpt:y,toolsType:p,isSync:I,viewId:w}=a;if(!w){console.error("collectorAsyncData",a);return}const m=a.scenePath||this.viewContainerManager.getCurScenePath(w);switch(c){case D.DrawWork:{(i=this.collector)==null||i.dispatch({type:c,op:l,workId:u,index:M,isSync:I,viewId:w,scenePath:m});break}case D.FullWork:{(n=this.collector)==null||n.dispatch({type:c,ops:g,workId:u,updateNodeOpt:y,opt:v,toolsType:p,isSync:I,viewId:w,scenePath:m});break}case D.UpdateNode:{(s=this.collector)==null||s.dispatch({type:c,updateNodeOpt:y,workId:u,opt:v,ops:g,op:l,isSync:I,viewId:w,scenePath:m});break}case D.RemoveNode:{d&&this.control.textEditorManager.deleteBatch(d,!1,!1),(r=this.collector)==null||r.dispatch({type:c,removeIds:d,isSync:I,viewId:w,scenePath:m});break}}}}async onLocalEventEnd(e,i){var c;const n=this.currentLocalWorkData.workState,s=this.viewContainerManager.getView(i);if(!s)return;const{focusScenePath:r,cameraOpt:a}=s;if(n===C.Start||n===C.Doing){const l=this.viewContainerManager.transformToScenePoint(e,i);this.pushPoint(l),this.setCurrentLocalWorkData({...this.currentLocalWorkData,workState:C.Done}),await new Promise(u=>{this.delayWorkStateToDone=setTimeout(()=>{var d,g;this.delayWorkStateToDone=void 0,this.runAnimation();const M=(d=this.currentLocalWorkData.workId)==null?void 0:d.toString();M&&r&&this.control.runEffectWork(()=>{var v;this.setShapeSelectorByWorkId(M,i),((v=this.currentToolsData)==null?void 0:v.toolsType)===N.Selector&&this.viewContainerManager.activeFloatBar(i)}),this.delayWorkStateToDoneResolve=u,((g=this.currentToolsData)==null?void 0:g.toolsType)===N.Selector&&this.viewContainerManager.activeFloatBar(i)},0)}).then(()=>{this.delayWorkStateToDoneResolve=void 0})}else if(((c=this.currentToolsData)==null?void 0:c.toolsType)===N.Text){const l=this.viewContainerManager.transformToScenePoint(e,i);if(this.localPointsBatchData[0]===l[0]&&this.localPointsBatchData[1]===l[1]){const u=this.currentToolsData.toolsOpt;u.workState=C.Doing,u.boxPoint=l,u.boxSize=[u.fontSize,u.fontSize],this.control.textEditorManager.checkEmptyTextBlur(),this.control.textEditorManager.createTextForMasterController({workId:Date.now().toString(),x:e[0],y:e[1],scale:(a==null?void 0:a.scale)||1,opt:u,type:Se.Text,isActive:!0,viewId:i,scenePath:r},Date.now())}this.clearLocalPointsBatchData()}}onLocalEventDoing(e,i){const n=this.currentLocalWorkData.workState;if(n===C.Start&&this.setCurrentLocalWorkData({...this.currentLocalWorkData,workState:C.Doing}),this.delayWorkStateToDone,n===C.Doing||this.delayWorkStateToDone){const s=this.viewContainerManager.transformToScenePoint(e,i);this.pushPoint(s),this.delayWorkStateToDone,!this.delayWorkStateToDone&&this.runAnimation();return}this.hoverCursor(e,i)}onLocalEventStart(e,i){var a,c,l,u,M,d,g,v;this.viewContainerManager.focuedViewId!==i&&this.viewContainerManager.setFocuedViewId(i),this.clearLocalPointsBatchData();const n=this.viewContainerManager.transformToScenePoint(e,i);if(this.pushPoint(n),((a=this.currentToolsData)==null?void 0:a.toolsType)===N.Text)return;this.control.textEditorManager.checkEmptyTextBlur();const s=((c=this.currentToolsData)==null?void 0:c.toolsType)===N.Selector?k:Date.now(),r=this.setZIndex(i);if(this.setCurrentLocalWorkData({workId:s,workState:C.Start,toolsOpt:r,viewId:i}),this.isCanRecordUndoRedo&&this.internalMsgEmitter.emit("addUndoTicker",s,i),this.maxDrawCount=0,this.cacheDrawCount=0,this.wokerDrawCount=0,this.subWorkerDrawCount=0,this.reRenders.length=0,s&&r&&((l=this.currentToolsData)!=null&&l.toolsType)&&this.prepareOnceWork({workId:s,toolsOpt:r,viewId:i},(u=this.currentToolsData)==null?void 0:u.toolsType),this.isCanDrawWork){const y=this.viewContainerManager.getCurScenePath(i);(d=this.collector)==null||d.dispatch({type:D.CreateWork,workId:s,toolsType:(M=this.currentToolsData)==null?void 0:M.toolsType,opt:r,viewId:i,scenePath:y}),y&&((g=this.collector)!=null&&g.hasSelector(i,y))&&this.blurSelector(i,y)}else((v=this.currentToolsData)==null?void 0:v.toolsType)===N.Selector&&this.viewContainerManager.unActiveFloatBar(i);this.consume()}pushPoint(e){this.localPointsBatchData.push(e[0],e[1])}correctStorage(e,i,n){var c;const s=new Map,r=[];Object.keys(e).forEach(l=>{var M,d;const u=(d=(M=e[l])==null?void 0:M.opt)==null?void 0:d.zIndex;ae(u)&&r.push([l,u])});const a=r.length&&((c=this.zIndexNodeMethod)==null?void 0:c.correct(r))||[];this.zIndexNodeMethod&&a.length&&(this.zIndexNodeMethod.setMinZIndex(a[0][1]||0,i),this.zIndexNodeMethod.setMaxZIndex(a[a.length-1][1]||0,i));for(const[l,u]of a){if(!e[l])continue;const M=e[l];M.opt&&ae(M.opt.zIndex)&&M.opt.zIndex!==u&&(M.opt.zIndex=u,s.set(l,M))}return s.size&&s.forEach((l,u)=>{var M;console.log("key",l),(M=this.collector)==null||M.updateValue(u,l,{viewId:i,scenePath:n,isSync:!0}),e[u]=l}),e}async originalEventLintener(e,i,n){if(this.isAbled())switch(e){case C.Start:this.setLocalWorkViewId(n),n&&this.onLocalEventStart(i,n);break;case C.Doing:n&&n===this.getLocalWorkViewId()&&this.onLocalEventDoing(i,n);break;case C.Done:n&&n===this.getLocalWorkViewId()&&await this.onLocalEventEnd(i,n);break}}getLocalWorkViewId(){return this.localWorkViewId}setLocalWorkViewId(e){this.localWorkViewId=e}setCurrentToolsData(e){var s,r,a;const i=e.toolsType,n=((s=this.currentToolsData)==null?void 0:s.toolsType)!==e.toolsType;if(!this.isActive&&n){setTimeout(()=>{this.setCurrentToolsData(e)},50);return}if(super.setCurrentToolsData(e),n){const c=(r=this.viewContainerManager)==null?void 0:r.getAllViews();for(const l of c)if(l){const{id:u,focusScenePath:M}=l;n&&u&&M&&((a=this.collector)!=null&&a.hasSelector(u,M)&&this.blurSelector(u,M),this.control.textEditorManager.checkEmptyTextBlur())}this.taskBatchData.add({msgType:D.UpdateTools,dataType:G.Local,toolsType:i,opt:{...e.toolsOpt,syncUnitTime:this.maxLastSyncTime},isRunSubWork:this.isRunSubWork,viewId:Ao}),this.runAnimation()}}setCurrentLocalWorkData(e){super.setCurrentLocalWorkData(e);const{workId:i}=e;(!this.isAbled()||!i)&&this.clearLocalPointsBatchData()}prepareOnceWork(e,i){const{workId:n,toolsOpt:s,viewId:r}=e;this.taskBatchData.add({msgType:D.CreateWork,workId:n,toolsType:i,opt:{...s,syncUnitTime:this.maxLastSyncTime},dataType:G.Local,isRunSubWork:this.isRunSubWork,viewId:r}),this.runAnimation()}createViewWorker(e,i){const{offscreenCanvasOpt:n,layerOpt:s,dpr:r,cameraOpt:a}=i;this.taskBatchData.add({msgType:D.Init,dataType:G.Local,viewId:e,offscreenCanvasOpt:n,layerOpt:s,dpr:r,cameraOpt:a,isRunSubWork:!0,isSafari:navigator.userAgent.indexOf("Safari")!==-1&&navigator.userAgent.indexOf("Chrome")===-1}),this.runAnimation()}destroyViewWorker(e,i=!1){var n;this.getLocalWorkViewId()===e&&this.setLocalWorkViewId(void 0),this.zIndexNodeMethod&&this.zIndexNodeMethod.clearZIndex(e),this.taskBatchData.add({msgType:D.Destroy,dataType:G.Local,viewId:e,isRunSubWork:!0}),this.runAnimation(),i||(n=this.collector)==null||n.dispatch({type:D.Clear,viewId:e})}onServiceDerive(e,i){var g,v,y,p;const{newValue:n,oldValue:s,viewId:r,scenePath:a}=i,c=re(n)||{},l=e;let u=c.type;if(!n&&s&&(u=D.RemoveNode,s.toolsType===N.LaserPen))return;const M=(g=this.viewContainerManager.getView(r))==null?void 0:g.focusScenePath;if(M&&M!==a)return;if(u&&l){const I=c;if(I.workId=(v=this.collector)!=null&&v.isOwn(l)?(y=this.collector)==null?void 0:y.getLocalId(l):l,I.msgType=u,I.toolsType===N.LaserPen&&(I.isRunSubWork=!0),I.dataType=G.Service,I.viewId=r,I.scenePath=a,I.selectIds&&(I.selectIds=I.selectIds.map(w=>{var m,T;return(m=this.collector)!=null&&m.isOwn(w)?(T=this.collector)==null?void 0:T.getLocalId(w):w})),I&&I.toolsType===N.Text||(s==null?void 0:s.toolsType)===N.Text){this.control.textEditorManager.onServiceDerive(I);return}this.taskBatchData.add(I)}this.runAnimation();const d=i.newValue&&((p=i.newValue.opt)==null?void 0:p.zIndex);if(this.zIndexNodeMethod&&ae(d)){const I=this.zIndexNodeMethod.getMinZIndex(r);this.zIndexNodeMethod.getMaxZIndex(r)<d&&this.zIndexNodeMethod.setMaxZIndex(d,r),I>d&&this.zIndexNodeMethod.setMinZIndex(d,r)}}pullServiceData(e,i){var s,r,a,c;let n=(s=this.collector)==null?void 0:s.getStorageData(e,i);if(n){n=this.correctStorage(n,e,i);const l=Object.keys(n);for(const u of l){const M=(r=n[u])==null?void 0:r.type;if(M&&u){const d=n[u];if(d.workId=(a=this.collector)!=null&&a.isOwn(u)?(c=this.collector)==null?void 0:c.getLocalId(u):u,d.msgType=M,d.dataType=G.Service,d.viewId=e,d.scenePath=i,d.useAnimation=!1,d.selectIds&&(d.selectIds=d.selectIds.map(g=>{var v,y;return(v=this.collector)!=null&&v.isOwn(g)?(y=this.collector)==null?void 0:y.getLocalId(g):g})),d.toolsType===N.Text){this.control.textEditorManager.onServiceDerive(d);continue}this.taskBatchData.add(d)}this.internalMsgEmitter.emit("excludeIds",l,e)}this.runAnimation()}}runAnimation(){this.animationId||(this.animationId=requestAnimationFrame(this.consume.bind(this)))}consume(){this.animationId=void 0;const{workState:e,viewId:i,workId:n}=this.currentLocalWorkData;if(!this.isAbled()&&this.clearLocalPointsBatchData(),this.tasksqueue.size){const s=this.consumeQueue();s.size&&(this.post(s),this.tasksqueue.clear())}else if(!this.delayWorkStateToDone){if(e!==C.Pending&&this.localPointsBatchData.length&&i){let s=!1;this.wokerDrawCount!==1/0&&this.wokerDrawCount<=this.subWorkerDrawCount&&this.cacheDrawCount<this.maxDrawCount&&(s=!0),this.maxDrawCount||(s=!0),s&&(this.taskBatchData.add({op:this.localPointsBatchData.map(r=>r),workState:e,workId:n,dataType:G.Local,msgType:D.DrawWork,isRunSubWork:this.isRunSubWork,viewId:i,scenePath:i&&this.viewContainerManager.getCurScenePath(i)}),this.delayWorkStateToDoneResolve&&e===C.Done&&this.delayWorkStateToDoneResolve(!0),this.clearLocalPointsBatchData(),this.cacheDrawCount=this.maxDrawCount)}this.taskBatchData.size&&(this.post(this.taskBatchData),this.taskBatchData.clear())}(this.tasksqueue.size||this.taskBatchData.size||this.localPointsBatchData.length)&&(this.animationId=requestAnimationFrame(this.consume.bind(this)))}unWritable(){this.setCurrentLocalWorkData({workState:C.Unwritable,workId:void 0})}abled(){this.setCurrentLocalWorkData({workState:C.Pending,workId:void 0})}isAbled(){return this.currentLocalWorkData.workState!==C.Unwritable}post(e){if(!this.control.hasOffscreenCanvas()&&this.mainThread){this.mainThread.consume(e);return}this.fullWorker.postMessage(e);const i=new Set;for(const n of e.values()){const s=n.msgType;(s===D.Init||s===D.Clear||s===D.Destroy||s===D.UpdateCamera||n.isRunSubWork)&&i.add(n)}i.size&&this.subWorker.postMessage(i)}destroy(){this.unWritable(),this.taskBatchData.clear(),this.tmpImageConfigMap.clear(),this.clearLocalPointsBatchData(),this.fullWorker.terminate(),this.subWorker.terminate(),this.isActive=!1}updateNode(e,i,n,s){this.taskBatchData.add({msgType:D.UpdateNode,workId:e,updateNodeOpt:i,viewId:n,scenePath:s,dataType:G.Local}),this.runAnimation()}updateCamera(e,i){this.useTasksqueue||(this.useTasksqueue=!0,this.mianTasksqueueCount=1,this.workerTasksqueueCount=1),this.useTasksqueue&&(this.tasksqueue.set(e,{msgType:D.UpdateCamera,dataType:G.Local,cameraOpt:{...i,width:Math.floor(i.width),height:Math.floor(i.height)},isRunSubWork:!0,viewId:e}),this.control.textEditorManager.onCameraChange(i,e),this.runAnimation(),this.useTasksClockId&&clearTimeout(this.useTasksClockId),this.useTasksClockId=setTimeout(()=>{this.useTasksClockId=void 0,this.tasksqueue.clear(),this.useTasksqueue=!1,this.mianTasksqueueCount=void 0,this.workerTasksqueueCount=void 0},this.maxLastSyncTime))}consumeQueue(){const e=new Set;return this.mianTasksqueueCount&&this.workerTasksqueueCount&&this.mianTasksqueueCount===this.workerTasksqueueCount&&(this.mianTasksqueueCount++,e.add({msgType:D.TasksQueue,dataType:G.Local,isRunSubWork:!0,mainTasksqueueCount:this.mianTasksqueueCount,tasksqueue:this.tasksqueue,viewId:""})),e}async clearViewScenePath(e,i){var n;if(this.control.textEditorManager.clear(e,i),this.queryTaskBatchData({msgType:D.Clear,dataType:G.Local,viewId:e}).forEach(s=>{this.taskBatchData.delete(s)}),this.taskBatchData.add({dataType:G.Local,msgType:D.Clear,viewId:e}),this.runAnimation(),!i){const s=this.viewContainerManager.getCurScenePath(e);(n=this.collector)==null||n.dispatch({type:D.Clear,viewId:e,scenePath:s})}this.zIndexNodeMethod&&this.zIndexNodeMethod.clearZIndex(e),this.clearLocalPointsBatchData(),await new Promise(s=>{this.clearAllResolve=s}).then(()=>{this.clearAllResolve=void 0})}internalMsgEmitterListener(){var e;this.methodBuilder=new Z([x.CopyNode,x.SetColorNode,x.DeleteNode,x.RotateNode,x.ScaleNode,x.TranslateNode,x.ZIndexNode,x.RotateNode,x.SetFontStyle,x.SetPoint,x.SetLock,x.SetShapeOpt]).registerForMainEngine($.MainEngine,this.control),this.zIndexNodeMethod=(e=this.methodBuilder)==null?void 0:e.getBuilder(x.ZIndexNode)}setZIndex(e){const i=this.currentToolsData&&re(this.currentToolsData.toolsOpt);return i&&this.zIndexNodeMethod&&this.isUseZIndex&&(this.zIndexNodeMethod.addMaxLayer(e),i.zIndex=this.zIndexNodeMethod.getMaxZIndex(e)),i}clearLocalPointsBatchData(){this.localPointsBatchData.length=0}hoverCursor(e,i){var n;if(((n=this.currentToolsData)==null?void 0:n.toolsType)===N.Selector){const s=this.viewContainerManager.getView(i);if(s&&s.displayer&&s.displayer.vDom){const c=s.displayer.vDom.state.floatBarData;if(c){const{x:l,y:u,w:M,h:d}=c;if(Yo(e,{x:l,y:u,w:M,h:d}))return}}const r=this.viewContainerManager.transformToScenePoint(e,i),a={msgType:D.CursorHover,dataType:G.Local,point:r,toolsType:this.currentToolsData.toolsType,opt:this.currentToolsData.toolsOpt,isRunSubWork:!1,viewId:i};this.queryTaskBatchData({msgType:D.CursorHover,dataType:G.Local,toolsType:this.currentToolsData.toolsType,viewId:i}).forEach(c=>{this.taskBatchData.delete(c)}),this.taskBatchData.add(a),this.runAnimation()}}sendCursorEvent(e,i){if(!this.currentLocalWorkData||this.currentLocalWorkData.workState===C.Unwritable||!this.currentToolsData||!this.isCanSentCursor)return;let n=[void 0,void 0];this.currentToolsData&&(this.isCanDrawWork||this.currentToolsData.toolsType===N.Text)&&this.currentLocalWorkData.workState!==C.Start&&this.currentLocalWorkData.workState!==C.Doing&&(n=e,this.control.cursor.sendEvent(n,i))}getBoundingRect(e){var n,s;if(!((n=this.boundingRectMap)==null?void 0:n.get(e))){const r=(s=this.collector)==null?void 0:s.getScenePathData(e);if(!r)return;if(Object.keys(r).forEach(a=>{var c;((c=this.collector)==null?void 0:c.getLocalId(a))===k&&delete r[a]}),Object.keys(r).length&&this.viewContainerManager.mainView&&this.viewContainerManager.mainView.cameraOpt){const a={msgType:D.BoundingBox,dataType:G.Local,scenePath:e,scenes:r,cameraOpt:{...this.viewContainerManager.mainView.cameraOpt},isRunSubWork:!0,viewId:this.viewContainerManager.mainView.id};return this.taskBatchData.add(a),this.runAnimation(),new Promise(c=>{this.boundingRectMap.set(e,c)}).then(c=>(this.boundingRectMap.delete(e),c))}}}getSnapshot(e,i,n,s){var a,c,l,u,M,d;if(!((a=this.snapshotMap)==null?void 0:a.get(e))){const g=(c=this.collector)==null?void 0:c.getViewIdBySecenPath(e);if(!g)return;const v=(l=this.collector)==null?void 0:l.getStorageData(g,e);if(!v)return;if(Object.keys(v).forEach(y=>{var p;((p=this.collector)==null?void 0:p.getLocalId(y))===k&&delete v[y]}),Object.keys(v).length){const y=this.viewContainerManager.mainView;if(!y)return;const p=i||((u=y.cameraOpt)==null?void 0:u.width),I=n||((M=y.cameraOpt)==null?void 0:M.height),w={msgType:D.Snapshot,dataType:G.Local,scenePath:e,scenes:v,w:p,h:I,cameraOpt:s&&{...s,width:p,height:I}||y.cameraOpt,isRunSubWork:!0,viewId:y.id,maxZIndex:(d=this.zIndexNodeMethod)==null?void 0:d.getMaxZIndex(g)};return this.taskBatchData.add(w),this.runAnimation(),new Promise(m=>{this.snapshotMap.set(e,m)}).then(m=>(this.snapshotMap.delete(e),m))}}}queryTaskBatchData(e){const i=[];if(e)for(const n of this.taskBatchData.values()){let s=!0;for(const[r,a]of Object.entries(e))if(n[r]!==a){s=!1;break}s&&i.push(n)}return i}insertImage(e){const i=this.viewContainerManager.mainView,n=i==null?void 0:i.id,s=i==null?void 0:i.focusScenePath;if(n&&s){const{src:r,uuid:a}=e;if(a&&!r){this.tmpImageConfigMap.set(a,e);return}const c=Date.now();Ne.InternalMsgEmitter.emit("addUndoTicker",c,n);const l={...e};this.zIndexNodeMethod&&(this.zIndexNodeMethod.addMaxLayer(n),l.zIndex=this.zIndexNodeMethod.getMaxZIndex(n)),this.taskBatchData.add({msgType:D.FullWork,dataType:G.Local,toolsType:N.Image,workId:e.uuid,opt:l,viewId:n,willRefresh:!0,willSyncService:!0}),this.runAnimation()}}lockImage(e,i){var a,c;const n=this.viewContainerManager.mainView,s=n==null?void 0:n.id,r=n==null?void 0:n.focusScenePath;if(s&&r&&this.collector){const l=this.collector.getStorageData(s,r);if(!l)return;for(const[u,M]of Object.entries(l))if(M&&M.toolsType===N.Image&&M.opt.uuid===e){const d=Date.now();Ne.InternalMsgEmitter.emit("addUndoTicker",d,s);const g=(a=this.collector)!=null&&a.isOwn(u)?(c=this.collector)==null?void 0:c.getLocalId(u):u,v={...M.opt,locked:i};this.taskBatchData.add({msgType:D.FullWork,dataType:G.Local,toolsType:N.Image,workId:g,opt:v,viewId:s,willRefresh:!0,willSyncService:!0}),this.runAnimation();return}}}completeImageUpload(e,i){const n=this.viewContainerManager.mainView,s=n==null?void 0:n.id,r=n==null?void 0:n.focusScenePath;if(s&&r){const a=this.tmpImageConfigMap.get(e);a&&(a.src=i,this.insertImage(a),this.tmpImageConfigMap.delete(e));return}}getImagesInformation(e){const i=[];if(this.collector){const n=this.collector.getScenePathData(e);if(!n)return i;for(const s of Object.values(n))if(s&&s.toolsType===N.Image){const r=s.opt;i.push({uuid:r.uuid,centerX:r.centerX,centerY:r.centerY,width:r.width,height:r.height,locked:r.locked,uniformScale:r.uniformScale,crossOrigin:r.crossOrigin})}}return i}setShapeSelectorByWorkId(e,i){this.taskBatchData.add({workId:k,selectIds:[e],msgType:D.Select,dataType:G.Service,viewId:i,willSyncService:!0}),this.runAnimation()}blurSelector(e,i){this.taskBatchData.add({workId:k,selectIds:[],msgType:D.Select,dataType:G.Service,viewId:e,scenePath:i}),this.runAnimation()}}var hM=xe,uM=function(){return hM.Date.now()},dM=uM,gM=/\s/;function MM(o){for(var t=o.length;t--&&gM.test(o.charAt(t)););return t}var pM=MM,fM=pM,yM=/^\s+/;function IM(o){return o&&o.slice(0,fM(o)+1).replace(yM,"")}var vM=IM,wM=Ze,NM=Oe,mM="[object Symbol]";function TM(o){return typeof o=="symbol"||NM(o)&&wM(o)==mM}var zM=TM,CM=vM,Gi=Re,jM=zM,Ji=NaN,SM=/^[-+]0x[0-9a-f]+$/i,xM=/^0b[01]+$/i,DM=/^0o[0-7]+$/i,LM=parseInt;function kM(o){if(typeof o=="number")return o;if(jM(o))return Ji;if(Gi(o)){var t=typeof o.valueOf=="function"?o.valueOf():o;o=Gi(t)?t+"":t}if(typeof o!="string")return o===0?o:+o;o=CM(o);var e=xM.test(o);return e||DM.test(o)?LM(o.slice(2),e?2:8):SM.test(o)?Ji:+o}var AM=kM,bM=Re,Et=dM,Ki=AM,EM="Expected a function",OM=Math.max,YM=Math.min;function PM(o,t,e){var i,n,s,r,a,c,l=0,u=!1,M=!1,d=!0;if(typeof o!="function")throw new TypeError(EM);t=Ki(t)||0,bM(e)&&(u=!!e.leading,M="maxWait"in e,s=M?OM(Ki(e.maxWait)||0,t):s,d="trailing"in e?!!e.trailing:d);function g(j){var E=i,b=n;return i=n=void 0,l=j,r=o.apply(b,E),r}function v(j){return l=j,a=setTimeout(I,t),u?g(j):r}function y(j){var E=j-c,b=j-l,P=t-E;return M?YM(P,s-b):P}function p(j){var E=j-c,b=j-l;return c===void 0||E>=t||E<0||M&&b>=s}function I(){var j=Et();if(p(j))return w(j);a=setTimeout(I,y(j))}function w(j){return a=void 0,d&&i?g(j):(i=n=void 0,r)}function m(){a!==void 0&&clearTimeout(a),l=0,i=c=n=a=void 0}function T(){return a===void 0?r:w(Et())}function z(){var j=Et(),E=p(j);if(i=arguments,n=this,c=j,E){if(a===void 0)return v(c);if(M)return clearTimeout(a),a=setTimeout(I,t),g(c)}return a===void 0&&(a=setTimeout(I,t)),r}return z.cancel=m,z.flush=T,z}var Ro=PM;const RM=He(Ro);var WM=Ro,UM=Re,$M="Expected a function";function BM(o,t,e){var i=!0,n=!0;if(typeof o!="function")throw new TypeError($M);return UM(e)&&(i="leading"in e?!!e.leading:i,n="trailing"in e?!!e.trailing:n),WM(o,t,{leading:i,maxWait:t,trailing:n})}var FM=BM;const Ie=He(FM);class QM{constructor(t){f(this,"internalMsgEmitter");f(this,"control");f(this,"roomHotkeyCheckers");f(this,"tmpCopyStore",new Map);f(this,"tmpCopyCoordInfo");var n;const{control:e,internalMsgEmitter:i}=t;this.control=e,this.internalMsgEmitter=i,this.roomHotkeyCheckers=((n=this.control.room)==null?void 0:n.viewsParams.hotKeys.nodes)||[]}get isUseSelf(){var t;return((t=this.control.room)==null?void 0:t.disableDeviceInputs)||!1}get isSelector(){var t;return((t=this.control.worker.currentToolsData)==null?void 0:t.toolsType)===N.Selector}get collector(){return this.control.collector}get mainEngine(){return this.control.worker}get keyboardKind(){return/^Mac/i.test(navigator.platform)?"mac":"windows"}getEventKey(t){switch(t.type){case"keydown":return"KeyDown"}return"KeyUp"}onActiveHotkey(t){var n,s,r;console.log("onActiveHotkey---sdk",t);const e=this.control.viewContainerManager.focuedViewId,i=(n=this.control.viewContainerManager.focuedView)==null?void 0:n.focusScenePath;if(e&&i)switch(t){case"delete":this.isSelector&&((s=this.collector)!=null&&s.hasSelector(e,i))&&Z.emitMethod($.MainEngine,x.DeleteNode,{workIds:[k],viewId:e});break;case"copy":this.isSelector&&((r=this.collector)!=null&&r.hasSelector(e,i))&&this.copySelectorToTemp(e,i);break;case"paste":this.tmpCopyStore.size&&this.pasteTempToFocusView(e,i);break}(t==="changeToPencil"||t==="redo"||t==="undo")&&this.onSelfActiveHotkey(t)}colloctHotkey(t){if(this.isUseSelf){const e=this.checkHotkey(t);e&&this.onSelfActiveHotkey(e)}}onSelfActiveHotkey(t){switch(console.log("onActiveHotkey---self",t),t){case"changeToPencil":this.setMemberState({currentApplianceName:V.pencil,useNewPencil:!0});break;case"changeToArrow":this.setMemberState({currentApplianceName:V.arrow});break;case"changeToClick":this.setMemberState({currentApplianceName:V.clicker});break;case"changeToEllipse":this.setMemberState({currentApplianceName:V.ellipse});break;case"changeToEraser":this.setMemberState({currentApplianceName:V.eraser,isLine:!0});break;case"changeToHand":this.setMemberState({currentApplianceName:V.hand});break;case"changeToLaserPointer":this.setMemberState({currentApplianceName:V.laserPointer});break;case"changeToSelector":this.setMemberState({currentApplianceName:V.selector});break;case"changeToRectangle":this.setMemberState({currentApplianceName:V.rectangle});break;case"changeToStraight":this.setMemberState({currentApplianceName:V.straight});break;case"redo":this.control.room&&!this.control.room.disableSerialization&&this.control.viewContainerManager.redo();break;case"undo":this.control.room&&!this.control.room.disableSerialization&&this.control.viewContainerManager.undo();break;case"changeToText":this.setMemberState({currentApplianceName:V.text});break}}checkHotkey(t){for(const e of this.roomHotkeyCheckers){const{kind:i,checker:n}=e;if(n({nativeEvent:t,kind:this.getEventKey(t),key:t.key,altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey},this.keyboardKind))return i}}copySelectorToTemp(t,e){var l,u;const i=this.control.viewContainerManager.getView(t),n=(u=(l=this.mainEngine)==null?void 0:l.methodBuilder)==null?void 0:u.getBuilder(x.CopyNode);if(!i||!this.collector||!n)return;const s=this.collector.transformKey(k),r=this.collector.getStorageData(t,e);if(!r)return;const a=r[s],c=a&&n.copySelector({viewId:t,store:a});c&&(this.tmpCopyCoordInfo=c==null?void 0:c.copyCoordInfo,this.tmpCopyStore=c==null?void 0:c.copyStores)}pasteTempToFocusView(t,e){var s,r;const i=this.control.viewContainerManager.getView(t),n=(r=(s=this.mainEngine)==null?void 0:s.methodBuilder)==null?void 0:r.getBuilder(x.CopyNode);if(!(!i||!this.tmpCopyCoordInfo||!this.tmpCopyStore.size||!this.collector||!n)&&i.viewData&&this.tmpCopyCoordInfo){const a=q.cloneDeep(this.tmpCopyCoordInfo.offset),c=this.tmpCopyCoordInfo.cameraOpt,l=i.viewData.camera;a.x=a.x+l.centerX-c.centerX,a.y=a.y+l.centerY-c.centerY,n.pasteSelector({viewId:t,scenePath:e,copyStores:q.cloneDeep(this.tmpCopyStore),copyCoordInfo:{offset:a,cameraOpt:l}})}}setMemberState(t){var e;(e=this.control.room)==null||e.setMemberState(t)}}const nt=class nt{constructor(t){f(this,"plugin");f(this,"room");f(this,"play");f(this,"collector");f(this,"hasSwitchToSelectorEffect");f(this,"snapshootStateMap");f(this,"effectResolve");f(this,"hotkeyManager");f(this,"pluginOptions");f(this,"roomMember");f(this,"cursor");f(this,"textEditorManager");f(this,"worker");f(this,"onSceneChange",async(t,e)=>{var r;const i=this.viewContainerManager.getView(e);i!=null&&i.focusScenePath&&(r=this.collector)!=null&&r.hasSelector(e,i.focusScenePath)&&this.worker.blurSelector(e,i.focusScenePath),this.textEditorManager.checkEmptyTextBlur();const n=i==null?void 0:i.displayer;n&&(n.setActive(!1),await n.stopEventHandler());const s=t;s&&this.viewContainerManager.setViewScenePath(e,s),n==null||n.setActive(!0)});f(this,"onRoomMembersChange",t=>{this.roomMember.setRoomMembers(K.toJS(t))});f(this,"onMemberChange",Ie(t=>{if(!this.room||!this.worker)return;const e=this.getToolsKey(t),i=this.getToolsOpt(e,t);this.worker.setCurrentToolsData(i),this.effectViewContainer(e),this.effectResolve&&this.effectResolve(!0)},100,{leading:!1}));f(this,"internalSceneChange",(t,e)=>{var i;(i=this.worker)==null||i.clearViewScenePath(t,!0).then(()=>{var n;(n=this.worker)==null||n.pullServiceData(t,e)})});f(this,"internalCameraChange",(t,e)=>{var i;(i=this.worker)==null||i.updateCamera(t,e)});const{displayer:e,plugin:i,options:n}=t;this.plugin=i,this.room=K.isRoom(e)?e:void 0,this.play=K.isPlayer(e)?e:void 0,this.pluginOptions=n,this.roomMember=new Vg;const s={control:this,internalMsgEmitter:nt.InternalMsgEmitter};this.cursor=new Jg(s),this.textEditorManager=new Gg(s),this.worker=new lM(s),this.hotkeyManager=new QM(s)}hasOffscreenCanvas(){return typeof OffscreenCanvas=="function"}bindPlugin(t){var e,i;this.plugin=t,this.collector&&this.collector.removeStorageStateListener(),this.collector=new $t(t,(i=(e=this.pluginOptions)==null?void 0:e.syncOpt)==null?void 0:i.interval),this.cursor.activeCollector(),this.activePlugin()}destroy(){var t,e,i,n,s;this.roomMember.destroy(),(t=this.collector)==null||t.destroy(),(e=this.worker)==null||e.destroy(),(i=this.viewContainerManager)==null||i.destroy(),(n=this.cursor)==null||n.destroy(),(s=this.textEditorManager)==null||s.destory()}cleanCurrentScene(){const t=Date.now(),e=this.worker.getLocalWorkViewId()||this.viewContainerManager.focuedViewId;e&&(nt.InternalMsgEmitter.emit("addUndoTicker",t,e),this.worker.clearViewScenePath(e))}onWritableChange(t){var e,i;t?(i=this.worker)==null||i.abled():(e=this.worker)==null||e.unWritable()}getToolsKey(t){const e=t.currentApplianceName;switch(this.hasSwitchToSelectorEffect=!1,e){case V.text:return t.textCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),N.Text;case V.pencil:return t.useLaserPen?N.LaserPen:N.Pencil;case V.eraser:case V.pencilEraser:return N.Eraser;case V.selector:return N.Selector;case V.arrow:return t.arrowCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),N.Arrow;case V.straight:return t.straightCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),N.Straight;case V.ellipse:return t.ellipseCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),N.Ellipse;case V.rectangle:return t.rectangleCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),N.Rectangle;case V.shape:if(t.shapeCompleteToSelector&&(this.hasSwitchToSelectorEffect=!0),t.shapeType===ze.Pentagram||t.shapeType===ze.Star)return N.Star;if(t.shapeType===ze.Polygon||t.shapeType===ze.Triangle||t.shapeType===ze.Rhombus)return N.Polygon;if(t.shapeType===ze.SpeechBalloon)return N.SpeechBalloon;break}return N.Clicker}getToolsOpt(t,e){const i=e.currentApplianceName,n={strokeColor:lt(e.strokeColor[0],e.strokeColor[1],e.strokeColor[2],e.strokeOpacity||1),thickness:e.strokeWidth,isOpacity:(e==null?void 0:e.strokeOpacity)&&e.strokeOpacity<1||(e==null?void 0:e.fillOpacity)&&e.fillOpacity<1||(e==null?void 0:e.textOpacity)&&e.textOpacity<1||(e==null?void 0:e.textBgOpacity)&&e.textBgOpacity<1||!1};switch(t){case N.Text:n.fontFamily=window.getComputedStyle(document.documentElement).getPropertyValue("font-family"),n.fontSize=(e==null?void 0:e.textSizeOverride)||(e==null?void 0:e.textSize)||Number(window.getComputedStyle(document.body).fontSize),n.textAlign=(e==null?void 0:e.textAlign)||"left",n.verticalAlign=(e==null?void 0:e.verticalAlign)||"middle",n.fontColor=(e==null?void 0:e.textColor)&&lt(e.textColor[0],e.textColor[1],e.textColor[2],e.textOpacity||1)||n.strokeColor||"rgba(0,0,0,1)",n.fontBgColor=Array.isArray(e==null?void 0:e.textBgColor)&&lt(e.textBgColor[0],e.textBgColor[1],e.textBgColor[2],e.textBgOpacity||1)||"transparent",n.bold=(e==null?void 0:e.bold)&&"bold"||void 0,n.italic=(e==null?void 0:e.italic)&&"italic"||void 0,n.underline=(e==null?void 0:e.underline)||void 0,n.lineThrough=(e==null?void 0:e.lineThrough)||void 0,n.text="",n.strokeColor=void 0;break;case N.Pencil:n.strokeType=(e==null?void 0:e.strokeType)||Mt.Normal;break;case N.Eraser:n.thickness=Math.min(3,Math.max(1,Math.floor(e.pencilEraserSize||1)))-1,n.isLine=i===V.eraser&&!0;break;case N.LaserPen:n.duration=(e==null?void 0:e.duration)||1,n.strokeType=(e==null?void 0:e.strokeType)||Mt.Normal;break;case N.Ellipse:case N.Rectangle:case N.Star:case N.Polygon:case N.SpeechBalloon:t===N.Star&&(e.shapeType===ze.Pentagram?(n.vertices=10,n.innerVerticeStep=2,n.innerRatio=.4):e!=null&&e.vertices&&(e!=null&&e.innerVerticeStep)&&(e!=null&&e.innerRatio)&&(n.vertices=e.vertices,n.innerVerticeStep=e.innerVerticeStep,n.innerRatio=e.innerRatio)),t===N.Polygon&&(e.shapeType===ze.Triangle?n.vertices=3:e.shapeType===ze.Rhombus?n.vertices=4:e.vertices&&(n.vertices=e.vertices)),n.fillColor=(e==null?void 0:e.fillColor)&&lt(e.fillColor[0],e.fillColor[1],e.fillColor[2],e==null?void 0:e.fillOpacity)||"transparent",t===N.SpeechBalloon&&(n.placement=e.placement||"bottomLeft");break}return{toolsType:t,toolsOpt:n}}effectViewContainer(t){var e,i,n,s,r;switch(t){case N.Text:case N.Pencil:case N.LaserPen:case N.Arrow:case N.Straight:case N.Rectangle:case N.Ellipse:case N.Star:case N.Polygon:case N.SpeechBalloon:case N.Triangle:case N.Rhombus:this.room.disableDeviceInputs=!0,(e=this.worker)==null||e.abled();break;case N.Eraser:case N.Selector:this.room.disableDeviceInputs=!1,(i=this.cursor)==null||i.unabled(),(n=this.worker)==null||n.abled();break;default:this.room.disableDeviceInputs=!1,(s=this.worker)==null||s.unWritable(),(r=this.cursor)==null||r.unabled();break}setTimeout(()=>{this.viewContainerManager.getAllViews().forEach(c=>{c!=null&&c.displayer&&c.displayer.bindToolsClass()})},0)}async getBoundingRect(t){var i,n,s,r,a;const e=await((i=this.worker)==null?void 0:i.getBoundingRect(t));if(e){const c=((s=(n=this.viewContainerManager.mainView)==null?void 0:n.viewData)==null?void 0:s.convertToPointInWorld({x:e.x,y:e.y}))||{x:e.x,y:e.y},l=((a=(r=this.viewContainerManager.mainView)==null?void 0:r.viewData)==null?void 0:a.camera.scale)||1;return{width:Math.floor(e.w/l)+1,height:Math.floor(e.h/l)+1,originX:c.x,originY:c.y}}}async screenshotToCanvas(t,e,i,n,s,r,a){const c=await this.worker.getSnapshot(e,i,n,s);c&&(t.drawImage(c,r||0,a||0),c.close())}async scenePreview(t,e){var r,a,c,l;const i=(r=this.collector)==null?void 0:r.getViewIdBySecenPath(t);if(!i)return;const n=this.viewContainerManager.getView(i);if(!n||!((a=n.cameraOpt)!=null&&a.width)||!((c=n.cameraOpt)!=null&&c.height))return;const s=await((l=this.worker)==null?void 0:l.getSnapshot(t));if(s&&this.worker){const u=document.createElement("canvas"),M=u.getContext("2d"),{width:d,height:g}=n.cameraOpt;u.width=d,u.height=g,M&&(M.drawImage(s,0,0),e.src=u.toDataURL(),e.onload=()=>{u.remove()},e.onerror=()=>{u.remove(),e.remove()}),s.close()}}switchToSelector(){var t;(t=this.room)==null||t.setMemberState({currentApplianceName:V.selector})}async runEffectWork(t){if(this.hasSwitchToSelectorEffect){const e=await new Promise(i=>{this.switchToSelector(),this.effectResolve=i});this.effectResolve=void 0,e&&t&&t()}}setSnapshootData(){var t;this.room&&(this.snapshootStateMap=new Map,this.snapshootStateMap.set("memberState",(t=this.room)==null?void 0:t.state.memberState))}getSnapshootData(t){var e;return(e=this.snapshootStateMap)==null?void 0:e.get(t)}clearSnapshootData(){var t;(t=this.snapshootStateMap)==null||t.clear(),this.snapshootStateMap=void 0}};f(nt,"InternalMsgEmitter",new to);let Ne=nt;var HM=Do,ZM=4;function VM(o){return HM(o,ZM)}var GM=VM;const qi=He(GM),$e=class $e{constructor(t){f(this,"emitter",new to);f(this,"undoStack");f(this,"redoStack");f(this,"worker");f(this,"control");f(this,"room");f(this,"isTicking");f(this,"undoTickerId");f(this,"viewId");f(this,"scenePath");f(this,"tickStartStorerCache");f(this,"excludeIds",new Set);f(this,"onChangeScene",RM(()=>{const t=this.control.viewContainerManager.getCurScenePath(this.viewId);if(t){let e=this.undoStack.filter(n=>n.scenePath===t).length;const i=this.redoStack.filter(n=>n.scenePath===t).length;e===0&&i===0&&this.tickStartStorerCache&&this.scenePath===t&&(e=1),this.emitter.emit("onCanUndoStepsUpdate",e),this.emitter.emit("onCanRedoStepsUpdate",i)}},$e.waitTime));const{control:e,internalMsgEmitter:i,viewId:n}=t;this.control=e,this.emitter=i,this.undoStack=[],this.redoStack=[],this.room=e.room,this.worker=e.worker,this.isTicking=!1,this.viewId=n}get collector(){return this.control.collector}addExcludeIds(t){if(this.isTicking)for(const e of t)this.excludeIds.add(e)}undoTickerStart(t,e){if(this.collector&&(this.undoTickerId!==t||this.scenePath!==e)){!this.undoTickerId&&!this.tickStartStorerCache&&!this.scenePath&&this.emitter.emit("onCanUndoStepsUpdate",1),this.undoTickerId&&this.viewId&&this.scenePath&&this.undoTickerEndSync(this.undoTickerId,this.viewId,this.scenePath),this.isTicking=!0;const i=this.collector.transformKey(k);this.excludeIds.add(i),this.undoTickerId=t,this.scenePath=e;const n=this.collector.getStorageData(this.viewId,e)||{};this.tickStartStorerCache=new Map(Object.entries(re(n))),console.log("undoTickerStart",t,this.viewId,e,this.tickStartStorerCache)}}undoTickerEndSync(t,e,i){var n,s;if(t===this.undoTickerId&&i===this.scenePath&&e===this.viewId&&this.tickStartStorerCache){const r=((n=this.collector)==null?void 0:n.storage[e])&&((s=this.collector)==null?void 0:s.storage[e][i])||{},a=this.diffFun(this.tickStartStorerCache,new Map(Object.entries(r)));a.size&&(this.undoStack.push({id:t,type:2,data:re(a),scenePath:i}),this.undoStack.length>$e.MaxStackLength&&this.undoStack.shift(),this.emitter.emit("onCanUndoStepsUpdate",this.undoStack.length)),this.redoStack.length&&(this.redoStack.length=0,this.emitter.emit("onCanRedoStepsUpdate",this.redoStack.length)),this.isTicking=!1,this.scenePath=void 0,this.tickStartStorerCache=void 0,this.undoTickerId=void 0,this.excludeIds.clear()}}undo(t){this.undoTickerId&&this.tickStartStorerCache&&this.scenePath&&this.undoTickerEndSync(this.undoTickerId,this.viewId,this.scenePath);let e=this.undoStack.length-1;for(;e>=0;){if(this.undoStack[e].scenePath===t){const r=this.undoStack[e];r&&(this.redoStack.push(r),r.type===2&&r.data&&this.refreshPlugin(r)),this.undoStack.splice(e,1);break}e--}const i=this.undoStack.filter(s=>s.scenePath===t).length,n=this.redoStack.filter(s=>s.scenePath===t).length;return this.emitter.emit("onCanUndoStepsUpdate",i),this.emitter.emit("onCanRedoStepsUpdate",n),i}redo(t){let e=this.redoStack.length-1;for(;e>=0;){if(this.redoStack[e].scenePath===t){const r=this.redoStack[e];r&&(!this.undoTickerId&&r.tickStartStorerCache?(this.undoTickerId=r.id,this.tickStartStorerCache=r.tickStartStorerCache,this.scenePath=r.scenePath):this.undoStack.push(r),r.type===2&&r.data&&this.refreshPlugin(r,!0)),this.redoStack.splice(e,1);break}e--}const i=this.undoStack.filter(s=>s.scenePath===t).length,n=this.redoStack.filter(s=>s.scenePath===t).length;return this.emitter.emit("onCanUndoStepsUpdate",i),this.emitter.emit("onCanRedoStepsUpdate",n),n}clear(){this.clearUndo(),this.clearRedo()}clearUndo(){this.undoStack.length=0,this.emitter.emit("onCanUndoStepsUpdate",this.undoStack.length)}clearRedo(){this.redoStack.length=0,this.emitter.emit("onCanRedoStepsUpdate",this.redoStack.length)}canUndo(){return!!this.undoStack.length}canRedo(){return!!this.redoStack.length}onFocusView(){const t=this.control.viewContainerManager.getCurScenePath(this.viewId);if(t){let e=this.undoStack.filter(n=>n.scenePath===t).length;const i=this.redoStack.filter(n=>n.scenePath===t).length;e===0&&i===0&&this.tickStartStorerCache&&this.scenePath===t&&(e=1),this.emitter.emit("onCanUndoStepsUpdate",e),this.emitter.emit("onCanRedoStepsUpdate",i)}}diffFun(t,e){const i=new Set,n=t.keys(),s=e.keys();for(const r of n){if(this.excludeIds.has(r))continue;const a=t.get(r),c=e.get(r);if(a&&c){if(ce(c,a))continue;i.add({dataType:3,key:r,data:[a,c]});continue}a&&i.add({dataType:2,key:r,data:a})}for(const r of s){if(this.excludeIds.has(r))continue;const a=e.get(r);a&&!t.has(r)&&i.add({dataType:1,key:r,data:a})}return i}isDrawEffectiveScene(t,e){const{key:i}=t;return!e.includes(i)}isDeleteEffectiveScene(t,e,i){var r;const{key:n}=t;if(!e.includes(n))return!1;const s=e.filter(a=>{var c,l;return((c=this.collector)==null?void 0:c.getLocalId(a))===k&&!((l=this.collector)!=null&&l.isOwn(a))}).map(a=>{var c;return(c=this.collector)==null?void 0:c.storage[this.viewId][i][a]});for(const a of s)if((r=a==null?void 0:a.selectIds)!=null&&r.includes(n))return!1;return!0}isOldEffectiveScene(t,e,i){var r;const{key:n}=t;if(!e.includes(n))return!1;const s=e.filter(a=>{var c,l;return((c=this.collector)==null?void 0:c.getLocalId(a))===k&&!((l=this.collector)!=null&&l.isOwn(a))}).map(a=>{var c;return(c=this.collector)==null?void 0:c.storage[this.viewId][i][a]});for(const a of s)if((r=a==null?void 0:a.selectIds)!=null&&r.includes(n))return!1;return!0}isNewEffectiveScene(t,e){const{key:i}=t;return!!e.includes(i)}refreshPlugin(t,e=!1){var r,a,c,l,u,M,d,g,v,y,p,I,w,m,T,z,j,E,b,P,U;let i;const{scenePath:n}=t,s=t.data;if(!(!s||!this.collector))for(const O of s.values()){const{dataType:Q,data:B,key:_}=O,oe=this.collector.getStorageData(this.viewId,n),X=oe&&Object.keys(oe)||[];switch(Q){case 1:if(i=e?this.isDrawEffectiveScene(O,X):this.isDeleteEffectiveScene(O,X,n),i)if(e&&!Array.isArray(B)){if((r=B.updateNodeOpt)!=null&&r.useAnimation&&(B.updateNodeOpt.useAnimation=!1),((a=this.collector)==null?void 0:a.getLocalId(_))===k&&((c=this.collector)!=null&&c.isOwn(O.key))){const H=B.selectIds;if(H){const J=X.filter(Y=>{var R,F;return((R=this.collector)==null?void 0:R.getLocalId(Y))===k&&!((F=this.collector)!=null&&F.isOwn(Y))}).map(Y=>{var R;return(R=this.collector)==null?void 0:R.storage[this.viewId][n][Y]});let W=!1;for(const Y of J)for(let R=0;R<H.length;R++)(l=Y==null?void 0:Y.selectIds)!=null&&l.includes(H[R])&&(delete H[R],W=!0);W&&(B.selectIds=H.filter(Y=>!!Y))}}(u=this.collector)==null||u.updateValue(O.key,B,{isAfterUpdate:!0,viewId:this.viewId,scenePath:n,isSync:!0})}else!e&&!Array.isArray(O.data)&&((M=this.collector)==null||M.updateValue(O.key,void 0,{isAfterUpdate:!0,viewId:this.viewId,scenePath:n,isSync:!0}));break;case 2:if(i=e?this.isDeleteEffectiveScene(O,X,n):this.isDrawEffectiveScene(O,X),i){if(e&&!Array.isArray(B))(d=this.collector)==null||d.updateValue(_,void 0,{isAfterUpdate:!0,viewId:this.viewId,scenePath:n,isSync:!0});else if(!e&&!Array.isArray(B)){if((g=B.updateNodeOpt)!=null&&g.useAnimation&&(B.updateNodeOpt.useAnimation=!1),((v=this.collector)==null?void 0:v.getLocalId(O.key))===k&&((y=this.collector)!=null&&y.isOwn(O.key))){const H=B.selectIds;if(H){const J=X.filter(Y=>{var R,F;return((R=this.collector)==null?void 0:R.getLocalId(Y))===k&&!((F=this.collector)!=null&&F.isOwn(Y))}).map(Y=>{var R;return(R=this.collector)==null?void 0:R.storage[this.viewId][n][Y]});let W=!1;for(const Y of J)for(let R=0;R<H.length;R++)(p=Y==null?void 0:Y.selectIds)!=null&&p.includes(H[R])&&(delete H[R],W=!0);W&&(B.selectIds=H.filter(Y=>!!Y))}}(I=this.collector)==null||I.updateValue(O.key,O.data,{isAfterUpdate:!0,viewId:this.viewId,scenePath:n,isSync:!0})}}break;case 3:if(i=e?this.isNewEffectiveScene(O,X):this.isOldEffectiveScene(O,X,n),i){if(e&&Array.isArray(B)&&B.length===2){const H=B[1];if((w=H.updateNodeOpt)!=null&&w.useAnimation&&(H.updateNodeOpt.useAnimation=!1),((m=this.collector)==null?void 0:m.getLocalId(O.key))===k&&((T=this.collector)!=null&&T.isOwn(O.key))){const J=H.selectIds;if(J){const W=X.filter(R=>{var F,ne;return((F=this.collector)==null?void 0:F.getLocalId(R))===k&&!((ne=this.collector)!=null&&ne.isOwn(R))}).map(R=>{var F;return(F=this.collector)==null?void 0:F.storage[this.viewId][n][R]});let Y=!1;for(const R of W)for(let F=0;F<J.length;F++)R!=null&&R.selectIds&&((z=R.selectIds)!=null&&z.includes(J[F]))&&(delete J[F],Y=!0);Y&&(H.selectIds=J.filter(R=>!!R))}}(j=this.collector)==null||j.updateValue(_,H,{isAfterUpdate:!0,viewId:this.viewId,scenePath:n,isSync:!0})}else if(!e&&Array.isArray(B)&&B.length===2){const H=B[0];if((E=H.updateNodeOpt)!=null&&E.useAnimation&&(H.updateNodeOpt.useAnimation=!1),((b=this.collector)==null?void 0:b.getLocalId(O.key))===k&&((P=this.collector)!=null&&P.isOwn(O.key))){const J=H.selectIds;if(J){const W=X.filter(R=>{var F,ne;return((F=this.collector)==null?void 0:F.getLocalId(R))===k&&!((ne=this.collector)!=null&&ne.isOwn(R))}).map(R=>{var F;return(F=this.collector)==null?void 0:F.storage[this.viewId][n][R]});let Y=!1;for(const R of W)for(let F=0;F<J.length;F++)R!=null&&R.selectIds&&R.selectIds.includes(J[F])&&(delete J[F],Y=!0);Y&&(H.selectIds=J.filter(R=>!!R))}}(U=this.collector)==null||U.updateValue(O.key,H,{isAfterUpdate:!0,viewId:this.viewId,scenePath:n,isSync:!0})}}break}}}};f($e,"sdkCallBack"),f($e,"MaxStackLength",20),f($e,"waitTime",100);let wt=$e;function JM(o){return o instanceof TouchEvent||o instanceof window.TouchEvent||(o==null?void 0:o.touches)&&(o==null?void 0:o.touches.length)||(o==null?void 0:o.changedTouches)&&(o==null?void 0:o.changedTouches.length)}function Je(o){return JM(o)&&(o.touches&&o.touches.length===1||o.changedTouches&&o.changedTouches.length===1)}function Wo(o){return o.touches&&o.touches.length?{x:o.touches[0].pageX,y:o.touches[0].pageY}:o.changedTouches&&o.changedTouches.length?{x:o.changedTouches[0].pageX,y:o.changedTouches[0].pageY}:{x:o.pageX,y:o.pageY}}class Ke{constructor(t){f(this,"internalMsgEmitter");f(this,"control");f(this,"mainView");f(this,"appViews",new Map);const{control:e,internalMsgEmitter:i}=t;this.control=e,this.internalMsgEmitter=i,this.internalMsgEmitter.on("addUndoTicker",this.undoTickerStart.bind(this)),this.internalMsgEmitter.on("excludeIds",this.addExcludeIds.bind(this))}undoTickerStart(t,e){const i=this.getView(e);i&&i.displayer&&i.focusScenePath&&i.displayer.commiter.undoTickerStart(t,i.focusScenePath)}addExcludeIds(t,e){const i=this.getView(e);i&&i.displayer&&i.focusScenePath&&i.displayer.commiter.addExcludeIds(t)}undo(){const t=this.focuedView;let e=0;if(t){const i=t.focusScenePath;e=t.displayer.commiter.undo(i)||0}return e}redo(){const t=this.focuedView;let e=0;if(t){const i=t.focusScenePath;e=t.displayer.commiter.redo(i)||0}return e}validator(t,e,i){var r;const n=qi(t[e]),s=qi(i);if(e==="focusScenePath"&&i&&!ce(n,s)&&(this.control.internalSceneChange(t.id,s),(r=this.focuedView)==null||r.displayer.commiter.onChangeScene()),e==="cameraOpt"&&!ce(n,s)){if(s.width!==(n==null?void 0:n.width)||s.height!==(n==null?void 0:n.height)){const a=this.getView(e);a==null||a.displayer.updateSize()}this.control.internalCameraChange(t.id,s)}}destroyAppView(t,e=!1){const i=this.appViews.get(t);i&&(this.control.textEditorManager.clear(t,e),i.displayer.destroy(),this.appViews.delete(t))}createMianView(t){this.mainView=new Proxy(t,{set:(e,i,n)=>(this.control.worker.isActive&&this.validator(e,i,n),e[i]=n,!0)})}createAppView(t){const e=t.id,i=new Proxy(t,{set:(n,s,r)=>(this.control.worker.isActive&&this.validator(n,s,r),n[s]=r,!0)});this.appViews.set(e,i)}isAppView(t){return t!==ve.viewId&&this.appViews.has(t)}getView(t){var e;return t===ve.viewId?this.mainView:(e=this.appViews)==null?void 0:e.get(t)}getCurScenePath(t){const e=this.getView(t);if(e)return e.focusScenePath}getAllViews(){return[this.mainView,...this.appViews.values()]}setViewScenePath(t,e){var i;if(t===ve.viewId&&this.mainView)this.mainView.focusScenePath=e;else{const n=t&&((i=this.appViews)==null?void 0:i.get(t))||void 0;n&&(n.focusScenePath=e)}}setViewData(t,e){var i;if(t===ve.viewId&&this.mainView)this.mainView.viewData=e;else{const n=t&&((i=this.appViews)==null?void 0:i.get(t))||void 0;n&&(n.viewData=e)}}setFocuedViewId(t){var e;this.focuedViewId=t,t===ve.viewId?this.focuedView=this.mainView:this.focuedView=t&&((e=this.appViews)==null?void 0:e.get(t))||void 0,this.control.cursor.onFocusViewChange(),this.focuedView&&this.focuedView.displayer.commiter.onFocusView()}setViewFocusScenePath(t,e){var n;let i;t===ve.viewId?i=this.mainView:i=(n=this.appViews)==null?void 0:n.get(t),i&&(i.focusScenePath=e)}destroy(){var t;this.internalMsgEmitter.removeAllListeners("addUndoTicker"),this.internalMsgEmitter.removeAllListeners("excludeIds"),(t=this.mainView)==null||t.displayer.destroy(),this.appViews.forEach(e=>{this.destroyAppView(e.id,!0),this.control.worker.destroyViewWorker(e.id)})}setFocuedViewCameraOpt(t){this.focuedView&&(this.focuedView.cameraOpt=t)}transformToOriginPoint(t,e){const i=this.getView(e);if(i!=null&&i.viewData){const n=i.viewData.convertToPointOnScreen(t[0],t[1]);return[n.x,n.y]}return t}transformToScenePoint(t,e){const i=this.getView(e);if(i!=null&&i.viewData){const n=i.viewData.convertToPointInWorld({x:t[0],y:t[1]});return[n.x,n.y]}return t}render(t){var e,i,n,s,r,a,c,l,u,M,d,g,v,y,p,I,w;for(const m of t){const{rect:T,imageBitmap:z,isClear:j,isUnClose:E,drawCanvas:b,clearCanvas:P,viewId:U}=m,O=(e=this.getView(U))==null?void 0:e.displayer;if(O&&T){const{dpr:Q,canvasBgRef:B,canvasFloatRef:_,canvasServiceFloatRef:oe,canvasTopRef:X}=O,H=T.w*Q,J=T.h*Q,W=T.x*Q,Y=T.y*Q;if(j){switch(P){case De.TopFloat:(n=(i=X.current)==null?void 0:i.getContext("2d"))==null||n.clearRect(W,Y,H,J);break;case De.Float:(r=(s=_.current)==null?void 0:s.getContext("2d"))==null||r.clearRect(W,Y,H,J);break;case De.ServiceFloat:(c=(a=oe.current)==null?void 0:a.getContext("2d"))==null||c.clearRect(W,Y,H,J);break;case De.Bg:(u=(l=B.current)==null?void 0:l.getContext("2d"))==null||u.clearRect(W,Y,H,J);break}continue}if(b&&z)switch(b){case De.TopFloat:(d=(M=X.current)==null?void 0:M.getContext("2d"))==null||d.drawImage(z,0,0,H,J,W,Y,H,J);break;case De.Float:{(v=(g=_.current)==null?void 0:g.getContext("2d"))==null||v.drawImage(z,0,0,H,J,W,Y,H,J);break}case De.ServiceFloat:{(p=(y=oe.current)==null?void 0:y.getContext("2d"))==null||p.drawImage(z,0,0,H,J,W,Y,H,J);break}case De.Bg:{(w=(I=B.current)==null?void 0:I.getContext("2d"))==null||w.drawImage(z,0,0,H,J,W,Y,H,J);break}}if(E)continue;z==null||z.close()}}}showFloatBar(t,e,i){const n=this.getView(t),s=n==null?void 0:n.displayer.vDom;s&&s.showFloatBar(e,i)}activeFloatBar(t){var i;const e=(i=this.getView(t))==null?void 0:i.displayer;e!=null&&e.vDom&&e.vDom.setFloatZIndex(2)}unActiveFloatBar(t){const e=this.getView(t),i=e==null?void 0:e.displayer.vDom;i&&i.setFloatZIndex(-1)}setActiveTextEditor(t,e){const i=this.getView(t),n=i==null?void 0:i.displayer.vDom;n&&n.setActiveTextEditor(e)}}f(Ke,"defaultCameraOpt",{centerX:0,centerY:0,scale:1}),f(Ke,"defaultScreenCanvasOpt",{autoRender:!1,contextType:Nt.Canvas2d}),f(Ke,"defaultLayerOpt",{offscreen:!0,handleEvent:!1,depth:!1});class KM{constructor(t,e,i){f(this,"viewId");f(this,"control");f(this,"internalMsgEmitter");f(this,"commiter");f(this,"cachePoint");f(this,"cacheCursorPoint");f(this,"active",!0);f(this,"mousedown",t=>{if(this.active&&t.button===0&&this.viewId){this.reflashContainerOffset();const e=this.getPoint(t);this.cachePoint=e,e&&this.control.worker.originalEventLintener(C.Start,e,this.viewId)}});f(this,"mousemove",t=>{if(this.active&&this.viewId){const e=this.getPoint(t);this.cachePoint=e,e&&this.control.worker.originalEventLintener(C.Doing,e,this.viewId)}});f(this,"mouseup",t=>{if(this.active&&t.button===0&&this.viewId){const e=this.getPoint(t)||this.cachePoint;e&&this.control.worker.originalEventLintener(C.Done,e,this.viewId),this.cachePoint=void 0}});f(this,"touchstart",t=>{var e;if(this.active&&Je(t)&&this.viewId){if(!this.control.worker.isAbled()){const n=(e=this.control.worker.getCurrentToolsData())==null?void 0:e.toolsType;n&&this.control.effectViewContainer(n)}this.reflashContainerOffset();const i=this.getPoint(t);this.cachePoint=i,i&&this.control.worker.originalEventLintener(C.Start,i,this.viewId)}});f(this,"touchmove",t=>{if(this.active){if(!Je(t)){this.control.worker.unWritable(),this.control.worker.clearLocalPointsBatchData();return}if(this.viewId){const e=this.getPoint(t);this.cachePoint=e,e&&this.control.worker.originalEventLintener(C.Doing,e,this.viewId)}}});f(this,"touchend",t=>{if(this.active){if(!Je(t)||!this.control.worker.isAbled()){this.control.worker.clearLocalPointsBatchData();return}if(this.viewId){const e=this.getPoint(t)||this.cachePoint;e&&this.control.worker.originalEventLintener(C.Done,e,this.viewId),this.cachePoint=void 0}}});f(this,"cursorMouseMove",Ie(t=>{const e=this.getPoint(t);this.cacheCursorPoint&&ce(e,this.cacheCursorPoint)||!this.viewId||(this.cacheCursorPoint=e,e&&this.control.worker.sendCursorEvent(e,this.viewId))},30,{leading:!1}));f(this,"cursorMouseLeave",Ie(()=>{this.viewId&&(this.cacheCursorPoint=[void 0,void 0],this.control.worker.sendCursorEvent(this.cacheCursorPoint,this.viewId))},30,{leading:!1}));f(this,"keydown",t=>{this.control.hotkeyManager.colloctHotkey(t)});this.viewId=t,this.control=e,this.internalMsgEmitter=i;const n={control:this.control,internalMsgEmitter:this.internalMsgEmitter,viewId:this.viewId};this.commiter=new wt(n)}bindToolsClass(){var e,i;const t=(i=(e=this.control.worker)==null?void 0:e.currentToolsData)==null?void 0:i.toolsType;switch(t){case N.Text:case N.Pencil:case N.LaserPen:case N.Arrow:case N.Straight:case N.Rectangle:case N.Ellipse:case N.Star:case N.Polygon:case N.SpeechBalloon:this.eventTragetElement&&(this.eventTragetElement.className=`netless-whiteboard ${t===N.Text?"cursor-text":t===N.Pencil||t===N.LaserPen?"cursor-pencil":"cursor-arrow"}`);break}}mountView(){this.setCanvassStyle(),this.control.viewContainerManager.mountView(this.viewId)}reflashContainerOffset(){this.eventTragetElement&&(this.containerOffset=this.getContainerOffset(this.eventTragetElement,{x:0,y:0}))}updateSize(){this.setCanvassStyle(),this.reflashContainerOffset()}setViewId(t){this.viewId=t}destroy(){this.eventTragetElement&&this.removeDisplayerEvent(this.eventTragetElement),this.vDom=void 0,this.internalMsgEmitter.removeAllListeners([$.Cursor,this.viewId])}getPoint(t){const e=Wo(t);if(e&&ae(e.x)&&ae(e.y))return[e.x-this.containerOffset.x,e.y-this.containerOffset.y]}setActive(t){this.active=t}async stopEventHandler(){this.cachePoint&&(await this.control.worker.originalEventLintener(C.Done,this.cachePoint,this.viewId),this.cachePoint=void 0)}getTranslate(t){const i=(t.style.WebkitTransform||getComputedStyle(t,"").getPropertyValue("-webkit-transform")||t.style.transform||getComputedStyle(t,"").getPropertyValue("transform")).match(/-?[0-9]+\.?[0-9]*/g),n=i&&parseInt(i[0])||0,s=i&&parseInt(i[1])||0;return[n,s]}getContainerOffset(t,e){var s;const i=this.getTranslate(t);let n={x:e.x+t.offsetLeft+i[0],y:e.y+t.offsetTop+i[1]};return(s=t.offsetParent)!=null&&s.nodeName&&t.offsetParent.nodeName!=="BODY"&&(n=this.getContainerOffset(t.offsetParent,n)),n}bindDisplayerEvent(t){t.addEventListener("mousedown",this.mousedown,!1),t.addEventListener("touchstart",this.touchstart,!1),window.addEventListener("mouseleave",this.mouseup,!1),window.addEventListener("mousemove",this.mousemove,!1),window.addEventListener("mouseup",this.mouseup,!1),window.addEventListener("touchmove",this.touchmove,!1),window.addEventListener("touchend",this.touchend,!1),t.addEventListener("mousemove",this.cursorMouseMove,!1),t.addEventListener("mouseleave",this.cursorMouseLeave,!1),t.addEventListener("keydown",this.keydown,!0)}removeDisplayerEvent(t){t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("mouseleave",this.mouseup),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("mousemove",this.cursorMouseMove),t.removeEventListener("mouseleave",this.cursorMouseLeave),t.removeEventListener("keydown",this.keydown)}}class ve{constructor(t,e){f(this,"viewId","mainView");f(this,"control");f(this,"internalMsgEmitter");f(this,"commiter");f(this,"cachePoint");f(this,"cacheCursorPoint");f(this,"active",!0);f(this,"mousedown",t=>{if(this.active&&t.button===0){this.reflashContainerOffset();const e=this.getPoint(t);this.cachePoint=e,e&&this.control.worker.originalEventLintener(C.Start,e,this.viewId)}});f(this,"mousemove",t=>{if(!this.active)return;const e=this.getPoint(t);this.cachePoint=e,e&&this.control.worker.originalEventLintener(C.Doing,e,this.viewId)});f(this,"mouseup",t=>{if(this.active&&t.button===0){const e=this.getPoint(t)||this.cachePoint;e&&this.control.worker.originalEventLintener(C.Done,e,this.viewId),this.cachePoint=void 0}});f(this,"touchstart",t=>{var i;if(!this.active||!Je(t))return;if(!this.control.worker.isAbled()){const n=(i=this.control.worker.getCurrentToolsData())==null?void 0:i.toolsType;n&&this.control.effectViewContainer(n)}this.reflashContainerOffset();const e=this.getPoint(t);this.cachePoint=e,e&&this.control.worker.originalEventLintener(C.Start,e,this.viewId)});f(this,"touchmove",t=>{if(!this.active)return;if(!Je(t)){this.control.worker.clearLocalPointsBatchData(),this.control.worker.unWritable();return}const e=this.getPoint(t);this.cachePoint=e,e&&this.control.worker.originalEventLintener(C.Doing,e,this.viewId)});f(this,"touchend",t=>{if(!this.active)return;if(!Je(t)||!this.control.worker.isAbled()){this.control.worker.clearLocalPointsBatchData();return}const e=this.getPoint(t)||this.cachePoint;e&&this.control.worker.originalEventLintener(C.Done,e,this.viewId),this.cachePoint=void 0});f(this,"cursorMouseMove",Ie(t=>{const e=this.getPoint(t);this.cacheCursorPoint&&ce(e,this.cacheCursorPoint)||(this.cacheCursorPoint=e,e&&this.control.worker.sendCursorEvent(e,this.viewId))},30,{leading:!1}));f(this,"cursorMouseLeave",Ie(()=>{this.cacheCursorPoint=[void 0,void 0],this.control.worker.sendCursorEvent(this.cacheCursorPoint,this.viewId)},30,{leading:!1}));f(this,"keydown",t=>{this.control.hotkeyManager.colloctHotkey(t)});this.control=t,this.internalMsgEmitter=e;const i={control:this.control,internalMsgEmitter:this.internalMsgEmitter,viewId:this.viewId};this.commiter=new wt(i)}bindToolsClass(){var e,i;const t=(i=(e=this.control.worker)==null?void 0:e.currentToolsData)==null?void 0:i.toolsType;switch(t){case N.Text:case N.Pencil:case N.LaserPen:case N.Arrow:case N.Straight:case N.Rectangle:case N.Ellipse:case N.Star:case N.Polygon:case N.SpeechBalloon:this.eventTragetElement&&(this.eventTragetElement.className=`netless-whiteboard ${t===N.Text?"cursor-text":t===N.Pencil||t===N.LaserPen?"cursor-pencil":"cursor-arrow"}`);break}}mountView(){this.setCanvassStyle(),this.control.viewContainerManager.mountView(this.viewId)}updateSize(){this.setCanvassStyle()}reflashContainerOffset(){this.eventTragetElement&&(this.containerOffset=this.getContainerOffset(this.eventTragetElement,{x:0,y:0}))}destroy(){this.eventTragetElement&&this.removeDisplayerEvent(this.eventTragetElement),this.vDom=void 0,this.internalMsgEmitter.removeAllListeners([$.Cursor,this.viewId])}getPoint(t){const e=Wo(t);if(e&&ae(e.x)&&ae(e.y))return[e.x-this.containerOffset.x,e.y-this.containerOffset.y]}setActive(t){this.active=t}async stopEventHandler(){this.cachePoint&&(await this.control.worker.originalEventLintener(C.Done,this.cachePoint,this.viewId),this.cachePoint=void 0)}getTranslate(t){const i=(t.style.WebkitTransform||getComputedStyle(t,"").getPropertyValue("-webkit-transform")||t.style.transform||getComputedStyle(t,"").getPropertyValue("transform")).match(/-?[0-9]+\.?[0-9]*/g),n=i&&parseInt(i[0])||0,s=i&&parseInt(i[1])||0;return[n,s]}getContainerOffset(t,e){var s;const i=this.getTranslate(t);let n={x:e.x+t.offsetLeft+i[0],y:e.y+t.offsetTop+i[1]};return(s=t.offsetParent)!=null&&s.nodeName&&t.offsetParent.nodeName!=="BODY"&&(n=this.getContainerOffset(t.offsetParent,n)),n}bindDisplayerEvent(t){t.addEventListener("mousedown",this.mousedown,!1),t.addEventListener("touchstart",this.touchstart,!1),window.addEventListener("mouseleave",this.mouseup,!1),window.addEventListener("mousemove",this.mousemove,!1),window.addEventListener("mouseup",this.mouseup,!1),window.addEventListener("touchmove",this.touchmove,!1),window.addEventListener("touchend",this.touchend,!1),t.addEventListener("mousemove",this.cursorMouseMove,!1),t.addEventListener("mouseleave",this.cursorMouseLeave,!1),t.addEventListener("keydown",this.keydown,!0)}removeDisplayerEvent(t){t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("mouseleave",this.mouseup),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("mousemove",this.cursorMouseMove),t.removeEventListener("mouseleave",this.cursorMouseLeave),t.removeEventListener("keydown",this.keydown)}}f(ve,"viewId","mainView");const qM="index-module__Container__nLsM3",_M="index-module__CanvasBox__j2Xe-",XM="index-module__FloatCanvas__d1YR7",ep="index-module__TopFloatCanvas__7IaCw",tp="index-module__SnapshotBox__--eeE",ip="index-module__FloatBar__cm-EL",op="index-module__RotateBtn__HSSkf",np="index-module__ResizeBtn__yjvda",sp="index-module__CursorBox__2UHvI",rp="index-module__TextEditorContainer__Qm8KC",ap="index-module__ResizeTowBox__HOllX",cp="index-module__FloatBarBtn__FJrOG",fe={Container:qM,CanvasBox:_M,FloatCanvas:XM,TopFloatCanvas:ep,SnapshotBox:tp,FloatBar:ip,RotateBtn:op,ResizeBtn:np,CursorBox:sp,TextEditorContainer:rp,ResizeTowBox:ap,FloatBarBtn:cp},l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DAgMC01LjAzOCAyLjA4NyA3LjEwMSA3LjEwMSAwIDAgMC0yLjA4NiA0LjkyIDcuMTAzIDcuMTAzIDAgMCAwIDEuNzY2IDQuODE1bDEuOTQ1LTEuNTg0IDIuMzk0IDcuMTgyLTcuMjIyLTIuNDA4IDEuNzkxLTEuNzlBOC44NDYgOC44NDYgMCAwIDEgMy4xMjUgMTJjMC0yLjI3MS44NjYtNC41NDMgMi42LTYuMjc2eiIgc3Ryb2tlPSIjRkZGIiBzdHJva2Utd2lkdGg9Ii41IiBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L2c+PC9zdmc+","font-colors-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTQgMTEgNC05IDQgOU02IDdoNCIgc3Ryb2tlPSIjMzM4MUZGIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=","font-colors":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTQgMTEgNC05IDQgOU02IDdoNCIgc3Ryb2tlPSIjNDQ0RTYwIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=","to-bottom":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDEwdjhtMCAwLTItMm0yIDIgMi0ybS00IDZoMTJtLTYtNGg2bS02LTRoNm0tNi00aDYiIHN0cm9rZT0iIzQ0NEU2MCIgZmlsbD0ibm9uZSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PC9zdmc+","to-top":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDIydi04bTAgMC0yIDJtMi0yIDIgMm0tNC02aDEybS02IDRoNm0tNiA0aDZtLTYgNGg2IiBzdHJva2U9IiM0NDRFNjAiIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==","bold-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQuNSAySDhhMi41IDIuNSAwIDAgMSAwIDVINS41aDBtLTEgMGg0YTMgMyAwIDAgMSAwIDZoLTQgMG0wIDFWMiIgc3Ryb2tlPSIjMzM4MUZGIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=",bold:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQuNSAySDhhMi41IDIuNSAwIDAgMSAwIDVINS41aDBtLTEgMGg0YTMgMyAwIDAgMSAwIDZoLTQgMG0wIDFWMiIgc3Ryb2tlPSIjNDQ0RTYwIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=","underline-active":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTY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jIyNjY2NnogbTAtNDUuMjI2NjY2bC04NS4zMzMzMzMgODUuMzMzMzMzIDQ1LjIyNjY2NiA0NS4yMjY2NjcgODUuMzMzMzM0LTg1LjMzMzMzNC00NS4yMjY2NjctNDUuMjI2NjY2eiIgIGZpbGw9IiM0NDRFNjAiPjwvcGF0aD48L3N2Zz4="};function le(o){return lp[o]}const hp=o=>{const{workIds:t,maranger:e}=o;return h.createElement("div",{className:"button normal-button",style:{touchAction:"none"},onClick:i=>{i==null||i.preventDefault(),i.stopPropagation(),Z.emitMethod($.MainEngine,x.DeleteNode,{workIds:t||[k],viewId:e.viewId})},onTouchEnd:i=>{i==null||i.preventDefault(),i.stopPropagation(),Z.emitMethod($.MainEngine,x.DeleteNode,{workIds:t||[k],viewId:e.viewId})}},h.createElement("img",{alt:"icon",src:le("delete")}))},up=o=>{const{workIds:t,viewId:e}=o;return h.createElement("div",{className:"button normal-button",onClick:i=>{i==null||i.preventDefault(),i.stopPropagation(),Z.emitMethod($.MainEngine,x.CopyNode,{workIds:t||[k],viewId:e})},onTouchEnd:i=>{i.stopPropagation(),Z.emitMethod($.MainEngine,x.CopyNode,{workIds:t||[k],viewId:e})}},h.createElement("img",{alt:"icon",src:le("duplicate")}))},_i=o=>{const{icon:t,onClickHandler:e,onTouchEndHandler:i}=o;return h.createElement("div",{className:"button normal-button",onClick:e,onTouchEnd:i},h.createElement("img",{src:le(t)}))},dp=o=>{const{open:t,setOpen:e,style:i}=o,{floatBarData:n,maranger:s}=h.useContext(se),[r,a]=h.useState([]),c=h.useMemo(()=>{if(i&&i.bottom){const d={};return d.top="inherit",d.bottom=50,d}},[i]),l=h.useMemo(()=>t?h.createElement("div",{className:"image-layer-menu",style:c},h.createElement(_i,{icon:"to-top",onClickHandler:d=>{d==null||d.preventDefault(),d.stopPropagation(),Z.emitMethod($.MainEngine,x.ZIndexNode,{workIds:[k],layer:Fe.Top,viewId:s==null?void 0:s.viewId})},onTouchEndHandler:d=>{d.stopPropagation(),Z.emitMethod($.MainEngine,x.ZIndexNode,{workIds:[k],layer:Fe.Top,viewId:s==null?void 0:s.viewId})}}),h.createElement(_i,{icon:"to-bottom",onClickHandler:d=>{d==null||d.preventDefault(),d.stopPropagation(),Z.emitMethod($.MainEngine,x.ZIndexNode,{workIds:[k],layer:Fe.Bottom,viewId:s==null?void 0:s.viewId})},onTouchEndHandler:d=>{d.stopPropagation(),Z.emitMethod($.MainEngine,x.ZIndexNode,{workIds:[k],layer:Fe.Bottom,viewId:s==null?void 0:s.viewId})}})):null,[t,c]),u=d=>{d==null||d.preventDefault(),d.stopPropagation(),d.nativeEvent.stopImmediatePropagation(),e(!t)},M=d=>{d.stopPropagation(),d.nativeEvent.stopImmediatePropagation(),e(!t)};return h.useEffect(()=>{ce(n==null?void 0:n.selectIds,r)||n!=null&&n.selectIds&&!ce(n==null?void 0:n.selectIds,r)&&(a(n==null?void 0:n.selectIds),e(!1))},[t,n,r,e]),h.createElement("div",{className:`button normal-button ${t&&"active"}`,onClick:u,onTouchEnd:M},l,h.createElement("img",{alt:"icon",src:le(t?"layer-pressed":"layer")}))},gp=o=>{const{activeColor:t,onClickHandler:e,onTouchEndHandler:i}=o;return h.createElement("div",{className:`font-color-button ${t==="transparent"?"active":""}`,onClick:e,onTouchEnd:i},h.createElement("div",{className:"circle none"}))},ai=o=>{const{color:t,activeColor:e,onClickHandler:i,onTouchEndHandler:n}=o;return h.createElement("div",{className:`font-color-button ${t===e?"active":""}`,onClick:i,onTouchEnd:n},h.createElement("div",{className:"circle",style:{backgroundColor:he(t,1)}}))},ci=o=>{const{opacity:t,activeColor:e,setCurOpacity:i}=o,[n,s]=h.useState({x:108,y:0});if(h.useEffect(()=>{s({x:t*100+8,y:0})},[]),!e)return null;const r=q.throttle((l,u)=>{l==null||l.preventDefault(),l.stopPropagation(),u.x!==(n==null?void 0:n.x)&&s({x:u.x,y:0});const M=Math.min(Math.max(u.x-8,0),100)/100;t!==M&&i(M,e,C.Doing)},100,{leading:!1}),a=l=>{l==null||l.preventDefault(),l.stopPropagation(),i(t,e,C.Start)},c=q.throttle((l,u)=>{l==null||l.preventDefault(),l.stopPropagation(),u.x!==(n==null?void 0:n.x)&&s({x:u.x,y:0});const M=Math.min(Math.max(u.x-8,0),100)/100;i(M,e,C.Done)},100,{leading:!1});return h.createElement("div",{className:"font-color-opacity",style:{marginLeft:"10px"},onClick:l=>{const u=l.nativeEvent.offsetX,M=Math.min(Math.max(u-12,0),100)/100;s({x:M*100+8,y:0}),i(M,e,C.Done)}},h.createElement("div",{className:"range-color",style:{background:`linear-gradient(to right, ${he(e,0)}, ${he(e,1)})`}}),h.createElement("div",{className:"range-opacity"},h.createElement(st,{bounds:"parent",axis:"x",position:n,onDrag:r,onStart:a,onStop:c},h.createElement("div",{className:"circle",style:{backgroundColor:he(e,t)},onClick:l=>{l==null||l.preventDefault(),l.stopPropagation()}}))))},Mp=o=>{const{open:t,setOpen:e,floatBarRef:i}=o,{floatBarData:n,floatBarColors:s,maranger:r,setFloatBarData:a}=h.useContext(se),[c,l]=h.useState(),[u,M]=h.useState(1);h.useEffect(()=>{if(n!=null&&n.strokeColor){const[p,I]=ri(n.strokeColor);l(p),M(I)}},[n]);const d=h.useMemo(()=>{if(i!=null&&i.current&&q.isNumber(n==null?void 0:n.y)&&(r!=null&&r.height)){if(i.current.offsetTop&&i.current.offsetTop+n.y>180){const p={};return p.top="inherit",p.bottom=50,p}else if(!i.current.offsetTop&&(r==null?void 0:r.height)-i.current.offsetTop-n.y<120){const p={};return p.top="inherit",p.bottom=50,p}}},[i,n==null?void 0:n.y,r]),g=h.useMemo(()=>h.createElement(ci,{key:"strokeColors",opacity:u,activeColor:c,setCurOpacity:(p,I,w)=>{w===C.Start&&(r!=null&&r.control.room)&&(r.control.room.disableDeviceInputs=!0),w===C.Done&&(r!=null&&r.control.room)&&(r.control.room.disableDeviceInputs=!1),M(p);const m=he(I,p);n!=null&&n.strokeColor&&(n.strokeColor=m,a({strokeColor:m})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],strokeColor:m,workState:w,viewId:r==null?void 0:r.viewId})}}),[u,c,r==null?void 0:r.control.room,r==null?void 0:r.viewId,n]),v=h.useMemo(()=>t?h.createElement("div",{className:"font-colors-menu",style:d,onTouchEnd:p=>{p.stopPropagation(),p.nativeEvent.stopImmediatePropagation()},onClick:p=>{p==null||p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation()}},s.concat().map((p,I)=>{const w=Lt(...p);return h.createElement(ai,{key:I,color:w,activeColor:c,onTouchEndHandler:m=>{m.stopPropagation(),l(w);const T=he(w,u);n!=null&&n.strokeColor&&(n.strokeColor=T,a({strokeColor:T})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],workState:C.Done,strokeColor:T,viewId:r==null?void 0:r.viewId})},onClickHandler:m=>{m==null||m.preventDefault(),m.stopPropagation(),l(w);const T=he(w,u);n!=null&&n.strokeColor&&(n.strokeColor=T,a({strokeColor:T})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],workState:C.Done,strokeColor:T,viewId:r==null?void 0:r.viewId})}})}),g):null,[t,s,g,c,u,n,r==null?void 0:r.viewId,d]),y=h.useMemo(()=>c?h.createElement("div",{className:"color-bar-ring",style:{backgroundColor:he(c,u)}},h.createElement("div",{className:"circle"})):null,[c,u]);return h.createElement("div",{className:`button normal-button font-colors-icon ${t&&"active"}`,onTouchEnd:p=>{p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),e(!t)},onClick:p=>{p==null||p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),e(!t)}},y,v)},pp=o=>{const{open:t,setOpen:e,floatBarRef:i}=o,{floatBarData:n,floatBarColors:s,maranger:r,setFloatBarData:a}=h.useContext(se),[c,l]=h.useState(),[u,M]=h.useState(1);h.useEffect(()=>{if(n!=null&&n.fillColor){const[p,I]=(n==null?void 0:n.fillColor)==="transparent"&&["transparent",1]||ri(n.fillColor);l(p),M(I)}},[n]);const d=h.useMemo(()=>{if(i!=null&&i.current&&q.isNumber(n==null?void 0:n.y)&&(r!=null&&r.height)){if(i.current.offsetTop&&i.current.offsetTop+n.y>200){const p={};return p.top="inherit",p.bottom=50,p}else if(!i.current.offsetTop&&(r==null?void 0:r.height)-i.current.offsetTop-n.y<140){const p={};return p.top="inherit",p.bottom=50,p}}},[i,n==null?void 0:n.y,r]),g=h.useMemo(()=>c&&c!=="transparent"?h.createElement(ci,{key:"fillColors",opacity:u||0,activeColor:c,setCurOpacity:(p,I,w)=>{w===C.Start&&(r!=null&&r.control.room)&&(r.control.room.disableDeviceInputs=!0),w===C.Done&&(r!=null&&r.control.room)&&(r.control.room.disableDeviceInputs=!1),M(p);const m=he(I,p);n!=null&&n.fillColor&&(n.fillColor=m,a({fillColor:m})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],fillColor:c&&he(I,p),workState:w,viewId:r==null?void 0:r.viewId})}}):null,[c,u,r==null?void 0:r.control.room,r==null?void 0:r.viewId,n]),v=h.useMemo(()=>t?h.createElement("div",{className:"font-colors-menu",style:d,onTouchEnd:p=>{p.stopPropagation(),p.nativeEvent.stopImmediatePropagation()},onClick:p=>{p==null||p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation()}},h.createElement(gp,{activeColor:c,onTouchEndHandler:p=>{p.stopPropagation(),l("transparent");const I="transparent";n!=null&&n.fillColor&&(n.fillColor=I,a({fillColor:I})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],workState:C.Done,fillColor:I,viewId:r==null?void 0:r.viewId})},onClickHandler:p=>{p==null||p.preventDefault(),p.stopPropagation(),l("transparent");const I="transparent";n!=null&&n.fillColor&&(n.fillColor=I,a({fillColor:I})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],workState:C.Done,fillColor:I,viewId:r==null?void 0:r.viewId})}}),s.map((p,I)=>{const w=Lt(...p);return h.createElement(ai,{key:I,color:w,activeColor:c,onTouchEndHandler:m=>{m.stopPropagation(),l(w);const T=he(w,u);n!=null&&n.fillColor&&(n.fillColor=T,a({fillColor:T})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],workState:C.Done,fillColor:T,viewId:r==null?void 0:r.viewId})},onClickHandler:m=>{m==null||m.preventDefault(),m.stopPropagation(),l(w);const T=he(w,u);n!=null&&n.fillColor&&(n.fillColor=T,a({fillColor:T})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:[k],workState:C.Done,fillColor:T,viewId:r==null?void 0:r.viewId})}})}),g):null,[t,c,s,g,n,r==null?void 0:r.viewId,u,d]),y=h.useMemo(()=>{const p=c&&c!=="transparent"&&he(c,u)||"transparent";return h.createElement("div",{className:"color-bar-fill"},h.createElement("div",{className:"circle",style:{backgroundColor:p}}))},[c,u]);return h.createElement("div",{className:`button normal-button font-colors-icon ${t&&"active"}`,onTouchEnd:p=>{p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),e(!t)},onClick:p=>{p==null||p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),e(!t)}},y,v)},fp=o=>{const{open:t,setOpen:e,textOpt:i,workIds:n,floatBarRef:s}=o,{floatBarColors:r,maranger:a,setFloatBarData:c,floatBarData:l}=h.useContext(se),[u,M]=h.useState(),[d,g]=h.useState(1);h.useEffect(()=>{if(i!=null&&i.fontColor){const[w,m]=(i==null?void 0:i.fontColor)==="transparent"&&["transparent",0]||ri(i.fontColor);M(w),g(m)}},[i==null?void 0:i.fontColor]);const v=h.useMemo(()=>{if(s!=null&&s.current&&q.isNumber(l==null?void 0:l.y)&&(a!=null&&a.height)){if(s.current.offsetTop&&s.current.offsetTop+l.y>180){const w={};return w.top="inherit",w.bottom=50,w}else if(!s.current.offsetTop&&(a==null?void 0:a.height)-s.current.offsetTop-l.y<120){const w={};return w.top="inherit",w.bottom=50,w}}},[s,l==null?void 0:l.y,a]),y=h.useMemo(()=>u&&u!=="transparent"?h.createElement(ci,{key:"fontColors",opacity:d,activeColor:u,setCurOpacity:(w,m,T)=>{T===C.Start&&(a!=null&&a.control.room)&&(a.control.room.disableDeviceInputs=!0),T===C.Done&&(a!=null&&a.control.room)&&(a.control.room.disableDeviceInputs=!1),g(w);const z=he(m,w);l!=null&&l.textOpt&&(l.textOpt.fontColor=z,c({textOpt:l.textOpt})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:n||[k],fontColor:u&&z,workState:T,viewId:a==null?void 0:a.viewId})}}):null,[u,d,a==null?void 0:a.control.room,a==null?void 0:a.viewId,l==null?void 0:l.textOpt,n]),p=h.useMemo(()=>t?h.createElement("div",{className:"font-colors-menu",style:v,onTouchEnd:w=>{w.stopPropagation(),w.nativeEvent.stopImmediatePropagation()},onClick:w=>{w==null||w.preventDefault(),w.stopPropagation(),w.nativeEvent.stopImmediatePropagation()}},r.map((w,m)=>{const T=Lt(...w);return h.createElement(ai,{key:m,color:T,activeColor:u,onTouchEndHandler:z=>{z.stopPropagation(),M(T);const j=he(T,d);l!=null&&l.textOpt&&(l.textOpt.fontColor=j,c({textOpt:l.textOpt})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:n||[k],workState:C.Done,fontColor:j,viewId:a==null?void 0:a.viewId})},onClickHandler:z=>{z==null||z.preventDefault(),z.stopPropagation(),M(T);const j=he(T,d);l!=null&&l.textOpt&&(l.textOpt.fontColor=j,c({textOpt:l.textOpt})),Z.emitMethod($.MainEngine,x.SetColorNode,{workIds:n||[k],workState:C.Done,fontColor:j,viewId:a==null?void 0:a.viewId})}})}),y):null,[t,r,y,u,d,l==null?void 0:l.textOpt,n,a==null?void 0:a.viewId,v]),I=h.useMemo(()=>{const w=u&&u!=="transparent"&&he(u,d)||"transparent";return h.createElement("div",{className:"color-bar"},h.createElement("div",{className:"color-bar-color",style:{backgroundColor:w}}))},[u,d]);return h.createElement("div",{className:`button normal-button font-colors-icon ${t&&"active"}`,onTouchEnd:w=>{w.stopPropagation(),w.nativeEvent.stopImmediatePropagation(),e(!t)},onClick:w=>{w==null||w.preventDefault(),w.stopPropagation(),w.nativeEvent.stopImmediatePropagation(),e(!t)}},h.createElement("img",{alt:"icon",src:le("font-colors")}),I,p)},yp=o=>{const{bold:t,setBold:e,workIds:i,viewId:n}=o,s=r=>{const a=t==="bold"?"normal":"bold";r==null||r.preventDefault(),r==null||r.stopPropagation(),e(a),Z.emitMethod($.MainEngine,x.SetFontStyle,{workIds:i,viewId:n,bold:a})};return h.createElement("div",{className:"font-style-button",onClick:s,onTouchEnd:s},h.createElement("img",{alt:"icon",src:le(t==="bold"?"bold-active":"bold")}))},Ip=o=>{const{underline:t,setUnderline:e,workIds:i,viewId:n}=o,s=r=>{const a=!t;r==null||r.preventDefault(),r==null||r.stopPropagation(),e(a),Z.emitMethod($.MainEngine,x.SetFontStyle,{workIds:i,viewId:n,underline:a})};return h.createElement("div",{className:"font-style-button",onClick:s,onTouchEnd:s},h.createElement("img",{alt:"icon",src:le(t?"underline-active":"underline")}))},vp=o=>{const{lineThrough:t,setLineThrough:e,workIds:i,viewId:n}=o,s=r=>{const a=!t;r==null||r.preventDefault(),r==null||r.stopPropagation(),e(a),Z.emitMethod($.MainEngine,x.SetFontStyle,{workIds:i,viewId:n,lineThrough:a})};return h.createElement("div",{className:"font-style-button",onClick:s,onTouchEnd:s},h.createElement("img",{alt:"icon",src:le(t?"line-through-active":"line-through")}))},wp=o=>{const{italic:t,setItalic:e,workIds:i,viewId:n}=o,s=r=>{const a=t==="italic"?"normal":"italic";r==null||r.preventDefault(),r==null||r.stopPropagation(),e(a),Z.emitMethod($.MainEngine,x.SetFontStyle,{workIds:i,viewId:n,italic:a})};return h.createElement("div",{className:"font-style-button",onClick:s,onTouchEnd:s},h.createElement("img",{alt:"icon",src:le(t==="italic"?"italic-active":"italic")}))},Np=o=>{const{open:t,setOpen:e,textOpt:i,workIds:n,style:s}=o,{maranger:r}=h.useContext(se),[a,c]=h.useState("normal"),[l,u]=h.useState("normal"),[M,d]=h.useState(!1),[g,v]=h.useState(!1);h.useEffect(()=>{i!=null&&i.bold&&c(i.bold),we(i==null?void 0:i.underline)&&d(i.underline||!1),we(i==null?void 0:i.lineThrough)&&v(i.lineThrough||!1),i!=null&&i.italic&&u(i.italic)},[i]);const y=h.useMemo(()=>{if(s&&s.bottom){const I={};return I.top="inherit",I.bottom=50,I}},[s]),p=h.useMemo(()=>t?h.createElement("div",{className:"font-style-menu",style:y,onTouchEnd:I=>{I.stopPropagation(),I.nativeEvent.stopImmediatePropagation()},onClick:I=>{I==null||I.preventDefault(),I.stopPropagation(),I.nativeEvent.stopImmediatePropagation()}},h.createElement(yp,{workIds:n||[k],bold:a,setBold:c,viewId:r==null?void 0:r.viewId}),h.createElement(Ip,{workIds:n||[k],underline:M,setUnderline:d,viewId:r==null?void 0:r.viewId}),h.createElement(vp,{workIds:n||[k],lineThrough:g,setLineThrough:v,viewId:r==null?void 0:r.viewId}),h.createElement(wp,{workIds:n||[k],italic:l,setItalic:u,viewId:r==null?void 0:r.viewId})):null,[t,n,a,r==null?void 0:r.viewId,M,g,l,y]);return h.createElement("div",{className:`button normal-button ${t&&"active"}`,onTouchEnd:I=>{I.stopPropagation(),I.nativeEvent.stopImmediatePropagation(),e(!t)},onClick:I=>{I==null||I.preventDefault(),I.stopPropagation(),I.nativeEvent.stopImmediatePropagation(),e(!t)}},h.createElement("img",{alt:"icon",src:le(t?"font-style-active":"font-style")}),p)},Me=Object.freeze([12,14,18,24,36,48,64,80,144,288]),Ge=["top","topLeft","topRight","bottom","bottomLeft","bottomRight","left","leftTop","leftBottom","right","rightTop","rightBottom"],mp=o=>{const{style:t,onClickHandler:e}=o;return h.createElement("div",{className:"font-size-menu",style:t,onTouchEnd:i=>{i.stopPropagation(),i.nativeEvent.stopImmediatePropagation()},onClick:i=>{i==null||i.preventDefault(),i.stopPropagation(),i.nativeEvent.stopImmediatePropagation()}},Me.map(i=>h.createElement("div",{className:"font-size-btn",key:i,onClick:()=>{e(i)},onTouchEnd:()=>{e(i)}},i)))},Tp=o=>{const t=h.useRef(null),{open:e,setOpen:i,textOpt:n,workIds:s,floatBarRef:r}=o,{maranger:a,floatBarData:c}=h.useContext(se),[l,u]=h.useState(0),[M,d]=h.useState(),g=Me.length-1;h.useEffect(()=>{n!=null&&n.fontSize&&(u(n.fontSize),t.current&&(t.current.value=n.fontSize.toString()))},[n==null?void 0:n.fontSize]);const v=h.useMemo(()=>{if(r!=null&&r.current&&q.isNumber(c==null?void 0:c.y)&&(a!=null&&a.height)){if(r.current.offsetTop&&r.current.offsetTop+c.y>250){const m={};return m.top="inherit",m.bottom=35,m}else if(!r.current.offsetTop&&(a==null?void 0:a.height)-r.current.offsetTop-c.y<180){const m={};return m.top="inherit",m.bottom=35,m}}},[r,c==null?void 0:c.y,a]);function y(m){u(m),m&&m>=Me[0]&&m<=Me[g]&&Z.emitMethod($.MainEngine,x.SetFontStyle,{workIds:s||[k],fontSize:m,viewId:a==null?void 0:a.viewId})}const p=m=>{var T;u(m),i(!1),(T=t.current)==null||T.blur(),m&&m>=Me[0]&&m<=Me[g]&&Z.emitMethod($.MainEngine,x.SetFontStyle,{workIds:s||[k],fontSize:m,viewId:a==null?void 0:a.viewId})},I=h.useMemo(()=>e?h.createElement(mp,{onClickHandler:p,style:v}):null,[e,p,v]),w=m=>{m>Me[g]&&(m=Me[g]),m<Me[0]&&(m=Me[0]),y(m)};return h.useEffect(()=>()=>{a!=null&&a.control.room&&q.isBoolean(M)&&(a.control.room.disableDeviceInputs=M)},[a,M]),h.createElement("div",{className:"button normal-button font-size-barBtn",style:{width:50},onTouchEnd:m=>{m.stopPropagation(),m.nativeEvent.stopImmediatePropagation()},onClick:m=>{m==null||m.preventDefault(),m.stopPropagation(),m.nativeEvent.stopImmediatePropagation()}},h.createElement("input",{className:"font-size-input",ref:t,onTouchEnd:()=>{t.current&&t.current.focus()},onClick:()=>{i(!e),t.current&&t.current.focus()},onKeyDown:m=>{if(m.key==="Backspace"){const T=window.getSelection(),z=T==null?void 0:T.getRangeAt(0);if(z!=null&&z.collapsed)return m==null||m.preventDefault(),document.execCommand("delete",!1),!1}},onKeyUp:()=>{if(t.current){const m=t.current.value,T=parseInt(m);isNaN(T)?t.current.value="0":t.current.value=T.toString()}},onChange:m=>{const T=m.target.value,z=parseInt(T);z&&y(z)},onFocus:()=>{a!=null&&a.control.room&&!a.control.room.disableDeviceInputs&&(d(a.control.room.disableDeviceInputs),a.control.room.disableDeviceInputs=!0)},onBlur:()=>{a!=null&&a.control.room&&q.isBoolean(M)&&(a.control.room.disableDeviceInputs=M)}}),h.createElement("div",{className:"font-size-btns"},h.createElement("div",{className:"font-size-add",onClick:()=>{w(l+Me[0])},onTouchEnd:()=>{w(l+Me[0])}}),h.createElement("div",{className:"font-size-cut",onClick:()=>{w(l-Me[0])},onTouchEnd:()=>{w(l-Me[0])}})),I)},zp=o=>{const{workIds:t,maranger:e,islocked:i}=o;return h.createElement("div",{className:"button normal-button",onClick:n=>{n==null||n.preventDefault(),n.stopPropagation(),Z.emitMethod($.MainEngine,x.SetLock,{workIds:t||[k],isLocked:!i,viewId:e==null?void 0:e.viewId})},onTouchEnd:n=>{n.stopPropagation(),Z.emitMethod($.MainEngine,x.SetLock,{workIds:t||[k],isLocked:!i,viewId:e==null?void 0:e.viewId})}},h.createElement("img",{alt:"icon",src:le(i?"unlock-new":"lock-new")}))},Ft=o=>{const{icon:t,min:e,max:i,step:n,value:s,onInputHandler:r}=o,[a,c]=h.useState(0),l=h.useRef(null),u=M=>{M>i&&(M=i),M<e&&(M=e),c(M),r(M),l.current&&(l.current.value=M.toString())};return h.useEffect(()=>{s&&(c(s),l.current&&(l.current.value=s.toString()))},[s]),h.createElement("div",{className:"button input-button",onTouchEnd:M=>{M.stopPropagation(),M.nativeEvent.stopImmediatePropagation()},onClick:M=>{M==null||M.preventDefault(),M.stopPropagation(),M.nativeEvent.stopImmediatePropagation()}},h.createElement("img",{src:le(t)}),h.createElement("input",{className:"input-number",type:"text",ref:l,onTouchEnd:()=>{l.current&&l.current.focus()},onClick:()=>{l.current&&l.current.focus()},onKeyDown:M=>{if(M.key==="Backspace"){const d=window.getSelection(),g=d==null?void 0:d.getRangeAt(0);if(g!=null&&g.collapsed)return M==null||M.preventDefault(),document.execCommand("delete",!1),!1}},onKeyUp:()=>{if(l.current){const M=l.current.value,d=parseInt(M);isNaN(d)?l.current.value="0":l.current.value=d.toString()}},onChange:M=>{const d=M.target.value,g=parseInt(d);g&&g&&g>=e&&g<=i&&u(g)}}),h.createElement("div",{className:"input-number-btns"},h.createElement("div",{className:"input-number-add",onClick:()=>{u(a+n)},onTouchEnd:()=>{u(a+n)}}),h.createElement("div",{className:"input-number-cut",onClick:()=>{u(a-n)},onTouchEnd:()=>{u(a-n)}})))},Cp=o=>{const{icon:t,min:e,max:i,step:n,value:s,onInputHandler:r}=o;return h.createElement("div",{className:"button input-button"},h.createElement("img",{src:le(t)}),h.createElement(jp,{min:e,max:i,step:n,value:s,onInputHandler:r}))},jp=o=>{const{value:t,min:e,max:i,onInputHandler:n}=o,[s,r]=h.useState({x:0,y:0});h.useEffect(()=>{r({x:t*100,y:0})},[]);const a=q.throttle((u,M)=>{u==null||u.preventDefault(),u.stopPropagation();let d=Math.floor(Math.max(M.x,e*100));d=Math.floor(Math.min(d,i*100)),M.x!==(s==null?void 0:s.x)&&r({x:d,y:0});const g=d/100;console.log("first1--doing",M,M.x,d,g),t!==g&&n(g)},100,{leading:!1}),c=u=>{u==null||u.preventDefault(),u.stopPropagation()},l=q.throttle((u,M)=>{u==null||u.preventDefault(),u.stopPropagation();let d=Math.floor(Math.max(M.x,e*100));d=Math.floor(Math.min(d,i*100)),M.x!==(s==null?void 0:s.x)&&r({x:d,y:0});const g=d/100;console.log("first1--end",M,M.x,d,g),t!==g&&n(g)},100,{leading:!1});return h.createElement("div",{className:"range-number-container",onClick:u=>{const M=u.nativeEvent.offsetX-6;let d=Math.floor(Math.max(M,e*100));d=Math.floor(Math.min(d,i*100)),r({x:d,y:0});const g=d/100;console.log("first1",u.nativeEvent.offsetX,d,g),t!==g&&n(g)}},h.createElement("div",{className:"range-number-color"}),h.createElement("div",{className:"range-number"},h.createElement(st,{bounds:"parent",axis:"x",position:s,onDrag:a,onStart:c,onStop:l},h.createElement("div",{className:"circle",onClick:c}))))},Sp=o=>{const{icon:t,value:e,onChangeHandler:i,style:n}=o,[s,r]=h.useState(0),[a,c]=h.useState(),l=h.useRef(null),u=h.useCallback(g=>{g>=Ge.length&&(g=0),g<0&&(g=Ge.length-1),r(g),i(Ge[g]),c(!1),l.current&&(l.current.value=Ge[g])},[i]),M=h.useMemo(()=>{if(n&&n.bottom){const g={};return g.top="inherit",g.bottom=50,g}},[n]);h.useEffect(()=>{e&&(r(Ge.indexOf(e)),l.current&&(l.current.value=e))},[e]);const d=h.useMemo(()=>a?h.createElement(xp,{options:Ge,onClickHandler:u,style:M}):null,[a,u,M]);return h.createElement("div",{className:"button input-button"},h.createElement("img",{src:le(t)}),h.createElement("input",{readOnly:!0,className:"input-number",type:"text",ref:l,onTouchEnd:()=>{l.current&&l.current.focus()},onClick:()=>{l.current&&(l.current.focus(),c(!a))}}),h.createElement("div",{className:"input-number-btns"},h.createElement("div",{className:"input-number-add",onClick:()=>{u(s+1)},onTouchEnd:()=>{u(s+1)}}),h.createElement("div",{className:"input-number-cut",onClick:()=>{u(s-1)},onTouchEnd:()=>{u(s-1)}})),d)},xp=o=>{const{options:t,style:e,onClickHandler:i}=o;return h.createElement("div",{className:"select-option-menu",style:e,onTouchEnd:n=>{n.stopPropagation(),n.nativeEvent.stopImmediatePropagation()},onClick:n=>{n==null||n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopImmediatePropagation()}},t.map((n,s)=>h.createElement("div",{className:"select-option-btn",key:n,onClick:()=>{i(s)},onTouchEnd:()=>{i(s)}},n)))},Dp=o=>{const{maranger:t,innerRatio:e,innerVerticeStep:i,vertices:n}=o,s=c=>{console.log("onInputHandler",c),Z.emitMethod($.MainEngine,x.SetShapeOpt,{workIds:[k],toolsType:N.Star,viewId:t.viewId,vertices:c})},r=c=>{console.log("onInputHandler",c),Z.emitMethod($.MainEngine,x.SetShapeOpt,{workIds:[k],toolsType:N.Star,viewId:t.viewId,innerVerticeStep:c})},a=c=>{console.log("onInputHandler",c),Z.emitMethod($.MainEngine,x.SetShapeOpt,{workIds:[k],toolsType:N.Star,viewId:t.viewId,innerRatio:c})};return h.createElement(h.Fragment,null,h.createElement(Ft,{value:n,icon:"polygon-vertex",min:3,max:100,step:1,onInputHandler:s}),h.createElement(Ft,{value:i,icon:"star-innerVertex",min:1,max:100,step:1,onInputHandler:r}),h.createElement(Cp,{value:e,icon:"star-innerRatio",min:.1,max:1,step:.1,onInputHandler:a}))},Lp=o=>{const{maranger:t,vertices:e}=o,i=n=>{Z.emitMethod($.MainEngine,x.SetShapeOpt,{workIds:[k],toolsType:N.Polygon,viewId:t.viewId,vertices:n})};return h.createElement(Ft,{value:e,icon:"polygon-vertex",min:3,max:100,step:1,onInputHandler:i})},kp=o=>{const{maranger:t,placement:e}=o,i=n=>{console.log("onChangeHandler-SpeechBalloonFormView",n),Z.emitMethod($.MainEngine,x.SetShapeOpt,{workIds:[k],toolsType:N.SpeechBalloon,viewId:t.viewId,placement:n})};return h.createElement(Sp,{value:e,icon:"speechBallon-placement",onChangeHandler:i})},Ot=o=>{const{icon:t,isActive:e,onClickHandler:i,onTouchEndHandler:n}=o;return h.createElement("div",{className:`button tab-button ${e?"active":""}`,onClick:i,onTouchEnd:n},h.createElement("img",{src:le(t)}))},Ap=o=>{const{toolsTypes:t,style:e,maranger:i,shapeOpt:n}=o,[s,r]=h.useState();h.useEffect(()=>{t.includes(N.Polygon)?r(N.Polygon):t.includes(N.Star)?r(N.Star):r(N.SpeechBalloon)},[t]);const a=(M,d)=>{d==null||d.preventDefault(),d==null||d.stopPropagation(),r(M)},c=h.useMemo(()=>s===N.Polygon&&i&&n.vertices?h.createElement(Lp,{vertices:n.vertices,maranger:i}):null,[i,s,n]),l=h.useMemo(()=>s===N.Star&&i&&n.vertices&&n.innerVerticeStep&&n.innerRatio?h.createElement(Dp,{maranger:i,vertices:n.vertices,innerVerticeStep:n.innerVerticeStep,innerRatio:n.innerRatio}):null,[i,s,n]),u=h.useMemo(()=>s===N.SpeechBalloon&&i&&n.placement?h.createElement(kp,{maranger:i,placement:n.placement}):null,[i,s,n]);return h.createElement("div",{className:"shapeOpt-sub-menu",style:e,onClick:M=>{M.stopPropagation(),M.nativeEvent.stopImmediatePropagation(),M==null||M.preventDefault()}},h.createElement("div",{className:"shapeOpt-sub-menu-tabs"},t.includes(N.Polygon)&&h.createElement(Ot,{isActive:s===N.Polygon,icon:s===N.Polygon?"polygon-active":"polygon",onClickHandler:a.bind(void 0,N.Polygon),onTouchEndHandler:a.bind(void 0,N.Polygon)})||null,t.includes(N.Star)&&h.createElement(Ot,{isActive:s===N.Star,icon:s===N.Star?"star-active":"star",onClickHandler:a.bind(void 0,N.Star),onTouchEndHandler:a.bind(void 0,N.Star)})||null,t.includes(N.SpeechBalloon)&&h.createElement(Ot,{isActive:s===N.SpeechBalloon,icon:s===N.SpeechBalloon?"speechBallon-active":"speechBallon",onClickHandler:a.bind(void 0,N.SpeechBalloon),onTouchEndHandler:a.bind(void 0,N.SpeechBalloon)})||null),h.createElement("div",{className:"shapeOpt-sub-menu-content"},c,l,u))},bp=o=>{const{open:t,setOpen:e,floatBarRef:i,toolsTypes:n,shapeOpt:s}=o,{floatBarData:r,maranger:a}=h.useContext(se),[c,l]=h.useState([]),[u,M]=h.useState(),d=h.useMemo(()=>{if(i!=null&&i.current&&q.isNumber(r==null?void 0:r.x)&&q.isNumber(r==null?void 0:r.y)&&(a!=null&&a.height)){if(i.current.offsetTop&&i.current.offsetTop+r.y>200){const p={};return p.top="inherit",p.bottom=50,p}else if(!i.current.offsetTop&&(a==null?void 0:a.height)-i.current.offsetTop-r.y<140){const p={};return p.top="inherit",p.bottom=50,p}}},[i,r==null?void 0:r.x,r==null?void 0:r.y,a==null?void 0:a.height]),g=h.useMemo(()=>t&&n&&a&&s?(a.control.room&&!a.control.room.disableDeviceInputs&&(M(a.control.room.disableDeviceInputs),a.control.room.disableDeviceInputs=!0),h.createElement(Ap,{shapeOpt:s,style:d,toolsTypes:n,maranger:a})):(a!=null&&a.control.room&&we(u)&&(a.control.room.disableDeviceInputs=u),null),[t,d,n,a,s]),v=p=>{p==null||p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),e(!t)},y=p=>{p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),e(!t)};return h.useEffect(()=>{ce(r==null?void 0:r.selectIds,c)||r!=null&&r.selectIds&&!ce(r==null?void 0:r.selectIds,c)&&(l(r==null?void 0:r.selectIds),e(!1))},[t,r,c,e]),h.useEffect(()=>()=>{t&&a!=null&&a.control.room&&we(u)&&(a.control.room.disableDeviceInputs=u)},[t,a,u]),h.createElement("div",{className:`button normal-button ${t&&"active"}`,onClick:v,onTouchEnd:y},g,h.createElement("img",{alt:"icon",src:le(t?"shapes-active":"shapes")}))},Uo=h.memo(o=>{const{textOpt:t,workIds:e,noLayer:i,position:n}=o,{floatBarData:s,maranger:r}=h.useContext(se),[a,c]=h.useState(0),[l,u]=h.useState(),M=h.useRef(null);h.useEffect(()=>{var E,b,P,U;const T={},z=(s==null?void 0:s.w)||((E=t==null?void 0:t.boxSize)==null?void 0:E[0])||0,j=(s==null?void 0:s.h)||((b=t==null?void 0:t.boxSize)==null?void 0:b[1])||0;if(n&&z&&j&&(r!=null&&r.width)&&(r!=null&&r.height)){if(n.y<60?n.y+j<r.height-60?T.bottom=-120:n.y+j<r.height?T.bottom=-58:n.y>0?T.top=62:T.top=-n.y+62:T.top=0,n.x<0)T.left=-n.x+3;else if(n.x+(((P=M.current)==null?void 0:P.offsetWidth)||z)>r.width){const O=r.width-(((U=M.current)==null?void 0:U.offsetWidth)||z)-n.x;T.left=O}u(T);return}u(void 0)},[M,n,s==null?void 0:s.w,s==null?void 0:s.h,r==null?void 0:r.width,r==null?void 0:r.height,t==null?void 0:t.boxSize]);const d=h.useMemo(()=>s!=null&&s.fillColor?h.createElement(pp,{floatBarRef:M,open:a===3,setOpen:T=>{c(T===!0?3:0)}}):null,[s==null?void 0:s.fillColor,a,M]),g=h.useMemo(()=>s!=null&&s.strokeColor?h.createElement(Mp,{floatBarRef:M,open:a===2,setOpen:T=>{c(T===!0?2:0)}}):null,[s==null?void 0:s.strokeColor,a,M]),v=h.useMemo(()=>t!=null&&t.fontColor&&(r!=null&&r.viewId)?h.createElement(fp,{floatBarRef:M,open:a===4,setOpen:T=>{c(T===!0?4:0)},textOpt:t,workIds:e}):null,[t,a,e,r,M]),y=h.useMemo(()=>t&&(r!=null&&r.viewId)?h.createElement(Np,{open:a===6,setOpen:T=>{c(T===!0?6:0)},textOpt:t,workIds:e,style:l}):null,[t,a,e,r,l]),p=h.useMemo(()=>t&&(r!=null&&r.viewId)?h.createElement(Tp,{open:a===7,setOpen:T=>{c(T===!0?7:0)},textOpt:t,workIds:e,floatBarRef:M}):null,[t,a,e,r,M]),I=h.useMemo(()=>i?null:h.createElement(dp,{open:a===1,setOpen:T=>{c(T===!0?1:0)},floatBarRef:M}),[i,a,M]),w=h.useMemo(()=>s!=null&&s.canLock&&r?h.createElement(zp,{workIds:e,maranger:r,islocked:s.isLocked}):null,[s,r,e]),m=h.useMemo(()=>r&&(r!=null&&r.viewId)&&l&&(s!=null&&s.shapeOpt)&&(s!=null&&s.toolsTypes)?h.createElement(bp,{open:a===8,setOpen:T=>{c(T===!0?8:0)},floatBarRef:M,workIds:e,toolsTypes:s.toolsTypes,shapeOpt:s.shapeOpt}):null,[s,r,a,l,e,M]);return h.createElement("div",{className:"bezier-pencil-plugin-floatbtns",style:l,ref:M},r&&h.createElement(hp,{workIds:e,maranger:r}),I,w,!!(r!=null&&r.viewId)&&h.createElement(up,{workIds:e,viewId:r.viewId}),m,p,y,v,g,d)}),Ep=o=>{const{data:t,isActive:e,manager:i,workId:n}=o,{opt:s,scale:r,translate:a,x:c,y:l}=t,u=`scale(${r||1}) ${a&&"translate("+a[0]+"px,"+a[1]+"px)"||""}`,{fontSize:M,fontFamily:d,underline:g,fontColor:v,lineThrough:y,textAlign:p,strokeColor:I,lineHeight:w,bold:m,italic:T,uid:z}=s,j=M,E=w||j*1.2,b={fontSize:`${j}px`,lineHeight:`${E}px`,color:v,borderColor:I,minHeight:`${E}px`};d&&(b.fontFamily=`${d}`),(y||g)&&(b.textDecoration=`${y&&"line-through"||""}${g&&" underline"||""}`),m&&(b.fontWeight=`${m}`),T&&(b.fontStyle=`${T}`),p&&(b.textAlign=`${p}`);let P="";s!=null&&s.text&&(P=s.text.split(",").reduce((Q,B,_)=>{const oe=B===""?"<br/>":B;return _===0?oe:`${Q}<div>${oe}</div>`},""));function U(){var O;e&&(z&&z===((O=i.control.collector)==null?void 0:O.uid)||!z)&&i.control.textEditorManager.active(n)}return h.createElement("div",{className:"editor-box",style:{left:`${c}px`,top:`${l}px`,transform:u,transformOrigin:"left top",pointerEvents:"none"}},h.createElement("div",{className:`editor ${e?"":"readOnly"}`,style:b,dangerouslySetInnerHTML:{__html:P},onClick:U}))},Op=h.memo(o=>{const{data:t,left:e,top:i,workId:n,updateOptInfo:s}=o,{opt:r,scale:a,translate:c}=t,l=h.useRef(null);h.useEffect(()=>{var P,U;if((P=l.current)!=null&&P.offsetWidth&&((U=l.current)!=null&&U.offsetHeight)){const O=r.boxSize;if((O==null?void 0:O[0])!==l.current.offsetWidth||O[1]!==l.current.offsetHeight||!O){const Q=[l.current.offsetWidth,l.current.offsetHeight];s({activeTextId:n,update:{boxSize:Q,workState:C.Done}})}}},[r.fontSize]);const u=`scale(${a||1}) ${c&&"translate("+c[0]+"px,"+c[1]+"px)"||""}`,{fontSize:M,fontFamily:d,underline:g,fontColor:v,lineThrough:y,textAlign:p,strokeColor:I,lineHeight:w,bold:m,italic:T}=r,z=M,j=w||z*1.2,E={fontSize:`${z}px`,lineHeight:`${j}px`,color:v,borderColor:I,minHeight:`${j}px`,pointerEvents:"none"};d&&(E.fontFamily=`${d}`),(y||g)&&(E.textDecoration=`${y&&"line-through"||""}${g&&" underline"||""}`),p&&(E.textAlign=`${p}`),m&&(E.fontWeight=`${m}`),T&&(E.fontStyle=`${T}`);let b="";return r!=null&&r.text&&(b=r.text.split(",").reduce((U,O,Q)=>{const B=O===""?"<br/>":O;return Q===0?B:`${U}<div>${B}</div>`},"")),h.createElement("div",{className:"editor-box",style:{left:`${e}`,top:`${i}`,transform:u,transformOrigin:"left top",zIndex:1,pointerEvents:"none"}},h.createElement("div",{className:"editor readOnly",ref:l,style:E,dangerouslySetInnerHTML:{__html:b}}))},(o,t)=>!(o.workId!==t.workId||o.left!==t.left||o.top!==t.top||!q.isEqual(o.data,t.data))),Yp=o=>{const{data:t,workId:e,isSelect:i,handleKeyUp:n,handleFocus:s,updateOptInfo:r,showFloatBtns:a,manager:c}=o,[l,u]=h.useState(),{opt:M,scale:d,translate:g,x:v,y}=t,[p,I]=h.useState(""),w=h.useRef(null);h.useEffect(()=>{let Y="";M!=null&&M.text&&(Y=M.text.split(",").reduce((F,ne,ue)=>{const Te=ne===""?"<br/>":ne;return ue===0?Te:`${F}<div>${Te}</div>`},"")),I(Y),Promise.resolve().then(()=>{w.current&&w.current.click()})},[]),h.useEffect(()=>{var Y,R,F,ne;((Y=w.current)!=null&&Y.offsetWidth&&((R=w.current)!=null&&R.offsetHeight)||(F=w.current)!=null&&F.offsetLeft||(ne=w.current)!=null&&ne.offsetTop)&&r({activeTextId:e,update:{boxSize:[w.current.offsetWidth,w.current.offsetHeight],workState:C.Doing}})});const m=`scale(${d||1}) ${g&&"translate("+g[0]+"px,"+g[1]+"px)"||""}`,{fontSize:T,fontFamily:z,underline:j,fontColor:E,lineThrough:b,textAlign:P,strokeColor:U,lineHeight:O,bold:Q,italic:B}=M,_=T,oe=O||_*1.2,X={transform:m,transformOrigin:"left top",fontSize:`${_}px`,lineHeight:`${oe}px`,color:E,borderColor:U,minHeight:`${oe}px`};z&&(X.fontFamily=`${z}`),(b||j)&&(X.textDecoration=`${b&&"line-through"||""} ${j&&" underline"||""}`),P&&(X.textAlign=`${P}`),Q&&(X.fontWeight=`${Q}`),B&&(X.fontStyle=`${B}`);function H(){var Y;if(w.current){w.current.focus();const R=window==null?void 0:window.getSelection(),F=w.current.lastChild;if(R&&F){const ne=document.createRange(),ue=((Y=F.textContent)==null?void 0:Y.length)||0;(F==null?void 0:F.nodeName)==="#text"?ne.setStart(F,ue):ne.setStart(F,ue&&1||0),ne.collapse(!0),R.removeAllRanges(),R.addRange(ne)}}}function J(Y){if(Y.key==="Backspace"){const R=window.getSelection(),F=R==null?void 0:R.getRangeAt(0);if(F!=null&&F.collapsed)return Y==null||Y.preventDefault(),document.execCommand("delete",!1),!1}return o.handleKeyDown(Y),!1}function W(Y){var R,F;if(Y==null||Y.preventDefault(),w.current){let ne=(Y.clipboardData||window.clipboardData).getData("text");ne=ne.toUpperCase();const ue=window==null?void 0:window.getSelection();if(!(ue!=null&&ue.rangeCount))return;const Te=ne.split(/\n/);if(ue&&Te.length){ue.deleteFromDocument();const ke=document.createRange();let de=w.current.lastChild;if(!de){const Ae=document.createTextNode(Te[0]);if(w.current.appendChild(Ae),Te.length===1){const rt=((R=Ae.textContent)==null?void 0:R.length)||0;ke.setStart(Ae,rt),ke.collapse(!0),ue.removeAllRanges(),ue.addRange(ke);return}}if((de==null?void 0:de.nodeName)==="#text"&&(de.textContent=de.textContent+Te[0],Te.length===1)){const Ae=((F=de.textContent)==null?void 0:F.length)||0;ke.setStart(de,Ae),ke.collapse(!0),ue.removeAllRanges(),ue.addRange(ke);return}(de==null?void 0:de.nodeName)==="DIV"&&(de.innerText=de.innerText+Te[0]);for(let Ae=1;Ae<Te.length;Ae++){const rt=Te[Ae];if(rt){const hi=document.createElement("div");hi.innerText=rt,w.current.appendChild(hi)}}de=w.current.lastChild,de&&ke.setStart(de,1),ke.collapse(!0),ue.removeAllRanges(),ue.addRange(ke)}o.handleKeyDown(Y)}}return h.createElement("div",{className:"editor-box",style:{left:`${v}px`,top:`${y}px`,zIndex:2,pointerEvents:"none"},onFocus:()=>{c.control.room&&!c.control.room.disableDeviceInputs&&(u(c.control.room.disableDeviceInputs),c.control.room.disableDeviceInputs=!0)},onBlur:()=>{c!=null&&c.control.room&&q.isBoolean(l)&&(c.control.room.disableDeviceInputs=l)},onKeyDown:Y=>(Y.stopPropagation(),!0),onMouseMove:Y=>(Y.stopPropagation(),Y==null||Y.preventDefault(),!0)},!i&&a&&h.createElement(Uo,{textOpt:M,workIds:[e],noLayer:!0,position:{x:v,y}}),h.createElement("div",{id:e,contentEditable:!0,className:"editor",ref:w,style:X,dangerouslySetInnerHTML:{__html:p},onKeyDown:J,onKeyUp:n,onClick:H,onTouchEnd:H,onFocus:s,onPaste:W}))};class $o extends h.Component{constructor(t){super(t)}getInnerText(t){const e=[];for(let i=0;i<t.childNodes.length;i++){const n=t.childNodes[i];if(n.nodeName==="#text"&&i===0){const s=n.textContent.split(/\n/),r=s.pop();e.push(...s),r&&e.push(r)}else if(n.nodeName==="DIV"){const s=n.innerText.split(/\n/);if(s.length===2&&s[0]===""&&s[1]==="")e.push("");else{const r=s.shift();r&&e.push(r);const a=s.pop();e.push(...s),a&&e.push(a)}}}return e}updateOptInfo(t){var r,a;const{activeTextId:e,update:i,syncData:n}=t,s=e&&re(((r=this.props.manager.control.textEditorManager)==null?void 0:r.get(e))||((a=this.props.editors)==null?void 0:a.get(e)));s&&s.opt&&(s.opt={...s.opt,...i},n&&(s.canSync=Object.keys(n).includes("canSync")&&n.canSync||s.canSync,s.canWorker=Object.keys(n).includes("canWorker")&&n.canWorker||s.canWorker),this.props.manager.control.textEditorManager.updateForViewEdited(e,s))}get editorUI(){var t;if((t=this.props.editors)!=null&&t.size){const e=[];return this.props.editors.forEach((i,n)=>{if(this.props.selectIds.includes(n)&&!(this.props.activeTextId==n)&&this.props.box){const{x:r,y:a}=this.props.box,{x:c,y:l}=i,u=`${c-r}px`,M=`${l-a}px`,d=h.createElement(Op,{left:u,top:M,key:n,data:i,workId:n,isSelect:!0,updateOptInfo:this.updateOptInfo.bind(this),manager:this.props.manager});e.push(d)}}),e}return null}render(){return h.createElement(h.Fragment,null,this.editorUI)}}class Pp extends $o{constructor(e){super(e);f(this,"ref");this.ref=h.createRef()}handleKeyUp(e){const i=this.getInnerText(e.nativeEvent.target),n=this.props.activeTextId;n&&this.updateOptInfo({activeTextId:n,update:{text:i.toString(),boxSize:[e.nativeEvent.target.offsetWidth,e.nativeEvent.target.offsetHeight],workState:C.Doing},syncData:{canSync:!0,canWorker:!0}})}handleFocus(e){const i=this.props.activeTextId;i&&this.updateOptInfo({activeTextId:i,update:{boxSize:[e.nativeEvent.target.offsetWidth,e.nativeEvent.target.offsetHeight],workState:C.Doing},syncData:{canSync:!0,canWorker:!0}})}get editorUI(){var e;if((e=this.props.editors)!=null&&e.size){const i=[];return this.props.editors.forEach((n,s)=>{if(!(this.props.selectIds.includes(s)&&this.props.activeTextId!==s)){const c=this.props.activeTextId==s?h.createElement(Yp,{key:s,data:n,workId:s,showFloatBtns:this.props.showFloatBtns||!1,handleFocus:this.handleFocus.bind(this),handleKeyUp:this.handleKeyUp.bind(this),updateOptInfo:this.updateOptInfo.bind(this),handleKeyDown:()=>{requestAnimationFrame(()=>{var l,u;(l=this.ref)!=null&&l.current&&((u=this.ref)==null||u.current.scrollTo({left:0,behavior:"instant"}))})},manager:this.props.manager}):h.createElement(Ep,{manager:this.props.manager,isActive:n.opt.workState===C.Doing||n.opt.workState===C.Start||!1,key:s,data:n,workId:s});i.push(c)}}),i}return null}render(){return h.createElement("div",{className:`${this.props.className}`,ref:this.ref},this.editorUI)}}const Rp=()=>{const{floatBarData:o}=h.useContext(se);return h.createElement("div",{className:"bezier-pencil-plugin-hightlight-box",style:{borderColor:o==null?void 0:o.selectorColor}},h.createElement("div",{className:"point LT nwse-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point LC ew-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point LB nesw-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point TC ns-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point RT nesw-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point RC ew-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point RB nwse-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point BC ns-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}))},Wp=()=>{const{floatBarData:o}=h.useContext(se);return h.createElement("div",{className:"bezier-pencil-plugin-hightlight-box",style:{borderColor:o==null?void 0:o.selectorColor}})},Up=()=>{const{floatBarData:o}=h.useContext(se);return h.createElement("div",{className:"bezier-pencil-plugin-hightlight-box",style:{borderColor:o==null?void 0:o.selectorColor}},h.createElement("div",{className:"point LT nwse-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point LB nesw-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point RT nesw-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}),h.createElement("div",{className:"point RB nwse-resize",style:{backgroundColor:o==null?void 0:o.selectorColor}}))},$p=()=>{const{floatBarData:o}=h.useContext(se);return h.createElement("div",{className:"bezier-pencil-plugin-hightlight-box",style:{borderColor:o==null?void 0:o.selectorColor}},h.createElement("img",{className:"lock",alt:"lock",src:"https://sdk.netless.link/resource/icons/lock.svg"}))},Bp=o=>{const{className:t}=o,{floatBarData:e,angle:i,setAngle:n,setOperationType:s,maranger:r}=h.useContext(se),[a,c]=h.useState(!1),[l,u]=h.useState(new ie),[M,d]=h.useState(new ie);h.useEffect(()=>{if(e){const p=Math.floor(e.w/2),I=Math.floor(-e.h/2);d(new ie(p,I)),u(new ie)}},[e]);const g=(p,I)=>{p==null||p.preventDefault(),p.stopPropagation(),c(!0);const w=Math.round(ie.GetAngleByPoints(l,M,new ie(I.x,I.y)))||0;n(w),s(x.RotateNode),r!=null&&r.control.room&&(r.control.room.disableDeviceInputs=!0),Z.emitMethod($.MainEngine,x.RotateNode,{workIds:[k],angle:w,workState:C.Start,viewId:r==null?void 0:r.viewId})},v=Ie((p,I)=>{p==null||p.preventDefault(),p.stopPropagation(),c(!1);const w=Math.round(ie.GetAngleByPoints(l,M,new ie(I.x,I.y)))||0;n(w),s(x.None),r!=null&&r.control.room&&(r.control.room.disableDeviceInputs=!1),Z.emitMethod($.MainEngine,x.RotateNode,{workIds:[k],angle:w,workState:C.Done,viewId:r==null?void 0:r.viewId})},100,{leading:!1}),y=Ie((p,I)=>{p==null||p.preventDefault(),p.stopPropagation(),c(!0);const w=Math.round(ie.GetAngleByPoints(l,M,new ie(I.x,I.y)))||0;n(w),s(x.RotateNode),Z.emitMethod($.MainEngine,x.RotateNode,{workIds:[k],angle:w,workState:C.Doing,viewId:r==null?void 0:r.viewId})},100,{leading:!1});return h.createElement(st,{handle:".bezier-pencil-plugin-rotate-mouse-pointer",onStart:g,onDrag:y,onStop:v},h.createElement("div",{className:`${t}`,style:e?{left:e.x-30,top:e.y+e.h+20,touchAction:"none"}:void 0},!a&&h.createElement("div",{className:"bezier-pencil-plugin-rotate-btn",style:{backgroundColor:e==null?void 0:e.selectorColor}},h.createElement("img",{alt:"icon",src:le("rotation-button")})),h.createElement("div",{className:`bezier-pencil-plugin-rotate-mouse-pointer ${a?"active":""}`},h.createElement("img",{alt:"icon",src:le("rotation")}),h.createElement("div",{className:"angle-icon"},i,"°"))))},Fp=o=>{const{floatBarData:t,setOperationType:e,maranger:i}=h.useContext(se),{onClickHandle:n}=o,[s,r]=h.useState(C.Pending),[a,c]=h.useState(),[l,u]=h.useState();h.useEffect(()=>{q.isNumber(t==null?void 0:t.x)&&q.isNumber(t==null?void 0:t.y)&&(s===C.Pending||s===C.Done)&&u({x:t.x,y:t.y})},[s,t==null?void 0:t.x,t==null?void 0:t.y]);const M=y=>{y==null||y.preventDefault(),y.stopPropagation(),q.isNumber(t==null?void 0:t.x)&&q.isNumber(t==null?void 0:t.y)&&(e(x.TranslateNode),r(C.Start),c({x:t.x,y:t.y}),i!=null&&i.control.room&&(i.control.room.disableDeviceInputs=!0),Z.emitMethod($.MainEngine,x.TranslateNode,{workIds:[k],position:{x:t.x,y:t.y},workState:C.Start,viewId:i==null?void 0:i.viewId}))},d=q.throttle((y,p)=>{y==null||y.preventDefault(),y.stopPropagation();const I={x:p.x,y:p.y};e(x.None),r(C.Done),i!=null&&i.control.room&&(i.control.room.disableDeviceInputs=!1),console.log("onDragEndHandler"),Z.emitMethod($.MainEngine,x.TranslateNode,{workIds:[k],position:I,workState:C.Done,viewId:i==null?void 0:i.viewId})},100,{leading:!1}),g=q.throttle((y,p)=>{y==null||y.preventDefault(),y.stopPropagation();const I={x:p.x,y:p.y};(p.x!==(t==null?void 0:t.x)||p.y!==(t==null?void 0:t.y))&&(r(C.Doing),Z.emitMethod($.MainEngine,x.TranslateNode,{workIds:[k],position:I,workState:C.Doing,viewId:i==null?void 0:i.viewId}))},100,{leading:!1}),v=h.useMemo(()=>!!((t==null?void 0:t.scaleType)===ge.none&&(t!=null&&t.canLock)),[t]);return h.createElement(st,{disabled:!!(t!=null&&t.isLocked),position:l,onStart:M,onDrag:g,onStop:d},h.createElement("div",{style:t?{position:"absolute",left:0,top:0,width:t.w,height:t.h,zIndex:2,pointerEvents:v?"none":"auto",touchAction:"none"}:void 0,onClick:q.throttle(y=>(y.stopPropagation(),y==null||y.preventDefault(),(a==null?void 0:a.x)===(t==null?void 0:t.x)&&(a==null?void 0:a.y)===(t==null?void 0:t.y)&&(console.log("computeTextActive"),n(y)),!1),100,{leading:!1}),onTouchEndCapture:q.throttle(y=>(y.stopPropagation(),y==null||y.preventDefault(),i&&s!==C.Doing&&(console.log("computeTextActive--1"),n(y)),!1),100,{leading:!1})}))},Qp=o=>{const{className:t}=o,[e,i]=h.useState({x:0,y:0,h:0,w:0}),{floatBarData:n,maranger:s}=h.useContext(se);h.useEffect(()=>{n&&i({x:n.x,y:n.y,w:n.w,h:n.h})},[]);const r=l=>{if(l==null||l.preventDefault(),l.stopPropagation(),n!=null&&n.w&&(n!=null&&n.h)){const u={x:(n==null?void 0:n.x)||0,y:(n==null?void 0:n.y)||0,w:n.w,h:n.h};i(u),s!=null&&s.control.room&&(s.control.room.disableDeviceInputs=!0),Z.emitMethod($.MainEngine,x.ScaleNode,{workIds:[k],box:u,workState:C.Start,viewId:s==null?void 0:s.viewId})}},a=Ie((l,u,M,d)=>{l==null||l.preventDefault(),l.stopPropagation();const g={x:e.x,y:e.y,w:e.w,h:e.h};switch(g.w+=d.width,g.h+=d.height,u){case"bottomLeft":case"left":g.x-=d.width;break;case"topLeft":g.x-=d.width,g.y-=d.height;break;case"top":case"topRight":g.y-=d.height;break}(d.width!==0||d.height!==0)&&Z.emitMethod($.MainEngine,x.ScaleNode,{workIds:[k],box:g,dir:u,workState:C.Doing,viewId:s==null?void 0:s.viewId})},100,{leading:!1}),c=Ie((l,u,M,d)=>{l==null||l.preventDefault(),l.stopPropagation();const g={x:e.x,y:e.y,w:e.w,h:e.h};switch(g.w+=d.width,g.h+=d.height,u){case"bottomLeft":case"left":g.x-=d.width;break;case"topLeft":g.x-=d.width,g.y-=d.height;break;case"top":case"topRight":g.y-=d.height;break}s!=null&&s.control.room&&(s.control.room.disableDeviceInputs=!1),Z.emitMethod($.MainEngine,x.ScaleNode,{workIds:[k],box:g,dir:u,workState:C.Done,viewId:s==null?void 0:s.viewId})},100,{leading:!1});return h.createElement(Ho.Resizable,{className:`${t}`,boundsByDirection:!0,size:{width:(n==null?void 0:n.w)||0,height:(n==null?void 0:n.h)||0},style:{position:"absolute",pointerEvents:"auto",left:n==null?void 0:n.x,top:n==null?void 0:n.y},enable:{top:(n==null?void 0:n.scaleType)===ge.all&&!0||!1,right:(n==null?void 0:n.scaleType)===ge.all&&!0||!1,bottom:(n==null?void 0:n.scaleType)===ge.all&&!0||!1,left:(n==null?void 0:n.scaleType)===ge.all&&!0||!1,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},lockAspectRatio:(n==null?void 0:n.scaleType)===ge.proportional,onResizeStart:r,onResize:a,onResizeStop:c})},Xi=o=>{const{id:t,pos:e,pointMap:i,type:n}=o,{setOperationType:s,maranger:r,floatBarData:a}=h.useContext(se),[c,l]=h.useState({x:0,y:0}),[u,M]=h.useState(C.Pending);h.useEffect(()=>{(u===C.Pending||u===C.Done)&&l(e)},[e,u]);const d=y=>{y==null||y.preventDefault(),y.stopPropagation(),s(x.SetPoint),M(C.Start),r!=null&&r.control.room&&(r.control.room.disableDeviceInputs=!0),Z.emitMethod($.MainEngine,x.SetPoint,{workId:k,pointMap:i,workState:C.Start,viewId:r==null?void 0:r.viewId})},g=Ie((y,p)=>{if(y==null||y.preventDefault(),y.stopPropagation(),s(x.SetPoint),M(C.Doing),p.x!==(c==null?void 0:c.x)||p.y!==(c==null?void 0:c.y)){const I=i.get(t);I&&n==="start"&&(r!=null&&r.control.viewContainerManager)?I[0]=r.control.viewContainerManager.transformToScenePoint([p.x,p.y],r.viewId):I&&n==="end"&&(r!=null&&r.control.viewContainerManager)&&(I[1]=r.control.viewContainerManager.transformToScenePoint([p.x,p.y],r.viewId)),Z.emitMethod($.MainEngine,x.SetPoint,{workId:k,pointMap:i,workState:C.Doing,viewId:r==null?void 0:r.viewId})}},100,{leading:!1}),v=Ie((y,p)=>{if(y==null||y.preventDefault(),y.stopPropagation(),s(x.None),M(C.Done),p.x!==(c==null?void 0:c.x)||p.y!==(c==null?void 0:c.y)){l(p);const I=i.get(t);I&&n==="start"&&(r!=null&&r.control.viewContainerManager)?I[0]=r.control.viewContainerManager.transformToScenePoint([p.x,p.y],r.viewId):I&&n==="end"&&(r!=null&&r.control.viewContainerManager)&&(I[1]=r.control.viewContainerManager.transformToScenePoint([p.x,p.y],r.viewId)),Z.emitMethod($.MainEngine,x.SetPoint,{workId:k,pointMap:i,workState:C.Done,viewId:r==null?void 0:r.viewId})}},100,{leading:!1});return h.createElement(st,{position:c,onStart:d,onDrag:g,onStop:v},h.createElement("div",{className:"bezier-pencil-plugin-point-draggable-btn"},h.createElement("div",{className:"bezier-pencil-plugin-point-draggable-btn-inner",style:{borderColor:a==null?void 0:a.selectorColor}})))},Hp=o=>{const{className:t}=o,{floatBarData:e,maranger:i}=h.useContext(se),[n,s]=h.useState(),[r,a]=h.useState(),[c,l]=h.useState(new Map);h.useEffect(()=>{const d=[];if(i&&(e!=null&&e.points)){const g=i.viewId;if(i.control.viewContainerManager.getView(g))for(const y of e.points){const p=i.control.viewContainerManager.transformToOriginPoint(y,g);d.push(p)}e!=null&&e.selectIds&&e.selectIds.length===1&&(c.set(e.selectIds[0],e.points),l(c))}d[0]&&s({x:d[0][0],y:d[0][1]}),d[1]&&a({x:d[1][0],y:d[1][1]})},[i,e==null?void 0:e.points,e==null?void 0:e.selectIds,c]);const u=h.useMemo(()=>n&&(e!=null&&e.selectIds)?h.createElement(Xi,{pos:n,type:"start",id:e.selectIds[0],pointMap:c}):null,[n,e==null?void 0:e.selectIds,c]),M=h.useMemo(()=>r&&(e!=null&&e.selectIds)?h.createElement(Xi,{pos:r,type:"end",id:e.selectIds[0],pointMap:c}):null,[r,e==null?void 0:e.selectIds,c]);return h.createElement("div",{className:`${t}`},u,M)},Zp=h.forwardRef((o,t)=>{const{floatBarData:e,operationType:i}=h.useContext(se),n=h.useMemo(()=>(e==null?void 0:e.scaleType)!==ge.all||i===x.RotateNode?null:h.createElement(Rp,null),[e,i]),s=h.useMemo(()=>(e==null?void 0:e.scaleType)!==ge.both||i===x.RotateNode?null:h.createElement(Wp,null),[e,i]),r=h.useMemo(()=>(e==null?void 0:e.scaleType)!==ge.proportional||i===x.RotateNode?null:h.createElement(Up,null),[e,i]),a=h.useMemo(()=>(e==null?void 0:e.scaleType)===ge.none&&(e!=null&&e.canLock)?h.createElement($p,null):null,[e]);return h.createElement("div",{ref:t,style:e?{transform:`translate(${e.x}px,${e.y}px)`,width:e.w,height:e.h,pointerEvents:"none"}:void 0},a,n,s,r,o.children)}),Vp=h.forwardRef((o,t)=>{var d;const{floatBarData:e,operationType:i,maranger:n}=h.useContext(se),{editors:s,activeTextId:r}=o,a=h.useMemo(()=>{var g;return e!=null&&e.canRotate&&((g=e==null?void 0:e.selectIds)==null?void 0:g.length)===1&&(i===x.None||i===x.RotateNode)?h.createElement(Bp,{className:fe.RotateBtn}):null},[e==null?void 0:e.canRotate,(d=e==null?void 0:e.selectIds)==null?void 0:d.length,i]),c=h.useMemo(()=>((e==null?void 0:e.scaleType)===ge.all||(e==null?void 0:e.scaleType)===ge.proportional)&&(i===x.None||i===x.ScaleNode)?h.createElement(Qp,{className:fe.ResizeBtn}):null,[e==null?void 0:e.scaleType,i]),l=h.useMemo(()=>(e==null?void 0:e.scaleType)===ge.both&&(i===x.None||i===x.SetPoint)?h.createElement(Hp,{className:fe.ResizeTowBox}):null,[e==null?void 0:e.scaleType,i]),u=h.useMemo(()=>{const g=(e==null?void 0:e.selectIds)||[];return s&&n&&g&&q.isNumber(e==null?void 0:e.x)&&q.isNumber(e==null?void 0:e.y)&&q.isNumber(e==null?void 0:e.w)&&q.isNumber(e==null?void 0:e.h)?h.createElement($o,{box:{x:e==null?void 0:e.x,y:e==null?void 0:e.y,w:e==null?void 0:e.w,h:e==null?void 0:e.h},manager:n,selectIds:g,activeTextId:r,editors:s}):null},[e==null?void 0:e.selectIds,e==null?void 0:e.x,e==null?void 0:e.y,e==null?void 0:e.w,e==null?void 0:e.h,s,n,r]),M=h.useMemo(()=>i===x.None&&q.isNumber(e==null?void 0:e.x)&&q.isNumber(e==null?void 0:e.y)&&q.isNumber(e==null?void 0:e.w)&&q.isNumber(e==null?void 0:e.h)?h.createElement("div",{className:fe.FloatBarBtn,style:{left:e==null?void 0:e.x,top:e==null?void 0:e.y,width:e.w,height:e.h}},h.createElement(Uo,{position:{x:e.x,y:e.y},textOpt:e==null?void 0:e.textOpt,noLayer:e==null?void 0:e.isLocked})):null,[e==null?void 0:e.x,e==null?void 0:e.y,e==null?void 0:e.w,e==null?void 0:e.h,e==null?void 0:e.textOpt,e==null?void 0:e.isLocked,i]);return h.createElement("div",{className:fe.FloatBar},h.createElement(Zp,{ref:t},h.createElement(h.Fragment,null,u)),h.createElement(Fp,{onClickHandle:g=>{if(n&&(s!=null&&s.size)){const v=n.getPoint(g.nativeEvent);v&&n.control.textEditorManager.computeTextActive(v,n.viewId)}}}),a,c,l,M)}),Gp=h.memo(Vp,(o,t)=>!!ce(o,t)),Jp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYISURBVHgB7ZpNSCtXFIBPEuvz+dMGpYUKD/sWFX+Qti6kK7Hqpm6e9q0rIoIUFUShPLV10VZx4+JZqa9v20LBhdq9fyBUCtKNPH8qYl2IOw3G38Rkek4y15y5uTOZJDOWggcOSSYzN/ebc+45554JwIM8iBCPyTEP+86T4vyMfsRN4b+nQTKIJp0vzuGvlpID7os8EQNEIBD4oKio6Bm9DwaDv/v9/n/076JgbtWUYPchwrW8qD7UnOvr6wFNkpubm+/wu7f0c7y6mrnlvQufxB0Iau7V1dX3BDA/P6/V1dVpzc3N2uLiIofK1c8VYHys/wRKBUN3/hGHqaysNOjc3FwMis6hc0FtLTHuvYLxCCZgci8uLn4wg5Gh6Fy8Jk+/NkcCAlAAuUkoW4g0B+d5tLS05O/r67O8eGxsDNra2uDy8nKsoKCAwCIQDxQa0yTxgrvCYXyTk5Ml+Orf2dlJeeHIyAigFSE/P38ELfUNqNdSkjgF5FF89jL1TU1NlQwODl5gZPujp6cHWltbUw7Koc7Pz8mkZpHPFeFrJuZeqLnoMoPoZqe0JjDP/IZgnyLUG/o8NDRkuo5Ua2pjY6MC4oFCFf1cA0oKzRSOp6enRfTaGh0d/QxBt+1CUVgnOTs7+xrHfQzGyOcKkK3QTJMnQffZ6e/v/xwttmsHq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ltltb2//E4wVAN82y7vOjKOZXSBhJdHNiT3TYWD8OY2PTUJkdd7MkJMnT5wZVQF2RFX6yBMUdzPMvvfqxz3sXHF+GNT9ANXit/10O1sgHkZvdQAOKvs9B5L7ARELGAAXLSTvM8QExTE+YbHe+HURhZp1aRyF4CJXClbbWwGketgkW9VsY+YaiBCVhfgE+XvxRwgZSM4jUVCDZFQ9pytmXR8hUTB2gnidx4XffVWydN0yQjwmx/jkAZJBrIBI5J7ZvQGZWUgVSuU/EqmOAzicKNMVu816DdRWUV1/7xAP8n+SfwF3Du3NF2sYhwAAAABJRU5ErkJggg==",Kp="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='40px'%20height='40px'%20viewBox='0%200%2040%2040'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2060.1%20(88133)%20-%20https://sketch.com%20--%3e%3ctitle%3eshape-cursor%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpath%20d='M20,21.5%20C20.2454599,21.5%2020.4496084,21.6768752%2020.4919443,21.9101244%20L20.5,22%20L20.5,27%20C20.5,27.2761424%2020.2761424,27.5%2020,27.5%20C19.7545401,27.5%2019.5503916,27.3231248%2019.5080557,27.0898756%20L19.5,27%20L19.5,22%20C19.5,21.7238576%2019.7238576,21.5%2020,21.5%20Z%20M27,19.5%20C27.2761424,19.5%2027.5,19.7238576%2027.5,20%20C27.5,20.2454599%2027.3231248,20.4496084%2027.0898756,20.4919443%20L27,20.5%20L22,20.5%20C21.7238576,20.5%2021.5,20.2761424%2021.5,20%20C21.5,19.7545401%2021.6768752,19.5503916%2021.9101244,19.5080557%20L22,19.5%20L27,19.5%20Z%20M18,19.5%20C18.2761424,19.5%2018.5,19.7238576%2018.5,20%20C18.5,20.2454599%2018.3231248,20.4496084%2018.0898756,20.4919443%20L18,20.5%20L13,20.5%20C12.7238576,20.5%2012.5,20.2761424%2012.5,20%20C12.5,19.7545401%2012.6768752,19.5503916%2012.9101244,19.5080557%20L13,19.5%20L18,19.5%20Z%20M20,12.5%20C20.2454599,12.5%2020.4496084,12.6768752%2020.4919443,12.9101244%20L20.5,13%20L20.5,18%20C20.5,18.2761424%2020.2761424,18.5%2020,18.5%20C19.7545401,18.5%2019.5503916,18.3231248%2019.5080557,18.0898756%20L19.5,18%20L19.5,13%20C19.5,12.7238576%2019.7238576,12.5%2020,12.5%20Z'%20id='path-1'%3e%3c/path%3e%3cfilter%20x='-64.6%25'%20y='-59.5%25'%20width='229.3%25'%20height='246.1%25'%20filterUnits='objectBoundingBox'%20id='filter-2'%3e%3cfeMorphology%20radius='1'%20operator='dilate'%20in='SourceAlpha'%20result='shadowSpreadOuter1'%3e%3c/feMorphology%3e%3cfeOffset%20dx='0'%20dy='2'%20in='shadowSpreadOuter1'%20result='shadowOffsetOuter1'%3e%3c/feOffset%3e%3cfeGaussianBlur%20stdDeviation='3'%20in='shadowOffsetOuter1'%20result='shadowBlurOuter1'%3e%3c/feGaussianBlur%3e%3cfeComposite%20in='shadowBlurOuter1'%20in2='SourceAlpha'%20operator='out'%20result='shadowBlurOuter1'%3e%3c/feComposite%3e%3cfeColorMatrix%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.16%200'%20type='matrix'%20in='shadowBlurOuter1'%3e%3c/feColorMatrix%3e%3c/filter%3e%3c/defs%3e%3cg%20id='页面-4'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Whiteboard-Guidelines'%20transform='translate(-344.000000,%20-751.000000)'%3e%3cg%20id='shape-cursor'%20transform='translate(344.000000,%20751.000000)'%3e%3crect%20id='矩形备份-44'%20fill='%23FFFFFF'%20opacity='0.01'%20x='0'%20y='0'%20width='40'%20height='40'%20rx='2'%3e%3c/rect%3e%3cg%20id='形状结合'%20fill-rule='nonzero'%3e%3cuse%20fill='black'%20fill-opacity='1'%20filter='url(%23filter-2)'%20xlink:href='%23path-1'%3e%3c/use%3e%3cpath%20stroke='%23FFFFFF'%20stroke-width='1'%20d='M20,21%20C20.4854103,21%2020.898085,21.3479993%2020.9899479,21.8654877%20L21,22%20L21,27%20C21,27.5522847%2020.5522847,28%2020,28%20C19.5145897,28%2019.101915,27.6520007%2019.0100521,27.1345123%20L19,27%20L19,22%20C19,21.4477153%2019.4477153,21%2020,21%20Z%20M27,19%20C27.5522847,19%2028,19.4477153%2028,20%20C28,20.4854103%2027.6520007,20.898085%2027.1345123,20.9899479%20L27,21%20L22,21%20C21.4477153,21%2021,20.5522847%2021,20%20C21,19.5145897%2021.3479993,19.101915%2021.8654877,19.0100521%20L22,19%20L27,19%20Z%20M18,19%20C18.5522847,19%2019,19.4477153%2019,20%20C19,20.4854103%2018.6520007,20.898085%2018.1345123,20.9899479%20L18,21%20L13,21%20C12.4477153,21%2012,20.5522847%2012,20%20C12,19.5145897%2012.3479993,19.101915%2012.8654877,19.0100521%20L13,19%20L18,19%20Z%20M20,12%20C20.4854103,12%2020.898085,12.3479993%2020.9899479,12.8654877%20L21,13%20L21,18%20C21,18.5522847%2020.5522847,19%2020,19%20C19.5145897,19%2019.101915,18.6520007%2019.0100521,18.1345123%20L19,18%20L19,13%20C19,12.4477153%2019.4477153,12%2020,12%20Z'%20fill='%23212324'%20fill-rule='evenodd'%3e%3c/path%3e%3c/g%3e%3crect%20id='矩形'%20fill='%23FFFFFF'%20x='18.5'%20y='17'%20width='3'%20height='6'%3e%3c/rect%3e%3crect%20id='矩形'%20fill='%23FFFFFF'%20x='17'%20y='18.5'%20width='6'%20height='3'%3e%3c/rect%3e%3cpath%20d='M20,21.5%20C20.2454599,21.5%2020.4496084,21.6768752%2020.4919443,21.9101244%20L20.5,22%20L20.5,27%20C20.5,27.2761424%2020.2761424,27.5%2020,27.5%20C19.7545401,27.5%2019.5503916,27.3231248%2019.5080557,27.0898756%20L19.5,27%20L19.5,22%20C19.5,21.7238576%2019.7238576,21.5%2020,21.5%20Z%20M27,19.5%20C27.2761424,19.5%2027.5,19.7238576%2027.5,20%20C27.5,20.2454599%2027.3231248,20.4496084%2027.0898756,20.4919443%20L27,20.5%20L22,20.5%20C21.7238576,20.5%2021.5,20.2761424%2021.5,20%20C21.5,19.7545401%2021.6768752,19.5503916%2021.9101244,19.5080557%20L22,19.5%20L27,19.5%20Z%20M18,19.5%20C18.2761424,19.5%2018.5,19.7238576%2018.5,20%20C18.5,20.2454599%2018.3231248,20.4496084%2018.0898756,20.4919443%20L18,20.5%20L13,20.5%20C12.7238576,20.5%2012.5,20.2761424%2012.5,20%20C12.5,19.7545401%2012.6768752,19.5503916%2012.9101244,19.5080557%20L13,19.5%20L18,19.5%20Z%20M20,12.5%20C20.2454599,12.5%2020.4496084,12.6768752%2020.4919443,12.9101244%20L20.5,13%20L20.5,18%20C20.5,18.2761424%2020.2761424,18.5%2020,18.5%20C19.7545401,18.5%2019.5503916,18.3231248%2019.5080557,18.0898756%20L19.5,18%20L19.5,13%20C19.5,12.7238576%2019.7238576,12.5%2020,12.5%20Z'%20id='形状结合'%20fill='%23212324'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qp="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='47px'%20height='40px'%20viewBox='0%200%2047%2040'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3c!--%20Generator:%20Sketch%2060.1%20(88133)%20-%20https://sketch.com%20--%3e%3ctitle%3etext-cursor%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpath%20d='M16,26.5%20C15.7238576,26.5%2015.5,26.2761424%2015.5,26%20C15.5,25.7545401%2015.6768752,25.5503916%2015.9101244,25.5080557%20L16,25.5%20L19.5,25.5%20L19.5,14.5%20L16,14.5%20C15.7238576,14.5%2015.5,14.2761424%2015.5,14%20C15.5,13.7545401%2015.6768752,13.5503916%2015.9101244,13.5080557%20L16,13.5%20L24,13.5%20C24.2761424,13.5%2024.5,13.7238576%2024.5,14%20C24.5,14.2454599%2024.3231248,14.4496084%2024.0898756,14.4919443%20L24,14.5%20L20.5,14.5%20L20.5,25.5%20L24,25.5%20C24.2761424,25.5%2024.5,25.7238576%2024.5,26%20C24.5,26.2454599%2024.3231248,26.4496084%2024.0898756,26.4919443%20L24,26.5%20L16,26.5%20Z'%20id='path-1'%3e%3c/path%3e%3cfilter%20x='-284.0%25'%20y='-81.5%25'%20width='668.1%25'%20height='293.9%25'%20filterUnits='objectBoundingBox'%20id='filter-2'%3e%3cfeMorphology%20radius='1'%20operator='dilate'%20in='SourceAlpha'%20result='shadowSpreadOuter1'%3e%3c/feMorphology%3e%3cfeOffset%20dx='0'%20dy='2'%20in='shadowSpreadOuter1'%20result='shadowOffsetOuter1'%3e%3c/feOffset%3e%3cfeGaussianBlur%20stdDeviation='3'%20in='shadowOffsetOuter1'%20result='shadowBlurOuter1'%3e%3c/feGaussianBlur%3e%3cfeComposite%20in='shadowBlurOuter1'%20in2='SourceAlpha'%20operator='out'%20result='shadowBlurOuter1'%3e%3c/feComposite%3e%3cfeColorMatrix%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.16%200'%20type='matrix'%20in='shadowBlurOuter1'%3e%3c/feColorMatrix%3e%3c/filter%3e%3c/defs%3e%3cg%20id='页面-4'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Whiteboard-Guidelines'%20transform='translate(-388.000000,%20-672.000000)'%3e%3cg%20id='text-cursor'%20transform='translate(392.000000,%20672.000000)'%3e%3crect%20id='矩形备份-40'%20fill='%23FFFFFF'%20opacity='0.01'%20x='0'%20y='0'%20width='40'%20height='40'%20rx='2'%3e%3c/rect%3e%3cg%20id='形状结合'%20fill-rule='nonzero'%3e%3cuse%20fill='black'%20fill-opacity='1'%20filter='url(%23filter-2)'%20xlink:href='%23path-1'%3e%3c/use%3e%3cpath%20stroke='%23FFFFFF'%20stroke-width='1'%20d='M19,25%20L19,15%20L16,15%20C15.4477153,15%2015,14.5522847%2015,14%20C15,13.5145897%2015.3479993,13.101915%2015.8654877,13.0100521%20L16,13%20L24,13%20C24.5522847,13%2025,13.4477153%2025,14%20C25,14.4854103%2024.6520007,14.898085%2024.1345123,14.9899479%20L24,15%20L21,15%20L21,25%20L24,25%20C24.5522847,25%2025,25.4477153%2025,26%20C25,26.4854103%2024.6520007,26.898085%2024.1345123,26.9899479%20L24,27%20L16,27%20C15.4477153,27%2015,26.5522847%2015,26%20C15,25.5145897%2015.3479993,25.101915%2015.8654877,25.0100521%20L16,25%20L19,25%20Z'%20fill='%23212324'%20fill-rule='evenodd'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";class _p extends h.Component{constructor(e){super(e);f(this,"renderAvatar",e=>{var n;const i=`rgb(${e.memberState.strokeColor[0]}, ${e.memberState.strokeColor[1]}, ${e.memberState.strokeColor[2]})`;if(this.detectAvatar(e)){const s=this.detectCursorName(e);return h.createElement("img",{className:"cursor-selector-avatar",style:{width:s?19:28,height:s?19:28,position:s?"initial":"absolute",borderColor:s?"white":i,marginRight:s?4:0},src:(n=e.payload)==null?void 0:n.avatar,alt:"avatar"})}else return null});f(this,"getOpacity",e=>{const i=this.getCursorName(e),n=this.detectAvatar(e);return i===void 0&&n===void 0?0:1});f(this,"getCursorName",e=>{if(e.payload&&e.payload.cursorName)return e.payload.cursorName});f(this,"getThemeClass",e=>e.payload&&e.payload.theme?"cursor-inner-mellow":"cursor-inner");f(this,"getCursorBackgroundColor",e=>{const i=this.detectCursorName(e);return e.payload&&e.payload.cursorBackgroundColor?e.payload.cursorBackgroundColor:i?`rgb(${e.memberState.strokeColor[0]}, ${e.memberState.strokeColor[1]}, ${e.memberState.strokeColor[2]})`:void 0});f(this,"getCursorTextColor",e=>e.payload&&e.payload.cursorTextColor?e.payload.cursorTextColor:"#FFFFFF");f(this,"getCursorTagBackgroundColor",e=>e.payload&&e.payload.cursorTagBackgroundColor?e.payload.cursorTagBackgroundColor:this.getCursorBackgroundColor(e));f(this,"detectCursorName",e=>!!(e.payload&&e.payload.cursorName));f(this,"detectAvatar",e=>!!(e.payload&&e.payload.avatar));f(this,"renderTag",e=>{if(e.payload&&e.payload.cursorTagName)return h.createElement("span",{className:"cursor-tag-name",style:{backgroundColor:this.getCursorTagBackgroundColor(e)}},e.payload.cursorTagName)})}render(){const{roomMember:e}=this.props,i=this.getCursorName(e);switch(e.memberState.currentApplianceName){case V.pencil:return h.createElement("div",{className:"cursor-box"},h.createElement("div",{className:"cursor-mid cursor-pencil-offset",style:{transform:"translate(-50%, -90%)",marginLeft:"10px"}},h.createElement("div",{className:"cursor-name"},h.createElement("div",{style:{opacity:this.getOpacity(e),backgroundColor:this.getCursorBackgroundColor(e),color:this.getCursorTextColor(e)},className:this.getThemeClass(e)},this.renderAvatar(e),i,this.renderTag(e))),h.createElement("div",null,h.createElement("img",{className:"cursor-pencil-image",src:Jp,alt:"pencilCursor"}))));case V.text:return h.createElement("div",{className:"cursor-box"},h.createElement("div",{className:"cursor-mid cursor-pencil-offset",style:{transform:"translate(-50%, -65%)",marginLeft:"0px"}},h.createElement("div",{className:"cursor-name"},h.createElement("div",{style:{opacity:this.getOpacity(e),backgroundColor:this.getCursorBackgroundColor(e),color:this.getCursorTextColor(e)},className:this.getThemeClass(e)},this.renderAvatar(e),i,this.renderTag(e))),h.createElement("div",null,h.createElement("img",{className:"cursor-arrow-image",src:qp,alt:"textCursor"}))));case V.rectangle:case V.arrow:case V.straight:case V.shape:case V.ellipse:return h.createElement("div",{className:"cursor-box"},h.createElement("div",{className:"cursor-mid cursor-pencil-offset",style:{transform:"translate(-50%, -65%)",marginLeft:"0px"}},h.createElement("div",{className:"cursor-name"},h.createElement("div",{style:{opacity:this.getOpacity(e),backgroundColor:this.getCursorBackgroundColor(e),color:this.getCursorTextColor(e)},className:this.getThemeClass(e)},this.renderAvatar(e),i,this.renderTag(e))),h.createElement("div",null,h.createElement("img",{className:"cursor-arrow-image",src:Kp,alt:"shapeCursor"}))));default:return null}}}const Xp=o=>{const{className:t,info:e}=o,{roomMember:i,...n}=e||{};return h.createElement("div",{className:`${t}`,style:n?{transform:`translate(${n.x}px, ${n.y}px)`}:{display:"none"}},i&&h.createElement(_p,{roomMember:i}))},ef=o=>{const{className:t,manager:e}=o,[i,n]=h.useState();h.useEffect(()=>(e.internalMsgEmitter.on([$.Cursor,e.viewId],s),()=>{e.internalMsgEmitter.off([$.Cursor,e.viewId],s)}),[e]);function s(a){n(a)}return h.useMemo(()=>{if(i!=null&&i.length){const a=i.map(c=>{var l;return c.roomMember?h.createElement(Xp,{key:(l=c.roomMember)==null?void 0:l.memberId,className:t,info:c}):null});return h.createElement(h.Fragment,null,a)}return null},[i])},se=h.createContext({maranger:void 0,floatBarColors:[],floatBarData:void 0,zIndex:-1,dpr:1,angle:0,operationType:x.None,scale:[1,1],setAngle:()=>{},setOperationType:()=>{},setFloatBarData:()=>{}});class li extends h.Component{constructor(e){var i;super(e);f(this,"setAngle",e=>{this.setState({angle:e})});f(this,"setOperationType",e=>{this.setState({operationType:e})});this.state={floatBarData:void 0,showFloatBar:!1,zIndex:-1,dpr:1,angle:0,operationType:x.None,scale:[1,1],editors:this.editors,activeTextId:(i=this.props.maranger.control.textEditorManager)==null?void 0:i.activeId}}get editors(){return re(this.props.maranger.control.textEditorManager.filterEditor(this.props.maranger.viewId))}componentDidMount(){this.props.maranger.vDom=this,this.props.maranger.mountView(),this.setState({dpr:this.props.maranger.dpr})}componentWillUnmount(){}showFloatBar(e,i){const n=e&&i&&{...this.state.floatBarData,...i}||void 0;this.setState({showFloatBar:e,floatBarData:n,angle:0})}setActiveTextEditor(e){this.setState({activeTextId:e,editors:this.editors})}setFloatZIndex(e){this.setState({zIndex:e})}setFloatBarData(e){this.state.floatBarData&&this.setState({floatBarData:{...this.state.floatBarData,...e}})}render(){var i,n,s,r,a,c,l;const e=!!((n=(i=this.props.maranger.control)==null?void 0:i.room)!=null&&n.floatBarOptions);return h.createElement(h.Fragment,null,h.createElement("div",{className:fe.Container,onMouseDown:u=>{u==null||u.preventDefault(),u.stopPropagation()},onTouchStart:u=>{u.stopPropagation()},onMouseMove:u=>{this.props.maranger.cursorMouseMove(u)}},!this.props.maranger.control.hasOffscreenCanvas()&&h.createElement("div",{className:fe.CanvasBox,ref:this.props.refs.canvasContainerRef})||h.createElement("div",{className:fe.CanvasBox},h.createElement("canvas",{id:"bgCanvas",ref:this.props.refs.canvasBgRef}),h.createElement("canvas",{id:"serviceCanvas",className:fe.FloatCanvas,ref:this.props.refs.canvasServiceFloatRef}),h.createElement("canvas",{id:"localCanvas",className:fe.FloatCanvas,ref:this.props.refs.canvasFloatRef}),h.createElement("canvas",{id:"topCanvas",className:fe.TopFloatCanvas,ref:this.props.refs.canvasTopRef})),!this.props.maranger.control.hasOffscreenCanvas()&&this.props.refs.snapshotContainerRef&&h.createElement("div",{className:fe.SnapshotBox,ref:this.props.refs.snapshotContainerRef})||null,h.createElement(se.Provider,{value:{maranger:this.props.maranger,floatBarColors:e&&((a=(r=(s=this.props.maranger.control)==null?void 0:s.room)==null?void 0:r.floatBarOptions)==null?void 0:a.colors)||[],floatBarData:this.state.floatBarData,zIndex:this.state.zIndex,dpr:this.state.dpr,angle:this.state.angle,operationType:this.state.operationType,scale:this.state.scale,setAngle:this.setAngle.bind(this),setOperationType:this.setOperationType.bind(this),setFloatBarData:this.setFloatBarData.bind(this)}},this.state.showFloatBar&&h.createElement(Gp,{ref:this.props.refs.floatBarRef,editors:this.state.editors,activeTextId:this.state.activeTextId})||null,((c=this.state.editors)==null?void 0:c.size)&&h.createElement(Pp,{className:fe.TextEditorContainer,showFloatBtns:e,manager:this.props.maranger,selectIds:((l=this.state.floatBarData)==null?void 0:l.selectIds)||[],editors:this.state.editors,activeTextId:this.state.activeTextId})||null),h.createElement(ef,{className:fe.CursorBox,manager:this.props.maranger})))}}class ut extends ve{constructor(e,i){super(e,i);f(this,"width",1e3);f(this,"height",1e3);f(this,"dpr",1);f(this,"vDom");f(this,"eventTragetElement");f(this,"snapshotContainerRef");f(this,"canvasContainerRef",h.createRef());f(this,"canvasTopRef",h.createRef());f(this,"canvasServiceFloatRef",h.createRef());f(this,"canvasFloatRef",h.createRef());f(this,"canvasBgRef",h.createRef());f(this,"floatBarRef",h.createRef());f(this,"containerOffset",{x:0,y:0});this.control.hasOffscreenCanvas()||(this.snapshotContainerRef=h.createRef())}setCanvassStyle(){if(this.eventTragetElement){const e=this.eventTragetElement.offsetWidth||this.width,i=this.eventTragetElement.offsetHeight||this.height;e&&i&&this.canvasContainerRef.current&&(this.dpr=Pe(),this.width=e,this.height=i,this.canvasContainerRef.current.style.width=`${e}px`,this.canvasContainerRef.current.style.height=`${i}px`),e&&i&&this.snapshotContainerRef&&this.snapshotContainerRef.current&&(this.dpr=Pe(),this.width=e,this.height=i),e&&i&&this.canvasBgRef.current&&(this.dpr=Pe(this.canvasBgRef.current.getContext("2d")),this.width=e,this.height=i,this.canvasBgRef.current.style.width=`${e}px`,this.canvasBgRef.current.style.height=`${i}px`,this.canvasBgRef.current.width=e*this.dpr,this.canvasBgRef.current.height=i*this.dpr,this.canvasFloatRef.current&&(this.canvasFloatRef.current.style.width=`${e}px`,this.canvasFloatRef.current.style.height=`${i}px`,this.canvasFloatRef.current.width=e*this.dpr,this.canvasFloatRef.current.height=i*this.dpr),this.canvasServiceFloatRef.current&&(this.canvasServiceFloatRef.current.style.width=`${e}px`,this.canvasServiceFloatRef.current.style.height=`${i}px`,this.canvasServiceFloatRef.current.width=e*this.dpr,this.canvasServiceFloatRef.current.height=i*this.dpr),this.canvasTopRef.current&&(this.canvasTopRef.current.style.width=`${e}px`,this.canvasTopRef.current.style.height=`${i}px`,this.canvasTopRef.current.width=e*this.dpr,this.canvasTopRef.current.height=i*this.dpr))}}destroy(){if(super.destroy(),this.eventTragetElement){const e=this.eventTragetElement.parentElement;if(e){const i=e.querySelectorAll(".teaching-aids-plugin-main-view-displayer");for(const n of i)n.remove()}}}createMainViewDisplayer(e){const i=document.createElement("div");return i.className="teaching-aids-plugin-main-view-displayer",e.appendChild(i),this.eventTragetElement=e.children[0],this.containerOffset=this.getContainerOffset(this.eventTragetElement,this.containerOffset),this.bindToolsClass(),Vt.render(h.createElement(li,{viewId:this.viewId,maranger:this,refs:{canvasServiceFloatRef:this.canvasServiceFloatRef,canvasFloatRef:this.canvasFloatRef,canvasBgRef:this.canvasBgRef,floatBarRef:this.floatBarRef,canvasTopRef:this.canvasTopRef,canvasContainerRef:this.canvasContainerRef,snapshotContainerRef:this.snapshotContainerRef}}),i),this.control.room&&this.bindDisplayerEvent(this.eventTragetElement),this}}class tf extends KM{constructor(e,i,n){super(e,i,n);f(this,"dpr",1);f(this,"width",1e3);f(this,"height",1e3);f(this,"vDom");f(this,"eventTragetElement");f(this,"canvasContainerRef",h.createRef());f(this,"canvasTopRef",h.createRef());f(this,"canvasServiceFloatRef",h.createRef());f(this,"canvasFloatRef",h.createRef());f(this,"canvasBgRef",h.createRef());f(this,"floatBarRef",h.createRef());f(this,"containerOffset",{x:0,y:0})}setCanvassStyle(){if(this.eventTragetElement){if(this.canvasContainerRef.current){const e=this.eventTragetElement.offsetWidth||this.width,i=this.eventTragetElement.offsetHeight||this.height;e&&i&&(this.width=e,this.height=i,this.dpr=Pe(),this.canvasContainerRef.current.style.width=`${e}px`,this.canvasContainerRef.current.style.height=`${i}px`)}if(this.canvasBgRef.current){this.dpr=Pe(this.canvasBgRef.current.getContext("2d"));const e=this.eventTragetElement.offsetWidth||this.width,i=this.eventTragetElement.offsetHeight||this.height;e&&i&&(this.width=e,this.height=i,this.canvasBgRef.current.style.width=`${e}px`,this.canvasBgRef.current.style.height=`${i}px`,this.canvasBgRef.current.width=e*this.dpr,this.canvasBgRef.current.height=i*this.dpr,this.canvasFloatRef.current&&(this.canvasFloatRef.current.style.width=`${e}px`,this.canvasFloatRef.current.style.height=`${i}px`,this.canvasFloatRef.current.width=e*this.dpr,this.canvasFloatRef.current.height=i*this.dpr),this.canvasServiceFloatRef.current&&(this.canvasServiceFloatRef.current.style.width=`${e}px`,this.canvasServiceFloatRef.current.style.height=`${i}px`,this.canvasServiceFloatRef.current.width=e*this.dpr,this.canvasServiceFloatRef.current.height=i*this.dpr),this.canvasTopRef.current&&(this.canvasTopRef.current.style.width=`${e}px`,this.canvasTopRef.current.style.height=`${i}px`,this.canvasTopRef.current.width=e*this.dpr,this.canvasTopRef.current.height=i*this.dpr))}}}createAppViewDisplayer(e,i){const n=document.createElement("div");return n.className="teaching-aids-plugin-app-view-displayer",i.appendChild(n),this.eventTragetElement=i.children[0],this.containerOffset=this.getContainerOffset(this.eventTragetElement,this.containerOffset),this.bindToolsClass(),Vt.render(h.createElement(li,{viewId:e,maranger:this,refs:{canvasServiceFloatRef:this.canvasServiceFloatRef,canvasFloatRef:this.canvasFloatRef,canvasBgRef:this.canvasBgRef,floatBarRef:this.floatBarRef,canvasTopRef:this.canvasTopRef,canvasContainerRef:this.canvasContainerRef}}),n),this.control.room&&this.bindDisplayerEvent(this.eventTragetElement),this}}class Ce extends Ke{constructor(e){super(e);f(this,"focuedViewId");f(this,"focuedView");f(this,"control");f(this,"tmpFocusedViewId");f(this,"checkScaleTimer");f(this,"onMainViewRelease",e=>{this.control.textEditorManager.clear(ut.viewId,!0),console.log("onMainViewRelease",e),this.onMainViewMounted(e);const i=this.control.getSnapshootData("memberState");this.control.room&&this.control.onMemberChange(i),this.control.clearSnapshootData()});f(this,"onMainViewMounted",e=>{var d;const i=e.divElement;if(!i||!e.focusScenePath||!(e.focusScenePath||e.scenePath))return;if(this.mainView&&this.mainView.displayer){this.mainView.displayer.destroy();const g=i.getElementsByClassName("teaching-aids-plugin-main-view-displayer");for(const v of g)v.remove();(d=this.control.worker)==null||d.destroyViewWorker(this.mainView.id,!0),this.mainView=void 0}const s=new ut(this.control,Ne.InternalMsgEmitter),r=e.size.width||s.width,a=e.size.height||s.height,l={dpr:s.dpr,originalPoint:[r/2,a/2],offscreenCanvasOpt:{...Ce.defaultScreenCanvasOpt,width:r,height:a},layerOpt:{...Ce.defaultLayerOpt,width:r,height:a},cameraOpt:{...Ce.defaultCameraOpt,width:r,height:a}},{scale:u,...M}=e.camera;l.cameraOpt={...l.cameraOpt,...M,scale:u===1/0?1:u},this.focuedViewId=ut.viewId,this.createMianView({id:ut.viewId,container:i,displayer:s,focusScenePath:e.focusScenePath,cameraOpt:l.cameraOpt,viewData:e}),this.focuedView=this.mainView,s.createMainViewDisplayer(i),e.callbacks.on("onSizeUpdated",this.onMainViewSizeUpdated),e.callbacks.on("onCameraUpdated",this.onMainViewCameraUpdated),e.callbacks.on("onActiveHotkey",this.onActiveHotkeyChange.bind(this))});f(this,"onMainViewSizeUpdated",async()=>{Promise.resolve().then(()=>{if(this.mainView&&this.mainView.viewData){const e=this.mainView.viewData.size,i=this.mainView.cameraOpt;i&&(this.mainView.displayer.updateSize(),this.mainView.cameraOpt={...i,...e})}})});f(this,"onMainViewCameraUpdated",async()=>{Promise.resolve().then(()=>{if(this.mainView&&this.mainView.viewData){const e=this.mainView.viewData.camera,i=this.mainView.cameraOpt;if(i){const n=e.scale===1/0?1:e.scale,s=e.centerX||0,r=e.centerY||0;this.mainView.cameraOpt={...i,scale:n,centerX:s,centerY:r},this.checkScaleTimer&&e.scale==1/0&&(clearTimeout(this.checkScaleTimer),this.checkScaleTimer=void 0),!this.checkScaleTimer&&e.scale===1/0&&this.mainView.viewData&&this.mainView.viewData.camera.scale===1/0&&(this.checkScaleTimer=setTimeout(()=>{var a,c;(c=(a=this.mainView)==null?void 0:a.viewData)==null||c.moveCamera({scale:n,centerX:s,centerY:r,animationMode:"immediately"}),this.checkScaleTimer=void 0},500))}}})});f(this,"onAppViewMounted",e=>{var d;const{appId:i,view:n}=e,s=n.divElement;if(!s||!n.focusScenePath)return;const r=this.appViews.get(i);if(r&&r.displayer){const g=s.getElementsByClassName("teaching-aids-plugin-app-view-displayer");for(const v of g)v.remove();this.destroyAppView(e.appId,!0),(d=this.control.worker)==null||d.destroyViewWorker(i,!0)}const a=new tf(i,this.control,Ne.InternalMsgEmitter),c=n.size.width||a.width,l=n.size.height||a.height,M={dpr:a.dpr,originalPoint:[c/2,l/2],offscreenCanvasOpt:{...Ce.defaultScreenCanvasOpt,width:c,height:l},layerOpt:{...Ce.defaultLayerOpt,width:c,height:l},cameraOpt:{...Ce.defaultCameraOpt,...n.camera,width:c,height:l}};if(this.createAppView({id:i,container:s,displayer:a,cameraOpt:M.cameraOpt,focusScenePath:n.focusScenePath,viewData:n}),a.createAppViewDisplayer(i,s),n.callbacks.on("onSizeUpdated",this.onAppViewSizeUpdated.bind(this,i)),n.callbacks.on("onCameraUpdated",this.onAppViewCameraUpdated.bind(this,i)),n.callbacks.on("onActiveHotkey",this.onActiveHotkeyChange.bind(this)),this.tmpFocusedViewId===i){const g=this.control.worker.getLocalWorkViewId();g&&g!==i?this.setFocuedViewId(g):this.setFocuedViewId(i),this.tmpFocusedViewId=void 0}});f(this,"onAppViewSizeUpdated",async e=>{Promise.resolve().then(()=>{const i=this.appViews.get(e);if(i&&i.viewData){const n=i.viewData.size,s=i.cameraOpt;s&&(i.displayer.updateSize(),i.cameraOpt={...s,...n})}})});f(this,"onAppViewCameraUpdated",async e=>{Promise.resolve().then(()=>{const i=this.appViews.get(e);if(i&&i.viewData){const n=i.viewData.camera,s=i.cameraOpt;if(s){const r=n.scale===1/0?1:n.scale,a=n.centerX||0,c=n.centerY||0;i.cameraOpt={...s,scale:r,centerX:a,centerY:c}}}})});this.control=e.control}async mountView(e){var n,s;const i=this.getView(e);if(i){const{width:r,height:a,dpr:c}=i.displayer,l={dpr:c,originalPoint:[r/2,a/2],offscreenCanvasOpt:{...Ce.defaultScreenCanvasOpt,width:r,height:a},layerOpt:{...Ce.defaultLayerOpt,width:r,height:a},cameraOpt:{...Ce.defaultCameraOpt,width:r,height:a}};if(i.viewData){const{scale:u,...M}=i.viewData.camera;l.cameraOpt={...l.cameraOpt,...M,scale:u===1/0?1:u}}e===((n=this.mainView)==null?void 0:n.id)&&await this.control.activeWorker(),(s=this.control.worker)==null||s.createViewWorker(e,l),i.focusScenePath&&this.control.collector&&this.control.worker.pullServiceData(e,i.focusScenePath)}}listenerWindowManager(e){e.emitter.on("focusedChange",i=>{const n=i||ve.viewId;if(this.focuedViewId!==n)if(this.getView(n)){const r=this.control.worker.getLocalWorkViewId();r&&r!==n?this.setFocuedViewId(r):this.setFocuedViewId(n)}else this.tmpFocusedViewId=n}),e.emitter.on("mainViewScenePathChange",i=>{console.log("ContainerManager mainViewScenePathChange",i),this.control.onSceneChange(i,"mainView")}),e.emitter.on("onMainViewMounted",this.onMainViewMounted),e.emitter.on("onAppViewMounted",this.onAppViewMounted),e.emitter.on("onMainViewRebind",this.onMainViewRelease),e.emitter.on("onBoxClose",i=>{this.appViews.get(i.appId)&&(this.destroyAppView(i.appId),this.control.worker.destroyViewWorker(i.appId))}),e.emitter.on("onAppScenePathChange",i=>{const{appId:n,view:s}=i;this.control.onSceneChange(s.focusScenePath,n)})}onActiveHotkeyChange(e){this.control.hotkeyManager.onActiveHotkey(e)}}class dt extends Ne{constructor(e){super(e);f(this,"windowManager");f(this,"viewContainerManager");const i={control:this,internalMsgEmitter:Ne.InternalMsgEmitter};this.viewContainerManager=new Ce(i)}init(){}destroy(){var e,i,n,s;this.roomMember.destroy(),(e=this.collector)==null||e.destroy(),(i=this.worker)==null||i.destroy(),(n=this.viewContainerManager)==null||n.destroy(),(s=this.cursor)==null||s.destroy()}activePlugin(){this.collector&&(this.collector.addStorageStateListener(e=>{var i,n;if((i=this.collector)!=null&&i.storage&&Object.keys(this.collector.storage).length===0){(n=this.worker)==null||n.clearViewScenePath("mainView",!0);return}if(e){const s=new Map;Object.keys(e).forEach(r=>{var c;const a=e[r];if(a){const l=a.viewId,u=s.get(l)||new Set;u.add(r),s.set(l,u),(c=this.worker)==null||c.onServiceDerive(r,a)}});for(const[r,a]of s.entries())Ne.InternalMsgEmitter.emit("excludeIds",[...a],r)}}),this.room&&this.roomMember.onUidChangeHook(e=>{var i,n,s,r;if((i=this.collector)!=null&&i.serviceStorage){const a=[];this.viewContainerManager.getAllViews().forEach(c=>{var l;if(c&&c.focusScenePath&&((l=this.collector)!=null&&l.serviceStorage[c.id])&&this.collector.serviceStorage[c.id][c.focusScenePath]){const u=Object.keys(this.collector.serviceStorage[c.id][c.focusScenePath]).filter(M=>{var d;return(d=this.collector)==null?void 0:d.isSelector(M)}).map(M=>({viewId:c.id,scenePath:c.focusScenePath,key:M}));u.length&&a.push(...u)}}),a.forEach(({key:c,viewId:l,scenePath:u})=>{var d,g;const M=(d=this.collector)==null?void 0:d.getUidFromKey(c);M&&!e.online.includes(M)&&((g=this.collector)==null||g.updateValue(c,void 0,{isAfterUpdate:!0,viewId:l,scenePath:u}))})}(s=(n=this.cursor)==null?void 0:n.eventCollector)!=null&&s.serviceStorage&&Object.keys((r=this.cursor)==null?void 0:r.eventCollector.serviceStorage).forEach(c=>{var l,u;e.online.includes(c)||(u=(l=this.cursor)==null?void 0:l.eventCollector)==null||u.clearValue(c)})}),this.worker.isActive&&this.viewContainerManager.getAllViews().forEach(e=>{e&&e.focusScenePath&&this.worker.pullServiceData(e.id,e.focusScenePath)}))}async activeWorker(){await this.worker.init()}setWindowManager(e){var i,n,s,r,a;this.windowManager=e,(n=(i=this.windowManager)==null?void 0:i.mainView)!=null&&n.divElement&&this.viewContainerManager.onMainViewMounted(this.windowManager.mainView),(a=(r=(s=this.windowManager.appManager)==null?void 0:s.viewManager)==null?void 0:r.views)!=null&&a.size&&this.windowManager.appManager.viewManager.views.forEach((c,l)=>{this.viewContainerManager.onAppViewMounted({appId:l,view:c})}),this.viewContainerManager.listenerWindowManager(this.windowManager)}}const Bo={syncOpt:{interval:200},canvasOpt:{contextType:Nt.Canvas2d},cdn:{fullWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@1.0.0-beta.2/cdn/fullWorker-O4uzWn.js",subWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@1.0.0-beta.2/cdn/subWorker-CvBoLi.js"}},A=class A extends K.InvisiblePlugin{constructor(){super(...arguments);f(this,"onPhaseChanged",e=>{var i;e===K.RoomPhase.Reconnecting&&((i=A.currentManager)==null||i.setSnapshootData())});f(this,"updateRoomWritable",()=>{var e;(e=A.currentManager)==null||e.onWritableChange(this.displayer.isWritable)});f(this,"roomStateChangeListener",async e=>{var i,n;K.isRoom(this.displayer)&&!this.displayer.isWritable||(e.memberState&&((i=A.currentManager)==null||i.onMemberChange(e.memberState)),e!=null&&e.roomMembers&&((n=A.currentManager)==null||n.onRoomMembersChange(e.roomMembers)))})}static async getInstance(e,i){const n=e.displayer,s=n.callbacks.on,r=n.callbacks.off,a=n.callbacks.once,c=e.cleanCurrentScene,l=e.mainView.setMemberState,u={displayer:n,windowManager:e,currentManager:A.currentManager,maxScreenshotWidth:10*1024,maxScreenshotHeight:10*1024,getBoundingRectAsync:async function(g){var p;A.logger.info("[ApplianceMultiPlugin] getBoundingRectAsync");const v=(this.windowManager&&this.windowManager.mainView||this.displayer).getBoundingRect(g),y=await((p=A.currentManager)==null?void 0:p.getBoundingRect(g));return!v.width||!v.height?y:Oo(v,y)},screenshotToCanvasAsync:async function(g,v,y,p,I,w){var b;A.logger.info("[ApplianceMultiPlugin] screenshotToCanvasAsync");let m=y,T=p,z=I.scale;m>this.maxScreenshotWidth&&(z=this.maxScreenshotWidth/m*z,m=this.maxScreenshotWidth),T>this.maxScreenshotHeight&&(z=Math.min(this.maxScreenshotHeight/T*z,z),T=this.maxScreenshotHeight),I.scale=z;const j=document.createElement("canvas"),E=j.getContext("2d");j.width=m*(w||1),j.height=T*(w||1),E&&((this.windowManager&&this.windowManager.mainView||this.displayer).screenshotToCanvas(E,v,m,T,I,w),g.drawImage(j,Math.floor((y-m)/2),Math.floor((p-T)/2),m*(w||1),T*(w||1),0,0,m,T),j.remove()),A.currentManager&&await((b=A.currentManager)==null?void 0:b.screenshotToCanvas(g,v,m,T,I,Math.floor((y-m)/2),Math.floor((p-T)/2)))},scenePreviewAsync:async function(g,v,y,p,I){A.logger.info("[ApplianceMultiPlugin] scenePreview"),(this.windowManager&&this.windowManager.mainView||this.displayer).scenePreview(g,v,y,p,I);const w=document.createElement("img");w.style.position="absolute",w.style.top="0px",w.style.left="0px",w.style.width="100%",w.style.height="100%",w.style.pointerEvents="none",v.append(w),getComputedStyle(v).position||(v.style.position="relative"),A.currentManager&&await A.currentManager.scenePreview(g,w)},_callbacksOn:function(g,v){A.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`),(g==="onCanUndoStepsUpdate"||g==="onCanRedoStepsUpdate")&&K.isRoom(this.displayer)&&this.displayer.isWritable?dt.InternalMsgEmitter.on(g,v):s.call(n.callbacks,g,v)},_callbacksOnce:function(g,v){A.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`),(g==="onCanUndoStepsUpdate"||g==="onCanRedoStepsUpdate")&&K.isRoom(this.displayer)&&this.displayer.isWritable?dt.InternalMsgEmitter.on(g,v):a.call(n.callbacks,g,v)},_callbacksOff:function(g,v){A.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`),(g==="onCanUndoStepsUpdate"||g==="onCanRedoStepsUpdate")&&K.isRoom(this.displayer)&&this.displayer.isWritable?dt.InternalMsgEmitter.off(g,v):r.call(n.callbacks,g,v)},undo:function(){return A.logger.info("[ApplianceMultiPlugin] undo"),A.currentManager&&K.isRoom(this.displayer)&&!this.displayer.disableSerialization?A.currentManager.viewContainerManager.undo():0},redo:function(){return A.logger.info("[ApplianceMultiPlugin] redo"),A.currentManager&&K.isRoom(this.displayer)&&!this.displayer.disableSerialization?A.currentManager.viewContainerManager.redo():0},cleanCurrentScene:function(){A.logger.info("[ApplianceMultiPlugin] cleanCurrentScene"),A.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&(A.currentManager.cleanCurrentScene(),c.call(e))},insertImage:function(g){A.logger.info("[ApplianceMultiPlugin] insertImage"),A.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&A.currentManager.worker.insertImage(g)},lockImage:function(g,v){A.logger.info("[ApplianceMultiPlugin] lockImage"),A.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&A.currentManager.worker.lockImage(g,v)},completeImageUpload:function(g,v){A.logger.info("[ApplianceMultiPlugin] completeImageUpload"),A.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&A.currentManager.worker.completeImageUpload(g,v)},getImagesInformation:function(g){return A.logger.info("[ApplianceMultiPlugin] completeImageUpload"),A.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable?A.currentManager.worker.getImagesInformation(g):[]},callbacks:()=>(A.logger.info("[ApplianceMultiPlugin] callbacks bind"),{...n.callbacks,on:u._callbacksOn.bind(u),once:u._callbacksOnce.bind(u),off:u._callbacksOff.bind(u)}),destroy(){A.currentManager&&(A.logger.info("[ApplianceMultiPlugin] destroy"),A.currentManager.destroy(),A.currentManager=void 0)},setMemberState(g){A.logger.info("[ApplianceMultiPlugin] setMemberState"),Object.keys(g).includes("currentApplianceName")&&(g.currentApplianceName&&g.currentApplianceName===V.laserPen?(g.currentApplianceName=V.pencil,g.useLaserPen=!0):g.currentApplianceName&&g.currentApplianceName===V.pencil&&(g.useLaserPen=!1)),l.call(e.mainView,g)}};i!=null&&i.logger&&(A.logger=i.logger),i.options&&(A.options=i.options);let M=n.getInvisiblePlugin(A.kind);n&&M&&A.createCurrentManager(e,A.options,M),!M&&K.isRoom(n)&&(M=await A.createApplianceMultiPlugin(n,A.kind)),M&&A.currentManager&&(A.currentManager.bindPlugin(M),M.init(n));const d=(g,v)=>{if(A.logger.info(`[ApplianceMultiPlugin] injectMethodToObject ${v}`),typeof g[v]=="function"||typeof g[v]>"u"){g[v]=u[v];return}v==="callbacks"&&(g.callbacks.on=u._callbacksOn.bind(u),g.callbacks.off=u._callbacksOff.bind(u),g.callbacks.once=u._callbacksOnce.bind(u))};return d(e,"undo"),d(e,"redo"),d(e,"cleanCurrentScene"),d(e,"insertImage"),d(e,"completeImageUpload"),d(e,"lockImage"),d(n,"getImagesInformation"),d(n,"callbacks"),d(n,"screenshotToCanvasAsync"),d(n,"getBoundingRectAsync"),d(n,"scenePreviewAsync"),d(e.mainView,"setMemberState"),{...u,callbacks:u.callbacks()}}static onCreate(e){e&&A.currentManager&&(A.currentManager.bindPlugin(e),e.init(e.displayer))}static async createApplianceMultiPlugin(e,i){await e.createInvisiblePlugin(A,{});let n=e.getInvisiblePlugin(i);return n||(n=await A.createApplianceMultiPlugin(e,i)),n}get isReplay(){return K.isPlayer(this.displayer)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}init(e){var i,n;if(K.isRoom(e)){const s=e.state;(i=A.currentManager)==null||i.onMemberChange(s.memberState),(n=A.currentManager)==null||n.onRoomMembersChange(s.roomMembers)}this.displayer.callbacks.on(this.callbackName,this.roomStateChangeListener),this.displayer.callbacks.on("onEnableWriteNowChanged",this.updateRoomWritable),this.displayer.callbacks.on("onPhaseChanged",this.onPhaseChanged)}destroy(){var e;A.logger.info("[ApplianceMultiPlugin] passive destroy"),(e=A.currentManager)==null||e.destroy(),A.currentManager=void 0}};f(A,"kind","appliance-multi-plugin"),f(A,"currentManager"),f(A,"logger",{info:console.log,warn:console.warn,error:console.error}),f(A,"options",Bo),f(A,"createCurrentManager",(e,i,n)=>{if(A.currentManager&&A.currentManager.destroy(),i&&e){const s={plugin:n,displayer:e.displayer,options:i},r=new dt(s);A.logger.info("[ApplianceMultiPlugin] refresh ApplianceMultiManager object"),r.setWindowManager(e),A.currentManager=r}});let Qt=A;class of extends ve{constructor(e,i){super(e,i);f(this,"width",1e3);f(this,"height",1e3);f(this,"dpr",1);f(this,"vDom");f(this,"viewId","mainView");f(this,"eventTragetElement");f(this,"snapshotContainerRef");f(this,"canvasContainerRef",h.createRef());f(this,"canvasTopRef",h.createRef());f(this,"canvasServiceFloatRef",h.createRef());f(this,"canvasFloatRef",h.createRef());f(this,"canvasBgRef",h.createRef());f(this,"floatBarRef",h.createRef());f(this,"containerOffset",{x:0,y:0});this.control.hasOffscreenCanvas()||(this.snapshotContainerRef=h.createRef())}setCanvassStyle(){if(this.eventTragetElement){const e=this.eventTragetElement.offsetWidth,i=this.eventTragetElement.offsetHeight;e&&i&&this.canvasContainerRef.current&&(this.dpr=Pe(),this.canvasContainerRef.current.style.width=`${e}px`,this.canvasContainerRef.current.style.height=`${i}px`),e&&i&&this.canvasContainerRef.current&&(this.dpr=Pe(),this.width=e,this.height=i,this.canvasContainerRef.current.style.width=`${e}px`,this.canvasContainerRef.current.style.height=`${i}px`),e&&i&&this.canvasBgRef.current&&(this.dpr=Pe(this.canvasBgRef.current.getContext("2d")),this.width=e,this.height=i,this.canvasBgRef.current.style.width=`${e}px`,this.canvasBgRef.current.style.height=`${i}px`,this.canvasBgRef.current.width=e*this.dpr,this.canvasBgRef.current.height=i*this.dpr,this.canvasFloatRef.current&&(this.canvasFloatRef.current.style.width=`${e}px`,this.canvasFloatRef.current.style.height=`${i}px`,this.canvasFloatRef.current.width=e*this.dpr,this.canvasFloatRef.current.height=i*this.dpr),this.canvasServiceFloatRef.current&&(this.canvasServiceFloatRef.current.style.width=`${e}px`,this.canvasServiceFloatRef.current.style.height=`${i}px`,this.canvasServiceFloatRef.current.width=e*this.dpr,this.canvasServiceFloatRef.current.height=i*this.dpr),this.canvasTopRef.current&&(this.canvasTopRef.current.style.width=`${e}px`,this.canvasTopRef.current.style.height=`${i}px`,this.canvasTopRef.current.width=e*this.dpr,this.canvasTopRef.current.height=i*this.dpr))}}createMainViewDisplayer(e){return this.vDom||(this.containerOffset=this.getContainerOffset(e,this.containerOffset),this.eventTragetElement=e.parentElement.children[0],e.innerHTML="",Vt.render(h.createElement(li,{viewId:this.viewId,maranger:this,refs:{canvasServiceFloatRef:this.canvasServiceFloatRef,canvasFloatRef:this.canvasFloatRef,canvasBgRef:this.canvasBgRef,floatBarRef:this.floatBarRef,canvasTopRef:this.canvasTopRef,canvasContainerRef:this.canvasContainerRef,snapshotContainerRef:this.snapshotContainerRef}}),e),this.control.room&&this.bindDisplayerEvent(this.eventTragetElement)),this}}class Ye extends Ke{constructor(e){super(e);f(this,"focuedViewId");f(this,"control");f(this,"focuedView");this.control=e.control}bindMainView(){if(!this.control.divMainView)return;const e=new of(this.control,Ne.InternalMsgEmitter);this.focuedViewId=ve.viewId;const{width:i,height:n,dpr:s}=e,r={dpr:s,originalPoint:[i/2,n/2],offscreenCanvasOpt:{...Ye.defaultScreenCanvasOpt,width:i,height:n},layerOpt:{...Ye.defaultLayerOpt,width:i,height:n},cameraOpt:{...Ye.defaultCameraOpt,width:i,height:n}},a=this.control.room&&this.control.room.mainView||this.control.play&&this.control.play.mainView;if(a){const{scale:c,...l}=a.camera;r.cameraOpt={...r.cameraOpt,...l,scale:c===1/0?1:c},this.createMianView({id:ve.viewId,displayer:e,focusScenePath:a.focusScenePath||a.scenePath,cameraOpt:r.cameraOpt,viewData:a}),this.focuedView=this.mainView,e.createMainViewDisplayer(this.control.divMainView)}}async mountView(e){var n;const i=this.getView(e);if(i){const{width:s,height:r,dpr:a}=i.displayer,c={dpr:a,originalPoint:[s/2,r/2],offscreenCanvasOpt:{...Ye.defaultScreenCanvasOpt,width:s,height:r},layerOpt:{...Ye.defaultLayerOpt,width:s,height:r},cameraOpt:{...Ye.defaultCameraOpt,width:s,height:r}};if(i.viewData){const{scale:l,...u}=i.viewData.camera;c.cameraOpt={...c.cameraOpt,...u,scale:l===1/0?1:l}}this.control.worker.isActive||await this.control.activeWorker(),(n=this.control.worker)==null||n.createViewWorker(e,c),i.focusScenePath&&this.control.collector&&this.control.worker.pullServiceData(e,i.focusScenePath)}}}class Le extends Ne{constructor(e){super(e);f(this,"viewContainerManager");f(this,"divMainView");f(this,"onCameraChange",Ie(e=>{this.viewContainerManager.setFocuedViewCameraOpt(e)},20,{leading:!1}));const i={control:this,internalMsgEmitter:Le.InternalMsgEmitter};this.viewContainerManager=new Ye(i)}init(){Le.InternalMsgEmitter.on($.BindMainView,e=>{this.divMainView=e,this.plugin&&!this.viewContainerManager.mainView&&this.viewContainerManager.bindMainView()})}activePlugin(){this.plugin&&this.divMainView&&!this.viewContainerManager.mainView&&this.viewContainerManager.bindMainView(),this.collector&&(this.collector.addStorageStateListener(e=>{var i,n;if((i=this.collector)!=null&&i.storage&&Object.keys(this.collector.storage).length===0){(n=this.worker)==null||n.clearViewScenePath("mainView",!0);return}if(e){const s=new Map;Object.keys(e).forEach(r=>{var c;const a=e[r];if(a){const l=a.viewId,u=s.get(l)||new Set;u.add(r),s.set(l,u),(c=this.worker)==null||c.onServiceDerive(r,a)}});for(const[r,a]of s.entries())Le.InternalMsgEmitter.emit("excludeIds",[...a],r)}}),this.room&&(this.roomMember.onUidChangeHook(e=>{var i,n,s,r;if((i=this.collector)!=null&&i.serviceStorage){const a=[];this.viewContainerManager.getAllViews().forEach(c=>{var l,u,M;if(c&&c.focusScenePath&&((l=this.collector)!=null&&l.serviceStorage[c.id])&&((u=this.collector)!=null&&u.serviceStorage[c.id][c.focusScenePath])){const d=Object.keys((M=this.collector)==null?void 0:M.serviceStorage[c.id][c.focusScenePath]).filter(g=>{var v;return(v=this.collector)==null?void 0:v.isSelector(g)}).map(g=>({viewId:c.id,scenePath:c.focusScenePath,key:g}));d.length&&a.push(...d)}}),a.forEach(({key:c,viewId:l,scenePath:u})=>{var d,g;const M=(d=this.collector)==null?void 0:d.getUidFromKey(c);M&&!e.online.includes(M)&&((g=this.collector)==null||g.updateValue(c,void 0,{isAfterUpdate:!0,viewId:l,scenePath:u}))})}(s=(n=this.cursor)==null?void 0:n.eventCollector)!=null&&s.serviceStorage&&Object.keys((r=this.cursor)==null?void 0:r.eventCollector.serviceStorage).forEach(c=>{var l,u;e.online.includes(c)||(u=(l=this.cursor)==null?void 0:l.eventCollector)==null||u.clearValue(c)})}),this.worker.isActive&&this.viewContainerManager.getAllViews().forEach(e=>{e&&e.focusScenePath&&this.worker.pullServiceData(e.id,e.focusScenePath)})))}async activeWorker(){await this.worker.init()}}const L=class L extends K.InvisiblePlugin{constructor(){super(...arguments);f(this,"updateRoomWritable",()=>{var e;(e=L.currentManager)==null||e.onWritableChange(this.displayer.isWritable)});f(this,"roomStateChangeListener",async e=>{var i,n;L.currentManager instanceof Le&&(e.cameraState&&L.currentManager.onCameraChange(e.cameraState),e.sceneState&&L.currentManager.onSceneChange(e.sceneState.scenePath,"mainView")),!(K.isRoom(this.displayer)&&!this.displayer.isWritable)&&(e.memberState&&((i=L.currentManager)==null||i.onMemberChange(e.memberState)),e!=null&&e.roomMembers&&((n=L.currentManager)==null||n.onRoomMembersChange(e.roomMembers)))})}static async getInstance(e,i){const n=e.callbacks.on,s=e.callbacks.off,r=e.callbacks.once,a=e.cleanCurrentScene,c=e.setMemberState,l={displayer:e,currentManager:L.currentManager,maxScreenshotWidth:10*1024,maxScreenshotHeight:10*1024,_injectTargetObject:void 0,getBoundingRectAsync:async function(d){var y;L.logger.info("[ApplianceSinglePlugin] getBoundingRectAsync");const g=this.displayer.getBoundingRect(d),v=await((y=L.currentManager)==null?void 0:y.getBoundingRect(d));return!g.width||!g.height?v:Oo(g,v)},screenshotToCanvasAsync:async function(d,g,v,y,p,I){var E;L.logger.info("[ApplianceSinglePlugin] screenshotToCanvasAsync");let w=v,m=y,T=p.scale;w>this.maxScreenshotWidth&&(T=this.maxScreenshotWidth/w*T,w=this.maxScreenshotWidth),m>this.maxScreenshotHeight&&(T=Math.min(this.maxScreenshotHeight/m*T,T),m=this.maxScreenshotHeight),p.scale=T;const z=document.createElement("canvas"),j=z.getContext("2d");z.width=w*(I||1),z.height=m*(I||1),j&&(this.displayer.screenshotToCanvas(j,g,w,m,p,I),d.drawImage(z,Math.floor((v-w)/2),Math.floor((y-m)/2),w*(I||1),m*(I||1),0,0,w,m),z.remove()),L.currentManager&&await((E=L.currentManager)==null?void 0:E.screenshotToCanvas(d,g,w,m,p,Math.floor((v-w)/2),Math.floor((y-m)/2)))},scenePreviewAsync:async function(d,g,v,y,p){L.logger.info("[ApplianceSinglePlugin] scenePreview"),this.displayer.scenePreview(d,g,v,y,p);const I=document.createElement("img");I.style.position="absolute",I.style.top="0px",I.style.left="0px",I.style.width="100%",I.style.height="100%",I.style.pointerEvents="none",g.append(I),getComputedStyle(g).position||(g.style.position="relative"),L.currentManager&&await L.currentManager.scenePreview(d,I)},_callbacksOn:function(d,g){L.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`),(d==="onCanUndoStepsUpdate"||d==="onCanRedoStepsUpdate")&&K.isRoom(this.displayer)&&this.displayer.isWritable?Le.InternalMsgEmitter.on(d,g):n.call(e.callbacks,d,g)},_callbacksOnce:function(d,g){L.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`),(d==="onCanUndoStepsUpdate"||d==="onCanRedoStepsUpdate")&&K.isRoom(this.displayer)&&this.displayer.isWritable?Le.InternalMsgEmitter.on(d,g):r.call(e.callbacks,d,g)},_callbacksOff:function(d,g){L.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`),(d==="onCanUndoStepsUpdate"||d==="onCanRedoStepsUpdate")&&K.isRoom(this.displayer)&&this.displayer.isWritable?Le.InternalMsgEmitter.off(d,g):s.call(e.callbacks,d,g)},undo:function(){return L.logger.info("[ApplianceSinglePlugin] undo"),L.currentManager&&K.isRoom(this.displayer)&&!this.displayer.disableSerialization?L.currentManager.viewContainerManager.undo():0},redo:function(){return L.logger.info("[ApplianceSinglePlugin] redo"),L.currentManager&&K.isRoom(this.displayer)&&!this.displayer.disableSerialization?L.currentManager.viewContainerManager.redo():0},cleanCurrentScene:function(d){L.logger.info("[ApplianceSinglePlugin] cleanCurrentScene"),L.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&(L.currentManager.cleanCurrentScene(),a.call(e,d))},insertImage:function(d){L.logger.info("[ApplianceSinglePlugin] insertImage"),L.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&L.currentManager.worker.insertImage(d)},lockImage:function(d,g){L.logger.info("[ApplianceSinglePlugin] lockImage"),L.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&L.currentManager.worker.lockImage(d,g)},completeImageUpload:function(d,g){L.logger.info("[ApplianceSinglePlugin] completeImageUpload"),L.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable&&L.currentManager.worker.completeImageUpload(d,g)},getImagesInformation:function(d){return L.logger.info("[ApplianceSinglePlugin] completeImageUpload"),L.currentManager&&K.isRoom(this.displayer)&&this.displayer.isWritable?L.currentManager.worker.getImagesInformation(d):[]},callbacks:()=>({...e.callbacks,on:l._callbacksOn.bind(l),once:l._callbacksOnce.bind(l),off:l._callbacksOff.bind(l)}),destroy(){L.currentManager&&(L.logger.info("[ApplianceSinglePlugin] destroy"),L.currentManager.destroy(),L.currentManager=void 0,L.cursorAdapter=void 0)},setMemberState(d){L.logger.info("[ApplianceSinglePlugin] setMemberState"),Object.keys(d).includes("currentApplianceName")&&(d.currentApplianceName&&d.currentApplianceName===V.laserPen&&(d.currentApplianceName=V.pencil,d.useLaserPen=!0),d.currentApplianceName&&d.currentApplianceName===V.pencil&&(d.useLaserPen=!1)),c(d)}};i!=null&&i.logger&&(L.logger=i.logger),i.options&&(L.options=i.options);let u=e.getInvisiblePlugin(L.kind);e&&u&&L.createCurrentManager(e,L.options,u),!u&&K.isRoom(e)&&(u=await L.createAppliancePlugin(e,L.kind)),u&&L.currentManager&&(L.currentManager.bindPlugin(u),u.init(e)),i!=null&&i.cursorAdapter&&(L.cursorAdapter=i.cursorAdapter),L.effectInstance();const M=(d,g)=>{if(L.logger.info(`[ApplianceSinglePlugin] injectMethodToObject ${g}`),typeof d[g]=="function"||typeof d[g]>"u"){d[g]=l[g];return}g==="callbacks"&&(d.callbacks.on=l._callbacksOn.bind(l),d.callbacks.off=l._callbacksOff.bind(l),d.callbacks.once=l._callbacksOnce.bind(l))};return M(e,"undo"),M(e,"redo"),M(e,"cleanCurrentScene"),M(e,"insertImage"),M(e,"completeImageUpload"),M(e,"lockImage"),M(e,"getImagesInformation"),M(e,"callbacks"),M(e,"screenshotToCanvasAsync"),M(e,"getBoundingRectAsync"),M(e,"scenePreviewAsync"),M(e,"setMemberState"),{...l,callbacks:l.callbacks()}}static onCreate(e){e&&L.currentManager&&(L.currentManager.bindPlugin(e),e.init(e.displayer))}static async createAppliancePlugin(e,i){await e.createInvisiblePlugin(L,{});let n=e.getInvisiblePlugin(i);return n||(n=await L.createAppliancePlugin(e,i)),n}static effectInstance(){if(L.cursorAdapter){const e=L.cursorAdapter.onAddedCursor;L.cursorAdapter.onAddedCursor=function(i){i.onCursorMemberChanged=n=>{try{n.appliance===V.pencil||n.appliance===V.shape||n.appliance===V.text||n.appliance===V.arrow||n.appliance===V.straight||n.appliance===V.rectangle||n.appliance===V.ellipse?i!=null&&i.divElement&&(i.divElement.style.display="none"):i!=null&&i.divElement&&(i.divElement.style.display="block")}catch{}},e.call(L.cursorAdapter,i)}}}get isReplay(){return K.isPlayer(this.displayer)}get callbackName(){return this.isReplay?"onPlayerStateChanged":"onRoomStateChanged"}init(e){var i;if(K.isRoom(e)){const n=e.state;n!=null&&n.memberState&&((i=L.currentManager)==null||i.onMemberChange(n.memberState))}this.displayer.callbacks.on(this.callbackName,this.roomStateChangeListener),this.displayer.callbacks.on("onEnableWriteNowChanged",this.updateRoomWritable)}destroy(){var e;L.logger.info("[ApplianceSinglePlugin] passive destroy"),(e=L.currentManager)==null||e.destroy(),L.currentManager=void 0,L.cursorAdapter=void 0}};f(L,"kind","teaching-aids-single-plugin"),f(L,"cursorAdapter"),f(L,"currentManager"),f(L,"logger",{info:console.log,warn:console.warn,error:console.error}),f(L,"options",Bo),f(L,"createCurrentManager",(e,i,n)=>{L.currentManager&&L.currentManager.destroy();const s={plugin:n,displayer:e,options:i},r=new Le(s);r.init(),L.logger.info("[ApplianceSinglePlugin] refresh ApplianceSingleManager object"),L.currentManager=r});let Ht=L;const Be=class Be extends h.Component{constructor(){super(...arguments);f(this,"mainViewRef",null)}componentDidMount(){Be.emiter||(Be.emiter=Le.InternalMsgEmitter),Be.emiter.emit($.BindMainView,this.mainViewRef)}componentWillUnmount(){Be.emiter.emit($.DisplayState,Gt.unmounted)}render(){return h.createElement(h.Fragment,null,this.props.children,h.createElement("div",{className:"teaching-aids-plugin-main-view-displayer",ref:e=>this.mainViewRef=e}))}};f(Be,"emiter");let Zt=Be;exports.ActiveContainerType=io;exports.ApplianceMultiPlugin=Qt;exports.ApplianceNames=V;exports.ApplianceSigleWrapper=Zt;exports.ApplianceSinglePlugin=Ht;exports.DisplayStateEnum=Gt;exports.ECanvasContextType=Nt;exports.ECanvasShowType=De;exports.EDataType=G;exports.EPostMessageType=D;exports.EScaleType=ge;exports.EStrokeType=Mt;exports.EToolsKey=N;exports.ElayerType=Fe;exports.EmitEventType=x;exports.EventMessageType=Qe;exports.EvevtWorkState=C;exports.InternalMsgEmitterType=$;exports.Point2d=ie;exports.ShapeType=ze;exports.Storage_Selector_key=k;exports.Storage_Splitter=je;exports.Storage_ViewId_ALL=Ao;exports.Vec2d=S;exports.ViewContainerManager=Ke;exports.average=Zg;exports.cloneDeep=re;exports.computRect=Pg;exports.fullWorker=Zo;exports.getRectFromPoints=si;exports.getRectRotated=Ug;exports.getRectScaleed=$g;exports.getRectTranslated=Wg;exports.getWHRatio=Qg;exports.isBoolean=we;exports.isEqual=ce;exports.isIntersect=Rg;exports.isIntersectForPoint=Yo;exports.isNumber=ae;exports.precise=Hg;exports.rotatePoints=Bg;exports.scalePoints=Fg;exports.subWorker=Vo;exports.throttle=Ie;exports.transformToNormalData=Lo;exports.transformToSerializableData=ko;